Previous 15994 Revisions Next

r2865 Tuesday 17th June, 2008 at 22:46:34 UTC by Nathan Woods
Updated to MAME 0.125u6 core
[docs]messnew.txt
[src/emu]emuopts.c emuopts.h inptport.c render.h rendersw.c ui.c video.c video.h
[src/emu/audio]generic.c generic.h
[src/emu/cpu]cpu.mak drcbec.c drcbex64.c drcbex86.c drcuml.c vtlb.c* vtlb.h*
[src/emu/cpu/cop400]cop420ds.c
[src/emu/cpu/mips]mips3.c mips3com.c mips3com.h mips3drc.c mips3fe.c
[src/emu/cpu/powerpc]ppccom.c ppccom.h ppcdrc.c
[src/emu/debug]debugcmd.c
[src/mame]mamedriv.c
[src/mame/audio]atarijsa.c atarijsa.h dcs.c harddriv.c
[src/mame/drivers]aleck64.c armedf.c atarig1.c atarig42.c atarigx2.c atarisy1.c atarisy2.c ataxx.c atetris.c bagman.c batman.c beathead.c blstroid.c bnstars.c cps1.c crystal.c cshooter.c cyberbal.c darius.c darkhors.c dcheese.c ddenlovr.c ddragon3.c dec0.c dec8.c deco156.c deco32.c deco_mlc.c decocass.c dietgo.c dynax.c embargo.c enigma2.c eolith.c eolith16.c eprom.c equites.c ertictac.c ettrivia.c exerion.c exidy440.c exprraid.c exterm.c f-32.c fantland.c fcombat.c fgoal.c filetto.c findout.c firebeat.c firetrap.c flkatck.c flstory.c flyball.c foodf.c freekick.c fromanc2.c fromance.c funkybee.c funkyjet.c fuukifg3.c gaelco2.c galaxold.c galpani3.c gamecstl.c gameplan.c gaplus.c gauntlet.c gcpinbal.c genesis.c getrivia.c gijoe.c goal92.c gomoku.c goodejan.c gottlieb.c gpworld.c grchamp.c gridlee.c groundfx.c gstriker.c gsword.c gticlub.c guab.c gunbustr.c gundealr.c hal21.c halleys.c hanaawas.c harddriv.c hitme.c hnayayoi.c homedata.c homerun.c hornet.c hshavoc.c igs_blit.c imolagp.c inufuku.c irobot.c itech32.c itech8.c jack.c jackal.c jalmah.c jchan.c jcross.c jedi.c kaneko16.c karnov.c kinst.c kinstb.c klax.c koikoi.c konamigv.c konamigx.c kopunch.c ksys573.c laserbat.c lastfght.c lazercmd.c leland.c lemmings.c lethal.c lethalj.c liberate.c liberatr.c limenko.c littlerb.c looping.c lordgun.c lsasquad.c lvcards.c m92.c mediagx.c megadriv.c megaplay.c megatech.c midvunit.c midzeus.c missb2.c model1.c model2.c ms32.c namcos1.c namcos21.c namcos22.c namcos23.c neogeo.c ninjaw.c nss.c offtwall.c onetwo.c overdriv.c pktgaldx.c pokechmp.c puckpkmn.c pushman.c raiden.c rampart.c rohga.c sbrkout.c seattle.c segac2.c segae.c segae.h segaorun.c segas16a.c segas16b.c segas18.c segas24.c segaxbd.c skullxbo.c sprint8.c srmp6.c starwars.c stv.c system16.c system18.c taito_z.c taitowlf.c tank8.c tecmosys.c thunderj.c timelimt.c toobin.c topshoot.c topspeed.c triplhnt.c vegas.c vindictr.c wgp.c wilytowr.c xexex.c xybots.c
[src/mame/includes]dcheese.h dec0.h genesis.h gstriker.h itech32.h n64.h namcos1.h neogeo.h slapstic.h sprint8.h tank8.h triplhnt.h
[src/mame/machine]asic65.c asic65.h atarigen.c atarigen.h balsente.c cps2crpt.c dec0.c decocass.c decoprot.c fd1089.c fd1089.h fddebug.c gaelco2.c galaxold.c gaplus.c harddriv.c irobot.c kaneko16.c konamigx.c konamigx.h konppc.c leland.c lsasquad.c midwayic.c midwayic.h midwunit.c model3.c n64.c namco50.c namco50.h namcoio.c namcos1.c pckeybrd.c pckeybrd.h pcshare.c pcshare.h rainbow.c s16fd.c s24fd.c scudsp.c scudsp.h segaic16.c slapstic.c snes.c toaplan1.c vertigo.c
[src/mame/video]atari.c atarirle.c cps1.c dcheese.c decocass.c exidy440.c fgoal.c gstriker.c irobot.c itech32.c itech8.c konamigx.c lazercmd.c lethal.c lethalj.c lordgun.c m92.c mystwarr.c n64.c neogeo.c raiden.c rockola.c snes.c sprint8.c stvvdp2.c tank8.c triplhnt.c victory.c
[src/mess/drivers]ip22.c n64.c pcw16.c saturn.c
[src/mess/machine]pc.c
[src/mess/osd/windows]tapedlg.c
[src/mess/tools/messtest]testmess.c
[src/osd/windows]drawgdi.c window.c

src/mame/audio/atarijsa.c
r2864r2865
5050static UINT8 last_ctl;
5151
5252static int cpu_num;
53static UINT8 test_port;
53static const char *test_port;
5454static UINT16 test_mask;
5555
5656static UINT8 has_pokey;
r2864r2865
104104 *
105105 *************************************/
106106
107void atarijsa_init(running_machine *machine, int testport, int testmask)
107void atarijsa_init(running_machine *machine, const char *testport, int testmask)
108108{
109109   int i;
110110   UINT8 *rgn;
r2864r2865
221221                0x01 = coin 1
222222            */
223223         result = input_port_read(machine, "JSAI");
224         if (!(input_port_read_indexed(machine, test_port) & test_mask)) result ^= 0x80;
224         if (!(input_port_read(machine, test_port) & test_mask)) result ^= 0x80;
225225         if (atarigen_cpu_to_sound_ready) result ^= 0x40;
226226         if (atarigen_sound_to_cpu_ready) result ^= 0x20;
227227         if (!has_tms5220 || tms5220_ready_r()) result ^= 0x10;
r2864r2865
348348                0x01 = coin 1
349349            */
350350         result = input_port_read(machine, "JSAII");
351         if (!(input_port_read_indexed(machine, test_port) & test_mask)) result ^= 0x80;
351         if (!(input_port_read(machine, test_port) & test_mask)) result ^= 0x80;
352352         if (atarigen_cpu_to_sound_ready) result ^= 0x40;
353353         if (atarigen_sound_to_cpu_ready) result ^= 0x20;
354354         break;
r2864r2865
467467                0x01 = coin R (active high)
468468            */
469469         result = input_port_read(machine, "JSAIII");
470         if (!(input_port_read_indexed(machine, test_port) & test_mask)) result ^= 0x90;
470         if (!(input_port_read(machine, test_port) & test_mask)) result ^= 0x90;
471471         if (atarigen_cpu_to_sound_ready) result ^= 0x40;
472472         if (atarigen_sound_to_cpu_ready) result ^= 0x20;
473473         break;
r2864r2865
604604                0x01 = coin R (active high)
605605            */
606606         result = input_port_read(machine, "JSAIII");
607         if (!(input_port_read_indexed(machine, test_port) & test_mask)) result ^= 0x90;
607         if (!(input_port_read(machine, test_port) & test_mask)) result ^= 0x90;
608608         if (atarigen_cpu_to_sound_ready) result ^= 0x40;
609609         if (atarigen_sound_to_cpu_ready) result ^= 0x20;
610610         break;
src/mame/audio/atarijsa.h
r2864r2865
55****************************************************************************/
66
77
8void atarijsa_init(running_machine *machine, int testport, int testmask);
8void atarijsa_init(running_machine *machine, const char *testport, int testmask);
99void atarijsa3_init_adpcm(int region);
1010void atarijsa_reset(void);
1111
src/mame/audio/harddriv.c
r2864r2865
178178//            D13 = Test Switch
179179//            D12 = 5220 Ready Flag (0=Ready)
180180   logerror("%06X:hdsnd68k_status_r(%04X)\n", activecpu_get_previouspc(), offset);
181   return (mainflag << 15) | (soundflag << 14) | 0x2000 | 0;//((input_port_read_indexed(machine, 0) & 0x0020) << 8) | 0;
181   return (mainflag << 15) | (soundflag << 14) | 0x2000 | 0;//((input_port_read(machine, "IN0") & 0x0020) << 8) | 0;
182182}
183183
184184
src/mame/audio/dcs.c
r2864r2865
13011301         dmadac_enable(0, dcs.channels, DSIO_MUTE);
13021302
13031303         /* bit 0 resets the FIFO */
1304         midway_ioasic_fifo_reset_w(DSIO_EMPTY_FIFO ^ 1);
1304         midway_ioasic_fifo_reset_w(machine, DSIO_EMPTY_FIFO ^ 1);
13051305         break;
13061306
13071307      /* offset 2 controls RAM pages */
r2864r2865
13721372
13731373      /* offset 3 controls FIFO reset */
13741374      case 3:
1375         midway_ioasic_fifo_reset_w(1);
1375         midway_ioasic_fifo_reset_w(machine, 1);
13761376         break;
13771377   }
13781378}
src/mame/machine/rainbow.c
r2864r2865
4848*************************************************************************/
4949
5050#include "driver.h"
51#include "deprecat.h"
5251#include "includes/cchip.h"
5352
5453static UINT8* CRAM[8];
r2864r2865
714713   }
715714}
716715
717static void request_goalin_data(void)
716static void request_goalin_data(running_machine *machine)
718717{
719   int n = mame_rand(Machine) % 15;
718   int n = mame_rand(machine) % 15;
720719
721720   CRAM[1][0x14B] = 0x00; /* x coordinates */
722721   CRAM[1][0x14D] = 0x10;
r2864r2865
751750
752751   if (CRAM[1][0x149] == 1)
753752   {
754      request_goalin_data();
753      request_goalin_data(machine);
755754
756755      CRAM[1][0x149] = 0xFF;
757756   }
src/mame/machine/scudsp.c
r2864r2865
5050
5151******************************************************************************************/
5252#include "driver.h"
53#include "deprecat.h"
5453#include "machine/scudsp.h"
5554#include "osd_cpu.h"
5655#include "sound/scsp.h"
r2864r2865
314313   return 0;
315314}
316315
317void dsp_prg_ctrl(UINT32 data)
316void dsp_prg_ctrl(running_machine *machine, UINT32 data)
318317{
319318   if(LEF) dsp_reg.pc = (data & 0xff);
320319   if(EXF) dsp_execute_program();
321320   if(EF && (!(stv_scu[40] & 0x0020)))
322      cpunum_set_input_line_and_vector(Machine, 0, 0xa, HOLD_LINE , 0x45);
321      cpunum_set_input_line_and_vector(machine, 0, 0xa, HOLD_LINE , 0x45);
323322}
324323
325324void dsp_prg_data(UINT32 data)
src/mame/machine/scudsp.h
r2864r2865
11/*SCU DSP stuff*/
22
3extern void dsp_prg_ctrl(UINT32 data);
3extern void dsp_prg_ctrl(running_machine *machine, UINT32 data);
44extern void dsp_prg_data(UINT32 data);
55extern void dsp_ram_addr_ctrl(UINT32 data);
66extern void dsp_ram_addr_w(UINT32 data);
src/mame/machine/fd1089.c
r2864r2865
11161116
11171117
11181118/* 317-???? FD1089A */
1119static const UINT8 key_alexkidd[0x2000] =
1119static const UINT8 key_0021[0x2000] =
11201120{
11211121   /* data */
11221122   0x2b,0xe7,0x6e,0x6f,0x8b,0xcd,0xd8,0x4a,0x23,0x8e,0x30,0x97,0x93,0xe4,0x9b,0x92,
r2864r2865
68456845    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
68466846};
68476847
6848/* 317-xxxx FD1089A - Partial table. */
6849static UINT8 key_wb35[0x2000] =
6850{
6851   /* data */
6852   0x54,0x36,0xF5,0x8c,0x1a,0xe3,0x2f,0x3a,0x90,0x09,0x3e,0xde,0x33,0x8f,0x63,0x02,
6853   0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
6854    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6855    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6856    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6857    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6858    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6859    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6860    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6861    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6862    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6863    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6864    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6865    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6866    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6867    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6868    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6869    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6870    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6871    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6872    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6873    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6874    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6875    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6876    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6877    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6878    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6879    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6880    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6881    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6882    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6883    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6884    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6885    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6886    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6887    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6888    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6889    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6890    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6891    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6892    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6893    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6894    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6895    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6896    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6897    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6898    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6899    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6900    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6901    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6902    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6903    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6904    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6905    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6906    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6907    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6908    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6909    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6910    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6911    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6912    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6913    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6914    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6915    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6916    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6917    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6918    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6919    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6920    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6921    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6922    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6923    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6924    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6925    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6926    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6927    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6928    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6929    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6930    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6931    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6932    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6933    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6934    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6935    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6936    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6937    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6938    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6939    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6940    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6941    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6942    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6943    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6944    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6945    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6946    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6947    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6948    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6949    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6950    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6951    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6952    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6953    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6954    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6955    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6956    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6957    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6958    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6959    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6960    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6961    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6962    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6963    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6964    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6965    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6966    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6967    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6968    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6969    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6970    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6971    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6972    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6973    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6974    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6975    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6976    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6977    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6978    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6979    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6980    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6981    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6982    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6983    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6984    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6985    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6986    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6987    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6988    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6989    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6990    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6991    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6992    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6993    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6994    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6995    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6996    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6997    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6998    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
6999    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7000    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7001    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7002    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7003    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7004    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7005    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7006    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7007    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7008    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7009    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7010    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7011    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7012    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7013    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7014    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7015    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7016    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7017    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7018    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7019    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7020    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7021    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7022    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7023    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7024    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7025    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7026    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7027    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7028    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7029    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7030    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7031    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7032    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7033    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7034    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7035    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7036    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7037    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7038    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7039    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7040    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7041    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7042    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7043    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7044    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7045    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7046    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7047    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7048    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7049    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7050    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7051    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7052    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7053    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7054    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7055    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7056    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7057    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7058    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7059    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7060    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7061    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7062    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7063    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7064    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7065    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7066    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7067    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7068    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7069    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7070    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7071    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7072    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7073    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7074    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7075    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7076    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7077    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7078    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7079    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7080    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7081    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7082    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7083    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7084    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7085    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7086    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7087    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7088    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7089    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7090    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7091    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7092    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7093    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7094    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7095    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7096    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7097    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7098    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7099    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7100    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7101    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7102    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7103    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7104    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7105    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7106    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7107    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
68487108
7109   /* opcodes */
7110   0x70,0xE7,0x06,0xc8,0x49,0x28,0x44,0x17,0x6d,0x56,0xf1,0x0c,0xd1,0xe4,0x92,0x5b,
7111    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7112    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7113    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7114    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7115    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7116    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7117    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7118    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7119    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7120    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7121    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7122    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7123    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7124    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7125    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7126    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7127    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7128    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7129    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7130    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7131    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7132    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7133    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7134    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7135    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7136    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7137    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7138    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7139    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7140    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7141    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7142    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7143    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7144    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7145    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7146    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7147    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7148    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7149    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7150    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7151    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7152    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7153    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7154    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7155    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7156    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7157    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7158    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7159    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7160    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7161    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7162    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7163    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7164    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7165    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7166    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7167    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7168    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7169    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7170    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7171    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7172    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7173    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7174    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7175    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7176    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7177    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7178    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7179    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7180    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7181    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7182    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7183    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7184    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7185    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7186    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7187    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7188    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7189    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7190    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7191    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7192    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7193    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7194    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7195    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7196    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7197    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7198    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7199    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7200    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7201    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7202    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7203    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7204    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7205    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7206    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7207    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7208    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7209    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7210    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7211    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7212    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7213    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7214    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7215    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7216    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7217    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7218    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7219    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7220    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7221    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7222    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7223    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7224    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7225    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7226    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7227    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7228    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7229    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7230    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7231    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7232    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7233    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7234    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7235    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7236    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7237    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7238    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7239    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7240    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7241    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7242    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7243    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7244    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7245    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7246    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7247    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7248    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7249    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7250    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7251    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7252    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7253    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7254    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7255    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7256    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7257    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7258    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7259    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7260    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7261    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7262    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7263    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7264    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7265    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7266    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7267    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7268    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7269    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7270    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7271    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7272    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7273    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7274    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7275    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7276    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7277    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7278    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7279    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7280    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7281    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7282    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7283    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7284    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7285    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7286    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7287    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7288    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7289    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7290    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7291    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7292    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7293    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7294    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7295    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7296    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7297    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7298    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7299    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7300    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7301    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7302    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7303    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7304    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7305    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7306    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7307    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7308    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7309    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7310    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7311    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7312    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7313    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7314    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7315    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7316    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7317    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7318    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7319    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7320    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7321    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7322    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7323    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7324    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7325    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7326    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7327    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7328    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7329    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7330    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7331    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7332    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7333    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7334    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7335    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7336    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7337    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7338    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7339    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7340    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7341    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7342    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7343    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7344    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7345    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7346    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7347    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7348    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7349    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7350    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7351    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7352    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7353    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7354    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7355    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7356    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7357    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7358    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7359    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7360    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7361    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7362    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7363    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7364    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7365    0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  , 0  ,
7366};
68497367
6850
6851
68527368struct parameters
68537369{
68547370   int xor;
r2864r2865
70927608   sys16_decrypt(key_0018,FD1089A);
70937609}
70947610
7095void fd1089_decrypt_alexkidd(void)
7611void fd1089_decrypt_0021(void)
70967612{
7097   sys16_decrypt(key_alexkidd,FD1089A);
7613   sys16_decrypt(key_0021,FD1089A);
70987614}
70997615
71007616void fd1089_decrypt_0022(void)
r2864r2865
71467662{
71477663   sys16_decrypt(key_5021,FD1089B);
71487664}
7665
7666void fd1089_decrypt_wb35(void)
7667{
7668   sys16_decrypt(key_wb35,FD1089A);
7669}
7670
src/mame/machine/fd1089.h
r2864r2865
1void *fd1089_get_decrypted_base(void);
2void fd1089_decrypt_0013A(void);
3void fd1089_decrypt_0018(void);
4void fd1089_decrypt_alexkidd(void);
5void fd1089_decrypt_0022(void);
6void fd1089_decrypt_0024(void);
7void fd1089_decrypt_0027(void);
8void fd1089_decrypt_0028(void);
9void fd1089_decrypt_0033(void);
10void fd1089_decrypt_0034(void);
11void fd1089_decrypt_0037(void);
12void fd1089_decrypt_0167(void);
13void fd1089_decrypt_0168(void);
14void fd1089_decrypt_5021(void);
1void *fd1089_get_decrypted_base(void);
2void fd1089_decrypt_0013A(void);
3void fd1089_decrypt_0018(void);
4void fd1089_decrypt_0021(void);
5void fd1089_decrypt_0022(void);
6void fd1089_decrypt_0024(void);
7void fd1089_decrypt_0027(void);
8void fd1089_decrypt_0028(void);
9void fd1089_decrypt_0033(void);
10void fd1089_decrypt_0034(void);
11void fd1089_decrypt_0037(void);
12void fd1089_decrypt_0167(void);
13void fd1089_decrypt_0168(void);
14void fd1089_decrypt_5021(void);
15void fd1089_decrypt_wb35(void);
src/mame/machine/s16fd.c
r2864r2865
99*/
1010
1111#include "driver.h"
12#include "deprecat.h"
1312
1413#include "cpu/m68000/m68000.h"
1514#include "machine/fd1094.h"
r2864r2865
195194
196195
197196/* startup function, to be called from DRIVER_INIT (once on startup) */
198void fd1094_driver_init(void (*set_decrypted)(UINT8 *))
197void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(UINT8 *))
199198{
200199   int i;
201200
r2864r2865
218217
219218#ifdef ENABLE_DEBUGGER
220219   /* key debugging */
221   if (Machine->debug_mode && memory_region(REGION_USER2) != NULL)
220   if (machine->debug_mode && memory_region(REGION_USER2) != NULL)
222221   {
223      void fd1094_init_debugging(int, int, int, void (*changed)(void));
224      fd1094_init_debugging(REGION_CPU1, REGION_USER1, REGION_USER2, key_changed);
222      void fd1094_init_debugging(running_machine *, int, int, int, void (*changed)(void));
223      fd1094_init_debugging(machine, REGION_CPU1, REGION_USER1, REGION_USER2, key_changed);
225224   }
226225#endif
227226
228227   state_save_register_global(fd1094_selected_state);
229228   state_save_register_global(fd1094_state);
230   state_save_register_postload(Machine, fd1094_postload, NULL);
229   state_save_register_postload(machine, fd1094_postload, NULL);
231230}
src/mame/machine/asic65.c
r2864r2865
55 *************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "includes/atarig42.h"
109#include "cpu/tms32010/tms32010.h"
1110#include "asic65.h"
r2864r2865
124123 *
125124 *************************************/
126125
127void asic65_config(int asictype)
126void asic65_config(running_machine *machine, int asictype)
128127{
129128   asic65_type = asictype;
130129   if (asic65_type == ASIC65_ROMBASED)
131      asic65_cpunum = mame_find_cpu_index(Machine, "asic65");
130      asic65_cpunum = mame_find_cpu_index(machine, "asic65");
132131}
133132
134133
r2864r2865
139138 *
140139 *************************************/
141140
142void asic65_reset(int state)
141void asic65_reset(running_machine *machine, int state)
143142{
144143   /* rom-based means reset and clear states */
145144   if (asic65_type == ASIC65_ROMBASED)
146      cpunum_set_input_line(Machine, asic65_cpunum, INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
145      cpunum_set_input_line(machine, asic65_cpunum, INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
147146
148147   /* otherwise, do it manually */
149148   else
150149   {
151      cpunum_suspend(mame_find_cpu_index(Machine, "asic65"), SUSPEND_REASON_DISABLE, 1);
150      cpunum_suspend(mame_find_cpu_index(machine, "asic65"), SUSPEND_REASON_DISABLE, 1);
152151
153152      /* if reset is being signalled, clear everything */
154153      if (state && !asic65_reset_state)
r2864r2865
158157      else if (!state && asic65_reset_state)
159158      {
160159         if (asic65_command != -1)
161            asic65_data_w(Machine, 1, asic65_command, 0xffff);
160            asic65_data_w(machine, 1, asic65_command, 0xffff);
162161      }
163162
164163      /* update the state */
src/mame/machine/asic65.h
r2864r2865
99#define ASIC65_GUARDIANS   2
1010#define ASIC65_ROMBASED      3
1111
12void asic65_config(int asictype);
13void asic65_reset(int state);
12void asic65_config(running_machine *machine, int asictype);
13void asic65_reset(running_machine *machine, int state);
1414WRITE16_HANDLER( asic65_data_w );
1515READ16_HANDLER( asic65_r );
1616READ16_HANDLER( asic65_io_r );
src/mame/machine/decocass.c
r2864r2865
181181WRITE8_HANDLER( decocass_quadrature_decoder_reset_w )
182182{
183183   /* just latch the analog controls here */
184   decocass_quadrature_decoder[0] = input_port_read_indexed(machine,3);
185   decocass_quadrature_decoder[1] = input_port_read_indexed(machine,4);
186   decocass_quadrature_decoder[2] = input_port_read_indexed(machine,5);
187   decocass_quadrature_decoder[3] = input_port_read_indexed(machine,6);
184   decocass_quadrature_decoder[0] = input_port_read(machine, "AN0");
185   decocass_quadrature_decoder[1] = input_port_read(machine, "AN1");
186   decocass_quadrature_decoder[2] = input_port_read(machine, "AN2");
187   decocass_quadrature_decoder[3] = input_port_read(machine, "AN3");
188188}
189189
190190WRITE8_HANDLER( decocass_adc_w )
r2864r2865
204204READ8_HANDLER( decocass_input_r )
205205{
206206   UINT8 data = 0xff;
207   static const char *portnames[] = { "IN0", "IN1", "IN2" };
208
207209   switch (offset & 7)
208210   {
209211   case 0: case 1: case 2:
210      data = input_port_read_indexed(machine, offset & 7);
212      data = input_port_read(machine, portnames[offset & 7]);
211213      break;
212214   case 3: case 4: case 5: case 6:
213215      data = decocass_quadrature_decoder[(offset & 7) - 3];
src/mame/machine/konppc.c
r2864r2865
11/* Konami PowerPC-based 3D games common functions */
22
33#include "driver.h"
4#include "deprecat.h"
54#include "cpu/sharc/sharc.h"
65#include "video/voodoo.h"
76#include "konppc.h"
r2864r2865
198197   return dsp_comm_ppc[board][offset];
199198}
200199
201static void dsp_comm_sharc_w(int board, int offset, UINT32 data)
200static void dsp_comm_sharc_w(running_machine *machine, int board, int offset, UINT32 data)
202201{
203202   if (offset >= 2)
204203   {
r2864r2865
210209      case CGBOARD_TYPE_ZR107:
211210      case CGBOARD_TYPE_GTICLUB:
212211      {
213         //cpunum_set_input_line(Machine, 2, SHARC_INPUT_FLAG0, ASSERT_LINE);
212         //cpunum_set_input_line(machine, 2, SHARC_INPUT_FLAG0, ASSERT_LINE);
214213         cpuintrf_push_context(2);
215214         sharc_set_flag_input(0, ASSERT_LINE);
216215         cpuintrf_pop_context();
r2864r2865
218217         if (offset == 1)
219218         {
220219            if (data & 0x03)
221               cpunum_set_input_line(Machine, 2, INPUT_LINE_IRQ2, ASSERT_LINE);
220               cpunum_set_input_line(machine, 2, INPUT_LINE_IRQ2, ASSERT_LINE);
222221         }
223222         break;
224223      }
r2864r2865
303302
304303WRITE32_HANDLER( cgboard_0_comm_sharc_w )
305304{
306   dsp_comm_sharc_w(0, offset, data);
305   dsp_comm_sharc_w(machine, 0, offset, data);
307306}
308307
309308READ32_HANDLER( cgboard_0_shared_sharc_r )
r2864r2865
323322
324323WRITE32_HANDLER( cgboard_1_comm_sharc_w )
325324{
326   dsp_comm_sharc_w(1, offset, data);
325   dsp_comm_sharc_w(machine, 1, offset, data);
327326}
328327
329328READ32_HANDLER( cgboard_1_shared_sharc_r )
src/mame/machine/irobot.c
r2864r2865
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "profiler.h"
109#include "cpu/m6809/m6809.h"
1110#include "irobot.h"
r2864r2865
2726
2827#define IR_CPU_STATE \
2928   logerror(\
30         "pc: %4x, scanline: %d\n", activecpu_get_previouspc(), video_screen_get_vpos(Machine->primary_screen))
29         "pc: %4x, scanline: %d\n", activecpu_get_previouspc(), video_screen_get_vpos(machine->primary_screen))
3130
3231
3332UINT8 irobot_vg_clear;
r2864r2865
5150UINT8 irobot_bufsel;
5251UINT8 irobot_alphamap;
5352
54static void irmb_run(void);
53static void irmb_run(running_machine *machine);
5554
5655
5756/***********************************************************************/
r2864r2865
118117      irvg_running=1;
119118   }
120119   if ((data & 0x10) && !(irobot_statwr & 0x10))
121      irmb_run();
120      irmb_run(machine);
122121   irobot_statwr = data;
123122}
124123
r2864r2865
226225{
227226
228227   if (irobot_control_num == 0)
229      return input_port_read_indexed(machine, 5);
228      return input_port_read(machine, "AN0");
230229   else if (irobot_control_num == 1)
231      return input_port_read_indexed(machine, 6);
230      return input_port_read(machine, "AN1");
232231   return 0;
233232
234233}
r2864r2865
575574
576575
577576/* Run mathbox */
578static void irmb_run(void)
577static void irmb_run(running_machine *machine)
579578{
580579   const irmb_ops *prevop = &mbops[0];
581580   const irmb_ops *curop = &mbops[0];
r2864r2865
862861      timer_adjust_oneshot(irmb_timer, attotime_mul(ATTOTIME_IN_NSEC(200), icount), 0);
863862   }
864863#else
865   cpunum_set_input_line(Machine, 0, M6809_FIRQ_LINE, ASSERT_LINE);
864   cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, ASSERT_LINE);
866865#endif
867866   irmb_running=1;
868867}
src/mame/machine/leland.c
r2864r2865
128128
129129READ8_HANDLER( cerberus_dial_1_r )
130130{
131   int original = input_port_read_indexed(machine, 0);
132   int modified = dial_compute_value(input_port_read_indexed(machine, 4), 0);
131   int original = input_port_read(machine, "IN0");
132   int modified = dial_compute_value(input_port_read(machine, "AN0"), 0);
133133   return (original & 0xc0) | ((modified & 0x80) >> 2) | (modified & 0x1f);
134134}
135135
136136
137137READ8_HANDLER( cerberus_dial_2_r )
138138{
139   int original = input_port_read_indexed(machine, 2);
140   int modified = dial_compute_value(input_port_read_indexed(machine, 5), 1);
139   int original = input_port_read(machine, "IN0");
140   int modified = dial_compute_value(input_port_read(machine, "AN1"), 1);
141141   return (original & 0xc0) | ((modified & 0x80) >> 2) | (modified & 0x1f);
142142}
143143
r2864r2865
181181
182182static void update_dangerz_xy(running_machine *machine)
183183{
184   UINT8 newy = input_port_read_indexed(machine, 4);
185   UINT8 newx = input_port_read_indexed(machine, 5);
184   UINT8 newy = input_port_read(machine, "AN0");
185   UINT8 newx = input_port_read(machine, "AN1");
186186   int deltay = newy - dial_last_input[0];
187187   int deltax = newx - dial_last_input[1];
188188
r2864r2865
235235
236236READ8_HANDLER( redline_pedal_1_r )
237237{
238   int pedal = input_port_read_indexed(machine, 0);
238   int pedal = input_port_read(machine, "IN0");
239239   return redline_pedal_value[pedal >> 5] | 0x0f;
240240}
241241
242242
243243READ8_HANDLER( redline_pedal_2_r )
244244{
245   int pedal = input_port_read_indexed(machine, 2);
245   int pedal = input_port_read(machine, "IN2");
246246   return redline_pedal_value[pedal >> 5] | 0x0f;
247247}
248248
249249
250250READ8_HANDLER( redline_wheel_1_r )
251251{
252   return dial_compute_value(input_port_read_indexed(machine, 4), 0);
252   return dial_compute_value(input_port_read(machine, "AN0"), 0);
253253}
254254
255255
256256READ8_HANDLER( redline_wheel_2_r )
257257{
258   return dial_compute_value(input_port_read_indexed(machine, 5), 1);
258   return dial_compute_value(input_port_read(machine, "AN1"), 1);
259259}
260260
261261
r2864r2865
268268
269269READ8_HANDLER( offroad_wheel_1_r )
270270{
271   return dial_compute_value(input_port_read_indexed(machine, 7), 0);
271   return dial_compute_value(input_port_read(machine, "AN3"), 0);
272272}
273273
274274
275275READ8_HANDLER( offroad_wheel_2_r )
276276{
277   return dial_compute_value(input_port_read_indexed(machine, 8), 1);
277   return dial_compute_value(input_port_read(machine, "AN4"), 1);
278278}
279279
280280
281281READ8_HANDLER( offroad_wheel_3_r )
282282{
283   return dial_compute_value(input_port_read_indexed(machine, 9), 2);
283   return dial_compute_value(input_port_read(machine, "AN5"), 2);
284284}
285285
286286
r2864r2865
293293
294294READ8_HANDLER( ataxx_trackball_r )
295295{
296   return dial_compute_value(input_port_read_indexed(machine, 3 + offset), offset);
296   static const char *tracknames[] = { "AN0", "AN1", "AN2", "AN3" };
297
298   return dial_compute_value(input_port_read(machine, tracknames[offset]), offset);
297299}
298300
299301
r2864r2865
306308
307309READ8_HANDLER( indyheat_wheel_r )
308310{
309   return dial_compute_value(input_port_read_indexed(machine, 3 + offset), offset);
311   static const char *tracknames[] = { "AN0", "AN1", "AN2" };
312
313   return dial_compute_value(input_port_read(machine, tracknames[offset]), offset);
310314}
311315
312316
r2864r2865
333337
334338WRITE8_HANDLER( indyheat_analog_w )
335339{
340   static const char *tracknames[] = { "AN3", "AN4", "AN5" };
341
336342   switch (offset)
337343   {
338344      case 3:
339         analog_result = input_port_read_indexed(machine, 6 + data);
345         analog_result = input_port_read(machine, tracknames[data]);
340346         break;
341347
342348      case 0:
r2864r2865
492498INTERRUPT_GEN( leland_master_interrupt )
493499{
494500   /* check for coins here */
495   if ((input_port_read_indexed(machine, 1) & 0x0e) != 0x0e)
501   if ((input_port_read(machine, "IN1") & 0x0e) != 0x0e)
496502      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE);
497503}
498504
r2864r2865
843849
844850READ8_HANDLER( ataxx_eeprom_r )
845851{
846   int port = input_port_read_indexed(machine, 2);
852   int port = input_port_read(machine, "IN2");
847853   if (LOG_EEPROM) logerror("%04X:EE read\n", safe_activecpu_get_pc());
848854   return (port & ~0x01) | eeprom_read_bit();
849855}
r2864r2865
11071113
11081114WRITE8_HANDLER( leland_master_analog_key_w )
11091115{
1116   static const char *portnames[] = { "AN0", "AN1", "AN2", "AN3", "AN4", "AN5" };
1117
11101118   switch (offset)
11111119   {
11121120      case 0x00:   /* FD = analog port trigger */
11131121         break;
11141122
11151123      case 0x01:   /* FE = analog port select/bankswitch */
1116         analog_result = input_port_read_indexed(machine, (data & 15) + 4);
1124         analog_result = input_port_read(machine, portnames[data & 15]);
11171125
11181126         /* update top board banking for some games */
11191127         if (LOG_BANKSWITCHING_M)
r2864r2865
11441152   switch (offset)
11451153   {
11461154      case 0x00:   /* /GIN0 */
1147         result = input_port_read_indexed(machine, 0);
1155         result = input_port_read(machine, "IN0");
11481156         break;
11491157
11501158      case 0x01:   /* /GIN1 */
1151         result = input_port_read_indexed(machine, 1);
1159         result = input_port_read(machine, "IN1");
11521160         if (cpunum_get_reg(1, Z80_HALT))
11531161            result ^= 0x01;
11541162         break;
r2864r2865
11641172         break;
11651173
11661174      case 0x10:   /* /GIN0 */
1167         result = input_port_read_indexed(machine, 2);
1175         result = input_port_read(machine, "IN2");
11681176         break;
11691177
11701178      case 0x11:   /* /GIN1 */
1171         result = input_port_read_indexed(machine, 3);
1179         result = input_port_read(machine, "IN3");
11721180         if (LOG_EEPROM) logerror("%04X:EE read\n", safe_activecpu_get_pc());
11731181         result = (result & ~0x01) | eeprom_read_bit();
11741182         break;
r2864r2865
12271235   switch (offset)
12281236   {
12291237      case 0x06:   /* /GIN0 */
1230         result = input_port_read_indexed(machine, 0);
1238         result = input_port_read(machine, "IN0");
12311239         break;
12321240
12331241      case 0x07:   /* /SLVBLK */
1234         result = input_port_read_indexed(machine, 1);
1242         result = input_port_read(machine, "IN1");
12351243         if (cpunum_get_reg(1, Z80_HALT))
12361244            result ^= 0x01;
12371245         break;
src/mame/machine/midwayic.c
r2864r2865
108108 *
109109 *************************************/
110110
111static void generate_serial_data(int upper)
111static void generate_serial_data(running_machine *machine, int upper)
112112{
113   int year = atoi(Machine->gamedrv->year), month = 12, day = 11;
113   int year = atoi(machine->gamedrv->year), month = 12, day = 11;
114114   UINT32 serial_number, temp;
115115   UINT8 serial_digit[9];
116116
r2864r2865
127127   serial_digit[7] = (serial_number / 10) % 10;
128128   serial_digit[8] = (serial_number / 1) % 10;
129129
130   serial.data[12] = mame_rand(Machine) & 0xff;
131   serial.data[13] = mame_rand(Machine) & 0xff;
130   serial.data[12] = mame_rand(machine) & 0xff;
131   serial.data[13] = mame_rand(machine) & 0xff;
132132
133133   serial.data[14] = 0; /* ??? */
134134   serial.data[15] = 0; /* ??? */
r2864r2865
182182}
183183
184184
185void midway_serial_pic_init(int upper)
185void midway_serial_pic_init(running_machine *machine, int upper)
186186{
187187   serial_register_state();
188   generate_serial_data(upper);
188   generate_serial_data(machine, upper);
189189}
190190
191191
r2864r2865
282282}
283283
284284
285void midway_serial_pic2_init(int upper, int yearoffs)
285void midway_serial_pic2_init(running_machine *machine, int upper, int yearoffs)
286286{
287287   serial_register_state();
288288   pic_register_state();
r2864r2865
291291   pic.time_just_written = 0;
292292   pic.time_write_timer = timer_alloc(reset_timer, NULL);
293293   memset(pic.default_nvram, 0xff, sizeof(pic.default_nvram));
294   generate_serial_data(upper);
294   generate_serial_data(machine, upper);
295295}
296296
297297
r2864r2865
340340}
341341
342342
343void midway_serial_pic2_w(UINT8 data)
343void midway_serial_pic2_w(running_machine *machine, UINT8 data)
344344{
345345   static FILE *nvramlog;
346346   if (LOG_NVRAM && !nvramlog)
r2864r2865
391391            if (!pic.time_just_written)
392392            {
393393               mame_system_time systime;
394               mame_get_base_datetime(Machine, &systime);
394               mame_get_base_datetime(machine, &systime);
395395
396396               pic.buffer[pic.total++] = make_bcd(systime.local_time.second);
397397               pic.buffer[pic.total++] = make_bcd(systime.local_time.minute);
r2864r2865
569569static UINT16 ioasic_fifo_status_r(void);
570570static void ioasic_input_empty(int state);
571571static void ioasic_output_full(int state);
572static void update_ioasic_irq(void);
572static void update_ioasic_irq(running_machine *machine);
573573static void cage_irq_handler(running_machine *machine, int state);
574574
575575
r2864r2865
589589}
590590
591591
592void midway_ioasic_init(int shuffle, int upper, int yearoffs, void (*irq_callback)(running_machine *, int))
592void midway_ioasic_init(running_machine *machine, int shuffle, int upper, int yearoffs, void (*irq_callback)(running_machine *, int))
593593{
594594   static const UINT8 shuffle_maps[][16] =
595595   {
r2864r2865
607607   ioasic_register_state();
608608
609609   /* do we have a DCS2 sound chip connected? (most likely) */
610   ioasic.has_dcs = (mame_find_cpu_index(Machine, "dcs2") != -1 || mame_find_cpu_index(Machine, "dsio") != -1 || mame_find_cpu_index(Machine, "denver") != -1);
611   ioasic.has_cage = (mame_find_cpu_index(Machine, "cage") != -1);
612   ioasic.dcs_cpu = mame_find_cpu_index(Machine, "dcs2");
610   ioasic.has_dcs = (mame_find_cpu_index(machine, "dcs2") != -1 || mame_find_cpu_index(machine, "dsio") != -1 || mame_find_cpu_index(machine, "denver") != -1);
611   ioasic.has_cage = (mame_find_cpu_index(machine, "cage") != -1);
612   ioasic.dcs_cpu = mame_find_cpu_index(machine, "dcs2");
613613   if (ioasic.dcs_cpu == (UINT8)-1)
614      ioasic.dcs_cpu = mame_find_cpu_index(Machine, "dsio");
614      ioasic.dcs_cpu = mame_find_cpu_index(machine, "dsio");
615615   if (ioasic.dcs_cpu == (UINT8)-1)
616      ioasic.dcs_cpu = mame_find_cpu_index(Machine, "denver");
616      ioasic.dcs_cpu = mame_find_cpu_index(machine, "denver");
617617   ioasic.shuffle_type = shuffle;
618618   ioasic.shuffle_map = &shuffle_maps[shuffle][0];
619619   ioasic.auto_ack = 0;
620620   ioasic.irq_callback = irq_callback;
621621
622622   /* initialize the PIC */
623   midway_serial_pic2_init(upper, yearoffs);
623   midway_serial_pic2_init(machine, upper, yearoffs);
624624
625625   /* reset the chip */
626   midway_ioasic_reset();
626   midway_ioasic_reset(machine);
627627   ioasic.reg[IOASIC_SOUNDCTL] = 0x0001;
628628
629629   /* configure the fifo */
r2864r2865
632632      dcs_set_fifo_callbacks(ioasic_fifo_r, ioasic_fifo_status_r);
633633      dcs_set_io_callbacks(ioasic_output_full, ioasic_input_empty);
634634   }
635   midway_ioasic_fifo_reset_w(1);
635   midway_ioasic_fifo_reset_w(machine, 1);
636636
637637   /* configure the CAGE IRQ */
638638   if (ioasic.has_cage)
r2864r2865
652652}
653653
654654
655void midway_ioasic_reset(void)
655void midway_ioasic_reset(running_machine *machine)
656656{
657657   ioasic.shuffle_active = 0;
658658   ioasic.sound_irq_state = 0x0080;
659659   ioasic.reg[IOASIC_INTCTL] = 0;
660660   if (ioasic.has_dcs)
661      midway_ioasic_fifo_reset_w(1);
662   update_ioasic_irq();
661      midway_ioasic_fifo_reset_w(machine, 1);
662   update_ioasic_irq(machine);
663663   midway_serial_pic_reset_w(1);
664664}
665665
666666
667static void update_ioasic_irq(void)
667static void update_ioasic_irq(running_machine *machine)
668668{
669669   UINT16 fifo_state = ioasic_fifo_status_r();
670670   UINT16 irqbits = 0x2000;
r2864r2865
685685   {
686686      ioasic.irq_state = new_state;
687687      if (ioasic.irq_callback)
688         (*ioasic.irq_callback)(Machine, ioasic.irq_state ? ASSERT_LINE : CLEAR_LINE);
688         (*ioasic.irq_callback)(machine, ioasic.irq_state ? ASSERT_LINE : CLEAR_LINE);
689689   }
690690}
691691
r2864r2865
698698      ioasic.sound_irq_state |= 0x0040;
699699   if (reason & CAGE_IRQ_REASON_BUFFER_EMPTY)
700700      ioasic.sound_irq_state |= 0x0080;
701   update_ioasic_irq();
701   update_ioasic_irq(machine);
702702}
703703
704704
r2864r2865
709709      ioasic.sound_irq_state |= 0x0080;
710710   else
711711      ioasic.sound_irq_state &= ~0x0080;
712   update_ioasic_irq();
712   update_ioasic_irq(Machine);
713713}
714714
715715
r2864r2865
720720      ioasic.sound_irq_state |= 0x0040;
721721   else
722722      ioasic.sound_irq_state &= ~0x0040;
723   update_ioasic_irq();
723   update_ioasic_irq(Machine);
724724}
725725
726726
r2864r2865
741741      /* fetch the data from the buffer and update the IOASIC state */
742742      result = ioasic.fifo[ioasic.fifo_out++ % FIFO_SIZE];
743743      ioasic.fifo_bytes--;
744      update_ioasic_irq();
744      update_ioasic_irq(Machine);
745745
746746      if (LOG_FIFO && (ioasic.fifo_bytes < 4 || ioasic.fifo_bytes >= FIFO_SIZE - 4))
747747         logerror("fifo_r(%04X): FIFO bytes = %d!\n", result, ioasic.fifo_bytes);
r2864r2865
796796}
797797
798798
799void midway_ioasic_fifo_reset_w(int state)
799void midway_ioasic_fifo_reset_w(running_machine *machine, int state)
800800{
801801   /* on the high state, reset the FIFO data */
802802   if (state)
r2864r2865
805805      ioasic.fifo_out = 0;
806806      ioasic.fifo_bytes = 0;
807807      ioasic.force_fifo_full = 0;
808      update_ioasic_irq();
808      update_ioasic_irq(machine);
809809   }
810810   if (LOG_FIFO)
811811      logerror("%08X:fifo_reset(%d)\n", safe_activecpu_get_pc(), state);
812812}
813813
814814
815void midway_ioasic_fifo_w(UINT16 data)
815void midway_ioasic_fifo_w(running_machine *machine, UINT16 data)
816816{
817817   /* if we have room, add it to the FIFO buffer */
818818   if (ioasic.fifo_bytes < FIFO_SIZE)
819819   {
820820      ioasic.fifo[ioasic.fifo_in++ % FIFO_SIZE] = data;
821821      ioasic.fifo_bytes++;
822      update_ioasic_irq();
822      update_ioasic_irq(machine);
823823      if (LOG_FIFO && (ioasic.fifo_bytes < 4 || ioasic.fifo_bytes >= FIFO_SIZE - 4))
824824         logerror("fifo_w(%04X): FIFO bytes = %d!\n", data, ioasic.fifo_bytes);
825825   }
r2864r2865
832832}
833833
834834
835void midway_ioasic_fifo_full_w(UINT16 data)
835void midway_ioasic_fifo_full_w(running_machine *machine, UINT16 data)
836836{
837837   if (LOG_FIFO)
838838      logerror("fifo_full_w(%04X)\n", data);
839839   ioasic.force_fifo_full = 1;
840   update_ioasic_irq();
840   update_ioasic_irq(machine);
841841   dcs_fifo_notify(ioasic.fifo_bytes, FIFO_SIZE);
842842}
843843
r2864r2865
992992         {
993993            /* we're in loopback mode -- copy to the input */
994994            ioasic.reg[IOASIC_UARTIN] = (newreg & 0x00ff) | 0x1000;
995            update_ioasic_irq();
995            update_ioasic_irq(machine);
996996         }
997997         else if (PRINTF_DEBUG)
998998            mame_printf_debug("%c", data & 0xff);
r2864r2865
10151015         }
10161016
10171017         /* FIFO reset? */
1018         midway_ioasic_fifo_reset_w(~newreg & 4);
1018         midway_ioasic_fifo_reset_w(machine, ~newreg & 4);
10191019         break;
10201020
10211021      case IOASIC_SOUNDOUT:
r2864r2865
10321032
10331033      case IOASIC_PICOUT:
10341034         if (ioasic.shuffle_type == MIDWAY_IOASIC_VAPORTRX)
1035            midway_serial_pic2_w(newreg ^ 0x0a);
1035            midway_serial_pic2_w(machine, newreg ^ 0x0a);
10361036         else if (ioasic.shuffle_type == MIDWAY_IOASIC_SFRUSHRK)
1037            midway_serial_pic2_w(newreg ^ 0x05);
1037            midway_serial_pic2_w(machine, newreg ^ 0x05);
10381038         else
1039            midway_serial_pic2_w(newreg);
1039            midway_serial_pic2_w(machine, newreg);
10401040         break;
10411041
10421042      case IOASIC_INTCTL:
r2864r2865
10481048         /* bit 14 = LED? */
10491049         if ((oldreg ^ newreg) & 0x3ff6)
10501050            logerror("IOASIC int control = %04X\n", data);
1051         update_ioasic_irq();
1051         update_ioasic_irq(machine);
10521052         break;
10531053
10541054      default:
src/mame/machine/midwayic.h
r2864r2865
66
77
88/* 1st generation Midway serial PIC */
9void midway_serial_pic_init(int upper);
9void midway_serial_pic_init(running_machine *machine, int upper);
1010void midway_serial_pic_reset_w(int state);
1111UINT8 midway_serial_pic_status_r(void);
1212UINT8 midway_serial_pic_r(void);
r2864r2865
1414
1515
1616/* 2nd generation Midway serial/NVRAM/RTC PIC */
17void midway_serial_pic2_init(int upper, int yearoffs);
17void midway_serial_pic2_init(running_machine *machine, int upper, int yearoffs);
1818void midway_serial_pic2_set_default_nvram(const UINT8 *nvram);
1919UINT8 midway_serial_pic2_status_r(void);
2020UINT8 midway_serial_pic2_r(void);
21void midway_serial_pic2_w(UINT8 data);
21void midway_serial_pic2_w(running_machine *machine, UINT8 data);
2222NVRAM_HANDLER( midway_serial_pic2 );
2323
2424
2525/* I/O ASIC connected to 2nd generation PIC */
26void midway_ioasic_init(int shuffle, int upper, int yearoffs, void (*irq_callback)(running_machine *, int));
26void midway_ioasic_init(running_machine *machine, int shuffle, int upper, int yearoffs, void (*irq_callback)(running_machine *, int));
2727void midway_ioasic_set_auto_ack(int auto_ack);
2828void midway_ioasic_set_shuffle_state(int state);
29void midway_ioasic_reset(void);
30void midway_ioasic_fifo_w(UINT16 data);
31void midway_ioasic_fifo_reset_w(int state);
32void midway_ioasic_fifo_full_w(UINT16 data);
29void midway_ioasic_reset(running_machine *machine);
30void midway_ioasic_fifo_w(running_machine *machine, UINT16 data);
31void midway_ioasic_fifo_reset_w(running_machine *machine, int state);
32void midway_ioasic_fifo_full_w(running_machine *machine, UINT16 data);
3333READ32_HANDLER( midway_ioasic_r );
3434WRITE32_HANDLER( midway_ioasic_w );
3535READ32_HANDLER( midway_ioasic_packed_r );
src/mame/machine/konamigx.c
r2864r2865
77 */
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "video/konamiic.h"
1211#include "machine/konamigx.h"
1312
r2864r2865
208207   cliprect->max_y = maxy;
209208}
210209
211INLINE void K053936GP_copyroz32clip( bitmap_t *dst_bitmap, bitmap_t *src_bitmap,
210INLINE void K053936GP_copyroz32clip( running_machine *machine,
211      bitmap_t *dst_bitmap, bitmap_t *src_bitmap,
212212      const rectangle *dst_cliprect, const rectangle *src_cliprect,
213213      UINT32 _startx,UINT32 _starty,int _incxx,int _incxy,int _incyx,int _incyy,
214214      int tilebpp, int blend, int clip )
r2864r2865
257257   ecx = tx = -tx;
258258
259259   tilebpp = (tilebpp-1) & 7;
260   pal_base = Machine->pens;
260   pal_base = machine->pens;
261261   cmask = colormask[tilebpp];
262262
263263   src_pitch = src_bitmap->rowpixels;
r2864r2865
358358}
359359
360360// adpoted from generic K053936_zoom_draw()
361static void K053936GP_zoom_draw(int chip, UINT16 *ctrl, UINT16 *linectrl,
361static void K053936GP_zoom_draw(running_machine *machine,
362      int chip, UINT16 *ctrl, UINT16 *linectrl,
362363      bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap,
363364      int tilebpp, int blend)
364365{
r2864r2865
397398         startx -= K053936_offset[chip][0] * incxx;
398399         starty -= K053936_offset[chip][0] * incxy;
399400
400         K053936GP_copyroz32clip(bitmap, src_bitmap, &my_clip, src_cliprect,
401         K053936GP_copyroz32clip(machine,
402               bitmap, src_bitmap, &my_clip, src_cliprect,
401403               startx<<5, starty<<5, incxx<<5, incxy<<5, 0, 0,
402404               tilebpp, blend, clip);
403405         y++;
r2864r2865
421423      startx -= K053936_offset[chip][0] * incxx;
422424      starty -= K053936_offset[chip][0] * incxy;
423425
424      K053936GP_copyroz32clip(bitmap, src_bitmap, cliprect, src_cliprect,
426      K053936GP_copyroz32clip(machine,
427            bitmap, src_bitmap, cliprect, src_cliprect,
425428            startx<<5, starty<<5, incxx<<5, incxy<<5, incyx<<5, incyy<<5,
426429            tilebpp, blend, clip);
427430   }
428431}
429432
430void K053936GP_0_zoom_draw(bitmap_t *bitmap, const rectangle *cliprect,
433void K053936GP_0_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
431434      tilemap *tmap, int tilebpp, int blend)
432435{
433   K053936GP_zoom_draw(0,K053936_0_ctrl,K053936_0_linectrl,bitmap,cliprect,tmap,tilebpp,blend);
436   K053936GP_zoom_draw(machine, 0,K053936_0_ctrl,K053936_0_linectrl,bitmap,cliprect,tmap,tilebpp,blend);
434437}
435438
436void K053936GP_1_zoom_draw(bitmap_t *bitmap, const rectangle *cliprect,
439void K053936GP_1_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
437440      tilemap *tmap, int tilebpp, int blend)
438441{
439   K053936GP_zoom_draw(1,K053936_1_ctrl,K053936_1_linectrl,bitmap,cliprect,tmap,tilebpp,blend);
442   K053936GP_zoom_draw(machine, 1,K053936_1_ctrl,K053936_1_linectrl,bitmap,cliprect,tmap,tilebpp,blend);
440443}
441444
442445
r2864r2865
457460    pri     : 0 = topmost, 255 = backmost (pixel priority)
458461*/
459462
460INLINE void zdrawgfxzoom32GP( bitmap_t *bitmap, const gfx_element *gfx, const rectangle *cliprect,
463INLINE void zdrawgfxzoom32GP( running_machine *machine,
464      bitmap_t *bitmap, const gfx_element *gfx, const rectangle *cliprect,
461465      UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy,
462466      int scalex, int scaley, int alpha, int drawmode, int zcode, int pri)
463467{
r2864r2865
522526   src_fh    = 16;
523527   src_base  = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
524528
525   pal_base  = Machine->pens + gfx->color_base + (color % gfx->total_colors) * granularity;
526   shd_base  = Machine->shadow_table;
529   pal_base  = machine->pens + gfx->color_base + (color % gfx->total_colors) * granularity;
530   shd_base  = machine->shadow_table;
527531
528532   dst_ptr   = bitmap->base;
529533   dst_pitch = bitmap->rowpixels;
r2864r2865
11921196   K053247_dy = offsy;
11931197}
11941198
1195void konamigx_mixer_init(int objdma)
1199void konamigx_mixer_init(running_machine *machine, int objdma)
11961200{
11971201   gx_objdma = 0;
11981202   gx_primode = 0;
r2864r2865
12121216   else
12131217      gx_spriteram = K053247_ram;
12141218
1215   palette_set_shadow_dRGB32(Machine, 3,-80,-80,-80, 0);
1219   palette_set_shadow_dRGB32(machine, 3,-80,-80,-80, 0);
12161220   K054338_invert_alpha(1);
12171221}
12181222
r2864r2865
16311635               l = sub1flags & 0xf;
16321636
16331637               if (offs == -2)
1634                  K053936GP_0_zoom_draw(bitmap, cliprect, sub1, l, k);
1638                  K053936GP_0_zoom_draw(machine, bitmap, cliprect, sub1, l, k);
16351639               else
16361640                  K053250_draw(machine, bitmap, cliprect, 0, vcblk[4]<<l, 0, 0);
16371641            }
r2864r2865
16601664               l = sub2flags & 0xf;
16611665
16621666               if (offs == -3)
1663                  K053936GP_1_zoom_draw(bitmap, cliprect, sub2, l, k);
1667                  K053936GP_1_zoom_draw(machine, bitmap, cliprect, sub2, l, k);
16641668               else
16651669                  K053250_draw(machine, bitmap, cliprect, 1, vcblk[5]<<l, 0, 0);
16661670            }
r2864r2865
18111815
18121816            if (nozoom) { scaley = scalex = 0x10000; } else { scalex = zw << 12; scaley = zh << 12; };
18131817
1814            zdrawgfxzoom32GP(bitmap, K053247_gfx, cliprect,
1818            zdrawgfxzoom32GP(machine,
1819                  bitmap, K053247_gfx, cliprect,
18151820                  temp,
18161821                  color,
18171822                  temp1,temp2,
src/mame/machine/toaplan1.c
r2864r2865
44 ***************************************************************************/
55
66#include "driver.h"
7#include "deprecat.h"
87#include "cpu/m68000/m68000.h"
98#include "cpu/tms32010/tms32010.h"
109#include "includes/toaplan1.h"
r2864r2865
112111}
113112
114113
115static void demonwld_dsp(int enable)
114static void demonwld_dsp(running_machine *machine, int enable)
116115{
117116   demonwld_dsp_on = enable;
118117   if (enable)
119118   {
120119      logerror("Turning DSP on and 68000 off\n");
121      cpunum_set_input_line(Machine, 2, INPUT_LINE_HALT, CLEAR_LINE);
122      cpunum_set_input_line(Machine, 2, 0, ASSERT_LINE); /* TMS32010 INT */
123      cpunum_set_input_line(Machine, 0, INPUT_LINE_HALT, ASSERT_LINE);
120      cpunum_set_input_line(machine, 2, INPUT_LINE_HALT, CLEAR_LINE);
121      cpunum_set_input_line(machine, 2, 0, ASSERT_LINE); /* TMS32010 INT */
122      cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, ASSERT_LINE);
124123   }
125124   else
126125   {
127126      logerror("Turning DSP off\n");
128      cpunum_set_input_line(Machine, 2, 0, CLEAR_LINE); /* TMS32010 INT */
129      cpunum_set_input_line(Machine, 2, INPUT_LINE_HALT, ASSERT_LINE);
127      cpunum_set_input_line(machine, 2, 0, CLEAR_LINE); /* TMS32010 INT */
128      cpunum_set_input_line(machine, 2, INPUT_LINE_HALT, ASSERT_LINE);
130129   }
131130}
132131static STATE_POSTLOAD( demonwld_restore_dsp )
133132{
134   demonwld_dsp(demonwld_dsp_on);
133   demonwld_dsp(machine, demonwld_dsp_on);
135134}
136135
137136WRITE16_HANDLER( demonwld_dsp_ctrl_w )
r2864r2865
144143   {
145144      switch (data)
146145      {
147         case 0x00:   demonwld_dsp(1); break;   /* Enable the INT line to the DSP */
148         case 0x01:   demonwld_dsp(0); break;   /* Inhibit the INT line to the DSP */
146         case 0x00:   demonwld_dsp(machine, 1); break;   /* Enable the INT line to the DSP */
147         case 0x01:   demonwld_dsp(machine, 0); break;   /* Inhibit the INT line to the DSP */
149148         default:   logerror("68000:%04x  Writing unknown command %08x to %08x\n",activecpu_get_previouspc() ,data ,0xe0000a + offset); break;
150149      }
151150   }
src/mame/machine/konamigx.h
r2864r2865
2121void K053936GP_set_offset(int chip, int xoffs, int yoffs);
2222void K053936GP_clip_enable(int chip, int status);
2323void K053936GP_set_cliprect(int chip, int minx, int maxx, int miny, int maxy);
24void K053936GP_0_zoom_draw(bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend);
25void K053936GP_1_zoom_draw(bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend);
24void K053936GP_0_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend);
25void K053936GP_1_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend);
2626
2727
2828
r2864r2865
8888               tilemap *sub2, int sub2flags,
8989               int mixerflags);
9090
91void konamigx_mixer_init(int objdma);
91void konamigx_mixer_init(running_machine *machine, int objdma);
9292void konamigx_mixer_primode(int mode);
9393
9494
src/mame/machine/namcoio.c
r2864r2865
898898
899899   switch (io[chipnum].type)
900900   {
901      case NAMCOIO_50XX:   return namco_50xx_read();
902      case NAMCOIO_50XX_2: return namco_50xx_2_read();
901      case NAMCOIO_50XX:   return namco_50xx_read(machine);
902      case NAMCOIO_50XX_2: return namco_50xx_2_read(machine);
903903      case NAMCOIO_51XX: return namcoio_51XX_read(machine, chipnum);
904904      case NAMCOIO_53XX_DIGDUG:  return namcoio_53XX_digdug_read(machine, chipnum);
905905      case NAMCOIO_53XX_POLEPOS: return namcoio_53XX_polepos_read(machine, chipnum);
r2864r2865
916916
917917   switch (io[chipnum].type)
918918   {
919      case NAMCOIO_50XX:   namco_50xx_write(data); break;
920      case NAMCOIO_50XX_2: namco_50xx_2_write(data); break;
919      case NAMCOIO_50XX:   namco_50xx_write(machine, data); break;
920      case NAMCOIO_50XX_2: namco_50xx_2_write(machine, data); break;
921921      case NAMCOIO_51XX:   namcoio_51XX_write(machine,chipnum,data); break;
922922      case NAMCOIO_52XX:   namcoio_52XX_write(data); break;
923923      case NAMCOIO_54XX:   namco_54xx_write(data); break;
r2864r2865
928928}
929929
930930
931static void namco_06xx_read_request(int chipnum)
931static void namco_06xx_read_request(running_machine *machine, int chipnum)
932932{
933933   LOG(("requesting read to chip %d\n",chipnum%3));
934934
935935   switch (io[chipnum].type)
936936   {
937      case NAMCOIO_50XX:   namco_50xx_read_request(); break;
938      case NAMCOIO_50XX_2: namco_50xx_2_read_request(); break;
937      case NAMCOIO_50XX:   namco_50xx_read_request(machine); break;
938      case NAMCOIO_50XX_2: namco_50xx_2_read_request(machine); break;
939939      default:
940940         logerror("%04x: custom IO type %d read_request unsupported\n",activecpu_get_pc(),io[chipnum].type);
941941         break;
r2864r2865
995995   return customio_command[chip];
996996}
997997
998static void namco_06xx_ctrl_w(int chip,int data)
998static void namco_06xx_ctrl_w(running_machine *machine, int chip,int data)
999999{
10001000   LOG(("%04x: 06XX #%d command %02x\n",activecpu_get_pc(),chip,data));
10011001
r2864r2865
10201020      {
10211021         switch (customio_command[chip] & 0xf)
10221022         {
1023            case 0x1: namco_06xx_read_request(4*chip + 0); break;
1024            case 0x2: namco_06xx_read_request(4*chip + 1); break;
1025            case 0x4: namco_06xx_read_request(4*chip + 2); break;
1026            case 0x8: namco_06xx_read_request(4*chip + 3); break;
1023            case 0x1: namco_06xx_read_request(machine, 4*chip + 0); break;
1024            case 0x2: namco_06xx_read_request(machine, 4*chip + 1); break;
1025            case 0x4: namco_06xx_read_request(machine, 4*chip + 2); break;
1026            case 0x8: namco_06xx_read_request(machine, 4*chip + 3); break;
10271027            default:
10281028               logerror("%04x: 06XX #%d read in unsupported mode %02x\n",activecpu_get_pc(),chip,customio_command[chip]);
10291029         }
r2864r2865
10391039WRITE8_HANDLER( namco_06xx_1_data_w )   { namco_06xx_data_w(machine,1,offset,data); }
10401040READ8_HANDLER( namco_06xx_0_ctrl_r )      { return namco_06xx_ctrl_r(0); }
10411041READ8_HANDLER( namco_06xx_1_ctrl_r )      { return namco_06xx_ctrl_r(1); }
1042WRITE8_HANDLER( namco_06xx_0_ctrl_w )   { namco_06xx_ctrl_w(0,data); }
1043WRITE8_HANDLER( namco_06xx_1_ctrl_w )   { namco_06xx_ctrl_w(1,data); }
1042WRITE8_HANDLER( namco_06xx_0_ctrl_w )   { namco_06xx_ctrl_w(machine, 0,data); }
1043WRITE8_HANDLER( namco_06xx_1_ctrl_w )   { namco_06xx_ctrl_w(machine, 1,data); }
src/mame/machine/gaplus.c
r2864r2865
3838        switch (offset)
3939        {
4040            case 0:
41                return input_port_read_indexed(machine, 4 ); /* cabinet & test mode */
41                return input_port_read(machine, "IN2");      /* cabinet & test mode */
4242                break;
4343            case 2:
4444                return 0x0f;
r2864r2865
5252        switch (offset)
5353        {
5454            case 0:
55                return input_port_read_indexed(machine, 4 ); /* cabinet & test mode */
55                return input_port_read(machine, "IN2");      /* cabinet & test mode */
5656                break;
5757            case 1:
5858                return 0x0f;
src/mame/machine/fddebug.c
r2864r2865
256256    FUNCTION PROTOTYPES
257257***************************************************************************/
258258
259static void set_default_key_params(void);
260static void load_overlay_file(void);
261static void save_overlay_file(void);
259static void set_default_key_params(running_machine *machine);
260static void load_overlay_file(running_machine *machine);
261static void save_overlay_file(running_machine *machine);
262262static void fd1094_regenerate_key(void);
263263
264264static int instruction_hook(offs_t curpc);
r2864r2865
479479    fd1094_init_debugging - set up debugging
480480-----------------------------------------------*/
481481
482void fd1094_init_debugging(int cpureg, int keyreg, int statreg, void (*changed)(void))
482void fd1094_init_debugging(running_machine *machine, int cpureg, int keyreg, int statreg, void (*changed)(void))
483483{
484484   /* set the key changed callback */
485485   key_changed = changed;
r2864r2865
514514   set_constraint(&constraints[constcount++], 0x000006, FD1094_STATE_RESET, 0x0000, 0xc001);
515515
516516   /* determine the key parameters */
517   set_default_key_params();
517   set_default_key_params(machine);
518518
519519   /* read the key overlay file */
520   load_overlay_file();
520   load_overlay_file(machine);
521521
522522   /* add some commands */
523523   debug_console_register_command("fdsave", CMDFLAG_NONE, 0, 0, 0, execute_fdsave);
r2864r2865
552552    name, set some defaults
553553-----------------------------------------------*/
554554
555static void set_default_key_params(void)
555static void set_default_key_params(running_machine *machine)
556556{
557557   static const struct
558558   {
r2864r2865
568568
569569   /* look for a matching game and set the key appropriately */
570570   for (keynum = 0; keynum < ARRAY_LENGTH(default_keys); keynum++)
571      if (strcmp(Machine->gamedrv->name, default_keys[keynum].gamename) == 0)
571      if (strcmp(machine->gamedrv->name, default_keys[keynum].gamename) == 0)
572572      {
573573         fd1094_global = default_keys[keynum].global;
574574         fd1094_seed = default_keys[keynum].seed;
r2864r2865
583583    file
584584-----------------------------------------------*/
585585
586static void load_overlay_file(void)
586static void load_overlay_file(running_machine *machine)
587587{
588588   char filename[20];
589589   file_error filerr;
r2864r2865
591591   int pcaddr;
592592
593593   /* determine the filename and open the file */
594   sprintf(filename, "%s.kov", Machine->gamedrv->name);
594   sprintf(filename, "%s.kov", machine->gamedrv->name);
595595   filerr = mame_fopen(SEARCHPATH_RAW, filename, OPEN_FLAG_READ, &file);
596596   if (filerr == FILERR_NONE)
597597   {
r2864r2865
613613    file
614614-----------------------------------------------*/
615615
616static void save_overlay_file(void)
616static void save_overlay_file(running_machine *machine)
617617{
618618   char filename[20];
619619   file_error filerr;
r2864r2865
621621   int pcaddr;
622622
623623   /* determin the filename and open the file */
624   sprintf(filename, "%s.kov", Machine->gamedrv->name);
624   sprintf(filename, "%s.kov", machine->gamedrv->name);
625625   filerr = mame_fopen(SEARCHPATH_RAW, filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file);
626626   if (filerr == FILERR_NONE)
627627   {
r2864r2865
748748
749749static void execute_fdsave(int ref, int params, const char **param)
750750{
751   save_overlay_file();
751   save_overlay_file(Machine);
752752   debug_console_printf("File saved\n");
753753}
754754
src/mame/machine/namcos1.c
r2864r2865
542542       it happens to work correctly also using the standard handling for 0058.
543543       The schematics don't show A11 being used, so I go for this handling.
544544      */
545
545546   op = (offset & 0x70) >> 4;
546547
547548   if (op == key_reg)      return key_id;
r2864r2865
12091210   namcos1_driver_init(&tankfrce_specific);
12101211}
12111212
1213// Inputs are multiplexed, somehow
1214READ8_HANDLER( tankfrc4_input_r )
1215{
1216
1217   switch (offset)
1218   {
1219      case 0:
1220         return mame_rand(machine);
1221
1222      case 1:
1223         return mame_rand(machine);
1224
1225   }
1226   return 0x00;
1227
1228}
1229
1230DRIVER_INIT( tankfrc4 )
1231{
1232   static const struct namcos1_specific tankfrce_specific=
1233   {
1234      key_type3_r,key_type3_w, 185, 5,-1, 1,-1, 2,-1
1235   };
1236   namcos1_driver_init(&tankfrce_specific);
1237
1238   memory_install_read8_handler(machine, 3, ADDRESS_SPACE_PROGRAM, 0x1400, 0x1401, 0, 0, tankfrc4_input_r);
1239}
1240
12121241/*******************************************************************************
12131242*   Dangerous Seed specific (CUS308)                                           *
12141243*******************************************************************************/
src/mame/machine/segaic16.c
r2864r2865
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "segaic16.h"
109#include "video/resnet.h"
1110
r2864r2865
641640}
642641
643642
644static void timer_interrupt_ack(int which)
643static void timer_interrupt_ack(running_machine *machine, int which)
645644{
646645   if (compare_timer[which].timer_ack)
647      (*compare_timer[which].timer_ack)(Machine);
646      (*compare_timer[which].timer_ack)(machine);
648647}
649648
650649
651static UINT16 compare_timer_r(int which, offs_t offset, UINT16 mem_mask)
650static UINT16 compare_timer_r(running_machine *machine, int which, offs_t offset, UINT16 mem_mask)
652651{
653652   offset &= 0xf;
654653   if (LOG_COMPARE) logerror("%06X:compare%d_r(%X) = %04X\n", activecpu_get_pc(), which, offset, compare_timer[which].regs[offset]);
r2864r2865
663662      case 0x6:   return compare_timer[which].regs[2];
664663      case 0x7:   return compare_timer[which].regs[7];
665664      case 0x9:
666      case 0xd:   timer_interrupt_ack(which); break;
665      case 0xd:   timer_interrupt_ack(machine, which); break;
667666   }
668667   return 0xffff;
669668}
670669
671670
672static void compare_timer_w(int which, offs_t offset, UINT16 data, UINT16 mem_mask)
671static void compare_timer_w(running_machine *machine, int which, offs_t offset, UINT16 data, UINT16 mem_mask)
673672{
674673   offset &= 0xf;
675674   if (LOG_COMPARE) logerror("%06X:compare%d_w(%X) = %04X\n", activecpu_get_pc(), which, offset, data);
r2864r2865
683682      case 0x8:
684683      case 0xc:   COMBINE_DATA(&compare_timer[which].regs[8]); break;
685684      case 0x9:
686      case 0xd:   timer_interrupt_ack(which); break;
685      case 0xd:   timer_interrupt_ack(machine, which); break;
687686      case 0xa:
688687      case 0xe:   COMBINE_DATA(&compare_timer[which].regs[10]); break;
689688      case 0xb:
r2864r2865
696695}
697696
698697
699READ16_HANDLER( segaic16_compare_timer_0_r )  { return compare_timer_r(0, offset, mem_mask); }
700READ16_HANDLER( segaic16_compare_timer_1_r )  { return compare_timer_r(1, offset, mem_mask); }
701WRITE16_HANDLER( segaic16_compare_timer_0_w ) { compare_timer_w(0, offset, data, mem_mask); }
702WRITE16_HANDLER( segaic16_compare_timer_1_w ) { compare_timer_w(1, offset, data, mem_mask); }
698READ16_HANDLER( segaic16_compare_timer_0_r )  { return compare_timer_r(machine, 0, offset, mem_mask); }
699READ16_HANDLER( segaic16_compare_timer_1_r )  { return compare_timer_r(machine, 1, offset, mem_mask); }
700WRITE16_HANDLER( segaic16_compare_timer_0_w ) { compare_timer_w(machine, 0, offset, data, mem_mask); }
701WRITE16_HANDLER( segaic16_compare_timer_1_w ) { compare_timer_w(machine, 1, offset, data, mem_mask); }
src/mame/machine/pckeybrd.c
r2864r2865
1717*/
1818
1919#include "driver.h"
20#include "deprecat.h"
2120#include "machine/pckeybrd.h"
2221
2322#ifdef MESS
r2864r2865
318317
319318
320319
321void at_keyboard_init(AT_KEYBOARD_TYPE type)
320void at_keyboard_init(running_machine *machine, AT_KEYBOARD_TYPE type)
322321{
323322   int i;
324323
r2864r2865
343342   {
344343      char buf[40];
345344      sprintf(buf, "pc_keyboard_%d", i);
346      keyboard.ports[i] = input_port_by_tag(Machine->portconfig, buf);
345      keyboard.ports[i] = input_port_by_tag(machine->portconfig, buf);
347346   }
348347
349348#ifdef MESS
src/mame/machine/n64.c
r2864r2865
2727static UINT32 mi_interrupt = 0;
2828static UINT32 mi_intr_mask = 0;
2929
30void signal_rcp_interrupt(int interrupt)
30void signal_rcp_interrupt(running_machine *machine, int interrupt)
3131{
3232   if (mi_intr_mask & interrupt)
3333   {
3434      mi_interrupt |= interrupt;
3535
36      cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ0, ASSERT_LINE);
36      cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, ASSERT_LINE);
3737   }
3838}
3939
40void clear_rcp_interrupt(int interrupt)
40void clear_rcp_interrupt(running_machine *machine, int interrupt)
4141{
4242   mi_interrupt &= ~interrupt;
4343
4444   //if (!mi_interrupt)
4545   {
46      cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ0, CLEAR_LINE);
46      cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, CLEAR_LINE);
4747   }
4848}
4949
r2864r2865
7575      case 0x00/4:      // MI_INIT_MODE_REG
7676         if (data & 0x0800)
7777         {
78            clear_rcp_interrupt(DP_INTERRUPT);
78            clear_rcp_interrupt(machine, DP_INTERRUPT);
7979         }
8080         break;
8181
r2864r2865
223223
224224        if (cpunum_get_info_int(1, CPUINFO_INT_REGISTER + RSP_SR) & RSP_STATUS_INTR_BREAK)
225225      {
226         signal_rcp_interrupt(SP_INTERRUPT);
226         signal_rcp_interrupt(Machine, SP_INTERRUPT);
227227      }
228228   }
229229}
r2864r2865
336336                }
337337                if (data & 0x00000008)      // clear interrupt
338338                {
339                    clear_rcp_interrupt(SP_INTERRUPT);
339                    clear_rcp_interrupt(machine, SP_INTERRUPT);
340340                }
341341                if (data & 0x00000010)      // set interrupt
342342                {
343                    signal_rcp_interrupt(SP_INTERRUPT);
343                    signal_rcp_interrupt(machine, SP_INTERRUPT);
344344                }
345345                if (data & 0x00000020)
346346                {
r2864r2865
491491UINT32 dp_status = 0;
492492
493493
494void dp_full_sync(void)
494void dp_full_sync(running_machine *machine)
495495{
496   signal_rcp_interrupt(DP_INTERRUPT);
496   signal_rcp_interrupt(machine, DP_INTERRUPT);
497497}
498498
499499READ32_HANDLER( n64_dp_reg_r )
r2864r2865
657657         break;
658658
659659      case 0x10/4:      // VI_CURRENT_REG
660         clear_rcp_interrupt(VI_INTERRUPT);
660         clear_rcp_interrupt(machine, VI_INTERRUPT);
661661         break;
662662
663663      case 0x14/4:      // VI_BURST_REG
r2864r2865
735735static int audio_fifo_rpos = 0;
736736static int audio_fifo_num = 0;
737737
738static void audio_fifo_push(UINT32 address, UINT32 length)
738static void audio_fifo_push(running_machine *machine, UINT32 address, UINT32 length)
739739{
740740    AUDIO_DMA *current;
741741
r2864r2865
765765
766766    if (! (ai_status & 0x40000000))
767767    {
768        signal_rcp_interrupt(AI_INTERRUPT);
768        signal_rcp_interrupt(machine, AI_INTERRUPT);
769769        start_audio_dma();
770770    }
771771}
772772
773static void audio_fifo_pop(void)
773static void audio_fifo_pop(running_machine *machine)
774774{
775775    audio_fifo_rpos++;
776776    audio_fifo_num--;
r2864r2865
788788    if (audio_fifo_num < AUDIO_DMA_DEPTH)
789789    {
790790        ai_status &= ~0x80000001;   // FIFO not full
791        signal_rcp_interrupt(AI_INTERRUPT);
791        signal_rcp_interrupt(machine, AI_INTERRUPT);
792792    }
793793}
794794
r2864r2865
832832
833833static TIMER_CALLBACK( audio_timer_callback )
834834{
835    audio_fifo_pop();
835    audio_fifo_pop(machine);
836836
837837    // keep playing if there's another DMA queued
838838    if (audio_fifo_get_top() != NULL)
839839    {
840840        start_audio_dma();
841        signal_rcp_interrupt(AI_INTERRUPT);
841        signal_rcp_interrupt(machine, AI_INTERRUPT);
842842    }
843843    else
844844    {
r2864r2865
890890        case 0x04/4:        // AI_LEN_REG
891891//          mame_printf_debug("ai_len = %08X at %08X\n", data, activecpu_get_pc());
892892            ai_len = data & 0x3ffff;        // Hardware v2.0 has 18 bits, v1.0 has 15 bits
893            audio_fifo_push(ai_dram_addr, ai_len);
893            audio_fifo_push(machine, ai_dram_addr, ai_len);
894894            break;
895895
896896        case 0x08/4:        // AI_CONTROL_REG
r2864r2865
899899            break;
900900
901901        case 0x0c/4:
902            clear_rcp_interrupt(AI_INTERRUPT);
902            clear_rcp_interrupt(machine, AI_INTERRUPT);
903903            break;
904904
905905        case 0x10/4:        // AI_DACRATE_REG
r2864r2865
985985            }
986986         }
987987
988         signal_rcp_interrupt(PI_INTERRUPT);
988         signal_rcp_interrupt(machine, PI_INTERRUPT);
989989         break;
990990      }
991991
r2864r2865
10161016               pi_dram_addr += 1;
10171017            }
10181018         }
1019         signal_rcp_interrupt(PI_INTERRUPT);
1019         signal_rcp_interrupt(machine, PI_INTERRUPT);
10201020
10211021         if (pi_first_dma)
10221022         {
r2864r2865
10331033      {
10341034         if (data & 0x2)
10351035         {
1036            clear_rcp_interrupt(PI_INTERRUPT);
1036            clear_rcp_interrupt(machine, PI_INTERRUPT);
10371037         }
10381038         break;
10391039      }
r2864r2865
14831483   }
14841484
14851485   si_status |= 0x1000;
1486   signal_rcp_interrupt(SI_INTERRUPT);
1486   signal_rcp_interrupt(machine, SI_INTERRUPT);
14871487}
14881488
14891489READ32_HANDLER( n64_si_reg_r )
r2864r2865
15221522
15231523      case 0x18/4:      // SI_STATUS_REG
15241524         si_status &= ~0x1000;
1525         clear_rcp_interrupt(SI_INTERRUPT);
1525         clear_rcp_interrupt(machine, SI_INTERRUPT);
15261526         break;
15271527
15281528      default:
r2864r2865
15691569    }
15701570    */
15711571
1572    signal_rcp_interrupt(SI_INTERRUPT);
1572    signal_rcp_interrupt(machine, SI_INTERRUPT);
15731573}
15741574
15751575//static UINT16 crc_seed = 0x3f;
15761576
1577void n64_machine_reset(void)
1577void n64_machine_reset(running_machine *machine)
15781578{
15791579   int i;
15801580   //UINT32 *pif_rom   = (UINT32*)memory_region(REGION_USER1);
r2864r2865
16421642   audio_timer = timer_alloc(audio_timer_callback, NULL);
16431643   timer_adjust_oneshot(audio_timer, attotime_never, 0);
16441644
1645   cpunum_set_input_line(Machine, 1, INPUT_LINE_HALT, ASSERT_LINE);
1645   cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, ASSERT_LINE);
16461646
16471647    // bootcode differs between CIC-chips, so we can use its checksum to detect the CIC-chip
16481648    boot_checksum = 0;
src/mame/machine/pckeybrd.h
r2864r2865
1919   AT_KEYBOARD_TYPE_MF2
2020} AT_KEYBOARD_TYPE;
2121
22void at_keyboard_init(AT_KEYBOARD_TYPE type);
22void at_keyboard_init(running_machine *machine, AT_KEYBOARD_TYPE type);
2323
2424void at_keyboard_polling(void);
2525int at_keyboard_read(void);
src/mame/machine/model3.c
r2864r2865
55*/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "includes/model3.h"
109
1110static int m3_step;
r2864r2865
288287/*****************************************************************************/
289288/* Epson RTC-72421 */
290289
291static UINT8 rtc_get_reg(int reg)
290static UINT8 rtc_get_reg(running_machine *machine, int reg)
292291{
293292   mame_system_time systime;
294293
295   mame_get_current_datetime(Machine, &systime);
294   mame_get_current_datetime(machine, &systime);
296295
297296   switch(reg)
298297   {
r2864r2865
354353{
355354   int reg = offset;
356355   UINT32 data;
357   data = rtc_get_reg(reg) << 24;
356   data = rtc_get_reg(machine, reg) << 24;
358357   data |= 0x30000;   /* these bits are set to pass the battery voltage test */
359358   return data;
360359}
src/mame/machine/balsente.c
r2864r2865
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "cpu/m6809/m6809.h"
1211#include "balsente.h"
1312#include "sound/cem3394.h"
r2864r2865
1817
1918/* local prototypes */
2019static void poly17_init(void);
21static void counter_set_out(int which, int gate);
20static void counter_set_out(running_machine *machine, int which, int gate);
2221static TIMER_CALLBACK( counter_callback );
2322static TIMER_CALLBACK( clock_counter_0_ff );
2423static void update_grudge_steering(running_machine *machine);
r2864r2865
392391 *
393392 *************************************/
394393
395static void m6850_update_io(void)
394static void m6850_update_io(running_machine *machine)
396395{
397396   UINT8 new_state;
398397
r2864r2865
448447   /* apply the change */
449448   if (new_state && !(m6850_status & 0x80))
450449   {
451      cpunum_set_input_line(Machine, 0, M6809_FIRQ_LINE, ASSERT_LINE);
450      cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, ASSERT_LINE);
452451      m6850_status |= 0x80;
453452   }
454453   else if (!new_state && (m6850_status & 0x80))
455454   {
456      cpunum_set_input_line(Machine, 0, M6809_FIRQ_LINE, CLEAR_LINE);
455      cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, CLEAR_LINE);
457456      m6850_status &= ~0x80;
458457   }
459458
r2864r2865
466465   /* apply the change */
467466   if (new_state && !(m6850_sound_status & 0x80))
468467   {
469      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, ASSERT_LINE);
468      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, ASSERT_LINE);
470469      m6850_sound_status |= 0x80;
471470   }
472471   else if (!new_state && (m6850_sound_status & 0x80))
473472   {
474      cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, CLEAR_LINE);
473      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, CLEAR_LINE);
475474      m6850_sound_status &= ~0x80;
476475   }
477476}
r2864r2865
501500
502501      /* clear the overrun and receive buffer full bits */
503502      m6850_status &= ~0x21;
504      m6850_update_io();
503      m6850_update_io(machine);
505504   }
506505
507506   return result;
r2864r2865
513512   /* set the output data byte and indicate that we're ready to go */
514513   m6850_output = param;
515514   m6850_data_ready = 1;
516   m6850_update_io();
515   m6850_update_io(machine);
517516}
518517
519518
r2864r2865
521520{
522521   /* indicate that the transmit buffer is no longer empty and update the I/O state */
523522   m6850_status &= ~0x02;
524   m6850_update_io();
523   m6850_update_io(machine);
525524
526525   /* set a timer for 500usec later to actually transmit the data */
527526   /* (this is very important for several games, esp Snacks'n Jaxson) */
r2864r2865
537536      m6850_control = data;
538537
539538      /* re-update since interrupt enables could have been modified */
540      m6850_update_io();
539      m6850_update_io(machine);
541540   }
542541
543542   /* output register is at offset 1; set a timer to synchronize the CPUs */
r2864r2865
570569
571570      /* clear the overrun and receive buffer full bits */
572571      m6850_sound_status &= ~0x21;
573      m6850_update_io();
572      m6850_update_io(machine);
574573   }
575574
576575   return result;
r2864r2865
591590   }
592591
593592   /* re-update since interrupt enables could have been modified */
594   m6850_update_io();
593   m6850_update_io(machine);
595594}
596595
597596
r2864r2865
720719 *
721720 *************************************/
722721
723static void counter_set_gate(int which, int gate)
722static void counter_set_gate(running_machine *machine, int which, int gate)
724723{
725724   int oldgate = counter[which].gate;
726725
r2864r2865
740739      /* mode 1 waits for the gate to trigger the counter */
741740      if (counter[which].mode == 1)
742741      {
743         counter_set_out(which, 0);
742         counter_set_out(machine, which, 0);
744743
745744         /* add one to the count; technically, OUT goes low on the next clock pulse */
746745         /* and then starts counting down; it's important that we don't count the first one */
r2864r2865
753752}
754753
755754
756static void counter_set_out(int which, int out)
755static void counter_set_out(running_machine *machine, int which, int out)
757756{
758757   /* OUT on counter 2 is hooked to the /INT line on the Z80 */
759758   if (which == 2)
760      cpunum_set_input_line(Machine, 1, 0, out ? ASSERT_LINE : CLEAR_LINE);
759      cpunum_set_input_line(machine, 1, 0, out ? ASSERT_LINE : CLEAR_LINE);
761760
762761   /* OUT on counter 0 is hooked to the GATE line on counter 1 */
763762   else if (which == 0)
764      counter_set_gate(1, !out);
763      counter_set_gate(machine, 1, !out);
765764
766765   /* remember the out state */
767766   counter[which].out = out;
r2864r2865
777776   /* set the state of the OUT line */
778777   /* mode 0 and 1: when firing, transition OUT to high */
779778   if (counter[param].mode == 0 || counter[param].mode == 1)
780      counter_set_out(param, 1);
779      counter_set_out(machine, param, 1);
781780
782781   /* no other modes handled currently */
783782}
r2864r2865
840839
841840         /* if the counter is in mode 0, a write here will reset the OUT state */
842841         if (counter[which].mode == 0)
843            counter_set_out(which, 0);
842            counter_set_out(machine, which, 0);
844843
845844         /* write the LSB */
846845         if (counter[which].writebyte == 0)
r2864r2865
869868
870869            /* if the counter is in mode 1, a write here will set the OUT state */
871870            if (counter[which].mode == 1)
872               counter_set_out(which, 1);
871               counter_set_out(machine, which, 1);
873872         }
874873         break;
875874
r2864r2865
880879
881880         /* if the counter was in mode 0, a write here will reset the OUT state */
882881         if (((counter[which].mode >> 1) & 7) == 0)
883            counter_set_out(which, 0);
882            counter_set_out(machine, which, 0);
884883
885884         /* set the mode */
886885         counter[which].mode = (data >> 1) & 7;
887886
888887         /* if the counter is in mode 0, a write here will reset the OUT state */
889888         if (counter[which].mode == 0)
890            counter_set_out(which, 0);
889            counter_set_out(machine, which, 0);
891890         break;
892891   }
893892}
r2864r2865
10121011   }
10131012
10141013   /* set the actual gate afterwards, since we need to know the old value above */
1015   counter_set_gate(0, (data >> 1) & 1);
1014   counter_set_gate(machine, 0, (data >> 1) & 1);
10161015
10171016   /* bits D2 and D4 control the clear/reset flags on the flip-flop that feeds counter 0 */
10181017   if (!(data & 0x04)) set_counter_0_ff(machine, 1);
10191018   if (!(data & 0x10)) set_counter_0_ff(machine, 0);
10201019
10211020   /* bit 5 clears the NMI interrupt; recompute the I/O state now */
1022   m6850_update_io();
1021   m6850_update_io(machine);
10231022}
10241023
10251024
src/mame/machine/snes.c
r2864r2865
1313#define __MACHINE_SNES_C
1414
1515#include "driver.h"
16#include "deprecat.h"
1716#include "includes/snes.h"
1817#include "cpu/g65816/g65816.h"
1918#ifdef MESS
r2864r2865
6261} joypad[4];
6362
6463// utility function - latches the H/V counters.  Used by IRQ, writes to WRIO, etc.
65static void snes_latch_counters(void)
64static void snes_latch_counters(running_machine *machine)
6665{
67   snes_ppu.beam.current_horz = video_screen_get_hpos(Machine->primary_screen) / snes_htmult;
68   snes_ppu.beam.latch_vert = video_screen_get_vpos(Machine->primary_screen);
66   snes_ppu.beam.current_horz = video_screen_get_hpos(machine->primary_screen) / snes_htmult;
67   snes_ppu.beam.latch_vert = video_screen_get_vpos(machine->primary_screen);
6968   snes_ppu.beam.latch_horz = snes_ppu.beam.current_horz;
7069   snes_ram[STAT78] |= 0x40;   // indicate we latched
7170   read_ophct = read_opvct = 0;   // clear read flags
r2864r2865
8281   timer_adjust_oneshot(snes_nmi_timer, attotime_never, 0);
8382}
8483
85static void snes_hirq_tick(void)
84static void snes_hirq_tick(running_machine *machine)
8685{
8786   // latch the counters and pull IRQ
8887   // (don't need to switch to the 65816 context, we don't do anything dependant on it)
89   snes_latch_counters();
88   snes_latch_counters(machine);
9089   snes_ram[TIMEUP] = 0x80;   /* Indicate that irq occured */
91   cpunum_set_input_line(Machine, 0, G65816_LINE_IRQ, HOLD_LINE );
90   cpunum_set_input_line(machine, 0, G65816_LINE_IRQ, HOLD_LINE );
9291
9392   // don't happen again
9493   timer_adjust_oneshot(snes_hirq_timer, attotime_never, 0);
r2864r2865
9695
9796static TIMER_CALLBACK( snes_hirq_tick_callback )
9897{
99   snes_hirq_tick();
98   snes_hirq_tick(machine);
10099}
101100
102101static TIMER_CALLBACK( snes_scanline_tick )
r2864r2865
117116      {
118117         snes_ram[TIMEUP] = 0x80;   /* Indicate that irq occured */
119118         // IRQ latches the counters, do it now
120         snes_latch_counters();
119         snes_latch_counters(machine);
121120         cpunum_set_input_line(machine, 0, G65816_LINE_IRQ, HOLD_LINE );
122121      }
123122   }
r2864r2865
141140//          printf("HIRQ @ %d, %d\n", pixel*snes_htmult, snes_ppu.beam.current_vert);
142141         if (pixel == 0)
143142         {
144            snes_hirq_tick();
143            snes_hirq_tick(machine);
145144         }
146145         else
147146         {
r2864r2865
176175   {
177176      int i;
178177
179      joypad[0].low = input_port_read_indexed(machine,  0 );
180      joypad[0].high = input_port_read_indexed(machine,  1 );
181      joypad[1].low = input_port_read_indexed(machine,  2 );
182      joypad[1].high = input_port_read_indexed(machine,  3 );
183      joypad[2].low = input_port_read_indexed(machine,  4 );
184      joypad[2].high = input_port_read_indexed(machine,  5 );
185      joypad[3].low = input_port_read_indexed(machine,  6 );
186      joypad[3].high = input_port_read_indexed(machine,  7 );
178      joypad[0].low  = input_port_read(machine, "PAD1L");
179      joypad[0].high = input_port_read(machine, "PAD1H");
180      joypad[1].low  = input_port_read(machine, "PAD2L");
181      joypad[1].high = input_port_read(machine, "PAD2H");
182      joypad[2].low  = input_port_read(machine, "PAD3L");
183      joypad[2].high = input_port_read(machine, "PAD3H");
184      joypad[3].low  = input_port_read(machine, "PAD4L");
185      joypad[3].high = input_port_read(machine, "PAD4H");
187186
188187      // avoid sending signals that could crash games
189188      for (i = 0; i < 4; i++)
r2864r2865
729728            return snes_ram[offset];
730729         }
731730      case SLHV:      /* Software latch for H/V counter */
732         snes_latch_counters();
731         snes_latch_counters(machine);
733732         return 0x0;      /* Return value is meaningless */
734733      case ROAMDATA:   /* Read data from OAM (DR) */
735734         {
r2864r2865
953952#ifndef MESS
954953      case 0x4100:      /* NSS Dip-Switches */
955954#ifdef MAME_DEBUG
956         return input_port_read_indexed(machine, 12);
955         return input_port_read_safe(machine, "DEBUG1", 0);
957956#else
958         return input_port_read_indexed(machine, 9);
957         return input_port_read(machine, "DSW");
959958#endif   /* MAME_DEBUG */
960959//      case 0x4101: //PC: a104 - a10e - a12a   //only nss_actr
961960//      case 0x420c: //PC: 9c7d - 8fab          //only nss_ssoc
r2864r2865
13841383         if (!(snes_ram[WRIO] & 0x80) && (data & 0x80))
13851384         {
13861385            // external latch
1387            snes_latch_counters();
1386            snes_latch_counters(machine);
13881387         }
13891388      case WRMPYA:   /* Multiplier A */
13901389         break;
src/mame/machine/vertigo.c
r2864r2865
108108static PIT8253_OUTPUT_CHANGED( v_irq3_w )
109109{
110110   if (state)
111      cpunum_set_input_line(Machine, 1, INPUT_LINE_IRQ0, ASSERT_LINE);
111      cpunum_set_input_line(device->machine, 1, INPUT_LINE_IRQ0, ASSERT_LINE);
112112
113113   update_irq_encoder(INPUT_LINE_IRQ3, state);
114114}
src/mame/machine/pcshare.c
r2864r2865
3838static TIMER_CALLBACK( pc_keyb_timer );
3939
4040
41void init_pc_common(UINT32 flags, void (*set_keyb_int_func)(int))
41void init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(int))
4242{
4343   /* PC-XT keyboard */
4444   if (flags & PCCOMMON_KEYBOARD_AT)
45      at_keyboard_init(AT_KEYBOARD_TYPE_AT);
45      at_keyboard_init(machine, AT_KEYBOARD_TYPE_AT);
4646   else
47      at_keyboard_init(AT_KEYBOARD_TYPE_PC);
47      at_keyboard_init(machine, AT_KEYBOARD_TYPE_PC);
4848   at_keyboard_set_scan_code_set(1);
4949
5050   set_keyb_int = set_keyb_int_func;
src/mame/machine/pcshare.h
r2864r2865
44#define PCCOMMON_KEYBOARD_PC   0
55#define PCCOMMON_KEYBOARD_AT   1
66
7void init_pc_common(UINT32 flags, void (*set_keyb_int_func)(int));
7void init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(int));
88
99void pc_keyboard(void);
1010UINT8 pc_keyb_read(void);
src/mame/machine/atarigen.c
r2864r2865
88
99
1010#include "driver.h"
11#include "deprecat.h"
1211#include "atarigen.h"
1312#include "slapstic.h"
1413#include "cpu/m6502/m6502.h"
r2864r2865
536535    slapstic and sets the chip number.
537536---------------------------------------------------------------*/
538537
539void atarigen_slapstic_init(int cpunum, offs_t base, offs_t mirror, int chipnum)
538void atarigen_slapstic_init(running_machine *machine, int cpunum, offs_t base, offs_t mirror, int chipnum)
540539{
541540   /* reset in case we have no state */
542541   atarigen_slapstic_num = chipnum;
r2864r2865
546545   if (chipnum != 0)
547546   {
548547      /* initialize the slapstic */
549      slapstic_init(chipnum);
548      slapstic_init(machine, chipnum);
550549
551550      /* install the memory handlers */
552      atarigen_slapstic = memory_install_readwrite16_handler(Machine, cpunum, ADDRESS_SPACE_PROGRAM, base, base + 0x7fff, 0, mirror, atarigen_slapstic_r, atarigen_slapstic_w);
551      atarigen_slapstic = memory_install_readwrite16_handler(machine, cpunum, ADDRESS_SPACE_PROGRAM, base, base + 0x7fff, 0, mirror, atarigen_slapstic_r, atarigen_slapstic_w);
553552
554553      /* allocate memory for a copy of bank 0 */
555554      atarigen_slapstic_bank0 = auto_malloc(0x2000);
src/mame/machine/atarigen.h
r2864r2865
134134    SLAPSTIC HANDLING
135135---------------------------------------------------------------*/
136136
137void atarigen_slapstic_init(int cpunum, offs_t base, offs_t mirror, int chipnum);
137void atarigen_slapstic_init(running_machine *machine, int cpunum, offs_t base, offs_t mirror, int chipnum);
138138void atarigen_slapstic_reset(void);
139139
140140WRITE16_HANDLER( atarigen_slapstic_w );
src/mame/machine/midwunit.c
r2864r2865
434434/*  printf("in=%04X%04X  out=%04X%04X\n", umk3_palette[3], umk3_palette[2], umk3_palette[1], umk3_palette[0]); */
435435}
436436
437static void init_mk3_common(void)
437static void init_mk3_common(running_machine *machine)
438438{
439439   /* common init */
440440   init_wunit_generic();
441441
442442   /* serial prefixes 439, 528 */
443   midway_serial_pic_init(528);
443   midway_serial_pic_init(machine, 528);
444444}
445445
446446DRIVER_INIT( mk3 )
447447{
448   init_mk3_common();
448   init_mk3_common(machine);
449449}
450450
451451DRIVER_INIT( mk3r20 )
452452{
453   init_mk3_common();
453   init_mk3_common(machine);
454454}
455455
456456DRIVER_INIT( mk3r10 )
457457{
458   init_mk3_common();
458   init_mk3_common(machine);
459459}
460460
461461DRIVER_INIT( umk3 )
462462{
463   init_mk3_common();
463   init_mk3_common(machine);
464464   umk3_palette = memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0106a060, 0x0106a09f, 0, 0, umk3_palette_hack_w);
465465}
466466
467467DRIVER_INIT( umk3r11 )
468468{
469   init_mk3_common();
469   init_mk3_common(machine);
470470   umk3_palette = memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0106a060, 0x0106a09f, 0, 0, umk3_palette_hack_w);
471471}
472472
r2864r2865
479479   init_wunit_generic();
480480
481481   /* serial prefixes 438, 528 */
482   midway_serial_pic_init(528);
482   midway_serial_pic_init(machine, 528);
483483}
484484
485485
r2864r2865
491491   init_wunit_generic();
492492
493493   /* serial prefixes 459, 470, 528 */
494   midway_serial_pic_init(528);
494   midway_serial_pic_init(machine, 528);
495495}
496496
497497
r2864r2865
555555   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01800000, 0x0180000f, 0, 0, wwfmania_io_0_w);
556556
557557   /* serial prefixes 430, 528 */
558   midway_serial_pic_init(528);
558   midway_serial_pic_init(machine, 528);
559559}
560560
561561
r2864r2865
567567   init_wunit_generic();
568568
569569   /* serial prefixes 465, 528 */
570   midway_serial_pic_init(528);
570   midway_serial_pic_init(machine, 528);
571571}
572572
573573
r2864r2865
600600   dcs_init();
601601
602602   /* serial prefixes 419, 420 */
603   midway_serial_pic_init(419);
603   midway_serial_pic_init(machine, 419);
604604}
605605
606606
src/mame/machine/namco50.c
r2864r2865
130130***************************************************************************/
131131
132132#include "driver.h"
133#include "deprecat.h"
134133#include "namco50.h"
135134#include "cpu/mb88xx/mb88xx.h"
136135
r2864r2865
258257   cpunum_set_input_line(machine, param, 0, CLEAR_LINE);
259258}
260259
261static void namco_50xx_irq_set(int cpunum)
260static void namco_50xx_irq_set(running_machine *machine, int cpunum)
262261{
263   cpunum_set_input_line(Machine, cpunum, 0, ASSERT_LINE);
262   cpunum_set_input_line(machine, cpunum, 0, ASSERT_LINE);
264263
265264   // The execution time of one instruction is ~4us, so we must make sure to
266265   // give the cpu time to poll the /IRQ input before we clear it.
r2864r2865
270269   timer_set(ATTOTIME_IN_USEC(21), NULL, cpunum, namco_50xx_irq_clear);
271270}
272271
273void namco_50xx_write(UINT8 data)
272void namco_50xx_write(running_machine *machine, UINT8 data)
274273{
275   int cpunum = mame_find_cpu_index(Machine, CPUTAG_50XX);
274   int cpunum = mame_find_cpu_index(machine, CPUTAG_50XX);
276275
277276   if (cpunum == -1)
278277      return;
279278
280279   timer_call_after_resynch(NULL, data, namco_50xx_latch_callback);
281280
282   namco_50xx_irq_set(cpunum);
281   namco_50xx_irq_set(machine, cpunum);
283282}
284283
285void namco_50xx_2_write(UINT8 data)
284void namco_50xx_2_write(running_machine *machine, UINT8 data)
286285{
287   int cpunum = mame_find_cpu_index(Machine, CPUTAG_50XX_2);
286   int cpunum = mame_find_cpu_index(machine, CPUTAG_50XX_2);
288287
289288   if (cpunum == -1)
290289      return;
291290
292291   timer_call_after_resynch(NULL, data, namco_50xx_2_latch_callback);
293292
294   namco_50xx_irq_set(cpunum);
293   namco_50xx_irq_set(machine, cpunum);
295294}
296295
297296
298void namco_50xx_read_request(void)
297void namco_50xx_read_request(running_machine *machine)
299298{
300   int cpunum = mame_find_cpu_index(Machine, CPUTAG_50XX);
299   int cpunum = mame_find_cpu_index(machine, CPUTAG_50XX);
301300
302301   if (cpunum == -1)
303302      return;
304303
305304   timer_call_after_resynch(NULL, 0, namco_50xx_readrequest_callback);
306305
307   namco_50xx_irq_set(cpunum);
306   namco_50xx_irq_set(machine, cpunum);
308307}
309308
310void namco_50xx_2_read_request(void)
309void namco_50xx_2_read_request(running_machine *machine)
311310{
312   int cpunum = mame_find_cpu_index(Machine, CPUTAG_50XX_2);
311   int cpunum = mame_find_cpu_index(machine, CPUTAG_50XX_2);
313312
314313   if (cpunum == -1)
315314      return;
316315
317316   timer_call_after_resynch(NULL, 0, namco_50xx_2_readrequest_callback);
318317
319   namco_50xx_irq_set(cpunum);
318   namco_50xx_irq_set(machine, cpunum);
320319}
321320
322321
323UINT8 namco_50xx_read(void)
322UINT8 namco_50xx_read(running_machine *machine)
324323{
325324   UINT8 res = portO[0];
326325
327   namco_50xx_read_request();
326   namco_50xx_read_request(machine);
328327
329328   return res;
330329}
331330
332UINT8 namco_50xx_2_read(void)
331UINT8 namco_50xx_2_read(running_machine *machine)
333332{
334333   UINT8 res = portO[1];
335334
336   namco_50xx_2_read_request();
335   namco_50xx_2_read_request(machine);
337336
338337   return res;
339338}
src/mame/machine/namco50.h
r2864r2865
1212ADDRESS_MAP_EXTERN( namco_50xx_2_map_data, 8 );
1313ADDRESS_MAP_EXTERN( namco_50xx_2_map_io, 8 );
1414
15UINT8 namco_50xx_read(void);
16void namco_50xx_read_request(void);
17void namco_50xx_write(UINT8 data);
15UINT8 namco_50xx_read(running_machine *machine);
16void namco_50xx_read_request(running_machine *machine);
17void namco_50xx_write(running_machine *machine, UINT8 data);
1818
19UINT8 namco_50xx_2_read(void);
20void namco_50xx_2_read_request(void);
21void namco_50xx_2_write(UINT8 data);
19UINT8 namco_50xx_2_read(running_machine *machine);
20void namco_50xx_2_read_request(running_machine *machine);
21void namco_50xx_2_write(running_machine *machine, UINT8 data);
2222
2323#endif   /* NAMCO54_H */
src/mame/machine/gaelco2.c
r2864r2865
194194   /* bit 6 is EEPROM data (DOUT) */
195195   /* bit 7 is EEPROM ready */
196196   /* bits 0-5, COINSW, STARTSW & Service */
197   return (1 << 7) | (eeprom_read_bit() << 6) | (input_port_read_indexed(machine, 2) & 0x3f);
197   return (1 << 7) | (eeprom_read_bit() << 6) | (input_port_read(machine, "COIN") & 0x3f);
198198}
199199
200200WRITE16_HANDLER( gaelco2_eeprom_cs_w )
src/mame/machine/decoprot.c
r2864r2865
128128{
129129   switch (offset<<1) {
130130      case 0x110: /* Player input */
131         return input_port_read_indexed(machine, 0);
131         return input_port_read(machine, "IN0");
132132
133133      case 0x36c: /* Coins */
134134      case 0x334: /* Probably also, c6, 2c0, 2e0, 4b2, 46a, 4da, rohga is 44c */
135         return input_port_read_indexed(machine, 1);
135         return input_port_read(machine, "IN1");
136136      case 0x0dc:
137         return input_port_read_indexed(machine, 1)<<4;
137         return input_port_read(machine, "IN1")<<4;
138138
139139      case 0x494: /* Dips */
140         return input_port_read_indexed(machine, 2);
140         return input_port_read(machine, "DSW1_2");
141141
142142      case 0x244:
143143         return deco16_prot_ram[0];
r2864r2865
360360
361361      /* Player 1 & 2 controls, read in IRQ then written *back* to protection device */
362362      case 0x50: /* written to 9e byte */
363         return input_port_read_indexed(machine, 0);
363         return input_port_read(machine, "IN0");
364364      case 0x6f8: /* written to 76 byte */
365         return (input_port_read_indexed(machine, 0)>>8)|(input_port_read_indexed(machine, 0)<<8); /* byte swap IN0 */
365         return (input_port_read(machine, "IN0")>>8)|(input_port_read(machine, "IN0")<<8); /* byte swap IN0 */
366366
367367      case 0x5c: /* After coin insert, high 0x8000 bit set starts game */
368368         return deco16_prot_ram[0x3b];
r2864r2865
372372         return ((deco16_prot_ram[0x9e/2]&0xff00)>>8) | ((deco16_prot_ram[0x9e/2]&0x00ff)<<8);
373373
374374      case 0xac: /* Dip switches */
375         return input_port_read_indexed(machine, 2);
375         return input_port_read(machine, "DSW");
376376      case 0xc2:
377         return input_port_read_indexed(machine, 2) ^ deco16_prot_ram[0x2c/2];
377         return input_port_read(machine, "DSW") ^ deco16_prot_ram[0x2c/2];
378378
379379      case 0x5d4: /* The state of the dips last frame */
380380         return deco16_prot_ram[0x34/2];
r2864r2865
386386         return (((deco16_prot_ram[0]&0xfff0)>>0) | ((deco16_prot_ram[0]&0x000c)>>2) | ((deco16_prot_ram[0]&0x0003)<<2)) & (~deco16_prot_ram[0x36/2]);
387387
388388      case 0x76a: /* Coins */
389         return input_port_read_indexed(machine, 1);
389         return input_port_read(machine, "IN1");
390390
391391      case 0x284: /* Bit shifting with inverted mask register */
392392         return (((deco16_prot_ram[0x40/2]&0xfff0)>>0) | ((deco16_prot_ram[0x40/2]&0x0007)<<1) | ((deco16_prot_ram[0x40/2]&0x0008)>>3)) & (~deco16_prot_ram[0x36/2]);
r2864r2865
400400         return (((deco16_prot_ram[0x6a/2]&0x00f0)<<4) | ((deco16_prot_ram[0x6a/2]&0x0f00)<<4) | ((deco16_prot_ram[0x6a/2]&0x0007)<<5) | ((deco16_prot_ram[0x6a/2]&0x0008)<<1)) & (~deco16_prot_ram[0x36/2]);
401401
402402      case 0x7d6: /* XOR IN0 */
403         return input_port_read_indexed(machine, 0) ^ deco16_prot_ram[0x2c/2];
403         return input_port_read(machine, "IN0") ^ deco16_prot_ram[0x2c/2];
404404      case 0x4b4:
405405         return ((deco16_prot_ram[0x32/2]&0x00f0)<<8) | ((deco16_prot_ram[0x32/2]&0x000e)<<7) | ((deco16_prot_ram[0x32/2]&0x0001)<<11);
406406   }
r2864r2865
461461
462462    switch (offset*2) {
463463      case 0xac: /* Dip switches */
464         return input_port_read_indexed(machine, 2);
464         return input_port_read(machine, "DSW");
465465      case 0xc2: /* Dip switches */
466         return input_port_read_indexed(machine, 2) ^ deco16_prot_ram[0x2c/2];
466         return input_port_read(machine, "DSW") ^ deco16_prot_ram[0x2c/2];
467467      case 0x46: /* Coins */
468         return input_port_read_indexed(machine, 1) ^ deco16_prot_ram[0x2c/2];
468         return input_port_read(machine, "IN1") ^ deco16_prot_ram[0x2c/2];
469469      case 0x50: /* Player 1 & 2 input ports */
470         return input_port_read_indexed(machine, 0);
470         return input_port_read(machine, "IN0");
471471      case 0x63c: /* Player 1 & 2 input ports */
472         return input_port_read_indexed(machine, 0) ^ deco16_prot_ram[0x2c/2];
472         return input_port_read(machine, "IN0") ^ deco16_prot_ram[0x2c/2];
473473
474474      case 0x5f4:
475475         return deco16_prot_ram[0x18/2];
r2864r2865
644644         return deco16_prot_ram[15];
645645
646646      case 0x36: /* Dip switches */
647         return input_port_read_indexed(machine, 2);
647         return input_port_read(machine, "DSW");
648648
649649      case 0x1c8: /* Coins */
650         return input_port_read_indexed(machine, 1);
650         return input_port_read(machine, "IN1");
651651
652652      case 0x22c: /* Player 1 & 2 input ports */
653         return input_port_read_indexed(machine, 0);
653         return input_port_read(machine, "IN0");
654654   }
655655
656656   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",activecpu_get_pc(),offset);
r2864r2865
740740         return ((deco16_prot_ram[0x78e>>1]>>4)&0xff00) | (deco16_prot_ram[0x78e>>1]&0x000f) | ((deco16_prot_ram[0x78e>>1]<<8)&0xf000);
741741
742742      case 0x00c >> 1: /* Player 1 & Player 2 joysticks & fire buttons */
743         return (input_port_read_indexed(machine, 0) + (input_port_read_indexed(machine, 1) << 8));
743         return (input_port_read(machine, "P1") + (input_port_read(machine, "P2") << 8));
744744      case 0x778 >> 1: /* Credits */
745         return input_port_read_indexed(machine, 2);
745         return input_port_read(machine, "IN0");
746746      case 0x382 >> 1: /* DIPS */
747         return (input_port_read_indexed(machine, 3) + (input_port_read_indexed(machine, 4) << 8));
747         return (input_port_read(machine, "DSWA") + (input_port_read(machine, "DSWB") << 8));
748748   }
749749
750750   if (activecpu_get_pc()!=0xc0ea)
751      logerror("CPU #0 PC %06x: warning - read unmapped control address %06x (ctrl %04x)\n",activecpu_get_pc(),offset<<1, input_port_read_indexed(machine, 0));
751      logerror("CPU #0 PC %06x: warning - read unmapped control address %06x (ctrl %04x)\n", activecpu_get_pc(), offset<<1, input_port_read(machine, "P1"));
752752
753753   return 0;
754754}
r2864r2865
857857
858858   switch (offset) {
859859      case 0x88/2: /* Player 1 & 2 input ports */
860         return input_port_read_indexed(machine, 0);
860         return input_port_read(machine, "IN0");
861861      case 0x36c/2:
862         return input_port_read_indexed(machine, 1);
862         return input_port_read(machine, "IN1");
863863      case 0x44c/2:
864
865         return ((input_port_read_indexed(machine, 1)&0x7)<<13)|((input_port_read_indexed(machine, 1)&0x8)<<9);
864         return ((input_port_read(machine, "IN1") & 0x7)<<13)|((input_port_read(machine, "IN1") & 0x8)<<9);
866865      case 0x292/2: /* Dips */
867         return input_port_read_indexed(machine, 2);
866         return input_port_read(machine, "DSW1_2");
868867
869868      case 0x44/2:
870869         return ((((DECO_PORT(0x2c)&0x000f)<<12)) ^ deco16_xor) & (~deco16_mask);
r2864r2865
12411240   switch (offset)
12421241   {
12431242   case 0x582: /* Player 1 & Player 2 */
1244      return input_port_read_indexed(machine, 0);
1243      return input_port_read(machine, "IN0");
12451244   case 0x04c: /* Coins/VBL */
1246      return input_port_read_indexed(machine, 1);
1245      return input_port_read(machine, "IN1");
12471246   case 0x672: /* Dip switches */
1248      return input_port_read_indexed(machine, 2);
1247      return input_port_read(machine, "DSW1_2");
12491248
12501249   case 0x13a:
12511250      return ((DECO_PORT(0x190)&0x00f0)<<8) | ((DECO_PORT(0x190)&0x0003)<<10) | ((DECO_PORT(0x190)&0x000c)<<6);
r2864r2865
13031302
13041303   /*********************************************************************************/
13051304
1306//  case 0x582: return input_port_read_indexed(machine, 0); /* IN0 */
1307//  case 0x672: return input_port_read_indexed(machine, 1); /* IN1 */
1305//  case 0x582: return input_port_read(machine, "IN0"); /* IN0 */
1306//  case 0x672: return input_port_read(machine, "IN1"); /* IN1 */
13081307//  case 0x04c: return eeprom_read_bit();
13091308
13101309   case 0x468:
r2864r2865
16521651   /* Special case inputs, because this is the only game with an eprom */
16531652   switch (addr)
16541653   {
1655   case 0x582: return (input_port_read_indexed(machine, 0)<<16) | 0xffff; /* IN0 */
1656   case 0x672: return (input_port_read_indexed(machine, 1)<<16) | 0xffff; /* IN1 */
1654   case 0x582: return (input_port_read(machine, "IN0")<<16) | 0xffff; /* IN0 */
1655   case 0x672: return (input_port_read(machine, "IN1")<<16) | 0xffff; /* IN1 */
16571656   case 0x04c: return (eeprom_read_bit()<<16) | 0xffff;
16581657   }
16591658
r2864r2865
17281727{
17291728   switch (offset * 2)
17301729   {
1731   case 0x298: return input_port_read_indexed(machine,0);
1732   case 0x342: return input_port_read_indexed(machine,1);
1733   case 0x506: return input_port_read_indexed(machine,2);
1730   case 0x298: return input_port_read(machine, "IN0");
1731   case 0x342: return input_port_read(machine, "IN1");
1732   case 0x506: return input_port_read(machine, "DSW");
17341733   }
17351734
1736   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",activecpu_get_pc(),offset<<1);
1735   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", activecpu_get_pc(), offset<<1);
17371736
17381737   return 0;
17391738}
r2864r2865
17551754   const UINT16* prot_ram=deco16_prot_ram;
17561755   switch (offset * 2)
17571756   {
1758   case 0x5b2: return input_port_read_indexed(machine,0);
1759   case 0x44c: return input_port_read_indexed(machine,1);
1760   case 0x042: return input_port_read_indexed(machine,2);
1757   case 0x5b2: return input_port_read(machine, "IN0");
1758   case 0x44c: return input_port_read(machine, "DSW");
1759   case 0x042: return input_port_read(machine, "IN1");
17611760
17621761   case 0x510: return DECO_PORT(0);
17631762   case 0x51a: return DECO_PORT(2);
17641763   }
17651764
1766   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n",activecpu_get_pc(),offset<<1);
1765   logerror("Protection PC %06x: warning - read unmapped memory address %04x\n", activecpu_get_pc(), offset<<1);
17671766
17681767   return 0;
17691768}
src/mame/machine/s24fd.c
r2864r2865
152152}
153153
154154/* startup function, to be called from DRIVER_INIT (once on startup) */
155void s24_fd1094_driver_init(void)
155void s24_fd1094_driver_init(running_machine *machine)
156156{
157157   int i;
158158
r2864r2865
179179
180180   state_save_register_global(fd1094_selected_state);
181181   state_save_register_global(fd1094_state);
182   state_save_register_postload(Machine, s24_fd1094_postload, NULL);
182   state_save_register_postload(machine, s24_fd1094_postload, NULL);
183183}
src/mame/machine/galaxold.c
r2864r2865
1515static int irq_line;
1616static emu_timer *int_timer;
1717
18static UINT8 kingball_speech_dip;
19static UINT8 kingball_sound;
20
2118static UINT8 _4in1_bank;
22static UINT8 gmgalax_selected_game;
2319
24
2520static void galaxold_7474_9M_2_callback(void)
2621{
2722   /* Q bar clocks the other flip-flop,
r2864r2865
220215}
221216
222217
223
224/* Hack? If $b003 is high, we'll check our "fake" speech dipswitch (marked as SLAM) */
225static READ8_HANDLER( kingball_IN0_r )
226{
227   if (kingball_speech_dip)
228      return (input_port_read_indexed(machine, 0) & ~0x40) | ((input_port_read_indexed(machine, 3) & 0x01) << 6);
229   else
230      return input_port_read_indexed(machine, 0);
231}
232
233static READ8_HANDLER( kingball_IN1_r )
234{
235   /* bit 5 is the NOISE line from the sound circuit.  The code just verifies
236       that it's working, doesn't actually use return value, so we can just use
237       rand() */
238
239   return (input_port_read_indexed(machine, 1) & ~0x20) | (mame_rand(machine) & 0x20);
240}
241
242WRITE8_HANDLER( kingball_speech_dip_w )
243{
244   kingball_speech_dip = data;
245}
246
247WRITE8_HANDLER( kingball_sound1_w )
248{
249   kingball_sound = (kingball_sound & ~0x01) | data;
250}
251
252WRITE8_HANDLER( kingball_sound2_w )
253{
254   kingball_sound = (kingball_sound & ~0x02) | (data << 1);
255   soundlatch_w (machine, 0, kingball_sound | 0xf0);
256}
257
258
259218READ8_HANDLER( scramblb_protection_1_r )
260219{
261220   switch (activecpu_get_pc())
r2864r2865
280239}
281240
282241
283static READ8_HANDLER( azurian_IN1_r )
284{
285   return (input_port_read_indexed(machine, 1) & ~0x40) | ((input_port_read_indexed(machine, 3) & 0x01) << 6);
286}
287
288static READ8_HANDLER( azurian_IN2_r )
289{
290   return (input_port_read_indexed(machine, 2) & ~0x04) | ((input_port_read_indexed(machine, 3) & 0x02) << 1);
291}
292
293
294242WRITE8_HANDLER( _4in1_bank_w )
295243{
296244   _4in1_bank = data & 0x03;
r2864r2865
300248
301249READ8_HANDLER( _4in1_input_port_1_r )
302250{
303   return (input_port_read_indexed(machine, 1) & ~0xc0) | (input_port_read_indexed(machine, 3+_4in1_bank) & 0xc0);
251   static const char *portnames[] = { "FAKE1", "FAKE2", "FAKE3", "FAKE4" };
252
253   return (input_port_read(machine, "IN1") & ~0xc0) | (input_port_read(machine, portnames[_4in1_bank]) & 0xc0);
304254}
305255
306256READ8_HANDLER( _4in1_input_port_2_r )
307257{
308   return (input_port_read_indexed(machine, 2) & 0x04) | (input_port_read_indexed(machine, 3+_4in1_bank) & ~0xc4);
309}
258   static const char *portnames[] = { "FAKE1", "FAKE2", "FAKE3", "FAKE4" };
310259
311
312static void gmgalax_select_game(int game)
313{
314   gmgalax_selected_game = game;
315
316   memory_set_bank(1, game);
317
318   galaxold_gfxbank_w(Machine, 0, gmgalax_selected_game);
260   return (input_port_read(machine, "DSW0") & 0x04) | (input_port_read(machine, portnames[_4in1_bank]) & ~0xc4);
319261}
320262
321READ8_HANDLER( gmgalax_input_port_0_r )
322{
323   return input_port_read_indexed(machine, gmgalax_selected_game ? 3 : 0);
324}
325263
326READ8_HANDLER( gmgalax_input_port_1_r )
327{
328   return input_port_read_indexed(machine, gmgalax_selected_game ? 4 : 1);
329}
330
331READ8_HANDLER( gmgalax_input_port_2_r )
332{
333   return input_port_read_indexed(machine, gmgalax_selected_game ? 5 : 2);
334}
335
336
337264DRIVER_INIT( pisces )
338265{
339266   /* the coin lockout was replaced */
r2864r2865
352279   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3035, 0x3035, 0, 0, dingo_3035_r);
353280}
354281
355DRIVER_INIT( kingball )
356{
357   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xa000, 0, 0, kingball_IN0_r);
358   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa800, 0xa800, 0, 0, kingball_IN1_r);
359282
360   state_save_register_global(kingball_speech_dip);
361   state_save_register_global(kingball_sound);
362}
363
364
365283static UINT8 decode_mooncrst(UINT8 data,offs_t addr)
366284{
367285   UINT8 res;
r2864r2865
473391   }
474392}
475393
476DRIVER_INIT( azurian )
477{
478   DRIVER_INIT_CALL(pisces);
479
480   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6800, 0x6800, 0, 0, azurian_IN1_r);
481   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x7000, 0x7000, 0, 0, azurian_IN2_r);
482}
483
484394DRIVER_INIT( 4in1 )
485395{
486396   offs_t i, len = memory_region_length(REGION_CPU1);
r2864r2865
508418/* Doesn't actually use the bank, but it mustn't have a coin lock! */
509419memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002, 0x6002, 0, 0, galaxold_gfxbank_w);
510420}
511
512DRIVER_INIT( gmgalax )
513{
514   /* games are banked at 0x0000 - 0x3fff */
515   UINT8 *RAM=memory_region(REGION_CPU1);
516   memory_configure_bank(1, 0, 2, &RAM[0x10000], 0x4000);
517
518   state_save_register_global(gmgalax_selected_game);
519
520   gmgalax_select_game(input_port_read_indexed(machine, 6) & 0x01);
521}
522
523INTERRUPT_GEN( gmgalax_vh_interrupt )
524{
525   // reset the cpu if the selected game changed
526   int new_game = input_port_read_indexed(machine, 6) & 0x01;
527
528   if (gmgalax_selected_game != new_game)
529   {
530      gmgalax_select_game(new_game);
531
532      /* Ghost Muncher never clears this */
533      galaxold_stars_enable_w(machine, 0, 0);
534
535      cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, ASSERT_LINE);
536   }
537}
src/mame/machine/harddriv.c
r2864r2865
350350            .....
351351        0x8000 = SW1 #1
352352    */
353   int temp = input_port_read_indexed(machine, 0);
353   int temp = input_port_read(machine, "IN0");
354354   if (atarigen_get_hblank(machine->primary_screen)) temp ^= 0x0002;
355355   temp ^= 0x0018;      /* both EOCs always high for now */
356356   return temp;
r2864r2865
359359
360360READ16_HANDLER( hdc68k_port1_r )
361361{
362   UINT16 result = input_port_read_indexed(machine, 1);
362   UINT16 result = input_port_read(machine, "a80000");
363363   UINT16 diff = result ^ hdc68k_last_port1;
364364
365365   /* if a new shifter position is selected, use it */
r2864r2865
387387
388388READ16_HANDLER( hda68k_port1_r )
389389{
390   UINT16 result = input_port_read_indexed(machine, 1);
390   UINT16 result = input_port_read(machine, "a80000");
391391
392392   /* merge in the wheel edge latch bit */
393393   if (hdc68k_wheel_edge)
r2864r2865
400400READ16_HANDLER( hdc68k_wheel_r )
401401{
402402   /* grab the new wheel value and upconvert to 12 bits */
403   UINT16 new_wheel = input_port_read_indexed(machine, 10) << 4;
403   UINT16 new_wheel = input_port_read(machine, "12BADC0") << 4;
404404
405405   /* hack to display the wheel position */
406406   if (input_code_pressed(KEYCODE_LSHIFT))
r2864r2865
445445
446446WRITE16_HANDLER( hd68k_adc_control_w )
447447{
448   static const char *adc8names[] = { "8BADC0", "8BADC1", "8BADC2", "8BADC3", "8BADC4", "8BADC5", "8BADC6", "8BADC7" };
449   static const char *adc12names[] = { "12BADC0", "12BADC1", "12BADC2", "12BADC3" };
450
448451   COMBINE_DATA(&adc_control);
449452
450453   /* handle a write to the 8-bit ADC address select */
451454   if (adc_control & 0x08)
452455   {
453456      adc8_select = adc_control & 0x07;
454      adc8_data = input_port_read_indexed(machine, 2 + adc8_select);
457      adc8_data = input_port_read(machine, adc8names[adc8_select]);
455458   }
456459
457460   /* handle a write to the 12-bit ADC address select */
458461   if (adc_control & 0x40)
459462   {
460463      adc12_select = (adc_control >> 4) & 0x03;
461      adc12_data = input_port_read_indexed(machine, 10 + adc12_select) << 4;
464      adc12_data = input_port_read(machine, adc12names[adc12_select]) << 4;
462465   }
463466
464467   /* bit 7 selects which byte of the 12 bit data to read */
r2864r2865
14701473         break;
14711474
14721475      case 4:   /* ASIC65 reset */
1473         asic65_reset(!val);
1476         asic65_reset(machine, !val);
14741477         break;
14751478
14761479      case 7:   /* LED */
r2864r2865
16131616   switch (offset & 7)
16141617   {
16151618      case 2:   /* ASIC65 reset */
1616         asic65_reset(!val);
1619         asic65_reset(machine, !val);
16171620         break;
16181621
16191622      default:
src/mame/machine/dec0.c
r2864r2865
77*******************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "dec0.h"
1211#include "cpu/h6280/h6280.h"
1312
r2864r2865
2019   switch (offset<<1)
2120   {
2221      case 0: /* Player 1 & 2 joystick & buttons */
23         return (input_port_read_indexed(machine, 0) + (input_port_read_indexed(machine, 1) << 8));
22         return (input_port_read(machine, "IN0") + (input_port_read(machine, "IN1") << 8));
2423
2524      case 2: /* Credits, start buttons */
26         return input_port_read_indexed(machine, 2);
25         return input_port_read(machine, "IN2");
2726
2827      case 4: /* Byte 4: Dipswitch bank 2, Byte 5: Dipswitch Bank 1 */
29         return (input_port_read_indexed(machine, 3) + (input_port_read_indexed(machine, 4) << 8));
28         return (input_port_read(machine, "DSW0") + (input_port_read(machine, "DSW1") << 8));
3029
3130      case 8: /* Intel 8751 mc, Bad Dudes & Heavy Barrel only */
32         //logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",activecpu_get_pc(),0x30c000+offset);
31         //logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n", activecpu_get_pc(), 0x30c000+offset);
3332         return i8751_return;
3433   }
3534
36   logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",activecpu_get_pc(),0x30c000+offset);
35   logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n", activecpu_get_pc(), 0x30c000+offset);
3736   return ~0;
3837}
3938
r2864r2865
4443   switch (offset<<1)
4544   {
4645      case 0: /* Player 1 rotary */
47         return ~(1 << (input_port_read_indexed(machine, 5) * 12 / 256));
46         return ~(1 << (input_port_read(machine, "AN0") * 12 / 256));
4847
4948      case 8: /* Player 2 rotary */
50         return ~(1 << (input_port_read_indexed(machine, 6) * 12 / 256));
49         return ~(1 << (input_port_read(machine, "AN1") * 12 / 256));
5150
5251      default:
53         logerror("Unknown rotary read at 300000 %02x\n",offset);
52         logerror("Unknown rotary read at 300000 %02x\n", offset);
5453   }
5554
5655   return 0;
r2864r2865
6362   switch (offset<<1)
6463   {
6564      case 0: /* Player 1 Joystick + start, Player 2 Joystick + start */
66         return (input_port_read_indexed(machine, 0) + (input_port_read_indexed(machine, 1) << 8));
65         return (input_port_read(machine, "IN0") + (input_port_read(machine, "IN1") << 8));
6766
6867      case 2: /* Dipswitches */
69         return (input_port_read_indexed(machine, 3) + (input_port_read_indexed(machine, 4) << 8));
68         return (input_port_read(machine, "DSW0") + (input_port_read(machine, "DSW1") << 8));
7069
7170      case 4: /* Player 1 rotary */
72         return ~(1 << (input_port_read_indexed(machine, 5) * 12 / 256));
71         return ~(1 << (input_port_read(machine, "AN0") * 12 / 256));
7372
7473      case 6: /* Player 2 rotary */
75         return ~(1 << (input_port_read_indexed(machine, 6) * 12 / 256));
74         return ~(1 << (input_port_read(machine, "AN1") * 12 / 256));
7675
7776      case 8: /* Credits, start buttons */
78         return input_port_read_indexed(machine, 2);
77         return input_port_read(machine, "IN2");
7978
8079      case 12:
8180         return 0;   /* ?? watchdog ?? */
8281   }
8382
84   logerror("PC %06x unknown control read at %02x\n",activecpu_get_pc(),0x180000+offset);
83   logerror("PC %06x unknown control read at %02x\n", activecpu_get_pc(), 0x180000+offset);
8584   return ~0;
8685}
8786
r2864r2865
9291   switch (offset<<1)
9392   {
9493      case 0: /* Dip Switches */
95         return (input_port_read_indexed(machine, 3) + (input_port_read_indexed(machine, 4) << 8));
94         return (input_port_read(machine, "DSW0") + (input_port_read(machine, "DSW1") << 8));
9695
9796      case 2: /* Player 1 & Player 2 joysticks & fire buttons */
98         return (input_port_read_indexed(machine, 0) + (input_port_read_indexed(machine, 1) << 8));
97         return (input_port_read(machine, "IN0") + (input_port_read(machine, "IN1") << 8));
9998
10099      case 4: /* Credits */
101         return input_port_read_indexed(machine, 2);
100         return input_port_read(machine, "IN2");
102101   }
103102
104   logerror("Unknown control read at 30c000 %d\n",offset);
103   logerror("Unknown control read at 30c000 %d\n", offset);
105104   return ~0;
106105}
107106
r2864r2865
115114      case 6:      return 0x2;
116115   }
117116
118   logerror("%04x, Unknown protection read at 30c000 %d\n",activecpu_get_pc(),offset);
117   logerror("%04x, Unknown protection read at 30c000 %d\n", activecpu_get_pc(), offset);
119118   return 0;
120119}
121120
r2864r2865
471470}
472471#endif
473472
474void dec0_i8751_write(int data)
473void dec0_i8751_write(running_machine *machine, int data)
475474{
476475   /* Writes to this address cause an IRQ to the i8751 microcontroller */
477476   if (GAME==1) hbarrel_i8751_write(data);
478477   if (GAME==2) baddudes_i8751_write(data);
479478   if (GAME==3) birdtry_i8751_write(data);
480479
481   cpunum_set_input_line(Machine, 0,5,HOLD_LINE);
480   cpunum_set_input_line(machine, 0,5,HOLD_LINE);
482481
483482   /* Simulate the processing time of the i8751, time value is guessed
484483    if (i8751_timer)
src/mame/machine/lsasquad.c
r2864r2865
181181
182182READ8_HANDLER( lsasquad_mcu_status_r )
183183{
184   int res = input_port_read_indexed(machine, 3);
184   int res = input_port_read(machine, "MCU?");
185185
186186   /* bit 0 = when 1, mcu is ready to receive data from main cpu */
187187   /* bit 1 = when 0, mcu has sent data to the main cpu */
src/mame/machine/kaneko16.c
r2864r2865
342342
343343         // execute the command:
344344
345         kaneko16_mcu_ram[param1 / 2] = ~input_port_read_indexed(machine, 4);   // DSW
345         kaneko16_mcu_ram[param1 / 2] = ~input_port_read(machine, "DSW1");   // DSW
346346         kaneko16_mcu_ram[param2 / 2] = 0xffff;            // ? -1 / anything else
347347
348348         calc3_mcu_command_offset = param3 / 2;   // where next command will be written?
r2864r2865
616616
617617      case 0x03:   // DSW
618618      {
619         kaneko16_mcu_ram[mcu_offset] = input_port_read_indexed(machine, 4);
619         kaneko16_mcu_ram[mcu_offset] = input_port_read(machine, "DSW1");
620620         logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n", activecpu_get_pc(), mcu_command, mcu_offset*2);
621621      }
622622      break;
r2864r2865
743743
744744      case 0x03:   // DSW
745745      {
746         kaneko16_mcu_ram[mcu_offset] = input_port_read_indexed(machine, 4);
746         kaneko16_mcu_ram[mcu_offset] = input_port_read(machine, "DSW1");
747747         logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n", activecpu_get_pc(), mcu_command, mcu_offset*2);
748748      }
749749      break;
r2864r2865
851851
852852      case 0x03:   // DSW
853853      {
854         kaneko16_mcu_ram[mcu_offset] = input_port_read_indexed(machine, 4);
854         kaneko16_mcu_ram[mcu_offset] = input_port_read(machine, "DSW1");
855855      }
856856      break;
857857
src/mame/machine/cps2crpt.c
r2864r2865
111111*******************************************************************************/
112112
113113#include "driver.h"
114#include "deprecat.h"
115114#include "cpu/m68000/m68kmame.h"
116115#include "ui.h"
117116#include "includes/cps1.h"
r2864r2865
631630
632631
633632
634static void cps2_decrypt(const UINT32 *master_key, UINT32 upper_limit)
633static void cps2_decrypt(running_machine *machine, const UINT32 *master_key, UINT32 upper_limit)
635634{
636635   UINT16 *rom = (UINT16 *)memory_region(REGION_CPU1);
637636   int length = memory_region_length(REGION_CPU1);
r2864r2865
674673      {
675674         char loadingMessage[256]; // for displaying with UI
676675         sprintf(loadingMessage, "Decrypting %d%%", i*100/0x10000);
677         ui_set_startup_text(Machine, loadingMessage,FALSE);
676         ui_set_startup_text(machine, loadingMessage,FALSE);
678677      }
679678
680679
r2864r2865
971970      if (strcmp(k->name, gamename) == 0)
972971      {
973972         // we have a proper key so use it to decrypt
974         cps2_decrypt(k->keys, k->upper_limit ? k->upper_limit : 0x400000);
973         cps2_decrypt(machine, k->keys, k->upper_limit ? k->upper_limit : 0x400000);
975974
976975         break;
977976      }
src/mame/machine/slapstic.c
r2864r2865
179179*************************************************************************/
180180
181181#include "driver.h"
182#include "deprecat.h"
183182#include "slapstic.h"
184183#include "cpu/m68000/m68000.h"
185184
r2864r2865
810809 *
811810 *************************************/
812811
813void slapstic_init(int chip)
812void slapstic_init(running_machine *machine, int chip)
814813{
815814   /* only a small number of chips are known to exist */
816815   if (chip < 101 || chip > 118)
r2864r2865
825824   slapstic_reset();
826825
827826   /* see if we're 68k or 6502/6809 based */
828   access_68k = (Machine->config->cpu[0].type == CPU_M68000 ||
829              Machine->config->cpu[0].type == CPU_M68010);
827   access_68k = (machine->config->cpu[0].type == CPU_M68000 ||
828              machine->config->cpu[0].type == CPU_M68010);
830829
831830   /* save state */
832831   state_save_register_item("slapstic", 0, state);
src/mame/mamedriv.c
r2864r2865
396396   DRIVER( legion )   /* (c) 1986 */
397397   DRIVER( legiono )   /* (c) 1986 */
398398   DRIVER( terraf )   /* (c) 1987 */
399   DRIVER( terrafb )   /* (c) 1987 */
399400   DRIVER( terrafa )   /* (c) 1987 */
400401   DRIVER( terrafu )   /* (c) 1987 Nichibutsu USA */
401402   DRIVER( kodure )   /* (c) 1987 (Japan) */
r2864r2865
34193420   DRIVER( tetris3 )   /* (c) 1988 (FD1094, decrypted) S16A */
34203421   DRIVER( timesca1 )   /* (c) 1987 (FD1089B, decrypted) */
34213422   DRIVER( wb31 )      /* (c) 1988 Sega / Westone (FD1094, decrypted) */
3423   DRIVER( wb35 )      /* (c) 1988 Sega / Westone (FD1089A, decrypted) */
34223424   DRIVER( pshot16a )   /* (c) 1988 */
34233425
34243426   /* System 16B */
r2864r2865
35533555   DRIVER( toutrun )   /* (c) 1987 (FD1094, decrypted) */
35543556   DRIVER( toutrun2 )   /* (c) 1987 (FD1094, decrypted) */
35553557   DRIVER( toutrun1 )   /* (c) 1987 (protected) */
3558   DRIVER( toutrunu )   /* (c) 1987 (FD1094, decrypted) */
35563559   DRIVER( shangon )   /* (c) 1987 (protected) */
35573560   DRIVER( shangon3 )   /* (c) 1987 (FD1089B, decrypted) */
35583561   DRIVER( shangon2 )   /* (c) 1987 (FD1089B, decrypted) */
r2864r2865
58485851   DRIVER( ctribe )   /* TA-0028 (c) 1990 (US) */
58495852   DRIVER( ctribe1 )   /* TA-0028 (c) 1990 (US) - Set 1? */
58505853   DRIVER( ctribeb )   /* bootleg */
5854   DRIVER( ctribb2 )   /* bootleg */
58515855   DRIVER( blockout )   /* TA-0029 (c) 1989 + California Dreams */
58525856   DRIVER( blckout2 )   /* TA-0029 (c) 1989 + California Dreams */
58535857   DRIVER( blckoutj )   /* TA-0029 (c) 1989 + California Dreams (Japan) */
r2864r2865
74887492   DRIVER( crysbios )
74897493   DRIVER( crysking )   /* 2001 Brezzasoft. Crystal of the kings */
74907494   DRIVER( evosocc )   /* 2001 Evoga. Evolution Soccer */
7491   DRIVER( topbladv )
7495   DRIVER( topbladv )   /* 2002 Sonokong. Top Blade V */
74927496   DRIVER( officeye )
74937497
74947498   /* Bell Fruit Cobra Hardware */
r2864r2865
77897793   DRIVER( lottof2 )   /* (c) 1993 HAR */
77907794   DRIVER( fredmem )   /* (c) 1994 Coastal Amusements */
77917795   DRIVER( fredmeus )   /* (c) 1994 Coastal Amusements */
7792   DRIVER( fredmeuk )  /* (c) 1994 Coastal Amusements */
7796   DRIVER( fredmeuk )   /* (c) 1994 Coastal Amusements */
77937797   DRIVER( fredmemj )   /* (c) 1994 Coastal Amusements */
7794   DRIVER( fredmemc )  /* (c) 1994 Coastal Amusements */
7795   DRIVER( fredmesp )  /* (c) 1994 Coastal Amusements */
7796   DRIVER( cecmatch )  /* (c) 1993 Coastal Amusements */
7798   DRIVER( fredmemc )   /* (c) 1994 Coastal Amusements */
7799   DRIVER( fredmesp )   /* (c) 1994 Coastal Amusements */
7800   DRIVER( cecmatch )   /* (c) 1993 Coastal Amusements */
77977801   DRIVER( f15se )      /* (c) 1991 Microprose */
77987802   DRIVER( f15se21 )   /* (c) 1991 Microprose */
77997803   DRIVER( botss )      /* (c) 1992 Microprose */
r2864r2865
78537857   DRIVER( pntnpuzl )   /* Century? */
78547858   DRIVER( trucocl )   /* (c) 1991 Miky SRL */
78557859   DRIVER( ertictac )   /* (c) 1992 Sisteme */
7856   DRIVER( poizone )   /* (c) 1990 Sisteme */
7860   DRIVER( poizone )   /* (c) 1990 Sisteme */
78577861   DRIVER( ssfindo )   /* (c) 1999 Icarus */
78587862   DRIVER( ppcar )      /* (c) 1999 Icarus */
78597863   DRIVER( imolagp )   /* (c) 1981 Leante Games */
r2864r2865
80578061   DRIVER( 2mindril )   /* (c) 1993 Taito */
80588062   DRIVER( koikoi )   /* (c) 1983 Kiwako */
80598063   DRIVER( good )      /* (c) 1983 Kiwako */
8060   DRIVER( filetto )
8064   DRIVER( filetto )   /* (c) 1990 Novamatic */
80618065   DRIVER( quizo )      /* (c) 1985 Seoul Coin Corp. */
80628066   DRIVER( quizoa )   /* (c) 1985 Seoul Coin Corp. */
80638067   DRIVER( gstream )   /* (c) 2002, Oriental Soft Japan */
r2864r2865
80828086   DRIVER( pebe0014 )   /* (c) 1994 IGT - International Gaming Technology */
80838087   DRIVER( peke1012 )   /* (c) 1994 IGT - International Gaming Technology */
80848088   DRIVER( peps0014 )   /* (c) 1996 IGT - International Gaming Technology */
8085    DRIVER( peps0022 )   /* (c) 1996 IGT - International Gaming Technology */
8086    DRIVER( peps0043 )   /* (c) 1996 IGT - International Gaming Technology */
8087    DRIVER( peps0045 )   /* (c) 1996 IGT - International Gaming Technology */
8088    DRIVER( peps0308 )   /* (c) 1996 IGT - International Gaming Technology */
8089   DRIVER( peps0022 )   /* (c) 1996 IGT - International Gaming Technology */
8090   DRIVER( peps0043 )   /* (c) 1996 IGT - International Gaming Technology */
8091   DRIVER( peps0045 )   /* (c) 1996 IGT - International Gaming Technology */
8092   DRIVER( peps0308 )   /* (c) 1996 IGT - International Gaming Technology */
80898093   DRIVER( peps0615 )   /* (c) 1996 IGT - International Gaming Technology */
80908094   DRIVER( peps0716 )   /* (c) 1996 IGT - International Gaming Technology */
80918095   DRIVER( pexp0019 )   /* (c) 1995 IGT - International Gaming Technology */
r2864r2865
80978101   DRIVER( jongkyo )   /* (c) 1985 Kiwako */
80988102   DRIVER( gtipoker )   /* (c) 1983 GTI Inc */
80998103   DRIVER( gamecstl )   /* MAME based bootleg */
8100   DRIVER( drw80pkr )
8101   DRIVER( blazlaz )
8102   DRIVER( paranoia )
8103   DRIVER( vcombat )   /* (c) 1993 VR8 Inc. */
8104   DRIVER( shadfgtr )  /* (c) 1989 Sega? */
8105   DRIVER( blackt96 )
8104   DRIVER( drw80pkr )   /* (c) 1983 IGT */
8105   DRIVER( blazlaz )   /* (c) 1989 Hudson Soft */
8106   DRIVER( paranoia )   /* (c) 1990 Naxat Soft */
8107   DRIVER( vcombat )   /* (c) 1993 VR8 Inc. */
8108   DRIVER( shadfgtr )   /* (c) 1989 Sega? */
8109   DRIVER( blackt96 )   /* (c) 1996 D.G.R.M. of Korea */
81068110
81078111   /* H8/3048 italian gambling games */
81088112   DRIVER( laperla )   /* (c) 2002 Nazionale Elettronica */
r2864r2865
81298133   DRIVER( grandprx )   /* (c) 4fun */
81308134
81318135   /* Astro Corp. */
8132   DRIVER( showhand )
8136   DRIVER( showhand )   /* (c) 1999? Astro Corp. */
81338137
81348138#endif   /* DRIVER_RECURSIVE */
src/mame/includes/namcos1.h
r2864r2865
4141DRIVER_INIT( soukobdx );
4242DRIVER_INIT( puzlclub );
4343DRIVER_INIT( tankfrce );
44DRIVER_INIT( tankfrc4 );
4445
45
4646/*----------- defined in video/namcos1.c -----------*/
4747
4848READ8_HANDLER( namcos1_videoram_r );
src/mame/includes/itech32.h
r2864r2865
1414
1515/*----------- defined in drivers/itech32.c -----------*/
1616
17void itech32_update_interrupts(int vint, int xint, int qint);
17void itech32_update_interrupts(running_machine *machine, int vint, int xint, int qint);
1818
1919
2020/*----------- defined in video/itech32.c -----------*/
src/mame/includes/tank8.h
r2864r2865
3030
3131/*----------- defined in drivers/tank8.c -----------*/
3232
33void tank8_set_collision(int index);
33void tank8_set_collision(running_machine *machine, int index);
3434
3535
3636/*----------- defined in video/tank8.c -----------*/
src/mame/includes/gstriker.h
r2864r2865
6161   UINT16* vram;
6262   UINT16 pal_base;
6363   UINT8 gfx_region;
64   UINT8 transpen;
6465
6566} tCG10103;
6667
r2864r2865
7273VIDEO_UPDATE( gstriker );
7374VIDEO_START( gstriker );
7475VIDEO_START( twrldc94 );
75
76VIDEO_START( vgoalsoc );
7677#endif
src/mame/includes/neogeo.h
r2864r2865
4444
4545void neogeo_set_display_position_interrupt_control(UINT16 data);
4646void neogeo_set_display_counter_msb(UINT16 data);
47void neogeo_set_display_counter_lsb(UINT16 data);
48void neogeo_acknowledge_interrupt(UINT16 data);
47void neogeo_set_display_counter_lsb(running_machine *machine, UINT16 data);
48void neogeo_acknowledge_interrupt(running_machine *machine, UINT16 data);
4949void neogeo_set_main_cpu_bank_address(UINT32 bank_address);
5050READ16_HANDLER( neogeo_unmapped_r );
5151
src/mame/includes/n64.h
r2864r2865
5959extern UINT32 n64_vi_origin;
6060extern UINT32 n64_vi_control;
6161
62extern void dp_full_sync(void);
63extern void signal_rcp_interrupt(int interrupt);
64extern void clear_rcp_interrupt(int interrupt);
62extern void dp_full_sync(running_machine *machine);
63extern void signal_rcp_interrupt(running_machine *machine, int interrupt);
64extern void clear_rcp_interrupt(running_machine *machine, int interrupt);
6565
6666
6767/* read/write handlers for the N64 subsystems */
r2864r2865
8484extern READ32_HANDLER( n64_pif_ram_r );
8585extern WRITE32_HANDLER( n64_pif_ram_w );
8686
87void n64_machine_reset(void);
87void n64_machine_reset(running_machine *machine);
8888
8989#endif
src/mame/includes/dcheese.h
r2864r2865
77
88/*----------- defined in drivers/dcheese.c -----------*/
99
10void dcheese_signal_irq(int which);
10void dcheese_signal_irq(running_machine *machine, int which);
1111
1212
1313/*----------- defined in video/dcheese.c -----------*/
src/mame/includes/sprint8.h
r2864r2865
11/*----------- defined in drivers/sprint8.c -----------*/
22
3void sprint8_set_collision(int n);
3void sprint8_set_collision(running_machine *machine, int n);
44
55
66/*----------- defined in video/sprint8.c -----------*/
src/mame/includes/dec0.h
r2864r2865
6363DRIVER_INIT( hbarrelw );
6464DRIVER_INIT( birdtry );
6565
66extern void dec0_i8751_write(int data);
66extern void dec0_i8751_write(running_machine *machine, int data);
6767extern void dec0_i8751_reset(void);
6868READ8_HANDLER( hippodrm_prot_r );
6969WRITE8_HANDLER( hippodrm_prot_w );
src/mame/includes/genesis.h
r2864r2865
2121extern UINT16 *genesis_68k_ram;
2222extern MACHINE_START( genesis );
2323extern MACHINE_RESET( genesis );
24extern READ16_HANDLER ( megaplay_genesis_io_r );
2524extern WRITE16_HANDLER ( genesis_io_w );
2625extern UINT16 *genesis_io_ram;
2726extern READ16_HANDLER(genesis_ctrl_r);
r2864r2865
3130extern WRITE8_HANDLER ( genesis_z80_w );
3231extern WRITE16_HANDLER(genesis_ctrl_w);
3332extern WRITE16_HANDLER ( genesis_68k_to_z80_w );
34extern READ16_HANDLER ( genesis_io_r );
3533extern READ16_HANDLER ( genesis_68k_to_z80_r );
3634extern INTERRUPT_GEN( genesis_vblank_interrupt );
3735extern void genesis_irq2_interrupt(running_machine *machine, int state);
r2864r2865
5654
5755READ16_HANDLER ( genesis_vdp_r );
5856WRITE16_HANDLER( genesis_vdp_w );
59
60/* Generic Input Ports */
61#define GENESIS_PORTS \
62   PORT_START \
63 \
64   PORT_START   /* Player 1 Controls - part 1 */ \
65   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) \
66   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) \
67   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) \
68   PORT_BIT(  0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) \
69   PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) \
70   PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) \
71   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNUSED ) \
72   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNUSED ) \
73 \
74   PORT_START   /* Player 1 Controls - part 2 */ \
75   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_UNUSED ) \
76   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_UNUSED ) \
77   PORT_BIT(  0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) \
78   PORT_BIT(  0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) \
79   PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) \
80   PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_START1 ) \
81   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNUSED ) \
82   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNUSED ) \
83 \
84   PORT_START   /* Player 2 Controls - part 1 */ \
85   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) \
86   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) \
87   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) \
88   PORT_BIT(  0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT  ) PORT_PLAYER(2) \
89   PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) \
90   PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) \
91   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNUSED ) \
92   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNUSED ) \
93 \
94   PORT_START   /* Player 2 Controls - part 2 */ \
95   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_UNUSED ) \
96   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_UNUSED ) \
97   PORT_BIT(  0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) \
98   PORT_BIT(  0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) \
99   PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) \
100   PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_START2 ) \
101   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNUSED ) \
102   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNUSED ) \
103
104
src/mame/includes/triplhnt.h
r2864r2865
1717
1818/*----------- defined in drivers/triplhnt.c -----------*/
1919
20void triplhnt_set_collision(int data);
20void triplhnt_set_collision(running_machine *machine, int data);
2121
2222
2323/*----------- defined in audio/triplhnt.c -----------*/
src/mame/includes/slapstic.h
r2864r2865
1111
1212/*----------- defined in machine/slapstic.c -----------*/
1313
14void slapstic_init(int chip);
14void slapstic_init(running_machine *machine, int chip);
1515void slapstic_reset(void);
1616
1717int slapstic_bank(void);
src/mame/video/fgoal.c
r2864r2865
5151
5252   /* draw color overlay foreground and background */
5353
54   if (fgoal_player == 1 && (input_port_read_indexed(screen->machine, 1) & 0x40))
54   if (fgoal_player == 1 && (input_port_read(screen->machine, "IN1") & 0x40))
5555   {
5656      drawgfxzoom(fgbitmap, screen->machine->gfx[0],
5757         0, (fgoal_player << 2) | current_color,
src/mame/video/stvvdp2.c
r2864r2865
8282#include "driver.h"
8383#include "eminline.h"
8484#include "profiler.h"
85#include "deprecat.h"
8685#include "includes/stv.h"
8786
8887UINT32* stv_vdp2_regs;
r2864r2865
52595258   stv_rbg_cache_data.is_cache_dirty = 3;
52605259   memset( &stv_vdp2_layer_data_placement, 0, sizeof(stv_vdp2_layer_data_placement));
52615260
5262   refresh_palette_data(Machine);
5261   refresh_palette_data(machine);
52635262}
52645263
52655264static int stv_vdp2_start (running_machine *machine)
src/mame/video/itech32.c
r2864r2865
462462 *
463463 *************************************/
464464
465static void update_interrupts(int fast)
465static void update_interrupts(running_machine *machine, int fast)
466466{
467467   int scanline_state = 0, blitter_state = 0;
468468
r2864r2865
471471   if (VIDEO_INTSTATE & VIDEO_INTENABLE & VIDEOINT_BLITTER)
472472      blitter_state = 1;
473473
474   itech32_update_interrupts(-1, blitter_state, scanline_state);
474   itech32_update_interrupts(machine, -1, blitter_state, scanline_state);
475475}
476476
477477
r2864r2865
485485   VIDEO_INTSTATE |= VIDEOINT_SCANLINE;
486486
487487   /* update the interrupt state */
488   update_interrupts(0);
488   update_interrupts(machine, 0);
489489}
490490
491491
r2864r2865
11951195 *
11961196 *************************************/
11971197
1198static void handle_video_command(void)
1198static void handle_video_command(running_machine *machine)
11991199{
12001200   /* only 6 known commands */
12011201   switch (VIDEO_COMMAND)
r2864r2865
12711271
12721272   /* tell the processor we're done */
12731273   VIDEO_INTSTATE |= VIDEOINT_BLITTER;
1274   update_interrupts(1);
1274   update_interrupts(machine, 1);
12751275}
12761276
12771277
r2864r2865
12931293   {
12941294      case 0x02/2:   /* VIDEO_INTACK */
12951295         VIDEO_INTSTATE = old & ~data;
1296         update_interrupts(1);
1296         update_interrupts(machine, 1);
12971297         break;
12981298
12991299      case 0x04/2:   /* VIDEO_TRANSFER */
r2864r2865
13181318         break;
13191319
13201320      case 0x08/2:   /* VIDEO_COMMAND */
1321         handle_video_command();
1321         handle_video_command(machine);
13221322         break;
13231323
13241324      case 0x0a/2:   /* VIDEO_INTENABLE */
1325         update_interrupts(1);
1325         update_interrupts(machine, 1);
13261326         break;
13271327
13281328      case 0x24/2:   /* VIDEO_LEFTCLIP */
src/mame/video/tank8.c
r2864r2865
196196
197197static TIMER_CALLBACK( tank8_collision_callback )
198198{
199   tank8_set_collision(param);
199   tank8_set_collision(machine, param);
200200}
201201
202202
src/mame/video/cps1.c
r2864r2865
8686Quiz Tonosama no Yabou 2                    1995  ?         ?                      ?          ?
8787Pnickies                                    1994  ?         ?                      ?          CPS-B-21? DL-0921-10014? ?
8888Pang 3                                      1995  94916-10  CP1B1F,CP1B8K,CP1B9KA  92631C-6   CPS-B-21  DL-0921-10014  C632  IOC1
89Megaman the Power Battle                    1995  91634B-2  RCM63B   BPRG1  IOB1  ?          CPS-B-21  DL-0921-10014  C632  IOC1
89Megaman the Power Battle                    1995  91634B-2  RCM63B   BPRG1  IOB1  92631C-6    CPS-B-21  DL-0921-10014  C632  IOC1
9090
9191@actually CPS-B-01, the original number was scratched out and "04" stamped over it
9292*denotes Suicide Battery
src/mame/video/lethalj.c
r2864r2865
3535
3636INLINE void get_crosshair_xy(running_machine *machine, int player, int *x, int *y)
3737{
38   static const char *gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" };
3839   const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen);
3940   int width = visarea->max_x + 1 - visarea->min_x;
4041   int height = visarea->max_y + 1 - visarea->min_y;
4142
42   *x = ((input_port_read_indexed(machine, 2 + player * 2) & 0xff) * width) / 255;
43   *y = ((input_port_read_indexed(machine, 3 + player * 2) & 0xff) * height) / 255;
43   *x = ((input_port_read(machine, gunnames[player * 2]) & 0xff) * width) / 255;
44   *y = ((input_port_read(machine, gunnames[1 + player * 2]) & 0xff) * height) / 255;
4445}
4546
4647
src/mame/video/itech8.c
r2864r2865
459459READ8_HANDLER( itech8_blitter_r )
460460{
461461   int result = blitter_data[offset / 2];
462   static const char *portnames[] = { "AN_C", "AN_D", "AN_E", "AN_F" };
462463
463464   /* debugging */
464465   if (FULL_LOGGING) logerror("%04x:blitter_r(%02x)\n", activecpu_get_previouspc(), offset / 2);
r2864r2865
478479
479480   /* a read from offsets 12-15 return input port values */
480481   if (offset >= 12 && offset <= 15)
481      result = input_port_read_indexed(machine, 3 + offset - 12);
482      result = input_port_read(machine, portnames[offset - 12]);
482483
483484   return result;
484485}
src/mame/video/gstriker.c
r2864r2865
449449      for (x=0;x<xnum;x++)
450450      {
451451         // Hack to handle horizontal wrapping
452         drawgfxzoom(screen, machine->gfx[CG10103_cur_chip->gfx_region], tile, color+CG10103_cur_chip->pal_base, flipx, flipy, xp>>16, ypos>>16, cliprect, TRANSPARENCY_PEN, 0x0, xfact, yfact);
453         drawgfxzoom(screen, machine->gfx[CG10103_cur_chip->gfx_region], tile, color+CG10103_cur_chip->pal_base, flipx, flipy, (xp>>16) - 0x200, ypos>>16, cliprect, TRANSPARENCY_PEN, 0x0, xfact, yfact);
452         drawgfxzoom(screen, machine->gfx[CG10103_cur_chip->gfx_region], tile, color+CG10103_cur_chip->pal_base, flipx, flipy, xp>>16, ypos>>16, cliprect, TRANSPARENCY_PEN, CG10103_cur_chip->transpen, xfact, yfact);
453         drawgfxzoom(screen, machine->gfx[CG10103_cur_chip->gfx_region], tile, color+CG10103_cur_chip->pal_base, flipx, flipy, (xp>>16) - 0x200, ypos>>16, cliprect, TRANSPARENCY_PEN, CG10103_cur_chip->transpen, xfact, yfact);
454454         xp += xstep;
455455         tile++;
456456      }
r2864r2865
514514   CG10103[numchip].gfx_region = gfx_region;
515515}
516516
517static void CG10103_set_transpen(int numchip, int transpen)
518{
519   CG10103[numchip].transpen = transpen;
520}
517521
518522
519523/*** VIDEO UPDATE/START **********************************************/
r2864r2865
578582   CG10103_init(1);
579583   CG10103_set_gfx_region(0, 2);
580584   CG10103_set_pal_base(0, 0x10);
585   CG10103_set_transpen(0, 0x0);
581586}
582587
583588VIDEO_START(twrldc94)
r2864r2865
600605   CG10103_init(1);
601606   CG10103_set_gfx_region(0, 2);
602607   CG10103_set_pal_base(0, 0x60);
608   CG10103_set_transpen(0, 0x0);
603609}
604610
611VIDEO_START(vgoalsoc)
612{
613   // Palette bases are hardcoded, but should be probably extracted from the mixer registers
614
615   // Initalize the chip for the score plane
616   VS920A_init(1);
617   VS920A_set_gfx_region(0, 0);
618   VS920A_set_pal_base(0, 0x30);
619   tilemap_set_transparent_pen(VS920A_get_tilemap(0),  0xf);
620
621   // Initalize the chip for the screen plane
622   MB60553_init(1);
623   MB60553_set_gfx_region(0, 1);
624   MB60553_set_pal_base(0, 0x20);
625   tilemap_set_transparent_pen(MB60553_get_tilemap(0), 0xf);
626
627   // Initialize the sprite generator
628   CG10103_init(1);
629   CG10103_set_gfx_region(0, 2);
630   CG10103_set_pal_base(0, 0x00);
631   CG10103_set_transpen(0, 0xf);
632}
src/mame/video/lazercmd.c
r2864r2865
3232   int xbit, ybit, size;
3333
3434    size = 2;
35   if (input_port_read_indexed(machine, 2) & 0x40)
35   if (input_port_read(machine, "DSW") & 0x40)
3636    {
3737      size = 4;
3838    }
r2864r2865
5757{
5858   int i,x,y;
5959
60   int video_inverted = input_port_read_indexed(screen->machine, 2) & 0x20;
60   int video_inverted = input_port_read(screen->machine, "DSW") & 0x20;
6161
6262   /* The first row of characters are invisible */
6363   for (i = 0; i < (VERT_RES - 1) * HORZ_RES; i++)
src/mame/video/lordgun.c
r2864r2865
186186   0x1B3,0x1B4,0x1B5,0x1B6,0x1B7,0x1B8,0x1B9,0x1BA,0x1BB,0x1BC,0x1BD,0x1BE,0x1BF,0x1BF
187187};
188188
189
190static const char *gunnames[] = { "LIGHT0_X", "LIGHT1_X", "LIGHT0_Y", "LIGHT1_Y" };
191
189192static void lorddgun_calc_gun_scr(running_machine *machine, int i)
190193{
191   int x = input_port_read_indexed(machine, 5+i) - 0x3c;
194   int x = input_port_read(machine, gunnames[i]) - 0x3c;
195
192196   if ( (x < 0) || (x > sizeof(lordgun_gun_x_table)/sizeof(lordgun_gun_x_table[0])) )
193197      x = 0;
194198
195199   lordgun_gun[i].scr_x = lordgun_gun_x_table[x];
196   lordgun_gun[i].scr_y = input_port_read_indexed(machine, 7+i);
200   lordgun_gun[i].scr_y = input_port_read(machine, gunnames[i+2]);
197201}
198202
199203void lordgun_update_gun(running_machine *machine, int i)
200204{
201205   const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen);
202206
203   lordgun_gun[i].hw_x = input_port_read_indexed(machine, 5+i);
204   lordgun_gun[i].hw_y = input_port_read_indexed(machine, 7+i);
207   lordgun_gun[i].hw_x = input_port_read(machine, gunnames[i]);
208   lordgun_gun[i].hw_y = input_port_read(machine, gunnames[i+2]);
205209
206210   lorddgun_calc_gun_scr(machine, i);
207211
src/mame/video/atarirle.c
r2864r2865
1919***************************************************************************/
2020
2121#include "driver.h"
22#include "deprecat.h"
22//#include "deprecat.h"
2323#include "atarirle.h"
2424
2525
src/mame/video/snes.c
r2864r2865
14431443             * Stop drawing if exceeded 32 objects and
14441444             * enforcing that limit is enabled */
14451445         range_over++;
1446         if( range_over == 32 ) //&& (input_port_read_indexed(machine, 16 ) & 0x10) )
1446         if( range_over == 32 ) //&& (input_port_read(machine, "INTERNAL") & 0x01) )
14471447         {
14481448            /* Set the flag in STAT77 register */
14491449            snes_ram[STAT77] |= 0x40;
r2864r2865
19841984
19851985      if( !debug_options.input_count-- )
19861986      {
1987         UINT8 toggles = input_port_read_indexed(machine, 10 );
1987         UINT8 toggles = input_port_read_safe(machine, "DEBUG2", 0);
19881988         if( toggles & 0x1 )
19891989            debug_options.bg_disabled[0] = !debug_options.bg_disabled[0];
19901990         if( toggles & 0x2 )
r2864r2865
20012001            debug_options.bg_disabled[5] = !debug_options.bg_disabled[5];
20022002         if( toggles & 0x80 )
20032003            debug_options.windows_disabled = !debug_options.windows_disabled;
2004         toggles = input_port_read_indexed(machine, 11 );
2004         toggles = input_port_read_safe(machine, "DEBUG3", 0);
20052005         if( toggles & 0x4 )
20062006            debug_options.transparency_disabled = !debug_options.transparency_disabled;
20072007         debug_options.input_count = 5;
r2864r2865
21112111   }
21122112   /* Just for testing, draw as many tiles as possible */
21132113   {
2114      UINT8 adjust = input_port_read_indexed(machine,  1 );
2115      UINT8 dip = input_port_read_indexed(machine,  9 );
2116      UINT8 inp = input_port_read_indexed(machine,  11 );
2114      UINT8 adjust = input_port_read(machine, "PAD1H");
2115      UINT8 dip = input_port_read_safe(machine, "DEBUG1", 0);
2116      UINT8 inp = input_port_read_safe(machine, "DEBUG3", 0);
21172117      UINT8 dt = 1 << ((dip & 0x3) - 1);
21182118      UINT8 dm = 1 << (((dip & 0xc) >> 2) - 1);
21192119      if( dt )
src/mame/video/rockola.c
r2864r2865
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110
1211
1312UINT8 *rockola_videoram2;
src/mame/video/sprint8.c
r2864r2865
162162
163163static TIMER_CALLBACK( sprint8_collision_callback )
164164{
165   sprint8_set_collision(param);
165   sprint8_set_collision(machine, param);
166166}
167167
168168
src/mame/video/raiden.c
r2864r2865
100100   }
101101}
102102
103WRITE16_HANDLER( raidena_control_w )
104{
105   /* raidena uses 0x40 instead of 0x02 */
106
107   /* Flipscreen */
108   if (offset==3 && ACCESSING_BITS_0_7) {
109      flipscreen=data&0x40;
110      tilemap_set_flip(ALL_TILEMAPS,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
111   }
112}
113
103114static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri_mask)
104115{
105116   int offs,fx,fy,x,y,color,sprite;
src/mame/video/victory.c
r2864r2865
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "victory.h"
109
1110
r2864r2865
5554
5655/* function prototypes */
5756static int command2(void);
58static int command3(void);
59static int command4(void);
60static int command5(void);
57static int command3(running_machine *machine);
58static int command4(running_machine *machine);
59static int command5(running_machine *machine);
6160static int command6(void);
62static int command7(void);
61static int command7(running_machine *machine);
6362
6463
6564
r2864r2865
232231         if (micro.cmdlo == 5)
233232         {
234233            if (LOG_MICROCODE) logerror("  Command 5 triggered by write to IH\n");
235            command5();
234            command5(machine);
236235         }
237236         break;
238237
r2864r2865
262261         if (micro.cmdlo == 3)
263262         {
264263            if (LOG_MICROCODE) logerror(" Command 3 triggered by write to X\n");
265            command3();
264            command3(machine);
266265         }
267266         break;
268267
r2864r2865
272271         if (micro.cmdlo == 4)
273272         {
274273            if (LOG_MICROCODE) logerror("  Command 4 triggered by write to Y\n");
275            command4();
274            command4(machine);
276275         }
277276         break;
278277
r2864r2865
292291         else if (micro.cmdlo == 7)
293292         {
294293            if (LOG_MICROCODE) logerror("  Command 7 triggered by write to B\n");
295            command7();
294            command7(machine);
296295         }
297296         break;
298297
r2864r2865
585584 *
586585 *************************************/
587586
588static int command3(void)
587static int command3(running_machine *machine)
589588{
590589/*
591590    Actual microcode:
r2864r2865
674673               rram[dstoffs + 0] ^= src >> shift;
675674               rram[dstoffs + 1] ^= src << nshift;
676675            }
677            if (fgcoll) victory_update_irq(Machine);
676            if (fgcoll) victory_update_irq(machine);
678677         }
679678      }
680679   }
r2864r2865
692691 *
693692 *************************************/
694693
695static int command4(void)
694static int command4(running_machine *machine)
696695{
697696/*
698697    Actual microcode:
r2864r2865
734733         case 0:                                    break;
735734         case 1:                                    break;
736735         case 2:   keep_going = command2();               break;
737         case 3:   keep_going = command3();               break;
736         case 3:   keep_going = command3(machine);            break;
738737         case 4:   micro.pc = micro.yp << 1; keep_going = 1;   break;
739         case 5:   keep_going = command5();               break;
738         case 5:   keep_going = command5(machine);            break;
740739         case 6:   keep_going = command6();               break;
741         case 7:   keep_going = command7();               break;
740         case 7:   keep_going = command7(machine);            break;
742741      }
743742   } while (keep_going);
744743
r2864r2865
755754 *
756755 *************************************/
757756
758static int command5(void)
757static int command5(running_machine *machine)
759758{
760759/*
761760    Actual microcode:
r2864r2865
874873         }
875874         acc &= 0xff;
876875      }
877      if (fgcoll) victory_update_irq(Machine);
876      if (fgcoll) victory_update_irq(machine);
878877   }
879878
880879   micro.xp = x;
r2864r2865
941940 *
942941 *************************************/
943942
944static int command7(void)
943static int command7(running_machine *machine)
945944{
946945/*
947946    Actual microcode:
r2864r2865
10041003         rram[addr + 0] ^= micro.r >> shift;
10051004         rram[addr + 1] ^= micro.r << nshift;
10061005      }
1007      if (fgcoll) victory_update_irq(Machine);
1006      if (fgcoll) victory_update_irq(machine);
10081007   }
10091008
10101009   count_states(4);
src/mame/video/exidy440.c
r2864r2865
445445   {
446446      int i;
447447
448      int beamx = ((input_port_read_indexed(screen->machine, 4) & 0xff) * (HBSTART - HBEND)) >> 8;
449      int beamy = ((input_port_read_indexed(screen->machine, 5) & 0xff) * (VBSTART - VBEND)) >> 8;
448      int beamx = ((input_port_read(screen->machine, "AN0") & 0xff) * (HBSTART - HBEND)) >> 8;
449      int beamy = ((input_port_read(screen->machine, "AN1") & 0xff) * (VBSTART - VBEND)) >> 8;
450450
451451      /* The timing of this FIRQ is very important. The games look for an FIRQ
452452            and then wait about 650 cycles, clear the old FIRQ, and wait a
src/mame/video/lethal.c
r2864r2865
1010#include "driver.h"
1111#include "video/konamiic.h"
1212
13#define GUNX( a ) ( ( input_port_read_indexed(machine,  a ) * 287 ) / 0xff )
14#define GUNY( a ) ( ( input_port_read_indexed(machine,  a ) * 223 ) / 0xff )
1513
1614static int sprite_colorbase;
1715static int layer_colorbase[4];
src/mame/video/atari.c
r2864r2865
77******************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "includes/atari.h"
1211#include "video/gtia.h"
1312
src/mame/video/decocass.c
r2864r2865
607607   int scrollx, scrolly_l, scrolly_r;
608608   rectangle clip;
609609
610   if (0xc0 != (input_port_read_indexed(screen->machine, 2) & 0xc0))  /* coin slots assert an NMI */
610   if (0xc0 != (input_port_read(screen->machine, "IN2") & 0xc0))  /* coin slots assert an NMI */
611611      cpunum_set_input_line(screen->machine, 0, INPUT_LINE_NMI, ASSERT_LINE);
612612
613613   if (0 == (watchdog_flip & 0x04))
src/mame/video/mystwarr.c
r2864r2865
172172
173173   K055673_vh_start(machine, REGION_GFX2, 1, -61, -22, gaiapols_sprite_callback); // stage2 brick walls
174174
175   konamigx_mixer_init(0);
175   konamigx_mixer_init(machine, 0);
176176
177177   K056832_set_LayerOffset(0, -2+2-1, 0-1);
178178   K056832_set_LayerOffset(1,  0+2, 0);
r2864r2865
214214
215215   K055673_vh_start(machine, REGION_GFX2, 0, -42, -22, gaiapols_sprite_callback);
216216
217   konamigx_mixer_init(0);
217   konamigx_mixer_init(machine, 0);
218218
219219   konamigx_mixer_primode(1);
220220
r2864r2865
245245
246246   K055673_vh_start(machine, REGION_GFX2, 0, -48, -24, mystwarr_sprite_callback);
247247
248   konamigx_mixer_init(0);
248   konamigx_mixer_init(machine, 0);
249249
250250   K056832_set_LayerOffset(0, -2-3, 0);
251251   K056832_set_LayerOffset(1,  0-3, 0);
r2864r2865
273273
274274   K055673_vh_start(machine, REGION_GFX2, 1, -51, -22, metamrph_sprite_callback);
275275
276   konamigx_mixer_init(0);
276   konamigx_mixer_init(machine, 0);
277277
278278   // other reference, floor at first boss
279279   K056832_set_LayerOffset(0, -2+4, 0); // text
r2864r2865
299299
300300   K055673_vh_start(machine, REGION_GFX2, 1, -62, -23, metamrph_sprite_callback);
301301
302   konamigx_mixer_init(0);
302   konamigx_mixer_init(machine, 0);
303303
304304   K056832_set_LayerOffset(0, -2+1, 0);
305305   K056832_set_LayerOffset(1,  0+1, 0);
r2864r2865
322322
323323   K055673_vh_start(machine, REGION_GFX2, 0, -58, -23, martchmp_sprite_callback);
324324
325   konamigx_mixer_init(0);
325   konamigx_mixer_init(machine, 0);
326326
327327   K056832_set_LayerOffset(0, -2-4, 0);
328328   K056832_set_LayerOffset(1,  0-4, 0);
src/mame/video/irobot.c
r2864r2865
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "irobot.h"
109
1110#define BITMAP_WIDTH   256
src/mame/video/neogeo.c
r2864r2865
843843      case 0x02: set_videoram_modulo(data); break;
844844      case 0x03: set_video_control(data); break;
845845      case 0x04: neogeo_set_display_counter_msb(data); break;
846      case 0x05: neogeo_set_display_counter_lsb(data); break;
847      case 0x06: neogeo_acknowledge_interrupt(data); break;
846      case 0x05: neogeo_set_display_counter_lsb(machine, data); break;
847      case 0x06: neogeo_acknowledge_interrupt(machine, data); break;
848848      case 0x07: break; /* unknown, see get_video_control */
849849      }
850850   }
src/mame/video/konamigx.c
r2864r2865
140140> so, well, the top bits of the code are suspicious
141141*/
142142
143static void _gxcommoninitnosprites(void)
143static void _gxcommoninitnosprites(running_machine *machine)
144144{
145145   int i;
146146
147147   K054338_vh_start();
148148   K055555_vh_start();
149149
150   konamigx_mixer_init(0);
150   konamigx_mixer_init(machine, 0);
151151
152152   for (i = 0; i < 8; i++)
153153   {
r2864r2865
176176
177177   gx_rozenable = 0;
178178
179   _gxcommoninitnosprites();
179   _gxcommoninitnosprites(machine);
180180}
181181
182182
r2864r2865
227227   K056832_vh_start(machine, REGION_GFX1, K056832_BPP_8, 0, NULL, konamigx_alpha_tile_callback, 0);
228228   K055673_vh_start(machine, REGION_GFX2, K055673_LAYOUT_LE2, -53, -23, konamigx_type2_sprite_callback);
229229
230   _gxcommoninitnosprites();
230   _gxcommoninitnosprites(machine);
231231}
232232
233233VIDEO_START(dragoonj)
r2864r2865
235235   K056832_vh_start(machine, REGION_GFX1, K056832_BPP_5, 1, NULL, konamigx_type2_tile_callback, 0);
236236   K055673_vh_start(machine, REGION_GFX2, K055673_LAYOUT_RNG, -53, -23, konamigx_dragoonj_sprite_callback);
237237
238   _gxcommoninitnosprites();
238   _gxcommoninitnosprites(machine);
239239
240240   K056832_set_LayerOffset(0, -2+1, 0);
241241   K056832_set_LayerOffset(1,  0+1, 0);
r2864r2865
248248   K056832_vh_start(machine, REGION_GFX1, K056832_BPP_8, 1, NULL, konamigx_type2_tile_callback, 0);
249249   K055673_vh_start(machine, REGION_GFX2, K055673_LAYOUT_LE2, -46, -23, konamigx_le2_sprite_callback);
250250
251   _gxcommoninitnosprites();
251   _gxcommoninitnosprites(machine);
252252
253253   konamigx_mixer_primode(-1); // swapped layer B and C priorities?
254254}
r2864r2865
300300   {
301301      K055673_vh_start(machine, REGION_GFX2, K055673_LAYOUT_GX6, -48, -23, konamigx_salmndr2_sprite_callback);
302302
303      _gxcommoninitnosprites();
303      _gxcommoninitnosprites(machine);
304304   }
305305   else
306306   {
r2864r2865
313313   K056832_vh_start(machine, REGION_GFX1, K056832_BPP_5, 0, NULL, konamigx_type2_tile_callback, 0);
314314   K055673_vh_start(machine, REGION_GFX2, K055673_LAYOUT_GX6, -53, -23, konamigx_type2_sprite_callback);
315315
316   _gxcommoninitnosprites();
316   _gxcommoninitnosprites(machine);
317317
318318   K056832_set_LayerOffset(0, -2+1, 0);
319319   K056832_set_LayerOffset(1,  0+1, 0);
r2864r2865
333333   K056832_vh_start(machine, REGION_GFX1, K056832_BPP_6, 0, NULL, konamigx_type2_tile_callback, 0);
334334   K055673_vh_start(machine, REGION_GFX2, K055673_LAYOUT_GX, -53, -23, konamigx_type2_sprite_callback);
335335
336   _gxcommoninitnosprites();
336   _gxcommoninitnosprites(machine);
337337
338338   K056832_set_LayerOffset(0, -2+1, 0);
339339   K056832_set_LayerOffset(1,  0+1, 0);
src/mame/video/n64.c
r2864r2865
33*/
44
55#include "driver.h"
6#include "deprecat.h"
67#include "includes/n64.h"
78
89#define LOG_RDP_EXECUTION       0
r2864r2865
30033004
30043005static void rdp_sync_full(UINT32 w1, UINT32 w2)
30053006{
3006   dp_full_sync();
3007   dp_full_sync(Machine);
30073008}
30083009
30093010static void rdp_set_key_gb(UINT32 w1, UINT32 w2)
src/mame/video/m92.c
r2864r2865
6060UINT16 *m92_vram_data,*m92_spritecontrol;
6161UINT8 m92_game_kludge;
6262
63extern void m92_sprite_interrupt(void);
63extern void m92_sprite_interrupt(running_machine *machine);
6464UINT8 m92_sprite_buffer_busy;
6565static int m92_palette_bank;
6666
r2864r2865
7070{
7171   m92_sprite_buffer_busy = 1;
7272   if (m92_game_kludge!=2) /* Major Title 2 doesn't like this interrupt!? */
73      m92_sprite_interrupt();
73      m92_sprite_interrupt(machine);
7474}
7575
7676WRITE16_HANDLER( m92_spritecontrol_w )
src/mame/video/dcheese.c
r2864r2865
8888
8989static TIMER_CALLBACK( blitter_scanline_callback )
9090{
91   dcheese_signal_irq(3);
91   dcheese_signal_irq(machine, 3);
9292   update_scanline_irq(machine);
9393}
9494
9595
9696static TIMER_CALLBACK( dcheese_signal_irq_callback )
9797{
98   dcheese_signal_irq(param);
98   dcheese_signal_irq(machine, param);
9999}
100100
101101
src/mame/video/triplhnt.c
r2864r2865
3939
4040static TIMER_CALLBACK( triplhnt_hit_callback )
4141{
42   triplhnt_set_collision(param);
42   triplhnt_set_collision(machine, param);
4343}
4444
4545
src/mame/drivers/deco_mlc.c
r2864r2865
116116
117117static READ32_HANDLER( avengrs_control_r )
118118{
119   return (input_port_read_indexed(machine, 1)<<16) | (eeprom_read_bit()<<23) | input_port_read_indexed(machine, 0);
119   return (input_port_read(machine, "IN1")<<16) | (eeprom_read_bit()<<23) | input_port_read(machine, "IN0");
120120}
121121
122122static READ32_HANDLER(test2_r)
123123{
124124//  if (offset==0)
125//      return input_port_read_indexed(machine, 0); //0xffffffff;
125//      return input_port_read(machine, "IN0"); //0xffffffff;
126126//   logerror("%08x:  Test2_r %d\n",activecpu_get_pc(),offset);
127127   return mame_rand(machine); //0xffffffff;
128128}
r2864r2865
330330/******************************************************************************/
331331
332332static INPUT_PORTS_START( mlc )
333   PORT_START
333   PORT_START_TAG("IN0")
334334   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
335335   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
336336   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
348348   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
349349   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
350350
351   PORT_START
351   PORT_START_TAG("IN1")
352352   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
353353   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
354354   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
src/mame/drivers/crystal.c
r2864r2865
639639   UINT16 *srcline;
640640   int y;
641641   UINT16 head,tail;
642   UINT32 width=video_screen_get_width(screen);
642643
643644   if(GetVidReg(0x8e)&1)
644645   {
r2864r2865
681682
682683   srcline=(UINT16 *) Visible;
683684   for(y=0;y<240;y++)
684      memcpy(BITMAP_ADDR16(bitmap, y, 0), &srcline[y*512], 320*2);
685      memcpy(BITMAP_ADDR16(bitmap, y, 0), &srcline[y*512], width*2);
685686
686687   return 0;
687688}
r2864r2865
833834   MDRV_SOUND_ROUTE(1, "right", 1.0)
834835MACHINE_DRIVER_END
835836
837/*
838    Top blade screen is 32 pixels wider
839*/
840static MACHINE_DRIVER_START( topbladv )
841   MDRV_IMPORT_FROM(crystal)
842
843   MDRV_SCREEN_MODIFY("main")
844   MDRV_SCREEN_SIZE(320+32, 240)
845   MDRV_SCREEN_VISIBLE_AREA(0, 319+32, 0, 239)
846
847MACHINE_DRIVER_END
848
836849ROM_START( crysbios )
837850   ROM_REGION( 0x20000, REGION_CPU1, 0 ) // bios
838851   ROM_LOAD("mx27l1000.u14",  0x000000, 0x020000, CRC(BEFF39A9) SHA1(b6f6dda58d9c82273f9422c1bd623411e58982cb) )
r2864r2865
926939   Rom[WORD_XOR_LE(0x974ED2/2)]=0x9001;   //PUSH R0
927940}
928941
942static DRIVER_INIT(topbladv)
943{
944   UINT16 *Rom=(UINT16*) memory_region(REGION_USER1);
945
946   Rom[WORD_XOR_LE(0x12d7a/2)]=0x90FC;   //PUSH R7-R6-R5-R4-R3-R2
947   Rom[WORD_XOR_LE(0x12d7c/2)]=0x9001;   //PUSH R0
948
949   Rom[WORD_XOR_LE(0x2fe18/2)]=0x9001;   //PUSH R0
950   Rom[WORD_XOR_LE(0x2fe1a/2)]=0x9200;   //PUSH SR
951
952   Rom[WORD_XOR_LE(0x18880/2)]=0x9001;   //PUSH R0
953   Rom[WORD_XOR_LE(0x18882/2)]=0x9200;   //PUSH SR
954
955   Rom[WORD_XOR_LE(0xDACE/2)]=0x901C;   //PUSH R4-R3-R2
956   Rom[WORD_XOR_LE(0xDAD0/2)]=0x9001;   //PUSH R0
957
958}
959
960static DRIVER_INIT(officeye)
961{
962   UINT16 *Rom=(UINT16*) memory_region(REGION_USER1);
963
964   Rom[WORD_XOR_LE(0x9c9e/2)]=0x901C;   //PUSH R4-R3-R2
965   Rom[WORD_XOR_LE(0x9ca0/2)]=0x9001;   //PUSH R0
966
967   Rom[WORD_XOR_LE(0x9EE4/2)]=0x907C;   //PUSH R6-R5-R4-R3-R2
968   Rom[WORD_XOR_LE(0x9EE6/2)]=0x9001;   //PUSH R0
969
970   Rom[WORD_XOR_LE(0x4B2E0/2)]=0x9004;   //PUSH R2
971   Rom[WORD_XOR_LE(0x4B2E2/2)]=0x9001;   //PUSH R0
972
973/*
974    Rom[WORD_XOR_LE(0x18880/2)]=0x9001; //PUSH R0
975    Rom[WORD_XOR_LE(0x18882/2)]=0x9200; //PUSH SR
976 */
977}
978
979
980
929981GAME( 2001, crysbios,        0, crystal, crystal,        0, ROT0, "Brezzasoft", "Crystal System BIOS", GAME_IS_BIOS_ROOT )
930982GAME( 2001, crysking, crysbios, crystal, crystal, crysking, ROT0, "Brezzasoft", "The Crystal of Kings", 0 )
931983GAME( 2001, evosocc,  crysbios, crystal, crystal,  evosocc, ROT0, "Evoga", "Evolution Soccer", 0 )
932GAME( 2001, topbladv, crysbios, crystal, crystal,  0,       ROT0, "unknown", "Top Blade V", GAME_NOT_WORKING ) // protection
984GAME( 2003, topbladv, crysbios, topbladv,crystal, topbladv, ROT0, "SonoKong / Expotato", "Top Blade V", GAME_NOT_WORKING ) // protection
985GAME( 2001, officeye,        0, crystal, crystal, officeye, ROT0, "Danbi", "Office Yeo In Cheon Ha (version 1.2)", GAME_NOT_WORKING ) // protection
933986
934GAME( 2001, officeye,        0, crystal, crystal,  0,       ROT0, "unknown", "Office Yeo In Cheon Ha", GAME_NOT_WORKING ) // protection
935
936
src/mame/drivers/eprom.c
r2864r2865
9090
9191static READ16_HANDLER( special_port1_r )
9292{
93   int result = input_port_read_indexed(machine, 1);
93   int result = input_port_read(machine, "260010");
9494
9595   if (atarigen_sound_to_cpu_ready) result ^= 0x0004;
9696   if (atarigen_cpu_to_sound_ready) result ^= 0x0008;
r2864r2865
103103static READ16_HANDLER( adc_r )
104104{
105105   static int last_offset;
106   int result = input_port_read_indexed(machine, 2 + (last_offset & 3));
106   static const char *adcnames[] = { "ADC0", "ADC1", "ADC2", "ADC3" };
107   int result = input_port_read(machine, adcnames[last_offset & 3]);
108
107109   last_offset = offset;
108110   return result;
109111}
r2864r2865
242244 *************************************/
243245
244246static INPUT_PORTS_START( eprom )
245   PORT_START      /* 26000 */
247   PORT_START_TAG("260000")      /* 260000 */
246248   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
247249   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
248250   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
r2864r2865
250252   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
251253   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
252254
253   PORT_START      /* 26010 */
255   PORT_START_TAG("260010")      /* 260010 */
254256   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_VBLANK )
255257   PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
256258   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )   /* Input buffer full (@260030) */
r2864r2865
263265   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
264266   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
265267
266   PORT_START   /* ADC0 @ 0x260020 */
268   PORT_START_TAG("ADC0")         /* ADC0 @ 0x260020 */
267269   PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
268270   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
269271
270   PORT_START   /* ADC1 @ 0x260022 */
272   PORT_START_TAG("ADC1")         /* ADC1 @ 0x260022 */
271273   PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1)
272274   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
273275
274   PORT_START   /* ADC0 @ 0x260024 */
276   PORT_START_TAG("ADC2")         /* ADC0 @ 0x260024 */
275277   PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
276278   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
277279
278   PORT_START   /* ADC1 @ 0x260026 */
280   PORT_START_TAG("ADC3")         /* ADC1 @ 0x260026 */
279281   PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(2)
280282   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
281283
r2864r2865
284286
285287
286288static INPUT_PORTS_START( klaxp )
287   PORT_START      /* 26000 */
289   PORT_START_TAG("260000")      /* 260000 */
288290   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
289291   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
290292   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r2864r2865
295297   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
296298   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
297299
298   PORT_START      /* 26010 */
300   PORT_START_TAG("260010")      /* 260010 */
299301   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_VBLANK )
300302   PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
301303   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )   /* Input buffer full (@260030) */
r2864r2865
316318
317319
318320static INPUT_PORTS_START( guts )
319   PORT_START      /* 26000 */
321   PORT_START_TAG("260000")      /* 260000 */
320322   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
321323   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
322324   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
r2864r2865
324326   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
325327   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
326328
327   PORT_START      /* 26010 */
329   PORT_START_TAG("260010")      /* 260010 */
328330   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_VBLANK )
329331   PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
330332   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )   /* Input buffer full (@260030) */
r2864r2865
337339   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
338340   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
339341
340   PORT_START   /* ADC0 @ 0x260020 */
342   PORT_START_TAG("ADC0")         /* ADC0 @ 0x260020 */
341343   PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
342344   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
343345
344   PORT_START   /* ADC1 @ 0x260022 */
346   PORT_START_TAG("ADC1")         /* ADC1 @ 0x260022 */
345347   PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_REVERSE
346348   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
347349
348   PORT_START   /* ADC0 @ 0x260024 */
350   PORT_START_TAG("ADC2")         /* ADC0 @ 0x260024 */
349351   PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
350352   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
351353
352   PORT_START   /* ADC1 @ 0x260026 */
354   PORT_START_TAG("ADC3")         /* ADC1 @ 0x260026 */
353355   PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) PORT_REVERSE
354356   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
355357
r2864r2865
724726static DRIVER_INIT( eprom )
725727{
726728   atarigen_eeprom_default = NULL;
727   atarijsa_init(machine, 1, 0x0002);
729   atarijsa_init(machine, "260010", 0x0002);
728730
729731   /* install CPU synchronization handlers */
730732   sync_data = memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x16cc00, 0x16cc01, 0, 0, sync_r, sync_w);
r2864r2865
735737static DRIVER_INIT( klaxp )
736738{
737739   atarigen_eeprom_default = NULL;
738   atarijsa_init(machine, 1, 0x0002);
740   atarijsa_init(machine, "260010", 0x0002);
739741}
740742
741743
742744static DRIVER_INIT( guts )
743745{
744746   atarigen_eeprom_default = NULL;
745   atarijsa_init(machine, 1, 0x0002);
747   atarijsa_init(machine, "260010", 0x0002);
746748}
747749
748750
src/mame/drivers/cshooter.c
r2864r2865
9393
9494static UINT8 *mainram;
9595
96static void ar_coin_hack(void)
96static void ar_coin_hack(running_machine *machine)
9797{
98   if(input_port_read(Machine, "COIN") & 1)
98   if(input_port_read(machine, "COIN") & 1)
9999   {
100100      if(coin_stat==0)
101101      {
r2864r2865
204204      cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0x10);
205205
206206   if(mainram!=NULL)
207      ar_coin_hack();
207      ar_coin_hack(machine);
208208
209209}
210210
src/mame/drivers/fgoal.c
r2864r2865
8181static TIMER_CALLBACK( interrupt_callback )
8282{
8383   int scanline;
84   int coin = (input_port_read_indexed(machine, 1) & 2);
84   int coin = (input_port_read(machine, "IN1") & 2);
8585
8686   cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
8787
r2864r2865
113113
114114static READ8_HANDLER( fgoal_analog_r )
115115{
116   return input_port_read_indexed(machine, 2 + fgoal_player); /* PCB can be jumpered to use a single dial */
116   return input_port_read(machine, fgoal_player ? "PADDLE1" : "PADDLE0"); /* PCB can be jumpered to use a single dial */
117117}
118118
119119
120120static READ8_HANDLER( fgoal_switches_r )
121121{
122122   if (video_screen_get_vpos(machine->primary_screen) & 0x80)
123      return input_port_read_indexed(machine, 1) | 0x80;
123      return input_port_read(machine, "IN1") | 0x80;
124124   else
125      return input_port_read_indexed(machine, 1);
125      return input_port_read(machine, "IN1");
126126}
127127
128128
r2864r2865
255255
256256static INPUT_PORTS_START( fgoal )
257257
258   PORT_START
258   PORT_START_TAG("IN0")
259259   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_TILT )
260260   PORT_DIPNAME( 0x40, 0x40, "Display Coinage Settings" )
261261   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
r2864r2865
280280
281281   /* extra credit score changes depending on player's performance */
282282
283   PORT_START
283   PORT_START_TAG("IN1")
284284   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* 128V */
285285   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ))
286286   PORT_DIPSETTING(    0x00, DEF_STR( Upright ))
r2864r2865
300300
301301   /* game freezes when analog controls read $00 or $ff */
302302
303   PORT_START
303   PORT_START_TAG("PADDLE0")
304304   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(1, 254) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_REVERSE PORT_PLAYER(1)
305305
306   PORT_START
306   PORT_START_TAG("PADDLE1")
307307   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(1, 254) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_REVERSE PORT_PLAYER(2)
308308
309309INPUT_PORTS_END
src/mame/drivers/hitme.c
r2864r2865
6868static VIDEO_UPDATE(hitme)
6969{
7070   /* the card width resistor comes from an input port, scaled to the range 0-25 kOhms */
71   double width_resist = input_port_read_indexed(screen->machine, 7) * 25000 / 100;
71   double width_resist = input_port_read(screen->machine, "WIDTH") * 25000 / 100;
7272   /* this triggers a oneshot for the following length of time */
7373   double width_duration = 0.45 * 1000e-12 * width_resist;
7474   /* the dot clock runs at the standard horizontal frequency * 320+16 clocks per scanline */
r2864r2865
128128
129129static UINT8 read_port_and_t0(running_machine *machine, int port)
130130{
131   UINT8 val = input_port_read_indexed(machine, port);
131   static const char *portnames[] = { "IN0", "IN1", "IN2", "IN3" };
132
133   UINT8 val = input_port_read(machine, portnames[port]);
132134   if (attotime_compare(timer_get_time(), timeout_time) > 0)
133135      val ^= 0x80;
134136   return val;
r2864r2865
183185        In fact, it is very important that our timing calculation timeout AFTER the sound
184186        system's equivalent computation, or else we will hang notes.
185187    */
186   UINT8 raw_game_speed = input_port_read_indexed(machine, 6);
188   UINT8 raw_game_speed = input_port_read(machine, "R3");
187189   double resistance = raw_game_speed * 25000 / 100;
188190   attotime duration = attotime_make(0, ATTOSECONDS_PER_SECOND * 0.45 * 6.8e-6 * resistance * (data+1));
189191   timeout_time = attotime_add(timer_get_time(), duration);
r2864r2865
223225   AM_RANGE(0x1500, 0x15ff) AM_READ(hitme_port_1_r)
224226   AM_RANGE(0x1600, 0x16ff) AM_READ(hitme_port_2_r)
225227   AM_RANGE(0x1700, 0x17ff) AM_READ(hitme_port_3_r)
226   AM_RANGE(0x1800, 0x18ff) AM_READ(input_port_4_r)
227   AM_RANGE(0x1900, 0x19ff) AM_READ(input_port_5_r)
228   AM_RANGE(0x1800, 0x18ff) AM_READ_PORT("IN4")
229   AM_RANGE(0x1900, 0x19ff) AM_READ_PORT("IN5")
228230   AM_RANGE(0x1d00, 0x1dff) AM_WRITE(output_port_0_w)
229231   AM_RANGE(0x1e00, 0x1fff) AM_WRITE(output_port_1_w)
230232ADDRESS_MAP_END
r2864r2865
235237   AM_RANGE(0x15, 0x15) AM_READ(hitme_port_1_r)
236238   AM_RANGE(0x16, 0x16) AM_READ(hitme_port_2_r)
237239   AM_RANGE(0x17, 0x17) AM_READ(hitme_port_3_r)
238   AM_RANGE(0x18, 0x18) AM_READ(input_port_4_r)
239   AM_RANGE(0x19, 0x19) AM_READ(input_port_5_r)
240   AM_RANGE(0x18, 0x18) AM_READ_PORT("IN4")
241   AM_RANGE(0x19, 0x19) AM_READ_PORT("IN5")
240242   AM_RANGE(0x1d, 0x1d) AM_WRITE(output_port_0_w)
241243   AM_RANGE(0x1e, 0x1f) AM_WRITE(output_port_1_w)
242244ADDRESS_MAP_END
r2864r2865
356358 *************************************/
357359
358360static INPUT_PORTS_START( hitme )
359   PORT_START
361   PORT_START_TAG("IN0")
360362   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )               /* Start button */
361363   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )               /* Always high */
362364   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )            /* Hblank */
r2864r2865
366368   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)   /* P1 Bet button */
367369   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )            /* Time out counter (*TO) */
368370
369   PORT_START
371   PORT_START_TAG("IN1")
370372   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
371373   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )               /* Always high */
372374   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )               /* Aux 2 dipswitch - Unused */
r2864r2865
376378   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)   /* P2 Bet button */
377379   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )            /* Time out counter (*TO) */
378380
379   PORT_START
381   PORT_START_TAG("IN2")
380382   PORT_DIPNAME( 0x01, 0x00, "Extra Hand On Natural" )         /* Aux 1 dipswitch */
381383   PORT_DIPSETTING(    0x00, DEF_STR ( Off ) )
382384   PORT_DIPSETTING(    0x01, DEF_STR ( On )  )
r2864r2865
388390   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)   /* P3 Bet button */
389391   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )            /* Time out counter (*TO) */
390392
391   PORT_START
393   PORT_START_TAG("IN3")
392394   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )            /* Time out counter (TOC1) */
393395   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )               /* Always high */
394396   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )               /* Aux 2 dipswitch - Unused*/
r2864r2865
398400   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)   /* P4 Bet button */
399401   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )            /* Time out counter (*TO) */
400402
401   PORT_START
403   PORT_START_TAG("IN4")
402404   PORT_DIPNAME( 0x07, 0x07, "Number of Chips" )
403405   PORT_DIPSETTING(    0x00, "5 Chips" )
404406   PORT_DIPSETTING(    0x01, "10 Chips" )
r2864r2865
410412   PORT_DIPSETTING(    0x07, "40 Chips" )
411413   PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED )
412414
413   PORT_START
415   PORT_START_TAG("IN5")
414416   PORT_DIPNAME( 0x07, 0x00, "Number of Hands" )
415417   PORT_DIPSETTING(    0x00, "5 Hands" )
416418   PORT_DIPSETTING(    0x01, "10 Hands" )
r2864r2865
427429   PORT_ADJUSTER(30, "Game Speed")
428430
429431   /* this is actually a variable resistor */
430   PORT_START
432   PORT_START_TAG("WIDTH")
431433   PORT_ADJUSTER(50, "Card Width")
432434INPUT_PORTS_END
433435
434436
435437static INPUT_PORTS_START( barricad )
436   PORT_START
438   PORT_START_TAG("IN0")
437439   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )                     /* Start button */
438440   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )                     /* Always high */
439441   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )                  /* Hblank */
r2864r2865
443445   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  ) PORT_PLAYER(1)
444446   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )                  /* Time out counter (*TO) */
445447
446   PORT_START
448   PORT_START_TAG("IN1")
447449   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
448450   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )                     /* Always high */
449451   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )                     /* Aux 2 dipswitch - Unused */
r2864r2865
453455   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  ) PORT_PLAYER(3)
454456   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )                  /* Time out counter (*TO) */
455457
456   PORT_START
458   PORT_START_TAG("IN2")
457459   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )                  /* ??? */
458460   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )                     /* Always high */
459461   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )                  /* Hblank */
r2864r2865
463465   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  ) PORT_PLAYER(4)
464466   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )                  /* Time out counter (*TO) */
465467
466   PORT_START
468   PORT_START_TAG("IN3")
467469   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )                  /* Time out counter (TOC1) */
468470   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )                  /* Always high */
469471   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )                  /* Aux 2 dipswitch - Unused*/
r2864r2865
478480        same dipswitch as hitme's chips, and speed is hitme's hands. The flyer
479481      says 1-7 points per games, but it really can go to 8. */
480482
481   PORT_START
483   PORT_START_TAG("IN4")
482484   PORT_DIPNAME( 0x07, 0x07, "Points Per Game" )
483485   PORT_DIPSETTING(    0x00, "1 Point" )
484486   PORT_DIPSETTING(    0x01, "2 Points" )
r2864r2865
492494   /* These are like lives, you lose a point if you crash. The last person with
493495        points wins the game. */
494496
495   PORT_START
497   PORT_START_TAG("IN5")
496498   PORT_DIPNAME( 0x07, 0x00, "Game Speed" )
497499   PORT_DIPSETTING(    0x00, "Fast Fast" )
498500   PORT_DIPSETTING(    0x01, "7" )
src/mame/drivers/rampart.c
r2864r2865
536536
537537   atarigen_eeprom_default = compressed_default_eeprom;
538538   memcpy(&rom[0x140000], &rom[0x40000], 0x8000);
539   atarigen_slapstic_init(0, 0x140000, 0x438000, 118);
539   atarigen_slapstic_init(machine, 0, 0x140000, 0x438000, 118);
540540}
541541
542542
src/mame/drivers/segaxbd.c
r2864r2865
6161 *************************************/
6262
6363extern void fd1094_machine_init(void);
64extern void fd1094_driver_init(void (*set_decrypted)(UINT8 *));
64extern void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(UINT8 *));
6565
6666
6767
r2864r2865
7171 *
7272 *************************************/
7373
74static void xboard_generic_init(void)
74static void xboard_generic_init(running_machine *machine)
7575{
7676   /* init the FD1094 */
77   fd1094_driver_init(NULL);
77   fd1094_driver_init(machine, NULL);
7878
7979   /* set the default road priority */
8080   xboard_set_road_priority(1);
r2864r2865
18761876   ROM_LOAD32_BYTE( "mpr12418.96",  0x100001, 0x20000, CRC(ed1a0f2b) SHA1(1aa87292ca0465fa129d6be81d95dbb77332ecab) )
18771877   ROM_LOAD32_BYTE( "mpr12419.100", 0x100002, 0x20000, CRC(ce4568cb) SHA1(1ed66e74ce94d41593b498827d9cc243f775d4ba) )
18781878   ROM_LOAD32_BYTE( "mpr12420.104", 0x100003, 0x20000, CRC(679442eb) SHA1(f88ef0219497f955d8db6783f3636dad52928f46) )
1879   ROM_LOAD32_BYTE( "epr12413.93", 0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) )
1880   ROM_LOAD32_BYTE( "epr12414.97", 0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) )
1879   ROM_LOAD32_BYTE( "epr12413.93",  0x180000, 0x20000, CRC(2f1693df) SHA1(ba1e654a1b5fae661b0dae4a8ed04ff50fb546a2) )
1880   ROM_LOAD32_BYTE( "epr12414.97",  0x180001, 0x20000, CRC(c78f3d45) SHA1(665750907ed11c89c2ea5c410eac2808445131ae) )
18811881   ROM_LOAD32_BYTE( "epr12415.101", 0x180002, 0x20000, CRC(6080e9ed) SHA1(eb1b871453f76e6a65d20fa9d4bddc1c9f940b4d) )
18821882   ROM_LOAD32_BYTE( "epr12416.105", 0x180003, 0x20000, CRC(6f1f2769) SHA1(d00d26cd1052d4b46c432b6b69cb2d83179d52a6) )
18831883
r2864r2865
19131913*/
19141914ROM_START( smgpu )
19151915   ROM_REGION( 0x80000, REGION_CPU1, 0 ) /* 68000 code */
1916   ROM_LOAD16_BYTE( "ep12561c.58", 0x00000, 0x20000, CRC(a5b0f3fe) SHA1(17103e56f822fdb52e72f597c01415ed375aa102) )
1917   ROM_LOAD16_BYTE( "ep12562c.63", 0x00001, 0x20000, CRC(799e55f4) SHA1(2e02cdc63bda47b087c81021018287cfa961c083) )
1916   ROM_LOAD16_BYTE( "epr12561c.58", 0x00000, 0x20000, CRC(a5b0f3fe) SHA1(17103e56f822fdb52e72f597c01415ed375aa102) )
1917   ROM_LOAD16_BYTE( "epr12562c.63", 0x00001, 0x20000, CRC(799e55f4) SHA1(2e02cdc63bda47b087c81021018287cfa961c083) )
19181918
19191919   ROM_REGION( 0x2000, REGION_USER1, 0 )   /* decryption key */
19201920   ROM_LOAD( "317-0125a.key", 0x0000, 0x2000, CRC(3ecdb120) SHA1(c484198e4509d79214e78d4a47e9a7e339f7a2ed) )
r2864r2865
19671967*/
19681968ROM_START( smgpu1 )
19691969   ROM_REGION( 0x80000, REGION_CPU1, 0 ) /* 68000 code */
1970   ROM_LOAD16_BYTE( "ep12561b.63", 0x00000, 0x20000, CRC(80a32655) SHA1(fe1ffa8af9f1ca175ba90b24a0853329b08d19af) )
1971   ROM_LOAD16_BYTE( "ep12562b.58", 0x00001, 0x20000, CRC(d525f2a8) SHA1(f3241e11485c7428cd9f081ec6768fda39ae3250) )
1970   ROM_LOAD16_BYTE( "epr12561b.58", 0x00000, 0x20000, CRC(80a32655) SHA1(fe1ffa8af9f1ca175ba90b24a0853329b08d19af) )
1971   ROM_LOAD16_BYTE( "epr12562b.63", 0x00001, 0x20000, CRC(d525f2a8) SHA1(f3241e11485c7428cd9f081ec6768fda39ae3250) )
19721972
19731973   ROM_REGION( 0x2000, REGION_USER1, 0 )   /* decryption key */
19741974   ROM_LOAD( "317-0125a.key", 0x0000, 0x2000, CRC(3ecdb120) SHA1(c484198e4509d79214e78d4a47e9a7e339f7a2ed) )
r2864r2865
24112411
24122412static DRIVER_INIT( generic_xboard )
24132413{
2414   xboard_generic_init();
2414   xboard_generic_init(machine);
24152415}
24162416
24172417
r2864r2865
24242424
24252425static DRIVER_INIT( aburner2 )
24262426{
2427   xboard_generic_init();
2427   xboard_generic_init(machine);
24282428   xboard_set_road_priority(0);
24292429
24302430   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x140006, 0x140007, 0, 0x00fff0, aburner2_iochip_0_D_w);
r2864r2865
24332433
24342434static DRIVER_INIT( aburner )
24352435{
2436   xboard_generic_init();
2436   xboard_generic_init(machine);
24372437   xboard_set_road_priority(0);
24382438}
24392439
24402440
24412441static DRIVER_INIT( loffire )
24422442{
2443   xboard_generic_init();
2443   xboard_generic_init(machine);
24442444   adc_reverse[1] = adc_reverse[3] = 1;
24452445
24462446   /* install extra synchronization on core shared memory */
r2864r2865
24502450
24512451static DRIVER_INIT( smgp )
24522452{
2453   xboard_generic_init();
2453   xboard_generic_init(machine);
24542454   memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x2f0000, 0x2f3fff, 0, 0, smgp_excs_r, smgp_excs_w);
24552455}
24562456
24572457
24582458static DRIVER_INIT( gprider )
24592459{
2460   xboard_generic_init();
2460   xboard_generic_init(machine);
24612461   gprider_hack = 1;
24622462}
24632463
src/mame/drivers/hornet.c
r2864r2865
308308*/
309309
310310#include "driver.h"
311#include "deprecat.h"
312311#include "cpu/powerpc/ppc.h"
313312#include "cpu/sharc/sharc.h"
314313#include "machine/konppc.h"
r2864r2865
463462   }
464463}
465464
466static void K037122_tile_draw(int chip, bitmap_t *bitmap, const rectangle *cliprect)
465static void K037122_tile_draw(running_machine *machine, int chip, bitmap_t *bitmap, const rectangle *cliprect)
467466{
468   const rectangle *visarea = video_screen_get_visible_area(Machine->primary_screen);
467   const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen);
469468
470469   if (K037122_reg[chip][0xc] & 0x10000)
471470   {
r2864r2865
648647   voodoo_update(0, bitmap, cliprect);
649648
650649   K037122_tile_update(screen->machine, 0);
651   K037122_tile_draw(0, bitmap, cliprect);
650   K037122_tile_draw(screen->machine, 0, bitmap, cliprect);
652651
653652   draw_7segment_led(bitmap, 3, 3, led_reg0);
654653   draw_7segment_led(bitmap, 9, 3, led_reg1);
r2864r2865
666665
667666      /* TODO: tilemaps per screen */
668667      K037122_tile_update(screen->machine, 0);
669      K037122_tile_draw(0, bitmap, cliprect);
668      K037122_tile_draw(screen->machine, 0, bitmap, cliprect);
670669   }
671670   else if (screen == right_screen)
672671   {
r2864r2865
674673
675674      /* TODO: tilemaps per screen */
676675      K037122_tile_update(screen->machine, 1);
677      K037122_tile_draw(1, bitmap, cliprect);
676      K037122_tile_draw(screen->machine, 1, bitmap, cliprect);
678677   }
679678
680679   draw_7segment_led(bitmap, 3, 3, led_reg0);
r2864r2865
688687static READ8_HANDLER( sysreg_r )
689688{
690689   UINT8 r = 0;
690   static const char *portnames[] = { "IN0", "IN1", "IN2" };
691691
692692   switch (offset)
693693   {
694694      case 0:
695695      case 1:
696696      case 2:
697         r = input_port_read_indexed(machine, offset);
697         r = input_port_read(machine, portnames[offset]);
698698         break;
699699
700700      case 3:
r2864r2865
702702         break;
703703
704704      case 4:
705         r = input_port_read_indexed(machine, 3);
705         r = input_port_read(machine, "DSW");
706706         break;
707707   }
708708   return r;
r2864r2865
837837/*****************************************************************************/
838838
839839static INPUT_PORTS_START( hornet )
840   PORT_START
840   PORT_START_TAG("IN0")
841841   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
842842   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
843843   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
847847   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
848848   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
849849
850   PORT_START
850   PORT_START_TAG("IN1")
851851   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
852852   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
853853   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
857857   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
858858   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
859859
860   PORT_START
860   PORT_START_TAG("IN2")
861861   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
862862   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
863863   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_7)
864864   PORT_SERVICE_NO_TOGGLE( 0x10, IP_ACTIVE_LOW )
865865   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED )
866866
867   PORT_START
867   PORT_START_TAG("DSW")
868868   PORT_DIPNAME( 0x80, 0x00, "Test Mode" )
869869   PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
870870   PORT_DIPSETTING( 0x80, DEF_STR( On ) )
r2864r2865
889889   PORT_DIPNAME( 0x01, 0x01, "Monitor Type" )
890890   PORT_DIPSETTING( 0x01, "24KHz" )
891891   PORT_DIPSETTING( 0x00, "15KHz" )
892
893892INPUT_PORTS_END
894893
895894static INPUT_PORTS_START( sscope )
896   PORT_START
895   PORT_START_TAG("IN0")
897896   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
898897   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
899898   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
902901   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)      // Gun trigger
903902   PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
904903
905   PORT_START
904   PORT_START_TAG("IN1")
906905   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
907906
908   PORT_START
907   PORT_START_TAG("IN2")
909908   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
910909   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
911910   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_7)
912911   PORT_SERVICE_NO_TOGGLE( 0x10, IP_ACTIVE_LOW )
913912   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED )
914913
915   PORT_START
914   PORT_START_TAG("DSW")
916915   PORT_DIPNAME( 0x80, 0x00, "Test Mode" )
917916   PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
918917   PORT_DIPSETTING( 0x80, DEF_STR( On ) )
r2864r2865
937936   PORT_DIPNAME( 0x01, 0x01, "Monitor Type" )
938937   PORT_DIPSETTING( 0x01, "24KHz" )
939938   PORT_DIPSETTING( 0x00, "15KHz" )
940
941939INPUT_PORTS_END
942940
943941static const struct RF5C400interface rf5c400_interface =
src/mame/drivers/ddragon3.c
r2864r2865
4444extern VIDEO_UPDATE( ddragon3 );
4545extern VIDEO_UPDATE( ctribe );
4646
47/* Read/Write Handlers */
47/*************************************
48 *
49 *  Read/Write Handlers
50 *
51 *************************************/
4852
4953static WRITE8_HANDLER( oki_bankswitch_w )
5054{
r2864r2865
8993   }
9094}
9195
92/* Memory Maps */
96/*************************************
97 *
98 *  Memory Maps
99 *
100 *************************************/
93101
94102static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 )
95103   AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM)
r2864r2865
199207   AM_RANGE(0x9800, 0x9800) AM_WRITE(OKIM6295_data_0_w)
200208ADDRESS_MAP_END
201209
202/* Input Ports */
210/*************************************
211 *
212 *  Game-specific port definitions
213 *
214 *************************************/
203215
204216static INPUT_PORTS_START( ddragon3 )
205   PORT_START_TAG("IN1")
217   PORT_START_TAG("IN0")
206218   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
207219   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
208220   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
r2864r2865
220232   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
221233   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
222234
223   PORT_START
235   PORT_START_TAG("IN1")
224236   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
225237   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
226238   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
227239   PORT_BIT( 0x00f8, IP_ACTIVE_LOW, IPT_UNUSED )
228240   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
229241
230   PORT_START // DSW1&2
231   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) )
242   PORT_START_TAG("IN2")
243   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) )   PORT_DIPLOCATION("SW1:1,2")
232244   PORT_DIPSETTING(     0x0000, DEF_STR( 3C_1C ) )
233245   PORT_DIPSETTING(     0x0001, DEF_STR( 2C_1C ) )
234246   PORT_DIPSETTING(     0x0003, DEF_STR( 1C_1C ) )
235247   PORT_DIPSETTING(     0x0002, DEF_STR( 1C_2C ) )
236   PORT_BIT( 0x000c, IP_ACTIVE_LOW, IPT_UNUSED )
237   PORT_DIPNAME( 0x0010, 0x0010, "Continue Discount" )
248   PORT_DIPUNUSED_DIPLOC( 0x0004, 0x0004, "SW1:3" )
249   PORT_DIPUNUSED_DIPLOC( 0x0008, 0x0008, "SW1:4" )
250   PORT_DIPNAME( 0x0010, 0x0010, "Continue Discount" )   PORT_DIPLOCATION("SW1:5")
238251   PORT_DIPSETTING(     0x0010, DEF_STR( Off ) )
239252   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
240   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )
253   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:6")
241254   PORT_DIPSETTING(     0x0000, DEF_STR( Off ) )
242255   PORT_DIPSETTING(     0x0020, DEF_STR( On ) )
243   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) )
256   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION("SW1:7")
244257   PORT_DIPSETTING(     0x0040, DEF_STR( Off ) )
245258   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
246   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
247   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Difficulty ) )
259   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "SW1:8" )
260   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW2:1,2")
248261   PORT_DIPSETTING(     0x0200, DEF_STR( Easy ) )
249262   PORT_DIPSETTING(     0x0300, DEF_STR( Normal ) )
250263   PORT_DIPSETTING(     0x0100, DEF_STR( Hard ) )
251264   PORT_DIPSETTING(     0x0000, DEF_STR( Hardest ) )
252   PORT_DIPNAME( 0x0400, 0x0400, "Player Vs. Player Damage" )
265   PORT_DIPNAME( 0x0400, 0x0400, "Player Vs. Player Damage" ) PORT_DIPLOCATION("SW2:3")
253266   PORT_DIPSETTING(     0x0400, DEF_STR( Off ) )
254267   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
255   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED )
256   PORT_SERVICE( 0x1000, IP_ACTIVE_LOW )
257   PORT_DIPNAME( 0x2000, 0x2000, "Stage Clear Energy" )
268   PORT_DIPUNUSED_DIPLOC( 0x0800, 0x0800, "SW2:4" )
269   PORT_SERVICE_DIPLOC( 0x1000, IP_ACTIVE_LOW, "SW2:5" )
270   PORT_DIPNAME( 0x2000, 0x2000, "Stage Clear Energy" )   PORT_DIPLOCATION("SW2:6")
258271   PORT_DIPSETTING(     0x0000, DEF_STR( Off ) )
259272   PORT_DIPSETTING(     0x2000, "50" )
260   PORT_DIPNAME( 0x4000, 0x4000, "Starting Energy" )
273   PORT_DIPNAME( 0x4000, 0x4000, "Starting Energy" )   PORT_DIPLOCATION("SW2:7")
261274   PORT_DIPSETTING(     0x0000, "200" )
262275   PORT_DIPSETTING(     0x4000, "230" )
263   PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Players ) )
276   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Players ) )   PORT_DIPLOCATION("SW2:8")
264277   PORT_DIPSETTING(     0x8000, "2" )
265278   PORT_DIPSETTING(     0x0000, "3" )
266279
r2864r2865
276289   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
277290INPUT_PORTS_END
278291
279static INPUT_PORTS_START( ddrago3b )
280   PORT_START
292static INPUT_PORTS_START( ctribe )
293   PORT_START_TAG("IN0")
281294   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
282295   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
283296   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
284297   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
285298   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 )   // punch
286299   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 )   // jump
287   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 )   // kick
300   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 )  // Unused in game but work on input test
288301   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
289302
290303   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
291304   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )
292305   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_SERVICE1 )
293   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED )
294   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Flip_Screen ) )
306   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_VBLANK )
307   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION("SW1:7")
295308   PORT_DIPSETTING(     0x1000, DEF_STR( Off ) )
296309   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
297310   PORT_BIT( 0xe000, IP_ACTIVE_LOW, IPT_UNUSED )
298311
299   PORT_START
312   PORT_START_TAG("IN1")
300313   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
301314   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
302315   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
306319   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
307320   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 )
308321
309   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Coinage ) )
322   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Coinage ) )   PORT_DIPLOCATION("SW1:1,2")
310323   PORT_DIPSETTING(     0x0000, DEF_STR( 3C_1C ) )
311324   PORT_DIPSETTING(     0x0100, DEF_STR( 2C_1C ) )
312325   PORT_DIPSETTING(     0x0300, DEF_STR( 1C_1C ) )
313326   PORT_DIPSETTING(     0x0200, DEF_STR( 1C_2C ) )
314   PORT_BIT( 0x0c00, IP_ACTIVE_LOW, IPT_UNUSED )
315   PORT_DIPNAME( 0x1000, 0x1000, "Continue Discount" )
327   PORT_DIPUNUSED_DIPLOC( 0x0400, 0x0400, "SW1:3" )
328   PORT_DIPUNUSED_DIPLOC( 0x0800, 0x0800, "SW1:4" )
329   PORT_DIPNAME( 0x1000, 0x1000, "Continue Discount" )   PORT_DIPLOCATION("SW1:5")
316330   PORT_DIPSETTING(     0x1000, DEF_STR( Off ) )
317331   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
318   PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Demo_Sounds ) )
332   PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:6")
319333   PORT_DIPSETTING(     0x0000, DEF_STR( Off ) )
320334   PORT_DIPSETTING(     0x2000, DEF_STR( On ) )
321   PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED )
335   PORT_DIPUNUSED_DIPLOC( 0x4000, 0x4000, "SW1:8" )
336   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
322337
323   PORT_START
338   PORT_START_TAG("IN2")
324339   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
325340   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
326341   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
r2864r2865
330345   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
331346   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START3 )
332347
333   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Difficulty ) )
348   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW2:1,2")
334349   PORT_DIPSETTING(     0x0200, DEF_STR( Easy ) )
335350   PORT_DIPSETTING(     0x0300, DEF_STR( Normal ) )
336351   PORT_DIPSETTING(     0x0100, DEF_STR( Hard ) )
337352   PORT_DIPSETTING(     0x0000, DEF_STR( Hardest ) )
338   PORT_DIPNAME( 0x0400, 0x0400, "Player Vs. Player Damage" )
339   PORT_DIPSETTING(     0x0400, DEF_STR( Off ) )
340   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
341   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED )
342   PORT_SERVICE( 0x1000, IP_ACTIVE_LOW )
343   PORT_DIPNAME( 0x2000, 0x2000, "Stage Clear Energy" )
344   PORT_DIPSETTING(     0x0000, DEF_STR( Off ) )
345   PORT_DIPSETTING(     0x2000, "50" )
353   PORT_DIPNAME( 0x0400, 0x0400, "Timer Speed" )      PORT_DIPLOCATION("SW2:3")
354   PORT_DIPSETTING(     0x0400, DEF_STR( Normal ) )
355   PORT_DIPSETTING(     0x0000, "Fast" )
356   PORT_DIPUNUSED_DIPLOC( 0x0800, 0x0800, "SW2:4" )
357   PORT_SERVICE_DIPLOC( 0x1000, IP_ACTIVE_LOW, "SW2:5" )
358   PORT_DIPNAME( 0x2000, 0x2000, "Stage Clear Energy" ) PORT_CONDITION("IN3",0x0100,PORTCOND_EQUALS,0x0100) PORT_DIPLOCATION("SW2:6")
359   PORT_DIPSETTING(     0x2000, "0" )
360   PORT_DIPSETTING(     0x0000, "50" )
361   PORT_DIPNAME( 0x2000, 0x2000, "Stage Clear Energy" ) PORT_CONDITION("IN3",0x0100,PORTCOND_EQUALS,0x0000) PORT_DIPLOCATION("SW2:6")
362   PORT_DIPSETTING(     0x2000, "100" )
363   PORT_DIPSETTING(     0x0000, "150" )
346364   PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED )
347365
348   PORT_START
366   PORT_START_TAG("IN3")
349367   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
350
351   PORT_DIPNAME( 0x0100, 0x0100, "Starting Energy" )
352   PORT_DIPSETTING(   0x0000, "200" )
353   PORT_DIPSETTING(   0x0100, "230" )
354   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Players ) )
355   PORT_DIPSETTING(   0x0200, "2" )
356   PORT_DIPSETTING(   0x0000, "3" )
357   PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED )
358INPUT_PORTS_END
359
360static INPUT_PORTS_START( ctribe )
361   PORT_START
362   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
363   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
364   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
365   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
366   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 )   // punch
367   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 )   // jump
368   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
369   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
370
371   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
372   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )
373   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_SERVICE1 )
374   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_VBLANK )
375   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7")
376   PORT_DIPSETTING(     0x1000, DEF_STR( Off ) )
368   PORT_DIPNAME( 0x0100, 0x0100, "More Stage Clear Energy" )   PORT_DIPLOCATION("SW2:7")
369   PORT_DIPSETTING(     0x0100, DEF_STR( Off ) )
377370   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
378   PORT_BIT( 0xe000, IP_ACTIVE_LOW, IPT_UNUSED )
379
380   PORT_START
381   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
382   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
383   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
384   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
385   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
386   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
387   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
388   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 )
389
390   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Coinage ) )     PORT_DIPLOCATION("SW1:1,2")
391   PORT_DIPSETTING(     0x0000, DEF_STR( 3C_1C ) )
392   PORT_DIPSETTING(     0x0100, DEF_STR( 2C_1C ) )
393   PORT_DIPSETTING(     0x0300, DEF_STR( 1C_1C ) )
394   PORT_DIPSETTING(     0x0200, DEF_STR( 1C_2C ) )
395   PORT_BIT( 0x0c00, IP_ACTIVE_LOW, IPT_UNUSED )
396   PORT_DIPNAME( 0x1000, 0x1000, "Continue Discount" )    PORT_DIPLOCATION("SW1:5")
397   PORT_DIPSETTING(     0x1000, DEF_STR( Off ) )
398   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
399   PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:6")
400   PORT_DIPSETTING(     0x0000, DEF_STR( Off ) )
401   PORT_DIPSETTING(     0x2000, DEF_STR( On ) )
371   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Players ) )   PORT_DIPLOCATION("SW2:8")
372   PORT_DIPSETTING(     0x0200, "2" )
373   PORT_DIPSETTING(     0x0000, "3" )
402374   PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED )
375INPUT_PORTS_END
403376
404   PORT_START
405   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
406   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
407   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
408   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
409   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
410   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
411   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
412   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START3 )
377static INPUT_PORTS_START( ddrago3b )
378   PORT_INCLUDE( ctribe )
413379
414   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Difficulty ) )  PORT_DIPLOCATION("SW2:1,2")
415   PORT_DIPSETTING(     0x0200, DEF_STR( Easy ) )
416   PORT_DIPSETTING(     0x0300, DEF_STR( Normal ) )
417   PORT_DIPSETTING(     0x0100, "Less than Difficult" )
418   PORT_DIPSETTING(     0x0000, "Difficult" )
419   PORT_DIPNAME( 0x0400, 0x0400, "Timer Speed" )          PORT_DIPLOCATION("SW2:3")
420   PORT_DIPSETTING(     0x0400, DEF_STR( Normal ) )
421   PORT_DIPSETTING(     0x0000, "Fast" )
380   PORT_MODIFY("IN0")
422381   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED )
423   PORT_DIPNAME( 0x1000, 0x1000, "Test Mode" )            PORT_DIPLOCATION("SW2:5")
424   PORT_DIPSETTING(     0x1000, DEF_STR( Off ) )
382
383   PORT_MODIFY("IN2")
384   PORT_DIPNAME( 0x0400, 0x0400, "Player Vs. Player Damage" )   PORT_DIPLOCATION("SW2:3")
385   PORT_DIPSETTING(     0x0400, DEF_STR( Off ) )
425386   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
426   PORT_DIPNAME( 0x6000, 0x6000, "Stage Clear Energy" )   PORT_DIPLOCATION("SW2:6,7")
427   PORT_DIPSETTING(     0x6000, "0" )
428   PORT_DIPSETTING(     0x4000, "50" )
429   PORT_DIPSETTING(     0x2000, "100" ) /* According to manual but doesn't work on real pcb. */
430   PORT_DIPSETTING(     0x0000, "150" ) /* According to manual but doesn't work on real pcb. */
431   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
432387
433   PORT_START
434   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
435   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED )
436   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Players ) )     PORT_DIPLOCATION("SW2:8")
437   PORT_DIPSETTING(   0x0200, "2" )
438   PORT_DIPSETTING(   0x0000, "3" )
439   PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED )
388   PORT_MODIFY("IN3")
389   PORT_DIPNAME( 0x0100, 0x0100, "Starting Energy" )   PORT_DIPLOCATION("SW2:7")
390   PORT_DIPSETTING(     0x0000, "200" )
391   PORT_DIPSETTING(     0x0100, "230" )
440392INPUT_PORTS_END
441393
442/* Graphics Layouts */
394/*************************************
395 *
396 *  Graphics Layouts
397 *
398 *************************************/
443399
444400static const gfx_layout tile_layout =
445401{
r2864r2865
466422   32*8   /* every tile takes 32 consecutive bytes */
467423};
468424
469/* Graphics Decode Info */
425/*************************************
426 *
427 *  Graphics Decode Info
428 *
429 *************************************/
470430
471431static GFXDECODE_START( ddragon3 )
472432   GFXDECODE_ENTRY( REGION_GFX1, 0, tile_layout,   256, 32 )
473433   GFXDECODE_ENTRY( REGION_GFX2, 0, sprite_layout,   0, 16 )
474434GFXDECODE_END
475435
476/* Sound Interfaces */
436/*************************************
437 *
438 *  Sound Interfaces
439 *
440 *************************************/
477441
478442static void dd3_ymirq_handler(running_machine *machine, int irq)
479443{
r2864r2865
485449   dd3_ymirq_handler
486450};
487451
488/* Interrupt Generators */
452/*************************************
453 *
454 *  Interrupt Generators
455 *
456 *************************************/
489457
490458static INTERRUPT_GEN( ddragon3_cpu_interrupt ) { /* 6:0x177e - 5:0x176a */
491459   if( cpu_getiloops() == 0 ){
r2864r2865
496464   }
497465}
498466
499/* Machine Drivers */
467/*************************************
468 *
469 *  Machine driver
470 *
471 *************************************/
500472
501473static MACHINE_DRIVER_START( ddragon3 )
502474   /* basic machine hardware */
r2864r2865
504476   MDRV_CPU_PROGRAM_MAP(readmem, writemem)
505477   MDRV_CPU_VBLANK_INT_HACK(ddragon3_cpu_interrupt, 2)
506478
507   MDRV_CPU_ADD_TAG("audio", Z80, 3579545) // Guess
479   MDRV_CPU_ADD_TAG("audio", Z80, 3579545) // Guess (confirmed on bootleg)
508480   /* audio CPU */
509481   MDRV_CPU_PROGRAM_MAP(readmem_sound, writemem_sound)
510482
511483   /* video hardware */
512484   MDRV_SCREEN_ADD("main", RASTER)
513   MDRV_SCREEN_REFRESH_RATE(60)
485   MDRV_SCREEN_REFRESH_RATE(57)
514486   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
515487   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
516488   MDRV_SCREEN_SIZE(40*8, 32*8)
r2864r2865
525497   /* sound hardware */
526498   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
527499
528   MDRV_SOUND_ADD(YM2151, 3579545)
500   MDRV_SOUND_ADD_TAG("ym2151", YM2151, 3579545)   /* music */
529501   MDRV_SOUND_CONFIG(ym2151_interface)
530   MDRV_SOUND_ROUTE(0, "left", 1.00)   /* music */
531   MDRV_SOUND_ROUTE(1, "right", 1.00)
502   MDRV_SOUND_ROUTE(0, "left", 0.50)
503   MDRV_SOUND_ROUTE(1, "right", 0.50)
532504
533   MDRV_SOUND_ADD(OKIM6295, 1122000)
505   MDRV_SOUND_ADD_TAG("oki", OKIM6295, 1000000)   /* sound fx */
534506   MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // clock frequency & pin 7 not verified
535   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.00)   /* sound fx */
536   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.00)
507   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.50)
508   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.50)
537509MACHINE_DRIVER_END
538510
539511static MACHINE_DRIVER_START( ddrago3b )
r2864r2865
556528   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
557529
558530   MDRV_VIDEO_UPDATE(ctribe)
531
532   MDRV_SOUND_MODIFY("ym2151")
533   MDRV_SOUND_ROUTE(0, "left", 1.20)
534   MDRV_SOUND_ROUTE(1, "right", 1.20)
535
536   MDRV_SOUND_MODIFY("oki")
537   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.80)
538   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.80)
559539MACHINE_DRIVER_END
560540
561/* ROMs */
541/*************************************
542 *
543 *  ROM definition(s)
544 *
545 *************************************/
562546
563547ROM_START( ddragon3 )
564548   ROM_REGION( 0x80000, REGION_CPU1, 0 )   /* 64k for cpu code */
r2864r2865
772756   ROM_CONTINUE(           0x000000, 0x20000 )
773757ROM_END
774758
775/* Game Drivers */
759ROM_START( ctribb2 )
760   ROM_REGION( 0x80000, REGION_CPU1, 0 )   /* 64k for cpu code */
761   ROM_LOAD16_BYTE( "1.bin",  0x00001, 0x20000, CRC(9cfa997f) SHA1(ee49b4b9e9cd29616f244fdf3912ef743e2404ce) )
762   ROM_LOAD16_BYTE( "3.bin",  0x00000, 0x20000, CRC(2ece8681) SHA1(17ee2ceb893e2eb08fa4cabcdebcec02bee16cda) )
763   ROM_LOAD16_BYTE( "2.bin",  0x40001, 0x10000, CRC(8c2c6dbd) SHA1(b99b9be6e0bdc8340fedd258819c4df587926a84) )
764   /* No EVEN rom! */
776765
766   ROM_REGION( 0x10000, REGION_CPU2, 0 )   /* 64k for sound cpu code */
767   ROM_LOAD( "6.bin",   0x00000, 0x10000, CRC(0101df2d) SHA1(35e1efa4a11c0f9d9db5ee057926e5de29c3a4c1) )
768
769   ROM_REGION( 0x200000, REGION_GFX1, ROMREGION_DISPOSE )
770   ROM_LOAD( "7.bin",   0x000000, 0x40000, CRC(a8b773f1) SHA1(999e41dfeb3fb937da769c4a33bb29bf4076dc63) )    /* Background */
771   ROM_LOAD( "8.bin",   0x040000, 0x40000, CRC(617530fc) SHA1(b9155ed0ae1437bf4d0b7a95e769bc05a820ecec) )
772   ROM_LOAD( "11.bin",  0x080000, 0x40000, CRC(cef0a821) SHA1(c7a35048d5ebf3f09abf9d27f91d12adc03befeb) )
773   ROM_LOAD( "12.bin",  0x0c0000, 0x40000, CRC(b84fda09) SHA1(3ae0c0ec6c398dea17e248b017ea3e2f6c3571e1) )
774   ROM_LOAD( "9.bin",   0x100000, 0x20000, CRC(2719d7ce) SHA1(35275d32b584c477033037bc041a3687ecca412d) )
775   ROM_LOAD( "10.bin",  0x140000, 0x20000, CRC(753a4f53) SHA1(c76a449ef29dde671196cda1f128b0b2d4839a97) )
776   ROM_LOAD( "13.bin",  0x180000, 0x20000, CRC(59e01fe1) SHA1(67f5a4e9c9e9ebc6218b7c2ede0e5ff51682ee2f) )
777   ROM_LOAD( "14.bin",  0x1c0000, 0x20000, CRC(a69ab4f3) SHA1(bc99c6a587c972cb5c9e719c53ef921a28f1498e) )
778
779   ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )
780   ROM_LOAD( "34.bin",  0x000000, 0x20000, CRC(5b498f0e) SHA1(9d93ca1f44e1f04eb3b66db6027130683c9431a2) )    /* Sprites */
781   ROM_LOAD( "33.bin",  0x020000, 0x20000, CRC(14d79049) SHA1(250c87aa238fc794cd0f07e3388b97137cc1228f) )
782   ROM_LOAD( "32.bin",  0x040000, 0x20000, CRC(9631ea23) SHA1(de0a6595731d185ea18959bd04e3ac9e4261a8f8) )
783   ROM_LOAD( "31.bin",  0x060000, 0x20000, CRC(0ca8d3b9) SHA1(c48e7c456acb9deb7f01c19ab9a66360af09a13d) )
784   ROM_LOAD( "30.bin",  0x080000, 0x10000, CRC(972faddb) SHA1(f2b211e8f8301667e6c9a3ce9612e39b16e66a67) )
785   ROM_LOAD( "29.bin",  0x100000, 0x20000, CRC(479ae8ea) SHA1(6bfbab5ed7ae7275be0c177c7e39cff19210c0ab) )
786   ROM_LOAD( "28.bin",  0x120000, 0x20000, CRC(95598bbf) SHA1(2a155bbb09dc4efca6e1a6b847829f7ec09d323e) )
787   ROM_LOAD( "27.bin",  0x140000, 0x20000, CRC(4a3d006d) SHA1(d32fa627e3a4683101aff233bfc8a016c78a1702) )
788   ROM_LOAD( "26.bin",  0x160000, 0x20000, CRC(aa34a3cb) SHA1(9bcf5db3a89a300468e9300a9fc5fd33d1ba60de) )
789   ROM_LOAD( "25.bin",  0x180000, 0x10000, CRC(eb3ab374) SHA1(db66cb7976c111fa76a3a211e96ad1d7b78ce0ad) )
790   ROM_LOAD( "24.bin",  0x200000, 0x20000, CRC(d60bbff0) SHA1(b5e978b1d58f4d0ff05e51b728bb3ec06eea7d08) )
791   ROM_LOAD( "23.bin",  0x220000, 0x20000, CRC(d9595c47) SHA1(323e572a022d5297c727dc8b1717269c5b9134b7) )
792   ROM_LOAD( "22.bin",  0x240000, 0x20000, CRC(5a19a911) SHA1(d7ce955d3127b57ee560379055d71bacf3a9d6a1) )
793   ROM_LOAD( "21.bin",  0x260000, 0x20000, CRC(071360f9) SHA1(8269115484f3ceb69c3b2a215f684dd31a366989) )
794   ROM_LOAD( "20.bin",  0x280000, 0x10000, CRC(c602ac97) SHA1(44440739636b684c6dcac837f59664120c9ba5f3) )
795   ROM_LOAD( "19.bin",  0x300000, 0x20000, CRC(8d22736a) SHA1(d17f92544efebbdf89ca9fd11ab7c16d2636f175) )
796   ROM_LOAD( "18.bin",  0x320000, 0x20000, CRC(0f157822) SHA1(a1e16e4036b0c68c3f58cb0520f8120fe60b0dfa) )
797   ROM_LOAD( "17.bin",  0x340000, 0x20000, CRC(7f48c824) SHA1(af6b48dbcf88cfcaecb8cec5dd9eb4c25f4bf9a8) )
798   ROM_LOAD( "16.bin",  0x360000, 0x20000, CRC(cd1e9bd5) SHA1(1f956ab476b2c403c0dbf9e6169cfe2c51bb45ac) )
799   ROM_LOAD( "15.bin",  0x380000, 0x10000, CRC(4da1d8e5) SHA1(568e9e8d00f1b1ca27c28df5fc0ffc74ad91da7e) )
800
801   ROM_REGION( 0x040000, REGION_SOUND1, 0 )   /* ADPCM Samples */
802   ROM_LOAD( "5.bin",   0x000000, 0x20000, CRC(f92a7f4a) SHA1(3717ef64876be9ada378b449749918ce9072073a) )
803   ROM_LOAD( "4.bin",   0x020000, 0x20000, CRC(1a3a0b39) SHA1(8847530027cf4be03ffbc6d78dee97b459d03a04) )
804ROM_END
805
806/*************************************
807 *
808 *  Game driver(s)
809 *
810 *************************************/
811
777812GAME( 1990, ddragon3, 0,        ddragon3, ddragon3, 0, ROT0, "Technos", "Double Dragon 3 - The Rosetta Stone (US)", GAME_SUPPORTS_SAVE )
778813GAME( 1990, ddrago3j, ddragon3,   ddragon3, ddragon3, 0, ROT0, "Technos", "Double Dragon 3 - The Rosetta Stone (Japan)", GAME_SUPPORTS_SAVE )
779814GAME( 1990, ddrago3b, ddragon3, ddrago3b, ddrago3b, 0, ROT0, "bootleg", "Double Dragon 3 - The Rosetta Stone (bootleg)", GAME_SUPPORTS_SAVE )
780815GAME( 1990, ctribe,   0,        ctribe,   ctribe,   0, ROT0, "Technos", "The Combatribes (US)", GAME_SUPPORTS_SAVE )
781816GAME( 1990, ctribe1,  ctribe,   ctribe,   ctribe,   0, ROT0, "Technos", "The Combatribes (US) - Set 1?", GAME_SUPPORTS_SAVE )
782817GAME( 1990, ctribeb,  ctribe,   ctribe,   ctribe,   0, ROT0, "bootleg", "The Combatribes (bootleg)", GAME_SUPPORTS_SAVE )
818GAME( 1990, ctribb2,  ctribe,   ctribe,   ctribe,   0, ROT0, "bootleg", "The Combatribes (Italian bootleg)", GAME_SUPPORTS_SAVE )
src/mame/drivers/exterm.c
r2864r2865
139139   UINT16 port;
140140
141141   /* Read the fake input port */
142   UINT8 trackball_pos = input_port_read_indexed(machine, 3 + which);
142   UINT8 trackball_pos = input_port_read(machine, which ? "DIAL1" : "DIAL0");
143143
144144   /* Calculate the change from the last position. */
145145   UINT8 trackball_diff = trackball_old[which] - trackball_pos;
r2864r2865
155155   aimpos[which] = (aimpos[which] + trackball_diff) & 0x3f;
156156
157157   /* Combine it with the standard input bits */
158   port = which ? input_port_read_indexed(machine,1) : input_port_read_indexed(machine,0);
158   port = which ? input_port_read(machine, "IN1") : input_port_read(machine, "IN0");
159159
160160   return (port & 0xc0ff) | (aimpos[which] << 8);
161161}
r2864r2865
371371 *************************************/
372372
373373static INPUT_PORTS_START( exterm )
374   PORT_START      /* IN0 */
374   PORT_START_TAG("IN0")      /* IN0 */
375375   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
376376   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START1 )
377377   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(1)
r2864r2865
384384   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
385385   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
386386
387   PORT_START      /* IN1 */
387   PORT_START_TAG("IN1")      /* IN1 */
388388   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN2 )
389389   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
390390   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(2)
r2864r2865
396396   PORT_BIT( 0x3f00, IP_ACTIVE_LOW, IPT_SPECIAL) /* trackball data */
397397   PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED )
398398
399   PORT_START   /* DSW */
399   PORT_START_TAG("DSW")      /* DSW */
400400   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unused ) ) /* According to the test screen */
401401   PORT_DIPSETTING(     0x0001, DEF_STR( Off ) )
402402   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
r2864r2865
425425   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
426426   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
427427
428   PORT_START /* IN3, fake trackball input port */
428   PORT_START_TAG("DIAL0") /* IN3, fake trackball input port */
429429   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X)
430430
431   PORT_START /* IN4, fake trackball input port. */
431   PORT_START_TAG("DIAL1") /* IN4, fake trackball input port. */
432432   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(2) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M)
433433INPUT_PORTS_END
434434
src/mame/drivers/mediagx.c
r2864r2865
11191119
11201120static void init_mediagx(running_machine *machine)
11211121{
1122   init_pc_common(PCCOMMON_KEYBOARD_AT,mediagx_set_keyb_int);
1122   init_pc_common(machine, PCCOMMON_KEYBOARD_AT,mediagx_set_keyb_int);
11231123   mc146818_init(MC146818_STANDARD);
11241124
11251125   pci_init();
src/mame/drivers/gaplus.c
r2864r2865
162162
163163***************************************************************************/
164164
165static READ8_HANDLER( in0_l )   { return input_port_read_indexed(machine, 0); }      // P1 joystick
166static READ8_HANDLER( in0_h )   { return input_port_read_indexed(machine, 0) >> 4; }   // P2 joystick
167static READ8_HANDLER( in1_l )   { return input_port_read_indexed(machine, 1); }      // fire and start buttons
168static READ8_HANDLER( in1_h )   { return input_port_read_indexed(machine, 1) >> 4; }   // coins
169static READ8_HANDLER( dipA_l )   { return input_port_read_indexed(machine, 2); }      // dips A
170static READ8_HANDLER( dipA_h )   { return input_port_read_indexed(machine, 2) >> 4; }   // dips A
171static READ8_HANDLER( dipB_l )   { return input_port_read_indexed(machine, 3); }      // dips B
172static READ8_HANDLER( dipB_h )   { return input_port_read_indexed(machine, 3) >> 4; }   // dips B
165static READ8_HANDLER( in0_l )   { return input_port_read(machine, "IN0"); }         // P1 joystick
166static READ8_HANDLER( in0_h )   { return input_port_read(machine, "IN0") >> 4; }   // P2 joystick
167static READ8_HANDLER( in1_l )   { return input_port_read(machine, "IN1"); }         // fire and start buttons
168static READ8_HANDLER( in1_h )   { return input_port_read(machine, "IN1") >> 4; }   // coins
169static READ8_HANDLER( dipA_l )   { return input_port_read(machine, "DSW0"); }      // dips A
170static READ8_HANDLER( dipA_h )   { return input_port_read(machine, "DSW0") >> 4; }   // dips A
171static READ8_HANDLER( dipB_l )   { return input_port_read(machine, "DSW1"); }      // dips B
172static READ8_HANDLER( dipB_h )   { return input_port_read(machine, "DSW1") >> 4; }   // dips B
173173static WRITE8_HANDLER( out_lamps0 )
174174{
175175   set_led_status(0,data & 1);
r2864r2865
364364
365365static INPUT_PORTS_START( gaplus )
366366   /* The inputs are not memory mapped, they are handled by three I/O chips. */
367   PORT_START   /* 56XX #0 pins 22-29 */
367   PORT_START_TAG("IN0")   /* 56XX #0 pins 22-29 */
368368   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
369369   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
370370   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
r2864r2865
374374   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
375375   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
376376
377   PORT_START   /* 56XX #0 pins 30-33 and 38-41 */
377   PORT_START_TAG("IN1")   /* 56XX #0 pins 30-33 and 38-41 */
378378   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
379379   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
380380   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
r2864r2865
384384   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
385385   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
386386
387   PORT_START   /* 58XX #1 pins 30-33 and 38-41 */
387   PORT_START_TAG("DSW0")   /* 58XX #1 pins 30-33 and 38-41 */
388388   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
389389   PORT_DIPSETTING(    0x80, "2" )
390390   PORT_DIPSETTING(    0xc0, "3" )
r2864r2865
407407   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
408408   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
409409
410   PORT_START   /* 58XX #1 pins 22-29 */
410   PORT_START_TAG("DSW1")   /* 58XX #1 pins 22-29 */
411411   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
412412   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
413413   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
433433   PORT_DIPSETTING(    0x05, "50k 150k and every 300k" )
434434   PORT_DIPSETTING(    0x06, "50k 150k" )
435435
436   PORT_START   /* 62XX #2 pins 24-27 */
436   PORT_START_TAG("IN2")   /* 62XX #2 pins 24-27 */
437437   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
438438   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
439439   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
r2864r2865
444444
445445/* identical to gaplus, but service mode is a dip switch instead of coming from edge connector */
446446static INPUT_PORTS_START( gapluso )
447   /* The inputs are not memory mapped, they are handled by three I/O chips. */
448   PORT_START   /* 56XX #0 pins 22-29 */
449   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
450   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
451   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
452   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
453   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
454   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
455   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
456   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
447   PORT_INCLUDE( gaplus )
457448
458   PORT_START   /* 56XX #0 pins 30-33 and 38-41 */
459   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
460   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
461   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
462   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
463   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
464   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
465   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
466   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
467
468   PORT_START   /* 58XX #1 pins 30-33 and 38-41 */
469   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
470   PORT_DIPSETTING(    0x80, "2" )
471   PORT_DIPSETTING(    0xc0, "3" )
472   PORT_DIPSETTING(    0x40, "4" )
473   PORT_DIPSETTING(    0x00, "5" )
474   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
475   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
476   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
477   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
478   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
479   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
480   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
481   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
482   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
483   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
484   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
485   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
486   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
487   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
488   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
489   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
490
491   PORT_START   /* 58XX #1 pins 22-29 */
449   PORT_MODIFY("DSW1")
492450   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
493   PORT_DIPNAME( 0x70, 0x70, DEF_STR( Difficulty ) )
494   PORT_DIPSETTING(    0x70, "0 - Standard" )
495   PORT_DIPSETTING(    0x60, "1 - Easiest" )
496   PORT_DIPSETTING(    0x50, "2" )
497   PORT_DIPSETTING(    0x40, "3" )
498   PORT_DIPSETTING(    0x30, "4" )
499   PORT_DIPSETTING(    0x20, "5" )
500   PORT_DIPSETTING(    0x10, "6" )
501   PORT_DIPSETTING(    0x00, "7 - Hardest" )
502   PORT_DIPNAME( 0x08, 0x08, "Round Advance" )
503   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
504   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
505   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Bonus_Life ) )
506   PORT_DIPSETTING(    0x00, "30k 70k and every 70k" )
507   PORT_DIPSETTING(    0x01, "30k 100k and every 100k" )
508   PORT_DIPSETTING(    0x02, "30k 100k and every 200k" )
509   PORT_DIPSETTING(    0x03, "50k 100k and every 100k" )
510   PORT_DIPSETTING(    0x04, "50k 100k and every 200k" )
511   PORT_DIPSETTING(    0x07, "50k 150k and every 150k" )
512   PORT_DIPSETTING(    0x05, "50k 150k and every 300k" )
513   PORT_DIPSETTING(    0x06, "50k 150k" )
514451
515   PORT_START   /* 62XX #2 pins 24-27 */
516   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
517   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
518   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
519   PORT_DIPSETTING(    0x04, DEF_STR( Upright ) )
520   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
452   PORT_MODIFY("IN2")
521453   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )   // doesn't seem to be used
522454INPUT_PORTS_END
523455
524456/* identical to gaplus, but different bonus life settings */
525457static INPUT_PORTS_START( galaga3a )
526   /* The inputs are not memory mapped, they are handled by three I/O chips. */
527   PORT_START   /* 56XX #0 pins 22-29 */
528   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
529   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
530   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
531   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
532   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
533   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
534   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
535   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
458   PORT_INCLUDE( gaplus )
536459
537   PORT_START   /* 56XX #0 pins 30-33 and 38-41 */
538   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
539   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
540   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
541   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
542   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
543   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
544   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
545   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
546
547   PORT_START   /* 58XX #1 pins 30-33 and 38-41 */
548   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
549   PORT_DIPSETTING(    0x80, "2" )
550   PORT_DIPSETTING(    0xc0, "3" )
551   PORT_DIPSETTING(    0x40, "4" )
552   PORT_DIPSETTING(    0x00, "5" )
553   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
554   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
555   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
556   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
557   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
558   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
559   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
560   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
561   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
562   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
563   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
564   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
565   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
566   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
567   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
568   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
569
570   PORT_START   /* 58XX #1 pins 22-29 */
571   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
572   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
573   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
574   PORT_DIPNAME( 0x70, 0x70, DEF_STR( Difficulty ) )
575   PORT_DIPSETTING(    0x70, "0 - Standard" )
576   PORT_DIPSETTING(    0x60, "1 - Easiest" )
577   PORT_DIPSETTING(    0x50, "2" )
578   PORT_DIPSETTING(    0x40, "3" )
579   PORT_DIPSETTING(    0x30, "4" )
580   PORT_DIPSETTING(    0x20, "5" )
581   PORT_DIPSETTING(    0x10, "6" )
582   PORT_DIPSETTING(    0x00, "7 - Hardest" )
583   PORT_DIPNAME( 0x08, 0x08, "Round Advance" )
584   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
585   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
460   PORT_MODIFY("DSW1")
586461   PORT_DIPNAME( 0x07, 0x02, DEF_STR( Bonus_Life ) )
587462   PORT_DIPSETTING(    0x02, "30k 80k and every 100k" )
588463   PORT_DIPSETTING(    0x03, "30k 100k and every 100k" )
r2864r2865
592467   PORT_DIPSETTING(    0x06, "30k 150k" )
593468   PORT_DIPSETTING(    0x00, "50k 150k and every 150k" )
594469   PORT_DIPSETTING(    0x01, "50k 150k and every 200k" )
595
596   PORT_START   /* 62XX #2 pins 24-27 */
597   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
598   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
599   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
600   PORT_DIPSETTING(    0x04, DEF_STR( Upright ) )
601   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
602   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
603470INPUT_PORTS_END
604471
605472/* identical to gaplus, but different bonus life settings */
606473static INPUT_PORTS_START( galaga3m )
607   /* The inputs are not memory mapped, they are handled by three I/O chips. */
608   PORT_START   /* 56XX #0 pins 22-29 */
609   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
610   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
611   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
612   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
613   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
614   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
615   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
616   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
474   PORT_INCLUDE( gaplus )
617475
618   PORT_START   /* 56XX #0 pins 30-33 and 38-41 */
619   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
620   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
621   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
622   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
623   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
624   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
625   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
626   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
627
628   PORT_START   /* 58XX #1 pins 30-33 and 38-41 */
629   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
630   PORT_DIPSETTING(    0x80, "2" )
631   PORT_DIPSETTING(    0xc0, "3" )
632   PORT_DIPSETTING(    0x40, "4" )
633   PORT_DIPSETTING(    0x00, "5" )
634   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
635   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
636   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
637   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
638   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
639   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
640   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
641   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
642   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
643   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
644   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
645   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
646   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
647   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
648   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
649   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
650
651   PORT_START   /* 58XX #1 pins 22-29 */
652   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
653   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
654   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
655   PORT_DIPNAME( 0x70, 0x70, DEF_STR( Difficulty ) )
656   PORT_DIPSETTING(    0x70, "0 - Standard" )
657   PORT_DIPSETTING(    0x60, "1 - Easiest" )
658   PORT_DIPSETTING(    0x50, "2" )
659   PORT_DIPSETTING(    0x40, "3" )
660   PORT_DIPSETTING(    0x30, "4" )
661   PORT_DIPSETTING(    0x20, "5" )
662   PORT_DIPSETTING(    0x10, "6" )
663   PORT_DIPSETTING(    0x00, "7 - Hardest" )
664   PORT_DIPNAME( 0x08, 0x08, "Round Advance" )
665   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
666   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
476   PORT_MODIFY("DSW1")
667477   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Bonus_Life ) )
668478   PORT_DIPSETTING(    0x00, "30k 150k and every 600k" )
669479   PORT_DIPSETTING(    0x01, "50k 150k and every 300k" )
r2864r2865
673483   PORT_DIPSETTING(    0x07, "100k 300k and every 600k" )
674484   PORT_DIPSETTING(    0x05, "150k 400k and every 900k" )
675485   PORT_DIPSETTING(    0x06, "150k 400k" )
676
677   PORT_START   /* 62XX #2 pins 24-27 */
678   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
679   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
680   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
681   PORT_DIPSETTING(    0x04, DEF_STR( Upright ) )
682   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
683   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
684486INPUT_PORTS_END
685487
686488
src/mame/drivers/jedi.c
r2864r2865
214214
215215   switch (state->a2d_select)
216216   {
217      case 0: ret = input_port_read_indexed(machine, 2); break;
218      case 2: ret = input_port_read_indexed(machine, 3); break;
217      case 0: ret = input_port_read(machine, "STICKY"); break;
218      case 2: ret = input_port_read(machine, "STICKX"); break;
219219   }
220220
221221   return ret;
r2864r2865
309309 *************************************/
310310
311311static INPUT_PORTS_START( jedi )
312   PORT_START   /* 0C00 */
312   PORT_START_TAG("0c00")   /* 0C00 */
313313   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON3 )
314314   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_BUTTON2 )
315315   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_BUTTON1 )
r2864r2865
319319   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_COIN2 )
320320   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_COIN1 )
321321
322   PORT_START   /* 0C01 */
322   PORT_START_TAG("0c01")   /* 0C01 */
323323   PORT_BIT( 0x03, IP_ACTIVE_LOW,  IPT_UNUSED )
324324   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_TILT )
325325   PORT_BIT( 0x18, IP_ACTIVE_LOW,  IPT_UNUSED )
326326   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(jedi_audio_comm_stat_r, 0)
327327   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
328328
329   PORT_START   /* analog Y */
329   PORT_START_TAG("STICKY")   /* analog Y */
330330   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10)
331331
332   PORT_START   /* analog X */
332   PORT_START_TAG("STICKX")   /* analog X */
333333   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10)
334334INPUT_PORTS_END
335335
src/mame/drivers/flkatck.c
r2864r2865
6060   int data = 0;
6161
6262   switch ((offset & 0x1c) >> 2){
63      case 0x00:   /* inputs + DIPSW #3 + coinsw */
63      case 0x00:
6464         if (offset & 0x02)
65            data = input_port_read_indexed(machine, 2 + (offset & 0x01));
65            data = input_port_read(machine, (offset & 0x01) ? "COIN" : "DSW3");
6666         else
67            data = input_port_read_indexed(machine, 4 + (offset & 0x01));
67            data = input_port_read(machine, (offset & 0x01) ? "P2" : "P1");
6868         break;
69      case 0x01:   /* DIPSW #1 & DIPSW #2 */
69      case 0x01:
7070         if (offset & 0x02)
71            data = input_port_read_indexed(machine, 1 - (offset & 0x01));
71            data = input_port_read(machine, (offset & 0x01) ? "DSW1" : "DSW2");
7272         break;
7373   }
7474
r2864r2865
150150
151151
152152static INPUT_PORTS_START( flkatck )
153   PORT_START   /* DSW #1 */
153   PORT_START_TAG("DSW1")   /* DSW #1 */
154154   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
155155   PORT_DIPSETTING(   0x02, DEF_STR( 4C_1C ) )
156156   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
r2864r2865
186186   PORT_DIPSETTING(   0x90, DEF_STR( 1C_7C ) )
187187   //PORT_DIPSETTING(    0x00, "Invalid" )
188188
189   PORT_START   /* DSW #2 */
189   PORT_START_TAG("DSW2")   /* DSW #2 */
190190   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
191191   PORT_DIPSETTING(   0x03, "1" )
192192   PORT_DIPSETTING(   0x02, "2" )
r2864r2865
209209   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
210210   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
211211
212   PORT_START   /* DSW #3 */
212   PORT_START_TAG("DSW3")   /* DSW #3 */
213213   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
214214   PORT_DIPSETTING(   0x01, DEF_STR( Off ) )
215215   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
r2864r2865
222222   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
223223   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
224224
225   PORT_START   /* COINSW & START */
225   PORT_START_TAG("COIN")   /* COINSW & START */
226226   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
227227   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
228228   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )   /* service */
r2864r2865
232232   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
233233   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
234234
235   PORT_START   /* PLAYER 1 INPUTS */
235   PORT_START_TAG("P1")   /* PLAYER 1 INPUTS */
236236   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
237237   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
238238   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
242242   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
243243   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
244244
245   PORT_START   /* PLAYER 2 INPUTS */
245   PORT_START_TAG("P2")   /* PLAYER 2 INPUTS */
246246   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
247247   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
248248   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(2)
src/mame/drivers/dynax.c
r2864r2865
237237   int res = 0x3f;
238238
239239   /* the game reads all rows at once (keyb = 0) to check if a key is pressed */
240   if (~keyb & 0x01) res &= input_port_read_indexed(machine, 3);
241   if (~keyb & 0x02) res &= input_port_read_indexed(machine, 4);
242   if (~keyb & 0x04) res &= input_port_read_indexed(machine, 5);
243   if (~keyb & 0x08) res &= input_port_read_indexed(machine, 6);
244   if (~keyb & 0x10) res &= input_port_read_indexed(machine, 7);
240   if (~keyb & 0x01) res &= input_port_read(machine, "KEY0");
241   if (~keyb & 0x02) res &= input_port_read(machine, "KEY1");
242   if (~keyb & 0x04) res &= input_port_read(machine, "KEY2");
243   if (~keyb & 0x08) res &= input_port_read(machine, "KEY3");
244   if (~keyb & 0x10) res &= input_port_read(machine, "KEY4");
245245
246246   return res;
247247}
r2864r2865
251251   int res = 0x3f;
252252
253253   /* the game reads all rows at once (keyb = 0) to check if a key is pressed */
254   if (~keyb & 0x01) res &= input_port_read_indexed(machine, 8);
255   if (~keyb & 0x02) res &= input_port_read_indexed(machine, 9);
256   if (~keyb & 0x04) res &= input_port_read_indexed(machine, 10);
257   if (~keyb & 0x08) res &= input_port_read_indexed(machine, 11);
258   if (~keyb & 0x10) res &= input_port_read_indexed(machine, 12);
254   if (~keyb & 0x01) res &= input_port_read(machine, "KEY5");
255   if (~keyb & 0x02) res &= input_port_read(machine, "KEY6");
256   if (~keyb & 0x04) res &= input_port_read(machine, "KEY7");
257   if (~keyb & 0x08) res &= input_port_read(machine, "KEY8");
258   if (~keyb & 0x10) res &= input_port_read(machine, "KEY9");
259259
260260   return res;
261261}
r2864r2865
518518   AM_RANGE( 0x50, 0x50 ) AM_WRITE      ( dynax_rombank_w         )   // BANK ROM Select  hnkochou only
519519   AM_RANGE( 0x60, 0x60 ) AM_READ      ( hanamai_keyboard_0_r      )   // P1
520520   AM_RANGE( 0x61, 0x61 ) AM_READ      ( hanamai_keyboard_1_r      )   // P2
521   AM_RANGE( 0x62, 0x62 ) AM_READ      ( input_port_2_r         )   // Coins
521   AM_RANGE( 0x62, 0x62 ) AM_READ_PORT   ( "IN0"                  )   // Coins
522522   AM_RANGE( 0x63, 0x63 ) AM_READ      ( ret_ff               )   // ?
523523   AM_RANGE( 0x64, 0x64 ) AM_WRITE      ( hanamai_keyboard_w      )   // keyboard row select
524524   AM_RANGE( 0x65, 0x65 ) AM_WRITE      ( dynax_rombank_w         )   // BANK ROM Select  hanamai only
r2864r2865
551551static ADDRESS_MAP_START( hnoridur_io_map, ADDRESS_SPACE_IO, 8 )
552552   ADDRESS_MAP_GLOBAL_MASK(0xff)
553553   AM_RANGE( 0x01, 0x07 ) AM_WRITE   ( dynax_blitter_rev2_w      )   // Blitter
554//  AM_RANGE( 0x10, 0x10 ) AM_WRITE ( SMH_NOP                  )   // CRT Controller
555//  AM_RANGE( 0x11, 0x11 ) AM_WRITE ( SMH_NOP                  )   // CRT Controller
554//  AM_RANGE( 0x10, 0x10 ) AM_WRITE ( SMH_NOP                   )   // CRT Controller
555//  AM_RANGE( 0x11, 0x11 ) AM_WRITE ( SMH_NOP                   )   // CRT Controller
556556   AM_RANGE( 0x20, 0x20 ) AM_WRITE   ( hanamai_keyboard_w      )   // keyboard row select
557   AM_RANGE( 0x21, 0x21 ) AM_READ   ( input_port_2_r         )   // Coins
557   AM_RANGE( 0x21, 0x21 ) AM_READ_PORT   ( "IN0"               )   // Coins
558558   AM_RANGE( 0x22, 0x22 ) AM_READ   ( hanamai_keyboard_1_r      )   // P2
559559   AM_RANGE( 0x23, 0x23 ) AM_READ   ( hanamai_keyboard_0_r      )   // P1
560   AM_RANGE( 0x24, 0x24 ) AM_READ   ( input_port_1_r         )   // DSW2
561   AM_RANGE( 0x25, 0x25 ) AM_READ   ( input_port_14_r         )   // DSW4
562   AM_RANGE( 0x26, 0x26 ) AM_READ   ( input_port_13_r         )   // DSW3
560   AM_RANGE( 0x24, 0x24 ) AM_READ_PORT   ( "DSW1"            )   // DSW2
561   AM_RANGE( 0x25, 0x25 ) AM_READ_PORT   ( "DSW3"            )   // DSW4
562   AM_RANGE( 0x26, 0x26 ) AM_READ_PORT   ( "DSW2"            )   // DSW3
563563   AM_RANGE( 0x30, 0x30 ) AM_WRITE   ( adpcm_reset_w            )   // MSM5205 reset
564564   AM_RANGE( 0x32, 0x32 ) AM_WRITE   ( adpcm_data_w            )   // MSM5205 data
565565   AM_RANGE( 0x34, 0x34 ) AM_WRITE   ( YM2413_register_port_0_w   )   // YM2413
r2864r2865
610610
611611static READ8_HANDLER( yarunara_input_r )
612612{
613   static const char *keynames0[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
614   static const char *keynames1[] = { "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
615
613616   switch (offset)
614617   {
615618      case 0:
r2864r2865
617620         switch( yarunara_select )
618621         {
619622            case 0x00:
620               return input_port_read(machine, "IN2");   // coins
623               return input_port_read(machine, "IN0");   // coins
621624
622625            case 0x02:
623626               return 0xff;   // bit 7 must be 1. Bit 2?
r2864r2865
634637            // player 2
635638            case 0x01:   //quiztvqq
636639            case 0x81:
637               return input_port_read_indexed(machine, 3 + 5 + yarunara_ip++);
640               return input_port_read(machine, keynames1[yarunara_ip++]);
638641
639642            // player 1
640643            case 0x02:   //quiztvqq
641644            case 0x82:
642               return input_port_read_indexed(machine, 3 + yarunara_ip++);
645               return input_port_read(machine, keynames0[yarunara_ip++]);
643646
644647            default:
645648               return 0xff;
r2864r2865
690693   AM_RANGE( 0x49, 0x49 ) AM_WRITE   ( dynax_extra_scrolly_w      )   // screen scroll Y
691694   AM_RANGE( 0x4a, 0x4a ) AM_WRITE   ( yarunara_rombank_w      )   // BANK ROM Select
692695   AM_RANGE( 0x4b, 0x4b ) AM_WRITE   ( dynax_vblank_ack_w      )   // VBlank IRQ Ack
693   AM_RANGE( 0x4c, 0x4c ) AM_READ   ( input_port_0_r         )   // DSW 1
694   AM_RANGE( 0x4f, 0x4f ) AM_READ   ( input_port_1_r         )   // DSW 2
696   AM_RANGE( 0x4c, 0x4c ) AM_READ_PORT   ( "DSW0"            )   // DSW 1
697   AM_RANGE( 0x4f, 0x4f ) AM_READ_PORT   ( "DSW1"            )   // DSW 2
695698   AM_RANGE( 0x50, 0x50 ) AM_WRITE   ( yarunara_flipscreen_w      )
696699   AM_RANGE( 0x51, 0x51 ) AM_WRITE   ( yarunara_layer_half_w      )   // half of the interleaved layer to write to
697700   AM_RANGE( 0x52, 0x52 ) AM_WRITE   ( yarunara_layer_half2_w   )   //
r2864r2865
715718//  AM_RANGE( 0x10, 0x10 ) AM_WRITE ( SMH_NOP                  )   // CRT Controller
716719//  AM_RANGE( 0x11, 0x11 ) AM_WRITE ( SMH_NOP                  )   // CRT Controller
717720   AM_RANGE( 0x20, 0x20 ) AM_WRITE   ( hanamai_keyboard_w      )   // keyboard row select
718   AM_RANGE( 0x21, 0x21 ) AM_READ   ( input_port_2_r         )   // Coins
721   AM_RANGE( 0x21, 0x21 ) AM_READ_PORT   ( "IN0"               )   // Coins
719722   AM_RANGE( 0x22, 0x22 ) AM_READ   ( hanamai_keyboard_1_r      )   // P2
720723   AM_RANGE( 0x23, 0x23 ) AM_READ   ( hanamai_keyboard_0_r      )   // P1
721   AM_RANGE( 0x24, 0x24 ) AM_READ   ( input_port_0_r         )   // DSW2
722   AM_RANGE( 0x26, 0x26 ) AM_READ   ( input_port_1_r         )   // DSW3
724   AM_RANGE( 0x24, 0x24 ) AM_READ_PORT   ( "DSW0"            )   // DSW2
725   AM_RANGE( 0x26, 0x26 ) AM_READ_PORT   ( "DSW1"            )   // DSW3
723726   AM_RANGE( 0x30, 0x30 ) AM_WRITE   ( adpcm_reset_w            )   // MSM5205 reset
724727   AM_RANGE( 0x32, 0x32 ) AM_WRITE   ( adpcm_data_w            )   // MSM5205 data
725728   AM_RANGE( 0x34, 0x34 ) AM_WRITE   ( YM2413_register_port_0_w   )   // YM2413
r2864r2865
753756   AM_RANGE( 0x01, 0x07 ) AM_WRITE      ( dynax_blitter_rev2_w      )   // Blitter
754757   AM_RANGE( 0x10, 0x10 ) AM_READWRITE   ( YM2203_status_port_0_r, YM2203_control_port_0_w   )   // YM2203
755758   AM_RANGE( 0x11, 0x11 ) AM_READWRITE   ( YM2203_read_port_0_r,   YM2203_write_port_0_w      )   // 2 x DSW
756//  AM_RANGE( 0x12, 0x12 ) AM_WRITE     ( SMH_NOP                  )   // CRT Controller
757//  AM_RANGE( 0x13, 0x13 ) AM_WRITE     ( SMH_NOP                  )   // CRT Controller
758   AM_RANGE( 0x20, 0x20 ) AM_READ      ( input_port_0_r         )   // P1
759   AM_RANGE( 0x21, 0x21 ) AM_READ      ( input_port_1_r         )   // P2
760   AM_RANGE( 0x22, 0x22 ) AM_READ      ( input_port_2_r         )   // Coins
759//  AM_RANGE( 0x12, 0x12 ) AM_WRITE     ( SMH_NOP                   )   // CRT Controller
760//  AM_RANGE( 0x13, 0x13 ) AM_WRITE     ( SMH_NOP                   )   // CRT Controller
761   AM_RANGE( 0x20, 0x20 ) AM_READ_PORT   ( "P1"                  )   // P1
762   AM_RANGE( 0x21, 0x21 ) AM_READ_PORT   ( "P2"                  )   // P2
763   AM_RANGE( 0x22, 0x22 ) AM_READ_PORT   ( "IN0"                  )   // Coins
761764   AM_RANGE( 0x23, 0x23 ) AM_READ      ( ret_ff               )   // ?
762765   AM_RANGE( 0x30, 0x30 ) AM_WRITE      ( dynax_layer_enable_w      )   // Layers Enable
763766   AM_RANGE( 0x31, 0x31 ) AM_WRITE      ( dynax_rombank_w         )   // BANK ROM Select
r2864r2865
790793   AM_RANGE( 0x15, 0x15 ) AM_WRITE   ( dynax_coincounter_1_w      )   //
791794   AM_RANGE( 0x16, 0x17 ) AM_WRITE   ( mjdialq2_layer_enable_w   )   // Layers Enable
792795   AM_RANGE( 0x41, 0x47 ) AM_WRITE   ( dynax_blitter_rev2_w      )   // Blitter
793//  AM_RANGE( 0x50, 0x50 ) AM_WRITE ( SMH_NOP                  )   // CRT Controller
794//  AM_RANGE( 0x51, 0x51 ) AM_WRITE ( SMH_NOP                  )   // CRT Controller
796//  AM_RANGE( 0x50, 0x50 ) AM_WRITE ( SMH_NOP                   )   // CRT Controller
797//  AM_RANGE( 0x51, 0x51 ) AM_WRITE ( SMH_NOP                   )   // CRT Controller
795798   AM_RANGE( 0x60, 0x60 ) AM_WRITE   ( hanamai_keyboard_w      )   // keyboard row select
796   AM_RANGE( 0x61, 0x61 ) AM_READ   ( input_port_2_r         )   // Coins
799   AM_RANGE( 0x61, 0x61 ) AM_READ_PORT   ( "IN0"               )   // Coins
797800   AM_RANGE( 0x62, 0x62 ) AM_READ   ( hanamai_keyboard_1_r      )   // P2
798801   AM_RANGE( 0x63, 0x63 ) AM_READ   ( hanamai_keyboard_0_r      )   // P1
799   AM_RANGE( 0x64, 0x64 ) AM_READ   ( input_port_0_r         )   // DSW
800   AM_RANGE( 0x67, 0x67 ) AM_READ   ( input_port_1_r         )   // DSW
802   AM_RANGE( 0x64, 0x64 ) AM_READ_PORT   ( "DSW0"            )   // DSW
803   AM_RANGE( 0x67, 0x67 ) AM_READ_PORT   ( "DSW1"            )   // DSW
801804   AM_RANGE( 0x70, 0x70 ) AM_WRITE   ( YM2413_register_port_0_w   )   // YM2413
802805   AM_RANGE( 0x71, 0x71 ) AM_WRITE   ( YM2413_data_port_0_w      )   //
803//  AM_RANGE( 0x80, 0x80 ) AM_WRITE ( SMH_NOP                  )   // IRQ ack?
806//  AM_RANGE( 0x80, 0x80 ) AM_WRITE ( SMH_NOP                  )   // IRQ ack?
804807ADDRESS_MAP_END
805808
806809
r2864r2865
813816   AM_RANGE( 0x08, 0x08 ) AM_WRITE   ( AY8910_write_port_0_w      )   // AY8910
814817   AM_RANGE( 0x0a, 0x0a ) AM_WRITE   ( AY8910_control_port_0_w   )   //
815818   AM_RANGE( 0x10, 0x10 ) AM_WRITE   ( hanamai_keyboard_w      )   // keyboard row select
816   AM_RANGE( 0x11, 0x11 ) AM_READ   ( input_port_2_r         )   // Coins
819   AM_RANGE( 0x11, 0x11 ) AM_READ_PORT   ( "IN0"               )   // Coins
817820   AM_RANGE( 0x12, 0x12 ) AM_READ   ( hanamai_keyboard_1_r      )   // P2
818821   AM_RANGE( 0x13, 0x13 ) AM_READ   ( hanamai_keyboard_0_r      )   // P1
819   AM_RANGE( 0x14, 0x14 ) AM_READ   ( input_port_0_r         )   // DSW1
820   AM_RANGE( 0x15, 0x15 ) AM_READ   ( input_port_1_r         )   // DSW2
821   AM_RANGE( 0x16, 0x16 ) AM_READ   ( input_port_13_r         )   // DSW3
822//  AM_RANGE( 0x20, 0x21 ) AM_WRITE ( SMH_NOP                  )   // CRT Controller
822   AM_RANGE( 0x14, 0x14 ) AM_READ_PORT   ( "DSW0"            )   // DSW1
823   AM_RANGE( 0x15, 0x15 ) AM_READ_PORT   ( "DSW1"            )   // DSW2
824   AM_RANGE( 0x16, 0x16 ) AM_READ_PORT   ( "DSW2"            )   // DSW3
825//  AM_RANGE( 0x20, 0x21 ) AM_WRITE ( SMH_NOP                   )   // CRT Controller
823826   AM_RANGE( 0x31, 0x37 ) AM_WRITE   ( dynax_blitter_rev2_w      )   // Blitter
824827   AM_RANGE( 0x40, 0x40 ) AM_WRITE   ( dynax_coincounter_0_w      )   // Coin Counter
825828   AM_RANGE( 0x50, 0x50 ) AM_WRITE   ( dynax_flipscreen_w      )   // Flip Screen
r2864r2865
890893   AM_RANGE( 0x50, 0x50 ) AM_WRITE   ( jantouki_vblank_ack_w      )   // VBlank IRQ Ack
891894   AM_RANGE( 0x51, 0x51 ) AM_WRITE   ( hanamai_keyboard_w      )   // keyboard row select
892895   AM_RANGE( 0x52, 0x52 ) AM_READ   ( hanamai_keyboard_0_r      )   // P1
893   AM_RANGE( 0x54, 0x54 ) AM_READ   ( input_port_2_r         )   // Coins
894   AM_RANGE( 0x55, 0x55 ) AM_READ   ( input_port_0_r         )   // DSW1
895   AM_RANGE( 0x56, 0x56 ) AM_READ   ( input_port_1_r         )   // DSW2
896   AM_RANGE( 0x54, 0x54 ) AM_READ_PORT   ( "IN0"               )   // Coins
897   AM_RANGE( 0x55, 0x55 ) AM_READ_PORT   ( "DSW0"            )   // DSW1
898   AM_RANGE( 0x56, 0x56 ) AM_READ_PORT   ( "DSW1"            )   // DSW2
896899   AM_RANGE( 0x58, 0x58 ) AM_WRITE   ( dynax_coincounter_0_w      )   // Coin Counter
897900   AM_RANGE( 0x5b, 0x5b ) AM_WRITE   ( dynax_blit2_palbank_w      )   // Layers Palettes (High Bit)
898901   AM_RANGE( 0x5d, 0x5d ) AM_WRITE   ( dynax_blit_palbank_w      )   //
r2864r2865
957960
958961static READ8_HANDLER( mjelctrn_keyboard_1_r )
959962{
960   return (hanamai_keyboard_1_r(machine,0) & 0x3f) | (input_port_read_indexed(machine, 15) ? 0x40 : 0);
963   return (hanamai_keyboard_1_r(machine, 0) & 0x3f) | (input_port_read(machine, "FAKE") ? 0x40 : 0);
961964}
962965
963966static READ8_HANDLER( mjelctrn_dsw_r )
964967{
965968   int dsw = (keyb & 0xc0) >> 6;
966   if (dsw >= 2)   dsw = dsw - 2 + 13;   // 0-3 -> IN0,IN1,IN13,IN14
967   return input_port_read_indexed(machine, dsw);
969   static const char *dswnames[] = { "DSW2", "DSW1", "DSW3", "DSW4" };
970
971   return input_port_read(machine, dswnames[dsw]);
968972}
969973
970974static WRITE8_HANDLER( mjelctrn_blitter_ack_w )
r2864r2865
991995//  AM_RANGE( 0x66, 0x66 ) AM_WRITE ( dynax_extra_scrolly_w     )   // screen scroll Y
992996   AM_RANGE( 0x6a, 0x6a ) AM_WRITE   ( hnoridur_rombank_w      )   // BANK ROM Select
993997   AM_RANGE( 0x80, 0x80 ) AM_WRITE   ( hanamai_keyboard_w      )   // keyboard row select
994   AM_RANGE( 0x81, 0x81 ) AM_READ   ( input_port_2_r         )   // Coins
998   AM_RANGE( 0x81, 0x81 ) AM_READ_PORT   ( "IN0"               )   // Coins
995999   AM_RANGE( 0x82, 0x82 ) AM_READ   ( mjelctrn_keyboard_1_r      )   // P2
9961000   AM_RANGE( 0x83, 0x83 ) AM_READ   ( hanamai_keyboard_0_r      )   // P1
9971001   AM_RANGE( 0x84, 0x84 ) AM_READ   ( mjelctrn_dsw_r         )   // DSW x 4
r2864r2865
10301034static READ8_HANDLER( htengoku_dsw_r )
10311035{
10321036
1033   if (!(htengoku_dsw & 0x01))   return input_port_read_indexed(machine, 11);
1034   if (!(htengoku_dsw & 0x02))   return input_port_read_indexed(machine, 12);
1035   if (!(htengoku_dsw & 0x04))   return input_port_read_indexed(machine, 13);
1036   if (!(htengoku_dsw & 0x08))   return input_port_read_indexed(machine, 14);
1037   if (!(htengoku_dsw & 0x10))   return input_port_read_indexed(machine, 15);
1037   if (!(htengoku_dsw & 0x01))   return input_port_read(machine, "DSW0");
1038   if (!(htengoku_dsw & 0x02))   return input_port_read(machine, "DSW1");
1039   if (!(htengoku_dsw & 0x04))   return input_port_read(machine, "DSW2");
1040   if (!(htengoku_dsw & 0x08))   return input_port_read(machine, "DSW3");
1041   if (!(htengoku_dsw & 0x10))   return input_port_read(machine, "DSW4");
10381042   logerror("%06x: warning, unknown bits read, htengoku_dsw = %02x\n", activecpu_get_pc(), htengoku_dsw);
10391043
10401044   return 0xff;
r2864r2865
10591063
10601064      case 0xff:   break;   // CRT controller?
10611065      default:
1062         logerror("%04x: coins_w with select = %02x, data = %02x\n",activecpu_get_pc(),htengoku_select,data);
1066         logerror("%04x: coins_w with select = %02x, data = %02x\n", activecpu_get_pc(), htengoku_select,data);
10631067   }
10641068}
10651069
10661070static READ8_HANDLER( htengoku_input_r )
10671071{
1072   static const char *keynames0[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
1073   static const char *keynames1[] = { "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
1074
10681075   switch( htengoku_select )
10691076   {
1070      case 0x81:   return input_port_read_indexed(machine, 1 + 5 + htengoku_ip++);
1071      case 0x82:   return input_port_read_indexed(machine, 1 + htengoku_ip++);
1077      case 0x81:   return input_port_read(machine, keynames1[htengoku_ip++]);
1078      case 0x82:   return input_port_read(machine, keynames0[htengoku_ip++]);
10721079      case 0x0d:   return 0xff;   // unused
10731080   }
1074   logerror("%04x: input_r with select = %02x\n",activecpu_get_pc(),htengoku_select);
1081   logerror("%04x: input_r with select = %02x\n", activecpu_get_pc(), htengoku_select);
10751082   return 0xff;
10761083}
10771084
r2864r2865
10791086{
10801087   switch( htengoku_select )
10811088   {
1082      case 0x00:   return input_port_read_indexed(machine, 0);
1089      case 0x00:   return input_port_read(machine, "IN0");
10831090      case 0x01:   return 0xff;   //?
10841091      case 0x02:   return 0xbf | ((htengoku_hopper && !(video_screen_get_frame_number(machine->primary_screen)%10)) ? 0 : (1<<6));;   // bit 7 = blitter busy, bit 6 = hopper
10851092      case 0x03:   return htengoku_coins;
10861093   }
1087   logerror("%04x: coin_r with select = %02x\n",activecpu_get_pc(),htengoku_select);
1094   logerror("%04x: coin_r with select = %02x\n", activecpu_get_pc(), htengoku_select);
10881095   return 0xff;
10891096}
10901097
r2864r2865
11871194            break;
11881195         return;
11891196   }
1190   logerror("%04x: unmapped ip_sel=%02x written with %02x\n",activecpu_get_pc(),tenkai_ipsel,data);
1197   logerror("%04x: unmapped ip_sel=%02x written with %02x\n", activecpu_get_pc(), tenkai_ipsel,data);
11911198}
11921199
11931200static READ8_HANDLER( tenkai_ip_r )
11941201{
1202   static const char *keynames0[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
1203//  static const char *keynames1[] = { "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
1204
11951205   switch (offset)
11961206   {
11971207      case 0:
r2864r2865
11991209         switch( tenkai_ipsel )
12001210         {
12011211            case 0x00:
1202               return input_port_read_indexed(machine, 5);   // coins
1212               return input_port_read(machine, "IN0");   // coins
12031213
12041214            default:
1205               logerror("%04x: unmapped ip_sel=%02x read from offs %x\n",activecpu_get_pc(),tenkai_ipsel,offset);
1215               logerror("%04x: unmapped ip_sel=%02x read from offs %x\n", activecpu_get_pc(), tenkai_ipsel, offset);
12061216               return 0xff;
12071217         }
12081218      }
r2864r2865
12171227            // player 2
12181228            case 0x81:
12191229               if (tenkai_ip >= 5)
1220                  logerror("%04x: unmapped tenkai_ip=%02x read\n",activecpu_get_pc(),tenkai_ip);
1221               return 0xff;//input_port_read_indexed(machine, 6 + 5 + tenkai_ip++);
1230                  logerror("%04x: unmapped tenkai_ip=%02x read\n", activecpu_get_pc(), tenkai_ip);
1231               return 0xff;//input_port_read(machine, keynames1[tenkai_ip++]);
12221232
12231233            // player 1
12241234            case 0x82:
12251235               if (tenkai_ip >= 5)
1226                  logerror("%04x: unmapped tenkai_ip=%02x read\n",activecpu_get_pc(),tenkai_ip);
1227               return input_port_read_indexed(machine, 6 + tenkai_ip++);
1236                  logerror("%04x: unmapped tenkai_ip=%02x read\n", activecpu_get_pc(), tenkai_ip);
1237               return input_port_read(machine, keynames0[tenkai_ip++]);
12281238
12291239            default:
1230               logerror("%04x: unmapped ip_sel=%02x read from offs %x\n",activecpu_get_pc(),tenkai_ipsel,offset);
1240               logerror("%04x: unmapped ip_sel=%02x read from offs %x\n", activecpu_get_pc(), tenkai_ipsel, offset);
12311241               return 0xff;
12321242         }
12331243      }
r2864r2865
12421252}
12431253static READ8_HANDLER( tenkai_dsw_r )
12441254{
1245   if (~tenkai_dswsel & 0x01) return input_port_read_indexed(machine, 0);
1246   if (~tenkai_dswsel & 0x02) return input_port_read_indexed(machine, 1);
1247   if (~tenkai_dswsel & 0x04) return input_port_read_indexed(machine, 2);
1248   if (~tenkai_dswsel & 0x08) return input_port_read_indexed(machine, 3);
1249   if (~tenkai_dswsel & 0x10) return input_port_read_indexed(machine, 4);
1255   if (~tenkai_dswsel & 0x01) return input_port_read(machine, "DSW0");
1256   if (~tenkai_dswsel & 0x02) return input_port_read(machine, "DSW1");
1257   if (~tenkai_dswsel & 0x04) return input_port_read(machine, "DSW2");
1258   if (~tenkai_dswsel & 0x08) return input_port_read(machine, "DSW3");
1259   if (~tenkai_dswsel & 0x10) return input_port_read(machine, "DSW4");
12501260   logerror("%04x: unmapped dsw %02x read\n",activecpu_get_pc(),tenkai_dswsel);
12511261   return 0xff;
12521262}
r2864r2865
14351445***************************************************************************/
14361446
14371447static INPUT_PORTS_START( MAHJONG_KEYS )
1438   // Keyboard 1
1439   PORT_START
1448   /* Keyboard 1 */
1449   PORT_START_TAG("KEY0")
14401450   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   PORT_PLAYER(1)
14411451   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   PORT_PLAYER(1)
14421452   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   PORT_PLAYER(1)
r2864r2865
14441454   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   PORT_PLAYER(1)
14451455   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1         )
14461456
1447   PORT_START
1457   PORT_START_TAG("KEY1")
14481458   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   PORT_PLAYER(1)
14491459   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   PORT_PLAYER(1)
14501460   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   PORT_PLAYER(1)
r2864r2865
14521462   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   PORT_PLAYER(1)
14531463   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
14541464
1455   PORT_START
1465   PORT_START_TAG("KEY2")
14561466   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   PORT_PLAYER(1)
14571467   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   PORT_PLAYER(1)
14581468   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   PORT_PLAYER(1)
r2864r2865
14601470   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   PORT_PLAYER(1)
14611471   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
14621472
1463   PORT_START
1473   PORT_START_TAG("KEY3")
14641474   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   PORT_PLAYER(1)
14651475   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   PORT_PLAYER(1)
14661476   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   PORT_PLAYER(1)
r2864r2865
14681478   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )
14691479   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
14701480
1471   PORT_START
1481   PORT_START_TAG("KEY4")
14721482   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   PORT_PLAYER(1)   // "l"
14731483   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
14741484   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN   )
r2864r2865
14761486   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN   )
14771487   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN   )
14781488
1479   // Keyboard 2
1480   PORT_START
1489   /* Keyboard 2 */
1490   PORT_START_TAG("KEY5")
14811491   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   PORT_PLAYER(2)
14821492   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   PORT_PLAYER(2)
14831493   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   PORT_PLAYER(2)
r2864r2865
14851495   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   PORT_PLAYER(2)
14861496   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2         )
14871497
1488   PORT_START
1498   PORT_START_TAG("KEY6")
14891499   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   PORT_PLAYER(2)
14901500   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   PORT_PLAYER(2)
14911501   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   PORT_PLAYER(2)
r2864r2865
14931503   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   PORT_PLAYER(2)
14941504   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
14951505
1496   PORT_START
1506   PORT_START_TAG("KEY7")
14971507   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   PORT_PLAYER(2)
14981508   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   PORT_PLAYER(2)
14991509   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   PORT_PLAYER(2)
r2864r2865
15011511   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   PORT_PLAYER(2)
15021512   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
15031513
1504   PORT_START
1514   PORT_START_TAG("KEY8")
15051515   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   PORT_PLAYER(2)
15061516   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   PORT_PLAYER(2)
15071517   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   PORT_PLAYER(2)
r2864r2865
15091519   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )
15101520   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
15111521
1512   PORT_START
1522   PORT_START_TAG("KEY9")
15131523   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   PORT_PLAYER(2)   // "l"
15141524   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
15151525   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN   )
r2864r2865
15191529INPUT_PORTS_END
15201530
15211531static INPUT_PORTS_START( MAHJONG_KEYS_BET )
1522   // Keyboard 1
1523   PORT_START
1532   /* Keyboard 1 */
1533   PORT_START_TAG("KEY0")
15241534   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   PORT_PLAYER(1)
15251535   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   PORT_PLAYER(1)
15261536   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   PORT_PLAYER(1)
r2864r2865
15281538   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   PORT_PLAYER(1)
15291539   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1         )
15301540
1531   PORT_START
1541   PORT_START_TAG("KEY1")
15321542   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   PORT_PLAYER(1)
15331543   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   PORT_PLAYER(1)
15341544   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   PORT_PLAYER(1)
r2864r2865
15361546   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   PORT_PLAYER(1)
15371547   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   PORT_PLAYER(1)
15381548
1539   PORT_START
1549   PORT_START_TAG("KEY2")
15401550   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   PORT_PLAYER(1)
15411551   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   PORT_PLAYER(1)
15421552   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   PORT_PLAYER(1)
r2864r2865
15441554   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   PORT_PLAYER(1)
15451555   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
15461556
1547   PORT_START
1557   PORT_START_TAG("KEY3")
15481558   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   PORT_PLAYER(1)
15491559   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   PORT_PLAYER(1)
15501560   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   PORT_PLAYER(1)
r2864r2865
15521562   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )
15531563   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
15541564
1555   PORT_START
1565   PORT_START_TAG("KEY4")
15561566   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   PORT_PLAYER(1)   // "l"
15571567   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   PORT_PLAYER(1)   // "t"
15581568   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   PORT_PLAYER(1)   // "w"
r2864r2865
15601570   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   PORT_PLAYER(1)   // "b"
15611571   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   PORT_PLAYER(1)   // "s"
15621572
1563   // Keyboard 2
1564   PORT_START
1573   /* Keyboard 2 */
1574   PORT_START_TAG("KEY5")
15651575   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   PORT_PLAYER(2)
15661576   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   PORT_PLAYER(2)
15671577   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   PORT_PLAYER(2)
r2864r2865
15691579   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   PORT_PLAYER(2)
15701580   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2         )
15711581
1572   PORT_START
1582   PORT_START_TAG("KEY6")
15731583   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   PORT_PLAYER(2)
15741584   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   PORT_PLAYER(2)
15751585   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   PORT_PLAYER(2)
r2864r2865
15771587   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   PORT_PLAYER(2)
15781588   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   PORT_PLAYER(2)
15791589
1580   PORT_START
1590   PORT_START_TAG("KEY7")
15811591   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   PORT_PLAYER(2)
15821592   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   PORT_PLAYER(2)
15831593   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   PORT_PLAYER(2)
r2864r2865
15851595   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   PORT_PLAYER(2)
15861596   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
15871597
1588   PORT_START
1598   PORT_START_TAG("KEY8")
15891599   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   PORT_PLAYER(2)
15901600   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   PORT_PLAYER(2)
15911601   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   PORT_PLAYER(2)
r2864r2865
15931603   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )
15941604   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
15951605
1596   PORT_START
1606   PORT_START_TAG("KEY9")
15971607   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   PORT_PLAYER(2)   // "l"
15981608   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   PORT_PLAYER(2)   // "t"
15991609   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   PORT_PLAYER(2)   // "w"
r2864r2865
16031613INPUT_PORTS_END
16041614
16051615static INPUT_PORTS_START( HANAFUDA_KEYS )
1606   // Keyboard 1
1607   PORT_START
1616   /* Keyboard 1 */
1617   PORT_START_TAG("KEY0")
16081618   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)
16091619   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD)
16101620   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN            )
r2864r2865
16121622   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN            )
16131623   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1            )
16141624
1615   PORT_START
1625   PORT_START_TAG("KEY1")
16161626   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)
16171627   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)
16181628   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN            )
r2864r2865
16201630   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN            )
16211631   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN            )
16221632
1623   PORT_START
1633   PORT_START_TAG("KEY2")
16241634   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD)
16251635   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD)
16261636   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN            )
r2864r2865
16281638   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN            )
16291639   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN            )
16301640
1631   PORT_START
1641   PORT_START_TAG("KEY3")
16321642   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD)
16331643   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD)
16341644   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN            )
r2864r2865
16361646   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN            )
16371647   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN            )
16381648
1639   PORT_START
1649   PORT_START_TAG("KEY4")
16401650   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   // "l"
16411651   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
16421652   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
16441654   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
16451655   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
16461656
1647   // Keyboard 2
1648   PORT_START
1657   /* Keyboard 2 */
1658   PORT_START_TAG("KEY5")
16491659   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   PORT_PLAYER(2)
16501660   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   PORT_PLAYER(2)
16511661   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   PORT_PLAYER(2)
r2864r2865
16531663   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   PORT_PLAYER(2)
16541664   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2         )
16551665
1656   PORT_START
1666   PORT_START_TAG("KEY6")
16571667   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   PORT_PLAYER(2)
16581668   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   PORT_PLAYER(2)
16591669   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   PORT_PLAYER(2)
r2864r2865
16611671   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   PORT_PLAYER(2)
16621672   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
16631673
1664   PORT_START
1674   PORT_START_TAG("KEY7")
16651675   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   PORT_PLAYER(2)
16661676   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   PORT_PLAYER(2)
16671677   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   PORT_PLAYER(2)
r2864r2865
16691679   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   PORT_PLAYER(2)
16701680   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
16711681
1672   PORT_START
1682   PORT_START_TAG("KEY8")
16731683   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   PORT_PLAYER(2)
16741684   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   PORT_PLAYER(2)
16751685   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   PORT_PLAYER(2)
r2864r2865
16771687   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )
16781688   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
16791689
1680   PORT_START
1690   PORT_START_TAG("KEY9")
16811691   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   PORT_PLAYER(2)   // "l"
16821692   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
16831693   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN   )
r2864r2865
16871697INPUT_PORTS_END
16881698
16891699static INPUT_PORTS_START( HANAFUDA_KEYS_BET )
1690   // Keyboard 1
1691   PORT_START
1700   /* Keyboard 1 */
1701   PORT_START_TAG("KEY0")
16921702   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)
16931703   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD)
16941704   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN            )
r2864r2865
16961706   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN            )
16971707   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1            )
16981708
1699   PORT_START
1709   PORT_START_TAG("KEY1")
17001710   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)
17011711   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)
17021712   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN            )
r2864r2865
17041714   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN            )
17051715   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET         )
17061716
1707   PORT_START
1717   PORT_START_TAG("KEY2")
17081718   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD)
17091719   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD)
17101720   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN            )
r2864r2865
17121722   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN            )
17131723   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN            )
17141724
1715   PORT_START
1725   PORT_START_TAG("KEY3")
17161726   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD)
17171727   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER            ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD)
17181728   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN            )
r2864r2865
17201730   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN            )
17211731   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN            )
17221732
1723   PORT_START
1733   PORT_START_TAG("KEY4")
17241734   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   PORT_PLAYER(1)   // "l"
17251735   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   PORT_PLAYER(1)   // "t"
17261736   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   PORT_PLAYER(1)   // "w"
r2864r2865
17281738   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   PORT_PLAYER(1)   // "b"
17291739   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   PORT_PLAYER(1)   // "s"
17301740
1731   // Keyboard 2
1732   PORT_START
1741   /* Keyboard 2 */
1742   PORT_START_TAG("KEY5")
17331743   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   PORT_PLAYER(2)
17341744   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   PORT_PLAYER(2)
17351745   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   PORT_PLAYER(2)
r2864r2865
17371747   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   PORT_PLAYER(2)
17381748   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2         )
17391749
1740   PORT_START
1750   PORT_START_TAG("KEY6")
17411751   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   PORT_PLAYER(2)
17421752   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   PORT_PLAYER(2)
17431753   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   PORT_PLAYER(2)
r2864r2865
17451755   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   PORT_PLAYER(2)
17461756   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   PORT_PLAYER(2)
17471757
1748   PORT_START
1758   PORT_START_TAG("KEY7")
17491759   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   PORT_PLAYER(2)
17501760   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   PORT_PLAYER(2)
17511761   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   PORT_PLAYER(2)
r2864r2865
17531763   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   PORT_PLAYER(2)
17541764   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
17551765
1756   PORT_START
1766   PORT_START_TAG("KEY8")
17571767   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   PORT_PLAYER(2)
17581768   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   PORT_PLAYER(2)
17591769   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   PORT_PLAYER(2)
r2864r2865
17611771   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )
17621772   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )
17631773
1764   PORT_START
1774   PORT_START_TAG("KEY9")
17651775   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   PORT_PLAYER(2)   // "l"
17661776   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   PORT_PLAYER(2)   // "t"
17671777   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   PORT_PLAYER(2)   // "w"
r2864r2865
18221832   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
18231833   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
18241834
1825   PORT_START_TAG("IN2")
1835   PORT_START_TAG("IN0")
18261836   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN   )
18271837   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
18281838   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE   ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)
r2864r2865
18881898   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
18891899   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
18901900
1891   PORT_START_TAG("IN2")
1901   PORT_START_TAG("IN0")
18921902   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 )      // Pay
18931903   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
18941904   PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW )   // Test (there isn't a dip switch)
r2864r2865
19511961   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
19521962   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
19531963
1954   PORT_START_TAG("IN2")
1964   PORT_START_TAG("IN0")
19551965   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN   )
19561966   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
19571967   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE   ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)
r2864r2865
19631973
19641974   PORT_INCLUDE( HANAFUDA_KEYS )
19651975
1966   PORT_START_TAG("IN13")
1976   PORT_START_TAG("DSW2")   /* IN13 */
19671977   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
19681978   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
19691979   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
19891999   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
19902000   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
19912001
1992   PORT_START_TAG("IN14")
2002   PORT_START_TAG("DSW3")   /* IN14 */
19932003   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
19942004   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
19952005   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
20182028
20192029
20202030static INPUT_PORTS_START( sprtmtch )
2021   PORT_START_TAG("IN0")
2031   PORT_START_TAG("P1")
20222032   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
20232033   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
20242034   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
r2864r2865
20282038   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
20292039   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_START1 )
20302040
2031   PORT_START_TAG("IN1")
2041   PORT_START_TAG("P2")
20322042   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
20332043   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
20342044   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
r2864r2865
20382048   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
20392049   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_START2 )
20402050
2041   PORT_START_TAG("IN2")
2051   PORT_START_TAG("IN0")
20422052   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
20432053   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
20442054   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
21482158   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
21492159   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
21502160
2151   PORT_START_TAG("IN2")
2161   PORT_START_TAG("IN0")
21522162   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )   // "17B"
21532163   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   // "18B"
21542164   PORT_SERVICE(0x04, IP_ACTIVE_LOW )            // Test (there isn't a dip switch)
r2864r2865
22142224   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
22152225   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
22162226
2217   PORT_START_TAG("IN2")
2227   PORT_START_TAG("IN0")
22182228   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )   // "17B"
22192229   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   // "18B"
22202230   PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW)      // Test (there isn't a dip switch)
r2864r2865
22772287   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
22782288   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
22792289
2280   PORT_START_TAG("IN2")
2290   PORT_START_TAG("IN0")
22812291   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN  )   // "17B"
22822292   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN  )   // "18B"
22832293   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE  ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)
r2864r2865
23392349   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
23402350   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
23412351
2342   PORT_START_TAG("IN2")
2352   PORT_START_TAG("IN0")
23432353   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN  )   // "17B"
23442354   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN  )   // "18B"
23452355   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE  ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)
r2864r2865
24002410   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
24012411   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
24022412
2403   PORT_START_TAG("IN2")
2413   PORT_START_TAG("IN0")
24042414   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN   )
24052415   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
24062416   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE   ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   // Test, during boot
r2864r2865
24102420   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1   )
24112421   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )
24122422
2413   PORT_START_TAG("IN3")
2423   /* Keyboard 1 */
2424   PORT_START_TAG("KEY0")
24142425   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
24152426   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
24162427   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
r2864r2865
24182429   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
24192430   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START1 )
24202431
2421   PORT_START_TAG("IN4")
2432   PORT_START_TAG("KEY1")
24222433   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
2423   PORT_START_TAG("IN5")
2434   PORT_START_TAG("KEY2")
24242435   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
2425   PORT_START_TAG("IN6")
2436   PORT_START_TAG("KEY3")
24262437   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
2427   PORT_START_TAG("IN7")
2438   PORT_START_TAG("KEY4")
24282439   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
24292440
2430   // Keyboard 2
2431   PORT_START_TAG("IN8")
2441   /* Keyboard 2 */
2442   PORT_START_TAG("KEY5")
24322443   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
24332444   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
24342445   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
r2864r2865
24362447   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
24372448   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START2 )
24382449
2439   PORT_START_TAG("IN9")
2450   PORT_START_TAG("KEY6")
24402451   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
2441   PORT_START_TAG("IN10")
2452   PORT_START_TAG("KEY7")
24422453   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
2443   PORT_START_TAG("IN11")
2454   PORT_START_TAG("KEY8")
24442455   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
2445   PORT_START_TAG("IN12")
2456   PORT_START_TAG("KEY9")
24462457   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
24472458INPUT_PORTS_END
24482459
r2864r2865
24992510   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
25002511   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
25012512
2502   PORT_START_TAG("IN2")
2513   PORT_START_TAG("IN0")
25032514   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
25042515   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
25052516   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE )   // Test
r2864r2865
25632574   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
25642575   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
25652576
2566   PORT_START_TAG("IN2")
2577   PORT_START_TAG("IN0")
25672578   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
25682579   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
25692580   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE )   // Test
r2864r2865
25752586
25762587   PORT_INCLUDE( MAHJONG_KEYS )
25772588
2578   PORT_START_TAG("IN8")
2589   PORT_START_TAG("DSW2")
25792590   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
25802591   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
25812592   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
26582669   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
26592670   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
26602671
2661   PORT_START_TAG("IN2")
2672   PORT_START_TAG("IN0")
26622673   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
26632674   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
26642675   PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW )
r2864r2865
26682679   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
26692680   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
26702681
2671   PORT_START_TAG("IN3")
2682   PORT_START_TAG("KEY0")
26722683   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
26732684   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
26742685   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
r2864r2865
26762687   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
26772688   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN)
26782689
2679   PORT_START_TAG("IN4")
2690   PORT_START_TAG("KEY1")
26802691   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
26812692   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
26822693   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
r2864r2865
26842695   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
26852696   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
26862697
2687   PORT_START_TAG("IN5")
2698   PORT_START_TAG("KEY2")
26882699   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
26892700   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
26902701   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
r2864r2865
26922703   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
26932704   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
26942705
2695   PORT_START_TAG("IN6")
2706   PORT_START_TAG("KEY3")
26962707   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
26972708   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
26982709   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
r2864r2865
27002711   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
27012712    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
27022713
2703   PORT_START_TAG("IN7")
2714   PORT_START_TAG("KEY4")
27042715   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
27052716   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
27062717   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
27112722
27122723
27132724static INPUT_PORTS_START( mjelct3 )
2714   PORT_START_TAG("DSW2")   // 7c21 (select = 00)
2725   PORT_START_TAG("DSW2")   /* 7c21 (select = 00) */
27152726   PORT_DIPNAME( 0x03, 0x03, "Difficulty?" )
27162727   PORT_DIPSETTING(    0x03, "0" )   // 20
27172728   PORT_DIPSETTING(    0x00, "1" )   // 32
r2864r2865
27342745   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
27352746   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
27362747
2737   PORT_START_TAG("DSW1")   // 7c20 (select = 40)
2748   PORT_START_TAG("DSW1")   /* 7c20 (select = 40) */
27382749   PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate" )
27392750   PORT_DIPSETTING(    0x00, "50" )
27402751   PORT_DIPSETTING(    0x01, "53" )
r2864r2865
27642775   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
27652776   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
27662777
2767   PORT_START_TAG("IN2")
2778   PORT_START_TAG("IN0")
27682779   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE4 )   // Pay
27692780   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN  )   // 18B
27702781   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )            // Test
r2864r2865
27762787
27772788   PORT_INCLUDE( MAHJONG_KEYS_BET )
27782789
2779   PORT_START_TAG("DSW3")   // 7c22 (select = 80)
2790   PORT_START_TAG("DSW3")   /* 7c22 (select = 80) */
27802791   PORT_DIPNAME( 0x07, 0x07, "YAKUMAN Bonus" )
27812792   PORT_DIPSETTING(    0x07, "Cut" )
27822793   PORT_DIPSETTING(    0x06, "1 T" )
r2864r2865
28022813   PORT_DIPSETTING(    0x80, "None (Part 2)" )
28032814   PORT_DIPSETTING(    0x00, "Super Express (Part 3)" )
28042815
2805   PORT_START_TAG("DSW4")   // 7c23 (select = c0)
2816   PORT_START_TAG("DSW4")   /* 7c23 (select = c0) */
28062817   PORT_DIPNAME( 0x01, 0x01, "Last Chance" )
28072818   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
28082819   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2864r2865
28282839   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
28292840   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
28302841
2831   PORT_START_TAG("FAKE")   // IN10 - Fake DSW
2842   PORT_START_TAG("FAKE")   /* IN10 - Fake DSW */
28322843   PORT_DIPNAME( 0xff, 0xff, "Allow Bets" )
28332844   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
28342845   PORT_DIPSETTING(    0xff, DEF_STR( On ) )
r2864r2865
28362847
28372848
28382849static INPUT_PORTS_START( mjelctrn )
2839   PORT_START_TAG("DSW2")   // 7c21 (select = 00)
2850   PORT_START_TAG("DSW2")   /* 7c21 (select = 00) */
28402851   PORT_DIPNAME( 0x03, 0x03, "Difficulty?" )
28412852   PORT_DIPSETTING(    0x03, "0" )   // 20
28422853   PORT_DIPSETTING(    0x00, "1" )   // 32
r2864r2865
28592870   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
28602871   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
28612872
2862   PORT_START_TAG("DSW1") // 7c20 (select = 40)
2873   PORT_START_TAG("DSW1") /* 7c20 (select = 40) */
28632874   PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate" )
28642875   PORT_DIPSETTING(    0x00, "50" )
28652876   PORT_DIPSETTING(    0x01, "53" )
r2864r2865
28892900   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
28902901   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
28912902
2892   PORT_START_TAG("IN2")
2903   PORT_START_TAG("IN0")
28932904   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE4 )   // Pay
28942905   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN  )   // 18B
28952906   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )            // Test
r2864r2865
29012912
29022913   PORT_INCLUDE( MAHJONG_KEYS_BET )
29032914
2904   PORT_START_TAG("DSW3") // 7c22 (select = 80)
2915   PORT_START_TAG("DSW3") /* 7c22 (select = 80) */
29052916   PORT_DIPNAME( 0x07, 0x07, "YAKUMAN Bonus" )
29062917   PORT_DIPSETTING(    0x07, "Cut" )
29072918   PORT_DIPSETTING(    0x06, "1 T" )
r2864r2865
29532964   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
29542965   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
29552966
2956   PORT_START_TAG("FAKE")   // IN10 - Fake DSW
2967   PORT_START_TAG("FAKE")   /* IN10 - Fake DSW */
29572968   PORT_DIPNAME( 0xff, 0xff, "Allow Bets" )
29582969   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
29592970   PORT_DIPSETTING(    0xff, DEF_STR( On ) )
r2864r2865
29612972
29622973
29632974static INPUT_PORTS_START( majxtal7 )
2964   PORT_START_TAG("DSW2")   // select = 00
2975   PORT_START_TAG("DSW2")   /* select = 00 */
29652976   PORT_DIPNAME( 0x03, 0x03, "Difficulty?" )
29662977   PORT_DIPSETTING(    0x03, "0" )   // 20
29672978   PORT_DIPSETTING(    0x00, "1" )   // 32
r2864r2865
29842995   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
29852996   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
29862997
2987   PORT_START_TAG("DSW1") // select = 40
2998   PORT_START_TAG("DSW1") /* select = 40  */
29882999   PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate" )
29893000   PORT_DIPSETTING(    0x00, "50" )
29903001   PORT_DIPSETTING(    0x01, "53" )
r2864r2865
30143025   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
30153026   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
30163027
3017   PORT_START_TAG("IN2")
3028   PORT_START_TAG("IN0")
30183029   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE4 )   // Pay
30193030   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN  )   // 18B
30203031   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )            // Test
r2864r2865
30263037
30273038   PORT_INCLUDE( MAHJONG_KEYS_BET )
30283039
3029   PORT_START_TAG("DSW3") // select = 80
3040   PORT_START_TAG("DSW3") /* select = 80 */
30303041   PORT_DIPNAME( 0x07, 0x07, "YAKUMAN Bonus" )
30313042   PORT_DIPSETTING(    0x07, "Cut" )
30323043   PORT_DIPSETTING(    0x06, "1 T" )
r2864r2865
30523063   PORT_DIPSETTING(    0x80, "X-Tal" )
30533064   PORT_DIPSETTING(    0x00, "Diamond" )
30543065
3055   PORT_START_TAG("DSW4") // select = c0
3066   PORT_START_TAG("DSW4") /* select = c0 */
30563067   PORT_DIPNAME( 0x01, 0x01, "Last Chance" )
30573068   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
30583069   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2864r2865
30783089   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
30793090   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
30803091
3081   PORT_START_TAG("FAKE")   // IN10 - Fake DSW
3092   PORT_START_TAG("FAKE")   /* IN10 - Fake DSW */
30823093   PORT_DIPNAME( 0xff, 0xff, DEF_STR( Unknown ) )
30833094   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
30843095   PORT_DIPSETTING(    0xff, DEF_STR( On ) )
30853096INPUT_PORTS_END
30863097
30873098static INPUT_PORTS_START( neruton )
3088   PORT_START_TAG("DSW2") //6a77 (select = 00)
3099   PORT_START_TAG("DSW2") /* 6a77 (select = 00) */
30893100   PORT_DIPNAME( 0x07, 0x07, "Time Setting" )
30903101   PORT_DIPSETTING(    0x07, "08:30" )
30913102   PORT_DIPSETTING(    0x06, "09:00" )
r2864r2865
31093120   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
31103121   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
31113122
3112   PORT_START_TAG("DSW1")   // 6a76 (select = 40)
3123   PORT_START_TAG("DSW1")   /* 6a76 (select = 40) */
31133124   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
31143125   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
31153126   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
r2864r2865
31343145   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
31353146   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
31363147
3137   PORT_START_TAG("IN2")
3148   PORT_START_TAG("IN0")
31383149   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // 17B
31393150   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // 18B
31403151   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE   ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   // Test
r2864r2865
31453156   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // 18A
31463157
31473158   PORT_INCLUDE( MAHJONG_KEYS )
3159
3160   /* 2008-06 FP: the following are needed to make happy the read handlers shared with mjelctrn*/
3161   PORT_START_TAG("DSW3")
3162   PORT_START_TAG("DSW4")
3163   PORT_START_TAG("FAKE")
31483164INPUT_PORTS_END
31493165
31503166
31513167static INPUT_PORTS_START( tenkai )
3152   PORT_START   // 0
3168   PORT_START_TAG("DSW0")
31533169   PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate" )
31543170   PORT_DIPSETTING(    0x00, "50" )
31553171   PORT_DIPSETTING(    0x01, "53" )
r2864r2865
31783194   PORT_DIPSETTING(    0x40, "10" )
31793195   PORT_DIPSETTING(    0x00, "20" )
31803196
3181   PORT_START   // 1
3197   PORT_START_TAG("DSW1")
31823198   PORT_DIPNAME( 0x03, 0x03, "Unknown 1-0&1" )
31833199   PORT_DIPSETTING(    0x03, "1:1" )
31843200   PORT_DIPSETTING(    0x02, "1:2" )
r2864r2865
32023218   PORT_DIPSETTING(    0x00, "1" )
32033219   PORT_DIPSETTING(    0x80, "2" )
32043220
3205   PORT_START   // 2
3221   PORT_START_TAG("DSW2")
32063222   PORT_DIPNAME( 0x01, 0x01, "Unknown 2-0" )
32073223   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
32083224   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
32283244   PORT_DIPSETTING(    0x80, "Start" )
32293245   PORT_DIPSETTING(    0x00, "Flip Flop" )
32303246
3231   PORT_START   // 3
3247   PORT_START_TAG("DSW3")
32323248   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
32333249   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
32343250   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
32543270   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
32553271   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
32563272
3257   PORT_START   // 4 (top)
3273   PORT_START_TAG("DSW4")   /* (top) */
32583274   PORT_DIPNAME( 0x01, 0x01, "Credits Per Note" )
32593275   PORT_DIPSETTING(    0x01, "5" )
32603276   PORT_DIPSETTING(    0x00, "10" )
r2864r2865
32803296   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
32813297   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
32823298
3283   PORT_START   // 5
3299   PORT_START_TAG("IN0")
32843300   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE4 )   // Pay
32853301   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN  )   // 18B
32863302   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )            // Test
r2864r2865
32953311
32963312
32973313static INPUT_PORTS_START( mjreach )
3298   PORT_START   // 0
3314   PORT_START_TAG("DSW0")
32993315   PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate" )
33003316   PORT_DIPSETTING(    0x00, "50" )
33013317   PORT_DIPSETTING(    0x01, "53" )
r2864r2865
33243340   PORT_DIPSETTING(    0x40, "10" )
33253341   PORT_DIPSETTING(    0x00, "20" )
33263342
3327   PORT_START   // 1
3343   PORT_START_TAG("DSW1")
33283344   PORT_DIPNAME( 0x03, 0x03, "Unknown 1-0&1" )
33293345   PORT_DIPSETTING(    0x03, "1:1" )
33303346   PORT_DIPSETTING(    0x02, "1:2" )
r2864r2865
33483364   PORT_DIPSETTING(    0x00, "1" )
33493365   PORT_DIPSETTING(    0x80, "2" )
33503366
3351   PORT_START   // 2
3367   PORT_START_TAG("DSW2")
33523368   PORT_DIPNAME( 0x01, 0x01, "Unknown 2-0" )
33533369   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
33543370   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
33743390   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
33753391   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
33763392
3377   PORT_START   // 3
3393   PORT_START_TAG("DSW3")
33783394   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
33793395   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
33803396   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
34003416   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
34013417   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
34023418
3403   PORT_START   // 4 (top)
3419   PORT_START_TAG("DSW4")   /* 4 (top) */
34043420   PORT_DIPNAME( 0x01, 0x01, "Credits Per Note" )
34053421   PORT_DIPSETTING(    0x01, "5" )
34063422   PORT_DIPSETTING(    0x00, "10" )
r2864r2865
34253441   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
34263442   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
34273443
3428   PORT_START   // 5
3444   PORT_START_TAG("IN0")
34293445   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE4 )   // Pay
34303446   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN  )   // 18B
34313447   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )            // Test
r2864r2865
34393455INPUT_PORTS_END
34403456
34413457static INPUT_PORTS_START( htengoku )
3442   PORT_START   // IN0
3458   PORT_START_TAG("IN0")
34433459   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE4   )   // medal out
34443460   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
34453461   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE  ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)
r2864r2865
34513467
34523468   PORT_INCLUDE( HANAFUDA_KEYS_BET )
34533469
3454   PORT_START   // IN11 - DSW1
3470   PORT_START_TAG("DSW0")   /* IN11 - DSW1 */
34553471   PORT_DIPNAME( 0x01, 0x01, "Show Girls" )
34563472   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
34573473   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
r2864r2865
34773493   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
34783494   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
34793495
3480   PORT_START   // IN12 - DSW2
3496   PORT_START_TAG("DSW1")   /* IN12 - DSW2 */
34813497   PORT_DIPNAME( 0x07, 0x05, "Payout Rate" )
34823498   PORT_DIPSETTING(    0x00, "Lowest" )
34833499   PORT_DIPSETTING(    0x01, "Lower" )
r2864r2865
35023518   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
35033519   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
35043520
3505   PORT_START   // IN13 - DSW3
3521   PORT_START_TAG("DSW2")   /* IN13 - DSW3 */
35063522   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
35073523   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
35083524   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
r2864r2865
35253541   PORT_DIPSETTING(    0x40, "3000" )
35263542   PORT_DIPSETTING(    0x00, "5000" )
35273543
3528   PORT_START   // IN14 - DSW4
3544   PORT_START_TAG("DSW3")   /* IN14 - DSW4 */
35293545   PORT_DIPNAME( 0x03, 0x03, "Odds For Goko" )
35303546   PORT_DIPSETTING(    0x03, "100" )
35313547   PORT_DIPSETTING(    0x02, "200" )
r2864r2865
35483564   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
35493565   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
35503566
3551   PORT_START   // IN15 - DSWs top bits
3567   PORT_START_TAG("DSW4")   /* IN15 - DSWs top bits */
35523568   PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
35533569   PORT_DIPNAME( 0x02, 0x02, "Set Clock" )
35543570   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
src/mame/drivers/megadriv.c
r2864r2865
370370   megadrive_vdp_address &=0xffff;
371371}
372372
373static void write_cram_value(int offset, int data)
373static void write_cram_value(running_machine *machine, int offset, int data)
374374{
375375   megadrive_vdp_cram[offset] = data;
376376
r2864r2865
381381        r = ((data >> 1)&0x07);
382382      g = ((data >> 5)&0x07);
383383      b = ((data >> 9)&0x07);
384      palette_set_color_rgb(Machine,offset,pal3bit(r),pal3bit(g),pal3bit(b));
384      palette_set_color_rgb(machine,offset,pal3bit(r),pal3bit(g),pal3bit(b));
385385      megadrive_vdp_palette_lookup[offset] = (b<<2) | (g<<7) | (r<<12);
386386      megadrive_vdp_palette_lookup_shadow[offset] = (b<<1) | (g<<6) | (r<<11);
387387      megadrive_vdp_palette_lookup_highlight[offset] = ((b|0x08)<<1) | ((g|0x08)<<6) | ((r|0x08)<<11);
r2864r2865
389389   }
390390}
391391
392static void vdp_cram_write(UINT16 data)
392static void vdp_cram_write(running_machine *machine, UINT16 data)
393393{
394394   int offset;
395395   offset = (megadrive_vdp_address&0x7e)>>1;
396396
397   write_cram_value(offset,data);
397   write_cram_value(machine, offset,data);
398398
399399   megadrive_vdp_address+=MEGADRIVE_REG0F_AUTO_INC;
400400
r2864r2865
402402}
403403
404404
405static void megadriv_vdp_data_port_w(int data)
405static void megadriv_vdp_data_port_w(running_machine *machine, int data)
406406{
407407   megadrive_vdp_command_pending = 0;
408408
r2864r2865
471471            break;
472472
473473         case 0x0003:
474            vdp_cram_write(data);
474            vdp_cram_write(machine, data);
475475            break;
476476
477477         case 0x0004:
r2864r2865
498498
499499
500500
501static void megadrive_vdp_set_register(int regnum, UINT8 value)
501static void megadrive_vdp_set_register(running_machine *machine, int regnum, UINT8 value)
502502{
503503   megadrive_vdp_register[regnum] = value;
504504
r2864r2865
513513      if (megadrive_irq4_pending)
514514      {
515515         if (MEGADRIVE_REG0_IRQ4_ENABLE)
516            cpunum_set_input_line(Machine, 0,4,HOLD_LINE);
516            cpunum_set_input_line(machine, 0,4,HOLD_LINE);
517517         else
518            cpunum_set_input_line(Machine, 0,4,CLEAR_LINE);
518            cpunum_set_input_line(machine, 0,4,CLEAR_LINE);
519519      }
520520
521521      /* ??? Fatal Rewind needs this but I'm not sure it's accurate behavior
r2864r2865
530530      if (megadrive_irq6_pending)
531531      {
532532         if (MEGADRIVE_REG01_IRQ6_ENABLE)
533            cpunum_set_input_line(Machine, 0,6,HOLD_LINE);
533            cpunum_set_input_line(machine, 0,6,HOLD_LINE);
534534         else
535            cpunum_set_input_line(Machine, 0,6,CLEAR_LINE);
535            cpunum_set_input_line(machine, 0,6,CLEAR_LINE);
536536      }
537537
538538      /* ??? */
r2864r2865
660660}
661661
662662
663static void megadrive_do_insta_68k_to_cram_dma(UINT32 source,UINT16 length)
663static void megadrive_do_insta_68k_to_cram_dma(running_machine *machine,UINT32 source,UINT16 length)
664664{
665665   int count;
666666
r2864r2865
670670   {
671671      //if (megadrive_vdp_address>=0x80) return; // abandon
672672
673      write_cram_value((megadrive_vdp_address&0x7e)>>1, vdp_get_word_from_68k_mem(source));
673      write_cram_value(machine, (megadrive_vdp_address&0x7e)>>1, vdp_get_word_from_68k_mem(source));
674674      source+=2;
675675
676676      if (source>0xffffff) source = 0xfe0000;
r2864r2865
716716}
717717
718718/* This can be simplified quite a lot.. */
719static void handle_dma_bits(void)
719static void handle_dma_bits(running_machine *machine)
720720{
721721
722722   if (megadrive_vdp_code&0x20)
r2864r2865
778778
779779         /* The 68k is frozen during this transfer, it should be safe to throw a few cycles away and do 'instant' DMA because the 68k can't detect it being in progress (can the z80?) */
780780         //mame_printf_debug("68k->CRAM DMA transfer source %06x length %04x dest %04x enabled %01x\n", source, length, megadrive_vdp_address,MEGADRIVE_REG01_DMA_ENABLE);
781         if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_cram_dma(source,length);
781         if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_cram_dma(machine,source,length);
782782      }
783783      else if (MEGADRIVE_REG17_DMATYPE==0x2)
784784      {
r2864r2865
848848   }
849849}
850850
851static void megadriv_vdp_ctrl_port_w(int data)
851static void megadriv_vdp_ctrl_port_w(running_machine *machine, int data)
852852{
853853//  logerror("write to vdp control port %04x\n",data);
854854   megadrive_vram_fill_pending = 0; // ??
r2864r2865
860860      megadrive_vdp_command_part2 = data;
861861
862862      update_megadrive_vdp_code_and_address();
863      handle_dma_bits();
863      handle_dma_bits(machine);
864864
865865      //logerror("VDP Write Part 2 setting Code %02x Address %04x\n",megadrive_vdp_code, megadrive_vdp_address);
866866
r2864r2865
874874
875875         if (regnum &0x20) mame_printf_debug("reg error\n");
876876
877         megadrive_vdp_set_register(regnum&0x1f,value);
877         megadrive_vdp_set_register(machine, regnum&0x1f,value);
878878         megadrive_vdp_code = 0;
879879         megadrive_vdp_address = 0;
880880      }
r2864r2865
905905            data = (data&0xff00) | data>>8;
906906         //  mame_printf_debug("8-bit write VDP data port access, offset %04x data %04x mem_mask %04x\n",offset,data,mem_mask);
907907         }
908         megadriv_vdp_data_port_w(data);
908         megadriv_vdp_data_port_w(machine, data);
909909         break;
910910
911911      case 0x04:
912912      case 0x06:
913913         if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit write VDP control port access, offset %04x data %04x mem_mask %04x\n",offset,data,mem_mask);
914         megadriv_vdp_ctrl_port_w(data);
914         megadriv_vdp_ctrl_port_w(machine, data);
915915         break;
916916
917917      case 0x08:
r2864r2865
950950   return megadrive_vdp_cram[(megadrive_vdp_address&0x7e)>>1];
951951}
952952
953static UINT16 megadriv_vdp_data_port_r(void)
953static UINT16 megadriv_vdp_data_port_r(running_machine *machine)
954954{
955955   UINT16 retdata=0;
956956
957   //return mame_rand(Machine);
957   //return mame_rand(machine);
958958
959959   megadrive_vdp_command_pending = 0;
960960
r2864r2865
968968
969969      case 0x0001:
970970         logerror("Attempting to READ from DATA PORT in VRAM WRITE MODE\n");
971         retdata = mame_rand(Machine);
971         retdata = mame_rand(machine);
972972         break;
973973
974974      case 0x0003:
975975         logerror("Attempting to READ from DATA PORT in CRAM WRITE MODE\n");
976         retdata = mame_rand(Machine);
976         retdata = mame_rand(machine);
977977         break;
978978
979979      case 0x0004:
r2864r2865
994994
995995      default:
996996         logerror("Attempting to READ from DATA PORT in #UNDEFINED# MODE\n");
997         retdata = mame_rand(Machine);
997         retdata = mame_rand(machine);
998998         break;
999999   }
10001000
r2864r2865
12941294      case 0x00:
12951295      case 0x02:
12961296         if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit VDP read data port access, offset %04x mem_mask %04x\n",offset,mem_mask);
1297         retvalue = megadriv_vdp_data_port_r();
1297         retvalue = megadriv_vdp_data_port_r(machine);
12981298         break;
12991299
13001300      case 0x04:
r2864r2865
14381438/* pointers to our io data read/write functions */
14391439static UINT8 (*megadrive_io_read_data_port_ptr)(int offset);
14401440static void (*megadrive_io_write_data_port_ptr)(int offset, UINT16 data);
1441
14411442INPUT_PORTS_START( megadri6 )
1442   PORT_START /* Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */
1443   PORT_START_TAG("PAD1")      /* Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */
14431444   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
14441445   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
14451446   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
14541455   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_PLAYER(1) PORT_NAME("P1 MODE") // mode
14551456
14561457
1457   PORT_START /* Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */
1458   PORT_START_TAG("PAD2")      /* Joypad 2 (6 button + start + mode) NOT READ DIRECTLY */
14581459   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
14591460   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
14601461   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
14681469   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("P2 Z") // z
14691470   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_PLAYER(2) PORT_NAME("P2 MODE") // mode
14701471
1471   PORT_START /* 3rd I/O port */
1472   PORT_START_TAG("IN0")      /* 3rd I/O port */
14721473
1473   PORT_START_TAG("RESET") /* Buttons on Genesis Console */
1474   PORT_START_TAG("RESET")      /* Buttons on Genesis Console */
14741475   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?)
14751476
1476   PORT_START_TAG("REGION") /* Buttons on Genesis Console */
1477   PORT_START_TAG("REGION")   /* Buttons on Genesis Console */
14771478   /* Region setting for Console */
14781479   PORT_DIPNAME( 0x000f, 0x0000, DEF_STR( Region ) )
14791480   PORT_DIPSETTING(      0x0000, "Use HazeMD Default Choice" )
r2864r2865
14861487
14871488
14881489INPUT_PORTS_START( ssf2ghw )
1489   PORT_START /* Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */
1490   PORT_START_TAG("PAD1")      /* Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */
14901491   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
14911492   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
14921493   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
15011502   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED )
15021503
15031504
1504   PORT_START /* Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */
1505   PORT_START_TAG("PAD2")      /* Joypad 1 (6 button + start + mode) NOT READ DIRECTLY */
15051506   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
15061507   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
15071508   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
15151516   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
15161517   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED )
15171518
1518   PORT_START /* 3rd I/O port */
1519   PORT_START_TAG("IN0")      /* 3rd I/O port */
15191520   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
15201521   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
15211522
1522//  PORT_START_TAG("RESET") /* Buttons on Genesis Console */
1523//  PORT_START_TAG("RESET")     /* Buttons on Genesis Console */
15231524//  PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?)
15241525
1525//  PORT_START_TAG("REGION") /* Buttons on Genesis Console */
1526//  PORT_START_TAG("REGION")    /* Buttons on Genesis Console */
15261527//  /* Region setting for Console */
15271528//  PORT_DIPNAME( 0x000f, 0x0000, DEF_STR( Region ) )
15281529//  PORT_DIPSETTING(      0x0000, "Use HazeMD Default Choice" )
r2864r2865
16161617*/
16171618
16181619INPUT_PORTS_START( megadriv )
1619   PORT_START /* Joypad 1 (3 button + start) NOT READ DIRECTLY */
1620   PORT_START_TAG("PAD1")      /* Joypad 1 (3 button + start) NOT READ DIRECTLY */
16201621   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
16211622   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
16221623   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
16261627   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 C") // c
16271628   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 START") // start
16281629
1629   PORT_START /* Joypad 2 (3 button + start) NOT READ DIRECTLY */
1630   PORT_START_TAG("PAD2")      /* Joypad 2 (3 button + start) NOT READ DIRECTLY */
16301631   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
16311632   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
16321633   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
16361637   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 C") // c
16371638   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 START") // start
16381639
1639   PORT_START /* 3rd I/O port */
1640   PORT_START_TAG("IN0")      /* 3rd I/O port */
16401641
1641   PORT_START_TAG("RESET") /* Buttons on Genesis Console */
1642   PORT_START_TAG("RESET")      /* Buttons on Genesis Console */
16421643   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?)
16431644
1644   PORT_START_TAG("REGION") /* Region setting for Console */
1645   PORT_START_TAG("REGION")   /* Region setting for Console */
16451646   /* Region setting for Console */
16461647   PORT_DIPNAME( 0x000f, 0x0000, DEF_STR( Region ) )
16471648   PORT_DIPSETTING(      0x0000, "Use HazeMD Default Choice" )
r2864r2865
16521653
16531654
16541655INPUT_PORTS_START( aladbl )
1655   PORT_START /* Joypad 1 (3 button + start) NOT READ DIRECTLY */
1656   PORT_START_TAG("PAD1")      /* Joypad 1 (3 button + start) NOT READ DIRECTLY */
16561657   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
16571658   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
16581659   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
16621663   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Jump") // c
16631664   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) // start
16641665
1665   PORT_START /* Joypad 2 (3 button + start) NOT READ DIRECTLY - not used */
1666   PORT_START_TAG("PAD2")      /* Joypad 2 (3 button + start) NOT READ DIRECTLY - not used */
16661667//  PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
16671668//  PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
16681669//  PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
16721673//  PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Jump") // c
16731674//  PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 ) // start
16741675
1675   PORT_START /* 3rd I/O port */
1676   PORT_START_TAG("IN0")      /* 3rd I/O port */
16761677
1677//  PORT_START_TAG("RESET") /* Buttons on Genesis Console */
1678//  PORT_START_TAG("RESET")     /* Buttons on Genesis Console */
16781679//  PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("Reset Button") PORT_IMPULSE(1) // reset, resets 68k (and..?)
16791680
1680//  PORT_START_TAG("REGION") /* Region setting for Console */
1681//  PORT_START_TAG("REGION")    /* Region setting for Console */
16811682//  /* Region setting for Console */
16821683//  PORT_DIPNAME( 0x000f, 0x0000, DEF_STR( Region ) )
16831684//  PORT_DIPSETTING(      0x0000, "Use HazeMD Default Choice" )
r2864r2865
17071708   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)     /* needed to avoid credits getting mad */
17081709INPUT_PORTS_END
17091710
1711#define MODE_BUTTON(player)   ( (input_port_read_indexed(Machine, player) & 0x800) >> 11 )
1712#define Z_BUTTON(player)   ( (input_port_read_indexed(Machine, player) & 0x400) >> 10 )
1713#define Y_BUTTON(player)   ( (input_port_read_indexed(Machine, player) & 0x200) >> 9 )
1714#define X_BUTTON(player)   ( (input_port_read_indexed(Machine, player) & 0x100) >> 8 )
17101715
1711#define MODE_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x800) >> 11 )
1712#define Z_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x400) >> 10 )
1713#define Y_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x200) >> 9 )
1714#define X_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x100) >> 8 )
1715
1716
17171716#define START_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x80) >> 7 )
1718#define C_BUTTON(player)     ( (input_port_read_indexed(Machine, player) & 0x40) >> 6 )
1719#define B_BUTTON(player)     ( (input_port_read_indexed(Machine, player) & 0x20) >> 5 )
1720#define A_BUTTON(player)     ( (input_port_read_indexed(Machine, player) & 0x10) >> 4 )
1717#define C_BUTTON(player)    ( (input_port_read_indexed(Machine, player) & 0x40) >> 6 )
1718#define B_BUTTON(player)    ( (input_port_read_indexed(Machine, player) & 0x20) >> 5 )
1719#define A_BUTTON(player)    ( (input_port_read_indexed(Machine, player) & 0x10) >> 4 )
17211720#define RIGHT_BUTTON(player) ( (input_port_read_indexed(Machine, player) & 0x08) >> 3 )
1722#define LEFT_BUTTON(player)  ( (input_port_read_indexed(Machine, player) & 0x04) >> 2 )
1723#define DOWN_BUTTON(player)  ( (input_port_read_indexed(Machine, player) & 0x02) >> 1 )
1724#define UP_BUTTON(player)    ( (input_port_read_indexed(Machine, player) & 0x01) >> 0 )
1725#define MD_RESET_BUTTON      ( (input_port_read_safe(Machine, "RESET",0x00)      & 0x01) >> 0 )
1721#define LEFT_BUTTON(player)    ( (input_port_read_indexed(Machine, player) & 0x04) >> 2 )
1722#define DOWN_BUTTON(player)    ( (input_port_read_indexed(Machine, player) & 0x02) >> 1 )
1723#define UP_BUTTON(player)    ( (input_port_read_indexed(Machine, player) & 0x01) >> 0 )
1724#define MD_RESET_BUTTON       ( (input_port_read_safe(Machine, "RESET", 0x00) & 0x01) >> 0 )
17261725
17271726static UINT8 megadrive_io_data_regs[3];
17281727static UINT8 megadrive_io_ctrl_regs[3];
r2864r2865
47554754   /* default state of z80 = reset, with bus */
47564755   mame_printf_debug("Resetting Megadrive / Genesis\n");
47574756
4758   switch (input_port_read_safe(machine, "REGION",0x00))
4757   switch (input_port_read_safe(machine, "REGION", 0x00))
47594758   {
47604759
47614760      case 1: // US
src/mame/drivers/galpani3.c
r2864r2865
110110
111111static INPUT_PORTS_START( galpani3 )
112112
113   PORT_START   // IN0 - Player Controls
113   PORT_START_TAG("P1")   /* IN0 - Player Controls */
114114   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_8WAY PORT_PLAYER(1)
115115   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_8WAY PORT_PLAYER(1)
116116   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
120120   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ?
121121   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
122122
123   PORT_START   // IN1 - Player Controls
123   PORT_START_TAG("P2")   /* IN1 - Player Controls */
124124   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_8WAY PORT_PLAYER(2)
125125   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_8WAY PORT_PLAYER(2)
126126   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
130130   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ?
131131   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
132132
133   PORT_START   // IN2 - Coins
133   PORT_START_TAG("COIN")   /* IN2 - Coins */
134134   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
135135   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
136136   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1  ) PORT_IMPULSE(2)
r2864r2865
140140   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1 )
141141   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED   )
142142
143   PORT_START   // IN3 - DSW provided by the MCU - $200386.b <- $400200
143   PORT_START_TAG("DSW")   /* IN3 - DSW provided by the MCU - $200386.b <- $400200 */
144144   PORT_DIPNAME( 0x0100, 0x0100, "Test Mode" )
145145   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
146146   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
215215   {
216216      case 0x03:   // DSW
217217      {
218         mcu_ram[mcu_offset] = input_port_read_indexed(machine, 3);
219         logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n",activecpu_get_pc(),mcu_command,mcu_offset*2);
218         mcu_ram[mcu_offset] = input_port_read(machine, "DSW");
219         logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n", activecpu_get_pc(), mcu_command, mcu_offset*2);
220220      }
221221      break;
222222
src/mame/drivers/itech32.c
r2864r2865
286286}
287287
288288
289void itech32_update_interrupts(int vint, int xint, int qint)
289void itech32_update_interrupts(running_machine *machine, int vint, int xint, int qint)
290290{
291291   int level = determine_irq_state(vint, xint, qint);
292292
293293   /* update it */
294294   if (level)
295      cpunum_set_input_line(Machine, 0, level, ASSERT_LINE);
295      cpunum_set_input_line(machine, 0, level, ASSERT_LINE);
296296   else
297      cpunum_set_input_line(Machine, 0, 7, CLEAR_LINE);
297      cpunum_set_input_line(machine, 0, 7, CLEAR_LINE);
298298}
299299
300300
301301static INTERRUPT_GEN( generate_int1 )
302302{
303303   /* signal the NMI */
304   itech32_update_interrupts(1, -1, -1);
304   itech32_update_interrupts(machine, 1, -1, -1);
305305   if (FULL_LOGGING) logerror("------------ VBLANK (%d) --------------\n", video_screen_get_vpos(machine->primary_screen));
306306}
307307
308308
309309static WRITE16_HANDLER( int1_ack_w )
310310{
311   itech32_update_interrupts(0, -1, -1);
311   itech32_update_interrupts(machine, 0, -1, -1);
312312}
313313
314314
src/mame/drivers/filetto.c
r2864r2865
301301{
302302   printf("Read Prototyping card [%02x] @ PC=%05x\n",offset,activecpu_get_pc());
303303   if(offset == 1)
304      return input_port_read_indexed(machine, 1);
304      return input_port_read(machine, "DSW");
305305
306306   return disk_data[offset];
307307}
r2864r2865
565565   AM_RANGE(0x02f8, 0x02ff) AM_RAM //Modem port
566566
567567   AM_RANGE(0x0310, 0x0311) AM_READWRITE(disk_iobank_r,disk_iobank_w) //Prototyping card (???)
568   AM_RANGE(0x0312, 0x0312) AM_READ(input_port_0_r)
568   AM_RANGE(0x0312, 0x0312) AM_READ_PORT("IN0")
569569
570570//  AM_RANGE(0x0300, 0x031f) AM_RAM //Prototyping card (???)
571571   AM_RANGE(0x0378, 0x037f) AM_RAM //printer (parallel) port
r2864r2865
582582ADDRESS_MAP_END
583583
584584static INPUT_PORTS_START( filetto )
585   PORT_START
585   PORT_START_TAG("IN0")
586586   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) //START1
587587   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
588588   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
r2864r2865
602602    DSW2
603603    <unused>
604604    */
605   PORT_START
605   PORT_START_TAG("DSW")
606606   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
607607   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
608608   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
src/mame/drivers/findout.c
r2864r2865
6666
6767static READ8_HANDLER( port1_r )
6868{
69   return input_port_read_indexed(machine, 1) | (ticket_dispenser_0_r(machine, 0) >> 5);
69   return input_port_read(machine, "IN0") | (ticket_dispenser_0_r(machine, 0) >> 5);
7070}
7171
7272static WRITE8_HANDLER( lamps_w )
r2864r2865
230230   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
231231   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
232232\
233   PORT_START   /* IN1 */\
233   PORT_START_TAG("IN1")   /* IN1 */\
234234   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("1 Left A-Z") \
235235   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("2 Right A-Z") \
236236   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("3 Select Letter") \
r2864r2865
251251   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
252252   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
253253\
254   PORT_START   /* IN1 */\
254   PORT_START_TAG("IN1")   /* IN1 */\
255255   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) \
256256   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) \
257257   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) \
r2864r2865
262262   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
263263
264264static INPUT_PORTS_START( reelfun )
265   PORT_START
265   PORT_START_TAG("DSWA")
266266   PORT_DIPNAME( 0x07, 0x01, "Coinage Multiplier" )
267267   PORT_DIPSETTING(    0x07, "7" )
268268   PORT_DIPSETTING(    0x06, "6" )
r2864r2865
292292INPUT_PORTS_END
293293
294294static INPUT_PORTS_START( findout )
295   PORT_START      /* DSW A */
295   PORT_START_TAG("DSWA")      /* DSW A */
296296   PORT_DIPNAME( 0x07, 0x01, DEF_STR( Coinage ) )
297297   PORT_DIPSETTING(    0x07, DEF_STR( 7C_1C ) )
298298   PORT_DIPSETTING(    0x06, DEF_STR( 6C_1C ) )
r2864r2865
322322INPUT_PORTS_END
323323
324324static INPUT_PORTS_START( gt103 )
325   PORT_START      /* DSW A */
325   PORT_START_TAG("DSWA")      /* DSW A */
326326   PORT_DIPNAME( 0x07, 0x01, "Coinage Multiplier" )
327327   PORT_DIPSETTING(    0x07, "7" )
328328   PORT_DIPSETTING(    0x06, "6" )
r2864r2865
352352INPUT_PORTS_END
353353
354354static INPUT_PORTS_START( gt103a )
355   PORT_START_TAG ("DSWA")
355   PORT_START_TAG("DSWA")
356356   PORT_DIPNAME( 0x03, 0x01, "Questions" )
357357   PORT_DIPSETTING(    0x00, "4" )
358358   PORT_DIPSETTING(    0x01, "5" )
r2864r2865
389389   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
390390   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
391391
392   PORT_START   /* IN1 */
392   PORT_START_TAG("IN1")   /* IN1 */
393393   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
394394   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
395395   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
r2864r2865
414414INPUT_PORTS_END
415415
416416static INPUT_PORTS_START( gt507uk )
417   PORT_START      /* DSW A */
417   PORT_START_TAG("DSWA")      /* DSW A */
418418   PORT_DIPNAME( 0x01, 0x00, "If Ram Error" )
419419   PORT_DIPSETTING( 0x01, "Freeze" )
420420   PORT_DIPSETTING( 0x00, "Play" )
src/mame/drivers/deco32.c
r2864r2865
329329{
330330   /* Protection/IO chip 75, same as Lemmings & Robocop 2 */
331331   switch (offset<<2) {
332   case 0x0a0: return input_port_read_indexed(machine, 0); /* Player 1 & 2 controls */
333   case 0x158: return input_port_read_indexed(machine, 1); /* Player 3 & 4 controls */
334   case 0xed4: return input_port_read_indexed(machine, 2); /* Misc */
332   case 0x0a0: return input_port_read(machine, "IN0"); /* Player 1 & 2 controls */
333   case 0x158: return input_port_read(machine, "IN1"); /* Player 3 & 4 controls */
334   case 0xed4: return input_port_read(machine, "IN2"); /* Misc */
335335   }
336336
337337   logerror("%08x: Unmapped protection read %04x\n",activecpu_get_pc(),offset<<2);
r2864r2865
341341static READ32_HANDLER( captaven_soundcpu_r )
342342{
343343   /* Top byte - top bit low == sound cpu busy, bottom word is dips */
344   return 0xffff0000 | input_port_read_indexed(machine, 3);
344   return 0xffff0000 | input_port_read(machine, "DSW");
345345}
346346
347347static READ32_HANDLER( fghthist_control_r )
348348{
349349   switch (offset) {
350   case 0: return 0xffff0000 | input_port_read_indexed(machine, 0);
351   case 1: return 0xffff0000 | input_port_read_indexed(machine, 1); //check top bits??
350   case 0: return 0xffff0000 | input_port_read(machine, "IN0");
351   case 1: return 0xffff0000 | input_port_read(machine, "IN1"); //check top bits??
352352   case 2: return 0xfffffffe | eeprom_read_bit();
353353   }
354354
r2864r2865
373373static READ32_HANDLER( dragngun_service_r )
374374{
375375//  logerror("%08x:Read service\n",activecpu_get_pc());
376   return input_port_read_indexed(machine, 3);
376   return input_port_read(machine, "IN2");
377377}
378378
379379static READ32_HANDLER( lockload_gun_mirror_r )
r2864r2865
381381//logerror("%08x:Read gun %d\n",activecpu_get_pc(),offset);
382382//return ((mame_rand(machine)%0xffff)<<16) | mame_rand(machine)%0xffff;
383383   if (offset) /* Mirror of player 1 and player 2 fire buttons */
384      return input_port_read_indexed(machine, 5) | ((mame_rand(machine)%0xff)<<16);
385   return input_port_read_indexed(machine, 4) | input_port_read_indexed(machine, 6) | (input_port_read_indexed(machine, 6)<<16) | (input_port_read_indexed(machine, 6)<<24); //((mame_rand(machine)%0xff)<<16);
384      return input_port_read(machine, "IN4") | ((mame_rand(machine)%0xff)<<16);
385   return input_port_read(machine, "IN3") | input_port_read(machine, "LIGHT0_X") | (input_port_read(machine, "LIGHT0_X")<<16) | (input_port_read(machine, "LIGHT0_X")<<24); //((mame_rand(machine)%0xff)<<16);
386386}
387387
388388static READ32_HANDLER( dragngun_prot_r )
r2864r2865
396396//definitely vblank in locked load
397397
398398   switch (offset<<1) {
399   case 0x140/2: return 0xffff0000 | input_port_read_indexed(machine, 0); /* IN0 */
400   case 0xadc/2: return 0xffff0000 | input_port_read_indexed(machine, 1) | strobe; /* IN1 */
401   case 0x6a0/2: return 0xffff0000 | input_port_read_indexed(machine, 2); /* IN2 (Dip switch) */
399   case 0x140/2: return 0xffff0000 | input_port_read(machine, "IN0"); /* IN0 */
400   case 0xadc/2: return 0xffff0000 | input_port_read(machine, "IN1") | strobe; /* IN1 */
401   case 0x6a0/2: return 0xffff0000 | input_port_read(machine, "DSW"); /* IN2 (Dip switch) */
402402   }
403403   return 0xffffffff;
404404}
r2864r2865
409409{
410410   /* Ports 0-3 are read, but seem unused */
411411   switch (dragngun_lightgun_port) {
412   case 4: return input_port_read_indexed(machine, 4); break;
413   case 5: return input_port_read_indexed(machine, 5); break;
414   case 6: return input_port_read_indexed(machine, 6); break;
415   case 7: return input_port_read_indexed(machine, 7); break;
412   case 4: return input_port_read(machine, "LIGHT0_X"); break;
413   case 5: return input_port_read(machine, "LIGHT1_X"); break;
414   case 6: return input_port_read(machine, "LIGHT0_Y"); break;
415   case 7: return input_port_read(machine, "LIGHT1_Y"); break;
416416   }
417417
418418//  logerror("Illegal lightgun port %d read \n",dragngun_lightgun_port);
r2864r2865
458458static READ32_HANDLER( tattass_prot_r )
459459{
460460   switch (offset<<1) {
461   case 0x280: return input_port_read_indexed(machine, 0) << 16; /* IN0 */
462   case 0x4c4: return input_port_read_indexed(machine, 1) << 16; /* IN1 */
461   case 0x280: return input_port_read(machine, "IN0") << 16;
462   case 0x4c4: return input_port_read(machine, "IN1") << 16;
463463   case 0x35a: return tattass_eprom_bit << 16;
464464   }
465465
r2864r2865
621621{
622622
623623   switch (offset<<1) {
624   case 0x280: return input_port_read_indexed(machine, 0) << 16| 0xffff; /* IN0 */
625   case 0x4c4: return input_port_read_indexed(machine, 1) << 16| 0xffff; /* IN1 */
624   case 0x280: return input_port_read(machine, "IN0") << 16| 0xffff; /* IN0 */
625   case 0x4c4: return input_port_read(machine, "IN1") << 16| 0xffff; /* IN1 */
626626   case 0x35a: return (eeprom_read_bit()<< 16) | 0xffff; // Debug switch in low word??
627627   }
628628
r2864r2865
12441244*/
12451245
12461246static INPUT_PORTS_START( captaven )
1247   PORT_START
1247   PORT_START_TAG("IN0")
12481248   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
12491249   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
12501250   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
12621262   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
12631263   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
12641264
1265   PORT_START
1265   PORT_START_TAG("IN1")
12661266   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
12671267   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
12681268   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
r2864r2865
12801280   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
12811281   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
12821282
1283   PORT_START
1283   PORT_START_TAG("IN2")
12841284   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
12851285   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
12861286   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 )
r2864r2865
12981298   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
12991299   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
13001300
1301   PORT_START   /* Dip switch bank 1 */
1301   PORT_START_TAG("DSW")   /* Dip switch bank 1 */
13021302   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
13031303   PORT_DIPSETTING(      0x0000, DEF_STR( 3C_1C ) )
13041304   PORT_DIPSETTING(      0x0001, DEF_STR( 2C_1C ) )
r2864r2865
13501350INPUT_PORTS_END
13511351
13521352static INPUT_PORTS_START( fghthist )
1353   PORT_START
1353   PORT_START_TAG("IN0")
13541354   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
13551355   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
13561356   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2864r2865
13681368   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
13691369   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
13701370
1371   PORT_START
1371   PORT_START_TAG("IN1")
13721372   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
13731373   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
13741374   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
13881388INPUT_PORTS_END
13891389
13901390static INPUT_PORTS_START( dragngun )
1391   PORT_START
1391   PORT_START_TAG("IN0")
13921392   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
13931393   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED )
13941394   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
14061406   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
14071407   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
14081408
1409   PORT_START
1409   PORT_START_TAG("IN1")
14101410   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
14111411   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
14121412   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
14241424   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
14251425   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
14261426
1427   PORT_START
1427   PORT_START_TAG("DSW")
14281428   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) /* Would be a dipswitch, but only 1 present on board */
14291429   PORT_DIPNAME( 0x0100, 0x0000, "Reset" ) /* Behaves like Reset */
14301430   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
r2864r2865
14511451   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
14521452   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
14531453
1454   PORT_START
1454   PORT_START_TAG("IN2")
14551455   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_VBLANK )
14561456   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
14571457   PORT_SERVICE( 0x0004, IP_ACTIVE_LOW )
r2864r2865
14611461   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
14621462   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
14631463
1464   PORT_START
1464   PORT_START_TAG("LIGHT0_X")
14651465   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_PLAYER(1)
14661466
1467   PORT_START
1467   PORT_START_TAG("LIGHT1_X")
14681468   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_PLAYER(2)
14691469
1470   PORT_START
1470   PORT_START_TAG("LIGHT0_Y")
14711471   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_PLAYER(1)
14721472
1473   PORT_START
1473   PORT_START_TAG("LIGHT1_Y")
14741474   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_PLAYER(2)
14751475INPUT_PORTS_END
14761476
14771477static INPUT_PORTS_START( lockload )
1478   PORT_START
1478   PORT_START_TAG("IN0")
14791479   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
14801480   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED )
14811481   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
14931493   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
14941494   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
14951495
1496   PORT_START
1496   PORT_START_TAG("IN1")
14971497   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
14981498   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
14991499   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
15001500   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_SPECIAL ) //check  //test BUTTON F2
15011501   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNUSED )
15021502
1503   PORT_START
1503   PORT_START_TAG("DSW")
15041504   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) /* Would be a dipswitch, but only 1 present on board */
15051505   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Free_Play ) )
15061506   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
r2864r2865
15271527   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
15281528   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
15291529
1530   PORT_START
1530   PORT_START_TAG("IN2")
15311531   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_VBLANK ) //IPT_VBLANK )
15321532   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED )
15331533   PORT_SERVICE( 0x0004, IP_ACTIVE_LOW )
15341534   PORT_BIT( 0x00f8, IP_ACTIVE_LOW, IPT_UNUSED ) //check  //test BUTTON F2
15351535
1536   PORT_START
1536   PORT_START_TAG("IN3")
15371537   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) /* mirror of fire buttons */
15381538   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
15391539
1540   PORT_START
1540   PORT_START_TAG("IN4")
15411541   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
15421542   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
15431543
1544   PORT_START
1544   PORT_START_TAG("LIGHT0_X")
15451545   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_PLAYER(1)
15461546
1547   PORT_START
1547   PORT_START_TAG("LIGHT0_Y")
15481548   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_PLAYER(1)
15491549
1550   PORT_START
1550   PORT_START_TAG("LIGHT1_X")
15511551   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_PLAYER(2)
15521552
1553   PORT_START
1553   PORT_START_TAG("LIGHT1_Y")
15541554   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(20) PORT_KEYDELTA(25) PORT_PLAYER(2)
15551555INPUT_PORTS_END
15561556
15571557static INPUT_PORTS_START( tattass )
1558   PORT_START
1558   PORT_START_TAG("IN0")
15591559   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
15601560   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
15611561   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
15731573   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
15741574   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
15751575
1576   PORT_START
1576   PORT_START_TAG("IN1")
15771577   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
15781578   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
15791579   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
15931593INPUT_PORTS_END
15941594
15951595static INPUT_PORTS_START( nslasher )
1596   PORT_START
1596   PORT_START_TAG("IN0")
15971597   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
15981598   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
15991599   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
16111611   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
16121612   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
16131613
1614   PORT_START
1614   PORT_START_TAG("IN1")
16151615   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
16161616   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
16171617   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
32773277
32783278   deco156_decrypt();
32793279
3280   soundlatch_setclearedvalue(0xff);
3280   soundlatch_setclearedvalue(machine, 0xff);
32813281
32823282   /* The board for Night Slashers is very close to the Fighter's History and
32833283    Tattoo Assassins boards, but has an encrypted ARM cpu. */
src/mame/drivers/midzeus.c
r2864r2865
13261326static DRIVER_INIT( mk4 )
13271327{
13281328   dcs2_init(machine, 0, 0);
1329   midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 461/* or 474 */, 94, NULL);
1329   midway_ioasic_init(machine, MIDWAY_IOASIC_STANDARD, 461/* or 474 */, 94, NULL);
13301330   midway_ioasic_set_shuffle_state(1);
13311331}
13321332
r2864r2865
13341334static DRIVER_INIT( invasn )
13351335{
13361336   dcs2_init(machine, 0, 0);
1337   midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 468/* or 488 */, 94, NULL);
1337   midway_ioasic_init(machine, MIDWAY_IOASIC_STANDARD, 468/* or 488 */, 94, NULL);
13381338   memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9c0000, 0x9c0000, 0, 0, invasn_gun_r, invasn_gun_w);
13391339}
13401340
r2864r2865
13421342static DRIVER_INIT( crusnexo )
13431343{
13441344   dcs2_init(machine, 0, 0);
1345   midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 472/* or 476,477,478,110 */, 99, NULL);
1345   midway_ioasic_init(machine, MIDWAY_IOASIC_STANDARD, 472/* or 476,477,478,110 */, 99, NULL);
13461346   memory_configure_bank(1, 0, 3, memory_region(REGION_USER2), 0x400000*4);
13471347
13481348   memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x9b0004, 0x9b0007, 0, 0, crusnexo_leds_r, crusnexo_leds_w);
r2864r2865
13531353static DRIVER_INIT( thegrid )
13541354{
13551355   dcs2_init(machine, 0, 0);
1356   midway_ioasic_init(MIDWAY_IOASIC_STANDARD, 474/* or 491 */, 99, NULL);
1356   midway_ioasic_init(machine, MIDWAY_IOASIC_STANDARD, 474/* or 491 */, 99, NULL);
13571357   memory_configure_bank(1, 0, 3, memory_region(REGION_USER2), 0x400000*4);
13581358}
13591359
src/mame/drivers/grchamp.c
r2864r2865
4242***************************************************************************/
4343
4444#include "driver.h"
45#include "deprecat.h"
4645#include "cpu/z80/z80.h"
4746#include "sound/ay8910.h"
4847#include "grchamp.h"
r2864r2865
7978static MACHINE_START( grchamp )
8079{
8180   /* if the coin system is 1 way, lock Coin B (Page 40) */
82   if (input_port_read_indexed(machine, 1) & 0x10)
81   if (input_port_read(machine, "DSWB") & 0x10)
8382      coin_lockout_w(1, 1);
8483}
8584
r2864r2865
337336 *
338337 *************************************/
339338
340INLINE UINT8 get_pc3259_bits(grchamp_state *state, int offs)
339INLINE UINT8 get_pc3259_bits(running_machine *machine, grchamp_state *state, int offs)
341340{
342341   int bits;
343342
344343   /* force a partial update to the current position */
345   video_screen_update_partial(Machine->primary_screen, video_screen_get_vpos(Machine->primary_screen));
344   video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen));
346345
347346   /* get the relevant 4 bits */
348347   bits = (state->collide >> (offs*4)) & 0x0f;
r2864r2865
355354static READ8_HANDLER( pc3259_0_r )
356355{
357356   grchamp_state *state = machine->driver_data;
358   return get_pc3259_bits(state, 0);
357   return get_pc3259_bits(machine, state, 0);
359358}
360359
361360
362361static READ8_HANDLER( pc3259_1_r )
363362{
364363   grchamp_state *state = machine->driver_data;
365   return get_pc3259_bits(state, 1);
364   return get_pc3259_bits(machine, state, 1);
366365}
367366
368367
369368static READ8_HANDLER( pc3259_2_r )
370369{
371370   grchamp_state *state = machine->driver_data;
372   return get_pc3259_bits(state, 2);
371   return get_pc3259_bits(machine, state, 2);
373372}
374373
375374
376375static READ8_HANDLER( pc3259_3_r )
377376{
378377   grchamp_state *state = machine->driver_data;
379   return get_pc3259_bits(state, 3);
378   return get_pc3259_bits(machine, state, 3);
380379}
381380
382381
src/mame/drivers/goodejan.c
r2864r2865
7979
8080   switch(goodejan_mux_data)
8181   {
82      case 1:    ret = input_port_read_indexed(machine, 1); break;
83      case 2:    ret = input_port_read_indexed(machine, 2); break;
84      case 4:    ret = input_port_read_indexed(machine, 3); break;
85      case 8:    ret = input_port_read_indexed(machine, 4); break;
86      case 0x10: ret = input_port_read_indexed(machine, 5); break;
82      case 1:    ret = input_port_read(machine, "KEY0"); break;
83      case 2:    ret = input_port_read(machine, "KEY1"); break;
84      case 4:    ret = input_port_read(machine, "KEY2"); break;
85      case 8:    ret = input_port_read(machine, "KEY3"); break;
86      case 0x10: ret = input_port_read(machine, "KEY4"); break;
8787   }
8888
8989   return ret;
r2864r2865
126126static INPUT_PORTS_START( goodejan )
127127   SEIBU_COIN_INPUTS   /* coin inputs read through sound cpu */
128128
129   PORT_START
129   PORT_START_TAG("KEY0")
130130   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
131131   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
132132   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
r2864r2865
136136   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
137137   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
138138
139   PORT_START
139   PORT_START_TAG("KEY1")
140140   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
141141   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
142142   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
r2864r2865
146146   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
147147   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
148148
149   PORT_START
149   PORT_START_TAG("KEY2")
150150   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
151151   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
152152   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
r2864r2865
156156   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
157157   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
158158
159   PORT_START
159   PORT_START_TAG("KEY3")
160160   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
161161   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
162162   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
r2864r2865
166166   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
167167   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
168168
169   PORT_START
169   PORT_START_TAG("KEY4")
170170   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
171171   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
172172   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
r2864r2865
176176   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
177177   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
178178
179   PORT_START
180   PORT_DIPNAME( 0x0001, 0x0001, "4" )
181    PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
182    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
183    PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
184    PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
185    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
186    PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
187    PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
188    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
189    PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
190    PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
191    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
192    PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) )  // Freezes if off?
193    PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
194    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
195    PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
196    PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
197    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
198    PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
199    PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
200    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
201    PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
202    PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
203    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
204    PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
205    PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
206    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
207    PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
208    PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
209    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
210    PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
211    PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
212    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
213    PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) )
214    PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
215    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
216    PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
217    PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
218    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
219    PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
220    PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
221    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
222    PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
223    PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
224    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
225    PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
226    PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
227    PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
179   PORT_START_TAG("DSW")
180   PORT_DIPNAME( 0x0001, 0x0001, "4" )
181   PORT_DIPSETTING(     0x0001, DEF_STR( Off ) )
182   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
183   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
184   PORT_DIPSETTING(     0x0002, DEF_STR( Off ) )
185   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
186   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
187   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
188   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
189   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
190   PORT_DIPSETTING(     0x0008, DEF_STR( Off ) )
191   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
192   PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) )  // Freezes if off?
193   PORT_DIPSETTING(     0x0010, DEF_STR( Off ) )
194   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
195   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
196   PORT_DIPSETTING(     0x0020, DEF_STR( Off ) )
197   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
198   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
199   PORT_DIPSETTING(     0x0040, DEF_STR( Off ) )
200   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
201   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
202   PORT_DIPSETTING(     0x0080, DEF_STR( Off ) )
203   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
204   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
205   PORT_DIPSETTING(     0x0100, DEF_STR( Off ) )
206   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
207   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
208   PORT_DIPSETTING(     0x0200, DEF_STR( Off ) )
209   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
210   PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
211   PORT_DIPSETTING(     0x0400, DEF_STR( Off ) )
212   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
213   PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) )
214   PORT_DIPSETTING(     0x0800, DEF_STR( Off ) )
215   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
216   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
217   PORT_DIPSETTING(     0x1000, DEF_STR( Off ) )
218   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
219   PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
220   PORT_DIPSETTING(     0x2000, DEF_STR( Off ) )
221   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
222   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
223   PORT_DIPSETTING(     0x4000, DEF_STR( Off ) )
224   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
225   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
226   PORT_DIPSETTING(     0x8000, DEF_STR( Off ) )
227   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
228228INPUT_PORTS_END
229229
230230
src/mame/drivers/aleck64.c
r2864r2865
417417
418418static INTERRUPT_GEN( n64_vblank )
419419{
420   signal_rcp_interrupt(VI_INTERRUPT);
420   signal_rcp_interrupt(machine, VI_INTERRUPT);
421421}
422422
423423static MACHINE_RESET( aleck64 )
424424{
425   n64_machine_reset();
425   n64_machine_reset(machine);
426426}
427427
428428static MACHINE_DRIVER_START( aleck64 )
src/mame/drivers/karnov.c
r2864r2865
3838*******************************************************************************/
3939
4040#include "driver.h"
41#include "deprecat.h"
4241#include "sound/2203intf.h"
4342#include "sound/3812intf.h"
4443
r2864r2865
6160/******************************************************************************/
6261
6362/* Emulation of the protected microcontroller - for coins & general protection */
64static void karnov_i8751_w(int data)
63static void karnov_i8751_w(running_machine *machine, int data)
6564{
6665   /* Pending coin operations may cause protection commands to be queued */
6766   if (i8751_needs_ack) {
r2864r2865
8786
8887//  if (!i8751_return && data!=0x300) logerror("CPU %04x - Unknown Write %02x intel\n",activecpu_get_pc(),data);
8988
90   cpunum_set_input_line(Machine, 0,6,HOLD_LINE); /* Signal main cpu task is complete */
89   cpunum_set_input_line(machine, 0,6,HOLD_LINE); /* Signal main cpu task is complete */
9190   i8751_needs_ack=1;
9291}
9392
94static void wndrplnt_i8751_w(int data)
93static void wndrplnt_i8751_w(running_machine *machine, int data)
9594{
9695   /* The last command hasn't been ACK'd (probably a conflict with coin command) */
9796   if (i8751_needs_ack) {
r2864r2865
141140   if (data==0x501) i8751_return=0x6bf8;
142141   if (data==0x500) i8751_return=0x4e75;
143142
144   cpunum_set_input_line(Machine, 0,6,HOLD_LINE); /* Signal main cpu task is complete */
143   cpunum_set_input_line(machine, 0,6,HOLD_LINE); /* Signal main cpu task is complete */
145144   i8751_needs_ack=1;
146145}
147146
148static void chelnov_i8751_w(int data)
147static void chelnov_i8751_w(running_machine *machine, int data)
149148{
150149   static int level;
151150
r2864r2865
251250
252251//  logerror("CPU %04x - Unknown Write %02x intel\n",activecpu_get_pc(),data);
253252
254   cpunum_set_input_line(Machine, 0,6,HOLD_LINE); /* Signal main cpu task is complete */
253   cpunum_set_input_line(machine, 0,6,HOLD_LINE); /* Signal main cpu task is complete */
255254   i8751_needs_ack=1;
256255}
257256
r2864r2865
292291         break;
293292
294293      case 6: /* SECREQ (Interrupt & Data to i8751) */
295         if (microcontroller_id==KARNOV || microcontroller_id==KARNOVJ) karnov_i8751_w(data);
296         if (microcontroller_id==CHELNOV || microcontroller_id==CHELNOVJ || microcontroller_id==CHELNOVW) chelnov_i8751_w(data);
297         if (microcontroller_id==WNDRPLNT) wndrplnt_i8751_w(data);
294         if (microcontroller_id==KARNOV || microcontroller_id==KARNOVJ) karnov_i8751_w(machine, data);
295         if (microcontroller_id==CHELNOV || microcontroller_id==CHELNOVJ || microcontroller_id==CHELNOVW) chelnov_i8751_w(machine, data);
296         if (microcontroller_id==WNDRPLNT) wndrplnt_i8751_w(machine, data);
298297         break;
299298
300299      case 8: /* HSHIFT (9 bits) - Top bit indicates video flip */
r2864r2865
652651   static int latch;
653652
654653   /* Coin input to the i8751 generates an interrupt to the main cpu */
655   if (input_port_read_indexed(machine, 3) == coin_mask) latch=1;
656   if (input_port_read_indexed(machine, 3) != coin_mask && latch) {
654   if (input_port_read(machine, "FAKE") == coin_mask) latch=1;
655   if (input_port_read(machine, "FAKE") != coin_mask && latch) {
657656      if (i8751_needs_ack) {
658657         /* i8751 is busy - queue the command */
659         i8751_coin_pending=input_port_read_indexed(machine, 3) | 0x8000;
658         i8751_coin_pending=input_port_read(machine, "FAKE") | 0x8000;
660659      } else {
661         i8751_return=input_port_read_indexed(machine, 3) | 0x8000;
660         i8751_return=input_port_read(machine, "FAKE") | 0x8000;
662661         cpunum_set_input_line(machine, 0,6,HOLD_LINE);
663662         i8751_needs_ack=1;
664663      }
src/mame/drivers/vegas.c
r2864r2865
13451345      /* bit 0x01 seems to be used to reset the IOASIC */
13461346      if (!(data & 0x01))
13471347      {
1348         midway_ioasic_reset();
1348         midway_ioasic_reset(machine);
13491349         dcs_reset_w(data & 0x01);
13501350      }
13511351
r2864r2865
14731473
14741474static WRITE32_HANDLER( asic_fifo_w )
14751475{
1476   midway_ioasic_fifo_w(data);
1476   midway_ioasic_fifo_w(machine, data);
14771477}
14781478
14791479
r2864r2865
15231523
15241524static WRITE32_HANDLER( dcs3_fifo_full_w )
15251525{
1526   midway_ioasic_fifo_full_w(data);
1526   midway_ioasic_fifo_full_w(machine, data);
15271527}
15281528
15291529
r2864r2865
24612461   };
24622462
24632463   /* initialize the subsystems */
2464   midway_ioasic_init(ioasic, serialnum, 80, ioasic_irq);
2464   midway_ioasic_init(machine, ioasic, serialnum, 80, ioasic_irq);
24652465   midway_ioasic_set_auto_ack(1);
24662466   smc91c94_init(&ethernet_intf);
24672467
src/mame/drivers/kopunch.c
r2864r2865
1818{
1919   if (cpu_getiloops() == 0)
2020   {
21      if (~input_port_read_indexed(machine, 1) & 0x80)   /* coin 1 */
21      if (~input_port_read(machine, "IN1") & 0x80)   /* coin 1 */
2222      {
2323         cpunum_set_input_line_and_vector(machine, 0,0,HOLD_LINE,0xf7);   /* RST 30h */
2424         return;
2525      }
26      else if (~input_port_read_indexed(machine, 1) & 0x08)   /* coin 2 */
26      else if (~input_port_read(machine, "IN1") & 0x08)   /* coin 2 */
2727      {
2828         cpunum_set_input_line_and_vector(machine, 0,0,HOLD_LINE,0xef);   /* RST 28h */
2929         return;
r2864r2865
3939   if (offset == 0)
4040      return mame_rand(machine);
4141   else
42      return (mame_rand(machine) & 0x07) | input_port_read_indexed(machine, 1);
42      return (mame_rand(machine) & 0x07) | input_port_read(machine, "IN1");
4343}
4444
4545static WRITE8_HANDLER( kopunch_lamp_w )
r2864r2865
7070ADDRESS_MAP_END
7171
7272static ADDRESS_MAP_START( kopunch_io_map, ADDRESS_SPACE_IO, 8 )
73   AM_RANGE(0x30, 0x30) AM_READ(input_port_0_r)
73   AM_RANGE(0x30, 0x30) AM_READ_PORT("IN0")
7474   AM_RANGE(0x31, 0x32) AM_READ(kopunch_in_r)
7575   AM_RANGE(0x33, 0x33) AM_WRITENOP
7676   AM_RANGE(0x34, 0x34) AM_WRITE(kopunch_coin_w)
r2864r2865
7979   AM_RANGE(0x37, 0x37) AM_WRITENOP
8080   AM_RANGE(0x38, 0x38) AM_WRITE(kopunch_lamp_w)
8181   AM_RANGE(0x39, 0x39) AM_WRITENOP
82   AM_RANGE(0x3a, 0x3a) AM_READ(input_port_2_r)
82   AM_RANGE(0x3a, 0x3a) AM_READ_PORT("DSW")
8383   AM_RANGE(0x3b, 0x3b) AM_WRITENOP
8484   AM_RANGE(0x3c, 0x3c) AM_WRITE(kopunch_scroll_x_w)
8585   AM_RANGE(0x3d, 0x3d) AM_WRITE(kopunch_scroll_y_w)
r2864r2865
8989
9090
9191static INPUT_PORTS_START( kopunch )
92   PORT_START
92   PORT_START_TAG("IN0")
9393   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
9494   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
9595   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
r2864r2865
9999   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
100100   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )
101101
102   PORT_START
102   PORT_START_TAG("IN1")
103103   PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* punch strength (high 3 bits) */
104104   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1)
105105   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
r2864r2865
107107   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
108108   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1)
109109
110   PORT_START
110   PORT_START_TAG("DSW")
111111   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
112112   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
113113   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
133133   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
134134   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
135135
136   PORT_START
136   PORT_START_TAG("IN2")
137137   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
138138   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
139139   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
src/mame/drivers/enigma2.c
r2864r2865
324324      if (protection_data != 0xff)
325325         ret = protection_data ^ 0x88;
326326      else
327         ret = input_port_read_indexed(machine, 2);
327         ret = input_port_read(machine, "DSW");
328328      break;
329329
330330   case 0x02:
r2864r2865
370370
371371static WRITE8_HANDLER( enigma2_flip_screen_w )
372372{
373   engima2_flip_screen = ((data >> 5) & 0x01) && ((input_port_read_indexed(machine, 2) & 0x20) == 0x20);
373   engima2_flip_screen = ((data >> 5) & 0x01) && ((input_port_read(machine, "DSW") & 0x20) == 0x20);
374374}
375375
376376
r2864r2865
453453
454454
455455static INPUT_PORTS_START( enigma2 )
456   PORT_START
456   PORT_START_TAG("IN0")
457457   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
458458   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
459459   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
460460   PORT_BIT( 0x78, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(p1_controls_r, 0)
461461   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
462462
463   PORT_START
463   PORT_START_TAG("IN1")
464464   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
465465   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
466466   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
467467   PORT_BIT( 0x78, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(p2_controls_r, 0)
468468   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
469469
470   PORT_START
470   PORT_START_TAG("DSW")
471471   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
472472   PORT_DIPSETTING(    0x00, "3" )
473473   PORT_DIPSETTING(    0x01, "4" )
r2864r2865
507507
508508
509509static INPUT_PORTS_START( enigma2a )
510   PORT_START
510   PORT_START_TAG("IN0")
511511   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
512512   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
513513   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
r2864r2865
515515   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(p1_controls_r, 0)
516516   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
517517
518   PORT_START
518   PORT_START_TAG("IN1")
519519   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
520520   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
521521   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
r2864r2865
523523   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(p2_controls_r, 0)
524524   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
525525
526   PORT_START
526   PORT_START_TAG("DSW")
527527   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
528528   PORT_DIPSETTING(    0x00, "3" )
529529   PORT_DIPSETTING(    0x01, "4" )
src/mame/drivers/segaorun.c
r2864r2865
5858 *************************************/
5959
6060extern void fd1094_machine_init(void);
61extern void fd1094_driver_init(void (*set_decrypted)(UINT8 *));
61extern void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(UINT8 *));
6262
6363static READ16_HANDLER( misc_io_r );
6464static WRITE16_HANDLER( misc_io_w );
r2864r2865
154154   segaic16_memory_mapper_init(machine, 0, outrun_info, sound_data_w, NULL);
155155
156156   /* init the FD1094 */
157   fd1094_driver_init(segaic16_memory_mapper_set_decrypted);
157   fd1094_driver_init(machine, segaic16_memory_mapper_set_decrypted);
158158
159159   /* reset the custom handlers and other pointers */
160160   custom_io_r = NULL;
r2864r2865
11921192/**************************************************************************************************************************
11931193 **************************************************************************************************************************
11941194 **************************************************************************************************************************
1195    Turbo Outrun (Out Run upgrade set)
1196    CPU: FD1094 (317-0118)
1197    GAME BD   834-6919-12
1198     CPU BD   837-6905-12
1199     VIDEO BD 837-6906-02
1195    Turbo Outrun (White cockpit/sitdown Deluxe version)
1196    CPU: FD1094 (317-0109)
12001197*/
12011198ROM_START( toutrun )
12021199   ROM_REGION( 0x60000, REGION_CPU1, 0 ) /* 68000 code */
1203   ROM_LOAD16_BYTE( "epr-12513.133", 0x000000, 0x10000, CRC(ae8835a5) SHA1(09573964d4f42ac0f08be3682b73e3420df27c6d) )
1204   ROM_LOAD16_BYTE( "epr-12512.118", 0x000001, 0x10000, CRC(f90372ad) SHA1(b42dd8c580421b4d7ffacf8d3baa7b9fc9e392ef) )
1205   ROM_LOAD16_BYTE( "epr-12515.132", 0x020000, 0x10000, CRC(1f047df4) SHA1(c1c67847f1390e671c19f0b90c3cbfbc237d960b) )
1206   ROM_LOAD16_BYTE( "epr-12514.117", 0x020001, 0x10000, CRC(5539e9c3) SHA1(01046e3b836f66ba6d5c4be1611de48197aca67f) )
1200   ROM_LOAD16_BYTE( "epr-12289.133", 0x000000, 0x10000, CRC(812fd035) SHA1(7bea9ba611333dfb86cfc2e2be8cff5f700b6f71) )
1201   ROM_LOAD16_BYTE( "epr-12288.118", 0x000001, 0x10000, CRC(2f1151bb) SHA1(e91600d4f4e5d3d5a67cafb1ff34006f281434f1) )
1202   ROM_LOAD16_BYTE( "epr-12291.132", 0x020000, 0x10000, CRC(8ca284d2) SHA1(93f71ec554ab000294aaa4de9ece0eecfcfe3c46) )
1203   ROM_LOAD16_BYTE( "epr-12290.117", 0x020001, 0x10000, CRC(44dbf3cb) SHA1(ad867a66d97e9f5b9e14a8d05049581214a077bf) )
12071204   ROM_LOAD16_BYTE( "epr-12293.131", 0x040000, 0x10000, CRC(f4321eea) SHA1(64334acc82c14bb58b7d51719f34fd81cfb9fc6b) )
12081205   ROM_LOAD16_BYTE( "epr-12292.116", 0x040001, 0x10000, CRC(51d98af0) SHA1(6e7115706bfafb687faa23d55d4a8c8e498a4df2) )
12091206
12101207   ROM_REGION( 0x2000, REGION_USER1, 0 )   /* decryption key */
1211   ROM_LOAD( "317-0118.key", 0x0000, 0x2000, CRC(083d7d56) SHA1(3153e44479986859f60a26fe9264ecea07e6e469) )
1208   ROM_LOAD( "317-0109.key", 0x0000, 0x2000, CRC(e12a6e78) SHA1(358325490fc93bb979e9a9a296ce639d331e8b52) )
12121209
12131210   ROM_REGION( 0x60000, REGION_CPU2, 0 ) /* second 68000 CPU */
12141211   ROM_LOAD16_BYTE( "opr-12295.76", 0x000000, 0x10000, CRC(d43a3a84) SHA1(362c98f62c205b6b40b7e8a4ba107745b547b984) )
r2864r2865
12221219   ROM_LOAD( "opr-12325.104", 0x20000, 0x10000, CRC(1405137a) SHA1(367db88d36852e35c5e839f692be5ea8c8e072d2) )
12231220
12241221   ROM_REGION32_LE( 0x100000, REGION_GFX2, 0 ) /* sprites */
1225   /* Video BD 837-6906-2, Mask Roms twice the size as EPR/OPR counterparts */
1226   ROM_LOAD32_BYTE( "mpr-12336.9",   0x00000, 0x20000, CRC(dda465c7) SHA1(83acc12a387b004986f084f25964c15a9f88a41a) )
1227   ROM_LOAD32_BYTE( "mpr-12337.10",  0x00001, 0x20000, CRC(828233d1) SHA1(d73a200af4245d590e1fd3ac436723f99cc50452) )
1228   ROM_LOAD32_BYTE( "mpr-12338.11",  0x00002, 0x20000, CRC(46b4b5f4) SHA1(afeb2e5ac6792edafe7328993fe8dfcd4bce1924) )
1229   ROM_LOAD32_BYTE( "mpr-12339.12",  0x00003, 0x20000, CRC(0d7e3bab) SHA1(fdb603df55785ded593daf591ddd90f8f24e0d47) )
1230   ROM_LOAD32_BYTE( "mpr-12364.13",  0x80000, 0x20000, CRC(a4b83e65) SHA1(966d8c163cef0842abff54e1dba3f15248e73f68) )
1231   ROM_LOAD32_BYTE( "mpr-12365.14",  0x80001, 0x20000, CRC(4a80b2a9) SHA1(14b4fe71e102622a73c8dc0dbd0013cbbe6fcf9d) )
1232   ROM_LOAD32_BYTE( "mpr-12366.15",  0x80002, 0x20000, CRC(385cb3ab) SHA1(fec6d80d488bfe26524fa3a48b195a45a073e481) )
1233   ROM_LOAD32_BYTE( "mpr-12367.16",  0x80003, 0x20000, CRC(4930254a) SHA1(00f24be3bf02b143fa554f4d32e283bdac79af6a) )
1222   ROM_LOAD32_BYTE( "opr-12307.9",  0x00000, 0x10000, CRC(437dcf09) SHA1(0022ee4d1c3698f77271e570cef98a8a1e5c5d6a) )
1223   ROM_LOAD32_BYTE( "opr-12308.10", 0x00001, 0x10000, CRC(0de70cc2) SHA1(c03f8f8cda72daf64af2878bf254840ac6dd17eb) )
1224   ROM_LOAD32_BYTE( "opr-12309.11", 0x00002, 0x10000, CRC(deb8c242) SHA1(c05d8ced4eafae52c4795fb1471cd66f5903d1aa) )
1225   ROM_LOAD32_BYTE( "opr-12310.12", 0x00003, 0x10000, CRC(45cf157e) SHA1(5d0be2a374a53ea1fe0ba2bf9b2173e96de1eb51) )
1226   ROM_LOAD32_BYTE( "opr-12311.13", 0x40000, 0x10000, CRC(ae2bd639) SHA1(64bb60ae7e3f87fbbce00106ba65c4e6fc1af0e4) )
1227   ROM_LOAD32_BYTE( "opr-12312.14", 0x40001, 0x10000, CRC(626000e7) SHA1(4a7f9e76dd76a3dc56b8257149bc94be3f4f2e87) )
1228   ROM_LOAD32_BYTE( "opr-12313.15", 0x40002, 0x10000, CRC(52870c37) SHA1(3a6836a46d94c0f9115800d206410252a1134c57) )
1229   ROM_LOAD32_BYTE( "opr-12314.16", 0x40003, 0x10000, CRC(40c461ea) SHA1(7bed8f24112dc3c827fd087138fcf2700092aa59) )
1230   ROM_LOAD32_BYTE( "opr-12315.17", 0x80000, 0x10000, CRC(3ff9a3a3) SHA1(0d90fe2669d03bd07a0d3b05934201778e28d54c) )
1231   ROM_LOAD32_BYTE( "opr-12316.18", 0x80001, 0x10000, CRC(8a1e6dc8) SHA1(32f09ec504c2b6772815bad7380a2f738f11746a) )
1232   ROM_LOAD32_BYTE( "opr-12317.19", 0x80002, 0x10000, CRC(77e382d4) SHA1(5b7912069a46043b7be989d82436add85497d318) )
1233   ROM_LOAD32_BYTE( "opr-12318.20", 0x80003, 0x10000, CRC(d1afdea9) SHA1(813eccc88d5046992be5b5a0618d32127d16e30b) )
1234   ROM_LOAD32_BYTE( "opr-12319.25", 0xc0000, 0x10000, CRC(df23baf9) SHA1(f9611391bb3b3b92203fa9f6dd461e3a6e863622) )
1235   ROM_LOAD32_BYTE( "opr-12320.22", 0xc0001, 0x10000, CRC(7931e446) SHA1(9f2161a689ebad61f6653942e23d9c2bc6170d4a) )
1236   ROM_LOAD32_BYTE( "opr-12321.23", 0xc0002, 0x10000, CRC(830bacd4) SHA1(5a4816969437ee1edca5845006c0b8e9ba365491) )
1237   ROM_LOAD32_BYTE( "opr-12322.24", 0xc0003, 0x10000, CRC(8b812492) SHA1(bf1f9e059c093c0991c7caf1b01c739ed54b8357) )
12341238
12351239   ROM_REGION( 0x10000, REGION_GFX3, 0 ) /* road gfx (2 identical roms, 1 for each road) */
12361240   ROM_LOAD( "epr-12299.47", 0x0000, 0x8000, CRC(fc9bc41b) SHA1(9af73e096253cf2c4f283f227530110a4b37fcee) ) /* Manual shows both as EPR-12298 */
r2864r2865
13791383   ROM_LOAD( "opr-12306.71", 0x50000, 0x10000, CRC(e49249fd) SHA1(ff36e4dba4e9d3d354e3dd528edeb50ad9c18ee4) )
13801384ROM_END
13811385
1386/**************************************************************************************************************************
1387    Turbo Outrun (Out Run upgrade set)
1388    CPU: FD1094 (317-0118)
1389    GAME BD   834-6919-12
1390     CPU BD   837-6905-12
1391     VIDEO BD 837-6906-02
1392*/
1393ROM_START( toutrunu )
1394   ROM_REGION( 0x60000, REGION_CPU1, 0 ) /* 68000 code */
1395   ROM_LOAD16_BYTE( "epr-12513.133", 0x000000, 0x10000, CRC(ae8835a5) SHA1(09573964d4f42ac0f08be3682b73e3420df27c6d) )
1396   ROM_LOAD16_BYTE( "epr-12512.118", 0x000001, 0x10000, CRC(f90372ad) SHA1(b42dd8c580421b4d7ffacf8d3baa7b9fc9e392ef) )
1397   ROM_LOAD16_BYTE( "epr-12515.132", 0x020000, 0x10000, CRC(1f047df4) SHA1(c1c67847f1390e671c19f0b90c3cbfbc237d960b) )
1398   ROM_LOAD16_BYTE( "epr-12514.117", 0x020001, 0x10000, CRC(5539e9c3) SHA1(01046e3b836f66ba6d5c4be1611de48197aca67f) )
1399   ROM_LOAD16_BYTE( "epr-12293.131", 0x040000, 0x10000, CRC(f4321eea) SHA1(64334acc82c14bb58b7d51719f34fd81cfb9fc6b) )
1400   ROM_LOAD16_BYTE( "epr-12292.116", 0x040001, 0x10000, CRC(51d98af0) SHA1(6e7115706bfafb687faa23d55d4a8c8e498a4df2) )
13821401
1402   ROM_REGION( 0x2000, REGION_USER1, 0 )   /* decryption key */
1403   ROM_LOAD( "317-0118.key", 0x0000, 0x2000, CRC(083d7d56) SHA1(3153e44479986859f60a26fe9264ecea07e6e469) )
1404
1405   ROM_REGION( 0x60000, REGION_CPU2, 0 ) /* second 68000 CPU */
1406   ROM_LOAD16_BYTE( "opr-12295.76", 0x000000, 0x10000, CRC(d43a3a84) SHA1(362c98f62c205b6b40b7e8a4ba107745b547b984) )
1407   ROM_LOAD16_BYTE( "opr-12294.58", 0x000001, 0x10000, CRC(27cdcfd3) SHA1(4fe57db95b109ab1bb1326789e06a3d3aac311cc) )
1408   ROM_LOAD16_BYTE( "opr-12297.75", 0x020000, 0x10000, CRC(1d9b5677) SHA1(fb6e33acc43fbc7a8d7ac44045439ecdf794fdeb) )
1409   ROM_LOAD16_BYTE( "opr-12296.57", 0x020001, 0x10000, CRC(0a513671) SHA1(4c13ca3a6f0aa9d06ed80798b466cca0c966a265) )
1410
1411   ROM_REGION( 0x30000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */
1412   ROM_LOAD( "opr-12323.102", 0x00000, 0x10000, CRC(4de43a6f) SHA1(68909338e1f192ac2699c8a8d24c3f46502dd019) )
1413   ROM_LOAD( "opr-12324.103", 0x10000, 0x10000, CRC(24607a55) SHA1(69033f2281cd42e88233c23d809b73607fe54853) )
1414   ROM_LOAD( "opr-12325.104", 0x20000, 0x10000, CRC(1405137a) SHA1(367db88d36852e35c5e839f692be5ea8c8e072d2) )
1415
1416   ROM_REGION32_LE( 0x100000, REGION_GFX2, 0 ) /* sprites */
1417   /* Video BD 837-6906-2, Mask Roms twice the size as EPR/OPR counterparts */
1418   ROM_LOAD32_BYTE( "mpr-12336.9",   0x00000, 0x20000, CRC(dda465c7) SHA1(83acc12a387b004986f084f25964c15a9f88a41a) )
1419   ROM_LOAD32_BYTE( "mpr-12337.10",  0x00001, 0x20000, CRC(828233d1) SHA1(d73a200af4245d590e1fd3ac436723f99cc50452) )
1420   ROM_LOAD32_BYTE( "mpr-12338.11",  0x00002, 0x20000, CRC(46b4b5f4) SHA1(afeb2e5ac6792edafe7328993fe8dfcd4bce1924) )
1421   ROM_LOAD32_BYTE( "mpr-12339.12",  0x00003, 0x20000, CRC(0d7e3bab) SHA1(fdb603df55785ded593daf591ddd90f8f24e0d47) )
1422   ROM_LOAD32_BYTE( "mpr-12364.13",  0x80000, 0x20000, CRC(a4b83e65) SHA1(966d8c163cef0842abff54e1dba3f15248e73f68) )
1423   ROM_LOAD32_BYTE( "mpr-12365.14",  0x80001, 0x20000, CRC(4a80b2a9) SHA1(14b4fe71e102622a73c8dc0dbd0013cbbe6fcf9d) )
1424   ROM_LOAD32_BYTE( "mpr-12366.15",  0x80002, 0x20000, CRC(385cb3ab) SHA1(fec6d80d488bfe26524fa3a48b195a45a073e481) )
1425   ROM_LOAD32_BYTE( "mpr-12367.16",  0x80003, 0x20000, CRC(4930254a) SHA1(00f24be3bf02b143fa554f4d32e283bdac79af6a) )
1426
1427   ROM_REGION( 0x10000, REGION_GFX3, 0 ) /* road gfx (2 identical roms, 1 for each road) */
1428   ROM_LOAD( "epr-12299.47", 0x0000, 0x8000, CRC(fc9bc41b) SHA1(9af73e096253cf2c4f283f227530110a4b37fcee) ) /* Manual shows both as EPR-12298 */
1429   ROM_LOAD( "epr-12298.11", 0x8000, 0x8000, CRC(fc9bc41b) SHA1(9af73e096253cf2c4f283f227530110a4b37fcee) )
1430
1431   ROM_REGION( 0x10000, REGION_CPU3, 0 ) /* sound CPU */
1432   ROM_LOAD( "epr-12300.88", 0x00000, 0x10000, CRC(e8ff7011) SHA1(6eaf3aea507007ea31d507ed7825d905f4b8e7ab) )
1433
1434   ROM_REGION( 0x80000, REGION_SOUND1, ROMREGION_ERASEFF ) /* sound PCM data */
1435   ROM_LOAD( "opr-12301.66", 0x00000, 0x10000, CRC(6e78ad15) SHA1(c31ddf434b459cd1a381d2a028beabddd4ed10d2) )
1436   ROM_LOAD( "opr-12302.67", 0x10000, 0x10000, CRC(e72928af) SHA1(40e0b178958cfe97c097fe9d82b5de54bc27a29f) )
1437   ROM_LOAD( "opr-12303.68", 0x20000, 0x10000, CRC(8384205c) SHA1(c1f9d52bc587eab5a97867198e9aa7c19e973429) )
1438   ROM_LOAD( "opr-12304.69", 0x30000, 0x10000, CRC(e1762ac3) SHA1(855f06c082a17d90857e6efa3cf95b0eda0e634d) )
1439   ROM_LOAD( "opr-12305.70", 0x40000, 0x10000, CRC(ba9ce677) SHA1(056781f92450c902e1d279a02bda28337815cba9) )
1440   ROM_LOAD( "opr-12306.71", 0x50000, 0x10000, CRC(e49249fd) SHA1(ff36e4dba4e9d3d354e3dd528edeb50ad9c18ee4) )
1441ROM_END
1442
1443
13831444/**************************************************************************************************************************
13841445 **************************************************************************************************************************
13851446 **************************************************************************************************************************
r2864r2865
17591820GAME( 1987, shangon2, shangon,  shangon,  shangon,  shangon3, ROT0, "Sega",    "Super Hang-On (mini ride-on, Rev A, FD1089B 317-0034)", 0 )
17601821GAME( 1987, shangon1, shangon,  shangon,  shangon,  shangon3, ROT0, "Sega",    "Super Hang-On (mini ride-on?, FD1089B 317-0034)", GAME_NOT_WORKING ) /* bad program rom */
17611822GAME( 1991, shangnle, shangon,  shangon,  shangon,  shangon,  ROT0, "Sega",    "Limited Edition Hang-On", 0 )
1762GAME( 1989, toutrun,  0,        outrun,   toutrun, outrun,   ROT0, "Sega",    "Turbo Out Run (Out Run upgrade, FD1094 317-0118)" , 0 )
1823GAME( 1989, toutrun,  0,        outrun,   toutrun1, outrun,   ROT0, "Sega",    "Turbo Out Run (cockpit, FD1094 317-0109)", 0 )
17631824GAME( 1989, toutrun2, toutrun,  outrun,   toutrun1, outrun,   ROT0, "Sega",    "Turbo Out Run (upright, FD1094 317-unknown)", 0 )
17641825GAME( 1989, toutrun1, toutrun,  outrun,   toutrun1, outrun,   ROT0, "Sega",    "Turbo Out Run (cockpit, FD1094 317-unknown)", GAME_NOT_WORKING ) /* FD1094 CPU not decrypted */
1826GAME( 1989, toutrunu, toutrun,  outrun,   toutrun,  outrun,   ROT0, "Sega",    "Turbo Out Run (Out Run upgrade, FD1094 317-0118)" , 0 )
src/mame/drivers/koikoi.c
r2864r2865
7070
7171static READ8_HANDLER(input_r)
7272{
73   if(inputcnt<0){      return 0;   }
73   if(inputcnt<0)
74   {
75      return 0;
76   }
77
7478   if(!inputcnt)
7579   {
76      int key=input_port_read_indexed(machine,2);
80      int key=input_port_read(machine, "IN1");
7781      int keyval=0; //we must return 0 (0x2 in 2nd read) to clear 4 bit at $6600 and allow next read
7882
7983      if(key)
r2864r2865
8488      inputval=inputTab[keyval]&0x1f;
8589      inputlen=inputTab[keyval]>>5;
8690   }
91
8792   if(inputlen==++inputcnt) //return expected value
8893   {
8994      return inputval^0xff;
9095   }
96
9197   if(inputcnt>4) //end of cycle
9298   {
9399      inputcnt=-1;
94100   }
101
95102   return 0xff; //return 0^0xff
96103}
97104
r2864r2865
104111{
105112   if(!offset)
106113   {
107         return input_port_read_indexed(machine, 1)^ioram[4]; //coin
114         return input_port_read(machine, "IN0")^ioram[4]; //coin
108115   }
109116   return 0;
110117}
r2864r2865
121128static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
122129   AM_RANGE(0x0000, 0x2fff) AM_ROM
123130   AM_RANGE(0x6000, 0x67ff) AM_RAM
124   AM_RANGE(0x8000, 0x8000) AM_READ( input_port_0_r )
131   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("DSW")
125132   AM_RANGE(0x7000, 0x77ff) AM_READWRITE(vram_r, vram_w) AM_BASE(&videoram)
126133   AM_RANGE(0x9000, 0x9007) AM_READWRITE(io_r, io_w)
127134ADDRESS_MAP_END
r2864r2865
136143ADDRESS_MAP_END
137144
138145static INPUT_PORTS_START( koikoi )
139   PORT_START   /* DSW */
146   PORT_START_TAG("DSW")   /* DSW */
140147   PORT_DIPNAME( 0x03, 0x01, "Timer C" )
141    PORT_DIPSETTING(    0x00, "50" )
142    PORT_DIPSETTING(    0x01, "70" )
143    PORT_DIPSETTING(    0x02, "90" )
144    PORT_DIPSETTING(    0x03, "110" )
148   PORT_DIPSETTING(   0x00, "50" )
149   PORT_DIPSETTING(   0x01, "70" )
150   PORT_DIPSETTING(   0x02, "90" )
151   PORT_DIPSETTING(   0x03, "110" )
145152
146153   PORT_DIPNAME( 0x0c, 0x04, "Timer M" )
147    PORT_DIPSETTING(    0x00, "120" )
148    PORT_DIPSETTING(    0x04, "150" )
149    PORT_DIPSETTING(    0x08, "180" )
150    PORT_DIPSETTING(    0x0c, "210" )
154   PORT_DIPSETTING(   0x00, "120" )
155   PORT_DIPSETTING(   0x04, "150" )
156   PORT_DIPSETTING(   0x08, "180" )
157   PORT_DIPSETTING(   0x0c, "210" )
151158
152159   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Coin_A ) )
153    PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
154    PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
160   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
161   PORT_DIPSETTING(   0x10, DEF_STR( 1C_2C ) )
155162
156163   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
157   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
158   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
164   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
165   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
159166
160167   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
161   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
162   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
168   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
169   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
163170
164171   PORT_DIPNAME( 0x80, 0x00, "Test Mode" )
165   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
166   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
172   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
173   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
167174
168   PORT_START   /* IN0 */
175   PORT_START_TAG("IN0")   /* IN0 */
169176   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
170177   PORT_BIT( 0xbf, IP_ACTIVE_LOW, IPT_UNUSED )
171178
172   PORT_START   /* IN1 */
179   PORT_START_TAG("IN1")   /* IN1 */
173180   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_A) //1
174181   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_S) //2
175182   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_D) //3
src/mame/drivers/gticlub.c
r2864r2865
3535*/
3636
3737#include "driver.h"
38#include "deprecat.h"
3938#include "machine/eeprom.h"
4039#include "cpu/powerpc/ppc.h"
4140#include "cpu/sharc/sharc.h"
r2864r2865
146145   0            /* reset_delay */
147146};
148147
149static void eeprom_handler(mame_file *file, int read_or_write)
148static void eeprom_handler(running_machine *machine, mame_file *file, int read_or_write)
150149{
151150   if (read_or_write)
152151   {
r2864r2865
168167         UINT8 eepdata[0x200];
169168         memset(eepdata, 0xff, 0x200);
170169
171         if (mame_stricmp(Machine->gamedrv->name, "slrasslt") == 0)
170         if (mame_stricmp(machine->gamedrv->name, "slrasslt") == 0)
172171         {
173172            // magic number
174173            eepdata[0x4] = 0x96;
r2864r2865
211210
212211         switch (adc1038_adr)
213212         {
214            case 0: adc1038_adc_data = input_port_read_indexed(machine, 4); break;
215            case 1: adc1038_adc_data = input_port_read_indexed(machine, 5); break;
216            case 2: adc1038_adc_data = input_port_read_indexed(machine, 6); break;
217            case 3: adc1038_adc_data = input_port_read_indexed(machine, 7); break;
213            case 0: adc1038_adc_data = input_port_read(machine, "AN0"); break;
214            case 1: adc1038_adc_data = input_port_read(machine, "AN1"); break;
215            case 2: adc1038_adc_data = input_port_read(machine, "AN2"); break;
216            case 3: adc1038_adc_data = input_port_read(machine, "AN3"); break;
218217            case 4: adc1038_adc_data = 0x000; break;
219218            case 5: adc1038_adc_data = 0x000; break;
220219            case 6: adc1038_adc_data = 0x000; break;
r2864r2865
256255
257256   switch (adc1038_adr)
258257   {
259      case 0: adc1038_adc_data = input_port_read_indexed(machine, 4); break;
260      case 1: adc1038_adc_data = input_port_read_indexed(machine, 5); break;
261      case 2: adc1038_adc_data = input_port_read_indexed(machine, 6); break;
262      case 3: adc1038_adc_data = input_port_read_indexed(machine, 7); break;
258      case 0: adc1038_adc_data = input_port_read(machine, "AN0"); break;
259      case 1: adc1038_adc_data = input_port_read(machine, "AN1"); break;
260      case 2: adc1038_adc_data = input_port_read(machine, "AN2"); break;
261      case 3: adc1038_adc_data = input_port_read(machine, "AN3"); break;
263262      case 4: adc1038_adc_data = 0x000; break;
264263      case 5: adc1038_adc_data = 0x000; break;
265264      case 6: adc1038_adc_data = 0x000; break;
r2864r2865
275274
276275static READ8_HANDLER( sysreg_r )
277276{
277   static const char *portnames[] = { "IN0", "IN1", "IN2", "IN3" };
278
278279   switch (offset)
279280   {
280281      case 0:
281282      case 1:
282283      case 3:
283         return input_port_read_indexed(machine, offset);
284         return input_port_read(machine, portnames[offset]);
284285
285286      case 2:
286287         return adc1038_sars_r(machine) << 7;
r2864r2865
372373         if (data & 0x20)
373374         {
374375            // Thunder Hurricane breaks otherwise...
375            if (mame_stricmp(Machine->gamedrv->name, "thunderh") != 0)
376            if (mame_stricmp(machine->gamedrv->name, "thunderh") != 0)
376377            {
377               cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ2, ASSERT_LINE);
378               cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ2, ASSERT_LINE);
378379               timer_set(ATTOTIME_IN_USEC(1), NULL, 0, network_irq_clear);
379380            }
380381         }
381382//          else
382//              cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ2, CLEAR_LINE);
383//              cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ2, CLEAR_LINE);
383384         break;
384385      }
385386      case 2:      // Sub ID register
r2864r2865
508509
509510static NVRAM_HANDLER(gticlub)
510511{
511   eeprom_handler(file, read_or_write);
512   eeprom_handler(machine, file, read_or_write);
512513}
513514
514515
515516static INPUT_PORTS_START( gticlub )
516   PORT_START
517   PORT_START_TAG("IN0")
517518   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )      // View switch
518519   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )       // Shift Down
519520   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )      // Shift Up
r2864r2865
521522   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_8)
522523   PORT_BIT( 0x0b, IP_ACTIVE_LOW, IPT_UNKNOWN )
523524
524   PORT_START
525   PORT_START_TAG("IN1")
525526   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
526527
527   PORT_START
528   PORT_START_TAG("IN2")
528529   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
529530
530   PORT_START
531   PORT_START_TAG("IN3")
531532   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
532533   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
533534   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
544545   PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
545546   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
546547
547   PORT_START /* mask default type                     sens delta min max */
548   PORT_START_TAG("AN0")   /* mask default type             sens delta min max */
548549   PORT_BIT( 0x3ff, 0x200, IPT_PADDLE ) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
549550
550   PORT_START
551   PORT_START_TAG("AN1")
551552   PORT_BIT( 0x3ff, 0x000, IPT_PEDAL ) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
552553
553   PORT_START
554   PORT_START_TAG("AN2")
554555   PORT_BIT( 0x3ff, 0x000, IPT_PEDAL2 ) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
555556
556   PORT_START
557   PORT_START_TAG("AN3")
557558   PORT_BIT( 0x3ff, 0x000, IPT_PEDAL3 ) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
558559
559560INPUT_PORTS_END
560561
561562static INPUT_PORTS_START( slrasslt )
562   PORT_START
563   PORT_START_TAG("IN0")
563564   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )                  // View Shift
564565   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)      // Trigger
565566   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)      // Missile
566567   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)      // Power Up
567568
568   PORT_START
569   PORT_START_TAG("IN1")
569570   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
570571   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
571572   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
572573   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
573574
574   PORT_START
575   PORT_START_TAG("IN2")
575576   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
576577
577   PORT_START
578   PORT_START_TAG("IN3")
578579   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
579580   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_8)
580581   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
592593   PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
593594   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
594595
595   PORT_START
596   PORT_START_TAG("AN0")
596597   PORT_BIT( 0x3ff, 0x000, IPT_AD_STICK_Y ) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
597598
598   PORT_START
599   PORT_START_TAG("AN1")
599600   PORT_BIT( 0x3ff, 0x000, IPT_AD_STICK_X ) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5) PORT_REVERSE
600601
601602INPUT_PORTS_END
602603
603604static INPUT_PORTS_START( thunderh )
604   PORT_START
605   PORT_START_TAG("IN0")
605606   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
606607   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
607608   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
611612   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
612613   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
613614
614   PORT_START
615   PORT_START_TAG("IN1")
615616   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
616617   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
617618   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
621622   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
622623   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
623624
624   PORT_START
625   PORT_START_TAG("IN2")
625626   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
626627
627   PORT_START
628   PORT_START_TAG("IN3")
628629   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
629630   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_8)
630631   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
645646INPUT_PORTS_END
646647
647648static INPUT_PORTS_START( hangplt )
648   PORT_START
649   PORT_START_TAG("IN0")
649650   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
650651   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
651652   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
653654   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
654655   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_UNKNOWN )
655656
656   PORT_START
657   PORT_START_TAG("IN1")
657658   PORT_BIT( 0x8f, IP_ACTIVE_LOW, IPT_UNKNOWN )
658659   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)      // Push limit switch
659660   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)      // Pull limit switch
660661
661   PORT_START
662   PORT_START_TAG("IN2")
662663   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
663664
664   PORT_START
665   PORT_START_TAG("IN3")
665666   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
666667   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_8)
667668   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
src/mame/drivers/foodf.c
r2864r2865
202202
203203static READ16_HANDLER( analog_r )
204204{
205   return input_port_read_indexed(machine, whichport);
205   static const char *portnames[] = { "STICK0_X", "STICK1_X", "STICK0_Y", "STICK1_Y" };
206
207   return input_port_read(machine, portnames[whichport]);
206208}
207209
208210
r2864r2865
262264 *************************************/
263265
264266static INPUT_PORTS_START( foodf )
265   PORT_START   /* IN0 */
267   PORT_START_TAG("STICK0_X")   /* IN0 */
266268   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1)
267269
268   PORT_START   /* IN1 */
270   PORT_START_TAG("STICK1_X")   /* IN1 */
269271   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
270272
271   PORT_START   /* IN2 */
273   PORT_START_TAG("STICK0_Y")   /* IN2 */
272274   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1)
273275
274   PORT_START   /* IN3 */
276   PORT_START_TAG("STICK1_Y")   /* IN3 */
275277   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
276278
277   PORT_START   /* IN4 */
279   PORT_START_TAG("IN0")   /* IN4 */
278280   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
279281   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
280282   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
r2864r2865
284286   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
285287   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
286288
287   PORT_START   /* SW1 */
289   PORT_START_TAG("DSW")   /* SW1 */
288290   PORT_DIPNAME( 0x07, 0x00, "Bonus Coins" )
289291   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
290292   PORT_DIPSETTING(    0x05, "1 for every 2" )
r2864r2865
353355
354356static READ8_HANDLER( pot_r )
355357{
356   return (input_port_read_indexed(machine, 5) >> offset) << 7;
358   return (input_port_read(machine, "DSW") >> offset) << 7;
357359}
358360
359361static const struct POKEYinterface pokey_interface =
src/mame/drivers/armedf.c
r2864r2865
1515Armed Formation
1616(c)1988 Nichibutsu
1717
18Based on the notes below I suspect several of the supported sets are
19actually bootlegs.
20
182168000 + Z80
1922
2023TODO:
2124- simulate the mcu/blitter (particularly needed in terrafu and legion)
25   -- or figure out which chip it is, decap it, and emulate it.
2226
2327
28
29
2430Stephh's notes (based on the games M68000 code and some tests) :
2531
26321a) 'legion'
r2864r2865
201207   /* bit 12 seems to handle screen flipping */
202208   flip_screen_set(armedf_vreg & 0x1000);
203209
210
204211   if ((armedf_vreg & 0x4000) && !(armedf_vreg & 0x0100))
205212   {
206213      int i;
r2864r2865
212219      //logerror("vreg WIPE TX\n");
213220   }
214221   //logerror("VReg = %04x\n", armedf_vreg);
222
215223}
216224
217225static WRITE16_HANDLER( kodure_io_w )
r2864r2865
273281   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(terraf_fg_scroll_msb_arm_w)   /* written between two consecutive writes to 7c008 */
274282ADDRESS_MAP_END
275283
284/* the same for now */
285static ADDRESS_MAP_START( terrafb_map, ADDRESS_SPACE_PROGRAM, 16 )
286   AM_RANGE(0x000000, 0x04ffff) AM_ROM
287   AM_RANGE(0x060000, 0x0603ff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
288   AM_RANGE(0x060400, 0x063fff) AM_RAM
289   AM_RANGE(0x064000, 0x064fff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_BASE(&paletteram16)
290   AM_RANGE(0x068000, 0x069fff) AM_RAM_WRITE(armedf_text_videoram_w) AM_BASE(&terraf_text_videoram)
291   AM_RANGE(0x06a000, 0x06a9ff) AM_RAM
292   AM_RANGE(0x06c000, 0x06c9ff) AM_RAM
293   AM_RANGE(0x070000, 0x070fff) AM_RAM_WRITE(armedf_fg_videoram_w) AM_BASE(&armedf_fg_videoram)
294   AM_RANGE(0x074000, 0x074fff) AM_RAM_WRITE(armedf_bg_videoram_w) AM_BASE(&armedf_bg_videoram)
295   AM_RANGE(0x078000, 0x078001) AM_READ(input_port_0_word_r)
296   AM_RANGE(0x078002, 0x078003) AM_READ(input_port_1_word_r)
297   AM_RANGE(0x078004, 0x078005) AM_READ(input_port_2_word_r)
298   AM_RANGE(0x078006, 0x078007) AM_READ(input_port_3_word_r)
299   AM_RANGE(0x07c000, 0x07c001) AM_WRITE(terraf_io_w)
300   AM_RANGE(0x07c002, 0x07c003) AM_WRITE(armedf_bg_scrollx_w)
301   AM_RANGE(0x07c004, 0x07c005) AM_WRITE(armedf_bg_scrolly_w)
302   AM_RANGE(0x07c006, 0x07c007) AM_WRITE(terraf_fg_scrollx_w)         /* not use in terrafu, 0x07c008 neither */
303   AM_RANGE(0x07c008, 0x07c009) AM_WRITE(terraf_fg_scrolly_w)         /* written twice, lsb and msb */
304   AM_RANGE(0x07c00a, 0x07c00b) AM_WRITE(sound_command_w)
305   AM_RANGE(0x07c00c, 0x07c00d) AM_WRITE(SMH_NOP)               /* Watchdog ? cycle 0000 -> 0100 -> 0200 back to 0000 */
306   AM_RANGE(0x07c00e, 0x07c00f) AM_WRITE(armedf_mcu_cmd)            /* MCU Command ? */
307   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(terraf_fg_scroll_msb_arm_w)   /* written between two consecutive writes to 7c008 */
308ADDRESS_MAP_END
309
276310static ADDRESS_MAP_START( kodure_map, ADDRESS_SPACE_PROGRAM, 16 )
277311   AM_RANGE(0x000000, 0x05ffff) AM_ROM
278312   AM_RANGE(0x060000, 0x060fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
r2864r2865
399433   AM_RANGE(0xc000, 0xffff) AM_RAM
400434ADDRESS_MAP_END
401435
436
437static ADDRESS_MAP_START( terrafb_extraz80_map, ADDRESS_SPACE_PROGRAM, 8 )
438   AM_RANGE(0x0000, 0x3fff) AM_ROM
439ADDRESS_MAP_END
440
441static ADDRESS_MAP_START( terrafb_extraz80_portmap, ADDRESS_SPACE_IO, 8 )
442   ADDRESS_MAP_GLOBAL_MASK(0xff)
443ADDRESS_MAP_END
444
445
402446static READ8_HANDLER( soundlatch_clear_r )
403447{
404448   soundlatch_clear_w(machine,0,0);
r2864r2865
749793   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
750794MACHINE_DRIVER_END
751795
796static MACHINE_DRIVER_START( terrafb )
797
798   /* basic machine hardware */
799   MDRV_CPU_ADD(M68000, 8000000) /* 8 MHz?? */
800   MDRV_CPU_PROGRAM_MAP(terrafb_map,0)
801   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
802
803   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz???? */
804   MDRV_CPU_PROGRAM_MAP(sound_map,0)
805   MDRV_CPU_IO_MAP(sound_portmap,0)
806   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)
807
808   MDRV_CPU_ADD(Z80, 3072000)   /* 3.072 MHz???? */
809   MDRV_CPU_PROGRAM_MAP(terrafb_extraz80_map,0)
810   MDRV_CPU_IO_MAP(terrafb_extraz80_portmap,0)
811   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,128)
812
813
814   /* video hardware */
815   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
816
817   MDRV_SCREEN_ADD("main", RASTER)
818   MDRV_SCREEN_REFRESH_RATE(57)
819   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
820   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
821   MDRV_SCREEN_SIZE(64*8, 32*8)
822   MDRV_SCREEN_VISIBLE_AREA(12*8, (64-12)*8-1, 1*8, 31*8-1 )
823   MDRV_GFXDECODE(armedf)
824   MDRV_PALETTE_LENGTH(2048)
825
826   MDRV_VIDEO_EOF(armedf)
827   MDRV_VIDEO_START(armedf)
828   MDRV_VIDEO_UPDATE(armedf)
829
830   /* sound hardware */
831   MDRV_SPEAKER_STANDARD_MONO("mono")
832
833   MDRV_SOUND_ADD(YM3812, 4000000)
834   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
835
836   MDRV_SOUND_ADD(DAC, 0)
837   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
838
839   MDRV_SOUND_ADD(DAC, 0)
840   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
841MACHINE_DRIVER_END
842
752843static MACHINE_DRIVER_START( kodure )
753844
754845   /* basic machine hardware */
r2864r2865
10531144   ROM_LOAD( "n82s129an.11j", 0x0000, 0x0100, CRC(81244757) SHA1(6324f63e571f0f7a0bb9eb97f9994809db79493f) ) /* N82S129AN or compatible labled "TF" */
10541145ROM_END
10551146
1147/*
1148
1149CPU
1150
1151Main cpu 68000,Z80B*
1152Sound cpu Z80
1153Sound ic ym3812
1154Osc 16 and 24 Mhz
1155
1156Note:
1157
1158The custom mcu of original was been replaced by a small daughterboard inversely
1159connected to the main cpu board.It has a Z80B*,which uses 2kb of ram (6116 SRAM x1),
1160and some standard TTL ics.
1161
1162ROMs
1163
1164tfb-1 to 3 and tfb-6 to 8 main program
1165tfb-10 Z80B* program (mcu hack)
1166the rest of roms (sound program and gfx data) are the same of existing set
1167
1168All roms are 24128,24256,27512
1169Note
1170
1171This romset comes from a bootleg/hacked pcb.Game differences from original are:
1172Company logo and copyright string removed.
1173
1174*/
1175
1176
1177ROM_START( terrafb )
1178   ROM_REGION( 0x50000, REGION_CPU1, 0 )   /* 64K*8 for 68000 code */
1179   ROM_LOAD16_BYTE( "tfb-8.bin", 0x00000, 0x10000, CRC(b11a6fa7) SHA1(7bb2b98be02d8913796a6d4fa20eed16226ce6b9) )
1180   ROM_LOAD16_BYTE( "tfb-3.bin", 0x00001, 0x10000, CRC(6c6aa7ed) SHA1(ee5fdeb5411034ce0fd1c883ee25bf1fe9a3ec52) )
1181   ROM_LOAD16_BYTE( "tfb-7.bin", 0x20000, 0x10000, CRC(fde8de7e) SHA1(6b0d27ec49c8c0609c110ad97938bec8c077ad18) )
1182   ROM_LOAD16_BYTE( "tfb-2.bin", 0x20001, 0x10000, CRC(db987414) SHA1(0a1734794c626cf9083d7854c9000c5daadfc3fd) )
1183   ROM_LOAD16_BYTE( "tfb-6.bin", 0x40000, 0x08000, CRC(1de681a1) SHA1(bddf404988226698d65e075b4c21de736a862df1) )
1184   ROM_LOAD16_BYTE( "tfb-1.bin", 0x40001, 0x08000, CRC(6a0b94c7) SHA1(55fb32ab859bf51a1c79bf962bb677fa557216ed) )
1185
1186   ROM_REGION( 0x10000, REGION_CPU2, 0 )   /* Z80 code (sound) */
1187   ROM_LOAD( "tf-001.17k", 0x00000, 0x10000, CRC(eb6b4138) SHA1(04c53bf46d87a156d3fad86f051985d0df79bd20) )
1188
1189   ROM_REGION( 0x4000, REGION_CPU3, 0 )   /* z80 program (replacement mcu/blitter) */
1190   ROM_LOAD( "tfb-10.bin", 0x0000, 0x4000, CRC(3f9aa367) SHA1(8278fb357b2d68869e39efa01ff19005807b41f8) )
1191
1192   ROM_REGION( 0x08000, REGION_GFX1, ROMREGION_DISPOSE )
1193   ROM_LOAD( "9.11e", 0x00000, 0x08000, CRC(bc6f7cbc) SHA1(20b8a34de4bfa0c2fdcd2f7743a0ab35141f4bf9) ) /* characters */
1194
1195   ROM_REGION( 0x20000, REGION_GFX2, ROMREGION_DISPOSE )
1196   ROM_LOAD( "5.15h", 0x00000, 0x10000, CRC(25d23dfd) SHA1(da32895c1aca403209b7fb181fa4fa23a8e74d32) ) /* foreground tiles */
1197   ROM_LOAD( "4.13h", 0x10000, 0x10000, CRC(b9b0fe27) SHA1(983c48239ba1524b517f89f281f2b70564bea1e9) )
1198
1199   ROM_REGION( 0x20000, REGION_GFX3, ROMREGION_DISPOSE )
1200   ROM_LOAD( "15.8a", 0x00000, 0x10000, CRC(2144d8e0) SHA1(ed89da11abf3d79753b478603009970c2600ab60) ) /* background tiles */
1201   ROM_LOAD( "14.6a", 0x10000, 0x10000, CRC(744f5c9e) SHA1(696223a087bb575c7cfaba11e682b221ada461e4) )
1202
1203   ROM_REGION( 0x20000, REGION_GFX4, ROMREGION_DISPOSE )
1204   ROM_LOAD( "tf-003.7d", 0x00000, 0x10000, CRC(d74085a1) SHA1(3f6ba85dbd6e48a502c115b2d322a586fc4f56c9) ) /* sprites */
1205   ROM_LOAD( "tf-002.9d", 0x10000, 0x10000, CRC(148aa0c5) SHA1(8d8a565540e91b384a9c154522501921b7da4d4e) )
1206
1207
1208   ROM_REGION( 0x0100, REGION_PROMS, 0 )   /* Unknown use */
1209   ROM_LOAD( "n82s129an.11j", 0x0000, 0x0100, CRC(81244757) SHA1(6324f63e571f0f7a0bb9eb97f9994809db79493f) ) /* N82S129AN or compatible labled "TF" */
1210ROM_END
1211
1212
10561213ROM_START( terrafu )
10571214   ROM_REGION( 0x50000, REGION_CPU1, 0 )   /* 64K*8 for 68000 code */
10581215   ROM_LOAD16_BYTE( "tf-8.6e", 0x00000, 0x10000, CRC(fea6dd64) SHA1(682eae338ce14808f134897f594fae1c69e75a1a) )
r2864r2865
13091466GAME( 1987, legion,   0,        legion,   legion,   legion,   ROT270, "Nichibutsu",     "Chouji Meikyuu Legion (ver 2.03)",               GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION )
13101467GAME( 1987, legiono,  legion,   legiono,  legion,   legiono,  ROT270, "Nichibutsu",     "Chouji Meikyuu Legion (ver 1.05)",               GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION )
13111468GAME( 1987, terraf,   0,        terraf,   terraf,   terraf,   ROT0,   "Nichibutsu",     "Terra Force (set 1)",             GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION )
1469GAME( 1987, terrafb,  terraf,   terrafb,  terraf,   terrafu,  ROT0,   "bootleg",     "Terra Force (bootleg with additional Z80)",GAME_NOT_WORKING )
13121470GAME( 1987, terrafa,  terraf,   terraf,   terraf,   terrafu,  ROT0,   "Nichibutsu",     "Terra Force (set 2)",             GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION )
13131471GAME( 1987, terrafu,  terraf,   terraf,   terraf,   terrafu,  ROT0,   "Nichibutsu USA", "Terra Force (US)",                GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION )
13141472GAME( 1987, kodure,   0,        kodure,   kodure,   kodure,   ROT0,   "Nichibutsu",     "Kodure Ookami (Japan)",           GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION )
src/mame/drivers/ddenlovr.c
r2864r2865
13071307
13081308static READ16_HANDLER( ddenlovr_special_r )
13091309{
1310   int res = input_port_read_indexed(machine, 2) | (ddenlovr_blitter_irq_flag << 6);
1310   int res = input_port_read(machine, "IN2") | (ddenlovr_blitter_irq_flag << 6);
13111311
13121312   return res;
13131313}
r2864r2865
14881488   /* 0 and 1 are read from offset 1, 2 from offset 0... */
14891489   switch( ddenlovr_select2 )
14901490   {
1491      case 0x00:   return input_port_read_indexed(machine, 0);
1492      case 0x01:   return input_port_read_indexed(machine, 1);
1493      case 0x02:   return input_port_read_indexed(machine, 2);
1491      case 0x00:   return input_port_read(machine, "IN0");
1492      case 0x01:   return input_port_read(machine, "IN1");
1493      case 0x02:   return input_port_read(machine, "IN2");
14941494   }
14951495   return 0xff;
14961496}
r2864r2865
14981498
14991499static READ8_HANDLER( quiz365_input_r )
15001500{
1501   if (!(ddenlovr_select & 0x01))   return input_port_read_indexed(machine, 3);
1502   if (!(ddenlovr_select & 0x02))   return input_port_read_indexed(machine, 4);
1503   if (!(ddenlovr_select & 0x04))   return input_port_read_indexed(machine, 5);
1501   if (!(ddenlovr_select & 0x01))   return input_port_read(machine, "DSW1");
1502   if (!(ddenlovr_select & 0x02))   return input_port_read(machine, "DSW2");
1503   if (!(ddenlovr_select & 0x04))   return input_port_read(machine, "DSW3");
15041504   if (!(ddenlovr_select & 0x08))   return 0xff;//mame_rand(machine);
15051505   if (!(ddenlovr_select & 0x10))   return 0xff;//mame_rand(machine);
15061506   return 0xff;
r2864r2865
15121512   /* 0 and 1 are read from offset 1, 2 from offset 0... */
15131513   switch( ddenlovr_select2 )
15141514   {
1515      case 0x10:   return input_port_read_indexed(machine, 0);
1516      case 0x11:   return input_port_read_indexed(machine, 1);
1517      case 0x12:   return input_port_read_indexed(machine, 2) | (ddenlovr_blitter_irq_flag << 6);
1515      case 0x10:   return input_port_read(machine, "IN0");
1516      case 0x11:   return input_port_read(machine, "IN1");
1517      case 0x12:   return input_port_read(machine, "IN2") | (ddenlovr_blitter_irq_flag << 6);
15181518   }
15191519   return 0xff;
15201520}
r2864r2865
16171617static READ16_HANDLER( ddenlvrj_dsw_r )
16181618{
16191619   UINT16 dsw = 0;
1620   if ((~*ddenlvrj_dsw_sel) & 0x01)   dsw |= input_port_read_indexed(machine, 3);   // dsw 1
1621   if ((~*ddenlvrj_dsw_sel) & 0x02)   dsw |= input_port_read_indexed(machine, 4);   // dsw 2
1622   if ((~*ddenlvrj_dsw_sel) & 0x04)   dsw |= input_port_read_indexed(machine, 5);   // ?
1620   if ((~*ddenlvrj_dsw_sel) & 0x01)   dsw |= input_port_read(machine, "DSW1");   // dsw 1
1621   if ((~*ddenlvrj_dsw_sel) & 0x02)   dsw |= input_port_read(machine, "DSW2");   // dsw 2
1622   if ((~*ddenlvrj_dsw_sel) & 0x04)   dsw |= input_port_read(machine, "DSW3");   // ?
16231623   return dsw;
16241624}
16251625
r2864r2865
16351635
16361636static READ16_HANDLER( ddenlvrj_blitter_r )
16371637{
1638   return input_port_read_indexed(machine, 2) | (ddenlovr_blitter_irq_flag ? 0x60 : 0x00 );   // bit 4 = 1 -> blitter busy
1638   return input_port_read(machine, "IN2") | (ddenlovr_blitter_irq_flag ? 0x60 : 0x00 );   // bit 4 = 1 -> blitter busy
16391639}
16401640
16411641static ADDRESS_MAP_START( ddenlvrj_readmem, ADDRESS_SPACE_PROGRAM, 16 )
r2864r2865
17201720
17211721static READ16_HANDLER( nettoqc_special_r )
17221722{
1723   return input_port_read_indexed(machine, 2) | (ddenlovr_blitter_irq_flag ? 0x60 : 0x00 );
1723   return input_port_read(machine, "IN2") | (ddenlovr_blitter_irq_flag ? 0x60 : 0x00 );
17241724}
17251725
17261726static READ16_HANDLER( nettoqc_input_r )
17271727{
1728   if (!(ddenlovr_select & 0x01))   return input_port_read_indexed(machine, 3);
1729   if (!(ddenlovr_select & 0x02))   return input_port_read_indexed(machine, 4);
1730   if (!(ddenlovr_select & 0x04))   return input_port_read_indexed(machine, 5);
1728   if (!(ddenlovr_select & 0x01))   return input_port_read(machine, "DSW1");
1729   if (!(ddenlovr_select & 0x02))   return input_port_read(machine, "DSW2");
1730   if (!(ddenlovr_select & 0x04))   return input_port_read(machine, "DSW3");
17311731   return 0xffff;
17321732}
17331733
r2864r2865
18121812
18131813static READ8_HANDLER( rongrong_input_r )
18141814{
1815   if (!(ddenlovr_select & 0x01))   return input_port_read_indexed(machine, 3);
1816   if (!(ddenlovr_select & 0x02))   return input_port_read_indexed(machine, 4);
1815   if (!(ddenlovr_select & 0x01))   return input_port_read(machine, "DSW1");
1816   if (!(ddenlovr_select & 0x02))   return input_port_read(machine, "DSW2");
18171817   if (!(ddenlovr_select & 0x04))   return 0xff;//mame_rand(machine);
18181818   if (!(ddenlovr_select & 0x08))   return 0xff;//mame_rand(machine);
1819   if (!(ddenlovr_select & 0x10))   return input_port_read_indexed(machine, 5);
1819   if (!(ddenlovr_select & 0x10))   return input_port_read(machine, "DSW3");
18201820   return 0xff;
18211821}
18221822
r2864r2865
20172017   AM_RANGE(0x38, 0x38) AM_READ(unk_r               )   // ? must be 78 on startup
20182018   AM_RANGE(0x58, 0x58) AM_READ(unk_r               )   // ? must be 78 on startup
20192019   AM_RANGE(0x63, 0x63) AM_READ(rongrong_gfxrom_r      )   // Video Chip
2020   AM_RANGE(0x6a, 0x6a) AM_READ(input_port_0_r         )
2021   AM_RANGE(0x6b, 0x6b) AM_READ(input_port_1_r         )
2020   AM_RANGE(0x6a, 0x6a) AM_READ_PORT("IN0")
2021   AM_RANGE(0x6b, 0x6b) AM_READ_PORT("IN1")
20222022   AM_RANGE(0x6c, 0x6d) AM_READ(mmpanic_link_r         )   // Other cabinets?
20232023   AM_RANGE(0x7c, 0x7c) AM_READ(OKIM6295_status_0_r   )   // Sound
2024   AM_RANGE(0x94, 0x94) AM_READ(input_port_2_r         )   // DSW 1
2025   AM_RANGE(0x98, 0x98) AM_READ(input_port_3_r         )   // DSW 2
2026   AM_RANGE(0x9c, 0x9c) AM_READ(input_port_4_r         )   // DSW 1&2 high bits
2024   AM_RANGE(0x94, 0x94) AM_READ_PORT("DSW1")            // DSW 1
2025   AM_RANGE(0x98, 0x98) AM_READ_PORT("DSW2")            // DSW 2
2026   AM_RANGE(0x9c, 0x9c) AM_READ_PORT("DSW3")            // DSW 1&2 high bits
20272027ADDRESS_MAP_END
20282028
20292029static ADDRESS_MAP_START( mmpanic_writeport, ADDRESS_SPACE_IO, 8 )
r2864r2865
21352135
21362136static READ8_HANDLER( funkyfig_dsw_r )
21372137{
2138   if (!(ddenlovr_select & 0x01))   return input_port_read_indexed(machine, 3);
2139   if (!(ddenlovr_select & 0x02))   return input_port_read_indexed(machine, 4);
2140   if (!(ddenlovr_select & 0x04))   return input_port_read_indexed(machine, 5);
2138   if (!(ddenlovr_select & 0x01))   return input_port_read(machine, "DSW1");
2139   if (!(ddenlovr_select & 0x02))   return input_port_read(machine, "DSW2");
2140   if (!(ddenlovr_select & 0x04))   return input_port_read(machine, "DSW3");
21412141   logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", activecpu_get_pc(), ddenlovr_select);
21422142   return 0xff;
21432143}
r2864r2865
21482148{
21492149   switch( ddenlovr_select2 )
21502150   {
2151      case 0x22:   return input_port_read_indexed(machine, 2);
2151      case 0x22:   return input_port_read(machine, "IN2");
21522152      case 0x23:   return funkyfig_lockout;
21532153   }
21542154   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", activecpu_get_pc(), ddenlovr_select2);
r2864r2865
21592159{
21602160   switch( ddenlovr_select2 )
21612161   {
2162      case 0x20:   return input_port_read_indexed(machine, 0);
2163      case 0x21:   return input_port_read_indexed(machine, 1);
2162      case 0x20:   return input_port_read(machine, "IN0");
2163      case 0x21:   return input_port_read(machine, "IN1");
21642164   }
21652165   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", activecpu_get_pc(), ddenlovr_select2);
21662166   return 0xff;
r2864r2865
22702270{
22712271   UINT8 val = 0xff;
22722272
2273   if      (!(keyb & 0x01))   val = input_port_read_indexed(machine, offset * 5 + 1);
2274   else if (!(keyb & 0x02))   val = input_port_read_indexed(machine, offset * 5 + 2);
2275   else if (!(keyb & 0x04))   val = input_port_read_indexed(machine, offset * 5 + 3);
2276   else if (!(keyb & 0x08))   val = input_port_read_indexed(machine, offset * 5 + 4);
2277   else if (!(keyb & 0x10))   val = input_port_read_indexed(machine, offset * 5 + 5);
2273   if      (!(keyb & 0x01))   val = input_port_read(machine, offset ? "KEY5" : "KEY0");
2274   else if (!(keyb & 0x02))   val = input_port_read(machine, offset ? "KEY6" : "KEY1");
2275   else if (!(keyb & 0x04))   val = input_port_read(machine, offset ? "KEY7" : "KEY2");
2276   else if (!(keyb & 0x08))   val = input_port_read(machine, offset ? "KEY8" : "KEY3");
2277   else if (!(keyb & 0x10))   val = input_port_read(machine, offset ? "KEY9" : "KEY4");
22782278
2279   val |= input_port_read_indexed(machine, 16 + offset);
2279   val |= input_port_read(machine, offset ? "HOPPER" : "BET");
22802280   return val;
22812281}
22822282
22832283static READ8_HANDLER( hanakanz_dsw_r )
22842284{
2285   if (!(dsw & 0x01))   return input_port_read_indexed(machine, 11);
2286   if (!(dsw & 0x02))   return input_port_read_indexed(machine, 12);
2287   if (!(dsw & 0x04))   return input_port_read_indexed(machine, 13);
2288   if (!(dsw & 0x08))   return input_port_read_indexed(machine, 14);
2289   if (!(dsw & 0x10))   return input_port_read_indexed(machine, 15);
2285   if (!(dsw & 0x01))   return input_port_read(machine, "DSW1");
2286   if (!(dsw & 0x02))   return input_port_read(machine, "DSW2");
2287   if (!(dsw & 0x04))   return input_port_read(machine, "DSW3");
2288   if (!(dsw & 0x08))   return input_port_read(machine, "DSW4");
2289   if (!(dsw & 0x10))   return input_port_read(machine, "DSW5");
22902290   return 0xff;
22912291}
22922292
r2864r2865
23762376   AM_RANGE(0x2c, 0x2c) AM_READ( hanakanz_busy_r         )
23772377   AM_RANGE(0x32, 0x32) AM_READ( hanakanz_dsw_r         )
23782378   AM_RANGE(0x83, 0x84) AM_READ( hanakanz_gfxrom_r         )
2379   AM_RANGE(0x90, 0x90) AM_READ( input_port_0_r         )
2379   AM_RANGE(0x90, 0x90) AM_READ_PORT("IN0")
23802380   AM_RANGE(0x91, 0x92) AM_READ( hanakanz_keyb_r         )
23812381   AM_RANGE(0x96, 0x96) AM_READ( hanakanz_rand_r         )
23822382   AM_RANGE(0xc0, 0xc0) AM_READ( OKIM6295_status_0_r      )
r2864r2865
24032403   AM_RANGE(0x2c, 0x2c) AM_READ( hanakanz_busy_r         )
24042404   AM_RANGE(0x32, 0x32) AM_READ( hanakanz_dsw_r         )
24052405   AM_RANGE(0x83, 0x84) AM_READ( hanakanz_gfxrom_r         )
2406   AM_RANGE(0xb0, 0xb0) AM_READ( input_port_0_r         )
2406   AM_RANGE(0xb0, 0xb0) AM_READ_PORT("IN0")
24072407   AM_RANGE(0xb1, 0xb2) AM_READ( hanakanz_keyb_r         )
24082408   AM_RANGE(0xb6, 0xb6) AM_READ( hanakanz_rand_r         )
24092409   AM_RANGE(0xc0, 0xc0) AM_READ( OKIM6295_status_0_r      )
r2864r2865
24442444   AM_RANGE(0x83, 0x84) AM_READ( hanakanz_gfxrom_r         )
24452445   AM_RANGE(0x92, 0x92) AM_READ( hanakanz_rand_r         )
24462446   AM_RANGE(0x93, 0x93) AM_READ( mjreach1_protection_r      )
2447   AM_RANGE(0x94, 0x94) AM_READ( input_port_0_r         )
2447   AM_RANGE(0x94, 0x94) AM_READ_PORT("IN0")
24482448   AM_RANGE(0x95, 0x96) AM_READ( hanakanz_keyb_r         )
24492449   AM_RANGE(0xc0, 0xc0) AM_READ( OKIM6295_status_0_r      )
24502450   AM_RANGE(0xe0, 0xef) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
r2864r2865
24752475{
24762476   UINT8 val = 0xff;
24772477
2478   if      (!(keyb & 0x01))   val = input_port_read_indexed(machine, offset * 5 + 1);
2479   else if (!(keyb & 0x02))   val = input_port_read_indexed(machine, offset * 5 + 2);
2480   else if (!(keyb & 0x04))   val = input_port_read_indexed(machine, offset * 5 + 3);
2481   else if (!(keyb & 0x08))   val = input_port_read_indexed(machine, offset * 5 + 4);
2482   else if (!(keyb & 0x10))   val = input_port_read_indexed(machine, offset * 5 + 5);
2478   if      (!(keyb & 0x01))   val = input_port_read(machine, offset ? "KEY5" : "KEY0");
2479   else if (!(keyb & 0x02))   val = input_port_read(machine, offset ? "KEY6" : "KEY1");
2480   else if (!(keyb & 0x04))   val = input_port_read(machine, offset ? "KEY7" : "KEY2");
2481   else if (!(keyb & 0x08))   val = input_port_read(machine, offset ? "KEY8" : "KEY3");
2482   else if (!(keyb & 0x10))   val = input_port_read(machine, offset ? "KEY9" : "KEY4");
24832483
2484   val |= input_port_read_indexed(machine, 16 + offset);
2484   val |= input_port_read(machine, offset ? "HOPPER" : "BET");
24852485   if (offset)   val |= 0x80;   // blitter busy
24862486   return val;
24872487}
r2864r2865
25732573static ADDRESS_MAP_START( mjchuuka_readport, ADDRESS_SPACE_IO, 8 )   // 16 bit I/O
25742574   AM_RANGE(0x13, 0x13) AM_MIRROR(0xff00) AM_READ( hanakanz_rand_r         )
25752575   AM_RANGE(0x23, 0x23) AM_MIRROR(0xff00) AM_READ( mjchuuka_gfxrom_0_r      )
2576   AM_RANGE(0x42, 0x42) AM_MIRROR(0xff00) AM_READ( input_port_0_r         )
2576   AM_RANGE(0x42, 0x42) AM_MIRROR(0xff00) AM_READ_PORT("IN0")
25772577   AM_RANGE(0x43, 0x44) AM_MIRROR(0xff00) AM_READ( mjchuuka_keyb_r         )
25782578   AM_RANGE(0x45, 0x45) AM_MIRROR(0xff00) AM_READ( mjchuuka_gfxrom_1_r      )
2579   AM_RANGE(0x60, 0x60) AM_MIRROR(0xff00) AM_READ( input_port_11_r         )   // DSW 1
2580   AM_RANGE(0x61, 0x61) AM_MIRROR(0xff00) AM_READ( input_port_12_r         )   // DSW 2
2581   AM_RANGE(0x62, 0x62) AM_MIRROR(0xff00) AM_READ( input_port_13_r         )   // DSW 3
2582   AM_RANGE(0x63, 0x63) AM_MIRROR(0xff00) AM_READ( input_port_14_r         )   // DSW 4
2583   AM_RANGE(0x64, 0x64) AM_MIRROR(0xff00) AM_READ( input_port_15_r         )   // DSW 1-4 high bits
2579   AM_RANGE(0x60, 0x60) AM_MIRROR(0xff00) AM_READ_PORT("DSW1")               // DSW 1
2580   AM_RANGE(0x61, 0x61) AM_MIRROR(0xff00) AM_READ_PORT("DSW2")               // DSW 2
2581   AM_RANGE(0x62, 0x62) AM_MIRROR(0xff00) AM_READ_PORT("DSW3")               // DSW 3
2582   AM_RANGE(0x63, 0x63) AM_MIRROR(0xff00) AM_READ_PORT("DSW4")               // DSW 4
2583   AM_RANGE(0x64, 0x64) AM_MIRROR(0xff00) AM_READ_PORT("DSW5")               // DSW 1-4 high bits
25842584   AM_RANGE(0x80, 0x80) AM_MIRROR(0xff00) AM_READ( OKIM6295_status_0_r      )
25852585   AM_RANGE(0xc0, 0xcf) AM_MIRROR(0xff00) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
25862586ADDRESS_MAP_END
r2864r2865
26372637{
26382638   switch( ddenlovr_select2 )
26392639   {
2640      case 0x00:   return input_port_read_indexed(machine, 0);
2640      case 0x00:   return input_port_read(machine, "IN0");
26412641      case 0x01:   return 0xff;
26422642      case 0x02:   return 0xff;   // bit 7 = 0 -> blitter busy, + hopper switch
26432643      case 0x03:   return 0xff;
r2864r2865
26522652{
26532653   UINT8 ret = 0xff;
26542654
2655   if      (keyb & 0x01)   ret = input_port_read_indexed(machine, 1);
2656   else if   (keyb & 0x02)   ret = input_port_read_indexed(machine, 2);
2657   else if   (keyb & 0x04)   ret = input_port_read_indexed(machine, 3);
2658   else if   (keyb & 0x08)   ret = input_port_read_indexed(machine, 4);
2659   else if   (keyb & 0x10)   ret = input_port_read_indexed(machine, 5);
2655   if      (keyb & 0x01)   ret = input_port_read(machine, "KEY0");
2656   else if   (keyb & 0x02)   ret = input_port_read(machine, "KEY1");
2657   else if   (keyb & 0x04)   ret = input_port_read(machine, "KEY2");
2658   else if   (keyb & 0x08)   ret = input_port_read(machine, "KEY3");
2659   else if   (keyb & 0x10)   ret = input_port_read(machine, "KEY4");
26602660   else   logerror("%06x: warning, unknown bits read, keyb = %02x\n", activecpu_get_pc(), keyb);
26612661
26622662   keyb <<= 1;
r2864r2865
26662666
26672667static READ8_HANDLER( mjmyster_dsw_r )
26682668{
2669   if (!(ddenlovr_select & 0x01))   return input_port_read_indexed(machine, 9);
2670   if (!(ddenlovr_select & 0x02))   return input_port_read_indexed(machine, 8);
2671   if (!(ddenlovr_select & 0x04))   return input_port_read_indexed(machine, 7);
2672   if (!(ddenlovr_select & 0x08))   return input_port_read_indexed(machine, 6);
2673   if (!(ddenlovr_select & 0x10))   return input_port_read_indexed(machine, 10);
2669   if (!(ddenlovr_select & 0x01))   return input_port_read(machine, "DSW4");
2670   if (!(ddenlovr_select & 0x02))   return input_port_read(machine, "DSW3");
2671   if (!(ddenlovr_select & 0x04))   return input_port_read(machine, "DSW2");
2672   if (!(ddenlovr_select & 0x08))   return input_port_read(machine, "DSW1");
2673   if (!(ddenlovr_select & 0x10))   return input_port_read(machine, "DSW5");
26742674   logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", activecpu_get_pc(), ddenlovr_select);
26752675   return 0xff;
26762676}
r2864r2865
27692769
27702770static READ8_HANDLER( hginga_dsw_r )
27712771{
2772   if (!(ddenlovr_select & 0x01))   return input_port_read_indexed(machine, 11);
2773   if (!(ddenlovr_select & 0x02))   return input_port_read_indexed(machine, 12);
2774   if (!(ddenlovr_select & 0x04))   return input_port_read_indexed(machine, 13);
2775   if (!(ddenlovr_select & 0x08))   return input_port_read_indexed(machine, 14);
2776   if (!(ddenlovr_select & 0x10))   return input_port_read_indexed(machine, 15);
2772   if (!(ddenlovr_select & 0x01))   return input_port_read(machine, "DSW4");
2773   if (!(ddenlovr_select & 0x02))   return input_port_read(machine, "DSW3");
2774   if (!(ddenlovr_select & 0x04))   return input_port_read(machine, "DSW2");
2775   if (!(ddenlovr_select & 0x08))   return input_port_read(machine, "DSW1");
2776   if (!(ddenlovr_select & 0x10))   return input_port_read(machine, "DSW5");
27772777   logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", activecpu_get_pc(), ddenlovr_select);
27782778   return 0xff;
27792779}
r2864r2865
27902790{
27912791   switch( hginga_select )
27922792   {
2793      case 0x20:   return input_port_read_indexed(machine, 0);
2794      case 0x21:   return input_port_read_indexed(machine, 16);
2793      case 0x20:   return input_port_read(machine, "IN0");
2794      case 0x21:   return input_port_read(machine, "BET");
27952795      case 0x22:   return 0x7f;   // bit 7 = blitter busy, bit 6 = hopper
27962796      case 0x23:   return hginga_coins;
27972797   }
2798   logerror("%04x: coins_r with select = %02x\n",activecpu_get_pc(),hginga_select);
2798   logerror("%04x: coins_r with select = %02x\n", activecpu_get_pc(), hginga_select);
27992799   return 0xff;
28002800}
28012801
r2864r2865
28232823         hginga_coins = data;
28242824         break;
28252825      default:
2826         logerror("%04x: coins_w with select = %02x, data = %02x\n",activecpu_get_pc(),hginga_select,data);
2826         logerror("%04x: coins_w with select = %02x, data = %02x\n", activecpu_get_pc(), hginga_select, data);
28272827   }
28282828}
28292829
28302830static READ8_HANDLER( hginga_input_r )
28312831{
2832   static const char *keynames0[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
2833   static const char *keynames1[] = { "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
2834
28322835   switch( hginga_select )
28332836   {
28342837      case 0x2d:
r2864r2865
28362839
28372840      // player 1
28382841      case 0xa1:
2839         return input_port_read_indexed(machine, 1 + hginga_ip++);
2842         return input_port_read(machine, keynames0[hginga_ip++]);
28402843
28412844      // player 2
28422845      case 0xa2:
2843         return input_port_read_indexed(machine, 1 + 5 + hginga_ip++);
2846         return input_port_read(machine, keynames1[hginga_ip++]);
28442847   }
2845   logerror("%04x: input_r with select = %02x\n",activecpu_get_pc(),hginga_select);
2848   logerror("%04x: input_r with select = %02x\n", activecpu_get_pc(), hginga_select);
28462849   return 0xff;
28472850}
28482851
r2864r2865
29182921{
29192922   UINT8 hopper_bit = ((hgokou_hopper && !(video_screen_get_frame_number(machine->primary_screen)%10)) ? 0 : (1<<6));
29202923
2921   if (!(ddenlovr_select2 & 0x01))   return input_port_read_indexed(machine, player * 5 + 1) | hopper_bit;
2922   if (!(ddenlovr_select2 & 0x02))   return input_port_read_indexed(machine, player * 5 + 2) | hopper_bit;
2923   if (!(ddenlovr_select2 & 0x04))   return input_port_read_indexed(machine, player * 5 + 3) | hopper_bit;
2924   if (!(ddenlovr_select2 & 0x08))   return input_port_read_indexed(machine, player * 5 + 4) | hopper_bit;
2925   if (!(ddenlovr_select2 & 0x10))   return input_port_read_indexed(machine, player * 5 + 5) | hopper_bit;
2924   if (!(ddenlovr_select2 & 0x01))   return input_port_read(machine, player ? "KEY5" : "KEY0") | hopper_bit;
2925   if (!(ddenlovr_select2 & 0x02))   return input_port_read(machine, player ? "KEY6" : "KEY1") | hopper_bit;
2926   if (!(ddenlovr_select2 & 0x04))   return input_port_read(machine, player ? "KEY7" : "KEY2") | hopper_bit;
2927   if (!(ddenlovr_select2 & 0x08))   return input_port_read(machine, player ? "KEY8" : "KEY3") | hopper_bit;
2928   if (!(ddenlovr_select2 & 0x10))   return input_port_read(machine, player ? "KEY9" : "KEY4") | hopper_bit;
29262929
29272930   return 0x7f;   // bit 7 = blitter busy, bit 6 = hopper
29282931}
r2864r2865
29312934{
29322935   switch (hginga_select)
29332936   {
2934      case 0x20:   return input_port_read_indexed(machine, 0);
2937      case 0x20:   return input_port_read(machine, "IN0");
29352938      case 0x21:   return hgokou_player_r(machine, 1);
29362939      case 0x22:   return hgokou_player_r(machine, 0);
29372940      case 0x23:   return hginga_coins;
r2864r2865
30393042
30403043static READ8_HANDLER( hparadis_input_r )
30413044{
3045   static const char *keynames0[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
3046   static const char *keynames1[] = { "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
3047
30423048   switch (hginga_select)
30433049   {
3044      case 0x00:   return input_port_read_indexed(machine, 0);            // P1 (Joy)
3045      case 0x01:   return input_port_read_indexed(machine, 1);            // P2 (Joy)
3046      case 0x02:   return input_port_read_indexed(machine, 2);            // Coins
3050      case 0x00:   return input_port_read(machine, "IN0");            // P1 (Joy)
3051      case 0x01:   return input_port_read(machine, "IN1");            // P2 (Joy)
3052      case 0x02:   return input_port_read(machine, "IN2");            // Coins
30473053      case 0x0d:   return 0x00;
3048      case 0x80:   return input_port_read_indexed(machine, 3 + hginga_ip++);   // P1 (Keys)
3049      case 0x81:   return input_port_read_indexed(machine, 8 + hginga_ip++);   // P2 (Keys)
3054      case 0x80:   return input_port_read(machine, keynames0[hginga_ip++]);   // P1 (Keys)
3055      case 0x81:   return input_port_read(machine, keynames1[hginga_ip++]);   // P2 (Keys)
30503056   }
30513057   logerror("%06x: warning, unknown bits read, hginga_select = %02x\n", activecpu_get_pc(), hginga_select);
30523058   return 0xff;
r2864r2865
30543060
30553061static READ8_HANDLER( hparadis_dsw_r )
30563062{
3057   if (!(ddenlovr_select & 0x01))   return input_port_read_indexed(machine, 13);
3058   if (!(ddenlovr_select & 0x02))   return input_port_read_indexed(machine, 14);
3063   if (!(ddenlovr_select & 0x01))   return input_port_read(machine, "DSW1");
3064   if (!(ddenlovr_select & 0x02))   return input_port_read(machine, "DSW2");
30593065   if (!(ddenlovr_select & 0x04))   return 0xff;
30603066   if (!(ddenlovr_select & 0x08))   return 0xff;
3061   if (!(ddenlovr_select & 0x10))   return input_port_read_indexed(machine, 15);
3067   if (!(ddenlovr_select & 0x10))   return input_port_read(machine, "DSW3");
30623068   return 0xff;
30633069}
30643070
r2864r2865
31223128{
31233129   switch( ddenlovr_select2 )
31243130   {
3125      case 0x80:   return input_port_read_indexed(machine, 0);
3131      case 0x80:   return input_port_read(machine, "IN0");
31263132      case 0x81:   return 0x00;
31273133      case 0x82:   return 0xff;   // bit 7 = 0 -> blitter busy, + hopper switch
31283134      case 0x83:   return 0x00;
r2864r2865
31983204static READ16_HANDLER( akamaru_dsw_r )
31993205{
32003206   UINT16 dsw = 0;
3201   if (akamaru_dsw_sel[1] == 0xff)   dsw |= input_port_read_indexed(machine, 3);
3202   if (akamaru_dsw_sel[0] == 0xff)   dsw |= input_port_read_indexed(machine, 4);
3207   if (akamaru_dsw_sel[1] == 0xff)   dsw |= input_port_read(machine, "DSW1");
3208   if (akamaru_dsw_sel[0] == 0xff)   dsw |= input_port_read(machine, "DSW2");
32033209   return dsw;
32043210}
32053211
r2864r2865
32843290{
32853291   UINT8 val = 0xff;
32863292
3287   if      (!(keyb & 0x01))   val = input_port_read_indexed(machine, offset * 5 + 1);
3288   else if (!(keyb & 0x02))   val = input_port_read_indexed(machine, offset * 5 + 2);
3289   else if (!(keyb & 0x04))   val = input_port_read_indexed(machine, offset * 5 + 3);
3290   else if (!(keyb & 0x08))   val = input_port_read_indexed(machine, offset * 5 + 4);
3291   else if (!(keyb & 0x10))   val = input_port_read_indexed(machine, offset * 5 + 5);
3293   if      (!(keyb & 0x01))   val = input_port_read(machine, offset ? "KEY5" : "KEY0");
3294   else if (!(keyb & 0x02))   val = input_port_read(machine, offset ? "KEY6" : "KEY1");
3295   else if (!(keyb & 0x04))   val = input_port_read(machine, offset ? "KEY7" : "KEY2");
3296   else if (!(keyb & 0x08))   val = input_port_read(machine, offset ? "KEY8" : "KEY3");
3297   else if (!(keyb & 0x10))   val = input_port_read(machine, offset ? "KEY9" : "KEY4");
32923298
32933299   return val;
32943300}
r2864r2865
33003306   // bit 7 = 1 -> blitter busy
33013307   // bit 6 = 0 -> VBLANK?
33023308   // bit 5 = 0 -> RTC?
3303   return input_port_read_indexed(machine, 0) | mjflove_irq_cause;
3309   return input_port_read(machine, "IN0") | mjflove_irq_cause;
33043310}
33053311
33063312static WRITE8_HANDLER( mjflove_blitter_w )
r2864r2865
33223328
33233329static ADDRESS_MAP_START( mjflove_readport, ADDRESS_SPACE_IO, 8 )   // 16 bit I/O
33243330   AM_RANGE(0x0010, 0x0010) AM_READ( hanakanz_rand_r         )   AM_MIRROR(0xff00)
3325   AM_RANGE(0x001c, 0x001c) AM_READ( input_port_12_r         )   AM_MIRROR(0xff00)
3331   AM_RANGE(0x001c, 0x001c) AM_READ_PORT("DSW2")               AM_MIRROR(0xff00)
33263332   AM_RANGE(0x0038, 0x0038) AM_READ( SMH_NOP               )   // ? ack or watchdog
33273333   AM_RANGE(0x0043, 0x0043) AM_READ( rongrong_gfxrom_r         )
33283334   AM_RANGE(0x0080, 0x0081) AM_READ( mjflove_keyb_r         )
33293335   AM_RANGE(0x0082, 0x0082) AM_READ( mjflove_blitter_r         )
33303336   AM_RANGE(0x00da, 0x00da) AM_READ( mjflove_protection_r      )   AM_MIRROR(0xff00)
3331   AM_RANGE(0x0100, 0x0100) AM_READ( input_port_11_r         )
3337   AM_RANGE(0x0100, 0x0100) AM_READ_PORT("DSW1")
33323338   AM_RANGE(0x0280, 0x028f) AM_DEVREAD(MSM6242, "rtc", msm6242_r)   // 6242RTC
33333339   AM_RANGE(0x0380, 0x0380) AM_READ( OKIM6295_status_0_r      )
33343340ADDRESS_MAP_END
r2864r2865
33583364
33593365
33603366static INPUT_PORTS_START( ddenlvrj )
3361   PORT_START   // IN0 - Player 1
3367   PORT_START_TAG("IN0")   /* IN0 - Player 1 */
33623368   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
33633369   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
33643370   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
r2864r2865
33683374   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
33693375   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
33703376
3371   PORT_START   // IN1 - Player 2
3377   PORT_START_TAG("IN1")   /* IN1 - Player 2 */
33723378   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
33733379   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
33743380   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
r2864r2865
33783384   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
33793385   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
33803386
3381   PORT_START   // IN2 - Coins + ?
3387   PORT_START_TAG("IN2")   /* IN2 - Coins + ? */
33823388   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1    )
33833389   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2    )
33843390   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )
r2864r2865
33883394   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL  )   // RTC
33893395   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL  )
33903396
3391   PORT_START   // IN3 - DSW1
3397   PORT_START_TAG("DSW1")   /* IN3 - DSW1 */
33923398   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
33933399   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
33943400   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
r2864r2865
34123418   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
34133419   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
34143420
3415   PORT_START   // IN4 - DSW2
3421   PORT_START_TAG("DSW2")   /* IN4 - DSW2 */
34163422   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) )
34173423   PORT_DIPSETTING(    0x06, "1 (Easy)" )
34183424   PORT_DIPSETTING(    0x05, "2" )
r2864r2865
34373443   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
34383444   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
34393445
3440   PORT_START   // IN5 - DSW1 & 2 top bits
3446   PORT_START_TAG("DSW3")   /* IN5 - DSW1 & 2 top bits */
34413447   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
34423448   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
34433449   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
34643470
34653471
34663472static INPUT_PORTS_START( ddenlovr )
3467   PORT_START   // IN0 - Player 1
3473   PORT_START_TAG("IN0")   /* IN0 - Player 1 */
34683474   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_START1 )
34693475   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
34703476   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
r2864r2865
34743480   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
34753481   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
34763482
3477   PORT_START   // IN1 - Player 2
3483   PORT_START_TAG("IN1")   /* IN1 - Player 2 */
34783484   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_START2 )
34793485   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
34803486   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
r2864r2865
34843490   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
34853491   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
34863492
3487   PORT_START   // IN2 - Coins + ?
3493   PORT_START_TAG("IN2")   /* IN2 - Coins + ? */
34883494   PORT_BIT(  0x01, IP_ACTIVE_LOW,  IPT_COIN1    )
34893495   PORT_BIT(  0x02, IP_ACTIVE_LOW,  IPT_COIN2    )
34903496   PORT_BIT(  0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )
r2864r2865
34943500   PORT_BIT(  0x40, IP_ACTIVE_HIGH, IPT_SPECIAL  )   // blitter irq flag
34953501   PORT_BIT(  0x80, IP_ACTIVE_HIGH, IPT_SPECIAL  )   // blitter busy flag
34963502
3497   PORT_START   // IN3 - DSW
3503   PORT_START_TAG("DSW")   /* IN3 - DSW */
34983504   PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
34993505   PORT_DIPNAME( 0x02, 0x02, "Unknown 1-1" )
35003506   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
r2864r2865
35203526
35213527
35223528static INPUT_PORTS_START( nettoqc )
3523   PORT_START   // IN0 - Player 1
3529   PORT_START_TAG("IN0")   /* IN0 - Player 1 */
35243530   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_START1 )
35253531   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
35263532   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r2864r2865
35303536   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
35313537   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
35323538
3533   PORT_START   // IN1 - Player 2
3539   PORT_START_TAG("IN1")   /* IN1 - Player 2 */
35343540   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_START2 )
35353541   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
35363542   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
r2864r2865
35403546   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
35413547   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
35423548
3543   PORT_START   // IN2 - Coins + ?
3549   PORT_START_TAG("IN2")   /* IN2 - Coins + ? */
35443550   PORT_BIT(  0x01, IP_ACTIVE_LOW,  IPT_COIN1    )
35453551   PORT_BIT(  0x02, IP_ACTIVE_LOW,  IPT_COIN2    )
35463552   PORT_BIT(  0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )
r2864r2865
35503556   PORT_BIT(  0x40, IP_ACTIVE_HIGH, IPT_SPECIAL  )   // blitter irq flag
35513557   PORT_BIT(  0x80, IP_ACTIVE_HIGH, IPT_SPECIAL  )
35523558
3553   PORT_START   // IN3 - DSW
3559   PORT_START_TAG("DSW1")   /* IN3 - DSW */
35543560   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
35553561   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
35563562   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
r2864r2865
35743580   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
35753581   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
35763582
3577   PORT_START   // IN4 - DSW
3583   PORT_START_TAG("DSW2")   /* IN4 - DSW */
35783584   PORT_DIPNAME( 0x03, 0x03, "Unknown 2-0&1*" )
35793585   PORT_DIPSETTING(    0x02, "0" )
35803586   PORT_DIPSETTING(    0x03, "1" )
r2864r2865
35993605   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
36003606   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
36013607
3602   PORT_START   // IN5 - DSW
3608   PORT_START_TAG("DSW3")   /* IN5 - DSW */
36033609   PORT_DIPNAME( 0x01, 0x01, "Unknown 1-8*" )
36043610   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
36053611   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
36183624
36193625
36203626static INPUT_PORTS_START( quiz365 )
3621   PORT_START   // IN0 - Player 1
3627   PORT_START_TAG("IN0")   /* IN0 - Player 1 */
36223628   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_START1 )
36233629   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
36243630   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r2864r2865
36283634   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
36293635   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
36303636
3631   PORT_START   // IN1 - Player 2
3637   PORT_START_TAG("IN1")   /* IN1 - Player 2 */
36323638   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_START2 )
36333639   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
36343640   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
r2864r2865
36383644   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
36393645   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
36403646
3641   PORT_START   // IN2 - Coins + ?
3647   PORT_START_TAG("IN2")   /* IN2 - Coins + ? */
36423648   PORT_BIT(  0x01, IP_ACTIVE_LOW,  IPT_COIN1    )
36433649   PORT_BIT(  0x02, IP_ACTIVE_LOW,  IPT_COIN2    )
36443650   PORT_BIT(  0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )
3645   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
3651   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
36463652   PORT_BIT(  0x10, IP_ACTIVE_LOW,  IPT_UNKNOWN  )
36473653   PORT_BIT(  0x20, IP_ACTIVE_LOW,  IPT_SPECIAL  )   // ? quiz365
36483654   PORT_BIT(  0x40, IP_ACTIVE_HIGH, IPT_SPECIAL  )   // blitter irq flag
36493655   PORT_BIT(  0x80, IP_ACTIVE_HIGH, IPT_SPECIAL  )   // blitter busy flag
36503656
3651   PORT_START   // IN3 - DSW
3657   PORT_START_TAG("DSW1")   /* IN3 - DSW */
36523658   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
36533659   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
36543660   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
r2864r2865
36713677   PORT_DIPSETTING(    0xc0, "2" )
36723678//  PORT_DIPSETTING(    0x00, "2" )
36733679
3674   PORT_START   // IN4 - DSW
3680   PORT_START_TAG("DSW2")   /* IN4 - DSW */
36753681   PORT_DIPNAME( 0x03, 0x03, "Unknown 2-0&1" )
36763682   PORT_DIPSETTING(    0x02, "0" )
36773683   PORT_DIPSETTING(    0x03, "1" )
r2864r2865
36953701   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
36963702   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
36973703
3698   PORT_START   // IN5 - DSW
3704   PORT_START_TAG("DSW3")   /* IN5 - DSW */
36993705   PORT_DIPNAME( 0x01, 0x01, "Unknown 3-0" )
37003706   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
37013707   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
37113717
37123718
37133719static INPUT_PORTS_START( rongrong )
3714   PORT_START   // IN0 - Player 1
3720   PORT_START_TAG("IN0")   /* IN0 - Player 1 */
37153721   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_START1 )
37163722   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
37173723   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
r2864r2865
37213727   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
37223728   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
37233729
3724   PORT_START   // IN1 - Player 2
3730   PORT_START_TAG("IN1")   /* IN1 - Player 2 */
37253731   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_START2 )
37263732   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
37273733   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
r2864r2865
37313737   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
37323738   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
37333739
3734   PORT_START   // IN2 - Coins + ?
3740   PORT_START_TAG("IN2")   /* IN2 - Coins + ? */
37353741   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_COIN1    )
37363742   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_COIN2    )
37373743   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
37413747   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_SPECIAL  )   // ? blitter irq flag ?
37423748   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_SPECIAL  )   // ? blitter busy flag ?
37433749
3744     PORT_START   // IN3 - DSW
3750     PORT_START_TAG("DSW1")   /* IN3 - DSW */
37453751    PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
37463752   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
37473753   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
r2864r2865
37653771     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
37663772     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
37673773
3768     PORT_START   // IN4 - DSW
3774     PORT_START_TAG("DSW2")   /* IN4 - DSW */
37693775    PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
37703776     PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
37713777     PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
r2864r2865
37883794     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
37893795     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
37903796
3791     PORT_START   // IN5 - DSW
3797     PORT_START_TAG("DSW3")   /* IN5 - DSW */
37923798    PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
37933799     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
37943800     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
38033809INPUT_PORTS_END
38043810
38053811static INPUT_PORTS_START( quizchq )
3806   PORT_START   // IN0 - Player 1
3812   PORT_START_TAG("IN0")   /* IN0 - Player 1 */
38073813   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_START1 )
38083814   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
38093815   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r2864r2865
38133819   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
38143820   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
38153821
3816   PORT_START   // IN1 - Player 2
3822   PORT_START_TAG("IN1")   /* IN1 - Player 2 */
38173823   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_START2 )
38183824   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
38193825   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
r2864r2865
38233829   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
38243830   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
38253831
3826   PORT_START   // IN2 - Coins + ?
3832   PORT_START_TAG("IN2")   /* IN2 - Coins + ? */
38273833   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_COIN1    )
38283834   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_COIN2    )
38293835   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
38333839   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_SPECIAL  )   // ? blitter irq flag ?
38343840   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_SPECIAL  )   // ? blitter busy flag ?
38353841
3836   PORT_START   // IN3 - DSW
3842   PORT_START_TAG("DSW1")   /* IN3 - DSW */
38373843   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
38383844   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
38393845   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
r2864r2865
38573863   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
38583864   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
38593865
3860   PORT_START   // IN4 - DSW
3866   PORT_START_TAG("DSW2")   /* IN4 - DSW */
38613867   PORT_DIPNAME( 0x01, 0x01, "Unknown 2-0" )
38623868   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
38633869   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
38813887   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
38823888   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
38833889
3884   PORT_START   // IN5 - DSW
3890   PORT_START_TAG("DSW3")   /* IN5 - DSW */
38853891   PORT_DIPNAME( 0x01, 0x01, "Unknown 1-0" )
38863892   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
38873893   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
38983904INPUT_PORTS_END
38993905
39003906static INPUT_PORTS_START( mmpanic )
3901   PORT_START   // IN0 6a (68 = 1:used? 2:normal 3:goes to 69)
3907   PORT_START_TAG("IN0")   /* IN0 6a (68 = 1:used? 2:normal 3:goes to 69) */
39023908   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
39033909   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   // tested?
39043910   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
39083914   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD)
39093915   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   // busy?
39103916
3911   PORT_START   // IN1 6b (68 = 0 & 1)
3917   PORT_START_TAG("IN1")   /* IN1 6b (68 = 0 & 1) */
39123918   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
39133919   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)
39143920   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)
r2864r2865
39183924   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)
39193925   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD)
39203926
3921   PORT_START   // IN2 - DSW
3927   PORT_START_TAG("DSW1")   /* IN2 - DSW */
39223928   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
39233929   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
39243930   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
r2864r2865
39433949   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
39443950   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
39453951
3946   PORT_START   // IN3 - DSW
3952   PORT_START_TAG("DSW2")   /* IN3 - DSW */
39473953   PORT_DIPNAME( 0x01, 0x01, "Unknown 2-0*" )
39483954   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
39493955   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
39683974   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
39693975   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
39703976
3971   PORT_START   // IN4 - DSW
3977   PORT_START_TAG("DSW3")   /* IN4 - DSW */
39723978   PORT_DIPNAME( 0x01, 0x01, "Set Date" )
39733979   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
39743980   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
39954001
39964002
39974003static INPUT_PORTS_START( animaljr )
3998   PORT_START   // IN0 6a (68 = 1:used? 2:normal 3:goes to 69)
4004   PORT_START_TAG("IN0")   /* IN0 6a (68 = 1:used? 2:normal 3:goes to 69) */
39994005   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
40004006   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
40014007   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
40054011   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
40064012   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )   // busy?
40074013
4008   PORT_START   // IN1 6b (68 = 0 & 1)
4014   PORT_START_TAG("IN1")   /* IN1 6b (68 = 0 & 1) */
40094015   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )   // tested ?
40104016   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)
40114017   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)
r2864r2865
40154021   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)
40164022   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
40174023
4018   PORT_START   // IN2 - DSW
4024   PORT_START_TAG("DSW1")   /* IN2 - DSW */
40194025   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
40204026   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
40214027   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
r2864r2865
40404046   PORT_DIPSETTING(    0x20, "6" )
40414047   PORT_DIPSETTING(    0x00, "7" )
40424048
4043   PORT_START   // IN3 - DSW
4049   PORT_START_TAG("DSW2")   /* IN3 - DSW */
40444050   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
40454051   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
40464052   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
40654071   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
40664072   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
40674073
4068   PORT_START   // IN4 - DSW
4074   PORT_START_TAG("DSW3")   /* IN4 - DSW */
40694075   PORT_DIPNAME( 0x01, 0x01, "Unknown 3-0*" )
40704076   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
40714077   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
40934099
40944100static INPUT_PORTS_START( hanakanz )
40954101
4096   PORT_START   // IN0 - Coins + Service Keys
4102   PORT_START_TAG("IN0")   /* IN0 - Coins + Service Keys */
40974103   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3   )   // medal out
40984104   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
40994105   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE  ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   // Test
r2864r2865
41034109   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1   )
41044110   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )
41054111
4106   // keyb 2
4107   PORT_START
4112   /* keyb 2 */
4113
4114   PORT_START_TAG("KEY0")
41084115   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )   // A
41094116   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )   // E
41104117   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // I
r2864r2865
41124119   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   // Kan
41134120   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
41144121
4115   PORT_START
4122   PORT_START_TAG("KEY1")
41164123   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )   // B
41174124   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )   // F
41184125   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // J
r2864r2865
41204127   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   // Reach
41214128   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )   PORT_PLAYER(2)   // BET
41224129
4123   PORT_START
4130   PORT_START_TAG("KEY2")
41244131   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )   // C
41254132   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )   // G
41264133   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // K
r2864r2865
41284135   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   // Ron
41294136   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
41304137
4131   PORT_START
4138   PORT_START_TAG("KEY3")
41324139   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )   // D
41334140   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )   // H
41344141   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // L
r2864r2865
41364143   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
41374144   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
41384145
4139   PORT_START
4146   PORT_START_TAG("KEY4")
41404147   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN            )
41414148   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   PORT_PLAYER(2)   // "t"
41424149   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   PORT_PLAYER(2)   // "w"
r2864r2865
41444151   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   PORT_PLAYER(2)   // "b"
41454152   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   PORT_PLAYER(2)   // "s"
41464153
4147   // keyb 1
4148   PORT_START
4154   /* keyb 1 */
4155
4156   PORT_START_TAG("KEY5")
41494157   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)   // A
41504158   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD)   // E
41514159   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // I
r2864r2865
41534161   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   // Kan
41544162   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
41554163
4156   PORT_START
4164   PORT_START_TAG("KEY6")
41574165   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)   // B
41584166   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)   // F
41594167   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // J
r2864r2865
41614169   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   // Reach
41624170   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )   // BET
41634171
4164   PORT_START
4172   PORT_START_TAG("KEY7")
41654173   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD)   // C
41664174   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD)   // G
41674175   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // K
r2864r2865
41694177   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   // Ron
41704178   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
41714179
4172   PORT_START
4180   PORT_START_TAG("KEY8")
41734181   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD)   // D
41744182   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD)   // H
41754183   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // L
r2864r2865
41774185   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
41784186   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
41794187
4180   PORT_START
4188   PORT_START_TAG("KEY9")
41814189   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN            )
41824190   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   // "t"
41834191   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   // "w"
r2864r2865
41854193   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   // "b"
41864194   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   // "s"
41874195
4188   PORT_START   // IN11 - DSW1
4196   PORT_START_TAG("DSW1")   /* IN11 - DSW1 */
41894197   PORT_DIPNAME( 0x07, 0x07, "Unknown 1-0&1&2" )
41904198   PORT_DIPSETTING(    0x07, "0" )
41914199   PORT_DIPSETTING(    0x06, "1" )
r2864r2865
42104218   PORT_DIPSETTING(    0x00, "5" )
42114219   PORT_DIPSETTING(    0x80, "10" )
42124220
4213   PORT_START   // IN12 - DSW2
4221   PORT_START_TAG("DSW2")   /* IN12 - DSW2 */
42144222   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
42154223   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
42164224   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
r2864r2865
42324240   PORT_DIPSETTING(    0x40, "70" )
42334241   PORT_DIPSETTING(    0x00, "80" )
42344242
4235   PORT_START   // IN13 - DSW3
4243   PORT_START_TAG("DSW3")   /* IN13 - DSW3 */
42364244   PORT_DIPNAME( 0x03, 0x03, "Game Type" )
42374245   PORT_DIPSETTING(    0x03, "8 Cards" )
42384246   PORT_DIPSETTING(    0x02, "6 Cards (Bets)" )
r2864r2865
42554263   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
42564264   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
42574265
4258   PORT_START   // IN14 - DSW4
4266   PORT_START_TAG("DSW4")   /* IN14 - DSW4 */
42594267   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Demo_Sounds ) )
42604268   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
42614269   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2864r2865
42814289   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
42824290   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
42834291
4284   PORT_START   // IN15 - DSWs top bits
4292   PORT_START_TAG("DSW5")   /* IN15 - DSWs top bits */
42854293   PORT_DIPNAME( 0x01, 0x01, "Unknown 1-8" )
42864294   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
42874295   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
43044312   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
43054313   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
43064314
4307   PORT_START   // IN16 - Fake DSW
4315   PORT_START_TAG("BET")   /* IN16 - Fake DSW */
43084316   PORT_DIPNAME( 0x40, 0x40, "Allow Bets" )
43094317   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
43104318   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
43114319
4312   PORT_START   // IN17 - Fake DSW
4320   PORT_START_TAG("HOPPER")   /* IN17 - Fake DSW */
43134321   PORT_DIPNAME( 0x40, 0x40, "? Hopper M." )
43144322   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
43154323   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
43194327
43204328static INPUT_PORTS_START( hkagerou )
43214329
4322   PORT_START   // IN0 - Coins + Service Keys
4330   PORT_START_TAG("IN0")   /* IN0 - Coins + Service Keys */
43234331   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3   )   // medal out
43244332   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
43254333   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE  ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   // Test
r2864r2865
43294337   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1   )
43304338   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )
43314339
4332   // keyb 2
4333   PORT_START
4340   /* keyb 2 */
4341
4342   PORT_START_TAG("KEY0")
43344343   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )   // A
43354344   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )   // E
43364345   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // I
r2864r2865
43384347   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   // Kan
43394348   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
43404349
4341   PORT_START
4350   PORT_START_TAG("KEY1")
43424351   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )   // B
43434352   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )   // F
43444353   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // J
r2864r2865
43464355   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   // Reach
43474356   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )   PORT_PLAYER(2)   // BET
43484357
4349   PORT_START
4358   PORT_START_TAG("KEY2")
43504359   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )   // C
43514360   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )   // G
43524361   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // K
r2864r2865
43544363   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   // Ron
43554364   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
43564365
4357   PORT_START
4366   PORT_START_TAG("KEY3")
43584367   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )   // D
43594368   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )   // H
43604369   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // L
r2864r2865
43624371   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
43634372   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
43644373
4365   PORT_START
4374   PORT_START_TAG("KEY4")
43664375   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN            )
43674376   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   PORT_PLAYER(2)   // "t"
43684377   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   PORT_PLAYER(2)   // "w"
r2864r2865
43704379   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   PORT_PLAYER(2)   // "b"
43714380   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   PORT_PLAYER(2)   // "s"
43724381
4373   // keyb 1
4374   PORT_START
4382   /* keyb 1 */
4383
4384   PORT_START_TAG("KEY5")
43754385   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)   // A
43764386   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD)   // E
43774387   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // I
r2864r2865
43794389   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   // "t"
43804390   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
43814391
4382   PORT_START
4392   PORT_START_TAG("KEY6")
43834393   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)   // B
43844394   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)   // F
43854395   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   // J
r2864r2865
43874397   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL   )   // "s"
43884398   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   // BET
43894399
4390   PORT_START
4400   PORT_START_TAG("KEY7")
43914401   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD)   // C
43924402   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD)   // G
43934403   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // K
r2864r2865
43954405   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Ron
43964406   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )
43974407
4398   PORT_START
4408   PORT_START_TAG("KEY8")
43994409   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD)   // D
44004410   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD)   // H
44014411   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN            )   // L
r2864r2865
44034413   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
44044414   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
44054415
4406   PORT_START
4416   PORT_START_TAG("KEY9")
44074417   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN            )
44084418   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   // "t"
44094419   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   // "w"
r2864r2865
44114421   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   // "b"
44124422   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   // "s"
44134423
4414   PORT_START   // IN11 - DSW1
4424   PORT_START_TAG("DSW1")   /* IN11 - DSW1 */
44154425   PORT_DIPNAME( 0x07, 0x07, "Unknown 1-0&1&2" )
44164426   PORT_DIPSETTING(    0x07, "0" )
44174427   PORT_DIPSETTING(    0x06, "1" )
r2864r2865
44364446   PORT_DIPSETTING(    0x00, "25" )
44374447   PORT_DIPSETTING(    0x80, "50" )
44384448
4439   PORT_START   // IN12 - DSW2
4449   PORT_START_TAG("DSW2")   /* IN12 - DSW2 */
44404450   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
44414451   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
44424452   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
r2864r2865
44584468   PORT_DIPSETTING(    0x40, "70" )
44594469   PORT_DIPSETTING(    0x00, "80" )
44604470
4461   PORT_START   // IN13 - DSW3
4471   PORT_START_TAG("DSW3")   /* IN13 - DSW3 */
44624472   PORT_DIPNAME( 0x01, 0x01, "Game Type?" )
44634473   PORT_DIPSETTING(    0x01, "0" )
44644474   PORT_DIPSETTING(    0x00, "1" )
r2864r2865
44824492   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
44834493   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
44844494
4485   PORT_START   // IN14 - DSW4
4495   PORT_START_TAG("DSW4")   /* IN14 - DSW4 */
44864496   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Demo_Sounds ) )
44874497   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
44884498   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2864r2865
45084518   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
45094519   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
45104520
4511   PORT_START   // IN15 - DSWs top bits
4521   PORT_START_TAG("DSW5")   /* IN15 - DSWs top bits */
45124522   PORT_DIPNAME( 0x01, 0x01, "Unknown 1-8" )
45134523   PORT_DIPSETTING(    0x00, "5" )
45144524   PORT_DIPSETTING(    0x01, "10" )
r2864r2865
45314541   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
45324542   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
45334543
4534   PORT_START   // IN16 - Fake DSW
4544   PORT_START_TAG("BET")   /* IN16 - Fake DSW */
45354545   PORT_DIPNAME( 0x40, 0x40, "Disable Bets" )
45364546   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
45374547   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
45384548
4539   PORT_START   // IN17 - Fake DSW
4549   PORT_START_TAG("HOPPER")   /* IN17 - Fake DSW */
45404550   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
45414551   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
45424552   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
45464556
45474557static INPUT_PORTS_START( mjreach1 )
45484558
4549   PORT_START   // IN0 - Coins + Service Keys
4559   PORT_START_TAG("IN0")   /* IN0 - Coins + Service Keys */
45504560   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3   )   // medal out
45514561   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
45524562   PORT_SERVICE(0x04, IP_ACTIVE_LOW)
r2864r2865
45564566   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1   )
45574567   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )
45584568
4559   // keyb 2
4560   PORT_START
4569   /* keyb 2 */
4570
4571   PORT_START_TAG("KEY0")
45614572   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   PORT_PLAYER(2)   // A
45624573   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   PORT_PLAYER(2)   // E
45634574   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   PORT_PLAYER(2)   // I
r2864r2865
45654576   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   PORT_PLAYER(2)   // Kan
45664577   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2         )   // Start 2
45674578
4568   PORT_START
4579   PORT_START_TAG("KEY1")
45694580   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   PORT_PLAYER(2)   // B
45704581   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   PORT_PLAYER(2)   // F
45714582   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   PORT_PLAYER(2)   // J
r2864r2865
45734584   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   PORT_PLAYER(2)   // Reach
45744585   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   PORT_PLAYER(2)   // BET
45754586
4576   PORT_START
4587   PORT_START_TAG("KEY2")
45774588   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   PORT_PLAYER(2)   // C
45784589   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   PORT_PLAYER(2)   // G
45794590   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   PORT_PLAYER(2)   // K
r2864r2865
45814592   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   PORT_PLAYER(2)   // Ron
45824593   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
45834594
4584   PORT_START
4595   PORT_START_TAG("KEY3")
45854596   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   PORT_PLAYER(2)   // D
45864597   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   PORT_PLAYER(2)   // H
45874598   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   PORT_PLAYER(2)   // L
r2864r2865
45894600   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
45904601   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
45914602
4592   PORT_START
4603   PORT_START_TAG("KEY4")
45934604   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   PORT_PLAYER(2)   // "l"
45944605   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   PORT_PLAYER(2)   // "t"
45954606   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   PORT_PLAYER(2)   // "w"
r2864r2865
45974608   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   PORT_PLAYER(2)   // "b"
45984609   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   PORT_PLAYER(2)   // "s"
45994610
4600   // keyb 1
4601   PORT_START
4611   /* keyb 1 */
4612
4613   PORT_START_TAG("KEY5")
46024614   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   // A
46034615   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   // E
46044616   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   // I
r2864r2865
46064618   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   // Kan
46074619   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1         )   // Start 1
46084620
4609   PORT_START
4621   PORT_START_TAG("KEY6")
46104622   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   // B
46114623   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   // F
46124624   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   // J
r2864r2865
46144626   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   // Reach
46154627   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   // BET
46164628
4617   PORT_START
4629   PORT_START_TAG("KEY7")
46184630   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   // C
46194631   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   // G
46204632   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   // K
r2864r2865
46224634   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   // Ron
46234635   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
46244636
4625   PORT_START
4637   PORT_START_TAG("KEY8")
46264638   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   // D
46274639   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   // H
46284640   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   // L
r2864r2865
46304642   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
46314643   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
46324644
4633   PORT_START
4645   PORT_START_TAG("KEY9")
46344646   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   // "l"
46354647   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   // "t"
46364648   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   // "w"
r2864r2865
46384650   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   // "b"
46394651   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   // "s"
46404652
4641   PORT_START   // IN11 - DSW1
4653   PORT_START_TAG("DSW1")   /* IN11 - DSW1 */
46424654   PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
46434655   PORT_DIPSETTING(    0x00, "50" )
46444656   PORT_DIPSETTING(    0x01, "53" )
r2864r2865
46674679   PORT_DIPSETTING(    0x40, "10" )
46684680   PORT_DIPSETTING(    0x00, "20" )
46694681
4670   PORT_START   // IN12 - DSW2
4682   PORT_START_TAG("DSW2")   /* IN12 - DSW2 */
46714683   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
46724684   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
46734685   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
r2864r2865
46904702   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
46914703   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
46924704
4693   PORT_START   // IN13 - DSW3
4705   PORT_START_TAG("DSW3")   /* IN13 - DSW3 */
46944706   PORT_DIPNAME( 0x07, 0x07, "YAKUMAN Bonus" )
46954707   PORT_DIPSETTING(    0x07, "Cut" )
46964708   PORT_DIPSETTING(    0x06, "1 T" )
r2864r2865
47154727   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
47164728   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
47174729
4718   PORT_START   // IN14 - DSW4
4730   PORT_START_TAG("DSW4")   /* IN14 - DSW4 */
47194731   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
47204732   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
47214733   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
47414753   PORT_DIPSETTING(    0x80, "Start" )
47424754   PORT_DIPSETTING(    0x00, "Flip/Flop" )
47434755
4744   PORT_START   // IN15 - DSWs top bits
4756   PORT_START_TAG("DSW5")   /* IN15 - DSWs top bits */
47454757   PORT_DIPNAME( 0x01, 0x01, "Credits Per Note" )
47464758   PORT_DIPSETTING(    0x01, "5" )
47474759   PORT_DIPSETTING(    0x00, "10" )
r2864r2865
47664778   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
47674779   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
47684780
4769   PORT_START   // IN16 - Fake DSW
4781   PORT_START_TAG("BET")   /* IN16 - Fake DSW */
47704782   PORT_DIPNAME( 0x40, 0x40, "Bets?" )
47714783   PORT_DIPSETTING(    0x40, "0" )
47724784   PORT_DIPSETTING(    0x00, "1" )
47734785
4774   PORT_START   // IN17 - Fake DSW
4786   PORT_START_TAG("HOPPER")   /* IN17 - Fake DSW */
47754787   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
47764788   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
47774789   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
47814793
47824794static INPUT_PORTS_START( mjchuuka )
47834795
4784   PORT_START   // IN0 - Coins + Service Keys
4796   PORT_START_TAG("IN0")   /* IN0 - Coins + Service Keys */
47854797   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3   )   // medal out
47864798   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
47874799   PORT_SERVICE(0x04, IP_ACTIVE_LOW)
r2864r2865
47914803   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1   )
47924804   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )
47934805
4794   // keyb 2
4795   PORT_START
4806   /* keyb 2 */
4807
4808   PORT_START_TAG("KEY0")
47964809   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   PORT_PLAYER(2)   // A
47974810   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   PORT_PLAYER(2)   // E
47984811   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   PORT_PLAYER(2)   // I
r2864r2865
48004813   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   PORT_PLAYER(2)   // Kan
48014814   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2         )   // Start 2
48024815
4803   PORT_START
4816   PORT_START_TAG("KEY1")
48044817   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   PORT_PLAYER(2)   // B
48054818   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   PORT_PLAYER(2)   // F
48064819   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   PORT_PLAYER(2)   // J
r2864r2865
48084821   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   PORT_PLAYER(2)   // Reach
48094822   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   PORT_PLAYER(2)   // BET
48104823
4811   PORT_START
4824   PORT_START_TAG("KEY2")
48124825   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   PORT_PLAYER(2)   // C
48134826   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   PORT_PLAYER(2)   // G
48144827   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   PORT_PLAYER(2)   // K
r2864r2865
48164829   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   PORT_PLAYER(2)   // Ron
48174830   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
48184831
4819   PORT_START
4832   PORT_START_TAG("KEY3")
48204833   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   PORT_PLAYER(2)   // D
48214834   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   PORT_PLAYER(2)   // H
48224835   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   PORT_PLAYER(2)   // L
r2864r2865
48244837   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
48254838   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
48264839
4827   PORT_START
4840   PORT_START_TAG("KEY4")
48284841   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   PORT_PLAYER(2)   // "l"
48294842   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   PORT_PLAYER(2)   // "t"
48304843   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   PORT_PLAYER(2)   // "w"
r2864r2865
48324845   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   PORT_PLAYER(2)   // "b"
48334846   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   PORT_PLAYER(2)   // "s"
48344847
4835   // keyb 1
4836   PORT_START
4848   /* keyb 1 */
4849
4850   PORT_START_TAG("KEY5")
48374851   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   // A
48384852   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   // E
48394853   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   // I
r2864r2865
48414855   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   // Kan
48424856   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1         )   // Start 1
48434857
4844   PORT_START
4858   PORT_START_TAG("KEY6")
48454859   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   // B
48464860   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   // F
48474861   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   // J
r2864r2865
48494863   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   // Reach
48504864   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   // BET
48514865
4852   PORT_START
4866   PORT_START_TAG("KEY7")
48534867   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   // C
48544868   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   // G
48554869   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   // K
r2864r2865
48574871   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   // Ron
48584872   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
48594873
4860   PORT_START
4874   PORT_START_TAG("KEY8")
48614875   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   // D
48624876   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   // H
48634877   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   // L
r2864r2865
48654879   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
48664880   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
48674881
4868   PORT_START
4882   PORT_START_TAG("KEY9")
48694883   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   // "l"
48704884   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   // "t"
48714885   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   // "w"
r2864r2865
48734887   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   // "b"
48744888   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   // "s"
48754889
4876   PORT_START   // IN11 - DSW1
4890   PORT_START_TAG("DSW1")   /* IN11 - DSW1 */
48774891   PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
48784892   PORT_DIPSETTING(    0x00, "50" )
48794893   PORT_DIPSETTING(    0x01, "53" )
r2864r2865
49024916   PORT_DIPSETTING(    0x40, "10" )
49034917   PORT_DIPSETTING(    0x00, "20" )
49044918
4905   PORT_START   // IN12 - DSW2
4919   PORT_START_TAG("DSW2")   /* IN12 - DSW2 */
49064920   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
49074921   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
49084922   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
r2864r2865
49264940   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
49274941   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
49284942
4929   PORT_START   // IN13 - DSW3
4943   PORT_START_TAG("DSW3")   /* IN13 - DSW3 */
49304944   PORT_DIPNAME( 0x07, 0x07, "YAKUMAN Bonus" )
49314945   PORT_DIPSETTING(    0x07, "Cut" )
49324946   PORT_DIPSETTING(    0x06, "1 T" )
r2864r2865
49514965   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
49524966   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
49534967
4954   PORT_START   // IN14 - DSW4
4968   PORT_START_TAG("DSW4")   /* IN14 - DSW4 */
49554969   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
49564970   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
49574971   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
49764990   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
49774991   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
49784992
4979   PORT_START   // IN15 - DSWs top bits
4993   PORT_START_TAG("DSW5")   /* IN15 - DSWs top bits */
49804994   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
49814995   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
49824996   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
50015015   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
50025016   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
50035017
5004   PORT_START   // IN16 - Fake DSW
5018   PORT_START_TAG("BET")   /* IN16 - Fake DSW */
50055019   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
50065020   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
50075021   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
50085022
5009   PORT_START   // IN17 - Fake DSW
5023   PORT_START_TAG("HOPPER")   /* IN17 - Fake DSW */
50105024   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
50115025   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
50125026   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
50155029
50165030
50175031static INPUT_PORTS_START( funkyfig )
5018   PORT_START   // IN0 - Keys (port 83 with port 80 = 20)
5032   PORT_START_TAG("IN0")   /* IN0 - Keys (port 83 with port 80 = 20) */
50195033   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
50205034   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)
50215035   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)
r2864r2865
50255039   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)
50265040   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD)
50275041
5028   PORT_START   // IN1 - ? (port 83 with port 80 = 21)
5042   PORT_START_TAG("IN1")   /* IN1 - ? (port 83 with port 80 = 21) */
50295043   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )   // ?
50305044   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
50315045
5032   PORT_START   // IN2 - Coins (port 82 with port 80 = 22)
5046   PORT_START_TAG("IN2")   /* IN2 - Coins (port 82 with port 80 = 22) */
50335047   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
50345048   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
50355049   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
50395053   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD)
50405054   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
50415055
5042   PORT_START   // IN3 - DSW1 (low bits, port 1c with rombank = 1e)
5056   PORT_START_TAG("DSW1")   /* IN3 - DSW1 (low bits, port 1c with rombank = 1e) */
50435057   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
50445058   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
50455059   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
r2864r2865
50645078   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
50655079   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
50665080
5067   PORT_START   // IN4 - DSW2 (low bits, port 1c with rombank = 1d)
5081   PORT_START_TAG("DSW2")   /* IN4 - DSW2 (low bits, port 1c with rombank = 1d) */
50685082   PORT_DIPNAME( 0x01, 0x01, "2 Player Game" )
50695083   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
50705084   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
r2864r2865
50885102   PORT_DIPSETTING(    0x40, "2" )
50895103   PORT_DIPSETTING(    0x00, "3" )
50905104
5091   PORT_START   // IN5 - DSW1 & 2 (high bits, port 1c with rombank = 1b)
5105   PORT_START_TAG("DSW3")   /* IN5 - DSW1 & 2 (high bits, port 1c with rombank = 1b) */
50925106   PORT_DIPNAME( 0x01, 0x01, "Continue?" )   // related to continue
50935107   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
50945108   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
51165130
51175131
51185132static INPUT_PORTS_START( mjmyster )
5119   PORT_START   // IN0 - Coins + Service Keys
5133   PORT_START_TAG("IN0")   /* IN0 - Coins + Service Keys */
51205134   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3   )   // medal out
51215135   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
51225136   PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW)
r2864r2865
51265140   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1   )
51275141   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )
51285142
5129   // keyb 1
5130   PORT_START
5143   /* keyb 1 */
5144
5145   PORT_START_TAG("KEY0")
51315146   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   // A
51325147   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   // E
51335148   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   // I
r2864r2865
51355150   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   // Kan
51365151   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1         )   // Start 1
51375152
5138   PORT_START
5153   PORT_START_TAG("KEY1")
51395154   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   // B
51405155   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   // F
51415156   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   // J
r2864r2865
51435158   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   // Reach
51445159   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   // BET
51455160
5146   PORT_START
5161   PORT_START_TAG("KEY2")
51475162   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   // C
51485163   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   // G
51495164   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   // K
r2864r2865
51515166   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   // Ron
51525167   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
51535168
5154   PORT_START
5169   PORT_START_TAG("KEY3")
51555170   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   // D
51565171   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   // H
51575172   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   // L
r2864r2865
51595174   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
51605175   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
51615176
5162   PORT_START
5177   PORT_START_TAG("KEY4")
51635178   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   // "l"
51645179   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   // "t"
51655180   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   // "w"
r2864r2865
51675182   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   // "b"
51685183   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   // "s"
51695184
5170   PORT_START   // IN6 - DSW1
5185   PORT_START_TAG("DSW1")   /* IN6 - DSW1 */
51715186   PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
51725187   PORT_DIPSETTING(    0x00, "50" )
51735188   PORT_DIPSETTING(    0x01, "53" )
r2864r2865
51965211   PORT_DIPSETTING(    0x40, "10" )
51975212   PORT_DIPSETTING(    0x00, "20" )
51985213
5199   PORT_START   // IN7 - DSW2
5214   PORT_START_TAG("DSW2")   /* IN7 - DSW2 */
52005215   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
52015216   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
52025217   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
r2864r2865
52205235   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
52215236   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
52225237
5223   PORT_START   // IN8 - DSW3
5238   PORT_START_TAG("DSW3")   /* IN8 - DSW3 */
52245239   PORT_DIPNAME( 0x03, 0x03, "YAKUMAN Times" )
52255240//  PORT_DIPSETTING(    0x00, "1" )
52265241   PORT_DIPSETTING(    0x03, "1" )
r2864r2865
52445259   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
52455260   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
52465261
5247   PORT_START   // IN9 - DSW4
5262   PORT_START_TAG("DSW4")   /* IN9 - DSW4 */
52485263   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
52495264   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
52505265   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
52705285   PORT_DIPSETTING(    0x80, DEF_STR( Japan ) )
52715286   PORT_DIPSETTING(    0x00, "Hong Kong" )
52725287
5273   PORT_START   // IN10 - DSWs top bits
5288   PORT_START_TAG("DSW5")   /* IN10 - DSWs top bits */
52745289   PORT_DIPNAME( 0x03, 0x03, "Computer Strength?" )
52755290   PORT_DIPSETTING(    0x03, "Weak" )
52765291   PORT_DIPSETTING(    0x02, DEF_STR( Normal ))
r2864r2865
52985313
52995314static INPUT_PORTS_START( hginga )
53005315
5301   PORT_START   // IN0 - Coins + Service Keys
5316   PORT_START_TAG("IN0")   /* IN0 - Coins + Service Keys */
53025317   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3   )   // medal out
53035318//  PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN  )
53045319   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE  ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   // Test
r2864r2865
53085323   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1   )
53095324//  PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN  )
53105325
5311   // keyb 2
5312   PORT_START
5326   /* keyb 2 */
5327
5328   PORT_START_TAG("KEY0")
53135329   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A   )   PORT_PLAYER(2)   // A
53145330   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E   )   PORT_PLAYER(2)   // E
53155331   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // I
r2864r2865
53175333   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Kan
53185334   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2      )
53195335
5320   PORT_START
5336   PORT_START_TAG("KEY1")
53215337   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B   )   PORT_PLAYER(2)   // B
53225338   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F   )   PORT_PLAYER(2)   // F
53235339   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // J
r2864r2865
53255341   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Reach
53265342   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET   )   PORT_PLAYER(2)   // BET
53275343
5328   PORT_START
5344   PORT_START_TAG("KEY2")
53295345   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C   )   PORT_PLAYER(2)   // C
53305346   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // G
53315347   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // K
r2864r2865
53335349   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Ron
53345350   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )
53355351
5336   PORT_START
5352   PORT_START_TAG("KEY3")
53375353   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D   )   PORT_PLAYER(2)   // D
53385354   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // H
53395355   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // L
r2864r2865
53415357   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )
53425358   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )
53435359
5344   PORT_START
5360   PORT_START_TAG("KEY4")
53455361   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN            )
53465362   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   PORT_PLAYER(2)   // "t"
53475363   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   PORT_PLAYER(2)   // "w"
r2864r2865
53495365   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   PORT_PLAYER(2)   // "b"
53505366   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   PORT_PLAYER(2)   // "s"
53515367
5352   // keyb 1
5353   PORT_START
5368   /* keyb 1 */
5369
5370   PORT_START_TAG("KEY5")
53545371   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A   )   // A
53555372   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E   )   // E
53565373   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // I
r2864r2865
53585375   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Kan
53595376   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1      )
53605377
5361   PORT_START
5378   PORT_START_TAG("KEY6")
53625379   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B   )   // B
53635380   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F   )   // F
53645381   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // J
r2864r2865
53665383   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Reach
53675384   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET   )   // BET
53685385
5369   PORT_START
5386   PORT_START_TAG("KEY7")
53705387   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C   )   // C
53715388   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // G
53725389   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // K
r2864r2865
53745391   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Ron
53755392   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )
53765393
5377   PORT_START
5394   PORT_START_TAG("KEY8")
53785395   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D   )   // D
53795396   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // H
53805397   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // L
r2864r2865
53825399   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )
53835400   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )
53845401
5385   PORT_START
5402   PORT_START_TAG("KEY9")
53865403   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN            )
53875404   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   // "t"
53885405   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   // "w"
r2864r2865
53905407   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   // "b"
53915408   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   // "s"
53925409
5393   PORT_START   // IN11 - DSW4
5410   PORT_START_TAG("DSW4")   /* IN11 - DSW4 */
53945411   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Demo_Sounds ) )
53955412   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
53965413   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2864r2865
54175434   PORT_DIPSETTING(    0x80, "Numbers" )
54185435   PORT_DIPSETTING(    0x00, "Letters" )
54195436
5420   PORT_START   // IN12 - DSW3
5437   PORT_START_TAG("DSW3")   /* IN12 - DSW3 */
54215438   PORT_DIPNAME( 0x03, 0x03, "Unknown 3-0&1" )
54225439   PORT_DIPSETTING(    0x03, "1" )
54235440   PORT_DIPSETTING(    0x02, "2" )
r2864r2865
54405457   PORT_DIPSETTING(    0x40, "2" )
54415458   PORT_DIPSETTING(    0x00, "3" )
54425459
5443   PORT_START   // IN13 - DSW2
5460   PORT_START_TAG("DSW2")   /* IN13 - DSW2 */
54445461   PORT_DIPNAME( 0x03, 0x03, "Unknown 2-0&1" )
54455462   PORT_DIPSETTING(    0x03, "1" )
54465463   PORT_DIPSETTING(    0x02, "2" )
r2864r2865
54635480   PORT_DIPSETTING(    0x40, "70" )
54645481   PORT_DIPSETTING(    0x00, "80" )
54655482
5466   PORT_START   // IN14 - DSW1
5483   PORT_START_TAG("DSW1")   /* IN14 - DSW1 */
54675484   PORT_DIPNAME( 0x07, 0x07, "Unknown 1-0&1&2" )
54685485   PORT_DIPSETTING(    0x07, "0" )
54695486   PORT_DIPSETTING(    0x06, "1" )
r2864r2865
54885505   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
54895506   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
54905507
5491   PORT_START   // IN15 - DSWs top bits
5508   PORT_START_TAG("DSW5")   /* IN15 - DSWs top bits */
54925509   PORT_DIPNAME( 0x01, 0x01, "Keyboard" )
54935510   PORT_DIPSETTING(    0x00, "Hanafuda" )   // Requires different inputs
54945511   PORT_DIPSETTING(    0x01, "Mahjong" )
r2864r2865
55125529   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
55135530   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
55145531
5515   PORT_START   // IN16 - Fake DSW
5532   PORT_START_TAG("BET")   /* IN16 - Fake DSW */
55165533   PORT_DIPNAME( 0x40, 0x40, "Allow Bets" )
55175534   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
55185535   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
r2864r2865
55205537INPUT_PORTS_END
55215538
55225539static INPUT_PORTS_START( hgokou )
5523   PORT_START   // IN0
5540   PORT_START_TAG("IN0")   /* IN0 */
55245541   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3   )   // medal out
55255542   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
55265543   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE  ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   PORT_TOGGLE
r2864r2865
55305547   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1   )
55315548   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )
55325549
5533   // keyb 1
5534   PORT_START   // IN1
5550   /* keyb 1 */
5551
5552   PORT_START_TAG("KEY0")   /* IN1 */
55355553   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)   // A
55365554   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD)   // E
55375555   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // I
r2864r2865
55395557   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE   )   // Kan
55405558   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1         )
55415559
5542   PORT_START   // IN2
5560   PORT_START_TAG("KEY1")   /* IN2 */
55435561   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)   // B
55445562   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)   // F
55455563   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // J
r2864r2865
55475565   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL   )   // Reach
55485566   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // BET
55495567
5550   PORT_START   // IN3
5568   PORT_START_TAG("KEY2")   /* IN3 */
55515569   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD)   // C
55525570   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // G
55535571   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // K
r2864r2865
55555573   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Ron
55565574   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )
55575575
5558   PORT_START   // IN4
5576   PORT_START_TAG("KEY3")   /* IN4 */
55595577   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD)   // D
55605578   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN            )   // H
55615579   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN            )   // L
r2864r2865
55635581   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN            )
55645582   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN            )
55655583
5566   PORT_START   // IN5
5584   PORT_START_TAG("KEY4")   /* IN5 */
55675585   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN   )
55685586   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "t"
55695587   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "w"
r2864r2865
55715589   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "b"
55725590   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "s"
55735591
5574   // keyb 2
5575   PORT_START   // IN6
5592   /* keyb 2 */
5593
5594   PORT_START_TAG("KEY5")   /* IN6 */
55765595   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   PORT_PLAYER(2)   // A
55775596   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   PORT_PLAYER(2)   // E
55785597   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // I
r2864r2865
55805599   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE   )   PORT_PLAYER(2)   // Kan
55815600   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2         )
55825601
5583   PORT_START   // IN7
5602   PORT_START_TAG("KEY6")   /* IN7 */
55845603   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   PORT_PLAYER(2)   // B
55855604   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   PORT_PLAYER(2)   // F
55865605   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // J
r2864r2865
55885607   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL   )   PORT_PLAYER(2)   // Reach
55895608   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // BET
55905609
5591   PORT_START   // IN8
5610   PORT_START_TAG("KEY7")   /* IN8 */
55925611   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C   )   PORT_PLAYER(2)   // C
55935612   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN      )   PORT_PLAYER(2)   // G
55945613   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // K
r2864r2865
55965615   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Ron
55975616   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )
55985617
5599   PORT_START   // IN9
5618   PORT_START_TAG("KEY8")   /* IN9 */
56005619   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D         )   PORT_PLAYER(2)   // D
56015620   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN            )   PORT_PLAYER(2)   // H
56025621   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN            )   // L
r2864r2865
56045623   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN            )
56055624   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN            )
56065625
5607   PORT_START   // IN10
5626   PORT_START_TAG("KEY9")   /* IN10 */
56085627   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN   )
56095628   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "t"
56105629   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "w"
r2864r2865
56125631   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "b"
56135632   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "s"
56145633
5615   PORT_START   // IN11 - DSW4
5634   PORT_START_TAG("DSW4")   /* IN11 - DSW4 */
56165635   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Demo_Sounds ) )
56175636   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
56185637   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2864r2865
56395658   PORT_DIPSETTING(    0x80, "Numbers" )
56405659   PORT_DIPSETTING(    0x00, "Letters" )
56415660
5642   PORT_START   // IN12 - DSW3
5661   PORT_START_TAG("DSW3")   /* IN12 - DSW3 */
56435662   PORT_DIPNAME( 0x03, 0x03, "Unknown 3-0&1" )
56445663   PORT_DIPSETTING(    0x03, "1" )
56455664   PORT_DIPSETTING(    0x02, "2" )
r2864r2865
56625681   PORT_DIPSETTING(    0x40, "2" )
56635682   PORT_DIPSETTING(    0x00, "3" )
56645683
5665   PORT_START   // IN13 - DSW2
5684   PORT_START_TAG("DSW2")   /* IN13 - DSW2 */
56665685   PORT_DIPNAME( 0x03, 0x03, "Unknown 2-0&1" )
56675686   PORT_DIPSETTING(    0x03, "1" )
56685687   PORT_DIPSETTING(    0x02, "2" )
r2864r2865
56855704   PORT_DIPSETTING(    0x40, "70" )
56865705   PORT_DIPSETTING(    0x00, "80" )
56875706
5688   PORT_START   // IN14 - DSW1
5707   PORT_START_TAG("DSW1")   /* IN14 - DSW1 */
56895708   PORT_DIPNAME( 0x07, 0x07, "Unknown 1-0&1&2" )
56905709   PORT_DIPSETTING(    0x07, "0" )
56915710   PORT_DIPSETTING(    0x06, "1" )
r2864r2865
57105729   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
57115730   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
57125731
5713   PORT_START   // IN15 - DSWs top bits
5732   PORT_START_TAG("DSW5")   /* IN15 - DSWs top bits */
57145733   PORT_DIPNAME( 0x01, 0x00, "Control Panel" )
57155734   PORT_DIPSETTING(    0x00, "Hanafuda" )
57165735   PORT_DIPSETTING(    0x01, "Mahjong" )   // Requires different inputs
r2864r2865
57365755INPUT_PORTS_END
57375756
57385757static INPUT_PORTS_START( mjmyornt )
5739   PORT_START   // IN0 - Coins + Service Keys
5758   PORT_START_TAG("IN0")   /* IN0 - Coins + Service Keys */
57405759   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3   )   // medal out
57415760   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
57425761   PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW)
r2864r2865
57465765   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1   )
57475766   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )
57485767
5749   // keyb 1
5750   PORT_START
5768   /* keyb 1 */
5769
5770   PORT_START_TAG("KEY0")
57515771   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   // A
57525772   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   // E
57535773   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   // I
r2864r2865
57555775   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   // Kan
57565776   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1         )   // Start 1
57575777
5758   PORT_START
5778   PORT_START_TAG("KEY1")
57595779   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   // B
57605780   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   // F
57615781   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   // J
r2864r2865
57635783   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   // Reach
57645784   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   // BET
57655785
5766   PORT_START
5786   PORT_START_TAG("KEY2")
57675787   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   // C
57685788   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   // G
57695789   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   // K
r2864r2865
57715791   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   // Ron
57725792   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
57735793
5774   PORT_START
5794   PORT_START_TAG("KEY3")
57755795   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   // D
57765796   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   // H
57775797   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   // L
r2864r2865
57795799   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
57805800   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
57815801
5782   PORT_START
5802   PORT_START_TAG("KEY4")
57835803   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   // "l"
57845804   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   // "t"
57855805   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   // "w"
r2864r2865
57875807   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   // "b"
57885808   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   // "s"
57895809
5790   PORT_START   // IN6 - DSW1
5810   PORT_START_TAG("DSW1")   /* IN6 - DSW1 */
57915811   PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
57925812   PORT_DIPSETTING(    0x00, "50" )
57935813   PORT_DIPSETTING(    0x01, "53" )
r2864r2865
58165836   PORT_DIPSETTING(    0x40, "10" )
58175837   PORT_DIPSETTING(    0x00, "20" )
58185838
5819   PORT_START   // IN7 - DSW2
5839   PORT_START_TAG("DSW2")   /* IN7 - DSW2 */
58205840   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
58215841   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
58225842   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
r2864r2865
58405860   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
58415861   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
58425862
5843   PORT_START   // IN8 - DSW3
5863   PORT_START_TAG("DSW3")   /* IN8 - DSW3 */
58445864   PORT_DIPNAME( 0x03, 0x03, "YAKUMAN Times" )
58455865//  PORT_DIPSETTING(    0x00, "1" )
58465866   PORT_DIPSETTING(    0x03, "1" )
r2864r2865
58645884   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
58655885   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
58665886
5867   PORT_START   // IN9 - DSW4
5887   PORT_START_TAG("DSW4")   /* IN9 - DSW4 */
58685888   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
58695889   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
58705890   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
58905910   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
58915911   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
58925912
5893   PORT_START   // IN10 - DSWs top bits
5913   PORT_START_TAG("DSW5")   /* IN10 - DSWs top bits */
58945914   PORT_DIPNAME( 0x03, 0x03, "Computer Strength?" )
58955915   PORT_DIPSETTING(    0x03, "Weak" )
58965916   PORT_DIPSETTING(    0x02, DEF_STR( Normal ))
r2864r2865
59185938
59195939#ifdef UNUSED_DEFINITION
59205940static INPUT_PORTS_START( mjmyuniv )
5921   PORT_START   // IN0 - Coins + Service Keys
5941   PORT_START_TAG("IN0")   /* IN0 - Coins + Service Keys */
59225942   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3   )   // medal out
59235943   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )
59245944   PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW)
r2864r2865
59285948   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1   )
59295949   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )
59305950
5931   // keyb 1
5932   PORT_START
5951   /* keyb 1 */
5952
5953   PORT_START_TAG("KEY0")
59335954   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   // A
59345955   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   // E
59355956   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   // I
r2864r2865
59375958   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   // Kan
59385959   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1         )   // Start 1
59395960
5940   PORT_START
5961   PORT_START_TAG("KEY1")
59415962   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   // B
59425963   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   // F
59435964   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   // J
r2864r2865
59455966   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   // Reach
59465967   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   // BET
59475968
5948   PORT_START
5969   PORT_START_TAG("KEY2")
59495970   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   // C
59505971   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   // G
59515972   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   // K
r2864r2865
59535974   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   // Ron
59545975   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
59555976
5956   PORT_START
5977   PORT_START_TAG("KEY3")
59575978   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   // D
59585979   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   // H
59595980   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   // L
r2864r2865
59615982   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
59625983   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
59635984
5964   PORT_START
5985   PORT_START_TAG("KEY4")
59655986   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   // "l"
59665987   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   // "t"
59675988   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   // "w"
r2864r2865
59695990   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   // "b"
59705991   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   // "s"
59715992
5972   PORT_START   // IN6 - DSW1
5993   PORT_START_TAG("DSW1")   /* IN6 - DSW1 */
59735994   PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
59745995   PORT_DIPSETTING(    0x00, "50" )
59755996   PORT_DIPSETTING(    0x01, "53" )
r2864r2865
59986019   PORT_DIPSETTING(    0x40, "10" )
59996020   PORT_DIPSETTING(    0x00, "20" )
60006021
6001   PORT_START   // IN7 - DSW2
6022   PORT_START_TAG("DSW2")   /* IN7 - DSW2 */
60026023   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
60036024   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
60046025   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
r2864r2865
60226043   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
60236044   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
60246045
6025   PORT_START   // IN8 - DSW3
6046   PORT_START_TAG("DSW3")   /* IN8 - DSW3 */
60266047   PORT_DIPNAME( 0x03, 0x03, "YAKUMAN Times" )
60276048//  PORT_DIPSETTING(    0x00, "1" )
60286049   PORT_DIPSETTING(    0x03, "1" )
r2864r2865
60466067   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
60476068   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
60486069
6049   PORT_START   // IN9 - DSW4
6070   PORT_START_TAG("DSW4")   /* IN9 - DSW4 */
60506071   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
60516072   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
60526073   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
60726093   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
60736094   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
60746095
6075   PORT_START   // IN10 - DSWs top bits
6096   PORT_START_TAG("DSW5")   /* IN10 - DSWs top bits */
60766097   PORT_DIPNAME( 0x03, 0x03, "Computer Strength?" )
60776098   PORT_DIPSETTING(    0x03, "Weak" )
60786099   PORT_DIPSETTING(    0x02, DEF_STR( Normal ))
r2864r2865
61006121#endif
61016122
61026123static INPUT_PORTS_START( akamaru )
6103   PORT_START   // IN0 - Player 1
6124   PORT_START_TAG("IN0")   /* IN0 - Player 1 */
61046125   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
61056126   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
61066127   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
r2864r2865
61106131   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
61116132   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
61126133
6113   PORT_START   // IN1 - Player 2
6134   PORT_START_TAG("IN1")   /* IN1 - Player 2 */
61146135   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
61156136   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
61166137   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
r2864r2865
61206141   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
61216142   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
61226143
6123   PORT_START   // IN2 - Coins + ?
6144   PORT_START_TAG("IN2")   /* IN2 - Coins + ? */
61246145   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1    )
61256146   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2    )
61266147   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )
r2864r2865
61306151   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL  )   // blitter irq flag
61316152   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL  )   // blitter busy flag
61326153
6133   PORT_START   // IN3 - DSW1
6154   PORT_START_TAG("DSW1")   /* IN3 - DSW1 */
61346155   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
61356156   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
61366157   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
r2864r2865
61526173   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
61536174   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
61546175
6155   PORT_START   // IN4 - DSW2
6176   PORT_START_TAG("DSW2")   /* IN4 - DSW2 */
61566177   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
61576178   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
61586179   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
r2864r2865
61796200INPUT_PORTS_END
61806201
61816202static INPUT_PORTS_START( mjflove )
6182   PORT_START   // IN0 - Coins + Service Keys
6203   PORT_START_TAG("IN0")   /* IN0 - Coins + Service Keys */
61836204   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1    )
61846205   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2    )
61856206   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )
r2864r2865
61896210   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL  )   // blitter irq flag
61906211   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL  )   // blitter busy flag
61916212
6192   // keyb 1
6193   PORT_START
6213   /* keyb 1 */
6214
6215   PORT_START_TAG("KEY0")
61946216   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   // A
61956217   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   // E
61966218   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   // I
r2864r2865
61986220   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   // Kan
61996221   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1         )   // Start 1
62006222
6201   PORT_START
6223   PORT_START_TAG("KEY1")
62026224   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   // B
62036225   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   // F
62046226   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   // J
r2864r2865
62066228   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   // Reach
62076229   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   // BET
62086230
6209   PORT_START
6231   PORT_START_TAG("KEY2")
62106232   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   // C
62116233   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   // G
62126234   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   // K
r2864r2865
62146236   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   // Ron
62156237   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
62166238
6217   PORT_START
6239   PORT_START_TAG("KEY3")
62186240   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   // D
62196241   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   // H
62206242   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   // L
r2864r2865
62226244   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
62236245   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
62246246
6225   PORT_START
6247   PORT_START_TAG("KEY4")
62266248   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   // "l"
62276249   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   // "t"
62286250   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   // "w"
r2864r2865
62306252   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   // "b"
62316253   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   // "s"
62326254
6233   // keyb 2
6234   PORT_START
6255   /* keyb 2 */
6256
6257   PORT_START_TAG("KEY5")
62356258   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A      )   PORT_PLAYER(2)   // A
62366259   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E      )   PORT_PLAYER(2)   // E
62376260   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I      )   PORT_PLAYER(2)   // I
r2864r2865
62396262   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN      )   PORT_PLAYER(2)   // Kan
62406263   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2         )   // Start 2
62416264
6242   PORT_START
6265   PORT_START_TAG("KEY6")
62436266   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B      )   PORT_PLAYER(2)   // B
62446267   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F      )   PORT_PLAYER(2)   // F
62456268   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J      )   PORT_PLAYER(2)   // J
r2864r2865
62476270   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH   )   PORT_PLAYER(2)   // Reach
62486271   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET      )   PORT_PLAYER(2)   // BET
62496272
6250   PORT_START
6273   PORT_START_TAG("KEY7")
62516274   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C      )   PORT_PLAYER(2)   // C
62526275   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G      )   PORT_PLAYER(2)   // G
62536276   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K      )   PORT_PLAYER(2)   // K
r2864r2865
62556278   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON      )   PORT_PLAYER(2)   // Ron
62566279   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
62576280
6258   PORT_START
6281   PORT_START_TAG("KEY8")
62596282   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D      )   PORT_PLAYER(2)   // D
62606283   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H      )   PORT_PLAYER(2)   // H
62616284   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L      )   PORT_PLAYER(2)   // L
r2864r2865
62636286   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
62646287   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN         )   // nothing
62656288
6266   PORT_START
6289   PORT_START_TAG("KEY9")
62676290   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE   )   PORT_PLAYER(2)   // "l"
62686291   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE      )   PORT_PLAYER(2)   // "t"
62696292   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP   )   PORT_PLAYER(2)   // "w"
r2864r2865
62716294   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG         )   PORT_PLAYER(2)   // "b"
62726295   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL      )   PORT_PLAYER(2)   // "s"
62736296
6274   PORT_START   // IN11 - DSW1
6297   PORT_START_TAG("DSW1")   /* IN11 - DSW1 */
62756298   PORT_DIPNAME( 0x01, 0x01, "Unknown 2-0" )
62766299   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
62776300   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
62976320   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
62986321   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
62996322
6300   PORT_START   // IN12 - DSW2
6323   PORT_START_TAG("DSW2")   /* IN12 - DSW2 */
63016324   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
63026325   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
63036326   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
r2864r2865
63226345INPUT_PORTS_END
63236346
63246347static INPUT_PORTS_START( hparadis )
6325   PORT_START   // IN0 - Player 1
6348   PORT_START_TAG("IN0")   /* IN0 - Player 1 */
63266349   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
63276350   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
63286351   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
r2864r2865
63326355   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
63336356   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
63346357
6335   PORT_START   // IN1 - Player 2
6358   PORT_START_TAG("IN1")   /* IN1 - Player 2 */
63366359   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
63376360
6338   PORT_START   // IN2
6361   PORT_START_TAG("IN2")   /* IN2 */
63396362   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1    )
63406363   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2    )
63416364   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
63456368   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN  )
63466369   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN  )
63476370
6348   // keyb 1
6349   PORT_START   // IN3
6371   /* keyb 1 */
6372
6373   PORT_START_TAG("KEY0")   /* IN3 */
63506374   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)   // A
63516375   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("5") PORT_CODE(KEYCODE_5_PAD)   // E
63526376   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // I
r2864r2865
63546378   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Kan
63556379   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1      )
63566380
6357   PORT_START   // IN4
6381   PORT_START_TAG("KEY1")   /* IN4 */
63586382   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)   // B
63596383   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("6") PORT_CODE(KEYCODE_6_PAD)   // F
63606384   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // J
r2864r2865
63626386   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Reach
63636387   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // BET
63646388
6365   PORT_START   // IN5
6389   PORT_START_TAG("KEY2")   /* IN5 */
63666390   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("3") PORT_CODE(KEYCODE_3_PAD)   // C
63676391   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("7") PORT_CODE(KEYCODE_7_PAD)   // G
63686392   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // K
r2864r2865
63706394   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Ron
63716395   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )
63726396
6373   PORT_START   // IN6
6397   PORT_START_TAG("KEY3")   /* IN6 */
63746398   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD)   // D
63756399   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("8") PORT_CODE(KEYCODE_8_PAD)   // H
63766400   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // L
r2864r2865
63786402   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )
63796403   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )
63806404
6381   PORT_START   // IN7
6405   PORT_START_TAG("KEY4")   /* IN7 */
63826406   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN   )
63836407   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "t"
63846408   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "w"
r2864r2865
63866410   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "b"
63876411   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "s"
63886412
6389   // keyb 2
6390   PORT_START   // IN8
6413   /* keyb 2 */
6414
6415   PORT_START_TAG("KEY5")   /* IN8 */
63916416   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A   )   PORT_PLAYER(2)   // A
63926417   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E   )   PORT_PLAYER(2)   // E
63936418   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // I
r2864r2865
63956420   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Kan
63966421   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2      )
63976422
6398   PORT_START   // IN9
6423   PORT_START_TAG("KEY6")   /* IN9 */
63996424   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B   )   PORT_PLAYER(2)   // B
64006425   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F   )   PORT_PLAYER(2)   // F
64016426   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // J
r2864r2865
64036428   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Reach
64046429   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // BET
64056430
6406   PORT_START   // IN10
6431   PORT_START_TAG("KEY7")   /* IN10 */
64076432   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C   )   PORT_PLAYER(2)   // C
64086433   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G   )   PORT_PLAYER(2)   // G
64096434   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // K
r2864r2865
64116436   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // Ron
64126437   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )
64136438
6414   PORT_START   // IN11
6439   PORT_START_TAG("KEY8")   /* IN11 */
64156440   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D   )   PORT_PLAYER(2)   // D
64166441   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H   )   PORT_PLAYER(2)   // H
64176442   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN      )   // L
r2864r2865
64196444   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN      )
64206445   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN      )
64216446
6422   PORT_START   // IN12
6447   PORT_START_TAG("KEY9")   /* IN12 */
64236448   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN   )
64246449   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "t"
64256450   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "w"
r2864r2865
64276452   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "b"
64286453   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // "s"
64296454
6430   PORT_START   // IN13 - DSW1
6455   PORT_START_TAG("DSW1")   /* IN13 - DSW1 */
64316456   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
64326457   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
64336458   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
r2864r2865
64506475   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
64516476   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
64526477
6453   PORT_START   // IN14 - DSW2
6478   PORT_START_TAG("DSW2")   /* IN14 - DSW2 */
64546479   PORT_DIPNAME( 0x03, 0x03, "Unknown 2-0&1" )
64556480   PORT_DIPSETTING(    0x03, "0" )
64566481   PORT_DIPSETTING(    0x02, "1" )
r2864r2865
64756500   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
64766501   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
64776502
6478   PORT_START   // IN15 - DSWs top bits
6503   PORT_START_TAG("DSW3")   /* IN15 - DSWs top bits */
64796504   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
64806505   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
64816506   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
src/mame/drivers/kaneko16.c
r2864r2865
598598
599599static READ16_HANDLER( gtmr_wheel_r )
600600{
601   if ( (input_port_read_indexed(machine, 4) & 0x1800) == 0x10)   // DSW setting
602      return   input_port_read_indexed(machine, 5)<<8;         // 360' Wheel
601   if ( (input_port_read(machine, "DSW1") & 0x1800) == 0x10)   // DSW setting
602      return   input_port_read(machine, "WHEEL0")<<8;         // 360' Wheel
603603   else
604      return   input_port_read_indexed(machine, 5);            // 270' Wheel
604      return   input_port_read(machine, "WHEEL0");            // 270' Wheel
605605}
606606
607607static WRITE16_HANDLER( gtmr_oki_0_bank_w )
r2864r2865
703703
704704static READ16_HANDLER( gtmr2_wheel_r )
705705{
706   switch (input_port_read_indexed(machine, 4) & 0x1800)
706   switch (input_port_read(machine, "DSW1") & 0x1800)
707707   {
708708      case 0x0000:   // 270' A. Wheel
709         return   (input_port_read_indexed(machine, 5));
709         return   (input_port_read(machine, "WHEEL0"));
710710         break;
711711      case 0x1000:   // 270' D. Wheel
712         return   (input_port_read_indexed(machine, 6) << 8);
712         return   (input_port_read(machine, "WHEEL1") << 8);
713713         break;
714714      case 0x0800:   // 360' Wheel
715         return   (input_port_read_indexed(machine, 7) << 8);
715         return   (input_port_read(machine, "WHEEL2") << 8);
716716         break;
717717      default:
718718         logerror("gtmr2_wheel_r : read at %06x with joystick\n", activecpu_get_pc());
r2864r2865
723723
724724static READ16_HANDLER( gtmr2_IN1_r )
725725{
726   return   (input_port_read_indexed(machine, 1) & (input_port_read_indexed(machine, 8) | ~0x7100));
726   return   (input_port_read(machine, "IN1") & (input_port_read(machine, "FAKE") | ~0x7100));
727727}
728728
729729static ADDRESS_MAP_START( gtmr2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
r2864r2865
874874***************************************************************************/
875875
876876static INPUT_PORTS_START( bakubrkr )
877   PORT_START   // IN0 - Player 1 + DSW - e00000.w
877   PORT_START_TAG("IN0")   // IN0 - Player 1 + DSW - e00000.w
878878   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1")
879879   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
880880   PORT_DIPSETTING(      0x0000, DEF_STR( On )  )
r2864r2865
896896   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
897897   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
898898
899   PORT_START   // IN1 - Player 2 - e00002.b
899   PORT_START_TAG("IN1")   // IN1 - Player 2 - e00002.b
900900   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
901901   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
902902   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
906906   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
907907   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
908908
909   PORT_START   // IN2 - Coins - e00004.b
909   PORT_START_TAG("IN2")   // IN2 - Coins - e00004.b
910910   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1   )
911911   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2   )
912912   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
r2864r2865
916916   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1   )
917917   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN   )
918918
919   PORT_START   // IN3 - Seems unused ! - e00006.b
919   PORT_START_TAG("IN3")   // IN3 - Seems unused ! - e00006.b
920920   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
921921   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
922922   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
933933***************************************************************************/
934934
935935static INPUT_PORTS_START( berlwall )
936   PORT_START   // IN0 - Player 1 - 680000.w
936   PORT_START_TAG("IN0")   // IN0 - Player 1 - 680000.w
937937   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
938938   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
939939   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
943943   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
944944   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
945945
946   PORT_START   // IN1 - Player 2 - 680002.w
946   PORT_START_TAG("IN1")   // IN1 - Player 2 - 680002.w
947947   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
948948   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
949949   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
953953   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
954954   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
955955
956   PORT_START   // IN2 - Coins - 680004.w
956   PORT_START_TAG("IN2")   // IN2 - Coins - 680004.w
957957   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1   )
958958   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2   )
959959   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
r2864r2865
963963   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1   )
964964   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN   )
965965
966   PORT_START   // IN3 - ? - 680006.w
966   PORT_START_TAG("IN3")   // IN3 - ? - 680006.w
967967   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
968968   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
969969   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
10431043***************************************************************************/
10441044
10451045static INPUT_PORTS_START( blazeon )
1046   PORT_START   // IN0 - Player 1 + DSW - c00000.w
1046   PORT_START_TAG("IN0")   // IN0 - Player 1 + DSW - c00000.w
10471047   PORT_DIPNAME( 0x0003,  0x0003, DEF_STR( Difficulty )  ) PORT_DIPLOCATION("SW2:1,2")
10481048   PORT_DIPSETTING(       0x0002, DEF_STR( Easy )        )
10491049   PORT_DIPSETTING(       0x0003, DEF_STR( Normal )      )
r2864r2865
10701070   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START1         )
10711071   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN1          ) PORT_IMPULSE(2)
10721072
1073   PORT_START   // IN1 - Player 2 - c00002.w
1073   PORT_START_TAG("IN1")   // IN1 - Player 2 - c00002.w
10741074   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A )   ) PORT_DIPLOCATION("SW1:1,2,3,4")
10751075   PORT_DIPSETTING(      0x0007, DEF_STR( 4C_1C )    )
10761076   PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C )    )
r2864r2865
11161116   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START2         )
11171117   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN2          ) PORT_IMPULSE(2)
11181118
1119   PORT_START   // IN2 - ? - c00004.w
1119   PORT_START_TAG("IN2")   // IN2 - ? - c00004.w
11201120   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN )   // unused?
11211121
1122   PORT_START   // IN3 - Other Buttons - c00006.w
1122   PORT_START_TAG("IN3")   // IN3 - Other Buttons - c00006.w
11231123   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN  )
11241124   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN  )
11251125   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN  )
r2864r2865
11351135***************************************************************************/
11361136
11371137static INPUT_PORTS_START( bloodwar )
1138   PORT_START   // IN0 - Player 1 - b00000.w
1138   PORT_START_TAG("IN0")   // IN0 - Player 1 - b00000.w
11391139   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP      ) PORT_PLAYER(1)
11401140   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN      ) PORT_PLAYER(1)
11411141   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT      ) PORT_PLAYER(1)
r2864r2865
11451145   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3         ) PORT_PLAYER(1)
11461146   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4         ) PORT_PLAYER(1)
11471147
1148   PORT_START   // IN1 - Player 2 - b00002.w
1148   PORT_START_TAG("IN1")   // IN1 - Player 2 - b00002.w
11491149   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP      ) PORT_PLAYER(2)
11501150   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN      ) PORT_PLAYER(2)
11511151   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT      ) PORT_PLAYER(2)
r2864r2865
11551155   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3         ) PORT_PLAYER(2)
11561156   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
11571157
1158   PORT_START   // IN2 - Coins - b00004.w
1158   PORT_START_TAG("IN2")   // IN2 - Coins - b00004.w
11591159   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1   )
11601160   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2   )
11611161   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
r2864r2865
11651165   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1   )
11661166   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SERVICE2   )   // tested
11671167
1168   PORT_START   // IN3 - ? - b00006.w
1168   PORT_START_TAG("IN3")   // IN3 - ? - b00006.w
11691169   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )   // tested
11701170   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
11711171   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)   // tested
r2864r2865
11751175   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
11761176   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
11771177
1178   PORT_START   // IN4 - DSW from the MCU - $10497e.b <- $208000.b
1178   PORT_START_TAG("DSW1")   // IN4 - DSW from the MCU - $10497e.b <- $208000.b
11791179   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1")
11801180   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
11811181   PORT_DIPSETTING(      0x0100, DEF_STR( On ) )
r2864r2865
12051205***************************************************************************/
12061206
12071207static INPUT_PORTS_START( bonkadv )
1208   PORT_START   // IN0 - Player 1 - b00000.w
1208   PORT_START_TAG("IN0")   // IN0 - Player 1 - b00000.w
12091209   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP      ) PORT_PLAYER(1)
12101210   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN      ) PORT_PLAYER(1)
12111211   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT      ) PORT_PLAYER(1)
r2864r2865
12151215   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3         ) PORT_PLAYER(1)
12161216   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4         ) PORT_PLAYER(1)
12171217
1218   PORT_START   // IN1 - Player 2 - b00002.w
1218   PORT_START_TAG("IN1")   // IN1 - Player 2 - b00002.w
12191219   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP      ) PORT_PLAYER(2)
12201220   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN      ) PORT_PLAYER(2)
12211221   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT      ) PORT_PLAYER(2)
r2864r2865
12251225   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3         ) PORT_PLAYER(2)
12261226   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4         ) PORT_PLAYER(2)
12271227
1228   PORT_START   // IN2 - Coins - b00004.w
1228   PORT_START_TAG("IN2")   // IN2 - Coins - b00004.w
12291229   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1   )
12301230   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2   )
12311231   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
r2864r2865
12351235   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1   )
12361236   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SERVICE2   )
12371237
1238   PORT_START   // IN3 - ? - b00006.w
1238   PORT_START_TAG("IN3")   // IN3 - ? - b00006.w
12391239   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
12401240   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
12411241   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
12451245   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
12461246   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
12471247
1248   PORT_START   // IN4 - DSW from the MCU - $10019e.b <- $200200.b
1248   PORT_START_TAG("DSW1")   // IN4 - DSW from the MCU - $10019e.b <- $200200.b
12491249   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) )
12501250   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
12511251   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
12761276***************************************************************************/
12771277
12781278static INPUT_PORTS_START( gtmr )
1279   PORT_START   // IN0 - Player 1 - b00000.w
1279   PORT_START_TAG("IN0")   // IN0 - Player 1 - b00000.w
12801280   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
12811281   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
12821282   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
12861286   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
12871287   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
12881288
1289   PORT_START   // IN1 - Player 2 - b00002.w
1289   PORT_START_TAG("IN1")   // IN1 - Player 2 - b00002.w
12901290   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
12911291   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
12921292   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
12961296   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
12971297   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
12981298
1299   PORT_START   // IN2 - Coins - b00004.w
1299   PORT_START_TAG("IN2")   // IN2 - Coins - b00004.w
13001300   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1   )
13011301   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2   )
13021302   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
r2864r2865
13061306   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1   )
13071307   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN   )
13081308
1309   PORT_START   // IN3 - Seems unused ! - b00006.w
1309   PORT_START_TAG("IN3")   // IN3 - Seems unused ! - b00006.w
13101310   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
13111311   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
13121312   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
13161316   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
13171317   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
13181318
1319   PORT_START   // IN4 - DSW from the MCU - 101265.b <- 206000.b
1319   PORT_START_TAG("DSW1")   // IN4 - DSW from the MCU - 101265.b <- 206000.b
13201320   PORT_SERVICE_DIPLOC(  0x0100, IP_ACTIVE_LOW, "SW1:1" )
13211321   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:2")
13221322   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
r2864r2865
13391339   PORT_DIPSETTING(      0x4000, "Flag Only" )
13401340   PORT_DIPSETTING(      0x0000, DEF_STR( None ) )
13411341
1342   PORT_START   // IN5 - Wheel - 100015.b <- ffffe.b
1342   PORT_START_TAG("WHEEL0")   // IN5 - Wheel - 100015.b <- ffffe.b
13431343   PORT_BIT ( 0x00ff, 0x0080, IPT_PADDLE ) PORT_SENSITIVITY(30) PORT_KEYDELTA(1)
13441344INPUT_PORTS_END
13451345
r2864r2865
13491349***************************************************************************/
13501350
13511351static INPUT_PORTS_START( gtmr2 )
1352   PORT_START   // IN0 - Player 1 - 100004.w <- b00000.w (cpl)
1352   PORT_START_TAG("IN0")   // IN0 - Player 1 - 100004.w <- b00000.w (cpl)
13531353   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
13541354   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
13551355   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
13591359   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
13601360   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
13611361
1362   PORT_START   // IN1 - Player 2 - 10000c.w <- b00002.w (cpl) - for "test mode" only
1362   PORT_START_TAG("IN1")   // IN1 - Player 2 - 10000c.w <- b00002.w (cpl) - for "test mode" only
13631363   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
13641364   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
13651365   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
13691369   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
13701370   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
13711371
1372   PORT_START   // IN2 - Coins - 100014.w <- b00004.w (cpl)
1372   PORT_START_TAG("IN2")   // IN2 - Coins - 100014.w <- b00004.w (cpl)
13731373   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1   )
13741374   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2   )   // only in "test mode"
13751375   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
r2864r2865
13791379   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1   )
13801380   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN   )
13811381
1382   PORT_START   // IN3 - 100017.w <- b00006.w
1382   PORT_START_TAG("IN3")   // IN3 - 100017.w <- b00006.w
13831383   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
13841384   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
13851385   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
13891389   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("IN 3-6")   // Code at 0x002236 - Centers 270D wheel ?
13901390   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
13911391
1392   PORT_START   // IN4 - DSW from the MCU - 1016f7.b <- 206000.b
1392   PORT_START_TAG("DSW1")   // IN4 - DSW from the MCU - 1016f7.b <- 206000.b
13931393   PORT_DIPNAME( 0x0700, 0x0700, "Linked Operation Board Number" ) PORT_DIPLOCATION("SW1:6,7,8")
13941394   PORT_DIPSETTING(      0x0700, "No Communication" )
13951395   PORT_DIPSETTING(      0x0600, "Board #1" )
r2864r2865
14141414   PORT_DIPSETTING(      0x0000, DEF_STR( On )  )
14151415   PORT_SERVICE_DIPLOC(  0x8000, IP_ACTIVE_LOW, "SW1:1" )
14161416
1417   PORT_START   // IN5 - Wheel (270A) - 100019.b <- fffff.b
1417   PORT_START_TAG("WHEEL0")   // IN5 - Wheel (270A) - 100019.b <- fffff.b
14181418   PORT_BIT ( 0x00ff, 0x0080, IPT_PADDLE ) PORT_SENSITIVITY(30) PORT_KEYDELTA(1)
14191419
1420   PORT_START   // IN6 - Wheel (270D) - 100019.b <- ffffe.b
1420   PORT_START_TAG("WHEEL1")   // IN6 - Wheel (270D) - 100019.b <- ffffe.b
14211421   PORT_BIT ( 0x00ff, 0x0080, IPT_PADDLE ) PORT_SENSITIVITY(30) PORT_KEYDELTA(1)
14221422
1423   PORT_START   // IN7 - Wheel (360) - 100019.b <- ffffe.b
1423   PORT_START_TAG("WHEEL2")   // IN7 - Wheel (360) - 100019.b <- ffffe.b
14241424   PORT_BIT( 0x00ff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT)
14251425
1426   PORT_START   // Fake IN1 - To be pressed during boot sequence - Code at 0x000c9e
1426   PORT_START_TAG("FAKE")   // Fake IN1 - To be pressed during boot sequence - Code at 0x000c9e
14271427   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("IN 1-0") PORT_CODE(KEYCODE_H)   // "sound test"
14281428   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
14291429   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
14401440***************************************************************************/
14411441
14421442static INPUT_PORTS_START( mgcrystl )
1443   PORT_START   // IN0 - Player 1 + DSW - c00000.w
1443   PORT_START_TAG("IN0")   // IN0 - Player 1 + DSW - c00000.w
14441444   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1")
14451445   PORT_DIPSETTING(      0x0001, DEF_STR( Off )         )
14461446   PORT_DIPSETTING(      0x0000, DEF_STR( On )          )
r2864r2865
14621462   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
14631463   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
14641464
1465   PORT_START   // IN1 - Player 2 - c00002.b
1465   PORT_START_TAG("IN1")   // IN1 - Player 2 - c00002.b
14661466   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
14671467   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
14681468   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
14811481   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
14821482   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
14831483
1484   PORT_START   // IN2 - Other Buttons - c00004.b
1484   PORT_START_TAG("IN2")   // IN2 - Other Buttons - c00004.b
14851485   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN  )
14861486   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1   )
14871487   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2   )
r2864r2865
15001500***************************************************************************/
15011501
15021502static INPUT_PORTS_START( shogwarr )
1503   PORT_START   // IN0 - - b80000.w
1503   PORT_START_TAG("IN0")   // IN0 - - b80000.w
15041504   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
15051505   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
15061506   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
15101510   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
15111511   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )   // ? tested
15121512
1513   PORT_START   // IN1 - - b80002.w
1513   PORT_START_TAG("IN1")   // IN1 - - b80002.w
15141514   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
15151515   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
15161516   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
15201520   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
15211521   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )   // ? tested
15221522
1523   PORT_START   // IN2 - Coins - b80004.w
1523   PORT_START_TAG("IN2")   // IN2 - Coins - b80004.w
15241524   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1   )
15251525   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2   )
15261526   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
r2864r2865
15301530   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1   )
15311531   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN   )   // ? tested
15321532
1533   PORT_START   // IN3 - ? - b80006.w
1533   PORT_START_TAG("IN3")   // IN3 - ? - b80006.w
15341534   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
15351535   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
15361536   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
15401540   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
15411541   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
15421542
1543   PORT_START   // IN4 - DSW from the MCU - 102e15.b <- 200059.b
1543   PORT_START_TAG("DSW1")   // IN4 - DSW from the MCU - 102e15.b <- 200059.b
15441544   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1")
15451545   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
15461546   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
src/mame/drivers/gauntlet.c
r2864r2865
193193
194194static READ16_HANDLER( port4_r )
195195{
196   int temp = input_port_read_indexed(machine, 4);
196   int temp = input_port_read(machine, "IN4");
197197   if (atarigen_cpu_to_sound_ready) temp ^= 0x0020;
198198   if (atarigen_sound_to_cpu_ready) temp ^= 0x0010;
199199   return temp;
r2864r2865
237237   if (atarigen_cpu_to_sound_ready) temp ^= 0x80;
238238   if (atarigen_sound_to_cpu_ready) temp ^= 0x40;
239239   if (tms5220_ready_r()) temp ^= 0x20;
240   if (!(input_port_read_indexed(machine, 4) & 0x0008)) temp ^= 0x10;
240   if (!(input_port_read(machine, "IN4") & 0x0008)) temp ^= 0x10;
241241
242242   return temp;
243243}
r2864r2865
16311631 *
16321632 *************************************/
16331633
1634static void gauntlet_common_init(int slapstic, int vindctr2)
1634static void gauntlet_common_init(running_machine *machine, int slapstic, int vindctr2)
16351635{
16361636   UINT8 *rom = memory_region(REGION_CPU1);
16371637   atarigen_eeprom_default = NULL;
1638   atarigen_slapstic_init(0, 0x038000, 0, slapstic);
1638   atarigen_slapstic_init(machine, 0, 0x038000, 0, slapstic);
16391639
16401640   /* swap the top and bottom halves of the main CPU ROM images */
16411641   atarigen_swap_mem(rom + 0x000000, rom + 0x008000, 0x8000);
r2864r2865
16511651
16521652static DRIVER_INIT( gauntlet )
16531653{
1654   gauntlet_common_init(104, 0);
1654   gauntlet_common_init(machine, 104, 0);
16551655}
16561656
16571657
16581658static DRIVER_INIT( gaunt2p )
16591659{
1660   gauntlet_common_init(107, 0);
1660   gauntlet_common_init(machine, 107, 0);
16611661}
16621662
16631663
16641664static DRIVER_INIT( gauntlet2 )
16651665{
1666   gauntlet_common_init(106, 0);
1666   gauntlet_common_init(machine, 106, 0);
16671667}
16681668
16691669
r2864r2865
16731673   UINT8 *data = malloc_or_die(0x8000);
16741674   int i;
16751675
1676   gauntlet_common_init(118, 1);
1676   gauntlet_common_init(machine, 118, 1);
16771677
16781678   /* highly strange -- the address bits on the chip at 2J (and only that
16791679       chip) are scrambled -- this is verified on the schematics! */
src/mame/drivers/ms32.c
r2864r2865
12881288   return i;
12891289}
12901290
1291static void irq_init(void)
1291static void irq_init(running_machine *machine)
12921292{
12931293   irqreq = 0;
1294   cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
1294   cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
12951295   cpunum_set_irq_callback(0, irq_callback);
12961296}
12971297
1298static void irq_raise(int level)
1298static void irq_raise(running_machine *machine, int level)
12991299{
13001300   irqreq |= (1<<level);
1301   cpunum_set_input_line(Machine, 0, 0, ASSERT_LINE);
1301   cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
13021302}
13031303
13041304static INTERRUPT_GEN(ms32_interrupt)
13051305{
1306   if( cpu_getiloops() == 0 ) irq_raise(10);
1307   if( cpu_getiloops() == 1 ) irq_raise(9);
1306   if( cpu_getiloops() == 0 ) irq_raise(machine, 10);
1307   if( cpu_getiloops() == 1 ) irq_raise(machine, 9);
13081308   /* hayaosi2 needs at least 12 IRQ 0 per frame to work (see code at FFE02289)
13091309       kirarast needs it too, at least 8 per frame, but waits for a variable amount
13101310       47pi2 needs ?? per frame (otherwise it hangs when you lose)
r2864r2865
13131313       desertwr
13141314       p47aces
13151315       */
1316   if( cpu_getiloops() >= 3 && cpu_getiloops() <= 32 ) irq_raise(0);
1316   if( cpu_getiloops() >= 3 && cpu_getiloops() <= 32 ) irq_raise(machine, 0);
13171317}
13181318
13191319/********** SOUND **********/
r2864r2865
13541354static WRITE8_HANDLER( to_main_w )
13551355{
13561356      to_main=data;
1357      irq_raise(1);
1357      irq_raise(machine, 1);
13581358}
13591359
13601360static ADDRESS_MAP_START( ms32_snd_readmem, ADDRESS_SPACE_PROGRAM, 8 )
r2864r2865
13911391   memory_set_bankptr(1, memory_region(REGION_CPU1));
13921392   memory_set_bank(4, 0);
13931393   memory_set_bank(5, 1);
1394   irq_init();
1394   irq_init(machine);
13951395}
13961396
13971397/********** MACHINE DRIVER **********/
src/mame/drivers/system16.c
r2864r2865
169169#include "sound/2151intf.h"
170170#include "sound/upd7759.h"
171171
172void fd1094_machine_init(void);
173void fd1094_driver_init(void (*set_decrypted)(UINT8 *));
174
175172static void sys16_video_config(void (*update)(void), int sprxoffs, const int *bank)
176173{
177174   static const int bank_default[16] =
r2864r2865
26342631   ROM_LOAD( "pas4p.2",  0x10000, 0x10000, CRC(092e016e) SHA1(713638749efa9dce19c547b84308236110bc85fe) )
26352632ROM_END
26362633
2634/* Passing Shot Bootleg is a decrypted version of Passing Shot Japanese (passshtj). It has been heavily modified */
2635
26372636ROM_START( passshtb )
26382637   ROM_REGION( 0x020000, REGION_CPU1, 0 ) /* 68000 code */
26392638   ROM_LOAD16_BYTE( "pass3_2p.bin", 0x000000, 0x10000, CRC(26bb9299) SHA1(11bacf86dfdd8bcfbfb61f0ebc59890325c48adc) )
src/mame/drivers/limenko.c
r2864r2865
3838
3939static READ32_HANDLER( port2_r )
4040{
41   return (eeprom_read_bit() << 23) | (input_port_read_indexed(machine, 2) & ~(1<<23));
41   return (eeprom_read_bit() << 23) | (input_port_read(machine, "IN2") & ~(1<<23));
4242}
4343
4444static WRITE32_HANDLER( eeprom_w )
r2864r2865
313313*****************************************************************************************************/
314314
315315static INPUT_PORTS_START( legendoh )
316   PORT_START
316   PORT_START_TAG("IN0")
317317   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_PLAYER(1)
318318   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_PLAYER(1)
319319   PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_PLAYER(1)
r2864r2865
332332   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3)
333333   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNUSED )
334334
335   PORT_START
335   PORT_START_TAG("IN1")
336336   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_PLAYER(2)
337337   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_PLAYER(2)
338338   PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_PLAYER(2)
r2864r2865
351351   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4)
352352   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNUSED )
353353
354   PORT_START
354   PORT_START_TAG("IN2")
355355   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_START1 )
356356   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_START2 )
357357   PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
373373INPUT_PORTS_END
374374
375375static INPUT_PORTS_START( sb2003 )
376   PORT_START
376   PORT_START_TAG("IN0")
377377   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_PLAYER(1)
378378   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_PLAYER(1)
379379   PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_PLAYER(1)
r2864r2865
384384   PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
385385   PORT_BIT( 0xff00ffff, IP_ACTIVE_LOW, IPT_UNUSED )
386386
387   PORT_START
387   PORT_START_TAG("IN1")
388388   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_PLAYER(2)
389389   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_PLAYER(2)
390390   PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_PLAYER(2)
r2864r2865
395395   PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
396396   PORT_BIT( 0xff00ffff, IP_ACTIVE_LOW, IPT_UNUSED )
397397
398   PORT_START
398   PORT_START_TAG("IN2")
399399   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_START1 )
400400   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_START2 )
401401   PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
411411INPUT_PORTS_END
412412
413413static INPUT_PORTS_START( spotty )
414   PORT_START
414   PORT_START_TAG("IN0")
415415   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_NAME("Hold 1")
416416   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_NAME("Hold 2")
417417   PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_NAME("Hold 3")
r2864r2865
422422   PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNUSED )
423423   PORT_BIT( 0xff00ffff, IP_ACTIVE_LOW, IPT_UNUSED )
424424
425   PORT_START
425   PORT_START_TAG("IN1")
426426   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_UNUSED )
427427   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_UNUSED )
428428   PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
433433   PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNUSED )
434434   PORT_BIT( 0xff00ffff, IP_ACTIVE_LOW, IPT_UNUSED )
435435
436   PORT_START
436   PORT_START_TAG("IN2")
437437   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_START1 )
438438   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_UNUSED )
439439   PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_COIN1 )
src/mame/drivers/model1.c
r2864r2865
679679
680680static int last_irq;
681681
682static void irq_raise(int level)
682static void irq_raise(running_machine *machine, int level)
683683{
684684   //  logerror("irq: raising %d\n", level);
685685   //  irq_status |= (1 << level);
686686   last_irq = level;
687   cpunum_set_input_line(Machine, 0, 0, HOLD_LINE);
687   cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
688688}
689689
690690static IRQ_CALLBACK(irq_callback)
r2864r2865
705705// 3 = ff54c
706706// other = ff568/ff574
707707
708static void irq_init(void)
708static void irq_init(running_machine *machine)
709709{
710   cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
710   cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
711711   cpunum_set_irq_callback(0, irq_callback);
712712}
713713
r2864r2865
715715{
716716   if (cpu_getiloops())
717717   {
718      irq_raise(1);
718      irq_raise(machine, 1);
719719   }
720720   else
721721   {
722      irq_raise(model1_sound_irq);
722      irq_raise(machine, model1_sound_irq);
723723
724724      // if the FIFO has something in it, signal the 68k too
725725      if (fifo_rptr != fifo_wptr)
r2864r2865
732732static MACHINE_RESET(model1)
733733{
734734   memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x1000000);
735   irq_init();
735   irq_init(machine);
736736   model1_tgp_reset(!strcmp(machine->gamedrv->name, "swa") || !strcmp(machine->gamedrv->name, "wingwar") || !strcmp(machine->gamedrv->name, "wingwara"));
737737   if (!strcmp(machine->gamedrv->name, "swa"))
738738   {
r2864r2865
751751static MACHINE_RESET(model1_vr)
752752{
753753   memory_set_bankptr(1, memory_region(REGION_CPU1) + 0x1000000);
754   irq_init();
754   irq_init(machine);
755755   model1_vr_tgp_reset();
756756   model1_sound_irq = 3;
757757
src/mame/drivers/jackal.c
r2864r2865
8787
8888static READ8_HANDLER( topgunbl_rotary_r )
8989{
90   return (1 << (input_port_read_indexed(machine, 5 + offset) * 8 / 256)) ^ 0xff;
90   return (1 << (input_port_read(machine, offset ? "DIAL1" : "DIAL0") * 8 / 256)) ^ 0xff;
9191}
9292
9393static WRITE8_HANDLER( jackal_flipscreen_w )
r2864r2865
232232   PORT_MODIFY("IN0")
233233   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
234234
235   PORT_START   // player 1 8-way rotary control - converted in topgunbl_rotary_r()
235   PORT_START_TAG("DIAL0")   // player 1 8-way rotary control - converted in topgunbl_rotary_r()
236236   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X)
237237
238   PORT_START   // player 2 8-way rotary control - converted in topgunbl_rotary_r()
238   PORT_START_TAG("DIAL1")   // player 2 8-way rotary control - converted in topgunbl_rotary_r()
239239   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2)
240240INPUT_PORTS_END
241241
src/mame/drivers/tank8.c
r2864r2865
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "tank8.h"
109#include "sound/discrete.h"
1110
1211static int collision_index;
1312
1413
15void tank8_set_collision(int index)
14void tank8_set_collision(running_machine *machine, int index)
1615{
17   cpunum_set_input_line(Machine, 0, 0, ASSERT_LINE);
16   cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
1817
1918   collision_index = index;
2019}
src/mame/drivers/cps1.c
r2864r2865
77057705   ROM_LOAD( "pa3-06.11d",  0x20000, 0x20000, CRC(affa4f82) SHA1(27b9292bbc121cf585f53297a79fe8f0d0a729ae) )
77067706ROM_END
77077707
7708/* B-Board uncertain but should be 91634B/91635B from the program ROM names */
7709/* there's a photo of a 91635B board but it's clearly not original */
7708/* B-Board 91634B */
77107709ROM_START( megaman )
77117710   ROM_REGION( CODE_SIZE, REGION_CPU1, 0 )      /* 68000 code */
77127711   ROM_LOAD16_WORD_SWAP( "rcma_23b.rom",   0x000000, 0x80000, CRC(61e4a397) SHA1(a90b1cbef4206a4554398bc458a4b3e2c46d4c4f) )
r2864r2865
79527951GAME( 1992, varthr1,  varth,    cps1_12MHz, varth,    cps1,     ROT270, "Capcom", "Varth - Operation Thunderstorm (World 920612)" , 0)      // "ETC"
79537952GAME( 1992, varthu,   varth,    cps1_12MHz, varth,    cps1,     ROT270, "Capcom (Romstar license)", "Varth - Operation Thunderstorm (US 920612)", 0 )
79547953GAME( 1992, varthj,   varth,    cps1_12MHz, varth,    cps1,     ROT270, "Capcom", "Varth - Operation Thunderstorm (Japan 920714)", 0 )
7955GAME( 1992, cworld2j, 0,        cps1_10MHz, cworld2j, cps1,     ROT0,   "Capcom", "Capcom World 2 (Japan 920611)", 0 )
7954GAME( 1992, cworld2j, 0,        cps1_12MHz, cworld2j, cps1,     ROT0,   "Capcom", "Capcom World 2 (Japan 920611)", 0 )
79567955GAME( 1992, sf2hf,    sf2ce,    cps1_12MHz, sf2,      cps1,     ROT0,   "Capcom", "Street Fighter II' - Hyper Fighting (World 921209)", 0 )
79577956GAME( 1992, sf2t,     sf2ce,    cps1_12MHz, sf2,      cps1,     ROT0,   "Capcom", "Street Fighter II' - Hyper Fighting (US 921209)", 0 )
79587957GAME( 1992, sf2tj,    sf2ce,    cps1_12MHz, sf2j,     cps1,     ROT0,   "Capcom", "Street Fighter II' Turbo - Hyper Fighting (Japan 921209)", 0 )
79597958GAME( 1992, qad,      0,        cps1_12MHz, qad,      cps1,     ROT0,   "Capcom", "Quiz & Dragons (US 920701)", 0 )   // 12MHz verified
7960GAME( 1994, qadj,     qad,      cps1_10MHz, qadj,     cps1,     ROT0,   "Capcom", "Quiz & Dragons (Japan 940921)", 0 )
7961GAME( 1995, qtono2,   0,        cps1_10MHz, qtono2,   cps1,     ROT0,   "Capcom", "Quiz Tonosama no Yabou 2 Zenkoku-ban (Japan 950123)", 0 )
7962GAME( 1995, megaman,  0,        cps1_10MHz, megaman,  cps1,     ROT0,   "Capcom", "Mega Man - The Power Battle (CPS1 Asia 951006)", 0 )
7963GAME( 1995, rockmanj, megaman,  cps1_10MHz, rockmanj, cps1,     ROT0,   "Capcom", "Rockman - The Power Battle (CPS1 Japan 950922)", 0 )
7959GAME( 1994, qadj,     qad,      cps1_12MHz, qadj,     cps1,     ROT0,   "Capcom", "Quiz & Dragons (Japan 940921)", 0 )
7960GAME( 1995, qtono2,   0,        cps1_12MHz, qtono2,   cps1,     ROT0,   "Capcom", "Quiz Tonosama no Yabou 2 Zenkoku-ban (Japan 950123)", 0 )
7961GAME( 1995, megaman,  0,        cps1_12MHz, megaman,  cps1,     ROT0,   "Capcom", "Mega Man - The Power Battle (CPS1 Asia 951006)", 0 )
7962GAME( 1995, rockmanj, megaman,  cps1_12MHz, rockmanj, cps1,     ROT0,   "Capcom", "Rockman - The Power Battle (CPS1 Japan 950922)", 0 )
79647963
79657964GAME( 1992, wof,      0,        qsound,     wof,      wof,      ROT0,   "Capcom", "Warriors of Fate (World 921002)" , 0)            // "ETC"
79667965GAME( 1992, wofa,     wof,      qsound,     wof,      wof,      ROT0,   "Capcom", "Sangokushi II (Asia 921005)" , 0)               // World "warning"
r2864r2865
79787977GAME( 1993, mbombrd,  0,        qsound,     slammast, slammast, ROT0,   "Capcom", "Muscle Bomber Duo - Ultimate Team Battle (World 931206)" , 0)  // "ETC"
79797978GAME( 1993, mbombrdj, mbombrd,  qsound,     slammast, slammast, ROT0,   "Capcom", "Muscle Bomber Duo - Heat Up Warriors (Japan 931206)", 0 )
79807979
7981GAME( 1994, pnickj,   0,        cps1_10MHz, pnickj,   cps1,     ROT0,   "Compile (Capcom license)", "Pnickies (Japan 940608)", 0 )
7980GAME( 1994, pnickj,   0,        cps1_12MHz, pnickj,   cps1,     ROT0,   "Compile (Capcom license)", "Pnickies (Japan 940608)", 0 )
79827981/* Japanese version of Pang 3 is encrypted, Euro version is not */
79837982GAME( 1995, pang3,    0,        pang3,      pang3,    pang3,    ROT0,   "Mitchell", "Pang! 3 (Euro 950511)", 0 )
79847983GAME( 1995, pang3j,   pang3,    pang3,      pang3,    pang3j,   ROT0,   "Mitchell", "Pang! 3 (Japan 950511)", 0 )
src/mame/drivers/lethalj.c
r2864r2865
143143 *************************************/
144144
145145static INPUT_PORTS_START( lethalj )
146   PORT_START
146   PORT_START_TAG("IN0")
147147   PORT_BIT( 0x0003, IP_ACTIVE_LOW, IPT_UNUSED )
148148   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
149149   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* ??? Seems to be rigged up to the auto scroll, and acts as a fast forward*/
150150   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
151151   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNUSED )
152152
153   PORT_START
153   PORT_START_TAG("IN1")
154154   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 )
155155   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
156156   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
190190   PORT_DIPSETTING(      0x0000, "-2.5" )
191191   PORT_DIPSETTING(      0x8000, "+0" )
192192
193   PORT_START            /* fake analog X */
193   PORT_START_TAG("LIGHT0_X")         /* fake analog X */
194194   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
195195
196   PORT_START            /* fake analog Y */
196   PORT_START_TAG("LIGHT0_Y")            /* fake analog Y */
197197   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
198198
199   PORT_START            /* fake analog X */
199   PORT_START_TAG("LIGHT1_X")            /* fake analog X */
200200   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
201201
202   PORT_START            /* fake analog Y */
202   PORT_START_TAG("LIGHT1_Y")            /* fake analog Y */
203203   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(2)
204204INPUT_PORTS_END
205205
206206
207207static INPUT_PORTS_START( eggventr )
208   PORT_START
208   PORT_START_TAG("IN0")
209209   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 )
210210   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
211211   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
235235   PORT_DIPSETTING(      0x1000, DEF_STR( On ) ) // but not actually called (EC).
236236   PORT_BIT( 0xe000, IP_ACTIVE_LOW, IPT_UNUSED )
237237
238   PORT_START
238   PORT_START_TAG("IN1")
239239   PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED )
240240   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
241241   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
r2864r2865
244244   PORT_BIT( 0x7f00, IP_ACTIVE_LOW, IPT_UNUSED )
245245   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
246246
247   PORT_START            /* fake analog X */
247   PORT_START_TAG("LIGHT0_X")            /* fake analog X */
248248   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
249249
250   PORT_START            /* fake analog Y */
250   PORT_START_TAG("LIGHT0_Y")            /* fake analog Y */
251251   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
252252
253   PORT_START            /* fake analog X */
253   PORT_START_TAG("LIGHT1_X")            /* fake analog X */
254254   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
255255
256   PORT_START            /* fake analog Y */
256   PORT_START_TAG("LIGHT1_Y")            /* fake analog Y */
257257   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(2)
258258INPUT_PORTS_END
259259
260260
261261static INPUT_PORTS_START( eggvntdx )
262   PORT_START
262   PORT_START_TAG("IN0")
263263   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 )
264264   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
265265   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
286286   PORT_DIPSETTING(      0x0000, DEF_STR( Hard ) )
287287   PORT_BIT( 0xe000, IP_ACTIVE_LOW, IPT_UNUSED )
288288
289   PORT_START
289   PORT_START_TAG("IN1")
290290   PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED )
291291   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
292292   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
r2864r2865
295295   PORT_BIT( 0x7f00, IP_ACTIVE_LOW, IPT_UNUSED )
296296   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
297297
298   PORT_START            /* fake analog X */
298   PORT_START_TAG("LIGHT0_X")            /* fake analog X */
299299   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
300300
301   PORT_START            /* fake analog Y */
301   PORT_START_TAG("LIGHT0_Y")            /* fake analog Y */
302302   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
303303
304   PORT_START            /* fake analog X */
304   PORT_START_TAG("LIGHT1_X")            /* fake analog X */
305305   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
306306
307   PORT_START            /* fake analog Y */
307   PORT_START_TAG("LIGHT1_Y")            /* fake analog Y */
308308   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(2)
309309INPUT_PORTS_END
310310
311311
312312static INPUT_PORTS_START( ripribit )
313   PORT_START
313   PORT_START_TAG("IN0")
314314   PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED )
315315   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
316316   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(ticket_status, NULL)
317317   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNUSED )
318318
319   PORT_START
319   PORT_START_TAG("IN1")
320320   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 )
321321   PORT_SERVICE_NO_TOGGLE( 0x0002, IP_ACTIVE_HIGH )
322322   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
356356   PORT_DIPSETTING(      0x2000, "800" )
357357   PORT_DIPSETTING(      0x0000, "1000" )
358358
359   PORT_START            /* fake analog X */
360   PORT_START            /* fake analog Y */
361   PORT_START            /* fake analog X */
362   PORT_START            /* fake analog Y */
359   PORT_START_TAG("LIGHT0_X")            /* fake analog X */
360   PORT_START_TAG("LIGHT0_Y")            /* fake analog Y */
361   PORT_START_TAG("LIGHT1_X")            /* fake analog X */
362   PORT_START_TAG("LIGHT1_Y")            /* fake analog Y */
363363INPUT_PORTS_END
364364
365365
366366static INPUT_PORTS_START( cfarm )
367   PORT_START
367   PORT_START_TAG("IN0")
368368   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 )
369369   PORT_SERVICE_NO_TOGGLE( 0x0002, IP_ACTIVE_HIGH )
370370   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
404404    PORT_DIPSETTING(      0x2000, "8" )
405405    PORT_DIPSETTING(      0x0000, "10" )
406406
407   PORT_START
407   PORT_START_TAG("IN1")
408408   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(ticket_status, NULL)
409409   PORT_BIT( 0x0006, IP_ACTIVE_LOW, IPT_UNUSED )
410410    PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
r2864r2865
412412    PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
413413   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNUSED )
414414
415   PORT_START            /* fake analog X */
416   PORT_START            /* fake analog Y */
417   PORT_START            /* fake analog X */
418   PORT_START            /* fake analog Y */
415   PORT_START_TAG("LIGHT0_X")            /* fake analog X */
416   PORT_START_TAG("LIGHT0_Y")            /* fake analog Y */
417   PORT_START_TAG("LIGHT1_X")            /* fake analog X */
418   PORT_START_TAG("LIGHT1_Y")            /* fake analog Y */
419419INPUT_PORTS_END
420420
421421
422422static INPUT_PORTS_START( cclownz )
423   PORT_START
423   PORT_START_TAG("IN0")
424424   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 )
425425   PORT_SERVICE_NO_TOGGLE( 0x0002, IP_ACTIVE_HIGH )
426426   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
460460    PORT_DIPSETTING(      0x2000, "2400" )
461461    PORT_DIPSETTING(      0x0000, "3000" )
462462
463   PORT_START
463   PORT_START_TAG("IN1")
464464   PORT_BIT( 0x0f0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(cclownz_paddle, NULL)
465465   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(ticket_status, NULL)
466466   PORT_BIT( 0x0060, IP_ACTIVE_LOW, IPT_UNUSED )
467467    PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
468468   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
469469
470   PORT_START            /* fake analog X */
471   PORT_START            /* fake analog Y */
472   PORT_START            /* fake analog X */
473   PORT_START            /* fake analog Y */
470   PORT_START_TAG("LIGHT0_X")            /* fake analog X */
471   PORT_START_TAG("LIGHT0_Y")            /* fake analog Y */
472   PORT_START_TAG("LIGHT1_X")            /* fake analog X */
473   PORT_START_TAG("LIGHT1_Y")            /* fake analog Y */
474474
475475   PORT_START_TAG("PADDLE")
476476    PORT_BIT( 0x00ff, 0x0000, IPT_PADDLE ) PORT_PLAYER(1) PORT_SENSITIVITY(50) PORT_KEYDELTA(8) PORT_CENTERDELTA(0) PORT_REVERSE
src/mame/drivers/itech8.c
r2864r2865
712712/* used by most games */
713713static READ8_HANDLER( special_port0_r )
714714{
715   UINT8 result = input_port_read_indexed(machine, 0);
715   UINT8 result = input_port_read(machine, "40");
716716   result = (result & 0xfe) | (pia_portb_data & 0x01);
717717   return result;
718718}
r2864r2865
721721/* used by Rim Rockin' Basketball */
722722static READ8_HANDLER( special_port1_r )
723723{
724   UINT8 result = input_port_read_indexed(machine, 1);
724   UINT8 result = input_port_read(machine, "60");
725725   result = (result & 0x7f) | ((pia_portb_data & 0x01) << 7);
726726   return result;
727727}
r2864r2865
10131013 *
10141014 *************************************/
10151015
1016#define UNUSED_ANALOG   \
1017   PORT_START   \
1016#define UNUSED_ANALOG(TAG)   \
1017   PORT_START_TAG(TAG)   \
10181018   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
10191019
10201020
10211021static INPUT_PORTS_START( wfortune )
1022   PORT_START   /* 40 */
1022   PORT_START_TAG("40")   /* 40 */
10231023   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
10241024   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
10251025   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ))
r2864r2865
10281028   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
10291029   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
10301030
1031   PORT_START   /* 60 */
1031   PORT_START_TAG("60")   /* 60 */
10321032   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_UNKNOWN )
10331033   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Blue Player") PORT_PLAYER(3)
10341034   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Yellow Player") PORT_PLAYER(2)
r2864r2865
10361036   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
10371037   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
10381038
1039   PORT_START   /* 80 */
1039   PORT_START_TAG("80")   /* 80 */
10401040   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
10411041
1042   UNUSED_ANALOG   /* analog C */
1042   UNUSED_ANALOG("AN_C")   /* analog C */
10431043
1044   PORT_START      /* analog D */
1044   PORT_START_TAG("AN_D")   /* analog D */
10451045   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(75) PORT_KEYDELTA(10) PORT_PLAYER(1)
10461046
1047   UNUSED_ANALOG   /* analog E */
1047   UNUSED_ANALOG("AN_E")   /* analog E */
10481048
1049   PORT_START      /* analog F */
1049   PORT_START_TAG("AN_F")   /* analog F */
10501050   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(75) PORT_KEYDELTA(10) PORT_COCKTAIL PORT_PLAYER(2)
10511051INPUT_PORTS_END
10521052
10531053
10541054static INPUT_PORTS_START( stratab )
1055   PORT_START   /* 40 */
1055   PORT_START_TAG("40")   /* 40 */
10561056   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
10571057   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
10581058   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ))
r2864r2865
10611061   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
10621062   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
10631063
1064   PORT_START   /* 60 */
1064   PORT_START_TAG("60")   /* 60 */
10651065   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Right Hook") PORT_COCKTAIL PORT_PLAYER(2)
10661066   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Left Hook") PORT_COCKTAIL PORT_PLAYER(2)
10671067   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Right Hook") PORT_PLAYER(1)
r2864r2865
10711071   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
10721072   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
10731073
1074   PORT_START   /* 80 */
1074   PORT_START_TAG("80")   /* 80 */
10751075   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
10761076
1077   PORT_START   /* analog C */
1077   PORT_START_TAG("AN_C")   /* analog C */
10781078    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_PLAYER(1)
10791079
1080   PORT_START   /* analog D */
1080   PORT_START_TAG("AN_D")   /* analog D */
10811081    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
10821082
1083   PORT_START   /* analog E */
1083   PORT_START_TAG("AN_E")   /* analog E */
10841084    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_COCKTAIL PORT_PLAYER(2)
10851085
1086   PORT_START   /* analog F */
1086   PORT_START_TAG("AN_F")   /* analog F */
10871087    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
10881088INPUT_PORTS_END
10891089
r2864r2865
10961096}
10971097
10981098static INPUT_PORTS_START( gtg )
1099   PORT_START   /* 40 */
1099   PORT_START_TAG("40")   /* 40 */
11001100   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
11011101   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
11021102   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ))
r2864r2865
11051105   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
11061106   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
11071107
1108   PORT_START   /* 60 */
1108   PORT_START_TAG("60")   /* 60 */
11091109   /* it is still unknown how the second player inputs are muxed in */
11101110   /* currently we map both sets of controls to the same inputs */
11111111   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gtg_mux, "P1\0P2")
r2864r2865
11131113   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
11141114   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
11151115
1116   PORT_START   /* 80 */
1116   PORT_START_TAG("80")   /* 80 */
11171117   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
11181118
1119   UNUSED_ANALOG   /* analog C */
1120   UNUSED_ANALOG   /* analog D */
1121   UNUSED_ANALOG   /* analog E */
1122   UNUSED_ANALOG   /* analog F */
1119   UNUSED_ANALOG("AN_C")   /* analog C */
1120   UNUSED_ANALOG("AN_D")   /* analog D */
1121   UNUSED_ANALOG("AN_E")   /* analog E */
1122   UNUSED_ANALOG("AN_F")   /* analog F */
11231123
11241124   PORT_START_TAG("P1")
11251125   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
r2864r2865
11381138
11391139
11401140static INPUT_PORTS_START( gtgt )
1141   PORT_START   /* 40 */
1141   PORT_START_TAG("40")   /* 40 */
11421142   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
11431143   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
11441144   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
11451145
1146   PORT_START   /* 60 */
1146   PORT_START_TAG("60")   /* 60 */
11471147   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
11481148   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
11491149   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Face Right") PORT_PLAYER(1)
r2864r2865
11531153   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
11541154   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
11551155
1156   PORT_START   /* 80 */
1156   PORT_START_TAG("80")   /* 80 */
11571157   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
11581158
1159   PORT_START   /* analog C */
1159   PORT_START_TAG("AN_C")   /* analog C */
11601160    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_PLAYER(1)
11611161
1162   PORT_START   /* analog D */
1162   PORT_START_TAG("AN_D")   /* analog D */
11631163    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
11641164
1165   UNUSED_ANALOG   /* analog E */
1166   UNUSED_ANALOG   /* analog F */
1165   UNUSED_ANALOG("AN_E")   /* analog E */
1166   UNUSED_ANALOG("AN_F")   /* analog F */
11671167INPUT_PORTS_END
11681168
11691169
11701170static INPUT_PORTS_START( gtg2t )
1171   PORT_START   /* 40 */
1171   PORT_START_TAG("40")   /* 40 */
11721172   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
11731173   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
11741174   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ))
r2864r2865
11771177   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
11781178   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
11791179
1180   PORT_START   /* 60 */
1180   PORT_START_TAG("60")   /* 60 */
11811181   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Face Right") PORT_COCKTAIL PORT_PLAYER(2)
11821182   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Face Left") PORT_COCKTAIL PORT_PLAYER(2)
11831183   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Face Right") PORT_PLAYER(1)
r2864r2865
11871187   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
11881188   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
11891189
1190   PORT_START   /* 80 */
1190   PORT_START_TAG("80")   /* 80 */
11911191   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
11921192
1193   PORT_START   /* analog C */
1193   PORT_START_TAG("AN_C")   /* analog C */
11941194    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_PLAYER(1)
11951195
1196   PORT_START   /* analog D */
1196   PORT_START_TAG("AN_D")   /* analog D */
11971197    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
11981198
1199   PORT_START   /* analog E */
1199   PORT_START_TAG("AN_E")   /* analog E */
12001200    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_COCKTAIL PORT_PLAYER(2)
12011201
1202   PORT_START   /* analog F */
1202   PORT_START_TAG("AN_F")   /* analog F */
12031203    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
12041204INPUT_PORTS_END
12051205
12061206
12071207static INPUT_PORTS_START( slikshot )
1208   PORT_START   /* 40 */
1208   PORT_START_TAG("40")   /* 40 */
12091209   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
12101210   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
12111211   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
12121212
1213   PORT_START   /* 60 */
1213   PORT_START_TAG("60")   /* 60 */
12141214   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
12151215   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
12161216   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL )
r2864r2865
12201220   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Green")
12211221   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
12221222
1223   PORT_START   /* 80 */
1223   PORT_START_TAG("80")   /* 80 */
12241224   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
12251225
1226   UNUSED_ANALOG   /* analog C */
1227   UNUSED_ANALOG   /* analog D */
1228   UNUSED_ANALOG   /* analog E */
1229   UNUSED_ANALOG   /* analog F */
1226   UNUSED_ANALOG("AN_C")   /* analog C */
1227   UNUSED_ANALOG("AN_D")   /* analog D */
1228   UNUSED_ANALOG("AN_E")   /* analog E */
1229   UNUSED_ANALOG("AN_F")   /* analog F */
12301230
12311231   PORT_START_TAG("FAKEX") /* fake */
12321232    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_RESET PORT_PLAYER(1)
r2864r2865
12371237
12381238
12391239static INPUT_PORTS_START( dynobop )
1240   PORT_START   /* 40 */
1240   PORT_START_TAG("40")   /* 40 */
12411241   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
12421242   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
12431243   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
12441244
1245   PORT_START   /* 60 */
1245   PORT_START_TAG("60")   /* 60 */
12461246   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* ball gate */
12471247   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
12481248   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* ball detect */
r2864r2865
12521252   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
12531253   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
12541254
1255   PORT_START   /* 80 */
1255   PORT_START_TAG("80")   /* 80 */
12561256   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
12571257
1258   UNUSED_ANALOG   /* analog C */
1259   UNUSED_ANALOG   /* analog D */
1260   UNUSED_ANALOG   /* analog E */
1261   UNUSED_ANALOG   /* analog F */
1258   UNUSED_ANALOG("AN_C")   /* analog C */
1259   UNUSED_ANALOG("AN_D")   /* analog D */
1260   UNUSED_ANALOG("AN_E")   /* analog E */
1261   UNUSED_ANALOG("AN_F")   /* analog F */
12621262
12631263   PORT_START_TAG("FAKEX") /* fake */
12641264    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_RESET PORT_PLAYER(1)
r2864r2865
12691269
12701270
12711271static INPUT_PORTS_START( sstrike )
1272   PORT_START   /* 40 */
1272   PORT_START_TAG("40")   /* 40 */
12731273   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
12741274   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
12751275   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
12761276
1277   PORT_START   /* 60 */
1277   PORT_START_TAG("60")   /* 60 */
12781278   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
12791279   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
12801280   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL )
r2864r2865
12841284   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
12851285   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
12861286
1287   PORT_START   /* 80 */
1287   PORT_START_TAG("80")   /* 80 */
12881288   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
12891289
1290   UNUSED_ANALOG   /* analog C */
1291   UNUSED_ANALOG   /* analog D */
1292   UNUSED_ANALOG   /* analog E */
1293   UNUSED_ANALOG   /* analog F */
1290   UNUSED_ANALOG("AN_C")   /* analog C */
1291   UNUSED_ANALOG("AN_D")   /* analog D */
1292   UNUSED_ANALOG("AN_E")   /* analog E */
1293   UNUSED_ANALOG("AN_F")   /* analog F */
12941294
12951295   PORT_START_TAG("FAKEX") /* fake */
12961296    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_RESET PORT_PLAYER(1)
r2864r2865
13011301
13021302
13031303static INPUT_PORTS_START( pokrdice )
1304   PORT_START   /* 40 */
1304   PORT_START_TAG("40")   /* 40 */
13051305   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
13061306   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Lower Right") PORT_CODE(KEYCODE_3_PAD)
13071307   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
13141314   PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED )
13151315   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
13161316
1317   PORT_START   /* 60 */
1317   PORT_START_TAG("60")   /* 60 */
13181318   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Upper Right") PORT_CODE(KEYCODE_9_PAD)
13191319   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
13201320   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Middle") PORT_CODE(KEYCODE_5_PAD)
r2864r2865
13241324   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Play")
13251325   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
13261326
1327   PORT_START   /* 80 */
1327   PORT_START_TAG("80")   /* 80 */
13281328   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
13291329
1330   UNUSED_ANALOG   /* analog C */
1331   UNUSED_ANALOG   /* analog D */
1332   UNUSED_ANALOG   /* analog E */
1333   UNUSED_ANALOG   /* analog F */
1330   UNUSED_ANALOG("AN_C")   /* analog C */
1331   UNUSED_ANALOG("AN_D")   /* analog D */
1332   UNUSED_ANALOG("AN_E")   /* analog E */
1333   UNUSED_ANALOG("AN_F")   /* analog F */
13341334INPUT_PORTS_END
13351335
13361336
13371337static INPUT_PORTS_START( hstennis )
1338   PORT_START   /* 40 */
1338   PORT_START_TAG("40")   /* 40 */
13391339   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
13401340   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
13411341   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ))
r2864r2865
13471347   PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED )
13481348   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
13491349
1350   PORT_START   /* 60 */
1350   PORT_START_TAG("60")   /* 60 */
13511351   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
13521352   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Soft") PORT_PLAYER(1)
13531353   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
r2864r2865
13571357   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Hard") PORT_PLAYER(1)
13581358   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
13591359
1360   PORT_START   /* 80 */
1360   PORT_START_TAG("80")   /* 80 */
13611361   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
13621362   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Soft") PORT_PLAYER(2)
13631363   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
r2864r2865
13671367   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Hard") PORT_PLAYER(2)
13681368   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
13691369
1370   UNUSED_ANALOG   /* analog C */
1371   UNUSED_ANALOG   /* analog D */
1372   UNUSED_ANALOG   /* analog E */
1373   UNUSED_ANALOG   /* analog F */
1370   UNUSED_ANALOG("AN_C")   /* analog C */
1371   UNUSED_ANALOG("AN_D")   /* analog D */
1372   UNUSED_ANALOG("AN_E")   /* analog E */
1373   UNUSED_ANALOG("AN_F")   /* analog F */
13741374INPUT_PORTS_END
13751375
13761376
13771377static INPUT_PORTS_START( arlingtn )
1378   PORT_START   /* 40 */
1378   PORT_START_TAG("40")   /* 40 */
13791379   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
13801380   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
13811381   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ))   /* see code at e23c */
r2864r2865
13841384   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
13851385   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
13861386
1387   PORT_START   /* 60 */
1387   PORT_START_TAG("60")   /* 60 */
13881388   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
13891389   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
13901390   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Place")
r2864r2865
13941394   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
13951395   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
13961396
1397   PORT_START   /* 80 */
1397   PORT_START_TAG("80")   /* 80 */
13981398   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
13991399   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNKNOWN )
14001400   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Show")
r2864r2865
14031403   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
14041404   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
14051405
1406   UNUSED_ANALOG   /* analog C */
1407   UNUSED_ANALOG   /* analog D */
1408   UNUSED_ANALOG   /* analog E */
1409   UNUSED_ANALOG   /* analog F */
1406   UNUSED_ANALOG("AN_C")   /* analog C */
1407   UNUSED_ANALOG("AN_D")   /* analog D */
1408   UNUSED_ANALOG("AN_E")   /* analog E */
1409   UNUSED_ANALOG("AN_F")   /* analog F */
14101410INPUT_PORTS_END
14111411
14121412
14131413static INPUT_PORTS_START( peggle )
1414   PORT_START   /* 40 */
1414   PORT_START_TAG("40")   /* 40 */
14151415   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
14161416   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED )
14171417   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
14181418
1419   PORT_START   /* 60 */
1419   PORT_START_TAG("60")   /* 60 */
14201420   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
14211421   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
14221422   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
r2864r2865
14251425   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
14261426   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
14271427
1428   PORT_START   /* 80 */
1428   PORT_START_TAG("80")   /* 80 */
14291429   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
14301430   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
14311431   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
14321432
1433   UNUSED_ANALOG   /* analog C */
1434   UNUSED_ANALOG   /* analog D */
1435   UNUSED_ANALOG   /* analog E */
1436   UNUSED_ANALOG   /* analog F */
1433   UNUSED_ANALOG("AN_C")   /* analog C */
1434   UNUSED_ANALOG("AN_D")   /* analog D */
1435   UNUSED_ANALOG("AN_E")   /* analog E */
1436   UNUSED_ANALOG("AN_F")   /* analog F */
14371437INPUT_PORTS_END
14381438
14391439
14401440static INPUT_PORTS_START( pegglet )
1441   PORT_START   /* 40 */
1441   PORT_START_TAG("40")   /* 40 */
14421442   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
14431443   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED )
14441444   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
14451445
1446   PORT_START   /* 60 */
1446   PORT_START_TAG("60")   /* 60 */
14471447   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
14481448   PORT_BIT( 0x3e, IP_ACTIVE_LOW, IPT_UNKNOWN )
14491449   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
14501450   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
14511451
1452   PORT_START   /* 80 */
1452   PORT_START_TAG("80")   /* 80 */
14531453   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
14541454   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
14551455   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
14561456
1457   UNUSED_ANALOG   /* analog C */
1457   UNUSED_ANALOG("AN_C")   /* analog C */
14581458
1459   PORT_START      /* analog D */
1459   PORT_START_TAG("AN_D")      /* analog D */
14601460   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_RESET PORT_PLAYER(1)
14611461
1462   UNUSED_ANALOG   /* analog E */
1463   UNUSED_ANALOG   /* analog F */
1462   UNUSED_ANALOG("AN_E")   /* analog E */
1463   UNUSED_ANALOG("AN_F")   /* analog F */
14641464INPUT_PORTS_END
14651465
14661466
14671467static INPUT_PORTS_START( neckneck )
1468   PORT_START   /* 40 */
1468   PORT_START_TAG("40")   /* 40 */
14691469   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
14701470   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
14711471   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ))   /* see code at e23c */
r2864r2865
14741474   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
14751475   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
14761476
1477   PORT_START   /* 60 */
1477   PORT_START_TAG("60")   /* 60 */
14781478   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
14791479   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
14801480   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Horse 3")
r2864r2865
14841484   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
14851485   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
14861486
1487   PORT_START   /* 80 */
1487   PORT_START_TAG("80")   /* 80 */
14881488   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
14891489   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNKNOWN )
14901490   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Horse 4")
r2864r2865
14931493   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
14941494   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
14951495
1496   UNUSED_ANALOG   /* analog C */
1497   UNUSED_ANALOG   /* analog D */
1498   UNUSED_ANALOG   /* analog E */
1499   UNUSED_ANALOG   /* analog F */
1496   UNUSED_ANALOG("AN_C")   /* analog C */
1497   UNUSED_ANALOG("AN_D")   /* analog D */
1498   UNUSED_ANALOG("AN_E")   /* analog E */
1499   UNUSED_ANALOG("AN_F")   /* analog F */
15001500INPUT_PORTS_END
15011501
15021502
15031503static INPUT_PORTS_START( rimrockn )
1504   PORT_START   /* 40 */
1504   PORT_START_TAG("40")   /* 40 */
15051505   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
15061506
1507   PORT_START   /* 60 */
1507   PORT_START_TAG("60")   /* 60 */
15081508   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
15091509   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
15101510   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
15141514   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
15151515   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* input from sound board */
15161516
1517   PORT_START   /* 80 */
1517   PORT_START_TAG("80")   /* 80 */
15181518   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
15191519
1520   PORT_START   /* special 161 */
1520   PORT_START_TAG("161")   /* special 161 */
15211521   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
15221522   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Pass") PORT_PLAYER(1)
15231523   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Shoot") PORT_PLAYER(1)
r2864r2865
15271527   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
15281528   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
15291529
1530   PORT_START   /* special 162 */
1530   PORT_START_TAG("162")   /* special 162 */
15311531   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
15321532   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Pass") PORT_PLAYER(2)
15331533   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Shoot") PORT_PLAYER(2)
r2864r2865
15371537   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
15381538   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
15391539
1540   PORT_START   /* special 163 */
1540   PORT_START_TAG("163")   /* special 163 */
15411541   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P3 Shoot") PORT_PLAYER(3)
15421542   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Pass") PORT_PLAYER(3)
15431543   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
15471547   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3)
15481548   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
15491549
1550   PORT_START   /* special 164 */
1550   PORT_START_TAG("164")   /* special 164 */
15511551   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P4 Shoot") PORT_PLAYER(4)
15521552   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P4 Pass") PORT_PLAYER(4)
15531553   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
15571557   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4)
15581558   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
15591559
1560   PORT_START   /* special 165 */
1560   PORT_START_TAG("165")   /* special 165 */
15611561   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 )
15621562   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE3 )
15631563   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE4 )
r2864r2865
15771577
15781578
15791579static INPUT_PORTS_START( ninclown )
1580   PORT_START   /* 40 */
1580   PORT_START_TAG("40")   /* 40 */
15811581   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_SERVICE1 )
15821582   PORT_SERVICE_NO_TOGGLE( 0x0200, IP_ACTIVE_LOW )
15831583   PORT_BIT( 0x0c00, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
15851585   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_COIN1 )
15861586   PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNKNOWN )
15871587
1588   PORT_START   /* 60 */
1588   PORT_START_TAG("60")   /* 60 */
15891589   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Throw") PORT_PLAYER(1)
15901590   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START1 )
15911591   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
r2864r2865
15951595   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Kick") PORT_PLAYER(1)
15961596   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Punch") PORT_PLAYER(1)
15971597
1598   PORT_START   /* 80 */
1598   PORT_START_TAG("80")   /* 80 */
15991599   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 Throw") PORT_PLAYER(2)
16001600   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
16011601   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
r2864r2865
16051605   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Kick") PORT_PLAYER(2)
16061606   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Punch") PORT_PLAYER(2)
16071607
1608   UNUSED_ANALOG   /* analog C */
1609   UNUSED_ANALOG   /* analog D */
1610   UNUSED_ANALOG   /* analog E */
1611   UNUSED_ANALOG   /* analog F */
1608   UNUSED_ANALOG("AN_C")   /* analog C */
1609   UNUSED_ANALOG("AN_D")   /* analog D */
1610   UNUSED_ANALOG("AN_E")   /* analog E */
1611   UNUSED_ANALOG("AN_F")   /* analog F */
16121612INPUT_PORTS_END
16131613
16141614
16151615static INPUT_PORTS_START( gtg2 )
1616   PORT_START   /* 40 */
1616   PORT_START_TAG("40")   /* 40 */
16171617   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
16181618   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
16191619   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
16241624   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ))
16251625   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
16261626
1627   PORT_START   /* 60 */
1627   PORT_START_TAG("60")   /* 60 */
16281628   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
16291629   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Face Right") PORT_PLAYER(1)
16301630   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Face Left") PORT_PLAYER(1)
16311631   PORT_BIT( 0x78, IP_ACTIVE_LOW, IPT_UNUSED )
16321632   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
16331633
1634   PORT_START   /* 80 */
1634   PORT_START_TAG("80")   /* 80 */
16351635   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
16361636   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Face Right") PORT_COCKTAIL PORT_PLAYER(2)
16371637   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Face Left") PORT_COCKTAIL PORT_PLAYER(2)
16381638   PORT_BIT( 0x78, IP_ACTIVE_LOW, IPT_UNUSED )
16391639   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
16401640
1641   PORT_START   /* analog C */
1641   PORT_START_TAG("AN_C")   /* analog C */
16421642    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_PLAYER(1)
16431643
1644   PORT_START   /* analog D */
1644   PORT_START_TAG("AN_D")   /* analog D */
16451645    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
16461646
1647   PORT_START   /* analog E */
1647   PORT_START_TAG("AN_E")   /* analog E */
16481648    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_COCKTAIL PORT_PLAYER(2)
16491649
1650   PORT_START   /* analog F */
1650   PORT_START_TAG("AN_F")   /* analog F */
16511651    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(32) PORT_RESET PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
16521652INPUT_PORTS_END
16531653
16541654
16551655static INPUT_PORTS_START( gpgolf )
1656   PORT_START   /* 40 */
1656   PORT_START_TAG("40")   /* 40 */
16571657   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
16581658   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
16591659   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
16641664   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ))
16651665   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
16661666
1667   PORT_START   /* 60 */
1668
1667   PORT_START_TAG("60")   /* 60 */
16691668   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
16701669   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
16711670   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Swing") PORT_PLAYER(1)
r2864r2865
16751674   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
16761675   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
16771676
1678   PORT_START   /* 80 */
1677   PORT_START_TAG("80")   /* 80 */
16791678   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
16801679
1681   UNUSED_ANALOG   /* analog C */
1682   UNUSED_ANALOG   /* analog D */
1683   UNUSED_ANALOG   /* analog E */
1684   UNUSED_ANALOG   /* analog F */
1680   UNUSED_ANALOG("AN_C")   /* analog C */
1681   UNUSED_ANALOG("AN_D")   /* analog D */
1682   UNUSED_ANALOG("AN_E")   /* analog E */
1683   UNUSED_ANALOG("AN_F")   /* analog F */
16851684INPUT_PORTS_END
16861685
16871686
src/mame/drivers/gstriker.c
r2864r2865
345345   AM_RANGE(0x08, 0x08) AM_WRITE(gs_sh_pending_command_clear_w)
346346ADDRESS_MAP_END
347347
348
349
350static ADDRESS_MAP_START( vgoal_map, ADDRESS_SPACE_PROGRAM, 16 )
351   AM_RANGE(0x000000, 0x0fffff) AM_ROM
352   AM_RANGE(0x100000, 0x103fff) AM_RAM AM_WRITE(MB60553_0_vram_w) AM_BASE(&MB60553_0_vram)
353   AM_RANGE(0x140000, 0x141fff) AM_RAM AM_BASE(&CG10103_0_vram)
354   AM_RANGE(0x180000, 0x180fff) AM_RAM AM_WRITE(VS920A_0_vram_w) AM_BASE(&VS920A_0_vram)
355   AM_RANGE(0x181000, 0x181fff) AM_RAM AM_BASE(&gstriker_lineram)
356   AM_RANGE(0x1c0000, 0x1c4fff) AM_RAM AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
357   AM_RANGE(0x200000, 0x20000f) AM_WRITE(MB60553_0_regs_w)
358   AM_RANGE(0x200040, 0x20005f) AM_RAM AM_BASE(&gs_mixer_regs)
359
360   AM_RANGE(0x200080, 0x200081) AM_READ(input_port_1_word_r)
361   AM_RANGE(0x200082, 0x200083) AM_READ(input_port_2_word_r)
362   AM_RANGE(0x200084, 0x200085) AM_READ(input_port_0_word_r)
363   AM_RANGE(0x200086, 0x200087) AM_READ(input_port_3_word_r)
364   AM_RANGE(0x200088, 0x200089) AM_READ(input_port_4_word_r)
365   AM_RANGE(0x20008e, 0x20008f) AM_READ(dmmy_8f)
366
367   AM_RANGE(0x2000a0, 0x2000a1) AM_WRITE(sound_command_w)
368   AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_BASE(&work_ram)
369ADDRESS_MAP_END
370
348371/*** INPUT PORTS *************************************************************/
349372
350static INPUT_PORTS_START( gstriker )
373static INPUT_PORTS_START( gstriker_generic )
351374   PORT_START
352375   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
353376   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
r2864r2865
370393   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)   // "Spare"
371394   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
372395
373   PORT_START
396   PORT_START      /* IN2 */
374397   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
375398   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
376399   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
380403   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
381404   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)   // "Spare"
382405   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
406INPUT_PORTS_END
383407
384   PORT_START
408static INPUT_PORTS_START( gstriker )
409   PORT_INCLUDE( gstriker_generic )
410
411   PORT_START /* IN3 */
385412   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coin_A ) )
386413   PORT_DIPSETTING(      0x0001, DEF_STR( 3C_1C ) )
387414   PORT_DIPSETTING(      0x0002, DEF_STR( 2C_1C ) )
r2864r2865
406433   PORT_DIPSETTING(      0x0080, "2" )
407434   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
408435
409   PORT_START
436   PORT_START /* IN4 */
410437   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Difficulty ) )
411438   PORT_DIPSETTING(      0x0001, DEF_STR( Normal ) )
412439   PORT_DIPSETTING(      0x0000, DEF_STR( Hard ) )
r2864r2865
430457   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
431458INPUT_PORTS_END
432459
460static INPUT_PORTS_START( twrldc94 )
461   PORT_INCLUDE( gstriker_generic )
462
463   PORT_START /* IN3 */
464   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
465   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
466   PORT_DIPSETTING(      0x0001, DEF_STR( 3C_1C ) )
467   PORT_DIPSETTING(      0x0002, DEF_STR( 2C_1C ) )
468   PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
469   PORT_DIPSETTING(      0x0006, DEF_STR( 1C_2C ) )
470   PORT_DIPSETTING(      0x0005, DEF_STR( 1C_3C ) )
471   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_4C ) )
472   PORT_DIPSETTING(      0x0003, DEF_STR( 1C_6C ) )
473
474   PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) )
475   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
476   PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
477   PORT_DIPSETTING(      0x0010, DEF_STR( 2C_1C ) )
478   PORT_DIPSETTING(      0x0038, DEF_STR( 1C_1C ) )
479   PORT_DIPSETTING(      0x0030, DEF_STR( 1C_2C ) )
480   PORT_DIPSETTING(      0x0028, DEF_STR( 1C_3C ) )
481   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_4C ) )
482   PORT_DIPSETTING(      0x0018, DEF_STR( 1C_6C ) )
483
484   PORT_DIPNAME( 0x00c0, 0x00c0, "Play Time" )
485   PORT_DIPSETTING(      0x0000, "P v CPU 1:00, P v P 1:30" )
486   PORT_DIPSETTING(      0x00c0, "P v CPU 1:30, P v P 2:00" )
487   PORT_DIPSETTING(      0x0040, "P v CPU 2:00, P v P 2:30" )
488   PORT_DIPSETTING(      0x0080, "P v CPU 2:30, P v P 3:00" )
489   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
490
491   PORT_START /* IN4 */
492   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
493   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Hard ) )
494   PORT_DIPSETTING(      0x0001, DEF_STR( Hard ) )
495   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
496   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
497
498   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Demo_Sounds ) )
499   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
500   PORT_DIPSETTING(      0x0004, DEF_STR( On ) )
501   PORT_DIPNAME( 0x0008, 0x0008, "Show Configuration" )
502   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
503   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
504   PORT_DIPNAME( 0x0010, 0x0010, "Countdown" )
505   PORT_DIPSETTING(      0x0010, "54 sec" )
506   PORT_DIPSETTING(      0x0000, "60 sec" )
507   PORT_DIPNAME( 0x0020, 0x0020, "Start credit" )
508   PORT_DIPSETTING(      0x0020, "1" )
509   PORT_DIPSETTING(      0x0000, "2" )
510   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unused ) )
511   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
512   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
513   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
514   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
515INPUT_PORTS_END
516
517static INPUT_PORTS_START( vgoalsoc )
518   PORT_INCLUDE( gstriker_generic )
519
520   PORT_START /* IN3 */
521   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
522   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
523   PORT_DIPSETTING(      0x0001, DEF_STR( 3C_1C ) )
524   PORT_DIPSETTING(      0x0002, DEF_STR( 2C_1C ) )
525   PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
526   PORT_DIPSETTING(      0x0006, DEF_STR( 1C_2C ) )
527   PORT_DIPSETTING(      0x0005, DEF_STR( 1C_3C ) )
528   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_4C ) )
529   PORT_DIPSETTING(      0x0003, DEF_STR( 1C_6C ) )
530
531   PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) )
532   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
533   PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
534   PORT_DIPSETTING(      0x0010, DEF_STR( 2C_1C ) )
535   PORT_DIPSETTING(      0x0038, DEF_STR( 1C_1C ) )
536   PORT_DIPSETTING(      0x0030, DEF_STR( 1C_2C ) )
537   PORT_DIPSETTING(      0x0028, DEF_STR( 1C_3C ) )
538   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_4C ) )
539   PORT_DIPSETTING(      0x0018, DEF_STR( 1C_6C ) )
540
541   PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR (Unknown) ) // Probably difficulty
542   PORT_DIPSETTING(      0x0080, "A" )
543   PORT_DIPSETTING(      0x00c0, "B" )
544   PORT_DIPSETTING(      0x0040, "C" )
545   PORT_DIPSETTING(      0x0000, "D" )
546   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
547
548   PORT_START /* IN4 */
549   PORT_DIPNAME( 0x0003, 0x0003, "Player VS CPU Time" ) // no coperative
550   PORT_DIPSETTING(      0x0002, "1:00" )
551   PORT_DIPSETTING(      0x0003, "1:30" )
552   PORT_DIPSETTING(      0x0001, "2:00" )
553   PORT_DIPSETTING(      0x0000, "2:30" )
554   PORT_DIPNAME( 0x000c, 0x000c, "Player VS Player Time" )
555   PORT_DIPSETTING(      0x0008, "1:30" )
556   PORT_DIPSETTING(      0x000c, "2:00" )
557   PORT_DIPSETTING(      0x0004, "2:30" )
558   PORT_DIPSETTING(      0x0000, "3:00" )
559   PORT_DIPNAME( 0x0010, 0x0010, "Countdown" )
560   PORT_DIPSETTING(      0x0010, "54 sec" )
561   PORT_DIPSETTING(      0x0000, "60 sec" )
562   PORT_DIPNAME( 0x0020, 0x0000, DEF_STR( Demo_Sounds ) )
563   PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
564   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
565   PORT_DIPNAME( 0x0040, 0x0040, "DWS2:6" )      // hangs at POST
566   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
567   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
568   PORT_DIPNAME( 0x0080, 0x0080, "Start credit" )
569   PORT_DIPSETTING(      0x0080, "1" )
570   PORT_DIPSETTING(      0x0000, "2" )
571   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
572INPUT_PORTS_END
573
433574/*** MACHINE DRIVER **********************************************************/
434575
435576static MACHINE_DRIVER_START( gstriker )
r2864r2865
472613   MDRV_VIDEO_START( twrldc94 )
473614MACHINE_DRIVER_END
474615
616
617static MACHINE_DRIVER_START( vgoal )
618   MDRV_CPU_ADD(M68000, 16000000)
619   MDRV_CPU_PROGRAM_MAP(vgoal_map,0)
620   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
621
622   MDRV_CPU_ADD(Z80,8000000/2)
623   /* audio CPU */   /* 4 MHz ??? */
624   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
625   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
626
627   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
628
629   MDRV_SCREEN_ADD("main", RASTER)
630   MDRV_SCREEN_REFRESH_RATE(60)
631   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(5000) /* hand-tuned, it needs a bit */)
632   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
633   MDRV_SCREEN_SIZE(64*8, 64*8)
634   MDRV_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
635
636   MDRV_GFXDECODE(gstriker)
637   MDRV_PALETTE_LENGTH(0x2000)
638
639   MDRV_VIDEO_START(vgoalsoc)
640   MDRV_VIDEO_UPDATE(gstriker)
641
642   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
643
644   MDRV_SOUND_ADD(YM2610, 8000000)
645   MDRV_SOUND_CONFIG(ym2610_interface)
646   MDRV_SOUND_ROUTE(0, "left",  0.25)
647   MDRV_SOUND_ROUTE(0, "right", 0.25)
648   MDRV_SOUND_ROUTE(1, "left",  1.0)
649   MDRV_SOUND_ROUTE(2, "right", 1.0)
650MACHINE_DRIVER_END
651
652
653
654
475655/*** ROM LOADING *************************************************************/
476656
477657ROM_START( gstriker )
r2864r2865
632812work_ram[0x000/2] = (_num_ & 0xffff0000) >> 16;\
633813work_ram[0x002/2] = (_num_ & 0x0000ffff) >> 0;
634814
815static int gametype = 0;
816static UINT16 mcu_data = 0;
817
635818static WRITE16_HANDLER( twrldc94_mcu_w )
636819{
637   switch(data)
820   mcu_data = data;
821}
822
823static READ16_HANDLER( twrldc94_mcu_r )
824{
825   return mcu_data;
826}
827
828static UINT16 prot_reg[2] = {0,0}; // current,last
829static WRITE16_HANDLER( twrldc94_prot_reg_w )
830{
831   prot_reg[1] = prot_reg[0];
832   prot_reg[0] = data;
833
834   if( ((prot_reg[1] & 2) == 2) && ((prot_reg[0] & 2) == 0) )
638835   {
639      /*P.O.S.T. / Test Mode*/
640      case 0x53: PC(0x00000a4c); break;
641      /*Time Up*/
642      case 0x68: break;
643      /*Title Screen*/
644      case 0x69: break;
645      /*Gameplay / Attract mode*/
646      case 0x6b: PC(0x00000746); break;
647      /*(after the P.O.S.T.)*/
648      case 0x6e: PC(0x00000746); break;/*WRONG?*/
649      default: popmessage("Unknown MCU CMD %04x",data);
836      switch( gametype )
837      {
838         case 1:
839            switch(mcu_data)
840            {
841               #define NULL_SUB 0x0000828E
842               case 0x53: PC(0x0000a4c); break; // boot -> main loop
843
844               /*
845                        68 and 62 could be sprite or sound changes, or ?
846                        68(),61()
847                        if( !carry )
848                        {
849                            68(),65()
850                        }
851                        else
852                        {
853                            62(),72()
854                        }
855                    */
856               case 0x68: PC(NULL_SUB); break; // time up doesn't block long enough for pk shootout
857               case 0x61: PC(0x0003AF4); break; // after time up, pk shootout???
858               case 0x65: PC(0x0003F26); break;
859
860               // 62->72
861               case 0x62: PC(NULL_SUB); break;   // after lose shootout, continue ???
862               case 0x72: PC(0x000409E); break; // game over
863
864               /*
865                        Attract mode is pre programmed loop called from main
866                        that runs through top11->demoplay
867                        (NOTE: sprites for demo play are being drawn at 0x141000,
868                        this address is used in a few places, and there's some activity
869                        further up around 0x1410b0.)
870
871                        The loop begins with three prot calls:
872                        one always present (may be diversion to 0x0010DC8 unreachable code
873                        and prot cases 6a,79,6f) and two alternating calls.
874                        The loop is 6e -> [6b|69] -> top11 -> (4 segment)playdemo
875
876                        These are the likely suspects for attract mode:
877                        0x0010E28 red tecmo on black
878                        0x0010EEC bouncing ball and player with game title
879                        0x00117A2 single segment demo play with player sprites at 0x140000
880                        0x001120A sliding display of player photos
881                        0x0010DC8 unreachable code at end of attract loop with cases 6a,79,6f
882
883                    */
884               case 0x6e: PC(0x0010E28); break; // loop
885               case 0x6b: PC(0x0010EEC); break; // attract even
886               case 0x69: PC(0x001120A); break; // attract odd
887
888               // In "continue" screen
889               // if( w@FFE078 & 80) 75
890               // *** after 75 beq
891               case 0x75: PC(NULL_SUB); break;
892
893               // unreachable code at end of attract loop 6a->79->6f
894               case 0x6a: PC(NULL_SUB); break;
895               case 0x79: PC(NULL_SUB); break;
896               case 0x6f: PC(NULL_SUB); break;
897
898               default:
899                  popmessage("Unknown MCU CMD %04x",mcu_data);
900                  PC(NULL_SUB);
901                  break;
902            }
903            break;
904
905         case 2:
906            switch(mcu_data)
907            {
908               case 0x53: PC(0x00000a5c); break; // POST
909
910               default:
911                  popmessage("Unknown MCU CMD %04x",mcu_data);
912                  PC(NULL_SUB);
913                  break;
914            }
915            break;
916
917
918         case 3:
919            switch(mcu_data)
920            {
921               case 0x33: PC(0x00063416); break; // *after game over, is this right?
922               case 0x3d: PC(0x0006275C); break; // after sprite ram init, team select
923               case 0x42: PC(0x0006274E); break; // after press start, init sprite ram
924               case 0x43: PC(0x0006a000); break; // POST
925               case 0x50: PC(0x00001900); break; // enter main loop
926               case 0x65: PC(0x0006532C); break; // results
927               case 0x70: PC(0x00063416); break; // *attract loop ends, what should happen after "standings" display?
928               case 0x74: PC(0x000650D8); break; // after time up, show scores and continue
929               case 0x79: PC(0x0006072E); break; // after select, start match
930
931               default:
932                  popmessage("Unknown MCU CMD %04x",mcu_data);
933                  PC(0x00000586); // rts
934                  break;
935            }
936            break;
937      }
650938   }
651939}
652940
653static DRIVER_INIT( twrldc94 )
941static READ16_HANDLER( twrldc94_prot_reg_r )
654942{
943   // bit 0 is for debugging vgoalsoc?
944   // Setting it results in a hang with a digit displayed on screen
945   // For twrldc94, it just disables sound.
946
947   return prot_reg[0];
948}
949
950/*
951    vgoalsoc uses a set of programmable timers.
952    There is a code implementation for at 00065F00 that appears to have
953    been RTSed out.
954    I'm guessing it was replaced with an external implementation.
955
956    This does indicate though that the protection could be performing
957    other more complicated functions.
958
959    The tick count is usually set to 0x3c => it's driven off vblank?
960*/
961//work_ram[ (0xffe900 - 0xffc00) ]
962#define COUNTER1_ENABLE work_ram[0x2900/2] >> 8
963#define COUNTER2_ENABLE (work_ram[0x2900/2] & 0xff)
964#define TICK_1 work_ram[0x2908/2]
965#define TICKCOUNT_1 work_ram[0x290a/2]
966#define TICK_2 work_ram[0x290c/2]
967#define TICKCOUNT_3 work_ram[0x290e/2]
968#define COUNTER_1 work_ram[0x2928/2]
969#define COUNTER_2 work_ram[0x292a/2]
970static READ16_HANDLER( vbl_toggle_r )
971{
972   return 0xff;
973}
974
975static WRITE16_HANDLER( vbl_toggle_w )
976{
977   if( COUNTER1_ENABLE == 1 )
978   {
979      TICK_1 = (TICK_1 - 1) & 0xff;   // 8bit
980      if( TICK_1 <= 0 )
981      {
982         TICK_1 = TICKCOUNT_1;
983         COUNTER_1 = (COUNTER_1 - 1);// & 0xff; has to be 16bit for continue timer.
984      }
985   }
986
987   if( COUNTER2_ENABLE == 2 )
988   {
989      TICK_2  = (TICK_2 - 1) & 0xff;
990      if( TICK_2 <= 0 )
991      {
992         TICK_2 = TICKCOUNT_3;
993         COUNTER_2 = (COUNTER_2 - 1);// & 0xff;
994      }
995   }
996}
997
998static void mcu_init( running_machine *machine )
999{
6551000   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20008a, 0x20008b, 0, 0, twrldc94_mcu_w);
1001   memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20008a, 0x20008b, 0, 0, twrldc94_mcu_r);
1002
1003   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20008e, 0x20008f, 0, 0, twrldc94_prot_reg_w);
1004   memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x20008e, 0x20008f, 0, 0, twrldc94_prot_reg_r);
6561005}
6571006
1007static DRIVER_INIT( twrldc94 )
1008{
1009   gametype = 1;
1010   mcu_init( machine );
1011}
1012
1013static DRIVER_INIT( twrldc94a )
1014{
1015   gametype = 2;
1016   mcu_init( machine );
1017}
1018
1019static DRIVER_INIT( vgoalsoc )
1020{
1021   gametype = 3;
1022   mcu_init( machine );
1023
1024   memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200090, 0x200091, 0, 0, vbl_toggle_w); // vblank toggle
1025   memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200090, 0x200091, 0, 0, vbl_toggle_r);
1026}
1027
6581028/*** GAME DRIVERS ************************************************************/
6591029
6601030GAME( 1993, gstriker, 0,        gstriker, gstriker, 0,        ROT0, "Human", "Grand Striker", GAME_IMPERFECT_GRAPHICS )
6611031
6621032/* Similar, but not identical hardware, appear to be protected by an MCU :-( */
663GAME( 199?, vgoalsoc, 0,        gstriker, gstriker, 0,        ROT0, "Tecmo", "V Goal Soccer (set 1)", GAME_NOT_WORKING )
664GAME( 199?, vgoalsca, vgoalsoc, gstriker, gstriker, 0,        ROT0, "Tecmo", "V Goal Soccer (set 2)", GAME_NOT_WORKING )
665GAME( 1994, twrldc94, 0,        twrldc94, gstriker, twrldc94, ROT0, "Tecmo", "Tecmo World Cup '94 (set 1)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS )
666GAME( 1994, twrdc94a, twrldc94, twrldc94, gstriker, twrldc94, ROT0, "Tecmo", "Tecmo World Cup '94 (set 2)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS )
1033GAME( 199?, vgoalsoc, 0,        vgoal,    vgoalsoc, vgoalsoc,   ROT0, "Tecmo", "V Goal Soccer (set 1)", GAME_NOT_WORKING )
1034GAME( 199?, vgoalsca, vgoalsoc, vgoal,    vgoalsoc, vgoalsoc,   ROT0, "Tecmo", "V Goal Soccer (set 2)", GAME_NOT_WORKING )
1035GAME( 1994, twrldc94, 0,        twrldc94, twrldc94, twrldc94,   ROT0, "Tecmo", "Tecmo World Cup '94 (set 1)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS )
1036GAME( 1994, twrdc94a, twrldc94, twrldc94, twrldc94, twrldc94a,  ROT0, "Tecmo", "Tecmo World Cup '94 (set 2)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/flstory.c
r2864r2865
8585   AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w)
8686   AM_RANGE(0xd401, 0xd401) AM_READ(snd_flag_r)
8787   AM_RANGE(0xd403, 0xd403) AM_NOP   /* unknown */
88   AM_RANGE(0xd800, 0xd800) AM_READ(input_port_0_r)
89   AM_RANGE(0xd801, 0xd801) AM_READ(input_port_1_r)
90   AM_RANGE(0xd802, 0xd802) AM_READ(input_port_2_r)
91   AM_RANGE(0xd803, 0xd803) AM_READ(input_port_3_r)
92   AM_RANGE(0xd804, 0xd804) AM_READ(input_port_4_r)
88   AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0")
89   AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSW1")
90   AM_RANGE(0xd802, 0xd802) AM_READ_PORT("IN0")
91   AM_RANGE(0xd803, 0xd803) AM_READ_PORT("IN1")
92   AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN2")
9393   AM_RANGE(0xd805, 0xd805) AM_READ(flstory_mcu_status_r)
94   AM_RANGE(0xd806, 0xd806) AM_READ(input_port_5_r)
94   AM_RANGE(0xd806, 0xd806) AM_READ_PORT("IN3")
9595//  AM_RANGE(0xda00, 0xda00) AM_WRITE(SMH_RAM)
9696   AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
9797   AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram)
r2864r2865
111111   AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w)
112112   AM_RANGE(0xd401, 0xd401) AM_READ(snd_flag_r)
113113   AM_RANGE(0xd403, 0xd403) AM_NOP   /* unknown */
114   AM_RANGE(0xd800, 0xd800) AM_READ(input_port_0_r)
115   AM_RANGE(0xd801, 0xd801) AM_READ(input_port_1_r)
116   AM_RANGE(0xd802, 0xd802) AM_READ(input_port_2_r)
117   AM_RANGE(0xd803, 0xd803) AM_READ(input_port_3_r)
118   AM_RANGE(0xd804, 0xd804) AM_READ(input_port_4_r)
114   AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0")
115   AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSW1")
116   AM_RANGE(0xd802, 0xd802) AM_READ_PORT("DSW2")
117   AM_RANGE(0xd803, 0xd803) AM_READ_PORT("IN0")
118   AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN1")
119119   AM_RANGE(0xd805, 0xd805) AM_READ(onna34ro_mcu_status_r)
120   AM_RANGE(0xd806, 0xd806) AM_READ(input_port_5_r)
120   AM_RANGE(0xd806, 0xd806) AM_READ_PORT("IN2")
121121//  AM_RANGE(0xda00, 0xda00) AM_WRITE(SMH_RAM)
122122   AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
123123   AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram)
r2864r2865
129129
130130static READ8_HANDLER( victnine_port_5_r )
131131{
132   return (victnine_mcu_status_r(machine,0) & 3) | (input_port_read_indexed(machine, 5) & ~3);
132   return (victnine_mcu_status_r(machine,0) & 3) | (input_port_read(machine, "IN2") & ~3);
133133}
134134
135135static ADDRESS_MAP_START( victnine_map, ADDRESS_SPACE_PROGRAM, 8 )
r2864r2865
142142   AM_RANGE(0xd400, 0xd400) AM_READWRITE(from_snd_r, sound_command_w)
143143   AM_RANGE(0xd401, 0xd401) AM_READ(snd_flag_r)
144144   AM_RANGE(0xd403, 0xd403) AM_READNOP /* unknown */
145   AM_RANGE(0xd800, 0xd800) AM_READ(input_port_0_r)
146   AM_RANGE(0xd801, 0xd801) AM_READ(input_port_1_r)
147   AM_RANGE(0xd802, 0xd802) AM_READ(input_port_2_r)
148   AM_RANGE(0xd803, 0xd803) AM_READ(input_port_3_r)
149   AM_RANGE(0xd804, 0xd804) AM_READ(input_port_4_r)
145   AM_RANGE(0xd800, 0xd800) AM_READ_PORT("DSW0")
146   AM_RANGE(0xd801, 0xd801) AM_READ_PORT("DSW1")
147   AM_RANGE(0xd802, 0xd802) AM_READ_PORT("DSW2")
148   AM_RANGE(0xd803, 0xd803) AM_READ_PORT("IN0")
149   AM_RANGE(0xd804, 0xd804) AM_READ_PORT("IN1")
150150   AM_RANGE(0xd805, 0xd805) AM_READ(victnine_port_5_r)
151   AM_RANGE(0xd806, 0xd806) AM_READ(input_port_6_r)
152   AM_RANGE(0xd807, 0xd807) AM_READ(input_port_7_r)
151   AM_RANGE(0xd806, 0xd806) AM_READ_PORT("IN3")
152   AM_RANGE(0xd807, 0xd807) AM_READ_PORT("IN4")
153153//  AM_RANGE(0xda00, 0xda00) AM_WRITE(SMH_RAM)
154154   AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
155155   AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram)
src/mame/drivers/f-32.c
r2864r2865
9898   if ((activecpu_get_pc() == 0x000379de) ||
9999       (activecpu_get_pc() == 0x000379cc) ) activecpu_adjust_icount(-100);
100100   //else printf("PC %08x\n", activecpu_get_pc() );
101   return input_port_read_indexed(machine, 1);
101   return input_port_read(machine, "IN1");
102102}
103103
104104
r2864r2865
118118
119119
120120static INPUT_PORTS_START( mosaicf2 )
121   PORT_START
121   PORT_START_TAG("IN0")
122122   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNUSED )
123123   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_PLAYER(1)
124124   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_PLAYER(1)
r2864r2865
130130   PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_START1 )
131131   PORT_BIT( 0xff000000, IP_ACTIVE_LOW, IPT_UNUSED )
132132
133   PORT_START
133   PORT_START_TAG("IN1")
134134   PORT_BIT( 0x000000ff, IP_ACTIVE_LOW, IPT_UNUSED )
135135   PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_COIN1 )
136136   PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_COIN2 )
src/mame/drivers/atetris.c
r2864r2865
493493
494494static DRIVER_INIT( atetris )
495495{
496   slapstic_init(101);
496   slapstic_init(machine, 101);
497497   slapstic_source = &memory_region(REGION_CPU1)[0x10000];
498498   slapstic_base = &memory_region(REGION_CPU1)[0x04000];
499499}
src/mame/drivers/model2.c
r2864r2865
307307   model2_timerrun[offset] = 1;
308308}
309309
310static void model2_timer_exp(int tnum, int bit)
310static void model2_timer_exp(running_machine *machine, int tnum, int bit)
311311{
312312   timer_adjust_oneshot(model2_timers[tnum], attotime_never, 0);
313313
314314   model2_intreq |= (1<<bit);
315315   if (model2_intena & (1<<bit))
316316   {
317      cpunum_set_input_line(Machine, 0, I960_IRQ2, ASSERT_LINE);
317      cpunum_set_input_line(machine, 0, I960_IRQ2, ASSERT_LINE);
318318   }
319319
320320   model2_timervals[tnum] = 0;
321321   model2_timerrun[tnum] = 0;
322322}
323323
324static TIMER_CALLBACK( model2_timer_0_cb ) { model2_timer_exp(0, 2); }
325static TIMER_CALLBACK( model2_timer_1_cb ) { model2_timer_exp(1, 3); }
326static TIMER_CALLBACK( model2_timer_2_cb ) { model2_timer_exp(2, 4); }
327static TIMER_CALLBACK( model2_timer_3_cb ) { model2_timer_exp(3, 5); }
324static TIMER_CALLBACK( model2_timer_0_cb ) { model2_timer_exp(machine, 0, 2); }
325static TIMER_CALLBACK( model2_timer_1_cb ) { model2_timer_exp(machine, 1, 3); }
326static TIMER_CALLBACK( model2_timer_2_cb ) { model2_timer_exp(machine, 2, 4); }
327static TIMER_CALLBACK( model2_timer_3_cb ) { model2_timer_exp(machine, 3, 5); }
328328
329329static MACHINE_RESET(model2_common)
330330{
r2864r2865
407407   dsp_type = DSP_TYPE_TGPX4;
408408}
409409
410static void chcolor(pen_t color, UINT16 data)
410static void chcolor(running_machine *machine, pen_t color, UINT16 data)
411411{
412   palette_set_color_rgb(Machine,color,pal5bit(data >> 0),pal5bit(data >> 5),pal5bit(data >> 10));
412   palette_set_color_rgb(machine,color,pal5bit(data >> 0),pal5bit(data >> 5),pal5bit(data >> 10));
413413}
414414
415415static WRITE32_HANDLER(pal32_w)
416416{
417417   COMBINE_DATA(paletteram32+offset);
418418   if(ACCESSING_BITS_0_15)
419      chcolor(offset*2, paletteram32[offset]);
419      chcolor(machine, offset*2, paletteram32[offset]);
420420   if(ACCESSING_BITS_16_31)
421      chcolor(offset*2+1, paletteram32[offset]>>16);
421      chcolor(machine, offset*2+1, paletteram32[offset]>>16);
422422}
423423
424424static WRITE32_HANDLER(ctrl0_w)
r2864r2865
907907   return 0xff;
908908}
909909
910static void snd_latch_to_68k_w(int data)
910static void snd_latch_to_68k_w(running_machine *machine, int data)
911911{
912912   while (!snd_68k_ready_r())
913913   {
r2864r2865
916916
917917   to_68k = data;
918918
919   cpunum_set_input_line(Machine, 1, 2, HOLD_LINE);
919   cpunum_set_input_line(machine, 1, 2, HOLD_LINE);
920920
921921   // give the 68k time to notice
922922   cpu_spinuntil_time(ATTOTIME_IN_USEC(40));
r2864r2865
936936{
937937   if (mem_mask == 0x0000ffff)
938938   {
939      snd_latch_to_68k_w(data&0xff);
939      snd_latch_to_68k_w(machine, data&0xff);
940940   }
941941}
942942
src/mame/drivers/ataxx.c
r2864r2865
104104
105105
106106static INPUT_PORTS_START( ataxx )
107   PORT_START      /* 0xF6 */
107   PORT_START_TAG("IN0")      /* 0xF6 */
108108   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
109109   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
110110   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* huh? affects trackball movement */
111    PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )
111   PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )
112112   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
113113   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
114114   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
115115   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
116116
117   PORT_START      /* 0xF7 */
117   PORT_START_TAG("IN1")      /* 0xF7 */
118118   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SLAVEHALT )
119119   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
120120   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
121121
122   PORT_START      /* 0x20 */
122   PORT_START_TAG("IN2")      /* 0x20 */
123123   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
124124   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
125125
126   PORT_START      /* 0x00 - analog X */
126   PORT_START_TAG("AN0")      /* 0x00 - analog X */
127127   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
128   PORT_START      /* 0x01 - analog Y */
128   PORT_START_TAG("AN1")      /* 0x01 - analog Y */
129129   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
130   PORT_START      /* 0x02 - analog X */
130   PORT_START_TAG("AN2")      /* 0x02 - analog X */
131131   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
132   PORT_START      /* 0x03 - analog Y */
132   PORT_START_TAG("AN3")      /* 0x03 - analog Y */
133133   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
134134INPUT_PORTS_END
135135
136136
137137static INPUT_PORTS_START( wsf )
138   PORT_START      /* 0xF6 */
138   PORT_START_TAG("IN0")      /* 0xF6 */
139139   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
140    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
141    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
142    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 )
143    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
144    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
145    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
146    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
140   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
141   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
142   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 )
143   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
144   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
145   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
146   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
147147
148   PORT_START      /* 0xF7 */
149    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SLAVEHALT )
150    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
151    PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
148   PORT_START_TAG("IN1")      /* 0xF7 */
149   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SLAVEHALT )
150   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
151   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
152152
153   PORT_START      /* 0x20 */
153   PORT_START_TAG("IN2")      /* 0x20 */
154154   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
155155   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
156    PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
156   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
157157   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
158158
159    PORT_START      /* 0x0D */
160    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
161    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
162    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
163    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
164    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
165    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
166    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
167    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
159   PORT_START_TAG("IN3")      /* 0x0D */
160   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
161   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
162   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
163   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
164   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
165   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
166   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
167   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
168168
169    PORT_START      /* 0x0E */
170    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
171    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
172    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
173    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
174    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
175    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
176    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
177    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
169   PORT_START_TAG("IN4")      /* 0x0E */
170   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
171   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
172   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
173   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
174   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
175   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
176   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
177   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
178178
179    PORT_START      /* 0x0F */
180    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
181    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
182    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
183    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
184    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
185    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START3 )
186    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
187    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
179   PORT_START_TAG("IN5")      /* 0x0F */
180   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
181   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
182   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
183   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
184   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
185   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START3 )
186   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
187   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
188188INPUT_PORTS_END
189189
190190
191191static INPUT_PORTS_START( indyheat )
192   PORT_START      /* 0xF6 */
193    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
192   PORT_START_TAG("IN0")      /* 0xF6 */
193   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
194194   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
195    PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
196    PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN3 ) PORT_IMPULSE(1)
195   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
196   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN3 ) PORT_IMPULSE(1)
197197   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
198    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
198   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
199199
200   PORT_START      /* 0xF7 */
200   PORT_START_TAG("IN1")      /* 0xF7 */
201201   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SLAVEHALT )
202202   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
203    PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
203   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
204204
205   PORT_START      /* 0x20 */
205   PORT_START_TAG("IN2")      /* 0x20 */
206206   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
207207   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
208208
209   PORT_START      /* Analog wheel 1 */
209   PORT_START_TAG("AN0")      /* Analog wheel 1 */
210210   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
211   PORT_START      /* Analog wheel 2 */
211   PORT_START_TAG("AN1")      /* Analog wheel 2 */
212212   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
213   PORT_START      /* Analog wheel 3 */
213   PORT_START_TAG("AN2")      /* Analog wheel 3 */
214214   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(3)
215   PORT_START      /* Analog pedal 1 */
215   PORT_START_TAG("AN3")      /* Analog pedal 1 */
216216   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
217   PORT_START      /* Analog pedal 2 */
217   PORT_START_TAG("AN4")      /* Analog pedal 2 */
218218   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
219   PORT_START      /* Analog pedal 3 */
219   PORT_START_TAG("AN5")      /* Analog pedal 3 */
220220   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(3)
221221
222    PORT_START      /* 0x0D */
223    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
222   PORT_START_TAG("IN3")      /* 0x0D */
223   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
224224   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
225225
226    PORT_START      /* 0x0E */
227    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
226   PORT_START_TAG("IN4")      /* 0x0E */
227   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
228228   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
229229
230    PORT_START      /* 0x0F */
231    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
230   PORT_START_TAG("IN5")      /* 0x0F */
231   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
232232   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED )
233    PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
233   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
234234INPUT_PORTS_END
235235
236236
237237static INPUT_PORTS_START( brutforc )
238   PORT_START      /* 0xF6 */
239    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
238   PORT_START_TAG("IN0")      /* 0xF6 */
239   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
240240   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
241    PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
242    PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN3 ) PORT_IMPULSE(1)
243    PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
244    PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
241   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
242   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN3 ) PORT_IMPULSE(1)
243   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
244   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
245245
246   PORT_START      /* 0xF7 */
247    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SLAVEHALT )
248    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
249    PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
246   PORT_START_TAG("IN1")      /* 0xF7 */
247   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SLAVEHALT )
248   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
249   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
250250
251   PORT_START      /* 0x20 */
251   PORT_START_TAG("IN2")      /* 0x20 */
252252   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
253253   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
254254
255    PORT_START      /* 0x0D */
256    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
257    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
258    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
259    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
260    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
261    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
262    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
263    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
255   PORT_START_TAG("IN3")      /* 0x0D */
256   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
257   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
258   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
259   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
260   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
261   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
262   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
263   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
264264
265    PORT_START      /* 0x0E */
266    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
267    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
268    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
269    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
270    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
271    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
272    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
273    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
265   PORT_START_TAG("IN4")      /* 0x0E */
266   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
267   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
268   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
269   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
270   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
271   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
272   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
273   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
274274
275    PORT_START      /* 0x0F */
276    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
277    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
278    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
279    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
280    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
281    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
282    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 )
283    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
275   PORT_START_TAG("IN5")      /* 0x0F */
276   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
277   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
278   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
279   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
280   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
281   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
282   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 )
283   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
284284INPUT_PORTS_END
285285
286286
src/mame/drivers/leland.c
r2864r2865
126126
127127
128128static INPUT_PORTS_START( cerberus )      /* complete, verified from code */
129   PORT_START      /* 0x80 */
129   PORT_START_TAG("IN0")   /* 0x80 */
130130    PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_PLAYER(1)
131131   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
132132   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
133133
134   PORT_START      /* 0x81 */
134   PORT_START_TAG("IN1")   /* 0x81 */
135135   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
136136   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
137137   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
138138   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
139139   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
140140
141   PORT_START      /* 0x90 */
141   PORT_START_TAG("IN2")   /* 0x90 */
142142    PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_PLAYER(2)
143143   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
144144   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
145145
146   PORT_START      /* 0x91 */
146   PORT_START_TAG("IN3")   /* 0x91 */
147147   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
148148   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
149149   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) PORT_PLAYER(1)
150150   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_PLAYER(1)
151151   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
152152
153   PORT_START      /* Analog joystick 1 */
153   PORT_START_TAG("AN0")   /* Analog joystick 1 */
154154    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
155   PORT_START
155   PORT_START_TAG("AN1")
156156    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
157   PORT_START      /* Analog joystick 2 */
158   PORT_START
159   PORT_START      /* Analog joystick 3 */
160   PORT_START
157   PORT_START_TAG("AN2")   /* Analog joystick 2 */
158   PORT_START_TAG("AN3")
159   PORT_START_TAG("AN4")   /* Analog joystick 3 */
160   PORT_START_TAG("AN5")
161161INPUT_PORTS_END
162162
163163
164164static INPUT_PORTS_START( mayhem )      /* complete, verified from code */
165   PORT_START      /* 0xC0 */
165   PORT_START_TAG("IN0")   /* 0xC0 */
166166   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
167167   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
168168   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
r2864r2865
172172   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
173173   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
174174
175   PORT_START      /* 0xC1 */
175   PORT_START_TAG("IN1")   /* 0xC1 */
176176   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
177177   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
178178   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
179179   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
180180   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
181181
182   PORT_START      /* 0xD0 */
182   PORT_START_TAG("IN2")   /* 0xD0 */
183183   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
184184   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
185185   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
189189   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
190190   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
191191
192   PORT_START      /* 0xD1 */
192   PORT_START_TAG("IN3")   /* 0xD1 */
193193   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
194194   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
195195   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
196196   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
197197   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
198198
199   PORT_START      /* Analog joystick 1 */
200   PORT_START
201   PORT_START      /* Analog joystick 2 */
202   PORT_START
203   PORT_START      /* Analog joystick 3 */
204   PORT_START
199   PORT_START_TAG("AN0")   /* Analog joystick 1 */
200   PORT_START_TAG("AN1")
201   PORT_START_TAG("AN2")   /* Analog joystick 2 */
202   PORT_START_TAG("AN3")
203   PORT_START_TAG("AN4")   /* Analog joystick 3 */
204   PORT_START_TAG("AN5")
205205INPUT_PORTS_END
206206
207207
208208static INPUT_PORTS_START( wseries )      /* complete, verified from code */
209   PORT_START      /* 0x80 */
209   PORT_START_TAG("IN0")   /* 0x80 */
210210   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
211211   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Extra Base") PORT_PLAYER(1)
212212   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Go Back") PORT_PLAYER(1)
213213
214   PORT_START      /* 0x81 */
214   PORT_START_TAG("IN1")   /* 0x81 */
215215   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
216216   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
217217   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
218218   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
219219   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
220220
221   PORT_START      /* 0x90 */
221   PORT_START_TAG("IN2")   /* 0x90 */
222222   PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED )
223223   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Aim") PORT_PLAYER(1)
224224
225   PORT_START      /* 0x91 */
225   PORT_START_TAG("IN3")   /* 0x91 */
226226   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
227227   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
228228   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) PORT_PLAYER(1)
229229   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_PLAYER(1)
230230   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
231231
232   PORT_START      /* Analog joystick 1 */
232   PORT_START_TAG("AN0")   /* Analog joystick 1 */
233233   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
234   PORT_START
234   PORT_START_TAG("AN1")
235235   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
236   PORT_START      /* Analog joystick 2 */
237   PORT_START
238   PORT_START      /* Analog joystick 3 */
236   PORT_START_TAG("AN2")   /* Analog joystick 2 */
237   PORT_START_TAG("AN3")
238   PORT_START_TAG("AN4")   /* Analog joystick 3 */
239239   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
240   PORT_START
240   PORT_START_TAG("AN5")
241241   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
242242INPUT_PORTS_END
243243
244244
245245static INPUT_PORTS_START( alleymas )      /* complete, verified from code */
246   PORT_START      /* 0xC0 */
246   PORT_START_TAG("IN0")   /* 0xC0 */
247247   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
248248   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
249249   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
250250
251   PORT_START      /* 0xC1 */
251   PORT_START_TAG("IN1")   /* 0xC1 */
252252   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
253253   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
254254   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
255255   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
256256   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
257257
258   PORT_START      /* 0xD0 */
258   PORT_START_TAG("IN2")   /* 0xD0 */
259259   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
260260   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )      /* redundant inputs */
261261   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )      /* redundant inputs */
262262
263   PORT_START      /* 0xD1 */
263   PORT_START_TAG("IN3")   /* 0xD1 */
264264   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
265265   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
266266   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) PORT_PLAYER(1)
267267   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_PLAYER(1)
268268   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
269269
270   PORT_START      /* Analog joystick 1 */
270   PORT_START_TAG("AN0")   /* Analog joystick 1 */
271271   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
272   PORT_START
272   PORT_START_TAG("AN1")
273273   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0,224) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
274   PORT_START      /* Analog joystick 2 */
275   PORT_START
276   PORT_START      /* Analog joystick 3 */
277   PORT_START
274   PORT_START_TAG("AN2")   /* Analog joystick 2 */
275   PORT_START_TAG("AN3")
276   PORT_START_TAG("AN4")   /* Analog joystick 3 */
277   PORT_START_TAG("AN5")
278278INPUT_PORTS_END
279279
280280
281281static INPUT_PORTS_START( upyoural )      /* complete, verified from code */
282   PORT_START      /* 0xC0 */
282   PORT_START_TAG("IN0")   /* 0xC0 */
283283   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
284284   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 )
285285   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
286286
287   PORT_START      /* 0xC1 */
287   PORT_START_TAG("IN1")   /* 0xC1 */
288288   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
289289   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
290290   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
291291   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
292292   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
293293
294   PORT_START      /* 0xD0 */
294   PORT_START_TAG("IN2")   /* 0xD0 */
295295   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
296296   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
297297   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )
298298
299   PORT_START      /* 0xD1 */
299   PORT_START_TAG("IN3")   /* 0xD1 */
300300   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
301301   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
302302   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) PORT_PLAYER(1)
303303   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_PLAYER(1)
304304   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
305305
306   PORT_START      /* Analog joystick 1 */
306   PORT_START_TAG("AN0")   /* Analog joystick 1 */
307307   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
308   PORT_START
308   PORT_START_TAG("AN1")
309309   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0,224) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
310   PORT_START      /* Analog joystick 2 */
311   PORT_START
312   PORT_START      /* Analog joystick 3 */
313   PORT_START
310   PORT_START_TAG("AN2")   /* Analog joystick 2 */
311   PORT_START_TAG("AN3")
312   PORT_START_TAG("AN4")   /* Analog joystick 3 */
313   PORT_START_TAG("AN5")
314314INPUT_PORTS_END
315315
316316
317317static INPUT_PORTS_START( dangerz )      /* complete, verified from code */
318   PORT_START      /* 0x80 */
318   PORT_START_TAG("IN0")   /* 0x80 */
319319   PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
320320   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
321321   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
322322   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
323323
324   PORT_START      /* 0x81 */
324   PORT_START_TAG("IN1")   /* 0x81 */
325325   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
326326   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
327327   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
328328   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
329329   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
330330
331   PORT_START      /* 0x90 */
331   PORT_START_TAG("IN2")   /* 0x90 */
332332   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
333333
334   PORT_START      /* 0x91 */
334   PORT_START_TAG("IN3")   /* 0x91 */
335335   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
336336   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
337337   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
338338   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
339339   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
340340
341   PORT_START      /* Analog 1 */
341   PORT_START_TAG("AN0")   /* Analog 1 */
342342   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
343   PORT_START      /* Analog 2 */
343   PORT_START_TAG("AN1")   /* Analog 2 */
344344   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
345345INPUT_PORTS_END
346346
347347
348348static INPUT_PORTS_START( basebal2 )      /* complete, verified from code */
349   PORT_START      /* 0x40/C0 */
349   PORT_START_TAG("IN0")   /* 0x40/C0 */
350350   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
351351   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* read by strkzone, but never referenced */
352352   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Extra Base") PORT_PLAYER(1)
353353   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Go Back") PORT_PLAYER(1)
354354
355   PORT_START      /* 0x41/C1 */
355   PORT_START_TAG("IN1")   /* 0x41/C1 */
356356   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
357357   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
358358   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
359359   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
360360   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
361361
362   PORT_START      /* 0x50/D0 */
362   PORT_START_TAG("IN2")   /* 0x50/D0 */
363363   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
364364   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("R Run/Steal") PORT_PLAYER(1)
365365   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("L Run/Steal") PORT_PLAYER(1)
366366   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Run/Aim") PORT_PLAYER(1)
367367   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Run/Cutoff") PORT_PLAYER(1)
368368
369   PORT_START      /* 0x51/D1 */
369   PORT_START_TAG("IN3")   /* 0x51/D1 */
370370   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
371371   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
372372   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) PORT_PLAYER(1)
373373   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_PLAYER(1)
374374   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
375375
376   PORT_START      /* Analog joystick 1 */
376   PORT_START_TAG("AN0")   /* Analog joystick 1 */
377377   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
378   PORT_START
378   PORT_START_TAG("AN1")
379379   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
380   PORT_START      /* Analog joystick 2 */
381   PORT_START
382   PORT_START      /* Analog joystick 3 */
380   PORT_START_TAG("AN2")   /* Analog joystick 2 */
381   PORT_START_TAG("AN3")
382   PORT_START_TAG("AN4")   /* Analog joystick 3 */
383383   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
384   PORT_START
384   PORT_START_TAG("AN5")
385385   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
386386INPUT_PORTS_END
387387
388388
389389static INPUT_PORTS_START( redline )      /* complete, verified in code */
390   PORT_START      /* 0xC0 */
390   PORT_START_TAG("IN0")   /* 0xC0 */
391391   PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
392392   PORT_BIT( 0xe0, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(64) PORT_PLAYER(1)
393393
394   PORT_START      /* 0xC1 */
394   PORT_START_TAG("IN1")   /* 0xC1 */
395395   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
396396   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
397397   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r2864r2865
399399   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
400400   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* used, but for what purpose? */
401401
402   PORT_START      /* 0xD0 */
402   PORT_START_TAG("IN2")   /* 0xD0 */
403403   PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
404404   PORT_BIT( 0xe0, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(64) PORT_PLAYER(2)
405405
406   PORT_START      /* 0xD1 */
406   PORT_START_TAG("IN3")   /* 0xD1 */
407407   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
408408   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
409409   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
410410   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
411411   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
412412
413   PORT_START      /* Analog wheel 1 */
413   PORT_START_TAG("AN0")   /* Analog wheel 1 */
414414   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
415   PORT_START      /* Analog wheel 2 */
415   PORT_START_TAG("AN1")   /* Analog wheel 2 */
416416   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
417417INPUT_PORTS_END
418418
419419
420420static INPUT_PORTS_START( quarterb )      /* complete, verified in code */
421   PORT_START      /* 0x80 */
421   PORT_START_TAG("IN0")   /* 0x80 */
422422   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
423423   PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
424424   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
425425   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
426426
427   PORT_START      /* 0x81 */
427   PORT_START_TAG("IN1")   /* 0x81 */
428428   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
429429   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
430430   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
431431   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
432432   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
433433
434   PORT_START      /* 0x90 */
434   PORT_START_TAG("IN2")   /* 0x90 */
435435   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
436436   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
437437   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
r2864r2865
441441   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
442442   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
443443
444   PORT_START      /* 0x91 */
444   PORT_START_TAG("IN3")   /* 0x91 */
445445   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
446446   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
447447   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
448448   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
449449   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
450450
451   PORT_START      /* Analog spring stick 1 */
451   PORT_START_TAG("AN0")   /* Analog spring stick 1 */
452452   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
453   PORT_START      /* Analog spring stick 2 */
453   PORT_START_TAG("AN1")   /* Analog spring stick 2 */
454454   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
455   PORT_START      /* Analog spring stick 3 */
456   PORT_START      /* Analog spring stick 4 */
457   PORT_START      /* Analog spring stick 5 */
458   PORT_START      /* Analog spring stick 6 */
455   PORT_START_TAG("AN2")   /* Analog spring stick 3 */
456   PORT_START_TAG("AN3")   /* Analog spring stick 4 */
457   PORT_START_TAG("AN4")   /* Analog spring stick 5 */
458   PORT_START_TAG("AN5")   /* Analog spring stick 6 */
459459INPUT_PORTS_END
460460
461461
462462static INPUT_PORTS_START( teamqb )      /* complete, verified in code */
463   PORT_START      /* 0x80 */
463   PORT_START_TAG("IN0")   /* 0x80 */
464464   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
465465   PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
466466   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
467467   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
468468
469   PORT_START      /* 0x81 */
469   PORT_START_TAG("IN1")   /* 0x81 */
470470   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
471471   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
472472   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
473473   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
474474   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
475475
476   PORT_START      /* 0x90 */
476   PORT_START_TAG("IN2")   /* 0x90 */
477477   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
478478   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
479479   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
r2864r2865
483483   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
484484   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
485485
486   PORT_START      /* 0x91 */
486   PORT_START_TAG("IN3")   /* 0x91 */
487487   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
488488   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
489489   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
490490   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
491491   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
492492
493   PORT_START      /* Analog spring stick 1 */
493   PORT_START_TAG("AN0")   /* Analog spring stick 1 */
494494   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
495   PORT_START      /* Analog spring stick 2 */
495   PORT_START_TAG("AN1")   /* Analog spring stick 2 */
496496   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
497   PORT_START      /* Analog spring stick 3 */
498   PORT_START      /* Analog spring stick 4 */
499   PORT_START      /* Analog spring stick 5 */
497   PORT_START_TAG("AN2")   /* Analog spring stick 3 */
498   PORT_START_TAG("AN3")   /* Analog spring stick 4 */
499   PORT_START_TAG("AN4")   /* Analog spring stick 5 */
500500   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(3)
501   PORT_START      /* Analog spring stick 6 */
501   PORT_START_TAG("AN5")   /* Analog spring stick 6 */
502502   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(3)
503503
504   PORT_START      /* 0x7C */
504   PORT_START_TAG("IN4")   /* 0x7C */
505505   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
506506   PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
507507   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
r2864r2865
509509   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 )
510510   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
511511
512   PORT_START      /* 0x7F */
512   PORT_START_TAG("IN5")   /* 0x7F */
513513   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
514514   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
515515   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)
r2864r2865
522522
523523
524524static INPUT_PORTS_START( aafb2p )      /* complete, verified in code */
525   PORT_START      /* 0x80 */
525   PORT_START_TAG("IN0")   /* 0x80 */
526526   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
527527   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
528528   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
529529
530   PORT_START      /* 0x81 */
530   PORT_START_TAG("IN1")   /* 0x81 */
531531   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
532532   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
533533   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
534534   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
535535   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
536536
537   PORT_START      /* 0x90 */
537   PORT_START_TAG("IN2")   /* 0x90 */
538538   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
539539   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
540540   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
541541   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
542542   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
543543
544   PORT_START      /* 0x91 */
544   PORT_START_TAG("IN3")   /* 0x91 */
545545   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
546546   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
547547   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
548548   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
549549   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
550550
551   PORT_START      /* Analog spring stick 1 */
551   PORT_START_TAG("AN0")   /* Analog spring stick 1 */
552552   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
553   PORT_START      /* Analog spring stick 2 */
553   PORT_START_TAG("AN1")   /* Analog spring stick 2 */
554554   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
555   PORT_START      /* Analog spring stick 3 */
556   PORT_START      /* Analog spring stick 4 */
557   PORT_START      /* Analog spring stick 5 */
555   PORT_START_TAG("AN2")   /* Analog spring stick 3 */
556   PORT_START_TAG("AN3")   /* Analog spring stick 4 */
557   PORT_START_TAG("AN4")   /* Analog spring stick 5 */
558558   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
559   PORT_START      /* Analog spring stick 6 */
559   PORT_START_TAG("AN5")   /* Analog spring stick 6 */
560560   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
561561
562   PORT_START      /* 0x7C */
562   PORT_START_TAG("IN4")   /* 0x7C */
563563   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
564564   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
565565   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
566566   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
567567   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
568568
569   PORT_START      /* 0x7F */
569   PORT_START_TAG("IN5")   /* 0x7F */
570570   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
571571   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
572572   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
r2864r2865
576576
577577
578578static INPUT_PORTS_START( offroad )      /* complete, verified from code */
579   PORT_START      /* 0xC0 */
579   PORT_START_TAG("IN0")   /* 0xC0 */
580580   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* read */
581581   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* read */
582582   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* read */
r2864r2865
586586   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
587587   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
588588
589   PORT_START      /* 0xC1 */
589   PORT_START_TAG("IN1")   /* 0xC1 */
590590   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
591591   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN3 )
592592   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
593593   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
594594   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
595595
596   PORT_START      /* 0xD0 */
596   PORT_START_TAG("IN2")   /* 0xD0 */
597597   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
598598
599   PORT_START      /* 0xD1 */
599   PORT_START_TAG("IN3")   /* 0xD1 */
600600   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
601601   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
602602   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
603603   PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )
604604   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
605605
606   PORT_START      /* Analog pedal 1 */
606   PORT_START_TAG("AN0")   /* Analog pedal 1 */
607607   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
608   PORT_START      /* Analog pedal 2 */
608   PORT_START_TAG("AN1")   /* Analog pedal 2 */
609609   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
610   PORT_START      /* Analog pedal 3 */
610   PORT_START_TAG("AN2")   /* Analog pedal 3 */
611611   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(3)
612   PORT_START      /* Analog wheel 1 */
612   PORT_START_TAG("AN3")   /* Analog wheel 1 */
613613   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
614   PORT_START      /* Analog wheel 2 */
614   PORT_START_TAG("AN4")   /* Analog wheel 2 */
615615   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
616   PORT_START      /* Analog wheel 3 */
616   PORT_START_TAG("AN5")   /* Analog wheel 3 */
617617   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(3)
618618INPUT_PORTS_END
619619
620620
621621static INPUT_PORTS_START( pigout )      /* complete, verified from code */
622   PORT_START      /* 0x40 */
622   PORT_START_TAG("IN0")   /* 0x40 */
623623   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
624624   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
625625   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
r2864r2865
629629   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
630630   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
631631
632   PORT_START      /* 0x41 */
632   PORT_START_TAG("IN1")   /* 0x41 */
633633   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SLAVEHALT )
634634   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
635635   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* read, but never referenced */
636636   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
637637   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
638638
639   PORT_START      /* 0x50 */
639   PORT_START_TAG("IN2")   /* 0x50 */
640640   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START3 )
641641   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
642642   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
r2864r2865
646646   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
647647   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
648648
649   PORT_START      /* 0x51 */
649   PORT_START_TAG("IN3")   /* 0x51 */
650650   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_eeprom_DATA )
651651   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
652652   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
653653   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
654654
655   PORT_START      /* 0x7F */
655   PORT_START_TAG("IN4")   /* 0x7F */
656656   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
657657   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
658658   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
src/mame/drivers/lazercmd.c
r2864r2865
286286static READ8_HANDLER( lazercmd_data_port_r )
287287{
288288   int data;
289   data = input_port_read_indexed(machine, 2) & 0x0f;
289   data = input_port_read(machine, "DSW") & 0x0f;
290290   return data;
291291}
292292
r2864r2865
381381   switch (offset)
382382   {
383383      case 0:             /* player 1 joysticks */
384         data = input_port_read_indexed(machine, 0);
384         data = input_port_read(machine, "IN0");
385385         break;
386386      case 1:             /* player 2 joysticks */
387         data = input_port_read_indexed(machine, 1);
387         data = input_port_read(machine, "IN1");
388388         break;
389389      case 2:             /* player 1 + 2 buttons */
390         data = input_port_read_indexed(machine, 4);
390         data = input_port_read(machine, "IN3");
391391         break;
392392      case 3:             /* coin slot + start buttons */
393         data = input_port_read_indexed(machine, 3);
393         data = input_port_read(machine, "IN2");
394394         break;
395395      case 4:             /* vertical scan counter */
396396         data = ((timer_count&0x10)>>1)|((timer_count&0x20)>>3)|((timer_count&0x40)>>5)|((timer_count&0x80)>>7);
r2864r2865
451451
452452
453453static INPUT_PORTS_START( lazercmd )
454   PORT_START                  /* IN0 player 1 controls */
454   PORT_START_TAG("IN0")      /* IN0 player 1 controls */
455455   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
456456   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
457457   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
458458   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
459459   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
460460
461   PORT_START                  /* IN1 player 2 controls */
461   PORT_START_TAG("IN1")      /* IN1 player 2 controls */
462462   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
463463   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
464464   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
465465   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
466466   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
467467
468   PORT_START                  /* IN2 dip switch */
468   PORT_START_TAG("DSW")      /* IN2 dip switch */
469469   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Game_Time ) )
470470   PORT_DIPSETTING(   0x00, "60 seconds" )
471471   PORT_DIPSETTING(   0x01, "90 seconds" )
r2864r2865
482482//  PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
483483//  PORT_DIPSETTING(    0x80, DEF_STR( On ) )
484484
485   PORT_START                  /* IN3 coinage & start */
485   PORT_START_TAG("IN2")      /* IN3 coinage & start */
486486   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
487487   PORT_DIPSETTING(   0x00, DEF_STR( 2C_1C ) )
488488   PORT_DIPSETTING(   0x01, DEF_STR( 1C_1C ) )
r2864r2865
491491   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
492492   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
493493
494   PORT_START                  /* IN4 player 1 + 2 buttons */
494   PORT_START_TAG("IN3")      /* IN4 player 1 + 2 buttons */
495495   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
496496   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
497497   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
r2864r2865
500500INPUT_PORTS_END
501501
502502static INPUT_PORTS_START( medlanes )
503   PORT_START                  /* IN0 player 1 controls */
503   PORT_START_TAG("IN0")      /* IN0 player 1 controls */
504504   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
505505   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
506506   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
507507   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
508508   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
509509
510   PORT_START                  /* IN1 player 1 controls */
510   PORT_START_TAG("IN1")      /* IN1 player 1 controls */
511511   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hook Left") PORT_CODE(KEYCODE_Z)
512512   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hook Right") PORT_CODE(KEYCODE_X)
513513   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
514514
515   PORT_START                  /* IN2 dip switch */
515   PORT_START_TAG("DSW")      /* IN2 dip switch */
516516   PORT_DIPNAME( 0x01, 0x01, "Game Timer" )
517517   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
518518   PORT_DIPSETTING(   0x01, DEF_STR( On ) )
r2864r2865
530530//  PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
531531//  PORT_DIPSETTING(    0x80, DEF_STR( On ) )
532532
533   PORT_START                  /* IN3 coinage & start */
533   PORT_START_TAG("IN2")      /* IN3 coinage & start */
534534   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
535535   PORT_DIPSETTING(   0x00, DEF_STR( 2C_1C ) )
536536   PORT_DIPSETTING(   0x01, DEF_STR( 1C_1C ) )
r2864r2865
538538   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
539539   PORT_BIT( 0xf4, IP_ACTIVE_HIGH, IPT_UNUSED )
540540
541   PORT_START                  /* IN4 not used */
541   PORT_START_TAG("IN3")      /* IN4 not used */
542542   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
543543INPUT_PORTS_END
544544
545545static INPUT_PORTS_START( bbonk )
546   PORT_START                  /* IN0 player 1 controls */
546   PORT_START_TAG("IN0")      /* IN0 player 1 controls */
547547   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
548548   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
549549   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
550550   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
551551   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
552552
553   PORT_START                  /* IN1 player 2 controls */
553   PORT_START_TAG("IN1")      /* IN1 player 2 controls */
554554   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
555555   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
556556   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
557557   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
558558   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
559559
560   PORT_START                  /* IN2 dip switch */
560   PORT_START_TAG("DSW")      /* IN2 dip switch */
561561   PORT_DIPNAME( 0x03, 0x02, "Games to win" )
562562   PORT_DIPSETTING(   0x02, "2" )
563563   PORT_DIPSETTING(   0x03, "3" )
r2864r2865
572572//  PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
573573//  PORT_DIPSETTING(    0x80, DEF_STR( On ) )
574574
575   PORT_START                  /* IN3 coinage & start */
575   PORT_START_TAG("IN2")      /* IN3 coinage & start */
576576   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
577577   PORT_DIPSETTING(   0x00, DEF_STR( 2C_1C ) )
578578   PORT_DIPSETTING(   0x01, DEF_STR( 1C_1C ) )
r2864r2865
580580   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
581581   PORT_BIT( 0xf4, IP_ACTIVE_HIGH, IPT_UNUSED )
582582
583   PORT_START                  /* IN4 not used */
583   PORT_START_TAG("IN3")      /* IN4 not used */
584584   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
585585INPUT_PORTS_END
586586
src/mame/drivers/lordgun.c
r2864r2865
110110
111111static READ8_HANDLER( lordgun_eeprom_r )
112112{
113   return input_port_read_indexed(machine, 0) | ((eeprom_read_bit() & 1) << 7);
113   return input_port_read(machine, "IN0") | ((eeprom_read_bit() & 1) << 7);
114114}
115115
116116static WRITE8_HANDLER( lordgun_eeprom_w )
r2864r2865
328328***************************************************************************/
329329
330330static INPUT_PORTS_START( lordgun )
331   PORT_START   // IN0
331   PORT_START_TAG("IN0")
332332   PORT_DIPNAME( 0x01, 0x01, "Game Mode" )
333333   PORT_DIPSETTING(    0x01, "Arcade" )
334334   PORT_DIPSETTING(    0x00, "Street" )
r2864r2865
346346   PORT_SERVICE_NO_TOGGLE( 0x40, IP_ACTIVE_LOW )
347347   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   // eeprom
348348
349   PORT_START   // IN1
349   PORT_START_TAG("IN1")
350350   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1   )
351351   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN  )
352352   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN  )
r2864r2865
355355   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN  )
356356   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE2 ) // cheat: skip ahead
357357
358   PORT_START   // IN2
358   PORT_START_TAG("IN2")
359359   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2  )
360360   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
361361   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
365365   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
366366   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
367367
368   PORT_START   // IN3
368   PORT_START_TAG("IN3")
369369   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN  )
370370   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN  )
371371   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN  )
r2864r2865
375375   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN  )
376376   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN  )
377377
378   PORT_START   //IN 4
378   PORT_START_TAG("IN4")
379379   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1   ) PORT_IMPULSE(5)
380380   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2   ) PORT_IMPULSE(5)
381381   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
385385   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
386386   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
387387
388   PORT_START   // IN5
388   PORT_START_TAG("LIGHT0_X")
389389   PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0,0x1ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(10) PORT_PLAYER(1)
390390
391   PORT_START   // IN6
391   PORT_START_TAG("LIGHT1_X")
392392   PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0,0x1ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(10) PORT_PLAYER(2)
393393
394   PORT_START   // IN7
394   PORT_START_TAG("LIGHT0_Y")
395395   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(10) PORT_PLAYER(1)
396396
397   PORT_START   // IN8
397   PORT_START_TAG("LIGHT1_Y")
398398   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(10) PORT_PLAYER(2)
399399INPUT_PORTS_END
400400
src/mame/drivers/lemmings.c
r2864r2865
3232static READ16_HANDLER( lemmings_trackball_r )
3333{
3434   switch (offset) {
35   case 0: return input_port_read_indexed(machine, 4); break;
36   case 1: return input_port_read_indexed(machine, 5); break;
37   case 4: return input_port_read_indexed(machine, 6); break;
38   case 5: return input_port_read_indexed(machine, 7); break;
35   case 0: return input_port_read(machine, "AN0"); break;
36   case 1: return input_port_read(machine, "AN1"); break;
37   case 4: return input_port_read(machine, "AN2"); break;
38   case 5: return input_port_read(machine, "AN3"); break;
3939   }
4040   return 0;
4141}
r2864r2865
4545{
4646    switch (offset<<1) {
4747      case 0x41a: /* Player input */
48         return input_port_read_indexed(machine, 0);
48         return input_port_read(machine, "IN0");
4949
5050      case 0x320: /* Coins */
51         return input_port_read_indexed(machine, 1);
51         return input_port_read(machine, "IN1");
5252
5353      case 0x4e6: /* Dips */
54         return (input_port_read_indexed(machine, 2) + (input_port_read_indexed(machine, 3) << 8));
54         return (input_port_read(machine, "DSW1") + (input_port_read(machine, "DSW2") << 8));
5555   }
5656
5757   return 0;
src/mame/drivers/pushman.c
r2864r2865
1515    The hardware is actually very similar to F1-Dream and Tiger Road but
1616    with a 68705 for protection.
1717
18    There is a Top Tronic licensed version currently not dumped
19
1820 **************************************************************************
1921
2022    Bouncing Balls                      (c) 1991 Comad
src/mame/drivers/hnayayoi.c
r2864r2865
5454{
5555   int res = 0x3f;
5656   int i;
57   static const char *keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
5758
5859   for (i = 0;i < 5;i++)
59      if (~keyb & (1 << i)) res &= input_port_read_indexed(machine, 4+i);
60      if (~keyb & (1 << i)) res &= input_port_read(machine, keynames[i]);
6061
6162   return res;
6263}
r2864r2865
118119   ADDRESS_MAP_GLOBAL_MASK(0xff)
119120   AM_RANGE(0x02, 0x02) AM_READ(YM2203_status_port_0_r)
120121   AM_RANGE(0x03, 0x03) AM_READ(YM2203_read_port_0_r)
121   AM_RANGE(0x04, 0x04) AM_READ(input_port_2_r)
122   AM_RANGE(0x04, 0x04) AM_READ_PORT("DSW3")
122123   AM_RANGE(0x41, 0x41) AM_READ(keyboard_0_r)
123124   AM_RANGE(0x42, 0x42) AM_READ(keyboard_1_r)
124   AM_RANGE(0x43, 0x43) AM_READ(input_port_3_r)
125   AM_RANGE(0x43, 0x43) AM_READ_PORT("COIN")
125126ADDRESS_MAP_END
126127
127128static ADDRESS_MAP_START( hnayayoi_writeport, ADDRESS_SPACE_IO, 8 )
r2864r2865
147148   AM_RANGE(0x8000, 0xfeff) AM_READ(SMH_ROM)
148149   AM_RANGE(0xff02, 0xff02) AM_READ(YM2203_status_port_0_r)
149150   AM_RANGE(0xff03, 0xff03) AM_READ(YM2203_read_port_0_r)
150   AM_RANGE(0xff04, 0xff04) AM_READ(input_port_2_r)
151   AM_RANGE(0xff04, 0xff04) AM_READ_PORT("DSW3")
151152   AM_RANGE(0xff41, 0xff41) AM_READ(keyboard_0_r)
152153   AM_RANGE(0xff42, 0xff42) AM_READ(keyboard_1_r)
153   AM_RANGE(0xff43, 0xff43) AM_READ(input_port_3_r)
154   AM_RANGE(0xff43, 0xff43) AM_READ_PORT("COIN")
154155ADDRESS_MAP_END
155156
156157static ADDRESS_MAP_START( hnfubuki_writemem, ADDRESS_SPACE_PROGRAM, 8 )
r2864r2865
200201   AM_RANGE(0x51, 0x51) AM_READ(YM2203_read_port_0_r)
201202   AM_RANGE(0x16, 0x16) AM_READ(keyboard_0_r)   // bit 7 = blitter busy flag
202203   AM_RANGE(0x15, 0x15) AM_READ(keyboard_1_r)
203   AM_RANGE(0x14, 0x14) AM_READ(input_port_3_r)
204   AM_RANGE(0x14, 0x14) AM_READ_PORT("COIN")
204205ADDRESS_MAP_END
205206
206207static ADDRESS_MAP_START( untoucha_writeport, ADDRESS_SPACE_IO, 8 )
r2864r2865
220221ADDRESS_MAP_END
221222
222223
224static INPUT_PORTS_START( mj_keyboard )
225   PORT_START_TAG("KEY0")
226   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
227   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
228   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
229   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
230   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
231   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
232   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
223233
234   PORT_START_TAG("KEY1")
235   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
236   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
237   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
238   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
239   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
240   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
241   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
242
243   PORT_START_TAG("KEY2")
244   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
245   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
246   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
247   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
248   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
249   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
250
251   PORT_START_TAG("KEY3")
252   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
253   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
254   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
255   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
256   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
257
258   PORT_START_TAG("KEY4")
259   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
260   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
261   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
262   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
263   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
264   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
265   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
266INPUT_PORTS_END
267
268
224269static INPUT_PORTS_START( hnayayoi )
225   PORT_START   /* DSW1 */
270   PORT_START_TAG("DSW1")   /* DSW1 */
226271   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
227272   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
228273   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
248293   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
249294   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
250295
251   PORT_START   /* DSW2 */
296   PORT_START_TAG("DSW2")   /* DSW2 */
252297   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
253298   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
254299   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
274319   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
275320   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
276321
277   PORT_START   /* DSW3 */
322   PORT_START_TAG("DSW3")   /* DSW3 */
278323   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   // blitter busy flag
279324   PORT_SERVICE( 0x02, IP_ACTIVE_LOW )
280325   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
r2864r2865
296341   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
297342   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
298343
299   PORT_START   /* COIN */
344   PORT_START_TAG("COIN")   /* COIN */
300345   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
301346   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
302   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
347   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
303348   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2 )   /* Analizer (Statistics) */
304349   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
305350   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )   /* "Note" ("Paper Money") = 10 Credits */
306351   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
307352   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
308353
309   PORT_START   /* P1 keyboard */
310   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
311   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
312   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
313   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
314   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
315   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
316   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
317
318   PORT_START
319   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
320   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
321   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
322   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
323   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
324   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
325   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
326
327   PORT_START
328   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
329   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
330   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
331   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
332   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
333   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
334
335   PORT_START
336   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
337   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
338   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
339   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
340   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
341
342   PORT_START
343   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
344   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
345   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
346   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
347   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
348   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
349   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
354   PORT_INCLUDE( mj_keyboard )
350355INPUT_PORTS_END
351356
352
353357static INPUT_PORTS_START( hnfubuki )
354   PORT_START   /* DSW1 */
358   PORT_START_TAG("DSW1")   /* DSW1 */
355359   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
356360   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
357361   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
377381   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
378382   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
379383
380   PORT_START   /* DSW2 */
384   PORT_START_TAG("DSW2")   /* DSW2 */
381385   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
382386   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
383387   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
403407   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
404408   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
405409
406   PORT_START   /* DSW3 */
410   PORT_START_TAG("DSW3")   /* DSW3 */
407411   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   // blitter busy flag
408412   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
409413   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
r2864r2865
427431   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
428432   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
429433
430   PORT_START   /* COIN */
434   PORT_START_TAG("COIN")   /* COIN */
431435   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
432436   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
433   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
437   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
434438   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2 )   /* Analizer (Statistics) */
435439   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
436440   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )   /* "Note" ("Paper Money") = 10 Credits */
437441   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
438442   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
439443
440   PORT_START   /* P1 keyboard */
441   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
442   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
443   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
444   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
445   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
446   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
447   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
448
449   PORT_START
450   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
451   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
452   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
453   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
454   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
455   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
456   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
457
458   PORT_START
459   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
460   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
461   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
462   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
463   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
464   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
465
466   PORT_START
467   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
468   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
469   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
470   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
471   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
472
473   PORT_START
474   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
475   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
476   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
477   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
478   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
479   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
480   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
444   PORT_INCLUDE( mj_keyboard )
481445INPUT_PORTS_END
482446
483447
484448static INPUT_PORTS_START( untoucha )
485   PORT_START   /* DSW1 */
449   PORT_START_TAG("DSW1")   /* DSW1 */
486450   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
487451   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
488452   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
508472   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
509473   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
510474
511   PORT_START   /* DSW2 */
475   PORT_START_TAG("DSW2")   /* DSW2 */
512476   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
513477   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
514478   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
534498   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
535499   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
536500
537   PORT_START   /* not used */
538   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
539
540   PORT_START   /* COIN */
501   PORT_START_TAG("COIN")   /* COIN */
541502   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
542503   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
543   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
504   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
544505   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2 )   /* Analizer (Statistics) */
545506   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
546507   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )   /* "Note" ("Paper Money") = 10 Credits */
547508   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
548509   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
549510
550   PORT_START   /* P1 keyboard */
551   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Hold 1") PORT_CODE(KEYCODE_Z)
552   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Hold 3") PORT_CODE(KEYCODE_C)
553   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Hold 5") PORT_CODE(KEYCODE_B)
511   PORT_START_TAG("KEY0")   /* P1 keyboard */
512   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Hold 1") PORT_CODE(KEYCODE_Z)
513   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Hold 3") PORT_CODE(KEYCODE_C)
514   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Hold 5") PORT_CODE(KEYCODE_B)
554515   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
555516   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
556517   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
557518   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
558519
559   PORT_START
520   PORT_START_TAG("KEY1")
560521   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
561522   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
562523   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
563   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet") PORT_CODE(KEYCODE_3)
524   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet") PORT_CODE(KEYCODE_3)
564525   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
565   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Take Score") PORT_CODE(KEYCODE_RCONTROL)
526   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Take Score") PORT_CODE(KEYCODE_RCONTROL)
566527   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
567528
568   PORT_START
569   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Hold 2") PORT_CODE(KEYCODE_X)
570   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Hold 4") PORT_CODE(KEYCODE_V)
529   PORT_START_TAG("KEY2")
530   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Hold 2") PORT_CODE(KEYCODE_X)
531   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Hold 4") PORT_CODE(KEYCODE_V)
571532   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
572533   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
573   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Cancel") PORT_CODE(KEYCODE_N)
534   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Cancel") PORT_CODE(KEYCODE_N)
574535   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
575536   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
576537
577   PORT_START
538   PORT_START_TAG("KEY3")
578539   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
579540   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
580   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Deal") PORT_CODE(KEYCODE_1)
541   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Deal") PORT_CODE(KEYCODE_1)
581542   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
582543   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
583544   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
584545   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
585546
586   PORT_START
547   PORT_START_TAG("KEY4")
587548   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
588   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Double Up") PORT_CODE(KEYCODE_RSHIFT)
549   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Double Up") PORT_CODE(KEYCODE_RSHIFT)
589550   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
590   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Flip Flop") PORT_CODE(KEYCODE_F)
551   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Flip Flop") PORT_CODE(KEYCODE_F)
591552   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
592553   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
593554   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
src/mame/drivers/system18.c
r2864r2865
7070#include "sound/2612intf.h"
7171#include "sound/rf5c68.h"
7272
73void fd1094_machine_init(void);
74void fd1094_driver_init(void (*set_decrypted)(UINT8 *));
75
7673/* video/segac2.c */
7774extern void update_system18_vdp( bitmap_t *bitmap, const rectangle *cliprect );
7875extern READ16_HANDLER( segac2_vdp_r );
src/mame/drivers/missb2.c
r2864r2865
1414*/
1515
1616#include "driver.h"
17#include "deprecat.h"
1817#include "sound/okim6295.h"
1918#include "sound/3812intf.h"
2019#include "includes/bublbobl.h"
r2864r2865
117116   return 0;
118117}
119118
120INLINE void bg_changecolor_RRRRGGGGBBBBxxxx(pen_t color,int data)
119INLINE void bg_changecolor_RRRRGGGGBBBBxxxx(running_machine *machine,pen_t color,int data)
121120{
122   palette_set_color_rgb(Machine,color+256,pal4bit(data >> 12),pal4bit(data >> 8),pal4bit(data >> 4));
121   palette_set_color_rgb(machine,color+256,pal4bit(data >> 12),pal4bit(data >> 8),pal4bit(data >> 4));
123122}
124123
125124static WRITE8_HANDLER( bg_paletteram_RRRRGGGGBBBBxxxx_be_w )
126125{
127126   bg_paletteram[offset] = data;
128   bg_changecolor_RRRRGGGGBBBBxxxx(offset / 2,bg_paletteram[offset | 1] | (bg_paletteram[offset & ~1] << 8));
127   bg_changecolor_RRRRGGGGBBBBxxxx(machine, offset / 2,bg_paletteram[offset | 1] | (bg_paletteram[offset & ~1] << 8));
129128}
130129
131130static WRITE8_HANDLER( missb2_bg_bank_w )
src/mame/drivers/liberatr.c
r2864r2865
177177   /* input becomes the starting point for the trackball counters */
178178   if (((data ^ ctrld) & 0x10) && (data & 0x10))
179179   {
180      UINT8 trackball = input_port_read_indexed(machine, 4);
181      UINT8 switches = input_port_read_indexed(machine, 0);
180      UINT8 trackball = input_port_read(machine, "FAKE");
181      UINT8 switches = input_port_read(machine, "IN0");
182182      trackball_offset = ((trackball & 0xf0) - (switches & 0xf0)) | ((trackball - switches) & 0x0f);
183183   }
184184   ctrld = data & 0x10;
r2864r2865
190190   /* if ctrld is high, the /ld signal on the LS191 is NOT set, meaning that the trackball is counting */
191191   if (ctrld)
192192   {
193      UINT8 trackball = input_port_read_indexed(machine, 4);
193      UINT8 trackball = input_port_read(machine, "FAKE");
194194      return ((trackball & 0xf0) - (trackball_offset & 0xf0)) | ((trackball - trackball_offset) & 0x0f);
195195   }
196196
197197   /* otherwise, the LS191 is simply passing through the raw switch inputs */
198198   else
199      return input_port_read_indexed(machine, 0);
199      return input_port_read(machine, "IN0");
200200}
201201
202202
r2864r2865
246246   AM_RANGE(0x0002, 0x0002) AM_READWRITE(liberatr_bitmap_xy_r, liberatr_bitmap_xy_w)
247247   AM_RANGE(0x0000, 0x3fff) AM_RAM_WRITE(liberatr_bitmap_w) AM_BASE(&liberatr_bitmapram)    /* overlapping for my convenience */
248248   AM_RANGE(0x4000, 0x4000) AM_READ(liberatr_input_port_0_r)
249   AM_RANGE(0x4001, 0x4001) AM_READ(input_port_1_r)
249   AM_RANGE(0x4001, 0x4001) AM_READ_PORT("IN1")
250250   AM_RANGE(0x4000, 0x400f) AM_WRITE(SMH_RAM) AM_BASE(&liberatr_base_ram)
251251   AM_RANGE(0x4200, 0x421f) AM_WRITE(SMH_RAM) AM_BASE(&liberatr_colorram)
252252   AM_RANGE(0x4400, 0x4400) AM_WRITENOP
r2864r2865
275275 *************************************/
276276
277277static INPUT_PORTS_START( liberatr )
278   PORT_START         /* IN0 - $5000 */
278   PORT_START_TAG("IN0")         /* IN0 - $5000 */
279279   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
280280   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
281281   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r2864r2865
287287   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
288288   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
289289
290   PORT_START         /* IN1 - $5001 */
290   PORT_START_TAG("IN1")         /* IN1 - $5001 */
291291   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
292292   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
293293   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )
r2864r2865
297297   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
298298   PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_VBLANK )
299299
300   PORT_START         /* IN2  -  Game Option switches DSW @ D4 on PCB */
300   PORT_START_TAG("DSW1")         /* IN2  -  Game Option switches DSW @ D4 on PCB */
301301   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
302302   PORT_DIPSETTING(    0x00, "4" )
303303   PORT_DIPSETTING(    0x01, "5" )
r2864r2865
320320   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
321321   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
322322
323   PORT_START         /* IN3  -  Pricing Option switches DSW @ A4 on PCB */
323   PORT_START_TAG("DSW2")         /* IN3  -  Pricing Option switches DSW @ A4 on PCB */
324324   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage ) )
325325   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
326326   PORT_DIPSETTING(    0x02, DEF_STR( 1C_1C ) )
r2864r2865
345345   PORT_DIPSETTING (   0xc0, "Freeze Mode" )
346346   PORT_DIPSETTING (   0xe0, "Freeze Mode" )
347347
348   PORT_START   /* IN4 - FAKE - overlaps IN0 in the HW */
348   PORT_START_TAG("FAKE")         /* IN4 - FAKE - overlaps IN0 in the HW */
349349   PORT_BIT( 0x0f, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(10)
350350   PORT_BIT( 0xf0, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(10)
351351INPUT_PORTS_END
src/mame/drivers/namcos21.c
r2864r2865
509509static UINT16 *master_dsp_code;
510510
511511void
512namcos21_kickstart( int internal )
512namcos21_kickstart( running_machine *machine, int internal )
513513{
514514   /* patch dsp watchdog */
515515   switch( namcos2_gametype )
r2864r2865
535535   mpDspState->slaveOutputSize = 0;
536536   mpDspState->masterFinished = 0;
537537   mpDspState->slaveActive = 0;
538   cpunum_set_input_line(Machine, 4, 0, HOLD_LINE); /* DSP: master */
539   cpunum_set_input_line(Machine, 5, INPUT_LINE_RESET, PULSE_LINE); /* DSP: slave */
538   cpunum_set_input_line(machine, 4, 0, HOLD_LINE); /* DSP: master */
539   cpunum_set_input_line(machine, 5, INPUT_LINE_RESET, PULSE_LINE); /* DSP: slave */
540540}
541541
542542static UINT16
r2864r2865
558558} /* ReadWordFromSlaveInput */
559559
560560static size_t
561GetInputBytesAdvertisedForSlave( void )
561GetInputBytesAdvertisedForSlave( running_machine *machine )
562562{
563563   if( mpDspState->slaveBytesAdvertised < mpDspState->slaveBytesAvailable )
564564   {
r2864r2865
566566   }
567567   else if( mpDspState->slaveActive && mpDspState->masterFinished && mpDspState->masterSourceAddr )
568568   {
569      namcos21_kickstart(0);
569      namcos21_kickstart(machine, 0);
570570   }
571571   return mpDspState->slaveBytesAdvertised;
572572} /* GetInputBytesAdvertisedForSlave */
r2864r2865
880880
881881static READ16_HANDLER(slave_port2_r)
882882{
883   return GetInputBytesAdvertisedForSlave();
883   return GetInputBytesAdvertisedForSlave(machine);
884884} /* slave_port2_r */
885885
886886static READ16_HANDLER(slave_port3_r)
src/mame/drivers/gameplan.c
r2864r2865
9595
9696static READ8_HANDLER( io_port_r )
9797{
98   static const char *portnames[] = { "IN0", "IN1", "IN2", "IN3", "DSW0", "DSW1" };
9899   gameplan_state *state = machine->driver_data;
99100
100   return input_port_read_indexed(machine, state->current_port);
101   return input_port_read(machine, portnames[state->current_port]);
101102}
102103
103104
r2864r2865
279280 *************************************/
280281
281282static INPUT_PORTS_START( killcom )
282   PORT_START      /* COL. A - from "TEST NO.7 - status locator - coin-door" */
283   PORT_START_TAG("IN0")   /* COL. A - from "TEST NO.7 - status locator - coin-door" */
283284   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
284285   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
285286   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
r2864r2865
289290   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
290291   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
291292
292   PORT_START      /* COL. B - from "TEST NO.7 - status locator - start sws." */
293   PORT_START_TAG("IN1")   /* COL. B - from "TEST NO.7 - status locator - start sws." */
293294   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
294295   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
295296   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
299300   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
300301   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
301302
302   PORT_START      /* COL. C - from "TEST NO.8 - status locator - player no.1" */
303   PORT_START_TAG("IN2")   /* COL. C - from "TEST NO.8 - status locator - player no.1" */
303304   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 )
304305   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
305306   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
r2864r2865
309310   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
310311   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
311312
312   PORT_START      /* COL. D - from "TEST NO.8 - status locator - player no.2" */
313   PORT_START_TAG("IN3")   /* COL. D - from "TEST NO.8 - status locator - player no.2" */
313314   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
314315   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
315316   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
r2864r2865
319320   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
320321   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL
321322
322   PORT_START      /* DSW A - from "TEST NO.6 - dip switch A" */
323   PORT_START_TAG("DSW0")   /* DSW A - from "TEST NO.6 - dip switch A" */
323324   PORT_DIPNAME( 0x03, 0x03, "Coinage P1/P2" )
324325   PORT_DIPSETTING(    0x03, "1 Credit/2 Credits" )
325326   PORT_DIPSETTING(    0x02, "2 Credits/3 Credits" )
r2864r2865
343344   PORT_DIPSETTING(    0x40, "Fast" )
344345   PORT_DIPSETTING(    0x00, "Fastest" )
345346
346   PORT_START      /* DSW B - from "TEST NO.6 - dip switch B" */
347   PORT_START_TAG("DSW1")   /* DSW B - from "TEST NO.6 - dip switch B" */
347348   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
348349   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
349350   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
369370   PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
370371   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
371372
372   PORT_START      /* audio board DSW A */
373   PORT_START_TAG("DSW2")   /* audio board DSW A */
373374   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
374375   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
375376   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
395396   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
396397   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
397398
398   PORT_START      /* audio board DSW B */
399   PORT_START_TAG("DSW3")   /* audio board DSW B */
399400   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
400401   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
401402   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
424425
425426
426427static INPUT_PORTS_START( megatack )
427   PORT_START      /* COL. A - from "TEST NO.7 - status locator - coin-door" */
428   PORT_START_TAG("IN0")   /* COL. A - from "TEST NO.7 - status locator - coin-door" */
428429   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
429430   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
430431   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
r2864r2865
434435   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
435436   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
436437
437   PORT_START      /* COL. B - from "TEST NO.7 - status locator - start sws." */
438   PORT_START_TAG("IN1")   /* COL. B - from "TEST NO.7 - status locator - start sws." */
438439   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
439440   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
440441   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
444445   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
445446   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
446447
447   PORT_START      /* COL. C - from "TEST NO.8 - status locator - player no.1" */
448   PORT_START_TAG("IN2")   /* COL. C - from "TEST NO.8 - status locator - player no.1" */
448449   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
449450   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
450451   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
454455   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
455456   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
456457
457   PORT_START      /* COL. D - from "TEST NO.8 - status locator - player no.2" */
458   PORT_START_TAG("IN3")   /* COL. D - from "TEST NO.8 - status locator - player no.2" */
458459   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
459460   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
460461   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
464465   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
465466   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
466467
467   PORT_START      /* DSW A - from "TEST NO.6 - dip switch A" */
468   PORT_START_TAG("DSW0")   /* DSW A - from "TEST NO.6 - dip switch A" */
468469   PORT_DIPNAME( 0x03, 0x03, "Coinage P1/P2" )
469470   PORT_DIPSETTING(    0x03, "1 Credit/2 Credits" )
470471   PORT_DIPSETTING(    0x02, "2 Credits/3 Credits" )
r2864r2865
489490   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
490491   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
491492
492   PORT_START      /* DSW B - from "TEST NO.6 - dip switch B" */
493   PORT_START_TAG("DSW1")   /* DSW B - from "TEST NO.6 - dip switch B" */
493494   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Bonus_Life ) )
494495   PORT_DIPSETTING(    0x07, "20000" )
495496   PORT_DIPSETTING(    0x06, "30000" )
r2864r2865
515516   PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
516517   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
517518
518   PORT_START      /* audio board DSW A */
519   PORT_START_TAG("DSW2")   /* audio board DSW A */
519520   PORT_DIPNAME( 0x01, 0x00, "Sound Test A 0" )
520521   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
521522   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
541542   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
542543   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
543544
544   PORT_START      /* audio board DSW B */
545   PORT_START_TAG("DSW3")   /* audio board DSW B */
545546   PORT_DIPNAME( 0x01, 0x00, "Sound Test B 0" )
546547   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
547548   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
570571
571572
572573static INPUT_PORTS_START( challeng )
573   PORT_START      /* COL. A - from "TEST NO.7 - status locator - coin-door" */
574   PORT_START_TAG("IN0")   /* COL. A - from "TEST NO.7 - status locator - coin-door" */
574575   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
575576   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
576577   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
r2864r2865
580581   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
581582   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
582583
583   PORT_START      /* COL. B - from "TEST NO.7 - status locator - start sws." */
584   PORT_START_TAG("IN1")   /* COL. B - from "TEST NO.7 - status locator - start sws." */
584585   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
585586   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
586587   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
590591   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
591592   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
592593
593   PORT_START      /* COL. C - from "TEST NO.8 - status locator - player no.1" */
594   PORT_START_TAG("IN2")   /* COL. C - from "TEST NO.8 - status locator - player no.1" */
594595   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 )
595596   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
596597   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
600601   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
601602   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
602603
603   PORT_START      /* COL. D - from "TEST NO.8 - status locator - player no.2" */
604   PORT_START_TAG("IN3")   /* COL. D - from "TEST NO.8 - status locator - player no.2" */
604605   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
605606   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
606607   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
610611   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
611612   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
612613
613   PORT_START      /* DSW A - from "TEST NO.6 - dip switch A" */
614   PORT_START_TAG("DSW0")   /* DSW A - from "TEST NO.6 - dip switch A" */
614615   PORT_DIPNAME( 0x03, 0x03, "Coinage P1/P2" )
615616   PORT_DIPSETTING(    0x03, "1 Credit/2 Credits" )
616617   PORT_DIPSETTING(    0x02, "2 Credits/3 Credits" )
r2864r2865
634635   PORT_DIPSETTING(    0x40, "5" )
635636   PORT_DIPSETTING(    0x00, "6" )
636637
637   PORT_START      /* DSW B - from "TEST NO.6 - dip switch B" */
638   PORT_START_TAG("DSW1")   /* DSW B - from "TEST NO.6 - dip switch B" */
638639   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Bonus_Life ) )
639640   PORT_DIPSETTING(    0x01, "20000" )
640641   PORT_DIPSETTING(    0x00, "30000" )
r2864r2865
660661   PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
661662   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
662663
663   PORT_START      /* audio board DSW A */
664   PORT_START_TAG("DSW2")   /* audio board DSW A */
664665   PORT_DIPNAME( 0x01, 0x00, "Sound Test A 0" )
665666   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
666667   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
686687   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
687688   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
688689
689   PORT_START      /* audio board DSW B */
690   PORT_START_TAG("DSW3")   /* audio board DSW B */
690691   PORT_DIPNAME( 0x01, 0x00, "Sound Test B 0" )
691692   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
692693   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
715716
716717
717718static INPUT_PORTS_START( kaos )
718   PORT_START      /* COL. A - from "TEST NO.7 - status locator - coin-door" */
719   PORT_START_TAG("IN0")   /* COL. A - from "TEST NO.7 - status locator - coin-door" */
719720   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
720721   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
721722   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
r2864r2865
725726   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
726727   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
727728
728   PORT_START      /* COL. B - from "TEST NO.7 - status locator - start sws." */
729   PORT_START_TAG("IN1")   /* COL. B - from "TEST NO.7 - status locator - start sws." */
729730   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
730731   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
731732   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
735736   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
736737   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
737738
738   PORT_START      /* COL. C - from "TEST NO.8 - status locator - player no.1" */
739   PORT_START_TAG("IN2")   /* COL. C - from "TEST NO.8 - status locator - player no.1" */
739740   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
740741   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
741742   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
r2864r2865
745746   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
746747   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
747748
748   PORT_START      /* COL. D - from "TEST NO.8 - status locator - player no.2" */
749   PORT_START_TAG("IN3")   /* COL. D - from "TEST NO.8 - status locator - player no.2" */
749750   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
750751   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
751752   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
r2864r2865
755756   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
756757   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
757758
758   PORT_START
759   PORT_START_TAG("DSW0")
759760   PORT_DIPNAME( 0x0f, 0x0e, DEF_STR( Coinage ) )
760761   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
761762   PORT_DIPSETTING(    0x0e, DEF_STR( 1C_1C ) )
r2864r2865
785786   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
786787   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
787788
788   PORT_START
789   PORT_START_TAG("DSW1")
789790   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
790791   PORT_DIPSETTING(    0x01, "3" )
791792   PORT_DIPSETTING(    0x00, "4" )
r2864r2865
810811   PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
811812   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
812813
813   PORT_START      /* audio board DSW A */
814   PORT_START_TAG("DSW2")   /* audio board DSW A */
814815   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
815816   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
816817   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
836837   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
837838   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
838839
839   PORT_START      /* audio board DSW B */
840   PORT_START_TAG("DSW3")   /* audio board DSW B */
840841   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
841842   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
842843   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
865866
866867
867868static INPUT_PORTS_START( leprechn )
868   PORT_START      /* COL. A - from "TEST NO.7 - status locator - coin-door" */
869   PORT_START_TAG("IN0")   /* COL. A - from "TEST NO.7 - status locator - coin-door" */
869870   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
870871   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
871872   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
r2864r2865
875876   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
876877   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
877878
878   PORT_START      /* COL. B - from "TEST NO.7 - status locator - start sws." */
879   PORT_START_TAG("IN1")   /* COL. B - from "TEST NO.7 - status locator - start sws." */
879880   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
880881   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
881882   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
885886   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
886887   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
887888
888   PORT_START      /* COL. C - from "TEST NO.8 - status locator - player no.1" */
889   PORT_START_TAG("IN2")   /* COL. C - from "TEST NO.8 - status locator - player no.1" */
889890   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
890891   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
891892   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
895896   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
896897   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
897898
898   PORT_START      /* COL. D - from "TEST NO.8 - status locator - player no.2" */
899   PORT_START_TAG("IN3")   /* COL. D - from "TEST NO.8 - status locator - player no.2" */
899900   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
900901   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
901902   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
905906   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
906907   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL
907908
908   PORT_START      /* DSW A - from "TEST NO.6 - dip switch A" */
909   PORT_START_TAG("DSW0")   /* DSW A - from "TEST NO.6 - dip switch A" */
909910   PORT_DIPNAME( 0x09, 0x09, DEF_STR( Coin_B ) )
910911   PORT_DIPSETTING(    0x09, DEF_STR( 1C_1C ) )
911912   PORT_DIPSETTING(    0x01, DEF_STR( 1C_5C ) )
r2864r2865
928929   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
929930   PORT_DIPSETTING(    0x00, DEF_STR( 1C_4C ) )
930931
931   PORT_START      /* DSW B - from "TEST NO.6 - dip switch B" */
932   PORT_START_TAG("DSW1")   /* DSW B - from "TEST NO.6 - dip switch B" */
932933   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
933934   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
934935   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
953954   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
954955   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
955956
956   PORT_START      /* audio board DSW A */
957   PORT_START_TAG("DSW2")   /* audio board DSW A */
957958   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
958959   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
959960   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
979980   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
980981   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
981982
982   PORT_START      /* audio board DSW B */
983   PORT_START_TAG("DSW3")   /* audio board DSW B */
983984   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
984985   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
985986   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
10081009
10091010
10101011static INPUT_PORTS_START( piratetr )
1011   PORT_START      /* COL. A - from "TEST NO.7 - status locator - coin-door" */
1012   PORT_START_TAG("IN0")   /* COL. A - from "TEST NO.7 - status locator - coin-door" */
10121013   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
10131014   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
10141015   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
r2864r2865
10181019   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
10191020   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
10201021
1021   PORT_START      /* COL. B - from "TEST NO.7 - status locator - start sws." */
1022   PORT_START_TAG("IN1")   /* COL. B - from "TEST NO.7 - status locator - start sws." */
10221023   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
10231024   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
10241025   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
10281029   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
10291030   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
10301031
1031   PORT_START      /* COL. C - from "TEST NO.8 - status locator - player no.1" */
1032   PORT_START_TAG("IN2")   /* COL. C - from "TEST NO.8 - status locator - player no.1" */
10321033   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
10331034   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
10341035   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
10381039   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
10391040   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
10401041
1041   PORT_START      /* COL. D - from "TEST NO.8 - status locator - player no.2" */
1042   PORT_START_TAG("IN3")   /* COL. D - from "TEST NO.8 - status locator - player no.2" */
10421043   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
10431044   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
10441045   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
10481049   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
10491050   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL
10501051
1051   PORT_START      /* DSW A - from "TEST NO.6 - dip switch A" */
1052   PORT_START_TAG("DSW0")   /* DSW A - from "TEST NO.6 - dip switch A" */
10521053   PORT_DIPNAME( 0x09, 0x09, DEF_STR( Coin_B ) )
10531054   PORT_DIPSETTING(    0x09, DEF_STR( 1C_1C ) )
10541055   PORT_DIPSETTING(    0x01, DEF_STR( 1C_5C ) )
r2864r2865
10711072   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
10721073   PORT_DIPSETTING(    0x00, DEF_STR( 1C_4C ) )
10731074
1074   PORT_START      /* DSW B - from "TEST NO.6 - dip switch B" */
1075   PORT_START_TAG("DSW1")   /* DSW B - from "TEST NO.6 - dip switch B" */
10751076   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
10761077   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
10771078   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
10961097   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
10971098   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
10981099
1099   PORT_START      /* audio board DSW A */
1100   PORT_START_TAG("DSW2")   /* audio board DSW A */
11001101   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
11011102   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
11021103   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
11221123   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
11231124   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
11241125
1125   PORT_START      /* audio board DSW B */
1126   PORT_START_TAG("DSW3")   /* audio board DSW B */
11261127   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
11271128   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
11281129   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
src/mame/drivers/darius.c
r2864r2865
127127***************************************************************************/
128128
129129#include "driver.h"
130#include "deprecat.h"
131130#include "video/taitoic.h"
132131#include "cpu/z80/z80.h"
133132#include "audio/taitosnd.h"
r2864r2865
151150WRITE16_HANDLER( darius_fg_layer_w );
152151
153152
154static void parse_control( void )   /* assumes Z80 sandwiched between 68Ks */
153static void parse_control( running_machine *machine )   /* assumes Z80 sandwiched between 68Ks */
155154{
156155   /* bit 0 enables cpu B */
157156   /* however this fails when recovering from a save state
158157       if cpu B is disabled !! */
159   cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
158   cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
160159
161160}
162161
r2864r2865
166165      data = data >> 8;   /* for Wgp */
167166   cpua_ctrl = data;
168167
169   parse_control();
168   parse_control(machine);
170169
171170   logerror("CPU #0 PC %06x: write %04x to cpu control\n",activecpu_get_pc(),data);
172171}
r2864r2865
189188         return (taitosound_comm_r(machine,0) & 0xff);   /* sound interface read */
190189
191190      case 0x04:
192         return input_port_read_indexed(machine,0);   /* IN0 */
191         return input_port_read(machine, "P1");
193192
194193      case 0x05:
195         return input_port_read_indexed(machine,1);   /* IN1 */
194         return input_port_read(machine, "P2");
196195
197196      case 0x06:
198         return input_port_read_indexed(machine,2);   /* IN2 */
197         return input_port_read(machine, "SYSTEM");
199198
200199      case 0x07:
201200         return coin_word;   /* bits 3&4 coin lockouts, must return zero */
202201
203202      case 0x08:
204         return input_port_read_indexed(machine,3);   /* DSW */
203         return input_port_read(machine, "DSW");
205204   }
206205
207206logerror("CPU #0 PC %06x: warning - read unmapped ioc offset %06x\n",activecpu_get_pc(),offset);
r2864r2865
612611   PORT_DIPSETTING(      0x0100, DEF_STR( Hard ) ) \
613612   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
614613
615#define DARIUS_PLAYERS_INPUT( player ) \
616   PORT_START \
617   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(player) PORT_8WAY \
618   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(player) PORT_8WAY \
619   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(player) PORT_8WAY \
620   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(player) PORT_8WAY \
621   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(player) \
622   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(player) \
623   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
614
615static INPUT_PORTS_START( darius_common )
616   PORT_START_TAG("P1")
617   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
618   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
619   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
620   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
621   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
622   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
623   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
624624   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
625625
626#define DARIUS_SYSTEM_INPUT \
627   PORT_START \
628   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) \
629   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) \
630   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_START1 )  \
631   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START2 ) \
632   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_SERVICE1 ) \
633   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_TILT ) \
634   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN ) \
626   PORT_START_TAG("P2")
627   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY
628   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY
629   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY
630   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY
631   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
632   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
633   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
634   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
635
636   PORT_START_TAG("SYSTEM")
637   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
638   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
639   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_START1 )
640   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START2 )
641   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_SERVICE1 )
642   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_TILT )
643   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
635644   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
645INPUT_PORTS_END
636646
637
638647static INPUT_PORTS_START( darius )
639   DARIUS_PLAYERS_INPUT( 1 )
648   PORT_INCLUDE( darius_common )
640649
641   DARIUS_PLAYERS_INPUT( 2 )
642
643   DARIUS_SYSTEM_INPUT
644
645   PORT_START   /* DSW */
650   PORT_START_TAG("DSW")   /* DSW */
646651   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
647652   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
648653   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
674679INPUT_PORTS_END
675680
676681static INPUT_PORTS_START( dariuse )
677   DARIUS_PLAYERS_INPUT( 1 )
682   PORT_INCLUDE( darius_common )
678683
679   DARIUS_PLAYERS_INPUT( 2 )
680
681   DARIUS_SYSTEM_INPUT
682
683   PORT_START   /* DSW */
684   PORT_START_TAG("DSW")   /* DSW */
684685   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
685686   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
686687   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
712713INPUT_PORTS_END
713714
714715static INPUT_PORTS_START( dariusj )
715   DARIUS_PLAYERS_INPUT( 1 )
716   PORT_INCLUDE( darius_common )
716717
717   DARIUS_PLAYERS_INPUT( 2 )
718
719   DARIUS_SYSTEM_INPUT
720
721   PORT_START   /* DSW */
718   PORT_START_TAG("DSW")   /* DSW */
722719   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
723720   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
724721   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
12021199
12031200static STATE_POSTLOAD( darius_postload )
12041201{
1205   parse_control();
1202   parse_control(machine);
12061203   reset_sound_region();
12071204}
12081205
src/mame/drivers/kinst.c
r2864r2865
330330static READ32_HANDLER( kinst_control_r )
331331{
332332   UINT32 result;
333   static const char *portnames[] = { "P1", "P2", "IN0", "IN1", "DSW" };
333334
334335   /* apply shuffling */
335336   offset = control_map[offset / 2];
r2864r2865
338339   switch (offset)
339340   {
340341      case 2:      /* $90 -- sound return */
341         result = 0xffff0000 | input_port_read_indexed(machine, offset);
342         result = 0xffff0000 | input_port_read(machine, portnames[offset]);
342343         result &= ~0x0002;
343344         if (dcs_control_r() & 0x800)
344345            result |= 0x0002;
r2864r2865
347348      case 0:      /* $80 */
348349      case 1:      /* $88 */
349350      case 3:      /* $98 */
350         result = 0xffff0000 | input_port_read_indexed(machine, offset);
351         result = 0xffff0000 | input_port_read(machine, portnames[offset]);
351352         break;
352353
353354      case 4:      /* $a0 */
354         result = 0xffff0000 | input_port_read_indexed(machine, offset);
355         result = 0xffff0000 | input_port_read(machine, portnames[offset]);
355356         if (activecpu_get_pc() == 0x802d428)
356357            cpu_spinuntil_int();
357358         break;
r2864r2865
452453 *************************************/
453454
454455static INPUT_PORTS_START( kinst )
455   PORT_START
456   PORT_START_TAG("P1")
456457   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
457458   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
458459   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
r2864r2865
470471   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN4 )
471472   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )   /* door */
472473
473   PORT_START
474   PORT_START_TAG("P2")
474475   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
475476   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
476477   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
r2864r2865
488489   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BILL1 )   /* bill */
489490   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )   /* coin door */
490491
491   PORT_START
492   PORT_START_TAG("IN0")
492493   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
493494   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sound status */
494495   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_VOLUME_UP )
495496   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_VOLUME_DOWN )
496497   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
497498
498   PORT_START
499   PORT_START_TAG("IN1")
499500   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )   /* verify */
500501
501   PORT_START
502   PORT_START_TAG("DSW")
502503   PORT_DIPNAME( 0x0003, 0x0003, "Blood Level" )
503504   PORT_DIPSETTING(      0x0003, DEF_STR( High ))
504505   PORT_DIPSETTING(      0x0002, DEF_STR( Medium ))
r2864r2865
556557
557558
558559static INPUT_PORTS_START( kinst2 )
559   PORT_START
560   PORT_START_TAG("P1")
560561   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
561562   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
562563   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
r2864r2865
574575   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN4 )
575576   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )   /* door */
576577
577   PORT_START
578   PORT_START_TAG("P2")
578579   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
579580   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
580581   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
r2864r2865
592593   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BILL1 )   /* bill */
593594   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )   /* coin door */
594595
595   PORT_START
596   PORT_START_TAG("IN0")
596597   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
597598   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SPECIAL )   /* sound status */
598599   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_VOLUME_UP )
599600   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_VOLUME_DOWN )
600601   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
601602
602   PORT_START
603   PORT_START_TAG("IN1")
603604   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )   /* verify */
604605
605   PORT_START
606   PORT_START_TAG("DSW")
606607   PORT_DIPNAME( 0x0003, 0x0003, "Blood Level" )
607608   PORT_DIPSETTING(      0x0003, DEF_STR( High ))
608609   PORT_DIPSETTING(      0x0002, DEF_STR( Medium ))
src/mame/drivers/beathead.c
r2864r2865
511511{
512512   /* initialize the common systems */
513513   atarigen_eeprom_default = NULL;
514   atarijsa_init(machine, 2, 0x0040);
514   atarijsa_init(machine, "IN2", 0x0040);
515515   atarijsa3_init_adpcm(REGION_SOUND1);
516516
517517   /* prepare the speedups */
src/mame/drivers/funkyjet.c
r2864r2865
155155/******************************************************************************/
156156
157157static INPUT_PORTS_START( funkyjet )
158   PORT_START   /* Player 1 controls */
158   PORT_START_TAG("P1")   /* Player 1 controls */
159159   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
160160   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
161161   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
165165   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )   /* Button 3 only in "test mode" */
166166   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
167167
168   PORT_START   /* Player 2 controls */
168   PORT_START_TAG("P2")   /* Player 2 controls */
169169   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
170170   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
171171   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
175175   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )   /* Button 3 only in "test mode" */
176176   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
177177
178   PORT_START   /* System Inputs */
178   PORT_START_TAG("IN0")   /* System Inputs */
179179   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
180180   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
181181   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
243243INPUT_PORTS_END
244244
245245static INPUT_PORTS_START( sotsugyo )
246   PORT_START   /* Player 1 controls */
246   PORT_START_TAG("P1")   /* Player 1 controls */
247247   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
248248   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
249249   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
253253   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)   /* only in "test mode" */
254254   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
255255
256   PORT_START   /* Player 2 controls */
256   PORT_START_TAG("P2")   /* Player 2 controls */
257257   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
258258   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
259259   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
263263   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)   /* only in "test mode" */
264264   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
265265
266   PORT_START   /* System Inputs */
266   PORT_START_TAG("IN0")   /* System Inputs */
267267   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
268268   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )      // Not working - see notes
269269   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )      // See notes
r2864r2865
271271
272272   /* Dips seem inverted with respect to other Deco games */
273273
274   PORT_START   /* Dip switch bank 1 */
274   PORT_START_TAG("DSWA")   /* Dip switch bank 1 */
275275   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) )
276276   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
277277   PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
r2864r2865
295295   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
296296   PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
297297
298   PORT_START   /* Dip switch bank 2 */
298   PORT_START_TAG("DSWB")   /* Dip switch bank 2 */
299299   PORT_DIPNAME( 0x80, 0x80, "Freeze" )
300300   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
301301   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
src/mame/drivers/xexex.c
r2864r2865
145145#endif
146146
147147
148static void xexex_objdma(int limiter)
148static void xexex_objdma(running_machine *machine, int limiter)
149149{
150150   static int frame = -1;
151151
r2864r2865
153153   UINT16 *src, *dst;
154154
155155   counter = frame;
156   frame = video_screen_get_frame_number(Machine->primary_screen);
156   frame = video_screen_get_frame_number(machine->primary_screen);
157157   if (limiter && counter == frame) return; // make sure we only do DMA transfer once per frame
158158
159159   K053247_export_config(&dst, 0, 0, 0, &counter);
r2864r2865
328328         if (K053246_is_IRQ_enabled())
329329         {
330330            // OBJDMA starts at the beginning of V-blank
331            xexex_objdma(0);
331            xexex_objdma(machine, 0);
332332
333333            // schedule DMA end interrupt
334334            timer_adjust_oneshot(dmadelay_timer, XE_DMADELAY, 0);
src/mame/drivers/skullxbo.c
r2864r2865
9696
9797static READ16_HANDLER( special_port1_r )
9898{
99   int temp = input_port_read_indexed(machine, 1);
99   int temp = input_port_read(machine, "FF5802");
100100   if (atarigen_cpu_to_sound_ready) temp ^= 0x0040;
101101   if (atarigen_get_hblank(machine->primary_screen)) temp ^= 0x0010;
102102   return temp;
r2864r2865
164164 *************************************/
165165
166166static INPUT_PORTS_START( skullxbo )
167   PORT_START      /* ff5800 */
167   PORT_START_TAG("FF5800")      /* ff5800 */
168168   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
169169   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
170170   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r2864r2865
175175   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
176176   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
177177
178   PORT_START      /* ff5802 */
178   PORT_START_TAG("FF5802")      /* ff5802 */
179179   PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED )
180180   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED )   /* HBLANK */
181181   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_VBLANK )
r2864r2865
618618static DRIVER_INIT( skullxbo )
619619{
620620   atarigen_eeprom_default = NULL;
621   atarijsa_init(machine, 1, 0x0080);
621   atarijsa_init(machine, "FF5802", 0x0080);
622622   memset(memory_region(REGION_GFX1) + 0x170000, 0, 0x20000);
623623}
624624
src/mame/drivers/jchan.c
r2864r2865
302302
303303      case 0x03:    // DSW
304304      {
305         mcu_ram[mcu_offset] = input_port_read_indexed(machine, 3);
305         mcu_ram[mcu_offset] = input_port_read(machine, "DSW");
306306         logerror("PC=%06X : MCU executed command: %04X %04X (read DSW)\n",activecpu_get_pc(),mcu_command,mcu_offset*2);
307307      }
308308      break;
r2864r2865
455455{
456456   switch(offset)
457457   {
458      case 0/2: return input_port_read_indexed(machine, 0); // Player 1 controls
459      case 2/2: return input_port_read_indexed(machine, 1); // Player 2 controls
458      case 0/2: return input_port_read(machine, "IN0"); // Player 1 controls
459      case 2/2: return input_port_read(machine, "IN1"); // Player 2 controls
460460      default: logerror("jchan_ctrl_r unknown!"); break;
461461   }
462462   return jchan_ctrl[offset];
r2864r2865
704704   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1   )
705705   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN   )
706706
707   PORT_START_TAG("IN3")   // DSW provided by the MCU - $200098.b <- $300200
707   PORT_START_TAG("DSW")   // DSW provided by the MCU - $200098.b <- $300200
708708   PORT_DIPNAME( 0x0100, 0x0100, "Test Mode" )
709709   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
710710   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
src/mame/drivers/seattle.c
r2864r2865
183183**************************************************************************/
184184
185185#include "driver.h"
186#include "deprecat.h"
187186#include "cpu/adsp2100/adsp2100.h"
188187#include "cpu/mips/mips3.h"
189188#include "audio/dcs.h"
r2864r2865
471470static TIMER_CALLBACK( galileo_timer_callback );
472471static void galileo_perform_dma(running_machine *machine, int which);
473472static void voodoo_stall(running_machine *machine, int stall);
474static void widget_reset(void);
473static void widget_reset(running_machine *machine);
475474static void update_widget_irq(running_machine *machine);
476475
477476
r2864r2865
569568   devtag_reset(machine, IDE_CONTROLLER, "ide");
570569   voodoo_reset(0);
571570   if (board_config == SEATTLE_WIDGET_CONFIG)
572      widget_reset();
571      widget_reset(machine);
573572   if (board_config == FLAGSTAFF_CONFIG)
574573      smc91c94_reset(machine);
575574}
r2864r2865
927926 *
928927 *************************************/
929928
930static int galileo_dma_fetch_next(int which)
929static int galileo_dma_fetch_next(running_machine *machine, int which)
931930{
932931   offs_t address = 0;
933932   UINT32 data;
r2864r2865
942941      if (galileo.reg[GREG_DMA0_CONTROL + which] & 0x400)
943942      {
944943         galileo.reg[GREG_INT_STATE] |= 1 << (GINT_DMA0COMP_SHIFT + which);
945         update_galileo_irqs(Machine);
944         update_galileo_irqs(machine);
946945      }
947946      galileo.reg[GREG_DMA0_CONTROL + which] &= ~0x5000;
948947      return 0;
r2864r2865
10531052         galileo.reg[GREG_INT_STATE] |= 1 << (GINT_DMA0COMP_SHIFT + which);
10541053         update_galileo_irqs(machine);
10551054      }
1056   } while (galileo_dma_fetch_next(which));
1055   } while (galileo_dma_fetch_next(machine, which));
10571056
10581057   galileo.reg[GREG_DMA0_CONTROL + which] &= ~0x5000;
10591058}
r2864r2865
11771176
11781177         /* fetch next record */
11791178         if (data & 0x2000)
1180            galileo_dma_fetch_next(which);
1179            galileo_dma_fetch_next(machine, which);
11811180         galileo.reg[offset] &= ~0x2000;
11821181
11831182         /* if enabling, start the DMA */
r2864r2865
14891488 *
14901489 *************************************/
14911490
1492static void widget_reset(void)
1491static void widget_reset(running_machine *machine)
14931492{
14941493   UINT8 saved_irq = widget.irq_num;
14951494   memset(&widget, 0, sizeof(widget));
14961495   widget.irq_num = saved_irq;
1497   smc91c94_reset(Machine);
1496   smc91c94_reset(machine);
14981497}
14991498
15001499
r2864r2865
16171616{
16181617   COMBINE_DATA(asic_reset);
16191618   if (!(*asic_reset & 0x0002))
1620      midway_ioasic_reset();
1619      midway_ioasic_reset(machine);
16211620}
16221621
16231622
16241623static WRITE32_HANDLER( asic_fifo_w )
16251624{
1626   midway_ioasic_fifo_w(data);
1625   midway_ioasic_fifo_w(machine, data);
16271626}
16281627
16291628
r2864r2865
27252724static void init_common(running_machine *machine, int ioasic, int serialnum, int yearoffs, int config)
27262725{
27272726   /* initialize the subsystems */
2728   midway_ioasic_init(ioasic, serialnum, yearoffs, ioasic_irq);
2727   midway_ioasic_init(machine, ioasic, serialnum, yearoffs, ioasic_irq);
27292728
27302729   /* switch off the configuration */
27312730   board_config = config;
src/mame/drivers/funkybee.c
r2864r2865
8888
8989static READ8_HANDLER( funkybee_input_port_0_r )
9090{
91   watchdog_reset_r(machine,0);
92   return input_port_read_indexed(machine,0);
91   watchdog_reset_r(machine, 0);
92   return input_port_read(machine, "IN0");
9393}
9494
9595static WRITE8_HANDLER( funkybee_coin_counter_w )
r2864r2865
103103   AM_RANGE(0xa000, 0xdfff) AM_READ(SMH_RAM)
104104   AM_RANGE(0xf000, 0xf000) AM_READ(SMH_NOP)   /* IRQ Ack */
105105   AM_RANGE(0xf800, 0xf800) AM_READ(funkybee_input_port_0_r)
106   AM_RANGE(0xf801, 0xf801) AM_READ(input_port_1_r)
107   AM_RANGE(0xf802, 0xf802) AM_READ(input_port_2_r)
106   AM_RANGE(0xf801, 0xf801) AM_READ_PORT("IN1")
107   AM_RANGE(0xf802, 0xf802) AM_READ_PORT("IN2")
108108ADDRESS_MAP_END
109109
110110static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
src/mame/drivers/freekick.c
r2864r2865
9393
9494static READ8_HANDLER( spinner_r )
9595{
96   return input_port_read_indexed(machine, 5 + spinner);
96   return input_port_read(machine, spinner ? "IN3" : "IN2");
9797}
9898
99static READ8_HANDLER( gigas_spinner_r )
100{
101   return input_port_read_indexed(machine,  spinner );
102}
103
10499static MACHINE_RESET( pbillrd )
105100{
106101   memory_configure_bank(1, 0, 2, memory_region(REGION_CPU1) + 0x10000, 0x4000);
r2864r2865
194189   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
195190   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1)
196191   AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
197   AM_RANGE(0xe000, 0xe000) AM_READ(input_port_0_r)
198   AM_RANGE(0xe800, 0xe800) AM_READ(input_port_1_r)
199   AM_RANGE(0xf000, 0xf000) AM_READ(input_port_2_r)
200   AM_RANGE(0xf800, 0xf800) AM_READ(input_port_3_r)
192   AM_RANGE(0xe000, 0xe000) AM_READ_PORT("IN0")
193   AM_RANGE(0xe800, 0xe800) AM_READ_PORT("IN1")
194   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSW1")
195   AM_RANGE(0xf800, 0xf800) AM_READ_PORT("DSW2")
201196ADDRESS_MAP_END
202197
203198static ADDRESS_MAP_START( pbillrd_writemem, ADDRESS_SPACE_PROGRAM, 8 )
r2864r2865
223218   AM_RANGE(0xe800, 0xe8ff) AM_READ(SMH_RAM)   // sprites
224219   AM_RANGE(0xec00, 0xec03) AM_DEVREAD(PPI8255, "ppi8255_0", ppi8255_r)
225220   AM_RANGE(0xf000, 0xf003) AM_DEVREAD(PPI8255, "ppi8255_1", ppi8255_r)
226   AM_RANGE(0xf800, 0xf800) AM_READ(input_port_3_r)
227   AM_RANGE(0xf801, 0xf801) AM_READ(input_port_4_r)
221   AM_RANGE(0xf800, 0xf800) AM_READ_PORT("IN0")
222   AM_RANGE(0xf801, 0xf801) AM_READ_PORT("IN1")
228223   AM_RANGE(0xf802, 0xf802) AM_READ(SMH_NOP)   //MUST return bit 0 = 0, otherwise game resets
229224   AM_RANGE(0xf803, 0xf803) AM_READ(spinner_r)
230225ADDRESS_MAP_END
r2864r2865
250245   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
251246   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_ROM)
252247   AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
253   AM_RANGE(0xe000, 0xe000) AM_READ(input_port_2_r)
254   AM_RANGE(0xe800, 0xe800) AM_READ(input_port_3_r)
255   AM_RANGE(0xf000, 0xf000) AM_READ(input_port_4_r)
256   AM_RANGE(0xf800, 0xf800) AM_READ(input_port_5_r)
248   AM_RANGE(0xe000, 0xe000) AM_READ_PORT("IN0")
249   AM_RANGE(0xe800, 0xe800) AM_READ_PORT("IN1")
250   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSW1")
251   AM_RANGE(0xf800, 0xf800) AM_READ_PORT("DSW2")
257252ADDRESS_MAP_END
258253
259254static ADDRESS_MAP_START( gigas_writemem, ADDRESS_SPACE_PROGRAM, 8 )
r2864r2865
275270
276271static ADDRESS_MAP_START( gigas_readport, ADDRESS_SPACE_IO, 8 )
277272   ADDRESS_MAP_GLOBAL_MASK(0xff)
278   AM_RANGE(0x00, 0x00) AM_READ(gigas_spinner_r)
273   AM_RANGE(0x00, 0x00) AM_READ(spinner_r)
279274   AM_RANGE(0x01, 0x01) AM_READ(SMH_NOP) //unused dip 3
280275ADDRESS_MAP_END
281276
r2864r2865
286281
287282static ADDRESS_MAP_START( oigas_readport, ADDRESS_SPACE_IO, 8 )
288283   ADDRESS_MAP_GLOBAL_MASK(0xff)
289   AM_RANGE(0x00, 0x00) AM_READ(gigas_spinner_r)
284   AM_RANGE(0x00, 0x00) AM_READ(spinner_r)
290285   AM_RANGE(0x01, 0x01) AM_READ(SMH_NOP) //unused dip 3
291286   AM_RANGE(0x02, 0x02) AM_READ(oigas_2_r)
292287   AM_RANGE(0x03, 0x03) AM_READ(oigas_3_r)
src/mame/drivers/namcos22.c
r2864r2865
12251225/*********************************************************************************************/
12261226
12271227static void
1228InitDSP( int bSuperSystem22 )
1228InitDSP( running_machine *machine, int bSuperSystem22 )
12291229{
12301230   mbSuperSystem22 = bSuperSystem22;
1231   cpunum_set_input_line(Machine, 1,INPUT_LINE_RESET,ASSERT_LINE); /* master DSP */
1232   cpunum_set_input_line(Machine, 2,INPUT_LINE_RESET,ASSERT_LINE); /* slave DSP */
1233   cpunum_set_input_line(Machine, 3,INPUT_LINE_RESET,ASSERT_LINE); /* MCU */
1231   cpunum_set_input_line(machine, 1,INPUT_LINE_RESET,ASSERT_LINE); /* master DSP */
1232   cpunum_set_input_line(machine, 2,INPUT_LINE_RESET,ASSERT_LINE); /* slave DSP */
1233   cpunum_set_input_line(machine, 3,INPUT_LINE_RESET,ASSERT_LINE); /* MCU */
12341234} /* InitDSP */
12351235
12361236static READ16_HANDLER( pdp_status_r )
r2864r2865
14081408   COMBINE_DATA( &mpSlaveExternalRAM[offset] );
14091409}
14101410
1411static void HaltSlaveDSP( void )
1411static void HaltSlaveDSP( running_machine *machine )
14121412{
1413   cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, ASSERT_LINE);
1413   cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, ASSERT_LINE);
14141414}
14151415
14161416static void EnableSlaveDSP( void )
r2864r2865
14951495      logerror( "UPLOAD_READY; cmd = 0x%x\n", data );
14961496      if( data==0 )
14971497      {
1498         HaltSlaveDSP();
1498         HaltSlaveDSP(machine);
14991499      }
15001500      else if( data==1 )
15011501      {
r2864r2865
23332333
23342334static MACHINE_RESET(namcoss22)
23352335{
2336   InitDSP(1/*super*/);
2336   InitDSP(machine, 1/*super*/);
23372337}
23382338
23392339/*
r2864r2865
30713071
30723072static MACHINE_RESET(namcos22)
30733073{
3074   InitDSP(0);
3074   InitDSP(machine, 0);
30753075}
30763076
30773077static MACHINE_DRIVER_START( namcos22 )
src/mame/drivers/flyball.c
r2864r2865
4141
4242   memset(potsense, 0, sizeof potsense);
4343
44   potsense[input_port_read_indexed(machine, 1)] |= 1;
45   potsense[input_port_read_indexed(machine, 2)] |= 2;
46   potsense[input_port_read_indexed(machine, 3)] |= 4;
47   potsense[input_port_read_indexed(machine, 4)] |= 8;
44   potsense[input_port_read(machine, "STICK1_Y")] |= 1;
45   potsense[input_port_read(machine, "STICK1_X")] |= 2;
46   potsense[input_port_read(machine, "STICK0_Y")] |= 4;
47   potsense[input_port_read(machine, "STICK0_X")] |= 8;
4848
4949   for (i = 0; i < 64; i++)
5050      if (potsense[i] != 0)
r2864r2865
7979
8080static READ8_HANDLER( flyball_input_r )
8181{
82   return input_port_read_indexed(machine, 0) & input_port_read_indexed(machine, 5);
82   return input_port_read(machine, "IN0") & input_port_read(machine, "IN1");
8383}
8484
8585static READ8_HANDLER( flyball_scanline_r )
r2864r2865
170170
171171
172172static INPUT_PORTS_START( flyball )
173   PORT_START /* IN0 */
173   PORT_START_TAG("IN0") /* IN0 */
174174   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
175175   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
176176   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r2864r2865
186186   PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
187187   PORT_DIPSETTING( 0x80, DEF_STR( On ) )
188188
189   PORT_START /* IN1 */
189   PORT_START_TAG("STICK1_Y") /* IN1 */
190190   PORT_BIT( 0x3f, 0x20, IPT_AD_STICK_Y ) PORT_MINMAX(1,63) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
191191
192   PORT_START /* IN2 */
192   PORT_START_TAG("STICK1_X") /* IN2 */
193193   PORT_BIT( 0x3f, 0x20, IPT_AD_STICK_X ) PORT_MINMAX(1,63) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
194194
195   PORT_START /* IN3 */
195   PORT_START_TAG("STICK0_Y") /* IN3 */
196196   PORT_BIT( 0x3f, 0x20, IPT_AD_STICK_Y ) PORT_MINMAX(1,63) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
197197
198   PORT_START /* IN4 */
198   PORT_START_TAG("STICK0_X") /* IN4 */
199199   PORT_BIT( 0x3f, 0x20, IPT_AD_STICK_X ) PORT_MINMAX(1,63) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
200200
201   PORT_START /* IN5 */
201   PORT_START_TAG("IN1") /* IN5 */
202202   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
203203   PORT_BIT( 0xFE, IP_ACTIVE_LOW, IPT_UNUSED )
204204INPUT_PORTS_END
src/mame/drivers/xybots.c
r2864r2865
6666{
6767   static int h256 = 0x0400;
6868
69   int result = input_port_read_indexed(machine, 1);
69   int result = input_port_read(machine, "FFE200");
7070
7171   if (atarigen_cpu_to_sound_ready) result ^= 0x0200;
7272   result ^= h256 ^= 0x0400;
r2864r2865
112112 *************************************/
113113
114114static INPUT_PORTS_START( xybots )
115   PORT_START   /* ffe100 */
115   PORT_START_TAG("FFE100")   /* ffe100 */
116116   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
117117   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
118118   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 Twist Right") PORT_CODE(KEYCODE_W) PORT_PLAYER(2)
r2864r2865
130130   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
131131   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
132132
133   PORT_START   /* ffe200 */
133   PORT_START_TAG("FFE200")   /* ffe200 */
134134   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
135135   PORT_SERVICE( 0x0100, IP_ACTIVE_LOW )
136136   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED )    /* /AUDBUSY */
r2864r2865
388388static DRIVER_INIT( xybots )
389389{
390390   atarigen_eeprom_default = NULL;
391   atarigen_slapstic_init(0, 0x008000, 0, 107);
392   atarijsa_init(machine, 1, 0x0100);
391   atarigen_slapstic_init(machine, 0, 0x008000, 0, 107);
392   atarijsa_init(machine, "FFE200", 0x0100);
393393}
394394
395395
src/mame/drivers/galaxold.c
r2864r2865
546546
547547
548548static READ8_HANDLER( scramb2_protection_r ) { return 0x25; }
549static READ8_HANDLER( scramb2_port0_r ) { return (input_port_read_indexed(machine, 0)>>offset)&0x1; }
550static READ8_HANDLER( scramb2_port1_r ) { return (input_port_read_indexed(machine, 1)>>offset)&0x1; }
551static READ8_HANDLER( scramb2_port2_r ) { return (input_port_read_indexed(machine, 2)>>offset)&0x1; }
549static READ8_HANDLER( scramb2_port0_r ) { return (input_port_read(machine, "IN0") >> offset) & 0x1; }
550static READ8_HANDLER( scramb2_port1_r ) { return (input_port_read(machine, "IN1") >> offset) & 0x1; }
551static READ8_HANDLER( scramb2_port2_r ) { return (input_port_read(machine, "IN2") >> offset) & 0x1; }
552552
553553static ADDRESS_MAP_START( scramb2_readmem, ADDRESS_SPACE_PROGRAM, 8 )
554554   AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
r2864r2865
977977   AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ(input_port_3_r)
978978ADDRESS_MAP_END
979979
980#define GAL_IN0\
981   PORT_START_TAG("IN0")\
982   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )\
983   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )\
984   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY\
985   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY\
986   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )\
987   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) )\
988   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )\
989   PORT_DIPSETTING(    0x20, DEF_STR( Cocktail ) )\
990   PORT_SERVICE( 0x40, IP_ACTIVE_HIGH )\
991   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE1 )
992980
993#define GAL_IN1\
994   PORT_START_TAG("IN1")\
995   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )\
996   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )\
997   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL\
998   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL\
999   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL\
1000   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )\
1001   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coinage ) )\
1002   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )\
1003   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )\
1004   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )\
1005   PORT_DIPSETTING(    0xc0, DEF_STR( Free_Play ) )
1006
1007981static INPUT_PORTS_START( scramblb )
1008982   PORT_START_TAG("IN0")
1009983   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
r2864r2865
10891063   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
10901064INPUT_PORTS_END
10911065
1092
1093#define MOON_IN0\
1094   PORT_START_TAG("IN0")\
1095   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )\
1096   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )\
1097   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY\
1098   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY\
1099   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )\
1100   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) )\
1101   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )\
1102   PORT_DIPSETTING(    0x20, DEF_STR( Cocktail ) )\
1103   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* "reset" on schematics */\
1104   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
1105
11061066static INPUT_PORTS_START( 4in1 )
11071067   PORT_START_TAG("IN0")
11081068   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
src/mame/drivers/atarisy1.c
r2864r2865
21012101   via_config(0, &via_interface);
21022102
21032103   atarigen_eeprom_default = NULL;
2104   atarigen_slapstic_init(0, 0x080000, 0, 103);
2104   atarigen_slapstic_init(machine, 0, 0x080000, 0, 103);
21052105
21062106   joystick_type = 0;   /* none */
21072107   trackball_type = 1;   /* rotated */
r2864r2865
21132113   via_config(0, &via_interface);
21142114
21152115   atarigen_eeprom_default = NULL;
2116   atarigen_slapstic_init(0, 0x080000, 0, 107);
2116   atarigen_slapstic_init(machine, 0, 0x080000, 0, 107);
21172117
21182118   joystick_type = 1;   /* digital */
21192119   trackball_type = 0;   /* none */
r2864r2865
21252125   via_config(0, &via_interface);
21262126
21272127   atarigen_eeprom_default = NULL;
2128   atarigen_slapstic_init(0, 0x080000, 0, 105);
2128   atarigen_slapstic_init(machine, 0, 0x080000, 0, 105);
21292129
21302130   joystick_type = 1;   /* digital */
21312131   trackball_type = 0;   /* none */
r2864r2865
21372137   via_config(0, &via_interface);
21382138
21392139   atarigen_eeprom_default = NULL;
2140   atarigen_slapstic_init(0, 0x080000, 0, 108);
2140   atarigen_slapstic_init(machine, 0, 0x080000, 0, 108);
21412141
21422142   joystick_type = 2;   /* analog */
21432143   trackball_type = 0;   /* none */
r2864r2865
21492149   via_config(0, &via_interface);
21502150
21512151   atarigen_eeprom_default = NULL;
2152   atarigen_slapstic_init(0, 0x080000, 0, 109);
2152   atarigen_slapstic_init(machine, 0, 0x080000, 0, 109);
21532153
21542154   joystick_type = 3;   /* pedal */
21552155   trackball_type = 2;   /* steering wheel */
r2864r2865
21612161   via_config(0, &via_interface);
21622162
21632163   atarigen_eeprom_default = NULL;
2164   atarigen_slapstic_init(0, 0x080000, 0, 110);
2164   atarigen_slapstic_init(machine, 0, 0x080000, 0, 110);
21652165
21662166   joystick_type = 3;   /* pedal */
21672167   trackball_type = 2;   /* steering wheel */
src/mame/drivers/wgp.c
r2864r2865
394394***************************************************************************/
395395
396396#include "driver.h"
397#include "deprecat.h"
398397#include "taitoipt.h"
399398#include "cpu/m68000/m68000.h"
400399#include "video/taitoic.h"
r2864r2865
433432   COMBINE_DATA(&sharedram[offset]);
434433}
435434
436static void parse_control(void)
435static void parse_control(running_machine *machine)
437436{
438437   /* bit 0 enables cpu B */
439438   /* however this fails when recovering from a save state
440439       if cpu B is disabled !! */
441   cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
440   cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
442441
443442   /* bit 1 is "vibration" acc. to test mode */
444443}
r2864r2865
449448      data = data >> 8;   /* for Wgp */
450449   cpua_ctrl = data;
451450
452   parse_control();
451   parse_control(machine);
453452
454453   logerror("CPU #0 PC %06x: write %04x to cpu control\n",activecpu_get_pc(),data);
455454}
r2864r2865
937936
938937static STATE_POSTLOAD( wgp_postload )
939938{
940   parse_control();
939   parse_control(machine);
941940   reset_sound_region();
942941}
943942
src/mame/drivers/sprint8.c
r2864r2865
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "includes/sprint8.h"
109
1110static int steer_dir[8];
r2864r2865
1514static int collision_index;
1615
1716
18void sprint8_set_collision(int n)
17void sprint8_set_collision(running_machine *machine, int n)
1918{
2019   if (collision_reset == 0)
2120   {
22      cpunum_set_input_line(Machine, 0, 0, ASSERT_LINE);
21      cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
2322
2423      collision_index = n;
2524   }
src/mame/drivers/getrivia.c
r2864r2865
121121
122122static READ8_HANDLER( port1_r )
123123{
124   return input_port_read_indexed(machine, 1) | (ticket_dispenser_0_r(machine, 0) >> 5);
124   return input_port_read(machine, "IN0") | (ticket_dispenser_0_r(machine, 0) >> 5);
125125}
126126
127127static WRITE8_HANDLER( lamps_w )
r2864r2865
301301
302302
303303static INPUT_PORTS_START( gselect )
304   PORT_START      /* DSW A */
304   PORT_START_TAG("DSWA")
305305   PORT_DIPNAME( 0x01, 0x01, "Poker: Discard Cards" )
306306   PORT_DIPSETTING(    0x01, "5" )
307307   PORT_DIPSETTING(    0x00, "3" )
r2864r2865
336336   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
337337   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_IMPULSE(2) PORT_NAME ("Play / Raise")
338338
339   PORT_START   /* IN1 */
339   PORT_START_TAG("IN1")
340340   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_IMPULSE(2)
341341   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_IMPULSE(2)
342342   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_IMPULSE(2)
r2864r2865
347347   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_IMPULSE(2) PORT_NAME ("Stand")
348348/*  Button 8, 6, 7 order verified in test mode switch test */
349349
350   PORT_START
350   PORT_START_TAG("IN2")
351351   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
352352INPUT_PORTS_END
353353
r2864r2865
397397   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
398398   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
399399
400   PORT_START   /* IN1 */
400   PORT_START_TAG("IN1")
401401   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
402402   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
403403   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
src/mame/drivers/dec0.c
r2864r2865
7272         break;
7373
7474      case 6: /* Intel 8751 microcontroller - Bad Dudes, Heavy Barrel, Birdy Try only */
75         dec0_i8751_write(data);
75         dec0_i8751_write(machine, data);
7676         break;
7777
7878      case 8: /* Interrupt ack (VBL - IRQ 6) */
r2864r2865
696696   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
697697   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
698698
699   PORT_START_TAG("DSW1")
699   PORT_START_TAG("DSW0")
700700   DEC0_COIN_SETTING
701701   PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
702702   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
r2864r2865
709709   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
710710   PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
711711
712   PORT_START_TAG("DSW2")
712   PORT_START_TAG("DSW1")
713713   PORT_DIPNAME( 0x03, 0x03, "Energy" )
714714   PORT_DIPSETTING(    0x02, DEF_STR( Low ) )
715715   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )
src/mame/drivers/atarig42.c
r2864r2865
111111   if (ACCESSING_BITS_8_15)
112112   {
113113      /* bit 14 controls the ASIC65 reset line */
114      asic65_reset((~data >> 14) & 1);
114      asic65_reset(machine, (~data >> 14) & 1);
115115
116116      /* bits 13-11 are the MO control bits */
117117      atarirle_control_w(machine, 0, (data >> 11) & 7);
r2864r2865
689689      0x0118,0x0100,0x01C8,0x01D0,0x0000
690690   };
691691   atarigen_eeprom_default = default_eeprom;
692   atarijsa_init(machine, 2, 0x0040);
692   atarijsa_init(machine, "IN2", 0x0040);
693693   atarijsa3_init_adpcm(REGION_SOUND1);
694694
695695   atarig42_playfield_base = 0x400;
r2864r2865
699699   sloop_base = memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, roadriot_sloop_data_r, roadriot_sloop_data_w);
700700   memory_set_opbase_handler(0, sloop_opbase_handler);
701701
702   asic65_config(ASIC65_ROMBASED);
702   asic65_config(machine, ASIC65_ROMBASED);
703703/*
704704    Road Riot color MUX
705705
r2864r2865
739739      0x0109,0x0100,0x0108,0x0134,0x0105,0x0148,0x1400,0x0000
740740   };
741741   atarigen_eeprom_default = default_eeprom;
742   atarijsa_init(machine, 2, 0x0040);
742   atarijsa_init(machine, "IN2", 0x0040);
743743   atarijsa3_init_adpcm(REGION_SOUND1);
744744
745745   atarig42_playfield_base = 0x000;
r2864r2865
753753   sloop_base = memory_install_readwrite16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x000000, 0x07ffff, 0, 0, guardians_sloop_data_r, guardians_sloop_data_w);
754754   memory_set_opbase_handler(0, sloop_opbase_handler);
755755
756   asic65_config(ASIC65_GUARDIANS);
756   asic65_config(machine, ASIC65_GUARDIANS);
757757/*
758758    Guardians color MUX
759759
src/mame/drivers/vindictr.c
r2864r2865
111111 *************************************/
112112
113113static INPUT_PORTS_START( vindictr )
114   PORT_START_TAG("26000")
114   PORT_START_TAG("260000")
115115   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
116116   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
117117   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
r2864r2865
122122   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_2WAY PORT_PLAYER(1)
123123   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_2WAY PORT_PLAYER(1)
124124
125   PORT_START_TAG("26010")
125   PORT_START_TAG("260010")
126126   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_VBLANK )
127127   PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
128128   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
138138   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_2WAY PORT_PLAYER(2)
139139   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_2WAY PORT_PLAYER(2)
140140
141   PORT_START_TAG("26020")
141   PORT_START_TAG("260020")
142142   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
143143   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
144144   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
r2864r2865
541541static DRIVER_INIT( vindictr )
542542{
543543   atarigen_eeprom_default = NULL;
544   atarijsa_init(machine, 1, 0x0002);
544   atarijsa_init(machine, "260010", 0x0002);
545545}
546546
547547
src/mame/drivers/hanaawas.c
r2864r2865
4747   switch( mux )
4848   {
4949   case 1: /* start buttons */
50      buttons = input_port_read_indexed(machine, 4);
50      buttons = input_port_read(machine, "START");
5151      break;
5252   case 2: /* player 1 buttons */
53      buttons = input_port_read_indexed(machine, 2);
53      buttons = input_port_read(machine, "P1");
5454      break;
5555   case 4: /* player 2 buttons */
56      buttons = input_port_read_indexed(machine, 3);
56      buttons = input_port_read(machine, "P2");
5757      break;
5858   }
5959
r2864r2865
6969      }
7070   }
7171
72   return (input_port_read_indexed(machine, 0) & 0xf0) | ordinal;
72   return (input_port_read(machine, "IN0") & 0xf0) | ordinal;
7373}
7474
7575static WRITE8_HANDLER( hanaawas_inputs_mux_w )
r2864r2865
109109
110110
111111static INPUT_PORTS_START( hanaawas )
112   PORT_START      /* IN0 */
112   PORT_START_TAG("IN0")   /* IN0 */
113113   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL )
114114   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
115115   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
116116   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
117117   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
118118
119   PORT_START      /* DSW0 */
119   PORT_START_TAG("DSW")   /* DSW0 */
120120   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
121121   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
122122   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2864r2865
141141   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
142142
143143   /* fake port.  The button depressed gets converted to an integer in the 1-10 range */
144   PORT_START      /* IN2 */
144   PORT_START_TAG("P1")   /* IN2 */
145145   PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_BUTTON1  ) PORT_PLAYER(1)
146146   PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_BUTTON2  ) PORT_PLAYER(1)
147147   PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_BUTTON3  ) PORT_PLAYER(1)
r2864r2865
154154   PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_PLAYER(1)
155155
156156   /* fake port.  The button depressed gets converted to an integer in the 1-10 range */
157   PORT_START      /* IN3 */
157   PORT_START_TAG("P2")   /* IN3 */
158158   PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_BUTTON1  ) PORT_PLAYER(2)
159159   PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_BUTTON2  ) PORT_PLAYER(2)
160160   PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_BUTTON3  ) PORT_PLAYER(2)
r2864r2865
166166   PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_BUTTON9  ) PORT_PLAYER(2)
167167   PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_PLAYER(2)
168168
169   PORT_START      /* IN4 */
169   PORT_START_TAG("START")   /* IN4 */
170170   PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_START1 )
171171   PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_START2 )
172172INPUT_PORTS_END
src/mame/drivers/hshavoc.c
r2864r2865
4141
4242
4343static INPUT_PORTS_START( hshavoc )
44   PORT_START   /* 16bit */
44   PORT_START_TAG("IN0")   /* 16bit */
4545   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Unknown ) )
4646   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
4747   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
src/mame/drivers/midvunit.c
r2864r2865
397397
398398static WRITE32_HANDLER( offroadc_serial_data_w )
399399{
400   midway_serial_pic2_w(data >> 16);
400   midway_serial_pic2_w(machine, data >> 16);
401401}
402402
403403
r2864r2865
14291429   memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x994000, 0x994000, 0, 0, crusnwld_control_w);
14301430
14311431   /* valid values are 450 or 460 */
1432   midway_serial_pic_init(450);
1432   midway_serial_pic_init(machine, 450);
14331433   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x991030, 0x991030, 0, 0, offroadc_serial_status_r);
14341434   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x996000, 0x996000, 0, 0, offroadc_serial_data_r);
14351435   memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x996000, 0x996000, 0, 0, offroadc_serial_data_w);
r2864r2865
14571457   memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x994000, 0x994000, 0, 0, crusnwld_control_w);
14581458
14591459   /* valid values are 230 or 234 */
1460   midway_serial_pic2_init(230, 94);
1460   midway_serial_pic2_init(machine, 230, 94);
14611461   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x991030, 0x991030, 0, 0, offroadc_serial_status_r);
14621462   memory_install_readwrite32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x996000, 0x996000, 0, 0, offroadc_serial_data_r, offroadc_serial_data_w);
14631463
r2864r2865
14721472
14731473   /* initialize the subsystems */
14741474   dcs2_init(machine, 2, 0x3839);
1475   midway_ioasic_init(0, 452/* no alternates */, 94, NULL);
1475   midway_ioasic_init(machine, 0, 452/* no alternates */, 94, NULL);
14761476   adc_shift = 16;
14771477
14781478   /* we need proper VRAM */
src/mame/drivers/littlerb.c
r2864r2865
5959*/
6060
6161#include "driver.h"
62#include "deprecat.h"
6362
6463static UINT16 littlerb_vdp_address_low;
6564static UINT16 littlerb_vdp_address_high;
r2864r2865
7877static UINT16* littlerb_region4;
7978
8079
81static void littlerb_data_write(UINT16 data)
80static void littlerb_data_write(running_machine *machine, UINT16 data)
8281{
8382   UINT32 addr = littlerb_write_address>>4; // is this right? should we shift?
8483
r2864r2865
105104         r = littlerb_region2[x+1];
106105         g = littlerb_region2[x+2];
107106
108         palette_set_color(Machine,x/3,MAKE_RGB(r,g,b));
107         palette_set_color(machine,x/3,MAKE_RGB(r,g,b));
109108      }
110109
111110
r2864r2865
175174
176175
177176      case 2:
178      littlerb_data_write(data);
177      littlerb_data_write(machine, data);
179178      break;
180179
181180      case 3:
src/mame/drivers/firebeat.c
r2864r2865
109109*/
110110
111111#include "driver.h"
112#include "deprecat.h"
113112#include "cpu/powerpc/ppc.h"
114113#include "machine/intelfsh.h"
115114#include "machine/scsicd.h"
r2864r2865
679678
680679   if (ACCESSING_BITS_24_31)
681680   {
682      r |= (input_port_read_indexed(machine, 0) & 0xff) << 24;
681      r |= (input_port_read(machine, "IN0") & 0xff) << 24;
683682   }
684683   if (ACCESSING_BITS_8_15)
685684   {
686      r |= (input_port_read_indexed(machine, 1) & 0xff) << 8;
685      r |= (input_port_read(machine, "IN1") & 0xff) << 8;
687686   }
688687   if (ACCESSING_BITS_0_7)
689688   {
690      r |= (input_port_read_indexed(machine, 2) & 0xff);
689      r |= (input_port_read(machine, "IN2") & 0xff);
691690   }
692691
693692   return r;
r2864r2865
697696{
698697   if (offset == 0)
699698   {
700      return input_port_read_indexed(machine, 3) | 0x01000100;
699      return input_port_read(machine, "SENSOR1") | 0x01000100;
701700   }
702701   else
703702   {
704      return input_port_read_indexed(machine, 4) | 0x01000100;
703      return input_port_read(machine, "SENSOR2") | 0x01000100;
705704   }
706705}
707706
r2864r2865
855854static int atapi_data_ptr, atapi_xferlen, atapi_xfermod, atapi_cdata_wait;
856855static int atapi_drivesel;
857856
858static void atapi_cause_irq(void)
857static void atapi_cause_irq(running_machine *machine)
859858{
860   cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ4, ASSERT_LINE);
859   cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ4, ASSERT_LINE);
861860}
862861
863static void atapi_clear_irq(void)
862static void atapi_clear_irq(running_machine *machine)
864863{
865   cpunum_set_input_line(Machine, 0, INPUT_LINE_IRQ4, CLEAR_LINE);
864   cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ4, CLEAR_LINE);
866865}
867866
868867static void atapi_exit(running_machine* machine)
r2864r2865
905904
906905
907906
908static UINT16 atapi_command_reg_r(int reg)
907static UINT16 atapi_command_reg_r(running_machine *machine, int reg)
909908{
910909   int i, data;
911910   static UINT8 temp_data[64*1024];
r2864r2865
918917      if (atapi_data_ptr == 0)
919918      {
920919         //printf("ATAPI: dropping DRQ\n");
921         atapi_cause_irq();
920         atapi_cause_irq(machine);
922921         atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
923922
924923         // get the data from the device
r2864r2865
938937      if (atapi_xfermod && atapi_data_ptr == (atapi_xferlen/2))
939938      {
940939         //printf("ATAPI: DRQ interrupt\n");
941         atapi_cause_irq();
940         atapi_cause_irq(machine);
942941         atapi_regs[ATAPI_REG_CMDSTATUS] |= ATAPI_STAT_DRQ;
943942         atapi_data_ptr = 0;
944943
r2864r2865
963962   else
964963   {
965964      if (reg == ATAPI_REG_CMDSTATUS)
966         atapi_clear_irq();
965         atapi_clear_irq(machine);
967966      return atapi_regs[reg];
968967   }
969968}
970969
971static void atapi_command_reg_w(int reg, UINT16 data)
970static void atapi_command_reg_w(running_machine *machine, int reg, UINT16 data)
972971{
973972   int i;
974973
r2864r2865
994993            SCSIWriteData( atapi_device_data[atapi_drivesel], atapi_scsi_packet, atapi_cdata_wait );
995994
996995            // assert IRQ
997            atapi_cause_irq();
996            atapi_cause_irq(machine);
998997
999998            // not sure here, but clear DRQ at least?
1000999            atapi_regs[ATAPI_REG_CMDSTATUS] = 0;
r2864r2865
10111010         atapi_regs[ATAPI_REG_CMDSTATUS] |= ATAPI_STAT_BSY;
10121011
10131012         // assert IRQ
1014         atapi_cause_irq();
1013         atapi_cause_irq(machine);
10151014
10161015         // decompose SCSI packet into proper byte order
10171016         for (i = 0; i < 16; i += 2)
r2864r2865
11731172//  printf("atapi_command_r: %08X, %08X\n", offset, mem_mask);
11741173   if (ACCESSING_BITS_16_31)
11751174   {
1176      r = atapi_command_reg_r(offset*2);
1175      r = atapi_command_reg_r(machine, offset*2);
11771176      return ATAPI_ENDIAN(r) << 16;
11781177   }
11791178   else
11801179   {
1181      r = atapi_command_reg_r((offset*2) + 1);
1180      r = atapi_command_reg_r(machine, (offset*2) + 1);
11821181      return ATAPI_ENDIAN(r) << 0;
11831182   }
11841183}
r2864r2865
11891188
11901189   if (ACCESSING_BITS_16_31)
11911190   {
1192      atapi_command_reg_w(offset*2, ATAPI_ENDIAN((data >> 16) & 0xffff));
1191      atapi_command_reg_w(machine, offset*2, ATAPI_ENDIAN((data >> 16) & 0xffff));
11931192   }
11941193   else
11951194   {
1196      atapi_command_reg_w((offset*2) + 1, ATAPI_ENDIAN((data >> 0) & 0xffff));
1195      atapi_command_reg_w(machine, (offset*2) + 1, ATAPI_ENDIAN((data >> 0) & 0xffff));
11971196   }
11981197}
11991198
r2864r2865
13951394{
13961395   if (offset == 0)      // Keyboard Wheel (P1)
13971396   {
1398      return input_port_read_indexed(machine, 3) << 24;
1397      return input_port_read(machine, "WHEEL_P1") << 24;
13991398   }
14001399   else if (offset == 2)   // Keyboard Wheel (P2)
14011400   {
1402      return input_port_read_indexed(machine, 4) << 24;
1401      return input_port_read(machine, "WHEEL_P2") << 24;
14031402   }
14041403
14051404   return 0;
r2864r2865
14821481static TIMER_CALLBACK( keyboard_timer_callback )
14831482{
14841483   static const int kb_uart_channel[2] = { 1, 0 };
1484   static const char *keynames[] = { "KEYBOARD_P1", "KEYBOARD_P2" };
14851485   int keyboard;
14861486   int i;
14871487
14881488   for (keyboard=0; keyboard < 2; keyboard++)
14891489   {
1490      UINT32 kbstate = input_port_read_indexed(machine, 5 + keyboard);
1490      UINT32 kbstate = input_port_read(machine, keynames[keyboard]);
14911491      int uart_channel = kb_uart_channel[keyboard];
14921492
14931493      if (kbstate != keyboard_state[keyboard])
src/mame/drivers/eolith.c
r2864r2865
104104    */
105105   eolith_speedup_read();
106106
107   return (input_port_read_indexed(machine, 0) & ~0x308) | (eeprom_read_bit() << 3) | (mame_rand(machine) & 0x300);
107   return (input_port_read(machine, "IN0") & ~0x308) | (eeprom_read_bit() << 3) | (mame_rand(machine) & 0x300);
108108}
109109
110110static WRITE32_HANDLER( systemcontrol_w )
src/mame/drivers/bagman.c
r2864r2865
223223   AM_RANGE(0xa800, 0xa800) AM_READ(input_port_2_r)
224224
225225
226   AM_RANGE(0xa005, 0xa005) AM_WRITE(SMH_NOP)   /* ???? */
227   AM_RANGE(0xa006, 0xa006) AM_WRITE(SMH_NOP)   /* ???? */
228   AM_RANGE(0xa007, 0xa007) AM_WRITE(SMH_NOP)   /* ???? */
226229
227#if 0
228   AM_RANGE(0xa007, 0xa007) AM_WRITE(SMH_NOP)   /* ???? */
229   AM_RANGE(0xb000, 0xb000) AM_WRITE(SMH_NOP)   /* ???? */
230   AM_RANGE(0xb800, 0xb800) AM_READ(SMH_NOP) /* ???? */
231   AM_RANGE(0xb800, 0xb800) AM_WRITE(SMH_NOP)   /* ???? */
232#endif
230   /* guess */
231   AM_RANGE(0xb000, 0xb000) AM_WRITE(AY8910_control_port_1_w)
232   AM_RANGE(0xb800, 0xb800) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w)
233233ADDRESS_MAP_END
234234
235235static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
r2864r2865
342342INPUT_PORTS_END
343343
344344
345static INPUT_PORTS_START( squaitsa )
346   PORT_START_TAG("IN0")
347    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
348    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
349    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
350    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
351    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
352    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY // these must be tied to a spinner somehow?
353    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY // ^
354    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
345355
356    PORT_START_TAG("IN1")
357    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
358    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
359    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
360    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
361    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
362    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL // these must be tied to a spinner somehow?
363    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL // ^
364   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
365
366   PORT_START_TAG("DSW")
367    PORT_DIPNAME(    0x01, 0x01, DEF_STR( Unknown ) )
368    PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
369    PORT_DIPSETTING( 0x00, DEF_STR( On ) )
370    PORT_DIPNAME(    0x02, 0x02, DEF_STR( Unknown ) )
371    PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
372    PORT_DIPSETTING( 0x00, DEF_STR( On ) )
373    PORT_DIPNAME(    0x04, 0x04, DEF_STR( Unknown ) )
374    PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
375    PORT_DIPSETTING( 0x00, DEF_STR( On ) )
376    PORT_DIPNAME(    0x08, 0x08, DEF_STR( Unknown ) )
377    PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
378    PORT_DIPSETTING( 0x00, DEF_STR( On ) )
379    PORT_DIPNAME(    0x10, 0x10, DEF_STR( Unknown ) )
380    PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
381    PORT_DIPSETTING( 0x00, DEF_STR( On ) )
382    PORT_DIPNAME(    0x20, 0x20, DEF_STR( Unknown ) )
383    PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
384    PORT_DIPSETTING( 0x00, DEF_STR( On ) )
385    PORT_DIPNAME(    0x40, 0x40, DEF_STR( Unknown ) )
386    PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
387    PORT_DIPSETTING( 0x00, DEF_STR( On ) )
388    PORT_DIPNAME(    0x80, 0x00, "Protection?" )
389    PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
390    PORT_DIPSETTING( 0x00, DEF_STR( On ) )
391INPUT_PORTS_END
392
346393static const gfx_layout charlayout =
347394{
348395   8,8,   /* 8*8 characters */
r2864r2865
392439   NULL
393440};
394441
442static const struct AY8910interface ay8910_interface_2 =
443{
444   AY8910_LEGACY_OUTPUT,
445   AY8910_DEFAULT_LOADS,
446   NULL,
447   NULL,
448   NULL,
449   NULL
450};
451
395452static const struct TMS5110interface tms5110_interface =
396453{
397454   -1,      /* ROM_REGION */
r2864r2865
464521   MDRV_SOUND_ADD(AY8910, 1500000)
465522   MDRV_SOUND_CONFIG(ay8910_interface)
466523   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
524
525   /* maybe */
526   MDRV_SOUND_ADD(AY8910, 1500000)
527   MDRV_SOUND_CONFIG(ay8910_interface_2)
528   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
467529MACHINE_DRIVER_END
468530
469531/*
r2864r2865
514576   MDRV_SOUND_ADD(AY8910, 1500000)
515577   MDRV_SOUND_CONFIG(ay8910_interface)
516578   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
579
580   MDRV_SOUND_ADD(AY8910, 1500000)
581   MDRV_SOUND_CONFIG(ay8910_interface_2)
582   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
517583MACHINE_DRIVER_END
518584
519585/***************************************************************************
r2864r2865
847913GAME( 1984, sbagmans, sbagman, bagman,  sbagman, 0,        ROT270, "Valadon Automation (Stern license)", "Super Bagman (Stern)", 0 )
848914GAME( 1983, pickin,     0,      pickin,  pickin,  0,        ROT270, "Valadon Automation", "Pickin'", 0 )
849915GAME( 1984, botanic,  0,       botanic, botanic, 0,        ROT270, "Valadon Automation (Itisa license)", "Botanic", 0 )
850GAME( 1984, squaitsa,  0,       botanic, botanic, 0,        ROT0, "Itisa", "Squash (Itisa)", GAME_NOT_WORKING )
916GAME( 1984, squaitsa,  0,       botanic, squaitsa, 0,        ROT0, "Itisa", "Squash (Itisa)", GAME_NOT_WORKING )
851917
src/mame/drivers/namcos23.c
r2864r2865
500500
501501
502502#include "driver.h"
503#include "deprecat.h"
504503#include "cpu/mips/mips3.h"
505504#include "cpu/h83002/h83002.h"
506505#include "sound/c352.h"
r2864r2865
732731   return (pSource[0]<<((offs&3)*8))>>24;
733732}
734733
735INLINE void UpdatePalette( int entry )
734INLINE void UpdatePalette( running_machine *machine, int entry )
736735{
737736         int j;
738737
r2864r2865
742741      int r = nthbyte(paletteram32,which+0x00001);
743742      int g = nthbyte(paletteram32,which+0x08001);
744743      int b = nthbyte(paletteram32,which+0x18001);
745      palette_set_color( Machine,which,MAKE_RGB(r,g,b) );
744      palette_set_color( machine,which,MAKE_RGB(r,g,b) );
746745   }
747746}
748747
r2864r2865
757756{
758757   COMBINE_DATA( &paletteram32[offset] );
759758
760   UpdatePalette((offset % (0x8000/4))*2);
759   UpdatePalette(machine, (offset % (0x8000/4))*2);
761760}
762761
763762// must return this magic number
src/mame/drivers/inufuku.c
r2864r2865
158158
159159   soundflag = pending_command ? 0x0000 : 0x0080;   // bit7
160160   eeprom = (eeprom_read_bit() & 1) << 6;         // bit6
161   inputport = input_port_read_indexed(machine, 4) & 0xff3f;         // bit5-0
161   inputport = input_port_read(machine, "IN1") & 0xff3f;   // bit5-0
162162
163163   return (soundflag | eeprom | inputport);
164164}
r2864r2865
269269******************************************************************************/
270270
271271static INPUT_PORTS_START( inufuku )
272   PORT_START   // 0
272   PORT_START_TAG("P1")   // 0
273273   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
274274   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
275275   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
r2864r2865
279279   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
280280   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
281281
282   PORT_START   // 1
282   PORT_START_TAG("P2")   // 1
283283   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
284284   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
285285   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
r2864r2865
289289   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
290290   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
291291
292   PORT_START   // 2
292   PORT_START_TAG("IN0")   // 2
293293   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
294294   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
295295   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
r2864r2865
299299   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
300300   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
301301
302   PORT_START   // 3
302   PORT_START_TAG("P4")   // 3
303303   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4)
304304   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)
305305   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
r2864r2865
309309   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
310310   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4)
311311
312   PORT_START   // 4
312   PORT_START_TAG("IN1")   // 4
313313   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
314314   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
315315   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 )
r2864r2865
321321   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
322322   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   // pending sound command
323323
324   PORT_START   // 5
324   PORT_START_TAG("P3")   // 5
325325   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3)
326326   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3)
327327   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)
src/mame/drivers/atarisy2.c
r2864r2865
30333033   UINT8 *cpu1 = memory_region(REGION_CPU1);
30343034
30353035   atarigen_eeprom_default = compressed_default_eeprom;
3036   slapstic_init(105);
3036   slapstic_init(machine, 105);
30373037
30383038   /* expand the 16k program ROMs into full 64k chunks */
30393039   for (i = 0x10000; i < 0x90000; i += 0x20000)
r2864r2865
30803080      0x0000
30813081   };
30823082   atarigen_eeprom_default = compressed_default_eeprom;
3083   slapstic_init(107);
3083   slapstic_init(machine, 107);
30843084
30853085   pedal_count = -1;
30863086   has_tms5220 = 1;
r2864r2865
30933093   UINT8 *cpu1 = memory_region(REGION_CPU1);
30943094
30953095   atarigen_eeprom_default = default_eeprom;
3096   slapstic_init(108);
3096   slapstic_init(machine, 108);
30973097
30983098   /* expand the 32k program ROMs into full 64k chunks */
30993099   for (i = 0x10000; i < 0x90000; i += 0x20000)
r2864r2865
32173217   UINT8 *cpu1 = memory_region(REGION_CPU1);
32183218
32193219   atarigen_eeprom_default = compressed_default_eeprom;
3220   slapstic_init(109);
3220   slapstic_init(machine, 109);
32213221
32223222   /* expand the 32k program ROMs into full 64k chunks */
32233223   for (i = 0x10000; i < 0x90000; i += 0x20000)
r2864r2865
32313231static DRIVER_INIT( apb )
32323232{
32333233   atarigen_eeprom_default = NULL;
3234   slapstic_init(110);
3234   slapstic_init(machine, 110);
32353235
32363236   pedal_count = 2;
32373237   has_tms5220 = 1;
src/mame/drivers/onetwo.c
r2864r2865
4040*/
4141
4242#include "driver.h"
43#include "deprecat.h"
4443#include "sound/okim6295.h"
4544#include "sound/3812intf.h"
4645
r2864r2865
8382   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
8483}
8584
86static void setColor(int offset)
85static void setColor(running_machine *machine, int offset)
8786{
8887      int r,g,b;
8988      r=paletteram[offset]&0x1f;
9089      g=paletteram_2[offset]&0x1f;
9190      b=((paletteram[offset]&0x60)>>2)|((paletteram_2[offset]&0xe0)>>5);
92      palette_set_color_rgb(Machine,offset,pal5bit(r),pal5bit(g),pal5bit(b));
91      palette_set_color_rgb(machine,offset,pal5bit(r),pal5bit(g),pal5bit(b));
9392}
9493
9594static WRITE8_HANDLER(palette1_w)
9695{
9796   paletteram[offset]=data;
98   setColor(offset);
97   setColor(machine, offset);
9998}
10099
101100static WRITE8_HANDLER(palette2_w)
102101{
103102   paletteram_2[offset]=data;
104   setColor(offset);
103   setColor(machine, offset);
105104}
106105
107106/* Main CPU */
src/mame/drivers/liberate.c
r2864r2865
126126ADDRESS_MAP_END
127127
128128static ADDRESS_MAP_START( deco16_readport, ADDRESS_SPACE_IO, 8 )
129   AM_RANGE(0x00, 0x00) AM_READ(input_port_0_r)
129   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0")
130130ADDRESS_MAP_END
131131
132132static ADDRESS_MAP_START( deco16_writeport, ADDRESS_SPACE_IO, 8 )
r2864r2865
134134ADDRESS_MAP_END
135135
136136static ADDRESS_MAP_START( liberatb_readmem, ADDRESS_SPACE_PROGRAM, 8 )
137   AM_RANGE(0x00fe, 0x00fe) AM_READ(input_port_0_r)
137   AM_RANGE(0x00fe, 0x00fe) AM_READ_PORT("IN0")
138138   AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM)
139139   AM_RANGE(0x1000, 0x3fff) AM_READ(SMH_ROM) /* Mirror of main rom */
140140   AM_RANGE(0x4000, 0x7fff) AM_READ(deco16_bank_r)
141   AM_RANGE(0xf000, 0xf000) AM_READ(input_port_1_r)
142   AM_RANGE(0xf001, 0xf001) AM_READ(input_port_2_r)
143   AM_RANGE(0xf002, 0xf002) AM_READ(input_port_3_r)
144   AM_RANGE(0xf003, 0xf003) AM_READ(input_port_4_r)
145   AM_RANGE(0xf004, 0xf004) AM_READ(input_port_5_r)
141   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("IN1")
142   AM_RANGE(0xf001, 0xf001) AM_READ_PORT("IN2")
143   AM_RANGE(0xf002, 0xf002) AM_READ_PORT("IN3")
144   AM_RANGE(0xf003, 0xf003) AM_READ_PORT("DSW1")
145   AM_RANGE(0xf004, 0xf004) AM_READ_PORT("DSW2")
146146   AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
147147ADDRESS_MAP_END
148148
r2864r2865
497497
498498static INTERRUPT_GEN( deco16_interrupt )
499499{
500   static int latch=0;
501   int p=~input_port_read_indexed(machine, 3);
502   if (p&0x43 && !latch) {
503      cpunum_set_input_line(machine, 0,DECO16_IRQ_LINE,ASSERT_LINE);
504      latch=1;
505   } else {
506      if (!(p&0x43))
500   static int latch = 0;
501   int p = ~input_port_read(machine, "IN3");
502   if ((p & 0x43) && !latch)
503   {
504      cpunum_set_input_line(machine, 0, DECO16_IRQ_LINE, ASSERT_LINE);
505      latch = 1;
506   }
507   else
508   {
509      if (!(p & 0x43))
507510         latch=0;
508511   }
509512}
src/mame/drivers/laserbat.c
r2864r2865
8989
9090static READ8_HANDLER( laserbat_input_r )
9191{
92   // Add coktail inputs
93   return input_port_read_indexed(machine, 0 + laserbat_input_mux);
92   static const char *portnames[] = { "IN0", "IN1", "IN2", "IN3" };
93
94   return input_port_read(machine, portnames[laserbat_input_mux]);
9495}
9596
9697static WRITE8_HANDLER( laserbat_cnteff_w )
r2864r2865
221222
222223
223224static INPUT_PORTS_START( laserbat )
224   PORT_START
225   PORT_START_TAG("IN0")
225226   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
226227   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
227228   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r2864r2865
231232   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
232233   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )
233234
234   PORT_START
235   PORT_START_TAG("IN1")
235236   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
236237   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
237238   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
253254   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
254255   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Reset")
255256
256   PORT_START
257   PORT_START_TAG("IN2")
257258   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
258259   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
259260   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
r2864r2865
277278   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
278279   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
279280
280   PORT_START
281   PORT_START_TAG("IN3")
281282   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
282283   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
283284   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
295296   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
296297   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
297298
298   PORT_START   /* SENSE */
299   PORT_START_TAG("SENSE")   /* SENSE */
299300   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
300301INPUT_PORTS_END
301302
302303static INPUT_PORTS_START( lazarian )
303   PORT_START
304   PORT_START_TAG("IN0")
304305   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
305306   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
306307   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r2864r2865
310311   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
311312   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )
312313
313   PORT_START
314   PORT_START_TAG("IN1")
314315   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
315316   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
316317   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
332333   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
333334   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Reset")
334335
335   PORT_START
336   PORT_START_TAG("IN2")
336337   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Coin_A ) )
337338   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
338339   PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
r2864r2865
355356   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
356357   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
357358
358   PORT_START
359   PORT_START_TAG("IN3")
359360   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
360361   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
361362   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
373374   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
374375   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
375376
376   PORT_START   /* SENSE */
377   PORT_START_TAG("SENSE")   /* SENSE */
377378   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
378379INPUT_PORTS_END
379380
380381static INPUT_PORTS_START( catnmous )
381   PORT_START
382   PORT_START_TAG("IN0")
382383   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
383384   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
384385   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r2864r2865
388389   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )
389390   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
390391
391   PORT_START
392   PORT_START_TAG("IN1")
392393   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
393394   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
394395   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
406407   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
407408   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Reset")
408409
409   PORT_START
410   PORT_START_TAG("IN2")
410411   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
411412   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
412413   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
r2864r2865
430431   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
431432   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
432433
433   PORT_START
434   PORT_START_TAG("IN3")
434435   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
435436   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
436437   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
456457   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
457458   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
458459
459   PORT_START   /* SENSE */
460   PORT_START_TAG("SENSE")   /* SENSE */
460461   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
461462INPUT_PORTS_END
462463
src/mame/drivers/rohga.c
r2864r2865
124124VIDEO_UPDATE( nitrobal );
125125WRITE16_HANDLER( rohga_buffer_spriteram16_w );
126126
127static READ16_HANDLER( rohga_dip3_r ) { return input_port_read_indexed(machine, 3); }
128static READ16_HANDLER( nitrobal_control_r ) { return input_port_read_indexed(machine, 3); }
129static READ16_HANDLER( schmeisr_control_r ) { return input_port_read_indexed(machine, 1); }
127static READ16_HANDLER( rohga_dip3_r ) { return input_port_read(machine, "DSW3"); }
128static READ16_HANDLER( nitrobal_control_r ) { return input_port_read(machine, "DSW3"); }
129static READ16_HANDLER( schmeisr_control_r ) { return input_port_read(machine, "IN1"); }
130130
131131/**********************************************************************************/
132132
r2864r2865
349349/**********************************************************************************/
350350
351351static INPUT_PORTS_START( rohga )
352   PORT_START
352   PORT_START_TAG("IN0")
353353   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
354354   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
355355   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2864r2865
367367   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
368368   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
369369
370   PORT_START
370   PORT_START_TAG("IN1")
371371   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
372372   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
373373   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
374374   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK )
375375
376   PORT_START   /* Dip switch bank 1/2 */
376   PORT_START_TAG("DSW1_2")      /* Dip switch bank 1/2 */
377377   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
378378   PORT_DIPSETTING(      0x0000, DEF_STR( 3C_1C ) )
379379   PORT_DIPSETTING(      0x0001, DEF_STR( 2C_1C ) )
r2864r2865
422422   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
423423   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
424424
425   PORT_START   /* Dip switch bank 3 */
425   PORT_START_TAG("DSW3")      /* Dip switch bank 3 */
426426   PORT_DIPNAME( 0x0001, 0x0001, "Stage Clear Bonus" ) /* Life Recovery At stage clear */
427427   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
428428   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
447447INPUT_PORTS_END
448448
449449static INPUT_PORTS_START( wizdfire )
450   PORT_START
450   PORT_START_TAG("IN0")
451451   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
452452   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
453453   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2864r2865
465465   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
466466   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
467467
468   PORT_START
468   PORT_START_TAG("IN1")
469469   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
470470   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
471471   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
472472   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK )
473473
474   PORT_START   /* Dip switch bank 1/2 */
474   PORT_START_TAG("DSW1_2")      /* Dip switch bank 1/2 */
475475   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
476476   PORT_DIPSETTING(      0x0000, DEF_STR( 3C_1C ) )
477477   PORT_DIPSETTING(      0x0001, DEF_STR( 2C_1C ) )
r2864r2865
520520INPUT_PORTS_END
521521
522522static INPUT_PORTS_START( nitrobal )
523   PORT_START
523   PORT_START_TAG("IN0")
524524   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
525525   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
526526   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2864r2865
538538   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
539539   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
540540
541   PORT_START
541   PORT_START_TAG("IN1")
542542   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
543543   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
544544   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
545545   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK )
546546
547   PORT_START   /* Dip switch bank 1/2 */
547   PORT_START_TAG("DSW1_2")      /* Dip switch bank 1/2 */
548548   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
549549   PORT_DIPSETTING(      0x0000, DEF_STR( 3C_1C ) )
550550   PORT_DIPSETTING(      0x0001, DEF_STR( 2C_1C ) )
r2864r2865
592592   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
593593   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
594594
595   PORT_START
595   PORT_START_TAG("DSW3")       /* Not really a DSW, but this way it's easier to read by tag */
596596   PORT_BIT( 0x1, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
597597   PORT_BIT( 0x2, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
598598   PORT_BIT( 0x4, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
r2864r2865
604604INPUT_PORTS_END
605605
606606static INPUT_PORTS_START( schmeisr )
607   PORT_START
607   PORT_START_TAG("IN0")
608608   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
609609   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
610610   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2864r2865
622622   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
623623   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
624624
625   PORT_START
625   PORT_START_TAG("IN1")
626626   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
627627   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
628628   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
629629   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK )
630630
631   PORT_START   /* Dip switch bank 1/2 */
631   PORT_START_TAG("DSW1_2")      /* Dip switch bank 1/2 */
632632   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
633633   PORT_DIPSETTING(      0x0000, DEF_STR( 3C_1C ) )
634634   PORT_DIPSETTING(      0x0001, DEF_STR( 2C_1C ) )
r2864r2865
676676   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
677677   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
678678
679   PORT_START   /* Dip switch bank 3 - This bank of switches are _NOT_ shown in the test mode screen */
679   PORT_START_TAG("DSW3")   /* Dip switch bank 3 - This bank of switches are _NOT_ shown in the test mode screen */
680680   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
681681   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
682682   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
src/mame/drivers/batman.c
r2864r2865
353353      0x01D0,0x02C8,0x0000
354354   };
355355   atarigen_eeprom_default = default_eeprom;
356   atarijsa_init(machine, 2, 0x0040);
356   atarijsa_init(machine, "260010", 0x0040);
357357   atarijsa3_init_adpcm(REGION_SOUND1);
358358}
359359
src/mame/drivers/stv.c
r2864r2865
235235           scu_size_1,      /* lv 1*/
236236           scu_size_2;      /* lv 2*/
237237
238static void dma_direct_lv0(void);   /*DMA level 0 direct transfer function*/
239static void dma_direct_lv1(void);   /*DMA level 1 direct transfer function*/
240static void dma_direct_lv2(void);   /*DMA level 2 direct transfer function*/
241static void dma_indirect_lv0(void); /*DMA level 0 indirect transfer function*/
242static void dma_indirect_lv1(void); /*DMA level 1 indirect transfer function*/
243static void dma_indirect_lv2(void); /*DMA level 2 indirect transfer function*/
238static void dma_direct_lv0(running_machine *machine);   /*DMA level 0 direct transfer function*/
239static void dma_direct_lv1(running_machine *machine);   /*DMA level 1 direct transfer function*/
240static void dma_direct_lv2(running_machine *machine);   /*DMA level 2 direct transfer function*/
241static void dma_indirect_lv0(running_machine *machine); /*DMA level 0 indirect transfer function*/
242static void dma_indirect_lv1(running_machine *machine); /*DMA level 1 indirect transfer function*/
243static void dma_indirect_lv2(running_machine *machine); /*DMA level 2 indirect transfer function*/
244244
245245
246246int minit_boost,sinit_boost;
r2864r2865
12341234*/
12351235      if(stv_scu[4] & 1 && ((stv_scu[5] & 7) == 7) && stv_scu[4] & 0x100)
12361236      {
1237         if(DIRECT_MODE(0)) { dma_direct_lv0(); }
1238         else            { dma_indirect_lv0(); }
1237         if(DIRECT_MODE(0)) { dma_direct_lv0(machine); }
1238         else            { dma_indirect_lv0(machine); }
12391239
12401240         stv_scu[4]^=1;//disable starting bit.
12411241
r2864r2865
12951295      case 12:
12961296      if(stv_scu[12] & 1 && ((stv_scu[13] & 7) == 7) && stv_scu[12] & 0x100)
12971297      {
1298         if(DIRECT_MODE(1)) { dma_direct_lv1(); }
1299         else            { dma_indirect_lv1(); }
1298         if(DIRECT_MODE(1)) { dma_direct_lv1(machine); }
1299         else            { dma_indirect_lv1(machine); }
13001300
13011301         stv_scu[12]^=1;
13021302
r2864r2865
13451345      case 20:
13461346      if(stv_scu[20] & 1 && ((stv_scu[21] & 7) == 7) && stv_scu[20] & 0x100)
13471347      {
1348         if(DIRECT_MODE(2)) { dma_direct_lv2(); }
1349         else            { dma_indirect_lv2(); }
1348         if(DIRECT_MODE(2)) { dma_direct_lv2(machine); }
1349         else            { dma_indirect_lv2(machine); }
13501350
13511351         stv_scu[20]^=1;
13521352
r2864r2865
13751375      /*DSP section*/
13761376      /*Use functions so it is easier to work out*/
13771377      case 32:
1378      dsp_prg_ctrl(data);
1378      dsp_prg_ctrl(machine, data);
13791379      if(LOG_SCU) logerror("SCU DSP: Program Control Port Access %08x\n",data);
13801380      break;
13811381      case 33:
r2864r2865
14341434   }
14351435}
14361436
1437static void dma_direct_lv0()
1437static void dma_direct_lv0(running_machine *machine)
14381438{
14391439   static UINT32 tmp_src,tmp_dst,tmp_size;
14401440   if(LOG_SCU) logerror("DMA lv 0 transfer START\n"
r2864r2865
15321532
15331533   if(LOG_SCU) logerror("DMA transfer END\n");
15341534   if(!(stv_scu[40] & 0x800))/*Lv 0 DMA end irq*/
1535      cpunum_set_input_line_and_vector(Machine, 0, 5, HOLD_LINE , 0x4b);
1535      cpunum_set_input_line_and_vector(machine, 0, 5, HOLD_LINE , 0x4b);
15361536
15371537   if(scu_add_tmp & 0x80000000)
15381538   {
r2864r2865
15441544   D0MV_0;
15451545}
15461546
1547static void dma_direct_lv1()
1547static void dma_direct_lv1(running_machine *machine)
15481548{
15491549   static UINT32 tmp_src,tmp_dst,tmp_size;
15501550   if(LOG_SCU) logerror("DMA lv 1 transfer START\n"
r2864r2865
16351635
16361636   if(LOG_SCU) logerror("DMA transfer END\n");
16371637   if(!(stv_scu[40] & 0x400))/*Lv 1 DMA end irq*/
1638      cpunum_set_input_line_and_vector(Machine, 0, 6, HOLD_LINE , 0x4a);
1638      cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x4a);
16391639
16401640   if(scu_add_tmp & 0x80000000)
16411641   {
r2864r2865
16471647   D1MV_0;
16481648}
16491649
1650static void dma_direct_lv2()
1650static void dma_direct_lv2(running_machine *machine)
16511651{
16521652   static UINT32 tmp_src,tmp_dst,tmp_size;
16531653   if(LOG_SCU) logerror("DMA lv 2 transfer START\n"
r2864r2865
17381738
17391739   if(LOG_SCU) logerror("DMA transfer END\n");
17401740   if(!(stv_scu[40] & 0x200))/*Lv 2 DMA end irq*/
1741      cpunum_set_input_line_and_vector(Machine, 0, 6, HOLD_LINE , 0x49);
1741      cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x49);
17421742
17431743   if(scu_add_tmp & 0x80000000)
17441744   {
r2864r2865
17501750   D2MV_0;
17511751}
17521752
1753static void dma_indirect_lv0()
1753static void dma_indirect_lv0(running_machine *machine)
17541754{
17551755   /*Helper to get out of the cycle*/
17561756   UINT8 job_done = 0;
r2864r2865
18161816   }while(job_done == 0);
18171817
18181818   if(!(stv_scu[40] & 0x800))/*Lv 0 DMA end irq*/
1819      cpunum_set_input_line_and_vector(Machine, 0, 5, HOLD_LINE , 0x4b);
1819      cpunum_set_input_line_and_vector(machine, 0, 5, HOLD_LINE , 0x4b);
18201820
18211821   D0MV_0;
18221822}
18231823
1824static void dma_indirect_lv1()
1824static void dma_indirect_lv1(running_machine *machine)
18251825{
18261826   /*Helper to get out of the cycle*/
18271827   UINT8 job_done = 0;
r2864r2865
18881888   }while(job_done == 0);
18891889
18901890   if(!(stv_scu[40] & 0x400))/*Lv 1 DMA end irq*/
1891      cpunum_set_input_line_and_vector(Machine, 0, 6, HOLD_LINE , 0x4a);
1891      cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x4a);
18921892
18931893   D1MV_0;
18941894}
18951895
1896static void dma_indirect_lv2()
1896static void dma_indirect_lv2(running_machine *machine)
18971897{
18981898   /*Helper to get out of the cycle*/
18991899   UINT8 job_done = 0;
r2864r2865
19591959   }while(job_done == 0);
19601960
19611961   if(!(stv_scu[40] & 0x200))/*Lv 2 DMA end irq*/
1962      cpunum_set_input_line_and_vector(Machine, 0, 6, HOLD_LINE , 0x49);
1962      cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x49);
19631963
19641964   D2MV_0;
19651965}
src/mame/drivers/megatech.c
r2864r2865
477477}
478478
479479
480static READ8_HANDLER( megaplay_r0) { return input_port_read(machine, "BIOS_IN0") ; }
481static READ8_HANDLER( megaplay_r1) { return input_port_read(machine, "BIOS_IN1") ; }
482static READ8_HANDLER( megaplay_r2) { return input_port_read(machine, "BIOS_DSW0") ; }
483static READ8_HANDLER( megaplay_r3) { return input_port_read(machine, "BIOS_DSW1") ; }
484
485480static int mt_bank_bank_pos = 0;
486481static int mt_bank_partial = 0;
487482static int mt_bank_addr = 0;
r2864r2865
524519    AM_RANGE(0x3000, 0x3fff) AM_READWRITE(megatech_banked_ram_r, megatech_banked_ram_w) // copies instruction data here at startup, must be banked
525520   AM_RANGE(0x4000, 0x5fff) AM_RAM // plain ram?
526521   AM_RANGE(0x6000, 0x6000) AM_WRITE( mt_z80_bank_w )
527   AM_RANGE(0x6400, 0x6400) AM_READ(megaplay_r2)
528   AM_RANGE(0x6401, 0x6401) AM_READ(megaplay_r3)
522   AM_RANGE(0x6400, 0x6400) AM_READ_PORT("BIOS_DSW0")
523   AM_RANGE(0x6401, 0x6401) AM_READ_PORT("BIOS_DSW1")
529524   AM_RANGE(0x6404, 0x6404) AM_READWRITE(megatech_cart_select_r, megatech_cart_select_w) // cart select & ram bank
530   AM_RANGE(0x6800, 0x6800) AM_READ(megaplay_r0)
531   AM_RANGE(0x6801, 0x6801) AM_READ(megaplay_r1)
525   AM_RANGE(0x6800, 0x6800) AM_READ_PORT("BIOS_IN0")
526   AM_RANGE(0x6801, 0x6801) AM_READ_PORT("BIOS_IN1")
532527   AM_RANGE(0x6802, 0x6807) AM_READWRITE(bios_ctrl_r, bios_ctrl_w)
533528//  AM_RANGE(0x6805, 0x6805) AM_READ(input_port_8_r)
534529    AM_RANGE(0x7000, 0x77ff) AM_ROM // from bios rom (0x7000-0x77ff populated in ROM)
r2864r2865
578573
579574static VIDEO_START(mtnew)
580575{
581   init_for_megadrive(); // create an sms vdp too, for comptibility mode
576   init_for_megadrive(machine); // create an sms vdp too, for comptibility mode
582577   VIDEO_START_CALL(megadriv);
583578}
584579//attotime_never
src/mame/drivers/timelimt.c
r2864r2865
3333
3434static MACHINE_START( timelimt )
3535{
36   soundlatch_setclearedvalue( 0 );
36   soundlatch_setclearedvalue( machine, 0 );
3737}
3838
3939static MACHINE_RESET( timelimt )
src/mame/drivers/igs_blit.c
r2864r2865
323323{                                    \
324324   COMBINE_DATA(&igs_input_sel);            \
325325                                    \
326   if ( (igs_input_sel & 0xff00) || ((~igs_input_sel) & ((1 << NUM)-1)) )   \
326   if ( (igs_input_sel & 0xff00) || ((~igs_input_sel) & ((1 << NUM)-1)) )      \
327327      logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", activecpu_get_pc(), igs_input_sel);   \
328328}                                    \
329329                                    \
r2864r2865
331331{                                    \
332332   int i;                              \
333333   UINT16 ret=0;                        \
334   static const char *dipnames[] = { "DSW1", "DSW2", "DSW3", "DSW4", "DSW5" };   \
334335                                    \
335336   for (i = 0; i < NUM; i++)               \
336337      if ((~igs_input_sel) & (1 << i) )      \
337         ret = input_port_read_indexed(machine, i);            \
338         ret = input_port_read(machine, dipnames[i]);            \
338339                                    \
339340   /* 0x0100 is blitter busy */            \
340341   return    (ret & 0xff) | 0x0000;            \
r2864r2865
663664   switch(igs_magic[0])
664665   {
665666      case 0x01:
666         if (~igs_input_sel2 & 0x01)   return input_port_read_indexed(machine, 4);
667         if (~igs_input_sel2 & 0x02)   return input_port_read_indexed(machine, 5);
668         if (~igs_input_sel2 & 0x04)   return input_port_read_indexed(machine, 6);
669         if (~igs_input_sel2 & 0x08)   return input_port_read_indexed(machine, 7);
670         if (~igs_input_sel2 & 0x10)   return input_port_read_indexed(machine, 8);
667         if (~igs_input_sel2 & 0x01)   return input_port_read(machine, "KEY0");
668         if (~igs_input_sel2 & 0x02)   return input_port_read(machine, "KEY1");
669         if (~igs_input_sel2 & 0x04)   return input_port_read(machine, "KEY2");
670         if (~igs_input_sel2 & 0x08)   return input_port_read(machine, "KEY3");
671         if (~igs_input_sel2 & 0x10)   return input_port_read(machine, "KEY4");
671672         /* fall through */
672673      default:
673674         logerror("%06x: warning, reading with igs_magic = %02x\n", activecpu_get_pc(), igs_magic[0]);
r2864r2865
736737{
737738   switch(igs_magic[0])
738739   {
739      case 0x00:   return input_port_read_indexed(machine, 4);
740      case 0x01:   return input_port_read_indexed(machine, 5);
741      case 0x02:   return input_port_read_indexed(machine, 6);
740      case 0x00:   return input_port_read(machine, "IN0");
741      case 0x01:   return input_port_read(machine, "IN1");
742      case 0x02:   return input_port_read(machine, "IN2");
742743
743744      case 0x20:   return 0x49;
744745      case 0x21:   return 0x47;
r2864r2865
803804{
804805   switch(igs_magic[0])
805806   {
806      case 0x00:   return input_port_read_indexed(machine, 5);
807      case 0x00:   return input_port_read(machine, "IN0");
807808
808809      case 0x20:   return 0x49;
809810      case 0x21:   return 0x47;
r2864r2865
873874      case 0:      return igs_input_sel2;
874875
875876      case 1:
876         if (~igs_input_sel2 & 0x01)   return input_port_read_indexed(machine, 6);
877         if (~igs_input_sel2 & 0x02)   return input_port_read_indexed(machine, 7);
878         if (~igs_input_sel2 & 0x04)   return input_port_read_indexed(machine, 8);
879         if (~igs_input_sel2 & 0x08)   return input_port_read_indexed(machine, 9);
880         if (~igs_input_sel2 & 0x10)   return input_port_read_indexed(machine, 10);
877         if (~igs_input_sel2 & 0x01)   return input_port_read(machine, "KEY0");
878         if (~igs_input_sel2 & 0x02)   return input_port_read(machine, "KEY1");
879         if (~igs_input_sel2 & 0x04)   return input_port_read(machine, "KEY2");
880         if (~igs_input_sel2 & 0x08)   return input_port_read(machine, "KEY3");
881         if (~igs_input_sel2 & 0x10)   return input_port_read(machine, "KEY4");
881882
882883         logerror("%06x: warning, reading with igs_input_sel2 = %02x\n", activecpu_get_pc(), igs_input_sel2);
883884         break;
r2864r2865
918919{
919920   switch(igs_magic[0])
920921   {
921      case 0x00:   return input_port_read_indexed(machine, 5);
922      case 0x01:   return input_port_read_indexed(machine, 6);
922      case 0x00:   return input_port_read(machine, "IN0");
923      case 0x01:   return input_port_read(machine, "IN1");
923924
924925      case 0x20:   return 0x49;
925926      case 0x21:   return 0x47;
r2864r2865
985986{
986987   switch(igs_magic[0])
987988   {
988      case 0x00:   return input_port_read_indexed(machine, 3);
989      case 0x00:   return input_port_read(machine, "COIN");
989990
990991      case 0x02:
991         if (~igs_input_sel2 & 0x01)   return input_port_read_indexed(machine, 4);
992         if (~igs_input_sel2 & 0x02)   return input_port_read_indexed(machine, 5);
993         if (~igs_input_sel2 & 0x04)   return input_port_read_indexed(machine, 6);
994         if (~igs_input_sel2 & 0x08)   return input_port_read_indexed(machine, 7);
995         if (~igs_input_sel2 & 0x10)   return input_port_read_indexed(machine, 8);
992         if (~igs_input_sel2 & 0x01)   return input_port_read(machine, "KEY0");
993         if (~igs_input_sel2 & 0x02)   return input_port_read(machine, "KEY1");
994         if (~igs_input_sel2 & 0x04)   return input_port_read(machine, "KEY2");
995         if (~igs_input_sel2 & 0x08)   return input_port_read(machine, "KEY3");
996         if (~igs_input_sel2 & 0x10)   return input_port_read(machine, "KEY4");
996997         /* fall through */
997998      default:
998999         logerror("%06x: warning, reading with igs_magic = %02x\n", activecpu_get_pc(), igs_magic[0]);
r2864r2865
11941195static VIDEO_EOF( vbowl )
11951196{
11961197   vbowl_trackball[0] = vbowl_trackball[1];
1197   vbowl_trackball[1] = (input_port_read_indexed(machine, 8) << 8) | input_port_read_indexed(machine, 7);
1198   vbowl_trackball[1] = (input_port_read(machine, "AN1") << 8) | input_port_read(machine, "AN0");
11981199}
11991200
12001201static WRITE16_HANDLER( vbowl_pen_hi_w )
r2864r2865
13001301***************************************************************************/
13011302
13021303static INPUT_PORTS_START( chindrag )
1303   PORT_START   // IN0 - DSW1
1304   PORT_START_TAG("DSW1")   // IN0 - DSW1
13041305   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
13051306   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
13061307   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
r2864r2865
13251326   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
13261327   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
13271328
1328   PORT_START   // IN1 - DSW2
1329   PORT_START_TAG("DSW2")   // IN1 - DSW2
13291330   PORT_DIPNAME( 0x01, 0x01, "Background" )
13301331   PORT_DIPSETTING(    0x01, "Girl" )
13311332   PORT_DIPSETTING(    0x00, "Landscape" )
r2864r2865
13511352   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
13521353   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
13531354
1354     PORT_START   // IN2 - DSW3
1355     PORT_START_TAG("DSW3")   // IN2 - DSW3
13551356   PORT_DIPNAME( 0xff, 0xff, DEF_STR( Unused ) )
13561357   PORT_DIPSETTING(    0xff, DEF_STR( Off ) )
13571358   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
13581359
1359   PORT_START   // IN3
1360   PORT_START_TAG("COIN")   // IN3
13601361   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
13611362   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
13621363   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   // keep pressed while booting
r2864r2865
13661367   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
13671368   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
13681369
1369   PORT_START   // IN4
1370   PORT_START_TAG("IN0")   // IN4
13701371   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
13711372   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
13721373   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
r2864r2865
13761377   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )   // press in girl test to pause, button 3 advances
13771378   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
13781379
1379   PORT_START   // IN5
1380   PORT_START_TAG("IN1")   // IN5
13801381   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
13811382   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
13821383   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
13861387   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
13871388   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
13881389
1389   PORT_START   // IN6
1390   PORT_START_TAG("IN2")   // IN6
13901391   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
13911392   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
13921393   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
r2864r2865
13981399INPUT_PORTS_END
13991400
14001401
1401
14021402static INPUT_PORTS_START( chmplst2 )
1403   PORT_START   // IN0 - DSW1
1403   PORT_START_TAG("DSW1")   // IN0 - DSW1
14041404   PORT_DIPNAME( 0x07, 0x02, "Pay Out (%)" )
14051405   PORT_DIPSETTING(    0x07, "50" )
14061406   PORT_DIPSETTING(    0x06, "54" )
r2864r2865
14251425   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
14261426   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
14271427
1428   PORT_START   // IN1 - DSW2
1428   PORT_START_TAG("DSW2")   // IN1 - DSW2
14291429   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )   // Only when bit 4 = 1
14301430   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
14311431   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
r2864r2865
14501450   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
14511451   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
14521452
1453     PORT_START   // IN2 - DSW3
1453     PORT_START_TAG("DSW3")   // IN2 - DSW3
14541454   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Unknown ) )
14551455   PORT_DIPSETTING(    0x03, "500" )
14561456   PORT_DIPSETTING(    0x02, "1000" )
r2864r2865
14741474   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
14751475   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
14761476
1477   PORT_START   // IN3
1477   PORT_START_TAG("COIN")   // IN3
14781478   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
14791479   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )   // data clear
14801480   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   // keep pressed while booting
r2864r2865
14841484   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
14851485   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
14861486
1487   PORT_START   // IN4
1487   PORT_START_TAG("KEY0")   // IN4
14881488   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
14891489   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
14901490   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
r2864r2865
14941494   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   // ? set to 0 both
14951495   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )   // ? and you can't start a game
14961496
1497   PORT_START   // IN5
1497   PORT_START_TAG("KEY1")   // IN5
14981498   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
14991499   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
15001500   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
r2864r2865
15041504   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
15051505   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
15061506
1507   PORT_START   // IN6
1507   PORT_START_TAG("KEY2")   // IN6
15081508   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
15091509   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
15101510   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
r2864r2865
15141514   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
15151515   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
15161516
1517   PORT_START   // IN7
1517   PORT_START_TAG("KEY3")   // IN7
15181518   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
15191519   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
15201520   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
r2864r2865
15241524   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
15251525   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
15261526
1527   PORT_START   // IN8
1527   PORT_START_TAG("KEY4")   // IN8
15281528   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
15291529   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
15301530   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
15361536INPUT_PORTS_END
15371537
15381538
1539
15401539static INPUT_PORTS_START( drgnwrld )
1541   PORT_START   // IN0 - DSW1
1540   PORT_START_TAG("DSW1")   // IN0 - DSW1
15421541   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
15431542   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
15441543   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
r2864r2865
15631562   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
15641563   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
15651564
1566   PORT_START   // IN1 - DSW2
1565   PORT_START_TAG("DSW2")   // IN1 - DSW2
15671566   PORT_DIPNAME( 0x01, 0x01, "Open Girl?" )
15681567   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
15691568   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
15891588   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
15901589   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
15911590
1592     PORT_START   // IN2 - DSW3
1591     PORT_START_TAG("DSW3")   // IN2 - DSW3
15931592   PORT_DIPNAME( 0xff, 0xff, DEF_STR( Unused ) )
15941593   PORT_DIPSETTING(    0xff, DEF_STR( Off ) )
15951594   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
15961595
1597   PORT_START   // IN3
1596   PORT_START_TAG("COIN")   // IN3
15981597   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
15991598   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
16001599   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   // keep pressed while booting
r2864r2865
16041603   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
16051604   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
16061605
1607   PORT_START   // IN4
1606   PORT_START_TAG("IN0")   // IN4
16081607   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
16091608   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
16101609   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
r2864r2865
16141613   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )   // press in girl test to pause, button 3 advances
16151614   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
16161615
1617   PORT_START   // IN5
1616   PORT_START_TAG("IN1")   // IN5
16181617   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
16191618   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
16201619   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
16241623   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
16251624   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
16261625
1627   PORT_START   // IN6
1626   PORT_START_TAG("IN2")   // IN6
16281627   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
16291628   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
16301629   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
r2864r2865
16361635INPUT_PORTS_END
16371636
16381637
1639
16401638static INPUT_PORTS_START( grtwall )
1641   PORT_START   // IN0 - DSW3
1639   PORT_START_TAG("DSW1")   // IN0 - DSW3
16421640   PORT_DIPNAME( 0xff, 0xff, "3" )
16431641   PORT_DIPSETTING(    0xff, DEF_STR( Off ) )
16441642   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
16451643
1646   PORT_START   // IN1 - DSW2
1644   PORT_START_TAG("DSW2")   // IN1 - DSW2
16471645   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Unknown ) )
16481646   PORT_DIPSETTING(    0x03, "1000" )
16491647   PORT_DIPSETTING(    0x02, "1500" )
r2864r2865
16671665   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
16681666   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
16691667
1670     PORT_START   // IN2 - DSW1
1668     PORT_START_TAG("DSW3")   // IN2 - DSW1
16711669   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
16721670   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
16731671   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
r2864r2865
16911689   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
16921690   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
16931691
1694   PORT_START   // IN3 - DSW4
1692   PORT_START_TAG("DSW4")   // IN3 - DSW4
16951693   PORT_DIPNAME( 0xff, 0xff, "4" )
16961694   PORT_DIPSETTING(    0xff, DEF_STR( Off ) )
16971695   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
16981696
1699   PORT_START   // IN4
1697   PORT_START_TAG("COIN")   // IN4
17001698   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
17011699   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
17021700   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   // keep pressed while booting
r2864r2865
17061704   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
17071705   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
17081706
1709   PORT_START   // IN5
1707   PORT_START_TAG("IN0")   // IN5
17101708   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
17111709   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
17121710   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
r2864r2865
17191717
17201718
17211719static INPUT_PORTS_START( lhb )
1722   PORT_START   // IN0 - DSW1
1720   PORT_START_TAG("DSW1")   // IN0 - DSW1
17231721   PORT_DIPNAME( 0x0f, 0x07, "Pay Out (%)" )
17241722   PORT_DIPSETTING(    0x0f, "96" )
17251723   PORT_DIPSETTING(    0x0e, "93" )
r2864r2865
17481746   PORT_DIPSETTING(    0x40, "10" )
17491747   PORT_DIPSETTING(    0x00, "20" )
17501748
1751   PORT_START   // IN1 - DSW2
1749   PORT_START_TAG("DSW2")   // IN1 - DSW2
17521750   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
17531751   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
17541752   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
r2864r2865
17721770   PORT_DIPSETTING(    0x80, "2" )
17731771//  PORT_DIPSETTING(    0x00, "2" )
17741772
1775     PORT_START   // IN2 - DSW3
1773     PORT_START_TAG("DSW3")   // IN2 - DSW3
17761774   PORT_DIPNAME( 0x03, 0x03, "Max Credit" )
17771775   PORT_DIPSETTING(    0x03, "1000" )
17781776   PORT_DIPSETTING(    0x02, "2000" )
r2864r2865
17951793   PORT_DIPSETTING(    0x40, "5" )
17961794   PORT_DIPSETTING(    0x00, "8" )
17971795
1798   PORT_START   // IN3 - DSW4
1796   PORT_START_TAG("DSW4")   // IN3 - DSW4
17991797   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
18001798   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
18011799   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
18201818   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
18211819   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
18221820
1823   PORT_START   // IN4 - DSW5
1821   PORT_START_TAG("DSW5")   // IN4 - DSW5
18241822   PORT_DIPNAME( 0xff, 0xff, "5" )
18251823   PORT_DIPSETTING(    0xff, DEF_STR( Off ) )
18261824   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
18271825
1828   PORT_START   // IN5
1826   PORT_START_TAG("COIN")   // IN5
18291827   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
18301828   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
18311829   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   // keep pressed while booting
r2864r2865
18351833   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
18361834   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
18371835
1838   PORT_START   // IN6
1836   PORT_START_TAG("KEY0")   // IN6
18391837   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
18401838   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
18411839   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
r2864r2865
18451843   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
18461844   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
18471845
1848   PORT_START   // IN7
1846   PORT_START_TAG("KEY1")   // IN7
18491847   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
18501848   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
18511849   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
r2864r2865
18551853   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
18561854   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
18571855
1858   PORT_START   // IN8
1856   PORT_START_TAG("KEY2")   // IN8
18591857   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
18601858   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
18611859   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
r2864r2865
18651863   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
18661864   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
18671865
1868   PORT_START   // IN9
1866   PORT_START_TAG("KEY3")   // IN9
18691867   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
18701868   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
18711869   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
r2864r2865
18751873   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
18761874   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
18771875
1878   PORT_START   // IN10
1876   PORT_START_TAG("KEY4")   // IN10
18791877   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
18801878   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
18811879   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
18881886
18891887
18901888static INPUT_PORTS_START( vbowl )
1891   PORT_START   // IN0 - DSW1
1889   PORT_START_TAG("DSW1")   // IN0 - DSW1
18921890   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
18931891   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
18941892   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
r2864r2865
19141912   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
19151913   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
19161914
1917   PORT_START   // IN1 - DSW2
1915   PORT_START_TAG("DSW2")   // IN1 - DSW2
19181916   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) )
19191917   PORT_DIPSETTING(    0x03, DEF_STR( Easy   ) )   // 5
19201918   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )   // 7
r2864r2865
19381936   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
19391937   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
19401938
1941     PORT_START   // IN2 - DSW3
1939     PORT_START_TAG("DSW3")   // IN2 - DSW3
19421940   PORT_DIPNAME( 0x03, 0x03, "Cabinet ID" )
19431941   PORT_DIPSETTING(    0x03, "1" )
19441942   PORT_DIPSETTING(    0x02, "2" )
r2864r2865
19611959   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
19621960   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
19631961
1964   PORT_START   // IN3 - DSW4
1962   PORT_START_TAG("DSW4")   // IN3 - DSW4
19651963   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
19661964   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
19671965   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
19871985   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
19881986   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
19891987
1990   PORT_START   // IN4
1988   PORT_START_TAG("COIN")   // IN4
19911989   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
19921990   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
19931991   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
19971995   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
19981996   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
19991997
2000   PORT_START   // IN5
1998   PORT_START_TAG("IN0")   // IN5
20011999   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
20022000   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
20032001   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
r2864r2865
20072005   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
20082006   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )
20092007
2010   PORT_START   // IN6
2008   PORT_START_TAG("IN1")   // IN6
20112009   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
20122010   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
20132011   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
r2864r2865
20172015   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
20182016   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
20192017
2020   PORT_START   // IN7
2018   PORT_START_TAG("AN0")   // IN7
20212019    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
20222020
2023   PORT_START   // IN8
2021   PORT_START_TAG("AN1")   // IN8
20242022    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
20252023INPUT_PORTS_END
20262024
20272025
20282026static INPUT_PORTS_START( vbowlj )
2029   PORT_START   // IN0 - DSW1
2027   PORT_START_TAG("DSW1")   // IN0 - DSW1
20302028   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
20312029   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
20322030   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
r2864r2865
20522050   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
20532051   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
20542052
2055   PORT_START   // IN1 - DSW2
2053   PORT_START_TAG("DSW2")   // IN1 - DSW2
20562054   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) )
20572055   PORT_DIPSETTING(    0x03, DEF_STR( Easy   ) )   // 5
20582056   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )   // 7
r2864r2865
20762074   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
20772075   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
20782076
2079     PORT_START   // IN2 - DSW3
2077     PORT_START_TAG("DSW3")   // IN2 - DSW3
20802078   PORT_DIPNAME( 0x03, 0x03, "Cabinet ID" )
20812079   PORT_DIPSETTING(    0x03, "1" )
20822080   PORT_DIPSETTING(    0x02, "2" )
r2864r2865
20992097   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
21002098   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
21012099
2102   PORT_START   // IN3 - DSW4
2100   PORT_START_TAG("DSW4")   // IN3 - DSW4
21032101   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
21042102   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
21052103   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
21252123   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
21262124   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
21272125
2128   PORT_START   // IN4
2126   PORT_START_TAG("COIN")   // IN4
21292127   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
21302128   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
21312129   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
21352133   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
21362134   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
21372135
2138   PORT_START   // IN5
2136   PORT_START_TAG("IN0")   // IN5
21392137   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
21402138   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
21412139   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
r2864r2865
21452143   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
21462144   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )
21472145
2148   PORT_START   // IN6
2146   PORT_START_TAG("IN1")   // IN6
21492147   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
21502148   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
21512149   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
r2864r2865
21552153   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
21562154   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
21572155
2158   PORT_START   // IN7
2156   PORT_START_TAG("AN0")   // IN7
21592157    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
21602158
2161   PORT_START   // IN8
2159   PORT_START_TAG("AN1")   // IN8
21622160    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
21632161INPUT_PORTS_END
21642162
21652163
21662164static INPUT_PORTS_START( xymg )
2167   PORT_START   // IN0 - DSW1
2165   PORT_START_TAG("DSW1")   // IN0 - DSW1
21682166   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
21692167   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
21702168   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
r2864r2865
21882186   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
21892187   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
21902188
2191   PORT_START   // IN1 - DSW2
2189   PORT_START_TAG("DSW2")   // IN1 - DSW2
21922190   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Unknown ) )
21932191   PORT_DIPSETTING(    0x03, "1000" )
21942192   PORT_DIPSETTING(    0x02, "1500" )
r2864r2865
22122210   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
22132211   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
22142212
2215     PORT_START   // IN2 - DSW3
2213     PORT_START_TAG("DSW3")   // IN2 - DSW3
22162214   PORT_DIPNAME( 0xff, 0xff, DEF_STR( Unused ) )
22172215   PORT_DIPSETTING(    0xff, DEF_STR( Off ) )
22182216   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
22192217
2220   PORT_START   // IN3
2218   PORT_START_TAG("COIN")   // IN3
22212219   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
22222220   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
22232221   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   // keep pressed while booting
r2864r2865
22272225   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
22282226   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
22292227
2230   PORT_START   // IN4
2228   PORT_START_TAG("KEY0")   // IN4
22312229   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
22322230   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
22332231   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
r2864r2865
22372235   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
22382236   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
22392237
2240   PORT_START   // IN5
2238   PORT_START_TAG("KEY1")   // IN5
22412239   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
22422240   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
22432241   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
r2864r2865
22472245   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
22482246   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
22492247
2250   PORT_START   // IN6
2248   PORT_START_TAG("KEY2")   // IN6
22512249   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
22522250   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
22532251   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
r2864r2865
22572255   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
22582256   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
22592257
2260   PORT_START   // IN7
2258   PORT_START_TAG("KEY3")   // IN7
22612259   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
22622260   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
22632261   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
r2864r2865
22672265   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
22682266   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
22692267
2270   PORT_START   // IN8
2268   PORT_START_TAG("KEY4")   // IN8
22712269   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
22722270   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
22732271   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
src/mame/drivers/goal92.c
r2864r2865
4040   switch(offset)
4141   {
4242      case 0:
43         return input_port_read_indexed(machine, 0);
43         return input_port_read(machine, "DSW1");
4444      case 1:
45         return input_port_read_indexed(machine, 1);
45         return input_port_read(machine, "IN1");
4646      case 2:
47         return input_port_read_indexed(machine, 2);
47         return input_port_read(machine, "IN2");
4848      case 3:
49         return input_port_read_indexed(machine, 3);
49         return input_port_read(machine, "IN3");
5050      case 7:
51         return input_port_read_indexed(machine, 4);
51         return input_port_read(machine, "DSW2");
5252
5353      default:
5454         logerror("reading unhandled goal92 inputs %04X %04X @ PC = %04X\n",offset, mem_mask,activecpu_get_pc());
src/mame/drivers/raiden.c
r2864r2865
4949VIDEO_START( raiden );
5050VIDEO_START( raidena );
5151WRITE16_HANDLER( raiden_control_w );
52WRITE16_HANDLER( raidena_control_w );
5253VIDEO_UPDATE( raiden );
5354
5455static UINT16 *raiden_shared_ram;
r2864r2865
8687   AM_RANGE(0x07000, 0x07fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
8788   AM_RANGE(0x08000, 0x08fff) AM_RAM AM_SHARE(1) AM_BASE(&raiden_shared_ram)
8889   AM_RANGE(0x0a000, 0x0a00d) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
89   AM_RANGE(0x0b000, 0x0b007) AM_WRITE(raiden_control_w)
9090   AM_RANGE(0x0c000, 0x0c7ff) AM_WRITE(raiden_text_w) AM_BASE(&videoram16)
9191   AM_RANGE(0x0e000, 0x0e001) AM_READ(input_port_1_word_r)
92   AM_RANGE(0x0e000, 0x0e007) AM_WRITE(raidena_control_w)
9293   AM_RANGE(0x0e002, 0x0e003) AM_READ(input_port_2_word_r)
9394   AM_RANGE(0x0f000, 0x0f035) AM_WRITE(SMH_RAM) AM_BASE(&raiden_scroll_ram)
9495   AM_RANGE(0xa0000, 0xfffff) AM_ROM
src/mame/drivers/fromanc2.c
r2864r2865
155155   UINT16 ret;
156156
157157   switch (fromanc2_portselect) {
158      case 0x01:   ret = input_port_read(machine, "IN1");   break;
158      case 0x01:   ret = input_port_read(machine, "IN1"); break;
159159      case 0x02:   ret = input_port_read(machine, "IN2"); break;
160160      case 0x04:   ret = input_port_read(machine, "IN3"); break;
161161      case 0x08:   ret = input_port_read(machine, "IN4"); break;
r2864r2865
175175          ((fromanc2_subcpu_nmi_flag & 1) << 6) |
176176          ((fromanc2_sndcpu_nmi_flag & 1) << 5));
177177   eeprom = (eeprom_read_bit() & 1) << 7;      // EEPROM DATA
178   coinsw = input_port_read_indexed(machine, 0) & 0x030f;         // COIN, TEST
178   coinsw = input_port_read(machine, "IN0") & 0x030f;         // COIN, TEST
179179
180180   return (cflag | eeprom | coinsw);
181181}
r2864r2865
186186
187187   cflag = (fromanc2_sndcpu_nmi_flag & 1) << 5;
188188   eeprom = (eeprom_read_bit() & 1) << 7;      // EEPROM DATA
189   coinsw = input_port_read_indexed(machine, 0) & 0x001f;         // COIN, TEST
189   coinsw = input_port_read(machine, "IN0") & 0x001f;         // COIN, TEST
190190
191191   return (cflag | eeprom | coinsw);
192192}
src/mame/drivers/gridlee.c
r2864r2865
172172{
173173   int delta, sign, magnitude;
174174   UINT8 newval;
175   static const char *portnames[] = { "TRACK0_Y", "TRACK0_X", "TRACK1_Y", "TRACK1_X" };
175176
176177   /* first read the new trackball value and compute the signed delta */
177   newval = input_port_read_indexed(machine, offset + 2 * gridlee_cocktail_flip);
178   newval = input_port_read(machine, portnames[offset + 2 * gridlee_cocktail_flip]);
178179   delta = (int)newval - (int)last_analog_input[offset];
179180
180181   /* handle the case where we wrap around from 0x00 to 0xff, or vice versa */
r2864r2865
300301static ADDRESS_MAP_START( readmem_cpu1, ADDRESS_SPACE_PROGRAM, 8 )
301302   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_RAM)
302303   AM_RANGE(0x9500, 0x9501) AM_READ(analog_port_r)
303   AM_RANGE(0x9502, 0x9502) AM_READ(input_port_4_r)
304   AM_RANGE(0x9503, 0x9503) AM_READ(input_port_5_r)
305   AM_RANGE(0x9600, 0x9600) AM_READ(input_port_6_r)
306   AM_RANGE(0x9700, 0x9700) AM_READ(input_port_7_r)
304   AM_RANGE(0x9502, 0x9502) AM_READ_PORT("IN0")
305   AM_RANGE(0x9503, 0x9503) AM_READ_PORT("IN1")
306   AM_RANGE(0x9600, 0x9600) AM_READ_PORT("DSW")
307   AM_RANGE(0x9700, 0x9700) AM_READ_PORT("IN2")
307308   AM_RANGE(0x9820, 0x9820) AM_READ(random_num_r)
308309   AM_RANGE(0x9c00, 0x9cff) AM_READ(SMH_RAM)
309310   AM_RANGE(0xa000, 0xffff) AM_READ(SMH_ROM)
r2864r2865
335336 *************************************/
336337
337338static INPUT_PORTS_START( gridlee )
338   PORT_START   /* 9500 (fake) */
339   PORT_START_TAG("TRACK0_Y")   /* 9500 (fake) */
339340    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(8)
340341
341   PORT_START   /* 9501 (fake) */
342   PORT_START_TAG("TRACK0_X")   /* 9501 (fake) */
342343    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(8) PORT_REVERSE
343344
344   PORT_START   /* 9500 (fake) */
345   PORT_START_TAG("TRACK1_Y")   /* 9500 (fake) */
345346    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(8) PORT_COCKTAIL
346347
347   PORT_START   /* 9501 (fake) */
348   PORT_START_TAG("TRACK1_X")   /* 9501 (fake) */
348349    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(8) PORT_REVERSE PORT_COCKTAIL
349350
350   PORT_START   /* 9502 */
351   PORT_START_TAG("IN0")      /* 9502 */
351352   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
352353   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
353354   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
354355
355   PORT_START   /* 9503 */
356   PORT_START_TAG("IN1")      /* 9503 */
356357   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
357358   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
358359   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
r2864r2865
363364   PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ))
364365   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
365366
366   PORT_START   /* 9600 */
367   PORT_START_TAG("DSW")      /* 9600 */
367368   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Bonus_Life ))
368369   PORT_DIPSETTING(    0x00, "8000 points" )
369370   PORT_DIPSETTING(    0x01, "10000 points" )
r2864r2865
387388   PORT_DIPSETTING(    0x00, DEF_STR( No ))
388389   PORT_DIPSETTING(    0x80, DEF_STR( Yes ))
389390
390   PORT_START   /* 9700 */
391   PORT_START_TAG("IN2")      /* 9700 */
391392   PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNKNOWN )
392393   PORT_SERVICE( 0x20, IP_ACTIVE_LOW )
393394   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
src/mame/drivers/bnstars.c
r2864r2865
298298}
299299
300300
301static void update_color(int color, int screen)
301static void update_color(running_machine *machine, int color, int screen)
302302{
303303   int r,g,b;
304304
r2864r2865
306306   g = ((ms32_pal_ram[screen][color*2] & 0x00ff) >>0 );
307307   b = ((ms32_pal_ram[screen][color*2+1] & 0x00ff) >>0 );
308308
309   palette_set_color(Machine,color+screen*0x8000,MAKE_RGB(r,g,b));
309   palette_set_color(machine,color+screen*0x8000,MAKE_RGB(r,g,b));
310310}
311311
312312static WRITE32_HANDLER( ms32_pal0_ram_w )
313313{
314314   COMBINE_DATA(&ms32_pal_ram[0][offset]);
315   update_color(offset/2, 0);
315   update_color(machine, offset/2, 0);
316316}
317317
318318static WRITE32_HANDLER( ms32_pal1_ram_w )
319319{
320320   COMBINE_DATA(&ms32_pal_ram[1][offset]);
321   update_color(offset/2, 1);
321   update_color(machine, offset/2, 1);
322322}
323323
324324static int ms32_reverse_sprite_order = 0;
src/mame/drivers/gcpinbal.c
r2864r2865
8181   switch (offset)
8282   {
8383      case 0x80/2:
84         return input_port_read_indexed(machine,0);   /* DSW */
84         return input_port_read(machine, "DSW");
8585
8686      case 0x84/2:
87         return input_port_read_indexed(machine,1);   /* IN0 */
87         return input_port_read(machine, "IN0");
8888
8989      case 0x86/2:
90         return input_port_read_indexed(machine,2);   /* IN1 */
90         return input_port_read(machine, "IN1");
9191
9292      case 0x50:
9393      case 0x51:
r2864r2865
231231***********************************************************/
232232
233233static INPUT_PORTS_START( gcpinbal )
234   PORT_START   /* DSW */
234   PORT_START_TAG("DSW")   /* DSW */
235235   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
236236   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
237237   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
r2864r2865
278278   PORT_DIPSETTING(      0x8000, "4" )
279279   PORT_DIPSETTING(      0x4000, "5" )
280280
281   PORT_START   /* IN0 */
281   PORT_START_TAG("IN0")   /* IN0 */
282282   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
283283   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
284284   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
296296   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(1)   // Tilt left
297297   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 )
298298
299   PORT_START   /* IN1 */
299   PORT_START_TAG("IN1")   /* IN1 */
300300   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
301301   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
302302   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/gundealr.c
r2864r2865
7373   {
7474      if (input_ports_hack)
7575      {
76         rambase[0x004] = input_port_read_indexed(machine, 4);   /* COIN */
77         rambase[0x005] = input_port_read_indexed(machine, 3);   /* IN1 */
78         rambase[0x006] = input_port_read_indexed(machine, 2);   /* IN0 */
76         rambase[0x004] = input_port_read(machine, "IN2");
77         rambase[0x005] = input_port_read(machine, "IN1");
78         rambase[0x006] = input_port_read(machine, "IN0");
7979      }
8080      cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xd7);   /* RST 10h vblank */
8181   }
r2864r2865
158158static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
159159   AM_RANGE(0x0000, 0x7fff) AM_ROM
160160   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1)
161   AM_RANGE(0xc000, 0xc000) AM_READ(input_port_0_r)   /* DSW0 */
162   AM_RANGE(0xc001, 0xc001) AM_READ(input_port_1_r)   /* DSW1 */
163   AM_RANGE(0xc004, 0xc004) AM_READ(input_port_2_r)   /* COIN (Gun Dealer only) */
164   AM_RANGE(0xc005, 0xc005) AM_READ(input_port_3_r)   /* IN1 (Gun Dealer only) */
165   AM_RANGE(0xc006, 0xc006) AM_READ(input_port_4_r)   /* IN0 (Gun Dealer only) */
161   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("DSW0")   /* DSW0 */
162   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("DSW1")   /* DSW1 */
163   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("IN0")   /* COIN (Gun Dealer only) */
164   AM_RANGE(0xc005, 0xc005) AM_READ_PORT("IN1")   /* IN1 (Gun Dealer only) */
165   AM_RANGE(0xc006, 0xc006) AM_READ_PORT("IN2")   /* IN0 (Gun Dealer only) */
166166   AM_RANGE(0xc010, 0xc013) AM_WRITE(yamyam_fg_scroll_w)      /* Yam Yam only */
167167   AM_RANGE(0xc014, 0xc014) AM_WRITE(gundealr_flipscreen_w)
168168   AM_RANGE(0xc016, 0xc016) AM_WRITE(yamyam_bankswitch_w)
r2864r2865
182182
183183
184184static INPUT_PORTS_START( gundealr )
185   PORT_START   /* DSW0 */
185   PORT_START_TAG("DSW0")   /* DSW0 */
186186   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
187187   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
188188   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
207207   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
208208   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
209209
210   PORT_START   /* DSW1 */
210   PORT_START_TAG("DSW1")   /* DSW1 */
211211   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
212212   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
213213   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
r2864r2865
232232   PORT_DIPSETTING(    0x80, "2" )
233233   PORT_DIPSETTING(    0xc0, "3" )
234234
235   PORT_START   /* COIN */
235   PORT_START_TAG("IN0")   /* COIN */
236236   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
237237   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
238238   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
242242   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
243243   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
244244
245   PORT_START   /* IN1 */
245   PORT_START_TAG("IN1")   /* Player 2 controls */
246246   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2)
247247   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
248248   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
r2864r2865
252252   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
253253   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
254254
255   PORT_START   /* IN0 */
255   PORT_START_TAG("IN2")   /* Player 1 controls */
256256   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
257257   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1)
258258   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
r2864r2865
264264INPUT_PORTS_END
265265
266266static INPUT_PORTS_START( gundealt )
267   PORT_START   /* DSW0 */
267   PORT_START_TAG("DSW0")   /* DSW0 */
268268   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
269269   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
270270   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
289289   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
290290   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
291291
292   PORT_START   /* DSW1 */
292   PORT_START_TAG("DSW1")   /* DSW1 */
293293   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
294294   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
295295   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
r2864r2865
314314   PORT_DIPSETTING(    0x80, "2" )
315315   PORT_DIPSETTING(    0xc0, "3" )
316316
317   PORT_START   /* IN0 */
317   PORT_START_TAG("IN0")   /* Player 1 controls */
318318   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
319319   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1)
320320   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
r2864r2865
324324   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
325325   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
326326
327   PORT_START   /* IN1 */
327   PORT_START_TAG("IN1")   /* Player 2 controls */
328328   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2)
329329   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
330330   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
r2864r2865
334334   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
335335   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
336336
337   PORT_START   /* COIN */
337   PORT_START_TAG("IN2")   /* COIN */
338338   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
339339   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
340340   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
346346INPUT_PORTS_END
347347
348348static INPUT_PORTS_START( yamyam )
349   PORT_START   /* DSW0 */
349   PORT_START_TAG("DSW0")   /* DSW0 */
350350   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
351351   PORT_DIPSETTING(    0x00, "3" )
352352   PORT_DIPSETTING(    0x01, "4" )
r2864r2865
370370   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
371371   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
372372
373   PORT_START   /* DSW1 */
373   PORT_START_TAG("DSW1")   /* DSW1 */
374374   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
375375   PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
376376   PORT_DIPSETTING(    0x06, DEF_STR( 4C_1C ) )
r2864r2865
394394   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
395395   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
396396
397   PORT_START   /* COIN */
397   PORT_START_TAG("IN0")   /* COIN */
398398   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
399399   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
400400   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
404404   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
405405   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
406406
407   PORT_START   /* IN1 */
407   PORT_START_TAG("IN1")   /* Player 2 controls */
408408   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2)
409409   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
410410   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
r2864r2865
414414   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
415415   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
416416
417   PORT_START   /* IN0 */
417   PORT_START_TAG("IN2")   /* Player 1 controls */
418418   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
419419   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1)
420420   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
src/mame/drivers/namcos1.c
r2864r2865
24352435GAME( 1990, soukobdx, boxyboy,  ns1,     boxyboy,  soukobdx, ROT0,   "Namco", "Souko Ban Deluxe (Japan)", 0 )
24362436GAME( 1990, puzlclub, 0,        ns1,     puzlclub, puzlclub, ROT90,  "Namco", "Puzzle Club (Japan prototype)", 0 )
24372437GAME( 1991, tankfrce, 0,        ns1,     ns1,      tankfrce, ROT0,   "Namco", "Tank Force (US, 2 Player)", 0 )
2438GAME( 1991, tankfrc4, tankfrce, ns1,     tankfrc4, tankfrce, ROT0,   "Namco", "Tank Force (US, 4 Player)", GAME_NOT_WORKING ) /* No controls */
2438GAME( 1991, tankfrc4, tankfrce, ns1,     tankfrc4, tankfrc4, ROT0,   "Namco", "Tank Force (US, 4 Player)", GAME_NOT_WORKING ) /* No controls */
24392439GAME( 1991, tankfrcj, tankfrce, ns1,     ns1,      tankfrce, ROT0,   "Namco", "Tank Force (Japan)", 0 )
24402440
src/mame/drivers/deco156.c
r2864r2865
150150
151151static READ32_HANDLER(hvysmsh_eeprom_r)
152152{
153   return (eeprom_read_bit()<<24) | input_port_read_indexed(machine, 0) | (input_port_read_indexed(machine, 1)<<16);
153   return (eeprom_read_bit()<<24) | input_port_read(machine, "IN0") | (input_port_read(machine, "IN1")<<16);
154154}
155155
156156static WRITE32_HANDLER(hvysmsh_eeprom_w)
r2864r2865
193193
194194static READ32_HANDLER(wcvol95_eeprom_r)
195195{
196   return (eeprom_read_bit()<<24) | input_port_read_indexed(machine, 0) | ((input_port_read_indexed(machine, 1)&0xff)<<16);
196   return (eeprom_read_bit()<<24) | input_port_read(machine, "IN0") | ((input_port_read(machine, "IN1") & 0xff)<<16);
197197}
198198
199199static WRITE32_HANDLER(wcvol95_eeprom_w)
r2864r2865
278278/***************************************************************************/
279279
280280static INPUT_PORTS_START( hvysmsh )
281   PORT_START
281   PORT_START_TAG("IN0")
282282   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
283283   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
284284   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
296296   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
297297   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
298298
299   PORT_START
299   PORT_START_TAG("IN1")
300300   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
301301   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
302302   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
316316INPUT_PORTS_END
317317
318318static INPUT_PORTS_START( wcvol95 )
319   PORT_START
319   PORT_START_TAG("IN0")
320320   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
321321   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
322322   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
334334   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
335335   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
336336
337   PORT_START
337   PORT_START_TAG("IN1")
338338   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
339339   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
340340   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
src/mame/drivers/ertictac.c
r2864r2865
4141
4242static READ32_HANDLER(IOCR_r)
4343{
44   return (input_port_read_indexed(machine, 5)&0x80)|0x34;
44   return (input_port_read(machine, "dummy") & 0x80) | 0x34;
4545}
4646
4747static WRITE32_HANDLER(IOCR_w)
r2864r2865
179179ADDRESS_MAP_END
180180
181181static INPUT_PORTS_START( ertictac )
182   PORT_START_TAG("IN 0")
182   PORT_START_TAG("IN0")
183183   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START2 )
184184   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
185185   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
186186   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
187187
188   PORT_START_TAG("IN 1")
188   PORT_START_TAG("IN1")
189189   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
190190   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   ) PORT_8WAY PORT_PLAYER(1)
191191   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_8WAY PORT_PLAYER(1)
192192   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_8WAY PORT_PLAYER(1)
193193   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_8WAY PORT_PLAYER(1)
194194
195   PORT_START_TAG("IN 2")
195   PORT_START_TAG("IN2")
196196   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
197197   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   ) PORT_8WAY PORT_PLAYER(2)
198198   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_8WAY PORT_PLAYER(2)
199199   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_8WAY PORT_PLAYER(2)
200200   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_8WAY PORT_PLAYER(2)
201201
202   PORT_START_TAG("DSW 1")
202   PORT_START_TAG("DSW1")
203203   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Language ) )
204204   PORT_DIPSETTING(    0x01, DEF_STR( French ) )
205205   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
r2864r2865
223223   PORT_DIPSETTING(    0x40, "Difficult" )
224224   PORT_DIPSETTING(    0x00, "Very Difficult" )
225225
226   PORT_START_TAG("DSW 2")
226   PORT_START_TAG("DSW2")
227227   PORT_DIPNAME( 0x05, 0x00, DEF_STR( Coin_A ) )
228228   PORT_DIPSETTING(    0x05, DEF_STR( 4C_1C ) )
229229   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
r2864r2865
249249INPUT_PORTS_END
250250
251251static INPUT_PORTS_START( poizone )
252   PORT_START_TAG("IN 0")
252   PORT_START_TAG("IN0")
253253   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START2 )
254254   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
255255   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
256256   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
257257
258   PORT_START_TAG("IN 1")
258   PORT_START_TAG("IN1")
259259   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
260260   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   ) PORT_8WAY PORT_PLAYER(1)
261261   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_8WAY PORT_PLAYER(1)
262262   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_8WAY PORT_PLAYER(1)
263263   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_8WAY PORT_PLAYER(1)
264264
265   PORT_START_TAG("IN 2")
265   PORT_START_TAG("IN2")
266266   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
267267   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   ) PORT_8WAY PORT_PLAYER(2)
268268   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_8WAY PORT_PLAYER(2)
269269   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_8WAY PORT_PLAYER(2)
270270   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_8WAY PORT_PLAYER(2)
271271
272   PORT_START_TAG("DSW 1")
272   PORT_START_TAG("DSW1")
273273   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Language ) ) // 01
274274   PORT_DIPSETTING(    0x01, DEF_STR( English ) )
275275   PORT_DIPSETTING(    0x00, DEF_STR( French ) )
r2864r2865
293293   PORT_DIPSETTING(   0x40, DEF_STR( 1C_3C ) )
294294   PORT_DIPSETTING(   0xC0, DEF_STR( 1C_4C ) )
295295
296//  PORT_START_TAG("DSW 2") /* DSW 2 doesn't work, may not be hooked up properly */
296   PORT_START_TAG("DSW2") /* DSW 2 doesn't work, may not be hooked up properly */
297297//  PORT_DIPNAME( 0x01, 0x01, "2-1" )
298298//  PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
299299//  PORT_DIPSETTING(    0x00, DEF_STR( On ) )
src/mame/drivers/jcross.c
r2864r2865
7070
7171static READ8_HANDLER( jcross_port_0_r )
7272{
73   return(input_port_read_indexed(machine, 0) | sound_cpu_busy);
73   return(input_port_read(machine, "IN0") | sound_cpu_busy);
7474}
7575
7676static WRITE8_HANDLER(jcross_vregs0_w){jcross_vregs[0]=data;}
r2864r2865
100100static ADDRESS_MAP_START( cpuA_map, ADDRESS_SPACE_PROGRAM, 8 )
101101   AM_RANGE(0x0000, 0x9fff) AM_ROM
102102   AM_RANGE(0xa000, 0xa000) AM_READ(jcross_port_0_r)
103   AM_RANGE(0xa100, 0xa100) AM_READ(input_port_1_r)
104   AM_RANGE(0xa200, 0xa200) AM_READ(input_port_2_r)
103   AM_RANGE(0xa100, 0xa100) AM_READ_PORT("IN1")
104   AM_RANGE(0xa200, 0xa200) AM_READ_PORT("IN2")
105105   AM_RANGE(0xa300, 0xa300) AM_WRITE(sound_command_w)
106   AM_RANGE(0xa400, 0xa400) AM_READ(input_port_3_r)
107   AM_RANGE(0xa500, 0xa500) AM_READ(input_port_4_r)
106   AM_RANGE(0xa400, 0xa400) AM_READ_PORT("DSW1")
107   AM_RANGE(0xa500, 0xa500) AM_READ_PORT("DSW2")
108108   AM_RANGE(0xa600, 0xa600) AM_WRITE(jcross_palettebank_w)
109109   AM_RANGE(0xa700, 0xa700) AM_READWRITE(snk_cpuB_nmi_trigger_r, snk_cpuA_nmi_ack_w)
110110   AM_RANGE(0xd300, 0xd300) AM_WRITE(jcross_vregs0_w)
r2864r2865
339339ROM_END
340340
341341GAME( 1984, jcross, 0, jcross, jcross, 0, ROT270,   "SNK", "Jumping Cross",GAME_NO_COCKTAIL|GAME_IMPERFECT_GRAPHICS)
342
343
src/mame/drivers/nss.c
r2864r2865
325325ADDRESS_MAP_END
326326
327327static INPUT_PORTS_START( snes )
328   PORT_START  /* IN 0 : Joypad 1 - L */
328   PORT_START_TAG("PAD1L")      /* IN 0 : Joypad 1 - L */
329329   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Button A") PORT_PLAYER(1)
330330   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 Button X") PORT_PLAYER(1)
331331   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P1 Button L") PORT_PLAYER(1)
332332   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P1 Button R") PORT_PLAYER(1)
333   PORT_START  /* IN 1 : Joypad 1 - H */
333   PORT_START_TAG("PAD1H")      /* IN 1 : Joypad 1 - H */
334334   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Button B") PORT_PLAYER(1)
335335   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Button Y") PORT_PLAYER(1)
336336   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("P1 Select")
r2864r2865
340340   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
341341   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
342342
343   PORT_START  /* IN 2 : Joypad 2 - L */
343   PORT_START_TAG("PAD2L")      /* IN 2 : Joypad 2 - L */
344344   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P2 Button A") PORT_PLAYER(2)
345345   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P2 Button X") PORT_PLAYER(2)
346346   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P2 Button L") PORT_PLAYER(2)
347347   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P2 Button R") PORT_PLAYER(2)
348   PORT_START  /* IN 3 : Joypad 2 - H */
348   PORT_START_TAG("PAD2H")      /* IN 3 : Joypad 2 - H */
349349   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Button B") PORT_PLAYER(2)
350350   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Button Y") PORT_PLAYER(2)
351351   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE2 ) PORT_NAME("P2 Select")
r2864r2865
355355   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
356356   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
357357
358   PORT_START  /* IN 4 : Joypad 3 - L */
358   PORT_START_TAG("PAD3L")      /* IN 4 : Joypad 3 - L */
359359   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P3 Button A") PORT_PLAYER(3)
360360   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P3 Button X") PORT_PLAYER(3)
361361   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P3 Button L") PORT_PLAYER(3)
362362   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P3 Button R") PORT_PLAYER(3)
363   PORT_START  /* IN 5 : Joypad 3 - H */
363   PORT_START_TAG("PAD3H")      /* IN 5 : Joypad 3 - H */
364364   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P3 Button B") PORT_PLAYER(3)
365365   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P3 Button Y") PORT_PLAYER(3)
366366   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE3 ) PORT_NAME("P3 Select")
r2864r2865
370370   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)
371371   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)
372372
373   PORT_START  /* IN 6 : Joypad 4 - L */
373   PORT_START_TAG("PAD4L")      /* IN 6 : Joypad 4 - L */
374374   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P4 Button A") PORT_PLAYER(4)
375375   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P4 Button X") PORT_PLAYER(4)
376376   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P4 Button L") PORT_PLAYER(4)
377377   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P4 Button R") PORT_PLAYER(4)
378   PORT_START  /* IN 7 : Joypad 4 - H */
378   PORT_START_TAG("PAD4H")      /* IN 7 : Joypad 4 - H */
379379   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P4 Button B") PORT_PLAYER(4)
380380   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P4 Button Y") PORT_PLAYER(4)
381381   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE4 ) PORT_NAME("P4 Select")
r2864r2865
385385   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
386386   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
387387
388   PORT_START   /* IN 8 : dip-switches */
388   PORT_START_TAG("DSW")   /* IN 8 : dip-switches */
389389   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Difficulty ) )
390390   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
391391   PORT_DIPSETTING(    0x03, DEF_STR( Hard )  )
src/mame/drivers/jack.c
r2864r2865
8989
9090static READ8_HANDLER( joinem_input1_r )
9191{
92   UINT8 ret = input_port_read_indexed(machine, 1) & ~0x20;
92   UINT8 ret = input_port_read(machine, "DSW2") & ~0x20;
9393
94   if((input_port_read_indexed(machine, 4) & 0x80) && !joinem_snd_bit)
94   if((input_port_read(machine, "IN2") & 0x80) && !joinem_snd_bit)
9595      ret |= 0x20;
9696
9797   return ret;
r2864r2865
142142   AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
143143   AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_RAM)
144144   AM_RANGE(0xb000, 0xb07f) AM_READ(SMH_RAM)
145   AM_RANGE(0xb500, 0xb500) AM_READ(input_port_0_r)
146   AM_RANGE(0xb501, 0xb501) AM_READ(input_port_1_r)
147   AM_RANGE(0xb502, 0xb502) AM_READ(input_port_2_r)
148   AM_RANGE(0xb503, 0xb503) AM_READ(input_port_3_r)
149   AM_RANGE(0xb504, 0xb504) AM_READ(input_port_4_r)
150   AM_RANGE(0xb505, 0xb505) AM_READ(input_port_5_r)
145   AM_RANGE(0xb500, 0xb500) AM_READ_PORT("DSW1")
146   AM_RANGE(0xb501, 0xb501) AM_READ_PORT("DSW2")
147   AM_RANGE(0xb502, 0xb502) AM_READ_PORT("IN0")
148   AM_RANGE(0xb503, 0xb503) AM_READ_PORT("IN1")
149   AM_RANGE(0xb504, 0xb504) AM_READ_PORT("IN2")
150   AM_RANGE(0xb505, 0xb505) AM_READ_PORT("IN3")
151151   AM_RANGE(0xb506, 0xb507) AM_READ(jack_flipscreen_r)
152152   AM_RANGE(0xb800, 0xbfff) AM_READ(SMH_RAM)
153153   AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM)
r2864r2865
170170   AM_RANGE(0x8000, 0x8fff) AM_RAM
171171   AM_RANGE(0xb000, 0xb0ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
172172   AM_RANGE(0xb400, 0xb400) AM_WRITE(jack_sh_command_w)
173   AM_RANGE(0xb500, 0xb500) AM_READ(input_port_0_r)
173   AM_RANGE(0xb500, 0xb500) AM_READ_PORT("DSW1")
174174   AM_RANGE(0xb501, 0xb501) AM_READ(joinem_input1_r)
175   AM_RANGE(0xb502, 0xb502) AM_READ(input_port_2_r)
176   AM_RANGE(0xb503, 0xb503) AM_READ(input_port_3_r)
177   AM_RANGE(0xb504, 0xb504) AM_READ(input_port_4_r)
175   AM_RANGE(0xb502, 0xb502) AM_READ_PORT("IN0")
176   AM_RANGE(0xb503, 0xb503) AM_READ_PORT("IN1")
177   AM_RANGE(0xb504, 0xb504) AM_READ_PORT("IN2")
178178   AM_RANGE(0xb506, 0xb507) AM_READWRITE(jack_flipscreen_r, jack_flipscreen_w)
179179   AM_RANGE(0xb700, 0xb700) AM_WRITE(joinem_misc_w)
180180   AM_RANGE(0xb800, 0xbbff) AM_RAM_WRITE(jack_videoram_w) AM_BASE(&videoram)
r2864r2865
232232   PORT_DIPNAME( 0x80, 0x00, "255 Lives (Cheat)")\
233233   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )\
234234   PORT_DIPSETTING(    0x80, DEF_STR( On ) )\
235   PORT_START_TAG("IN2")\
235   PORT_START_TAG("IN0")\
236236   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )\
237237   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )\
238238   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_UNUSED )\
239239   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )\
240240   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )\
241241   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )\
242   PORT_START_TAG("IN3")\
242   PORT_START_TAG("IN1")\
243243   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY\
244244   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY\
245245   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY\
r2864r2865
248248   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL\
249249   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL\
250250   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL\
251   PORT_START_TAG("IN4")\
251   PORT_START_TAG("IN2")\
252252   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )\
253253   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )\
254254   PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED )\
255   PORT_START_TAG("IN5")\
255   PORT_START_TAG("IN3")\
256256   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL\
257257   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL\
258258   PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED )
r2864r2865
292292
293293/* Same as 'jack', but another different coinage */
294294static INPUT_PORTS_START( jack3 )
295   PORT_START      /* DSW1 */
295   PORT_START_TAG("DSW1")
296296   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
297297   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
298298   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
r2864r2865
383383   PORT_DIPSETTING(    0x40, DEF_STR( None ) )         // 3 under 0 pts
384384//  PORT_DIPSETTING(    0xc0, DEF_STR( None ) )         // 5 under 0 pts
385385
386   PORT_START_TAG("IN2")
386   PORT_START_TAG("IN0")
387387   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
388388   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
389389   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_UNUSED )
390390   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
391391   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
392392
393   PORT_START_TAG("IN3")
393   PORT_START_TAG("IN1")
394394   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_2WAY
395395   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_2WAY
396396   PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED )
r2864r2865
398398   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_2WAY PORT_COCKTAIL
399399   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
400400
401   PORT_START_TAG("IN4")
401   PORT_START_TAG("IN2")
402402   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
403403   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
404404
405   PORT_START_TAG("IN5")
405   PORT_START_TAG("IN3")
406406   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
407407   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
408408INPUT_PORTS_END
r2864r2865
434434   /* probably unused */
435435   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNKNOWN )
436436
437   PORT_START_TAG("IN2")
437   PORT_START_TAG("IN0")
438438   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
439439   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
440440   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r2864r2865
444444   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
445445   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
446446
447   PORT_START_TAG("IN3")
447   PORT_START_TAG("IN1")
448448   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY
449449   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY
450450   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r2864r2865
454454   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
455455   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
456456
457   PORT_START_TAG("IN4")
457   PORT_START_TAG("IN2")
458458   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 )
459459   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
460460   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r2864r2865
464464   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
465465   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
466466
467   PORT_START_TAG("IN5")
467   PORT_START_TAG("IN3")
468468   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
469469   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
470470   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r2864r2865
502502   PORT_START_TAG("DSW2")
503503   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
504504
505   PORT_START_TAG("IN2")
505   PORT_START_TAG("IN0")
506506   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
507507   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
508508   PORT_BIT( 0x3c, IP_ACTIVE_HIGH, IPT_UNUSED )
509509   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
510510   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
511511
512   PORT_START_TAG("IN3")
512   PORT_START_TAG("IN1")
513513   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED )
514514   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY
515515   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY
r2864r2865
517517   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL
518518   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL
519519
520   PORT_START_TAG("IN4")
520   PORT_START_TAG("IN2")
521521   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
522522   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
523523
524   PORT_START_TAG("IN5")
524   PORT_START_TAG("IN3")
525525   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
526526   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
527527INPUT_PORTS_END
r2864r2865
579579   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
580580   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
581581
582   PORT_START_TAG("IN2")
582   PORT_START_TAG("IN0")
583583   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
584584   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
585585   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME ("Select Game 1")
r2864r2865
589589   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
590590   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
591591
592   PORT_START_TAG("IN3")
592   PORT_START_TAG("IN1")
593593   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
594594   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
595595   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
r2864r2865
599599   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
600600   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
601601
602   PORT_START_TAG("IN4")
602   PORT_START_TAG("IN2")
603603   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
604604   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) // not needed?
605605   PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED )
606606
607   PORT_START_TAG("IN5")
607   PORT_START_TAG("IN3")
608608   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
609609   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL  // not needed?
610610   PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED )
611611INPUT_PORTS_END
612612
613613static INPUT_PORTS_START( joinem )
614   PORT_START
614   PORT_START_TAG("DSW1")
615615   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
616616   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
617617   PORT_DIPSETTING(    0x03, DEF_STR( 4C_3C ) )
r2864r2865
635635   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
636636   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
637637
638   PORT_START
638   PORT_START_TAG("DSW2")
639639   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
640640   PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
641641   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
r2864r2865
659659   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
660660   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
661661
662   PORT_START
662   PORT_START_TAG("IN0")
663663   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
664664   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
665665   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
666666   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
667667   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNKNOWN )
668668
669   PORT_START
669   PORT_START_TAG("IN1")
670670   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
671671   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
672672   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
673673   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
674674   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNKNOWN )
675675
676   PORT_START
676   PORT_START_TAG("IN2")
677677   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
678678   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
679679   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
r2864r2865
685685INPUT_PORTS_END
686686
687687static INPUT_PORTS_START( loverboy )
688   PORT_START
688   PORT_START_TAG("DSW1")
689689   PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) )
690690   PORT_DIPSETTING(    0x0c, DEF_STR( 4C_1C ) )
691691   PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
r2864r2865
716716   PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
717717   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
718718
719   PORT_START
719   PORT_START_TAG("DSW2")
720720   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
721721   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
722722   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2864r2865
742742   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
743743   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
744744
745   PORT_START
745   PORT_START_TAG("IN0")
746746   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
747747   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
748748   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
r2864r2865
752752   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
753753   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
754754
755   PORT_START
755   PORT_START_TAG("IN1")
756756   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
757757   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
758758   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
r2864r2865
762762   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
763763   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
764764
765   PORT_START
765   PORT_START_TAG("IN2")
766766   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
767767   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
768768   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
r2864r2865
804804   PORT_START_TAG("DSW2")
805805   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) //?
806806
807   PORT_START_TAG("IN2")
807   PORT_START_TAG("IN0")
808808   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
809809   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
810810   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 )
r2864r2865
814814   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
815815   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
816816
817   PORT_START_TAG("IN3")
817   PORT_START_TAG("IN1")
818818   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
819819   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
820820   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
r2864r2865
824824   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
825825   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
826826
827   PORT_START_TAG("IN4")
827   PORT_START_TAG("IN2")
828828   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2)
829829   PORT_BIT( 0xfd, IP_ACTIVE_HIGH, IPT_UNUSED )
830830
831   PORT_START_TAG("IN5")
831   PORT_START_TAG("IN3")
832832   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) //?
833833INPUT_PORTS_END
834834
r2864r2865
920920      cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
921921   else
922922   {
923      if(!(input_port_read_indexed(machine, 4) & 0x80))
923      if(!(input_port_read(machine, "IN2") & 0x80))
924924         cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
925925   }
926926}
src/mame/drivers/dietgo.c
r2864r2865
6767
6868
6969static INPUT_PORTS_START( dietgo )
70   PORT_START   /* Verified as 4 bit input port only */
70   PORT_START_TAG("IN0")   /* Verified as 4 bit input port only */
7171   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
7272   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
7373   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
7474   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_VBLANK )
7575
76   PORT_START   /* 16bit */
76   PORT_START_TAG("IN1")   /* 16bit */
7777   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
7878   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
7979   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
9191   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
9292   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
9393
94   PORT_START   /* Dip switch bank 1 */
94   PORT_START_TAG("DSW")   /* Dip switch bank 1 */
9595   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
9696   PORT_DIPSETTING(      0x0000, DEF_STR( 3C_1C ) )
9797   PORT_DIPSETTING(      0x0001, DEF_STR( 2C_1C ) )
src/mame/drivers/ettrivia.c
r2864r2865
132132ADDRESS_MAP_END
133133
134134INPUT_PORTS_START( ettrivia )
135   PORT_START
135   PORT_START_TAG("IN0")
136136   PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
137137   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
138138   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
142142   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
143143   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
144144
145   PORT_START
145   PORT_START_TAG("IN1")
146146   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
147147   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
148148   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
152152   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
153153   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
154154
155   PORT_START
155   PORT_START_TAG("COIN")
156156   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
157157INPUT_PORTS_END
158158
r2864r2865
230230
231231static INTERRUPT_GEN( ettrivia_interrupt )
232232{
233   if( input_port_read_indexed(machine, 2) & 0x01 )
233   if( input_port_read(machine, "COIN") & 0x01 )
234234      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
235235   else
236236      cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
src/mame/drivers/jalmah.c
r2864r2865
194194   tilemap_set_transparent_pen(sc3_tilemap,15);
195195}
196196
197#define MCU_READ(_number_,_bit_,_offset_,_retval_)\
198if((0xffff - input_port_read_indexed(machine, _number_)) & _bit_) { jm_regs[_offset_] = _retval_; }
197#define MCU_READ(tag, _bit_, _offset_, _retval_) \
198if((0xffff - input_port_read(machine, tag)) & _bit_) { jm_regs[_offset_] = _retval_; }
199199
200200/*RAM-based protection handlings*/
201201static void daireika_mcu_run(running_machine *machine)
202202{
203203   static UINT16 prg_prot;
204204
205   if((0xffff - input_port_read_indexed(machine,0)) & 0x0008)//service_mode
205   if((0xffff - input_port_read(machine, "SYSTEM")) & 0x0008)   //service_mode
206206   {
207      jm_regs[0x000/2] = input_port_read_indexed(machine,2);
208      jm_regs[0x002/2] = input_port_read_indexed(machine,3);
209      jm_regs[0x004/2] = input_port_read_indexed(machine,4);
210      jm_regs[0x006/2] = input_port_read_indexed(machine,5);
211      jm_regs[0x008/2] = input_port_read_indexed(machine,6);
212      jm_regs[0x00a/2] = input_port_read_indexed(machine,7);
207      jm_regs[0x000/2] = input_port_read(machine, "KEY0");
208      jm_regs[0x002/2] = input_port_read(machine, "KEY1");
209      jm_regs[0x004/2] = input_port_read(machine, "KEY2");
210      jm_regs[0x006/2] = input_port_read(machine, "KEY3");
211      jm_regs[0x008/2] = input_port_read(machine, "KEY4");
212      jm_regs[0x00a/2] = input_port_read(machine, "KEY5");
213213   }
214214   else
215215   {
216216      jm_regs[0x000/2] = 0x0000;
217      MCU_READ(3,0x0001,0x000/2,0x00);/*FF*/
218      MCU_READ(4,0x0400,0x000/2,0x01);/*A*/
219      MCU_READ(4,0x1000,0x000/2,0x02);/*B*/
220      MCU_READ(4,0x0200,0x000/2,0x03);/*C*/
221      MCU_READ(4,0x0800,0x000/2,0x04);/*D*/
222      MCU_READ(4,0x0004,0x000/2,0x05);/*E*/
223      MCU_READ(4,0x0010,0x000/2,0x06);/*F*/
224      MCU_READ(4,0x0002,0x000/2,0x07);/*G*/
225      MCU_READ(4,0x0008,0x000/2,0x08);/*H*/
226      MCU_READ(3,0x0400,0x000/2,0x09);/*I*/
227      MCU_READ(3,0x1000,0x000/2,0x0a);/*J*/
228      MCU_READ(3,0x0200,0x000/2,0x0b);/*K*/
229      MCU_READ(3,0x0800,0x000/2,0x0c);/*L*/
230      MCU_READ(3,0x0004,0x000/2,0x0d);/*M*/
231      MCU_READ(3,0x0010,0x000/2,0x0e);/*N*/
232      MCU_READ(2,0x0200,0x000/2,0x0f);/*RON   (trusted)*/
233      MCU_READ(2,0x1000,0x000/2,0x10);/*REACH (trusted)*/
234      MCU_READ(2,0x0400,0x000/2,0x11);/*KAN            */
235      MCU_READ(3,0x0008,0x000/2,0x12);/*PON            */
236      MCU_READ(3,0x0002,0x000/2,0x13);/*CHI   (trusted)*/
237      MCU_READ(2,0x0004,0x000/2,0x14);/*START1*/
217      MCU_READ("KEY1", 0x0001, 0x000/2, 0x00);      /*FF*/
218      MCU_READ("KEY2", 0x0400, 0x000/2, 0x01);      /*A*/
219      MCU_READ("KEY2", 0x1000, 0x000/2, 0x02);      /*B*/
220      MCU_READ("KEY2", 0x0200, 0x000/2, 0x03);      /*C*/
221      MCU_READ("KEY2", 0x0800, 0x000/2, 0x04);      /*D*/
222      MCU_READ("KEY2", 0x0004, 0x000/2, 0x05);      /*E*/
223      MCU_READ("KEY2", 0x0010, 0x000/2, 0x06);      /*F*/
224      MCU_READ("KEY2", 0x0002, 0x000/2, 0x07);      /*G*/
225      MCU_READ("KEY2", 0x0008, 0x000/2, 0x08);      /*H*/
226      MCU_READ("KEY1", 0x0400, 0x000/2, 0x09);      /*I*/
227      MCU_READ("KEY1", 0x1000, 0x000/2, 0x0a);      /*J*/
228      MCU_READ("KEY1", 0x0200, 0x000/2, 0x0b);      /*K*/
229      MCU_READ("KEY1", 0x0800, 0x000/2, 0x0c);      /*L*/
230      MCU_READ("KEY1", 0x0004, 0x000/2, 0x0d);      /*M*/
231      MCU_READ("KEY1", 0x0010, 0x000/2, 0x0e);      /*N*/
232      MCU_READ("KEY0", 0x0200, 0x000/2, 0x0f);      /*RON   (trusted)*/
233      MCU_READ("KEY0", 0x1000, 0x000/2, 0x10);      /*REACH (trusted)*/
234      MCU_READ("KEY0", 0x0400, 0x000/2, 0x11);      /*KAN            */
235      MCU_READ("KEY1", 0x0008, 0x000/2, 0x12);      /*PON            */
236      MCU_READ("KEY1", 0x0002, 0x000/2, 0x13);      /*CHI   (trusted)*/
237      MCU_READ("KEY0", 0x0004, 0x000/2, 0x14);      /*START1*/
238238   }
239239   jm_regs[0x00c/2] = mame_rand(machine) & 0xffff;
240240   prg_prot++;
r2864r2865
247247{
248248   static UINT16 prg_prot;
249249
250   if((0xffff - input_port_read_indexed(machine,0)) & 0x0008)//service_mode
250   if((0xffff - input_port_read(machine, "SYSTEM")) & 0x0008)   //service_mode
251251   {
252      jm_regs[0x300/2] = input_port_read_indexed(machine,2);
253      jm_regs[0x302/2] = input_port_read_indexed(machine,3);
254      jm_regs[0x304/2] = input_port_read_indexed(machine,4);
255      jm_regs[0x306/2] = input_port_read_indexed(machine,5);
256      jm_regs[0x308/2] = input_port_read_indexed(machine,6);
257      jm_regs[0x30a/2] = input_port_read_indexed(machine,7);
252      jm_regs[0x300/2] = input_port_read(machine, "KEY0");
253      jm_regs[0x302/2] = input_port_read(machine, "KEY1");
254      jm_regs[0x304/2] = input_port_read(machine, "KEY2");
255      jm_regs[0x306/2] = input_port_read(machine, "KEY3");
256      jm_regs[0x308/2] = input_port_read(machine, "KEY4");
257      jm_regs[0x30a/2] = input_port_read(machine, "KEY5");
258258   }
259259   else
260260   {
261261      jm_regs[0x300/2] = 0x0000;
262      MCU_READ(3,0x0001,0x300/2,0x00);/*FF*/
263      MCU_READ(4,0x0400,0x300/2,0x01);/*A*/
264      MCU_READ(4,0x1000,0x300/2,0x02);/*B*/
265      MCU_READ(4,0x0200,0x300/2,0x03);/*C*/
266      MCU_READ(4,0x0800,0x300/2,0x04);/*D*/
267      MCU_READ(4,0x0004,0x300/2,0x05);/*E*/
268      MCU_READ(4,0x0010,0x300/2,0x06);/*F*/
269      MCU_READ(4,0x0002,0x300/2,0x07);/*G*/
270      MCU_READ(4,0x0008,0x300/2,0x08);/*H*/
271      MCU_READ(3,0x0400,0x300/2,0x09);/*I*/
272      MCU_READ(3,0x1000,0x300/2,0x0a);/*J*/
273      MCU_READ(3,0x0200,0x300/2,0x0b);/*K*/
274      MCU_READ(3,0x0800,0x300/2,0x0c);/*L*/
275      MCU_READ(3,0x0004,0x300/2,0x0d);/*M*/
276      MCU_READ(3,0x0010,0x300/2,0x0e);/*N*/
277      MCU_READ(2,0x0200,0x300/2,0x0f);/*RON   (trusted)*/
278      MCU_READ(2,0x1000,0x300/2,0x10);/*REACH (trusted)*/
279      MCU_READ(2,0x0400,0x300/2,0x11);/*KAN            */
280      MCU_READ(3,0x0008,0x300/2,0x12);/*PON            */
281      MCU_READ(3,0x0002,0x300/2,0x13);/*CHI   (trusted)*/
282      MCU_READ(2,0x0004,0x300/2,0x14);/*START1*/
262      MCU_READ("KEY1", 0x0001, 0x300/2, 0x00);      /*FF*/
263      MCU_READ("KEY2", 0x0400, 0x300/2, 0x01);      /*A*/
264      MCU_READ("KEY2", 0x1000, 0x300/2, 0x02);      /*B*/
265      MCU_READ("KEY2", 0x0200, 0x300/2, 0x03);      /*C*/
266      MCU_READ("KEY2", 0x0800, 0x300/2, 0x04);      /*D*/
267      MCU_READ("KEY2", 0x0004, 0x300/2, 0x05);      /*E*/
268      MCU_READ("KEY2", 0x0010, 0x300/2, 0x06);      /*F*/
269      MCU_READ("KEY2", 0x0002, 0x300/2, 0x07);      /*G*/
270      MCU_READ("KEY2", 0x0008, 0x300/2, 0x08);      /*H*/
271      MCU_READ("KEY1", 0x0400, 0x300/2, 0x09);      /*I*/
272      MCU_READ("KEY1", 0x1000, 0x300/2, 0x0a);      /*J*/
273      MCU_READ("KEY1", 0x0200, 0x300/2, 0x0b);      /*K*/
274      MCU_READ("KEY1", 0x0800, 0x300/2, 0x0c);      /*L*/
275      MCU_READ("KEY1", 0x0004, 0x300/2, 0x0d);      /*M*/
276      MCU_READ("KEY1", 0x0010, 0x300/2, 0x0e);      /*N*/
277      MCU_READ("KEY0", 0x0200, 0x300/2, 0x0f);      /*RON   (trusted)*/
278      MCU_READ("KEY0", 0x1000, 0x300/2, 0x10);      /*REACH (trusted)*/
279      MCU_READ("KEY0", 0x0400, 0x300/2, 0x11);      /*KAN            */
280      MCU_READ("KEY1", 0x0008, 0x300/2, 0x12);      /*PON            */
281      MCU_READ("KEY1", 0x0002, 0x300/2, 0x13);      /*CHI   (trusted)*/
282      MCU_READ("KEY0", 0x0004, 0x300/2, 0x14);      /*START1*/
283283   }
284284   jm_regs[0x30c/2] = mame_rand(machine) & 0xffff;
285285   prg_prot++;
r2864r2865
289289
290290static void second_mcu_run(running_machine *machine)
291291{
292   if((0xffff - input_port_read_indexed(machine,1)) & 0x0004)//service_mode
292   if((0xffff - input_port_read(machine, "DSW")) & 0x0004)   //service_mode
293293   {
294      jm_regs[0x200/2] = input_port_read_indexed(machine,2);
295      jm_regs[0x202/2] = input_port_read_indexed(machine,3);
296      jm_regs[0x204/2] = input_port_read_indexed(machine,4);
294      jm_regs[0x200/2] = input_port_read(machine, "KEY0");
295      jm_regs[0x202/2] = input_port_read(machine, "KEY1");
296      jm_regs[0x204/2] = input_port_read(machine, "KEY2");
297297   }
298298   else
299299   {
300300      jm_regs[0x200/2] = 0x0000;
301      MCU_READ(3,0x0001,0x200/2,0x00);/*FF*/
302      MCU_READ(4,0x0400,0x200/2,0x01);/*A*/
303      MCU_READ(4,0x1000,0x200/2,0x02);/*B*/
304      MCU_READ(4,0x0200,0x200/2,0x03);/*C*/
305      MCU_READ(4,0x0800,0x200/2,0x04);/*D*/
306      MCU_READ(4,0x0004,0x200/2,0x05);/*E*/
307      MCU_READ(4,0x0010,0x200/2,0x06);/*F*/
308      MCU_READ(4,0x0002,0x200/2,0x07);/*G*/
309      MCU_READ(4,0x0008,0x200/2,0x08);/*H*/
310      MCU_READ(3,0x0400,0x200/2,0x09);/*I*/
311      MCU_READ(3,0x1000,0x200/2,0x0a);/*J*/
312      MCU_READ(3,0x0200,0x200/2,0x0b);/*K*/
313      MCU_READ(3,0x0800,0x200/2,0x0c);/*L*/
314      MCU_READ(3,0x0004,0x200/2,0x0d);/*M*/
315      MCU_READ(3,0x0010,0x200/2,0x0e);/*N*/
316      MCU_READ(2,0x0200,0x200/2,0x0f);/*RON*/
317      MCU_READ(2,0x1000,0x200/2,0x10);/*REACH*/
318      MCU_READ(2,0x0400,0x200/2,0x11);/*KAN*/
319      MCU_READ(3,0x0008,0x200/2,0x12);/*PON*/
320      MCU_READ(3,0x0002,0x200/2,0x13);/*CHI*/
321      MCU_READ(2,0x0004,0x200/2,0x14);/*START1*/
301      MCU_READ("KEY1", 0x0001, 0x200/2, 0x00);      /*FF*/
302      MCU_READ("KEY2", 0x0400, 0x200/2, 0x01);      /*A*/
303      MCU_READ("KEY2", 0x1000, 0x200/2, 0x02);      /*B*/
304      MCU_READ("KEY2", 0x0200, 0x200/2, 0x03);      /*C*/
305      MCU_READ("KEY2", 0x0800, 0x200/2, 0x04);      /*D*/
306      MCU_READ("KEY2", 0x0004, 0x200/2, 0x05);      /*E*/
307      MCU_READ("KEY2", 0x0010, 0x200/2, 0x06);      /*F*/
308      MCU_READ("KEY2", 0x0002, 0x200/2, 0x07);      /*G*/
309      MCU_READ("KEY2", 0x0008, 0x200/2, 0x08);      /*H*/
310      MCU_READ("KEY1", 0x0400, 0x200/2, 0x09);      /*I*/
311      MCU_READ("KEY1", 0x1000, 0x200/2, 0x0a);      /*J*/
312      MCU_READ("KEY1", 0x0200, 0x200/2, 0x0b);      /*K*/
313      MCU_READ("KEY1", 0x0800, 0x200/2, 0x0c);      /*L*/
314      MCU_READ("KEY1", 0x0004, 0x200/2, 0x0d);      /*M*/
315      MCU_READ("KEY1", 0x0010, 0x200/2, 0x0e);      /*N*/
316      MCU_READ("KEY0", 0x0200, 0x200/2, 0x0f);      /*RON*/
317      MCU_READ("KEY0", 0x1000, 0x200/2, 0x10);      /*REACH*/
318      MCU_READ("KEY0", 0x0400, 0x200/2, 0x11);      /*KAN*/
319      MCU_READ("KEY1", 0x0008, 0x200/2, 0x12);      /*PON*/
320      MCU_READ("KEY1", 0x0002, 0x200/2, 0x13);      /*CHI*/
321      MCU_READ("KEY0", 0x0004, 0x200/2, 0x14);      /*START1*/
322322
323//      MCU_READ(2,0x0004,0x7b8/2,0x03);/*START1(correct?)  */
323//      MCU_READ("KEY0", 0x0004, 0x7b8/2, 0x03);        /*START1(correct?)  */
324324   }
325325   jm_regs[0x20c/2] = mame_rand(machine) & 0xffff; //kakumei2
326326
r2864r2865
548548ADDRESS_MAP_END
549549
550550
551
552
553static INPUT_PORTS_START( jalmah )
551static INPUT_PORTS_START( common )
554552   /*System port*/
555   PORT_START
553   PORT_START_TAG("SYSTEM")
556554   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
557555   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
558556   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
562560   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
563561   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
564562   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
565   PORT_SERVICE( 0x0008, IP_ACTIVE_LOW )
563   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
564   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
565   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
566566   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
567567   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
568568   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
595595   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
596596
597597   /*Dip-SW port*/
598   PORT_START
598   PORT_START_TAG("DSW")
599599   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )    // Coin2 is always 1C/1C.
600600   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
601601   PORT_DIPSETTING(      0x0002, DEF_STR( 3C_1C ) )
r2864r2865
646646   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
647647
648648   /*Mahjong Panel ports*/
649   PORT_START
649   PORT_START_TAG("KEY0")
650650   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
651651   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
652652   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
653653   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
654654   PORT_BIT( 0xe9fb, IP_ACTIVE_LOW, IPT_UNUSED )
655655
656   PORT_START
656   PORT_START_TAG("KEY1")
657657   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
658658   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
659659   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_M )
r2864r2865
665665   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_J )
666666   PORT_BIT( 0xe1e0, IP_ACTIVE_LOW, IPT_UNUSED )
667667
668   PORT_START
668   PORT_START_TAG("KEY2")
669669   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_G )
670670   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_E )
671671   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_H )
r2864r2865
675675   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_D )
676676   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_B )
677677   PORT_BIT( 0xe1e1, IP_ACTIVE_LOW, IPT_UNUSED )
678INPUT_PORTS_END
678679
679   PORT_START
680static INPUT_PORTS_START( jalmah )
681   PORT_INCLUDE( common )
682
683   PORT_MODIFY("SYSTEM")
684   PORT_SERVICE( 0x0008, IP_ACTIVE_LOW )
685
686   PORT_START_TAG("KEY3")
680687   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START2 )
681688   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_RON )    PORT_PLAYER(2)
682689   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )    PORT_PLAYER(2)
683690   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )PORT_PLAYER(2)
684691   PORT_BIT( 0xe9fb, IP_ACTIVE_LOW, IPT_UNUSED )       PORT_PLAYER(2)
685692
686   PORT_START
693   PORT_START_TAG("KEY4")
687694   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_PLAYER(2)
688695   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )        PORT_PLAYER(2)
689696   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_M )       PORT_PLAYER(2)
r2864r2865
695702   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_J )       PORT_PLAYER(2)
696703   PORT_BIT( 0xe1e0, IP_ACTIVE_LOW, IPT_UNUSED )
697704
698   PORT_START
705   PORT_START_TAG("KEY5")
699706   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_G )PORT_PLAYER(2)
700707   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_E )PORT_PLAYER(2)
701708   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_H )PORT_PLAYER(2)
r2864r2865
709716
710717
711718static INPUT_PORTS_START( jalmah2 )
712   /*System port*/
713   PORT_START
714   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
715   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
716   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
717   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
718   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
719   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
720   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
721   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
722   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
723   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
724   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
725   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
726   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
727   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
728   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
729   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
730   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN1 )
731   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN2 )
732   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
733   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
734   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
735   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
736   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
737   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
738   PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
739   PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
740   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
741   PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) )
742   PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
743   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
744   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
745   PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
746   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
747   PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
748   PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
749   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
750   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
751   PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
752   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
753   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
754   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
755   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
719   PORT_INCLUDE( common )
756720
757   /*Dip-SW port*/
758   PORT_START
721   PORT_MODIFY("DSW")
759722   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )
760723   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
761724   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
763726   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
764727   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
765728   PORT_SERVICE( 0x0004, IP_ACTIVE_LOW )
766   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
767   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
768   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
769   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
770   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
771   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
772   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
773   PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
774   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
775   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
776   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
777   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
778729   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
779730   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
780731   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
787738   PORT_DIPSETTING(      0x0500, DEF_STR( 1C_3C ) )
788739   PORT_DIPSETTING(      0x0400, DEF_STR( 1C_4C ) )
789740   PORT_DIPSETTING(      0x0000, "1 Coin / 99 Credits" )
790   PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) )
791   PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
792   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
793   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
794   PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
795   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
796   PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
797   PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
798   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
799   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
800   PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
801   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
802   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
803   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
804   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
805741
806   /*Mahjong Panel ports*/
807   PORT_START
808   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
809   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
810   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
811   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
812   PORT_BIT( 0xe9fb, IP_ACTIVE_LOW, IPT_UNUSED )
813
814   PORT_START
742   PORT_MODIFY("KEY1")
815743   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_NAME("P1 Mahjong Flip Flop?")   PORT_CODE(KEYCODE_2) //? seems a button,affects continue countdown
816   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
817   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_M )
818   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
819   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_N )
820   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_K )
821   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_I )
822   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_L )
823   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_J )
824   PORT_BIT( 0xe1e0, IP_ACTIVE_LOW, IPT_UNUSED )
825
826   PORT_START
827   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_G )
828   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_E )
829   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_H )
830   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_F )
831   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_C )
832   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_A )
833   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_D )
834   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_B )
835   PORT_BIT( 0xe1e1, IP_ACTIVE_LOW, IPT_UNUSED )
836744INPUT_PORTS_END
837745
838746
839747static INPUT_PORTS_START( jalmah2a )
840   /*System port*/
841   PORT_START
842   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
843   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
844   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
845   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
846   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
847   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
848   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
849   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
850   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
851   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
852   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
853   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
854   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
855   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
856   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
857   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
858   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN1 )
859   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN2 )
860   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
861   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
862   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
863   PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
864   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
865   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
866   PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
867   PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
868   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
869   PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) )
870   PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
871   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
872   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
873   PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
874   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
875   PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
876   PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
877   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
878   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
879   PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
880   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
881   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
882   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
883   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
748   PORT_INCLUDE( common )
884749
885   /*Dip-SW port*/
886   PORT_START
750   PORT_MODIFY("DSW")
887751   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
888752   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
889753   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
891755   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
892756   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
893757   PORT_SERVICE( 0x0004, IP_ACTIVE_LOW )
894   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
895   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
896   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
897758   PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Demo_Sounds ) )
898759   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
899760   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
900   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
901   PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
902   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
903   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
904   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
905   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
906761   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
907762   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
908763   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
915770   PORT_DIPSETTING(      0x0500, DEF_STR( 1C_3C ) )
916771   PORT_DIPSETTING(      0x0400, DEF_STR( 1C_4C ) )
917772   PORT_DIPSETTING(      0x0000, "1 Coin / 99 Credits" )
918   PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) )
919   PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
920   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
921   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
922   PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
923   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
924   PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
925   PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
926   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
927   PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
928   PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
929   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
930773   PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Flip_Screen ) )
931774   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
932775   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
933776
934   /*Mahjong Panel ports*/
935   PORT_START
936   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
937   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
938   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
939   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
940   PORT_BIT( 0xe9fb, IP_ACTIVE_LOW, IPT_UNUSED )
941
942   PORT_START
777   PORT_MODIFY("KEY1")
943778   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_NAME("P1 Mahjong Flip Flop?")   PORT_CODE(KEYCODE_2) //? seems a button,affects continue countdown
944   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
945   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_M )
946   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
947   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_N )
948   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_K )
949   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_I )
950   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_L )
951   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_J )
952   PORT_BIT( 0xe1e0, IP_ACTIVE_LOW, IPT_UNUSED )
953
954   PORT_START
955   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_G )
956   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_E )
957   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_H )
958   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_F )
959   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_C )
960   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_A )
961   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_D )
962   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_B )
963   PORT_BIT( 0xe1e1, IP_ACTIVE_LOW, IPT_UNUSED )
964779INPUT_PORTS_END
965780
966781static const gfx_layout charlayout =
src/mame/drivers/lvcards.c
r2864r2865
136136
137137static READ8_HANDLER( payout_r )
138138{
139   result = input_port_read_indexed(machine, 2);
139   result = input_port_read(machine, "IN2");
140140
141141   if (payout)
142142   {
r2864r2865
158158   AM_RANGE(0x6000, 0x67ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
159159   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(lvcards_videoram_w) AM_BASE(&videoram)
160160   AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(lvcards_colorram_w) AM_BASE(&colorram)
161   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
162   AM_RANGE(0xa001, 0xa001) AM_READ(input_port_1_r) AM_WRITENOP // lamps
161   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
162   AM_RANGE(0xa001, 0xa001) AM_READ_PORT("IN1") AM_WRITENOP // lamps
163163   AM_RANGE(0xa002, 0xa002) AM_READ(payout_r) AM_WRITE(control_port_2a_w)//AM_WRITENOP // ???
164164ADDRESS_MAP_END
165165
r2864r2865
168168   AM_RANGE(0x6000, 0x67ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
169169   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(lvcards_videoram_w) AM_BASE(&videoram)
170170   AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(lvcards_colorram_w) AM_BASE(&colorram)
171   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
172   AM_RANGE(0xa001, 0xa001) AM_READ(input_port_1_r) AM_WRITENOP
173   AM_RANGE(0xa002, 0xa002) AM_READ(input_port_2_r) AM_WRITENOP
171   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
172   AM_RANGE(0xa001, 0xa001) AM_READ_PORT("IN1") AM_WRITENOP
173   AM_RANGE(0xa002, 0xa002) AM_READ_PORT("IN2") AM_WRITENOP
174174   AM_RANGE(0xc000, 0xdfff) AM_ROM
175175ADDRESS_MAP_END
176176
r2864r2865
185185   AM_RANGE(0x6000, 0x67ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
186186   AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(lvcards_videoram_w) AM_BASE(&videoram)
187187   AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(lvcards_colorram_w) AM_BASE(&colorram)
188   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
189   AM_RANGE(0xa001, 0xa001) AM_READ(input_port_1_r) AM_WRITENOP // lamps
188   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
189   AM_RANGE(0xa001, 0xa001) AM_READ_PORT("IN1") AM_WRITENOP // lamps
190190   AM_RANGE(0xa002, 0xa002) AM_READ(payout_r) AM_WRITE(control_port_2_w)
191191   AM_RANGE(0xc000, 0xdfff) AM_ROM
192192ADDRESS_MAP_END
src/mame/drivers/tecmosys.c
r2864r2865
188188#include "sound/okim6295.h"
189189#include "sound/262intf.h"
190190#include "sound/ymz280b.h"
191#include "deprecat.h"
192191
193192static UINT16* tecmosys_spriteram;
194193static UINT16* tilemap_paletteram16;
r2864r2865
399398}
400399
401400
402INLINE void set_color_555(pen_t color, int rshift, int gshift, int bshift, UINT16 data)
401INLINE void set_color_555(running_machine *machine, pen_t color, int rshift, int gshift, int bshift, UINT16 data)
403402{
404   palette_set_color_rgb(Machine, color, pal5bit(data >> rshift), pal5bit(data >> gshift), pal5bit(data >> bshift));
403   palette_set_color_rgb(machine, color, pal5bit(data >> rshift), pal5bit(data >> gshift), pal5bit(data >> bshift));
405404}
406405
407406
408407static WRITE16_HANDLER( tilemap_paletteram16_xGGGGGRRRRRBBBBB_word_w )
409408{
410409   COMBINE_DATA(&tilemap_paletteram16[offset]);
411   set_color_555(offset+0x4000, 5, 10, 0, tilemap_paletteram16[offset]);
410   set_color_555(machine, offset+0x4000, 5, 10, 0, tilemap_paletteram16[offset]);
412411}
413412
414413static WRITE16_HANDLER( bg0_tilemap_lineram_w )
r2864r2865
731730   }
732731}
733732
734static void tecmosys_do_final_mix(bitmap_t* bitmap)
733static void tecmosys_do_final_mix(running_machine *machine, bitmap_t* bitmap)
735734{
736   const pen_t *paldata = Machine->pens;
735   const pen_t *paldata = machine->pens;
737736   int y,x;
738737   UINT16 *srcptr;
739738   UINT16 *srcptr2;
r2864r2865
806805static VIDEO_UPDATE(deroon)
807806{
808807
809   fillbitmap(bitmap,Machine->pens[0x4000],cliprect);
808   fillbitmap(bitmap,screen->machine->pens[0x4000],cliprect);
810809
811810
812811   tilemap_set_scrolly( bg0tilemap, 0, tecmosys_c80000regs[1]+16);
r2864r2865
837836   tecmosys_tilemap_copy_to_compose(0xc000);
838837
839838
840   tecmosys_do_final_mix(bitmap);
839   tecmosys_do_final_mix(screen->machine, bitmap);
841840
842841/*
843842    popmessage("%04x %04x %04x %04x | %04x %04x %04x %04x | %04x %04x %04x %04x  | %04x %04x %04x %04x  | %04x %04x %04x %04x  | %04x %04x %04x %04x",
r2864r2865
936935   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
937936
938937   MDRV_SCREEN_ADD("main", RASTER)
939   MDRV_SCREEN_REFRESH_RATE(60)
938   MDRV_SCREEN_REFRESH_RATE(57.4458)
940939   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(3000))
941940   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
942941   MDRV_SCREEN_SIZE(64*8, 64*8)
src/mame/drivers/exidy440.c
r2864r2865
344344{
345345   /* I/O1 accesses clear the CIRQ flip/flop */
346346   cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
347   return input_port_read_indexed(machine, 3);
347   return input_port_read(machine, "IN3");
348348}
349349
350350
r2864r2865
435435
436436static READ8_HANDLER( topsecex_input_port_5_r )
437437{
438   return (input_port_read_indexed(machine, 5) & 1) ? 0x01 : 0x02;
438   return (input_port_read(machine, "AN1") & 1) ? 0x01 : 0x02;
439439}
440440
441441
r2864r2865
517517
518518
519519static INPUT_PORTS_START( crossbow )
520   PORT_START            /* player inputs and logic board dips */
520   PORT_START_TAG("IN0")      /* player inputs and logic board dips */
521521   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
522522   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
523523   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
r2864r2865
533533   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
534534   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
535535
536   PORT_START             /* audio board dips */
536   PORT_START_TAG("IN1")       /* audio board dips */
537537   COINAGE
538538   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN )
539539   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )
540540   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
541541   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
542542
543   PORT_START            /* start button */
543   PORT_START_TAG("IN2")      /* start button */
544544   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
545545   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
546546
547   PORT_START            /* coin counters */
547   PORT_START_TAG("IN3")      /* coin counters */
548548   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
549549   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
550550   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
551551
552   PORT_START            /* fake analog X */
552   PORT_START_TAG("AN0")      /* fake analog X */
553553   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
554554
555   PORT_START            /* fake analog Y */
555   PORT_START_TAG("AN1")      /* fake analog Y */
556556   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
557557INPUT_PORTS_END
558558
559559
560560static INPUT_PORTS_START( cheyenne )
561   PORT_START            /* player inputs and logic board dips */
561   PORT_START_TAG("IN0")      /* player inputs and logic board dips */
562562   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
563563   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
564564   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
r2864r2865
574574   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
575575   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
576576
577   PORT_START             /* audio board dips */
577   PORT_START_TAG("IN1")      /* audio board dips */
578578   COINAGE
579579   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN )
580580   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )
581581   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
582582   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
583583
584   PORT_START            /* start button */
584   PORT_START_TAG("IN2")      /* start button */
585585   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
586586   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
587587
588   PORT_START            /* coin counters */
588   PORT_START_TAG("IN3")      /* coin counters */
589589   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
590590   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
591591   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
592592
593   PORT_START            /* fake analog X */
593   PORT_START_TAG("AN0")      /* fake analog X */
594594   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
595595
596   PORT_START            /* fake analog Y */
596   PORT_START_TAG("AN1")      /* fake analog Y */
597597   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
598598INPUT_PORTS_END
599599
600600
601601static INPUT_PORTS_START( combat )
602   PORT_START            /* player inputs and logic board dips */
602   PORT_START_TAG("IN0")      /* player inputs and logic board dips */
603603   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
604604   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
605605   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
r2864r2865
615615   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
616616   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
617617
618   PORT_START             /* audio board dips */
618   PORT_START_TAG("IN1")       /* audio board dips */
619619   COINAGE
620620   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN )
621621   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )
622622   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
623623   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
624624
625   PORT_START            /* start button */
625   PORT_START_TAG("IN2")      /* start button */
626626   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
627627   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
628628
629   PORT_START            /* coin counters */
629   PORT_START_TAG("IN3")      /* coin counters */
630630   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
631631   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
632632   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
633633
634   PORT_START            /* fake analog X */
634   PORT_START_TAG("AN0")      /* fake analog X */
635635   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
636636
637   PORT_START            /* fake analog Y */
637   PORT_START_TAG("AN1")      /* fake analog Y */
638638   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
639639INPUT_PORTS_END
640640
641641
642642static INPUT_PORTS_START( catch22 )
643   PORT_START            /* player inputs and logic board dips */
643   PORT_START_TAG("IN0")      /* player inputs and logic board dips */
644644   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
645645   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
646646   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
r2864r2865
656656   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
657657   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
658658
659   PORT_START             /* audio board dips */
659   PORT_START_TAG("IN1")      /* audio board dips */
660660   COINAGE
661661   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN )
662662   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )
663663   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
664664   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
665665
666   PORT_START            /* start button */
666   PORT_START_TAG("IN2")      /* start button */
667667   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
668668   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
669669
670   PORT_START            /* coin counters */
670   PORT_START_TAG("IN3")      /* coin counters */
671671   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
672672   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
673673   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
674674   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
675675
676   PORT_START            /* fake analog X */
676   PORT_START_TAG("AN0")      /* fake analog X */
677677   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
678678
679   PORT_START            /* fake analog Y */
679   PORT_START_TAG("AN1")      /* fake analog Y */
680680   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
681681INPUT_PORTS_END
682682
683683
684684static INPUT_PORTS_START( cracksht )
685   PORT_START            /* player inputs and logic board dips */
685   PORT_START_TAG("IN0")      /* player inputs and logic board dips */
686686   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
687687   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
688688   PORT_DIPNAME( 0x0c, 0x00, "Seconds" )
r2864r2865
698698   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
699699   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
700700
701   PORT_START             /* audio board dips */
701   PORT_START_TAG("IN1")      /* audio board dips */
702702   COINAGE
703703   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN )
704704   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
705705   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
706706   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
707707
708   PORT_START            /* start button */
708   PORT_START_TAG("IN2")      /* start button */
709709   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
710710   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
711711
712   PORT_START            /* coin counters */
712   PORT_START_TAG("IN3")      /* coin counters */
713713   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
714714   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
715715   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
716716   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
717717
718   PORT_START            /* fake analog X */
718   PORT_START_TAG("AN0")      /* fake analog X */
719719   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
720720
721   PORT_START            /* fake analog Y */
721   PORT_START_TAG("AN1")      /* fake analog Y */
722722   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
723723INPUT_PORTS_END
724724
725725
726726static INPUT_PORTS_START( claypign )
727   PORT_START            /* player inputs and logic board dips */
727   PORT_START_TAG("IN0")      /* player inputs and logic board dips */
728728   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
729729   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
730730   PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r2864r2865
736736   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
737737   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
738738
739   PORT_START             /* audio board dips */
739   PORT_START_TAG("IN1")      /* audio board dips */
740740   COINAGE
741741   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN )
742742   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
743743   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
744744   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
745745
746   PORT_START            /* start button */
746   PORT_START_TAG("IN2")      /* start button */
747747   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
748748   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
749749
750   PORT_START            /* coin counters */
750   PORT_START_TAG("IN3")      /* coin counters */
751751   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
752752   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
753753   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
754754   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
755755
756   PORT_START            /* fake analog X */
756   PORT_START_TAG("AN0")      /* fake analog X */
757757   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
758758
759   PORT_START            /* fake analog Y */
759   PORT_START_TAG("AN1")      /* fake analog Y */
760760   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
761761INPUT_PORTS_END
762762
763763
764764static INPUT_PORTS_START( chiller )
765   PORT_START            /* player inputs and logic board dips */
765   PORT_START_TAG("IN0")      /* player inputs and logic board dips */
766766   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
767767   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
768768   PORT_DIPNAME( 0x0c, 0x00, "Seconds" )
r2864r2865
778778   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
779779   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
780780
781   PORT_START             /* audio board dips */
781   PORT_START_TAG("IN1")      /* audio board dips */
782782   COINAGE
783783   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
784784
785   PORT_START            /* start button */
785   PORT_START_TAG("IN2")      /* start button */
786786   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
787787   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
788788
789   PORT_START            /* coin counters */
789   PORT_START_TAG("IN3")      /* coin counters */
790790   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
791791   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
792792   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
793793   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
794794
795   PORT_START            /* fake analog X */
795   PORT_START_TAG("AN0")      /* fake analog X */
796796   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
797797
798   PORT_START            /* fake analog Y */
798   PORT_START_TAG("AN1")      /* fake analog Y */
799799   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
800800INPUT_PORTS_END
801801
802802
803803static INPUT_PORTS_START( topsecex )
804   PORT_START            /* player inputs and logic board dips */
804   PORT_START_TAG("IN0")      /* player inputs and logic board dips */
805805   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
806806   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
807807   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
r2864r2865
817817   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
818818   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
819819
820   PORT_START             /* audio board dips */
820   PORT_START_TAG("IN1")      /* audio board dips */
821821   COINAGE
822822   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
823823
824   PORT_START            /* start button */
824   PORT_START_TAG("IN2")      /* start button */
825825   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 )
826826   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
827827
828   PORT_START            /* coin counters */
828   PORT_START_TAG("IN3")      /* coin counters */
829829   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
830830   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
831831   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
832832   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
833833
834   PORT_START            /* fake analog X */
834   PORT_START_TAG("AN0")      /* fake analog X */
835835   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE
836836
837   PORT_START            /* fake analog Y */
837   PORT_START_TAG("AN1")      /* fake analog Y */
838838   PORT_BIT(  0xff, IP_ACTIVE_LOW, IPT_BUTTON1 )
839839
840   PORT_START            /* start button */
840   PORT_START_TAG("IN4")      /* start button */
841841   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Fireball")
842842   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Laser")
843843   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Missile")
r2864r2865
850850
851851
852852static INPUT_PORTS_START( hitnmiss )
853   PORT_START            /* player inputs and logic board dips */
853   PORT_START_TAG("IN0")      /* player inputs and logic board dips */
854854   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(hitnmiss_button1_r, 0)
855855   PORT_DIPNAME( 0x0c, 0x00, "Seconds" )
856856   PORT_DIPSETTING(    0x04, "20" )
r2864r2865
865865   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
866866   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
867867
868   PORT_START             /* audio board dips */
868   PORT_START_TAG("IN1")      /* audio board dips */
869869   COINAGE
870870   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNKNOWN )
871871   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )
872872   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
873873   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
874874
875   PORT_START            /* start button */
875   PORT_START_TAG("IN2")      /* start button */
876876   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
877877   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
878878
879   PORT_START            /* coin counters */
879   PORT_START_TAG("IN3")      /* coin counters */
880880   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
881881   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
882882   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
883883   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
884884
885   PORT_START            /* fake analog X */
885   PORT_START_TAG("AN0")      /* fake analog X */
886886   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
887887
888   PORT_START            /* fake analog Y */
888   PORT_START_TAG("AN1")      /* fake analog Y */
889889   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
890890
891891   PORT_START_TAG("HITNMISS_BUTTON1")
r2864r2865
894894
895895
896896static INPUT_PORTS_START( whodunit )
897   PORT_START            /* player inputs and logic board dips */
897   PORT_START_TAG("IN0")      /* player inputs and logic board dips */
898898   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
899899   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
900900   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
r2864r2865
910910   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
911911   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
912912
913   PORT_START             /* audio board dips */
913   PORT_START_TAG("IN1")      /* audio board dips */
914914   COINAGE
915915   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
916916
917   PORT_START            /* start button */
917   PORT_START_TAG("IN2")      /* start button */
918918   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
919919   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
920920
921   PORT_START            /* coin counters */
921   PORT_START_TAG("IN3")      /* coin counters */
922922   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
923923   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
924924   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
925925   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
926926
927   PORT_START            /* fake analog X */
927   PORT_START_TAG("AN0")      /* fake analog X */
928928   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
929929
930   PORT_START            /* fake analog Y */
930   PORT_START_TAG("AN1")      /* fake analog Y */
931931   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
932932INPUT_PORTS_END
933933
934934
935935static INPUT_PORTS_START( showdown )
936   PORT_START            /* player inputs and logic board dips */
936   PORT_START_TAG("IN0")      /* player inputs and logic board dips */
937937   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
938938   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
939939   PORT_DIPNAME( 0x0c, 0x00, "Hands" )
r2864r2865
949949   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, 0)
950950   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, 0)
951951
952   PORT_START             /* audio board dips */
952   PORT_START_TAG("IN1")      /* audio board dips */
953953   COINAGE
954954   PORT_DIPNAME( 0x70, 0x70, DEF_STR( Unknown ) )
955955   PORT_DIPSETTING(    0x70, "1" )
r2864r2865
964964   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
965965   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
966966
967   PORT_START            /* start button */
967   PORT_START_TAG("IN2")      /* start button */
968968   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Action")
969969   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Bet-All")
970970   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Gold")
r2864r2865
974974   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
975975   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
976976
977   PORT_START            /* coin counters */
977   PORT_START_TAG("IN3")      /* coin counters */
978978   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
979979   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0)
980980   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
981981   PORT_BIT( 0xf8, IP_ACTIVE_LOW,  IPT_UNKNOWN )
982982
983   PORT_START            /* fake analog X */
983   PORT_START_TAG("AN0")      /* fake analog X */
984984   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
985985
986   PORT_START            /* fake analog Y */
986   PORT_START_TAG("AN1")      /* fake analog Y */
987987   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
988988INPUT_PORTS_END
989989
src/mame/drivers/topshoot.c
r2864r2865
138138
139139
140140static INPUT_PORTS_START( topshoot ) /* Top Shooter Input Ports */
141   PORT_START   /* 16bit */
141   PORT_START_TAG("IN0")   /* 16bit */
142142   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Unknown ) )
143143   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
144144   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
src/mame/drivers/blstroid.c
r2864r2865
430430static DRIVER_INIT( blstroid )
431431{
432432   atarigen_eeprom_default = NULL;
433   atarijsa_init(machine, 2, 0x80);
433   atarijsa_init(machine, "IN0", 0x80);
434434}
435435
436436
src/mame/drivers/megaplay.c
r2864r2865
117117
118118static UINT32 readpos = 1;  // serial bank selection position (9-bit)
119119
120#define MEGAPLAY_TEST \
121   PORT_START \
122   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Select") PORT_CODE(KEYCODE_0) \
123    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 1") PORT_CODE(KEYCODE_W) \
124    PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 2") PORT_CODE(KEYCODE_E) \
125    PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 3") PORT_CODE(KEYCODE_R) \
126    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 4") PORT_CODE(KEYCODE_T) \
127    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 5") PORT_CODE(KEYCODE_Y) \
128   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 6") PORT_CODE(KEYCODE_U) \
120static INPUT_PORTS_START ( megaplay )
121   PORT_START_TAG("P1_1")   /* Player 1 Controls - part 1 */
122   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
123   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
124   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
125   PORT_BIT(  0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
126   PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )
127   PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
128   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNUSED )
129   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNUSED )
130
131   PORT_START_TAG("P1_2")   /* Player 1 Controls - part 2 */
132   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_UNUSED )
133   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_UNUSED )
134   PORT_BIT(  0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
135   PORT_BIT(  0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
136   PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
137   PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_START1 )
138   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNUSED )
139   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNUSED )
140
141   PORT_START_TAG("P2_1")   /* Player 2 Controls - part 1 */
142   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
143   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
144   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
145   PORT_BIT(  0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT  ) PORT_PLAYER(2)
146   PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
147   PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
148   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNUSED )
149   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNUSED )
150
151   PORT_START_TAG("P2_2")   /* Player 2 Controls - part 2 */
152   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_UNUSED )
153   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_UNUSED )
154   PORT_BIT(  0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
155   PORT_BIT(  0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
156   PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
157   PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_START2 )
158   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNUSED )
159   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNUSED )
160
161   PORT_START_TAG("TEST")
162   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Select") PORT_CODE(KEYCODE_0)
163    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 1") PORT_CODE(KEYCODE_W)
164    PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 2") PORT_CODE(KEYCODE_E)
165    PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 3") PORT_CODE(KEYCODE_R)
166    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 4") PORT_CODE(KEYCODE_T)
167    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 5") PORT_CODE(KEYCODE_Y)
168   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_NAME("0x6400 bit 6") PORT_CODE(KEYCODE_U)
129169   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
130170
131#define MEGAPLAY_COIN \
132   PORT_START \
133    PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) \
134   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) \
135    PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) \
136    PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) \
137    PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) \
138    PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
139    PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
171   PORT_START_TAG("COIN")
172    PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
173   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
174    PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
175    PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
176    PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
177    PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
178    PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
140179    PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
141180
142181/* Caused 01081:
143 *  PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_START1 ) \
182 *  PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_START1 )
144183 *  PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_START2 )
145184 */
146185
147#define MEGAPLAY_DSWA \
148   PORT_START \
149   PORT_DIPNAME( 0x0f, 0x0f, "Coin slot 1" ) PORT_DIPLOCATION("SW1:1,2,3,4") \
150    PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ) ) \
151    PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) \
152    PORT_DIPSETTING( 0x09, DEF_STR( 2C_1C ) ) \
153    PORT_DIPSETTING( 0x05, "2 coins/1 credit - 5 coins/3 credits - 6 coins/4 credits" ) \
154    PORT_DIPSETTING( 0x04, "2 coins/1 credit - 4 coins/3 credits" ) \
155    PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) ) \
156    PORT_DIPSETTING( 0x06, DEF_STR( 2C_3C ) ) \
157    PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) ) \
158    PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) ) \
159    PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) ) \
160    PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) ) \
161    PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) ) \
162    PORT_DIPSETTING( 0x03, "1 coin/1 credit - 5 coins/6 credits" ) \
163    PORT_DIPSETTING( 0x02, "1 coin/1 credit - 4 coins/5 credits" ) \
164    PORT_DIPSETTING( 0x01, "1 coin/1 credit - 2 coins/3 credits" ) \
186   PORT_START_TAG("DSW0")
187   PORT_DIPNAME( 0x0f, 0x0f, "Coin slot 1" ) PORT_DIPLOCATION("SW1:1,2,3,4")
188    PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ) )
189    PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
190    PORT_DIPSETTING( 0x09, DEF_STR( 2C_1C ) )
191    PORT_DIPSETTING( 0x05, "2 coins/1 credit - 5 coins/3 credits - 6 coins/4 credits" )
192    PORT_DIPSETTING( 0x04, "2 coins/1 credit - 4 coins/3 credits" )
193    PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
194    PORT_DIPSETTING( 0x06, DEF_STR( 2C_3C ) )
195    PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) )
196    PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) )
197    PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) )
198    PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) )
199    PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) )
200    PORT_DIPSETTING( 0x03, "1 coin/1 credit - 5 coins/6 credits" )
201    PORT_DIPSETTING( 0x02, "1 coin/1 credit - 4 coins/5 credits" )
202    PORT_DIPSETTING( 0x01, "1 coin/1 credit - 2 coins/3 credits" )
165203    PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
166204
167#define MEGAPLAY_DSWB \
168205   PORT_DIPNAME( 0xf0, 0xf0, "Coin slot 2" ) PORT_DIPLOCATION("SW2:1,2,3,4")\
169    PORT_DIPSETTING( 0x70, DEF_STR( 4C_1C ) ) \
170    PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) ) \
171    PORT_DIPSETTING( 0x90, DEF_STR( 2C_1C ) ) \
172    PORT_DIPSETTING( 0x50, "2 coins/1 credit - 5 coins/3 credits - 6 coins/4 credits" ) \
173    PORT_DIPSETTING( 0x40, "2 coins/1 credit - 4 coins/3 credits" ) \
174    PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) ) \
175    PORT_DIPSETTING( 0x60, DEF_STR( 2C_3C ) ) \
176    PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) ) \
177    PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) ) \
178    PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) ) \
179    PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) ) \
180    PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) ) \
181    PORT_DIPSETTING( 0x30, "1 coin/1 credit - 5 coins/6 credits" ) \
182    PORT_DIPSETTING( 0x20, "1 coin/1 credit - 4 coins/5 credits" ) \
183    PORT_DIPSETTING( 0x10, "1 coin/1 credit - 2 coins/3 credits" ) \
206    PORT_DIPSETTING( 0x70, DEF_STR( 4C_1C ) )
207    PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) )
208    PORT_DIPSETTING( 0x90, DEF_STR( 2C_1C ) )
209    PORT_DIPSETTING( 0x50, "2 coins/1 credit - 5 coins/3 credits - 6 coins/4 credits" )
210    PORT_DIPSETTING( 0x40, "2 coins/1 credit - 4 coins/3 credits" )
211    PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) )
212    PORT_DIPSETTING( 0x60, DEF_STR( 2C_3C ) )
213    PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) )
214    PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) )
215    PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) )
216    PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) )
217    PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) )
218    PORT_DIPSETTING( 0x30, "1 coin/1 credit - 5 coins/6 credits" )
219    PORT_DIPSETTING( 0x20, "1 coin/1 credit - 4 coins/5 credits" )
220    PORT_DIPSETTING( 0x10, "1 coin/1 credit - 2 coins/3 credits" )
184221    PORT_DIPSETTING( 0x00, " 1 coin/1 credit" )
185
186static INPUT_PORTS_START ( megaplay )
187   GENESIS_PORTS
188   MEGAPLAY_TEST
189   MEGAPLAY_COIN
190   MEGAPLAY_DSWA
191   MEGAPLAY_DSWB
192222INPUT_PORTS_END
193223
194224static INPUT_PORTS_START ( mp_sonic )
195   GENESIS_PORTS
196   MEGAPLAY_TEST
197   MEGAPLAY_COIN
198   MEGAPLAY_DSWA
199   MEGAPLAY_DSWB
225   PORT_INCLUDE( megaplay )
200226
201   PORT_START
202   // DSW C  (per game settings)
227   PORT_START_TAG("DSW1")   /* DSW C  (per game settings) */
203228   PORT_DIPNAME( 0x03, 0x01, "Initial Players" ) PORT_DIPLOCATION("SW3:1,2")
204229    PORT_DIPSETTING( 0x00, "4" )
205230    PORT_DIPSETTING( 0x01, "3" )
r2864r2865
218243INPUT_PORTS_END
219244
220245static INPUT_PORTS_START ( mp_gaxe2 )
221   GENESIS_PORTS
222   MEGAPLAY_TEST
223   MEGAPLAY_COIN
224   MEGAPLAY_DSWA
225   MEGAPLAY_DSWB
246   PORT_INCLUDE( megaplay )
226247
227   PORT_START
228   // DSW C  (per game settings)
248   PORT_START_TAG("DSW1")   /* DSW C  (per game settings) */
229249   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW3:1")
230250    PORT_DIPSETTING( 0x01, DEF_STR( Normal ) )
231251    PORT_DIPSETTING( 0x00, DEF_STR( Hard ) )
r2864r2865
247267
248268#ifdef UNUSED_DEFINITION
249269static INPUT_PORTS_START ( mp_col3 )
250   GENESIS_PORTS
251   MEGAPLAY_TEST
252   MEGAPLAY_COIN
253   MEGAPLAY_DSWA
254   MEGAPLAY_DSWB
270   PORT_INCLUDE( megaplay )
255271
256   PORT_START
257   // DSW C  (per game settings)
272   PORT_START_TAG("DSW1")   /* DSW C  (per game settings) */
258273   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Language ) ) PORT_DIPLOCATION("SW3:1")
259274    PORT_DIPSETTING( 0x01, DEF_STR( English ) )
260275    PORT_DIPSETTING( 0x00, DEF_STR( Japanese ) )
r2864r2865
275290#endif
276291
277292static INPUT_PORTS_START ( mp_twc )
278   GENESIS_PORTS
279   MEGAPLAY_TEST
280   MEGAPLAY_COIN
281   MEGAPLAY_DSWA
282   MEGAPLAY_DSWB
293   PORT_INCLUDE( megaplay )
283294
284   PORT_START
285   // DSW C  (per game settings)
295   PORT_START_TAG("DSW1")   /* DSW C  (per game settings) */
286296   PORT_DIPNAME( 0x01, 0x01, "Time" ) PORT_DIPLOCATION("SW3:1")
287297    PORT_DIPSETTING( 0x01, DEF_STR( Normal ) )
288298    PORT_DIPSETTING( 0x00, "Short" )
r2864r2865
298308INPUT_PORTS_END
299309
300310static INPUT_PORTS_START ( mp_sor2 )
301   GENESIS_PORTS
302   MEGAPLAY_TEST
303   MEGAPLAY_COIN
304   MEGAPLAY_DSWA
305   MEGAPLAY_DSWB
311   PORT_INCLUDE( megaplay )
306312
307   PORT_START
308   // DSW C  (per game settings)
313   PORT_START_TAG("DSW1")   /* DSW C  (per game settings) */
309314   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW3:1,2")
310315    PORT_DIPSETTING( 0x00, "4" )
311316    PORT_DIPSETTING( 0x01, "3" )
r2864r2865
319324INPUT_PORTS_END
320325
321326static INPUT_PORTS_START ( mp_bio )
322   GENESIS_PORTS
323   MEGAPLAY_TEST
324   MEGAPLAY_COIN
325   MEGAPLAY_DSWA
326   MEGAPLAY_DSWB
327   PORT_INCLUDE( megaplay )
327328
328   PORT_START
329   // DSW C  (per game settings)
329   PORT_START_TAG("DSW1")   /* DSW C  (per game settings) */
330330   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW3:1,2")
331331    PORT_DIPSETTING( 0x00, "5" )
332332    PORT_DIPSETTING( 0x01, "4" )
r2864r2865
340340INPUT_PORTS_END
341341
342342static INPUT_PORTS_START ( mp_gslam )
343   GENESIS_PORTS
344   MEGAPLAY_TEST
345   MEGAPLAY_COIN
346   MEGAPLAY_DSWA
347   MEGAPLAY_DSWB
343   PORT_INCLUDE( megaplay )
348344
349   PORT_START
350   // DSW C  (per game settings)
345   PORT_START_TAG("DSW1")   /* DSW C  (per game settings) */
351346   PORT_DIPNAME( 0x07, 0x04, DEF_STR ( Game_Time ) ) PORT_DIPLOCATION("SW3:1,2,3")
352347    PORT_DIPSETTING( 0x00, "5:00" )
353348    PORT_DIPSETTING( 0x01, "4:30" )
r2864r2865
363358INPUT_PORTS_END
364359
365360static INPUT_PORTS_START ( mp_mazin )
366   GENESIS_PORTS
367   MEGAPLAY_TEST
368   MEGAPLAY_COIN
369   MEGAPLAY_DSWA
370   MEGAPLAY_DSWB
361   PORT_INCLUDE( megaplay )
371362
372   PORT_START
373   // DSW C  (per game settings)
363   PORT_START_TAG("DSW1")   /* DSW C  (per game settings) */
374364   PORT_DIPNAME( 0x01, 0x01, "Initial Player" ) PORT_DIPLOCATION("SW3:1")
375365    PORT_DIPSETTING( 0x01, "2" )
376366    PORT_DIPSETTING( 0x00, "1" )
r2864r2865
386376INPUT_PORTS_END
387377
388378static INPUT_PORTS_START ( mp_soni2 )
389   GENESIS_PORTS
390   MEGAPLAY_TEST
391   MEGAPLAY_COIN
392   MEGAPLAY_DSWA
393   MEGAPLAY_DSWB
379   PORT_INCLUDE( megaplay )
394380
395   PORT_START
396   // DSW C  (per game settings)
381   PORT_START_TAG("DSW1")   /* DSW C  (per game settings) */
397382   PORT_DIPNAME( 0x03, 0x01, "Initial Players (Normal mode)" ) PORT_DIPLOCATION("SW3:1,2")
398383    PORT_DIPSETTING( 0x00, "4" )
399384    PORT_DIPSETTING( 0x01, "3" )
r2864r2865
439424}
440425
441426
427/* Old code, todo, update the new code instead */
428
429static READ16_HANDLER ( OLD_megaplay_genesis_io_r )
430{
431   /* 8-bit only, data is mirrored in both halves */
432
433   UINT8 return_value = 0;
434
435   switch (offset)
436   {
437      case 0:
438      /* Charles MacDonald ( http://cgfm2.emuviews.com/ )
439            D7 : Console is 1= Export (USA, Europe, etc.) 0= Domestic (Japan)
440            D6 : Video type is 1= PAL, 0= NTSC
441            D5 : Sega CD unit is 1= not present, 0= connected.
442            D4 : Unused (always returns zero)
443            D3 : Bit 3 of version number
444            D2 : Bit 2 of version number
445            D1 : Bit 1 of version number
446            D0 : Bit 0 of version number
447        */
448         return_value = 0x80; /* ? megatech is usa? */
449         break;
450
451      case 1: /* port A data (joypad 1) */
452
453         if (genesis_io_ram[offset] & 0x40)
454            return_value = input_port_read(machine, "P1_1") & (genesis_io_ram[4]^0xff);
455         else
456         {
457            return_value = input_port_read(machine, "P1_2") & (genesis_io_ram[4]^0xff);
458            return_value |= input_port_read(machine, "P1_1") & 0x03;
459         }
460         return_value = (genesis_io_ram[offset] & 0x80) | return_value;
461//          logerror ("reading joypad 1 , type %02x %02x\n",genesis_io_ram[offset] & 0xb0, return_value &0x7f);
462         break;
463
464      case 2: /* port B data (joypad 2) */
465
466         if (genesis_io_ram[offset] & 0x40)
467            return_value = input_port_read(machine, "P2_1") & (genesis_io_ram[5]^0xff);
468         else
469         {
470            return_value = input_port_read(machine, "P2_2") & (genesis_io_ram[5]^0xff);
471            return_value |= input_port_read(machine, "P2_1") & 0x03;
472         }
473         return_value = (genesis_io_ram[offset] & 0x80) | return_value;
474//          logerror ("reading joypad 2 , type %02x %02x\n",genesis_io_ram[offset] & 0xb0, return_value &0x7f);
475         break;
476
477//      case 3: /* port C data */
478//          return_value = bios_6402 << 3;
479//          break;
480
481   default:
482         return_value = genesis_io_ram[offset];
483
484   }
485   return return_value | return_value << 8;
486}
487
488static WRITE16_HANDLER ( OLD_megaplay_genesis_io_w )
489{
490//  logerror ("write io offset :%02x data %04x PC: 0x%06x\n",offset,data,activecpu_get_previouspc());
491
492   switch (offset)
493   {
494      case 0x00:
495      /*??*/
496      break;
497
498      case 0x01:/* port A data */
499      genesis_io_ram[offset] = (data & (genesis_io_ram[0x04])) | (genesis_io_ram[offset] & ~(genesis_io_ram[0x04]));
500      break;
501
502      case 0x02: /* port B data */
503      genesis_io_ram[offset] = (data & (genesis_io_ram[0x05])) | (genesis_io_ram[offset] & ~(genesis_io_ram[0x05]));
504      break;
505
506      case 0x03: /* port C data */
507      genesis_io_ram[offset] = (data & (genesis_io_ram[0x06])) | (genesis_io_ram[offset] & ~(genesis_io_ram[0x06]));
508      bios_6204 = data & 0x07;
509      break;
510
511      case 0x04: /* port A control */
512      genesis_io_ram[offset] = data;
513      break;
514
515      case 0x05: /* port B control */
516      genesis_io_ram[offset] = data;
517      break;
518
519      case 0x06: /* port C control */
520      genesis_io_ram[offset] = data;
521      break;
522
523      case 0x07: /* port A TxData */
524      genesis_io_ram[offset] = data;
525      break;
526
527      default:
528      genesis_io_ram[offset] = data;
529   }
530}
531
442532static READ8_HANDLER( bank_r )
443533{
444534   UINT8* bank = memory_region(REGION_CPU3);
445535   UINT8* game = memory_region(REGION_CPU1);
446536
447537   if(game_banksel == 0x142) // Genesis I/O
448      return megaplay_genesis_io_r(machine, (offset & 0x1f) / 2, 0xffff);
538      return OLD_megaplay_genesis_io_r(machine, (offset & 0x1f) / 2, 0xffff);
449539
450540   if(bios_mode & MP_ROM)
451541   {
r2864r2865
478568static WRITE8_HANDLER ( bank_w )
479569{
480570   if(game_banksel == 0x142) // Genesis I/O
481      genesis_io_w(machine, (offset & 0x1f) / 2, data, 0xffff);
571      OLD_megaplay_genesis_io_w(machine, (offset & 0x1f) / 2, data, 0xffff);
482572
483573   if(offset <= 0x1fff && (bios_width & 0x08))
484574      ic37_ram[(0x2000 * (bios_bank & 0x03)) + offset] = data;
r2864r2865
569659    AM_RANGE(0x0000, 0x3fff) AM_READ(SMH_ROM)
570660   AM_RANGE(0x4000, 0x4fff) AM_READ(SMH_RAM)
571661   AM_RANGE(0x5000, 0x5fff) AM_READ(SMH_RAM)
572   AM_RANGE(0x6200, 0x6200) AM_READ(input_port_7_r)
573   AM_RANGE(0x6201, 0x6201) AM_READ(input_port_8_r)
574   AM_RANGE(0x6400, 0x6400) AM_READ(input_port_5_r)
575   AM_RANGE(0x6401, 0x6401) AM_READ(input_port_6_r)
662   AM_RANGE(0x6200, 0x6200) AM_READ_PORT("DSW0")
663   AM_RANGE(0x6201, 0x6201) AM_READ_PORT("DSW1")
664   AM_RANGE(0x6400, 0x6400) AM_READ_PORT("TEST")
665   AM_RANGE(0x6401, 0x6401) AM_READ_PORT("COIN")
576666   AM_RANGE(0x6204, 0x6204) AM_READ(megaplay_bios_6204_r)
577667   AM_RANGE(0x6203, 0x6203) AM_READ(megaplay_bios_banksel_r)
578668   AM_RANGE(0x6402, 0x6402) AM_READ(megaplay_bios_6402_r)
r2864r2865
853943   }
854944}
855945
856/* Old code, todo, update the new code instead */
857static READ16_HANDLER ( OLD_megaplay_genesis_io_r )
858{
859   /* 8-bit only, data is mirrored in both halves */
860
861   UINT8 return_value = 0;
862
863   switch (offset)
864   {
865      case 0:
866      /* Charles MacDonald ( http://cgfm2.emuviews.com/ )
867            D7 : Console is 1= Export (USA, Europe, etc.) 0= Domestic (Japan)
868            D6 : Video type is 1= PAL, 0= NTSC
869            D5 : Sega CD unit is 1= not present, 0= connected.
870            D4 : Unused (always returns zero)
871            D3 : Bit 3 of version number
872            D2 : Bit 2 of version number
873            D1 : Bit 1 of version number
874            D0 : Bit 0 of version number
875        */
876         return_value = 0x80; /* ? megatech is usa? */
877         break;
878
879      case 1: /* port A data (joypad 1) */
880
881         if (genesis_io_ram[offset] & 0x40)
882            return_value = input_port_read_indexed(machine, 1) & (genesis_io_ram[4]^0xff);
883         else
884         {
885            return_value = input_port_read_indexed(machine, 2) & (genesis_io_ram[4]^0xff);
886            return_value |= input_port_read_indexed(machine, 1) & 0x03;
887         }
888         return_value = (genesis_io_ram[offset] & 0x80) | return_value;
889//          logerror ("reading joypad 1 , type %02x %02x\n",genesis_io_ram[offset] & 0xb0, return_value &0x7f);
890         break;
891
892      case 2: /* port B data (joypad 2) */
893
894         if (genesis_io_ram[offset] & 0x40)
895            return_value = input_port_read_indexed(machine, 3) & (genesis_io_ram[5]^0xff);
896         else
897         {
898            return_value = input_port_read_indexed(machine, 4) & (genesis_io_ram[5]^0xff);
899            return_value |= input_port_read_indexed(machine, 3) & 0x03;
900         }
901         return_value = (genesis_io_ram[offset] & 0x80) | return_value;
902//          logerror ("reading joypad 2 , type %02x %02x\n",genesis_io_ram[offset] & 0xb0, return_value &0x7f);
903         break;
904
905//      case 3: /* port C data */
906//          return_value = bios_6402 << 3;
907//          break;
908
909   default:
910         return_value = genesis_io_ram[offset];
911
912   }
913   return return_value | return_value << 8;
914}
915
916static WRITE16_HANDLER ( OLD_megaplay_genesis_io_w )
917{
918//  logerror ("write io offset :%02x data %04x PC: 0x%06x\n",offset,data,activecpu_get_previouspc());
919
920   switch (offset)
921   {
922      case 0x00:
923      /*??*/
924      break;
925
926      case 0x01:/* port A data */
927      genesis_io_ram[offset] = (data & (genesis_io_ram[0x04])) | (genesis_io_ram[offset] & ~(genesis_io_ram[0x04]));
928      break;
929
930      case 0x02: /* port B data */
931      genesis_io_ram[offset] = (data & (genesis_io_ram[0x05])) | (genesis_io_ram[offset] & ~(genesis_io_ram[0x05]));
932      break;
933
934      case 0x03: /* port C data */
935      genesis_io_ram[offset] = (data & (genesis_io_ram[0x06])) | (genesis_io_ram[offset] & ~(genesis_io_ram[0x06]));
936      bios_6204 = data & 0x07;
937      break;
938
939      case 0x04: /* port A control */
940      genesis_io_ram[offset] = data;
941      break;
942
943      case 0x05: /* port B control */
944      genesis_io_ram[offset] = data;
945      break;
946
947      case 0x06: /* port C control */
948      genesis_io_ram[offset] = data;
949      break;
950
951      case 0x07: /* port A TxData */
952      genesis_io_ram[offset] = data;
953      break;
954
955      default:
956      genesis_io_ram[offset] = data;
957   }
958}
959
960
961946static READ16_HANDLER( megadriv_68k_read_z80_extra_ram )
962947{
963948   return ic36_ram[(offset<<1)^1] | (ic36_ram[(offset<<1)]<<8);
src/mame/drivers/harddriv.c
r2864r2865
179179#include "sound/dac.h"
180180
181181/* from slapstic.c */
182void slapstic_init(int chip);
182void slapstic_init(running_machine *machine, int chip);
183183
184184
185185
r2864r2865
534534 *************************************/
535535
536536static INPUT_PORTS_START( harddriv )
537   PORT_START_TAG("600000")
537   PORT_START_TAG("IN0")      /* 600000 */
538538   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )   /* diagnostic switch */
539539   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SPECIAL )   /* HBLANK */
540540   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_VBLANK )
r2864r2865
590590
591591
592592static INPUT_PORTS_START( racedriv )
593   PORT_START_TAG("600000")
593   PORT_START_TAG("IN0")      /* 600000 */
594594   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )   /* diagnostic switch */
595595   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SPECIAL )   /* HBLANK */
596596   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_VBLANK )
r2864r2865
646646
647647
648648static INPUT_PORTS_START( racedrvc )
649   PORT_START_TAG("60c000")
649   PORT_START_TAG("IN0")      /* 60c000 */
650650   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )   /* diagnostic switch */
651651   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SPECIAL )   /* HBLANK */
652652   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_VBLANK )
r2864r2865
708708
709709
710710static INPUT_PORTS_START( stunrun )
711   PORT_START_TAG("60c000")
711   PORT_START_TAG("IN0")      /* 60c000 */
712712   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
713713   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SPECIAL )   /* HBLANK */
714714   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_VBLANK )
r2864r2865
766766
767767
768768static INPUT_PORTS_START( steeltal )
769   PORT_START_TAG("60c000")
769   PORT_START_TAG("IN0")      /* 60c000 */
770770   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
771771   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SPECIAL )   /* HBLANK */
772772   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_VBLANK )
r2864r2865
825825
826826
827827static INPUT_PORTS_START( strtdriv )
828   PORT_START_TAG("60c000")
828   PORT_START_TAG("IN0")      /* 60c000 */
829829   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
830830   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SPECIAL )   /* HBLANK */
831831   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_VBLANK )
r2864r2865
874874   PORT_START_TAG("8BADC7")      /* b00000 - 8 bit ADC 7 - seat adjust */
875875   PORT_BIT( 0xff, 0X80, IPT_UNUSED )
876876
877   PORT_START_TAG("400000")      /* 400000 - steering wheel */
877   PORT_START_TAG("12BADC0")      /* 400000 - steering wheel */
878878   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(5)
879879
880880   /* dummy ADC ports to end up with the same number as the full version */
881   PORT_START_TAG("12BADCX")
881   PORT_START_TAG("12BADC1")      /* FAKE */
882882   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
883   PORT_START_TAG("12BADCY")
883   PORT_START_TAG("12BADC2")      /* FAKE */
884884   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
885   PORT_START_TAG("12BADCZ")
885   PORT_START_TAG("12BADC3")      /* FAKE */
886886   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
887887INPUT_PORTS_END
888888
889889
890890static INPUT_PORTS_START( hdrivair )
891   PORT_START_TAG("60c000")
891   PORT_START_TAG("IN0")      /* 60c000 */
892892   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
893893   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SPECIAL )   /* HBLANK */
894894   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_VBLANK )
r2864r2865
35223522   hddsk_rom = (UINT16 *)(memory_region(REGION_USER3) + 0x00000);
35233523
35243524   /* set up the ASIC65 */
3525   asic65_config(ASIC65_STANDARD);
3525   asic65_config(machine, ASIC65_STANDARD);
35263526}
35273527
35283528
r2864r2865
35493549   hddsk_rom = (UINT16 *)(memory_region(REGION_USER3) + 0x000000);
35503550
35513551   /* set up the ASIC65 */
3552   asic65_config(ASIC65_STANDARD);
3552   asic65_config(machine, ASIC65_STANDARD);
35533553}
35543554
35553555
r2864r2865
35623562   memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x901000, 0x910001, 0, 0, asic65_io_r);
35633563
35643564   /* set up the ASIC65 */
3565   asic65_config(ASIC65_STEELTAL);
3565   asic65_config(machine, ASIC65_STEELTAL);
35663566
35673567   /* install DSPCOM control */
35683568   memory_install_write16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x904000, 0x90401f, 0, 0, hddspcom_control_w);
r2864r2865
36403640   /* initialize the boards */
36413641   init_multisync(machine, 0);
36423642   init_adsp(machine);
3643   atarijsa_init(machine, 0, 0x0020);
3643   atarijsa_init(machine, "IN0", 0x0020);
36443644
36453645   /* set up gsp speedup handler */
36463646   hdgsp_speedup_addr[0] = memory_install_write16_handler(machine, hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup1_w);
r2864r2865
36853685   init_driver_sound(machine);
36863686
36873687   /* set up the slapstic */
3688   slapstic_init(117);
3688   slapstic_init(machine, 117);
36893689   hd68k_slapstic_base = memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xe0000, 0xfffff, 0, 0, rd68k_slapstic_r, rd68k_slapstic_w);
36903690
36913691   /* synchronization */
r2864r2865
37103710   init_driver_sound(machine);
37113711
37123712   /* set up the slapstic */
3713   slapstic_init(117);
3713   slapstic_init(machine, 117);
37143714   hd68k_slapstic_base = memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xe0000, 0xfffff, 0, 0, rd68k_slapstic_r, rd68k_slapstic_w);
37153715
37163716   /* synchronization */
r2864r2865
37513751   init_ds3(machine);
37523752   init_dspcom(machine);
37533753   atarijsa3_init_adpcm(REGION_SOUND1);
3754   atarijsa_init(machine, 0, 0x0020);
3754   atarijsa_init(machine, "IN0", 0x0020);
37553755
37563756   memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x908000, 0x908001, 0, 0, steeltal_dummy_r);
37573757
r2864r2865
38003800   init_dsk(machine);
38013801
38023802   /* set up the slapstic */
3803   slapstic_init(117);
3803   slapstic_init(machine, 117);
38043804   hd68k_slapstic_base = memory_install_readwrite16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xe0000, 0xfffff, 0, 0, rd68k_slapstic_r, rd68k_slapstic_w);
38053805
38063806   memory_install_read16_handler(machine, hdcpu_main, ADDRESS_SPACE_PROGRAM, 0xa80000, 0xafffff, 0, 0, hda68k_port1_r);
src/mame/drivers/pokechmp.c
r2864r2865
4545*/
4646
4747#include "driver.h"
48#include "deprecat.h"
4948#include "cpu/m6502/m6502.h"
5049#include "sound/2203intf.h"
5150#include "sound/3812intf.h"
r2864r2865
9998}
10099
101100
102INLINE void pokechmp_set_color(pen_t color, int rshift, int gshift, int bshift, UINT16 data)
101INLINE void pokechmp_set_color(running_machine *machine, pen_t color, int rshift, int gshift, int bshift, UINT16 data)
103102{
104   palette_set_color_rgb(Machine, color, pal5bit(data >> rshift), pal5bit(data >> gshift), pal5bit(data >> bshift));
103   palette_set_color_rgb(machine, color, pal5bit(data >> rshift), pal5bit(data >> gshift), pal5bit(data >> bshift));
105104}
106105
107106
108107static WRITE8_HANDLER( pokechmp_paletteram_w )
109108{
110109   paletteram[offset] = data;
111   pokechmp_set_color(offset &0x3ff, 0, 5, 10, (paletteram[offset&0x3ff]<<8) | ( paletteram[ (offset&0x3ff)+0x400 ] )  );
110   pokechmp_set_color(machine, offset &0x3ff, 0, 5, 10, (paletteram[offset&0x3ff]<<8) | ( paletteram[ (offset&0x3ff)+0x400 ] )  );
112111}
113112
114113
src/mame/drivers/konamigv.c
r2864r2865
517517      int axis;
518518      UINT16 diff;
519519      UINT16 value;
520      static const char *axisnames[] = { "TRACK0_X", "TRACK0_Y" };
520521
521522      for( axis = 0; axis < 2; axis++ )
522523      {
523         value = input_port_read_indexed(machine, axis + 3 );
524         value = input_port_read(machine, axisnames[axis]);
524525         diff = value - trackball_prev[ axis ];
525526         trackball_prev[ axis ] = value;
526527         trackball_data[ axis ] = ( ( diff & 0xf00 ) << 16 ) | ( ( diff & 0xff ) << 8 );
r2864r2865
556557static INPUT_PORTS_START( simpbowl )
557558   PORT_INCLUDE( konamigv )
558559
559   PORT_START_TAG("IN3")
560   PORT_START_TAG("TRACK0_X")
560561   PORT_BIT( 0xfff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_REVERSE PORT_PLAYER(1)
561562
562   PORT_START_TAG("IN4")
563   PORT_START_TAG("TRACK0_Y")
563564   PORT_BIT( 0xfff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_PLAYER(1)
564565
565566INPUT_PORTS_END
r2864r2865
601602      int axis;
602603      UINT16 diff;
603604      UINT16 value;
605      static const char *axisnames[] = { "TRACK0_X", "TRACK0_Y", "TRACK1_X", "TRACK1_Y" };
604606
605607      for( axis = 0; axis < 4; axis++ )
606608      {
607         value = input_port_read_indexed(machine, axis + 3 );
609         value = input_port_read(machine, axisnames[axis]);
608610         diff = value - btc_trackball_prev[ axis ];
609611         btc_trackball_prev[ axis ] = value;
610612         btc_trackball_data[ axis ] = ( ( diff & 0xf00 ) << 16 ) | ( ( diff & 0xff ) << 8 );
r2864r2865
643645static INPUT_PORTS_START( btchamp )
644646   PORT_INCLUDE( konamigv )
645647
646   PORT_START_TAG("IN3")
648   PORT_START_TAG("TRACK0_X")
647649   PORT_BIT( 0x7ff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_REVERSE PORT_PLAYER(1)
648650
649   PORT_START_TAG("IN4")
651   PORT_START_TAG("TRACK0_Y")
650652   PORT_BIT( 0x7ff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_PLAYER(1)
651653
652   PORT_START_TAG("IN5")
654   PORT_START_TAG("TRACK1_X")
653655   PORT_BIT( 0x7ff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_REVERSE PORT_PLAYER(2)
654656
655   PORT_START_TAG("IN6")
657   PORT_START_TAG("TRACK1_Y")
656658   PORT_BIT( 0x7ff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_PLAYER(2)
657659INPUT_PORTS_END
658660
src/mame/drivers/firetrap.c
r2864r2865
101101   /* Check for coin insertion */
102102   /* the following only works in the bootleg version, which doesn't have an */
103103   /* 8751 - the real thing is much more complicated than that. */
104   if ((input_port_read_indexed(machine, 2) & 0x70) != 0x70) return 0xff;
104   if ((input_port_read(machine, "IN2") & 0x70) != 0x70) return 0xff;
105105   return 0;
106106}
107107
r2864r2865
247247   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
248248   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1)
249249   AM_RANGE(0xc000, 0xe97f) AM_READ(SMH_RAM)
250   AM_RANGE(0xf010, 0xf010) AM_READ(input_port_0_r)
251   AM_RANGE(0xf011, 0xf011) AM_READ(input_port_1_r)
252   AM_RANGE(0xf012, 0xf012) AM_READ(input_port_2_r)
253   AM_RANGE(0xf013, 0xf013) AM_READ(input_port_3_r)
254   AM_RANGE(0xf014, 0xf014) AM_READ(input_port_4_r)
250   AM_RANGE(0xf010, 0xf010) AM_READ_PORT("IN0")
251   AM_RANGE(0xf011, 0xf011) AM_READ_PORT("IN1")
252   AM_RANGE(0xf012, 0xf012) AM_READ_PORT("IN2")
253   AM_RANGE(0xf013, 0xf013) AM_READ_PORT("DSW0")
254   AM_RANGE(0xf014, 0xf014) AM_READ_PORT("DSW1")
255255   AM_RANGE(0xf016, 0xf016) AM_READ(firetrap_8751_r)
256256ADDRESS_MAP_END
257257
r2864r2865
278278   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
279279   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1)
280280   AM_RANGE(0xc000, 0xe97f) AM_READ(SMH_RAM)
281   AM_RANGE(0xf010, 0xf010) AM_READ(input_port_0_r)
282   AM_RANGE(0xf011, 0xf011) AM_READ(input_port_1_r)
283   AM_RANGE(0xf012, 0xf012) AM_READ(input_port_2_r)
284   AM_RANGE(0xf013, 0xf013) AM_READ(input_port_3_r)
285   AM_RANGE(0xf014, 0xf014) AM_READ(input_port_4_r)
281   AM_RANGE(0xf010, 0xf010) AM_READ_PORT("IN0")
282   AM_RANGE(0xf011, 0xf011) AM_READ_PORT("IN1")
283   AM_RANGE(0xf012, 0xf012) AM_READ_PORT("IN2")
284   AM_RANGE(0xf013, 0xf013) AM_READ_PORT("DSW0")
285   AM_RANGE(0xf014, 0xf014) AM_READ_PORT("DSW1")
286286   AM_RANGE(0xf016, 0xf016) AM_READ(firetrap_8751_bootleg_r)
287287   AM_RANGE(0xf800, 0xf8ff) AM_READ(SMH_ROM)   /* extra ROM in the bootleg with unprotection code */
288288ADDRESS_MAP_END
r2864r2865
327327
328328
329329static INPUT_PORTS_START( firetrap )
330   PORT_START   /* IN0 */
330   PORT_START_TAG("IN0")   /* IN0 */
331331   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_4WAY
332332   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_4WAY
333333   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_4WAY
r2864r2865
337337   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_4WAY
338338   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_4WAY
339339
340   PORT_START   /* IN1 */
340   PORT_START_TAG("IN1")   /* IN1 */
341341   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_4WAY PORT_COCKTAIL
342342   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_4WAY PORT_COCKTAIL
343343   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_4WAY PORT_COCKTAIL
r2864r2865
347347   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_4WAY PORT_COCKTAIL
348348   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_4WAY PORT_COCKTAIL
349349
350   PORT_START      /* IN2 */
350   PORT_START_TAG("IN2")   /* IN2 */
351351   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
352352   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
353353   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
r2864r2865
357357   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
358358   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
359359
360   PORT_START      /* DSW0 */
360   PORT_START_TAG("DSW0")   /* DSW0 */
361361   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
362362//  PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
363363//  PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
r2864r2865
382382   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
383383   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
384384
385   PORT_START      /* DSW1 */
385   PORT_START_TAG("DSW1")   /* DSW1 */
386386   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
387387   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
388388   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
r2864r2865
403403   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
404404   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
405405
406   PORT_START      /* Connected to i8751 directly */
406   PORT_START_TAG("COIN")   /* Connected to i8751 directly */
407407   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
408408   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
409409   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
410410INPUT_PORTS_END
411411
412412static INPUT_PORTS_START( firetpbl )
413   PORT_START   /* IN0 */
413   PORT_START_TAG("IN0")   /* IN0 */
414414   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_4WAY
415415   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_4WAY
416416   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_4WAY
r2864r2865
420420   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_4WAY
421421   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_4WAY
422422
423   PORT_START   /* IN1 */
423   PORT_START_TAG("IN1")   /* IN1 */
424424   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_4WAY PORT_COCKTAIL
425425   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_4WAY PORT_COCKTAIL
426426   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_4WAY PORT_COCKTAIL
r2864r2865
430430   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_4WAY PORT_COCKTAIL
431431   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_4WAY PORT_COCKTAIL
432432
433   PORT_START      /* IN2 */
433   PORT_START_TAG("IN2")   /* IN2 */
434434   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
435435   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
436436   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
r2864r2865
440440   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )   /* bootleg only */
441441   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
442442
443   PORT_START      /* DSW0 */
443   PORT_START_TAG("DSW0")   /* DSW0 */
444444   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
445445//  PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
446446//  PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
r2864r2865
465465   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
466466   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
467467
468   PORT_START      /* DSW1 */
468   PORT_START_TAG("DSW1")   /* DSW1 */
469469   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
470470   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
471471   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
r2864r2865
544544   static int coin_command_pending=0;
545545
546546   /* Check for coin IRQ */
547   if (cpu_getiloops()) {
548      if ((input_port_read_indexed(machine, 5) & 0x7) != 0x7 && !latch) {
549         coin_command_pending=~input_port_read_indexed(machine, 5);
547   if (cpu_getiloops())
548   {
549      if ((input_port_read(machine, "COIN") & 0x7) != 0x7 && !latch)
550      {
551         coin_command_pending = ~input_port_read(machine, "COIN");
550552         latch=1;
551553      }
552      if ((input_port_read_indexed(machine, 5) & 0x7) == 0x7)
554      if ((input_port_read(machine, "COIN") & 0x7) == 0x7)
553555         latch=0;
554556
555557      /* Make sure coin IRQ's aren't generated when another command is pending, the main cpu
src/mame/drivers/topspeed.c
r2864r2865
230230***************************************************************************/
231231
232232#include "driver.h"
233#include "deprecat.h"
234233#include "taitoipt.h"
235234#include "cpu/m68000/m68000.h"
236235#include "video/taitoic.h"
r2864r2865
265264   COMBINE_DATA(&sharedram[offset]);
266265}
267266
268static void parse_control(void)   /* assumes Z80 sandwiched between 68Ks */
267static void parse_control(running_machine *machine)   /* assumes Z80 sandwiched between 68Ks */
269268{
270269   /* bit 0 enables cpu B */
271270   /* however this fails when recovering from a save state
272271       if cpu B is disabled !! */
273   cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
272   cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
274273
275274}
276275
r2864r2865
280279      data = data >> 8;   /* for Wgp */
281280   cpua_ctrl = data;
282281
283   parse_control();
282   parse_control(machine);
284283
285284   logerror("CPU #0 PC %06x: write %04x to cpu control\n",activecpu_get_pc(),data);
286285}
r2864r2865
681680
682681static STATE_POSTLOAD( topspeed_postload )
683682{
684   parse_control();
683   parse_control(machine);
685684   reset_sound_region();
686685}
687686
src/mame/drivers/segae.c
r2864r2865
765765   return retdata;
766766}
767767
768static void vdp_data_w(UINT8 data, struct sms_vdp* chip)
768static void vdp_data_w(running_machine *machine, UINT8 data, struct sms_vdp* chip)
769769{
770770   /* data writes clear the pending flag */
771771   chip->cmd_pend = 0;
r2864r2865
801801               r = (palword & 0x000f)>>0;
802802               g = (palword & 0x00f0)>>4;
803803               b = (palword & 0x0f00)>>8;
804               palette_set_color_rgb(Machine,(chip->addr_reg&0x3e)/2, pal4bit(r), pal4bit(g), pal4bit(b));
804               palette_set_color_rgb(machine,(chip->addr_reg&0x3e)/2, pal4bit(r), pal4bit(g), pal4bit(b));
805805               chip->cram_mamecolours[(chip->addr_reg&0x3e)/2]=(b<<1)|(g<<6)|(r<<11);
806806            }
807807         }
r2864r2865
816816            r = (data & 0x03)>>0;
817817            g = (data & 0x0c)>>2;
818818            b = (data & 0x30)>>4;
819            palette_set_color_rgb(Machine,chip->addr_reg&0x1f, pal2bit(r), pal2bit(g), pal2bit(b));
819            palette_set_color_rgb(machine,chip->addr_reg&0x1f, pal2bit(r), pal2bit(g), pal2bit(b));
820820            chip->cram_mamecolours[chip->addr_reg&0x1f]=(b<<3)|(g<<8)|(r<<13);
821821         }
822822
r2864r2865
945945
946946WRITE8_HANDLER( md_sms_vdp_data_w )
947947{
948   vdp_data_w(data, md_sms_vdp);
948   vdp_data_w(machine, data, md_sms_vdp);
949949}
950950
951951READ8_HANDLER( md_sms_vdp_ctrl_r )
r2864r2865
973973
974974WRITE8_HANDLER( sms_vdp_data_w )
975975{
976   vdp_data_w(data, vdp1);
976   vdp_data_w(machine, data, vdp1);
977977}
978978
979979READ8_HANDLER( sms_vdp_ctrl_r )
r2864r2865
14221422 Even though some games set bit 7, it does nothing.
14231423 */
14241424
1425static void end_of_frame(struct sms_vdp *chip)
1425static void end_of_frame(running_machine *machine, struct sms_vdp *chip)
14261426{
14271427   UINT8 m1 = (chip->regs[0x1]&0x10)>>4;
14281428   UINT8 m2 = (chip->regs[0x0]&0x02)>>1;
r2864r2865
14401440      visarea.min_y = 0;
14411441      visarea.max_y = sms_mode_table[chip->screen_mode].sms2_height-1;
14421442
1443      if (chip->chip_id==3) video_screen_configure(Machine->primary_screen, 256, 256, &visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate));
1443      if (chip->chip_id==3) video_screen_configure(machine->primary_screen, 256, 256, &visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate));
14441444
14451445   }
14461446   else /* 160x144 */
r2864r2865
14641464#ifdef UNUSED_FUNCTION
14651465VIDEO_EOF(sms)
14661466{
1467   end_of_frame(vdp1);
1467   end_of_frame(machine, vdp1);
14681468   //if (SMS_PAUSE_BUTTON) cpunum_set_input_line(machine, 0,INPUT_LINE_NMI,PULSE_LINE); // not on systeme!!!
14691469}
14701470#endif
r2864r2865
19541954
19551955static VIDEO_EOF(systeme)
19561956{
1957   end_of_frame(vdp1);
1958   end_of_frame(vdp2);
1957   end_of_frame(machine, vdp1);
1958   end_of_frame(machine, vdp2);
19591959}
19601960
19611961
19621962VIDEO_EOF(megatech_md_sms)
19631963{
1964   end_of_frame(md_sms_vdp);
1964   end_of_frame(machine, md_sms_vdp);
19651965}
19661966
19671967VIDEO_EOF(megatech_bios)
19681968{
1969   end_of_frame(vdp1);
1969   end_of_frame(machine, vdp1);
19701970}
19711971
19721972VIDEO_UPDATE(megatech_md_sms)
r2864r2865
20812081
20822082static WRITE8_HANDLER( sms_vdp_2_data_w )
20832083{
2084   vdp_data_w(data, vdp2);
2084   vdp_data_w(machine, data, vdp2);
20852085}
20862086
20872087static READ8_HANDLER( sms_vdp_2_ctrl_r )
r2864r2865
22102210   init_ports_systeme(machine);
22112211}
22122212
2213void init_for_megadrive(void)
2213void init_for_megadrive(running_machine *machine)
22142214{
2215   md_sms_vdp = start_vdp(Machine, GEN_VDP);
2215   md_sms_vdp = start_vdp(machine, GEN_VDP);
22162216   md_sms_vdp->set_irq = sms_vdp_cpu1_irq_callback;
22172217   md_sms_vdp->is_pal = 0;
22182218   md_sms_vdp->sms_total_scanlines = 262;
src/mame/drivers/fantland.c
r2864r2865
178178   static int old_x[2], old_y[2], old_f[2];
179179   static UINT8 ret[2];
180180
181   switch (input_port_read_indexed(machine, 7) & 0x03)
181   switch (input_port_read(machine, "Controls") & 0x03)
182182   {
183183      case 3:
184      case 1:   return input_port_read_indexed(machine, 0 + offset);   // Lightgun buttons
185      case 2:   return input_port_read_indexed(machine, 4 + offset);   // Joystick
184      case 1:   return input_port_read(machine, offset ? "IN1" : "IN0");   // Lightgun buttons
185      case 2:   return input_port_read(machine, offset ? "IN5" : "IN4");   // Joystick
186186   }
187187
188188   // Trackball
189189
190   x = input_port_read_indexed(machine, 13 + offset * 2);
191   y = input_port_read_indexed(machine, 12 + offset * 2);
190   x = input_port_read(machine, offset ? "P2 Trackball X" : "P1 Trackball X");
191   y = input_port_read(machine, offset ? "P2 Trackball Y" : "P1 Trackball Y");
192192   f = video_screen_get_frame_number(machine->primary_screen);
193193
194   ret[offset]   =   (ret[offset] & 0x14) | (input_port_read_indexed(machine, 2 + offset) & 0xc3);
194   ret[offset]   =   (ret[offset] & 0x14) | (input_port_read(machine, offset ? "IN3" : "IN2") & 0xc3);
195195
196196   x =  (x & 0x7f) - (x & 0x80);
197197   y =  (y & 0x7f) - (y & 0x80);
r2864r2865
221221   AM_RANGE( 0x52000, 0x521ff ) AM_READWRITE( SMH_RAM, paletteram_xRRRRRGGGGGBBBBB_le_w ) AM_BASE( &paletteram )
222222   AM_RANGE( 0x53000, 0x53001 ) AM_READWRITE( borntofi_inputs_r, borntofi_nmi_enable_w )
223223   AM_RANGE( 0x53002, 0x53002 ) AM_READWRITE( input_port_6_r,    fantland_soundlatch_w )
224   AM_RANGE( 0x53003, 0x53003 ) AM_READ( input_port_7_r )
224   AM_RANGE( 0x53003, 0x53003 ) AM_READ_PORT( "Controls" )
225225
226226   AM_RANGE( 0x54000, 0x567ff ) AM_RAM AM_BASE( &spriteram )
227227
228   AM_RANGE( 0x57000, 0x57000 ) AM_READ( input_port_8_r  )
229   AM_RANGE( 0x57001, 0x57001 ) AM_READ( input_port_9_r  )
230   AM_RANGE( 0x57002, 0x57002 ) AM_READ( input_port_10_r )
231   AM_RANGE( 0x57003, 0x57003 ) AM_READ( input_port_11_r )
228   AM_RANGE( 0x57000, 0x57000 ) AM_READ_PORT( "P1 Lightgun Y" )
229   AM_RANGE( 0x57001, 0x57001 ) AM_READ_PORT( "P1 Lightgun X" )
230   AM_RANGE( 0x57002, 0x57002 ) AM_READ_PORT( "P2 Lightgun Y" )
231   AM_RANGE( 0x57003, 0x57003 ) AM_READ_PORT( "P2 Lightgun X" )
232232
233233   AM_RANGE( 0x60000, 0x6ffff ) AM_RAM AM_BASE( &spriteram_2 )
234234
r2864r2865
405405***************************************************************************/
406406
407407static INPUT_PORTS_START( fantland )
408   PORT_START   /* IN0 - a3000 */
408   PORT_START_TAG("a3000")   /* IN0 - a3000 */
409409   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1         )
410410   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START1         )
411411   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   )
r2864r2865
425425   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(2)
426426   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON2      ) PORT_PLAYER(2)
427427
428   PORT_START   /* IN2 - a3002 */
428   PORT_START_TAG("a3002")   /* IN2 - a3002 */
429429   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) )
430430   PORT_DIPSETTING(    0x0001, DEF_STR( 4C_1C ) )
431431   PORT_DIPSETTING(    0x0002, DEF_STR( 3C_1C ) )
r2864r2865
554554***************************************************************************/
555555
556556static INPUT_PORTS_START( borntofi )
557   PORT_START   /* IN0 - 53000 (Lightgun) */
557   PORT_START_TAG("IN0")   /* IN0 - 53000 (Lightgun) */
558558   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1   )
559559   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1   )
560560   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2   )
r2864r2865
564564   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN   )
565565   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )
566566
567   PORT_START   /* IN1 - 53001 (Lightgun) */
567   PORT_START_TAG("IN1")   /* IN1 - 53001 (Lightgun) */
568568   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2   )
569569   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2   )
570570   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2   ) PORT_PLAYER(2)
r2864r2865
574574   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN   )
575575   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN   )
576576
577   PORT_START   /* IN2 - 53000 (Trackball) */
577   PORT_START_TAG("IN2")   /* IN2 - 53000 (Trackball) */
578578   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1   )
579579   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_START1   )
580580   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL   )   // trackball x
r2864r2865
584584   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_BUTTON2   )
585585   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_BUTTON1   )
586586
587   PORT_START   /* IN3 - 53001 (Trackball) */
587   PORT_START_TAG("IN3")   /* IN3 - 53001 (Trackball) */
588588   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN2   )
589589   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_START2   )
590590   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL   )   // trackball x
r2864r2865
594594   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_BUTTON2   ) PORT_PLAYER(2)
595595   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_BUTTON1   ) PORT_PLAYER(2)
596596
597   PORT_START   /* IN4 - 53000 (Joystick) */
597   PORT_START_TAG("IN4")   /* IN4 - 53000 (Joystick) */
598598   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1         )
599599   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1         )
600600   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP      )
r2864r2865
604604   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2         )
605605   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1         )
606606
607   PORT_START   /* IN5 - 53001 (Joystick) */
607   PORT_START_TAG("IN5")   /* IN5 - 53001 (Joystick) */
608608   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2         )
609609   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2         )
610610   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP      ) PORT_PLAYER(2)
r2864r2865
614614   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2         ) PORT_PLAYER(2)
615615   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1         ) PORT_PLAYER(2)
616616
617   PORT_START   /* IN6 - 53002 */
617   PORT_START_TAG("IN6")   /* IN6 - 53002 */
618618   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
619619   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
620620   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
r2864r2865
662662   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
663663   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
664664
665   PORT_START_TAG("P1 Lightgun Y")   /* IN8 - 57000 */
665   PORT_START_TAG("P1 Lightgun Y")      /* IN8 - 57000 */
666666   PORT_BIT( 0xff, 0xb0, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, (352.0 - 12) / 352, 12.0 / 352, 0) PORT_MINMAX(0x80,0xfc) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_PLAYER(1)
667667
668   PORT_START_TAG("P1 Lightgun X")   /* IN9 - 57001 */
668   PORT_START_TAG("P1 Lightgun X")      /* IN9 - 57001 */
669669   PORT_BIT( 0xff, 0x60, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0x07,0xb7) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_PLAYER(1)
670670
671   PORT_START_TAG("P2 Lightgun Y")   /* IN10 - 57002 */
671   PORT_START_TAG("P2 Lightgun Y")      /* IN10 - 57002 */
672672   PORT_BIT( 0xff, 0xb0, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, (352.0 - 12) / 352, 12.0 / 352, 0) PORT_MINMAX(0x80,0xfc) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_PLAYER(2)
673673
674   PORT_START_TAG("P2 Lightgun X")   /* IN11 - 57003 */
674   PORT_START_TAG("P2 Lightgun X")      /* IN11 - 57003 */
675675   PORT_BIT( 0xff, 0x70, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0x07,0xb7) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_PLAYER(2)
676676
677   PORT_START   /* IN12 - 53000 */
677   PORT_START_TAG("P1 Trackball Y")   /* IN12 - 53000 */
678678   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(10) PORT_KEYDELTA(5) PORT_PLAYER(1) PORT_RESET
679679
680   PORT_START   /* IN13 - 53000 */
680   PORT_START_TAG("P1 Trackball X")   /* IN13 - 53000 */
681681   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(5) PORT_PLAYER(1) PORT_RESET
682682
683   PORT_START   /* IN14 - 53001 */
683   PORT_START_TAG("P2 Trackball Y")   /* IN14 - 53001 */
684684   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(10) PORT_KEYDELTA(5) PORT_PLAYER(2)
685685
686   PORT_START   /* IN15 - 53001 */
686   PORT_START_TAG("P2 Trackball X")   /* IN15 - 53001 */
687687   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(5) PORT_PLAYER(2)
688688INPUT_PORTS_END
689689
r2864r2865
695695static CUSTOM_INPUT( wheelrun_wheel_r )
696696{
697697   int player = (FPTR)param;
698   int delta = input_port_read_indexed(field->port->machine, 4 + player);
698   int delta = input_port_read(field->port->machine, player ? "WHEEL1" : "WHEEL0");
699699   delta = (delta & 0x7f) - (delta & 0x80) + 4;
700700
701701   if      (delta > 7)   delta = 7;
r2864r2865
706706}
707707
708708static INPUT_PORTS_START( wheelrun )
709   PORT_START   /* IN0 - 53000 */
709   PORT_START_TAG("53000")   /* IN0 - 53000 */
710710   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1   )
711711   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(1)
712712   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN   )
r2864r2865
714714   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(wheelrun_wheel_r, (void *)0)
715715   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN   )
716716
717   PORT_START   /* IN1 - 53001 */
717   PORT_START_TAG("53001")   /* IN1 - 53001 */
718718   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN2   )
719719   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(2)
720720   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN   )
r2864r2865
722722   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(wheelrun_wheel_r, (void *)1)
723723   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN   )
724724
725   PORT_START   /* IN2 - 53002 */
725   PORT_START_TAG("53002")   /* IN2 - 53002 */
726726   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
727727   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
728728   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
r2864r2865
745745   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
746746   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
747747
748   PORT_START   /* IN3 - 53003 */
748   PORT_START_TAG("53003")   /* IN3 - 53003 */
749749   PORT_DIPNAME( 0xff, 0xdf, "Wheel Sensitivity" )
750750   PORT_DIPSETTING(    0x7f, "0" )
751751   PORT_DIPSETTING(    0xbf, "1" )
r2864r2865
756756   PORT_DIPSETTING(    0xfd, "6" )
757757   PORT_DIPSETTING(    0xfe, "7" )
758758
759   PORT_START   /* IN4 */
759   PORT_START_TAG("WHEEL0")   /* IN4 */
760760   PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
761   PORT_START   /* IN5 */
761   PORT_START_TAG("WHEEL1")   /* IN5 */
762762   PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_RESET PORT_REVERSE PORT_PLAYER(2)
763763INPUT_PORTS_END
764764
src/mame/drivers/ksys573.c
r2864r2865
301301   switch (offset)
302302   {
303303   case 0:
304      data = input_port_read_indexed(machine, 0);
304      data = input_port_read(machine, "IN0");
305305      break;
306306   case 1:
307307   {
308      data = input_port_read_indexed(machine, 1);
308      data = input_port_read(machine, "IN1");
309309      data |= 0x000000c0;
310310
311311      if( has_ds2401[ security_cart_number ] )
r2864r2865
341341      break;
342342   }
343343   case 2:
344      data = input_port_read_indexed(machine, 2);
344      data = input_port_read(machine, "IN2");
345345      break;
346346   case 3:
347      data = input_port_read_indexed(machine, 3);
347      data = input_port_read(machine, "IN3");
348348      break;
349349   }
350350
src/mame/drivers/atarig1.c
r2864r2865
964964      state_save_register_postload(machine, pitfighb_state_postload, NULL);
965965   }
966966   else if (slapstic != 0)
967      atarigen_slapstic_init(0, slapstic_base, 0, slapstic);
967      atarigen_slapstic_init(machine, 0, slapstic_base, 0, slapstic);
968968   atarijsa_init(machine, 0, 0x4000);
969969
970970   atarig1_pitfight = is_pitfight;
src/mame/drivers/sbrkout.c
r2864r2865
3131***************************************************************************/
3232
3333#include "driver.h"
34#include "deprecat.h"
3534#include "sound/dac.h"
3635
3736#include "sbrkout.lh"
r2864r2865
180179}
181180
182181
183static void update_nmi_state(void)
182static void update_nmi_state(running_machine *machine)
184183{
185184   if ((pot_trigger[0] & ~pot_mask[0]) | (pot_trigger[1] & ~pot_mask[1]))
186      cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, ASSERT_LINE);
185      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE);
187186   else
188      cpunum_set_input_line(Machine, 0, INPUT_LINE_NMI, CLEAR_LINE);
187      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE);
189188}
190189
191190
192191static TIMER_CALLBACK( pot_trigger_callback )
193192{
194193   pot_trigger[param] = 1;
195   update_nmi_state();
194   update_nmi_state(machine);
196195}
197196
198197
r2864r2865
200199{
201200   pot_mask[0] = ~offset & 1;
202201   pot_trigger[0] = 0;
203   update_nmi_state();
202   update_nmi_state(machine);
204203}
205204
206205
r2864r2865
208207{
209208   pot_mask[1] = ~offset & 1;
210209   pot_trigger[1] = 0;
211   update_nmi_state();
210   update_nmi_state(machine);
212211}
213212
214213
src/mame/drivers/segae.h
r2864r2865
1414extern READ8_HANDLER( sms_vdp_ctrl_r );
1515extern WRITE8_HANDLER( sms_vdp_ctrl_w );
1616
17extern void init_for_megadrive(void);
17extern void init_for_megadrive(running_machine *machine);
1818extern void segae_md_sms_stop_scanline_timer(void);
1919
2020
src/mame/drivers/toobin.c
r2864r2865
9595
9696static READ16_HANDLER( special_port1_r )
9797{
98   int result = input_port_read_indexed(machine, 1);
98   int result = input_port_read(machine, "FF9000");
9999   if (atarigen_get_hblank(machine->primary_screen)) result ^= 0x8000;
100100   if (atarigen_cpu_to_sound_ready) result ^= 0x2000;
101101   return result;
r2864r2865
151151 *************************************/
152152
153153static INPUT_PORTS_START( toobin )
154   PORT_START   /* ff8800 */
154   PORT_START_TAG("FF8800")   /* ff8800 */
155155   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 R Paddle Forward") PORT_CODE(KEYCODE_L) PORT_PLAYER(2)
156156   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 L Paddle Forward") PORT_CODE(KEYCODE_J) PORT_PLAYER(2)
157157   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 L Paddle Backward") PORT_CODE(KEYCODE_U) PORT_PLAYER(2)
r2864r2865
164164   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Throw") PORT_CODE(KEYCODE_RCONTROL) PORT_PLAYER(2)
165165   PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNUSED )
166166
167   PORT_START   /* ff9000 */
167   PORT_START_TAG("FF9000")   /* ff9000 */
168168   PORT_BIT( 0x03ff, IP_ACTIVE_LOW, IPT_UNUSED )
169169   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED )
170170   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
617617static DRIVER_INIT( toobin )
618618{
619619   atarigen_eeprom_default = NULL;
620   atarijsa_init(machine, 1, 0x1000);
620   atarijsa_init(machine, "FF9000", 0x1000);
621621}
622622
623623
src/mame/drivers/overdriv.c
r2864r2865
339339   AM_RANGE(0x1000, 0xffff) AM_WRITE(SMH_ROM)
340340ADDRESS_MAP_END
341341
342/* Both IPT_START1 assignments are needed. The game will reset during */
343/* the "continue" sequence if the assignment on the first port        */
344/* is missing.                                                        */
342345
343
344346static INPUT_PORTS_START( overdriv )
345347   PORT_START
346348   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_TOGGLE
src/mame/drivers/gsword.c
r2864r2865
177177static int gsword_coins_in(void)
178178{
179179   /* emulate 8741 coin slot */
180   if (input_port_read_indexed(machine, 4)&0xc0)
180   if (input_port_read(machine, "IN4") & 0xc0)
181181   {
182182      logerror("Coin In\n");
183183      return 0x80;
r2864r2865
215215   switch (offset)
216216   {
217217   case 0x01: /* start button , coins */
218      return input_port_read_indexed(machine, 0);
218      return input_port_read(machine, "IN0");
219219   case 0x02: /* Player 1 Controller */
220      return input_port_read_indexed(machine, 1);
220      return input_port_read(machine, "IN1");
221221   case 0x04: /* Player 2 Controller */
222      return input_port_read_indexed(machine, 3);
222      return input_port_read(machine, "IN3");
223223//  default:
224224//      logerror("8741-2 unknown read %d PC=%04x\n",offset,activecpu_get_pc());
225225   }
r2864r2865
232232   switch (offset)
233233   {
234234   case 0x01: /* start button  */
235      return input_port_read_indexed(machine, 2);
235      return input_port_read(machine, "IN2");
236236   case 0x02: /* Player 1 Controller? */
237      return input_port_read_indexed(machine, 1);
237      return input_port_read(machine, "IN1");
238238   case 0x04: /* Player 2 Controller? */
239      return input_port_read_indexed(machine, 3);
239      return input_port_read(machine, "IN3");
240240   }
241241   /* unknown */
242242//  logerror("8741-3 unknown read %d PC=%04x\n",offset,activecpu_get_pc());
r2864r2865
422422   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(&gsword_cpu2_ram)
423423
424424   /* 8000 to 8003 looks MCU */
425   AM_RANGE(0x8000, 0x8000) AM_READ(input_port_1_r) // 1PL
426   AM_RANGE(0x8001, 0x8001) AM_READ(input_port_2_r) // 2PL / ACK
427   AM_RANGE(0x8002, 0x8002) AM_READ(input_port_0_r) // START
425   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("IN1")   // 1PL
426   AM_RANGE(0x8001, 0x8001) AM_READ_PORT("IN2")   // 2PL / ACK
427   AM_RANGE(0x8002, 0x8002) AM_READ_PORT("IN0")   // START
428428
429429//  AM_RANGE(0x6000, 0x6000) AM_WRITE(adpcm_soundcommand_w)
430430   AM_RANGE(0xA000, 0xA001) AM_WRITE(josvolly_8741_1_w) AM_READ(josvolly_8741_1_r)
r2864r2865
443443ADDRESS_MAP_END
444444
445445static INPUT_PORTS_START( gsword )
446   PORT_START   /* IN0 (8741-2 port1?) */
446   PORT_START_TAG("IN0")      /* IN0 (8741-2 port1?) */
447447   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
448448   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
449449   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r2864r2865
452452   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
453453   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
454454   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
455   PORT_START   /* IN1 (8741-2 port2?) */
455
456   PORT_START_TAG("IN1")      /* IN1 (8741-2 port2?) */
456457   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY
457458   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY
458459   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r2864r2865
461462   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 )
462463   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
463464   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
464   PORT_START   /* IN2 (8741-3 port1?) */
465
466   PORT_START_TAG("IN2")      /* IN2 (8741-3 port1?) */
465467   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
466468   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
467469   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r2864r2865
469471   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
470472   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
471473   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
472   PORT_START   /* IN3  (8741-3 port2?) */
474
475   PORT_START_TAG("IN3")      /* IN3  (8741-3 port2?) */
473476   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL
474477   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL
475478   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r2864r2865
478481   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL
479482   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
480483   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
481   PORT_START   /* IN4 (coins) */
484
485   PORT_START_TAG("IN4")      /* IN4 (coins) */
482486   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
483487   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
484488   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r2864r2865
488492   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
489493   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
490494
491   PORT_START   /* DSW0 */
495   PORT_START_TAG("DSW0")      /* DSW0 */
492496   /* NOTE: Switches 0 & 1, 6,7,8 not used      */
493497   /*   Coins configurations were handled   */
494498   /*   via external hardware & not via program */
r2864r2865
501505   PORT_DIPSETTING(    0x08, DEF_STR( 1C_4C ) )
502506   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_5C ) )
503507
504   PORT_START      /* DSW1 */
508   PORT_START_TAG("DSW1")      /* DSW1 */
505509   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unused ) )
506510   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
507511   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2864r2865
526530   PORT_DIPSETTING(    0x00, "1" )
527531   PORT_DIPSETTING(    0x80, "255 (Cheat)" )
528532
529   PORT_START      /* DSW2 */
533   PORT_START_TAG("DSW2")      /* DSW2 */
530534   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unused ) )
531535   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
532536   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2864r2865
553557INPUT_PORTS_END
554558
555559static INPUT_PORTS_START( josvolly )
556   PORT_START   /* IN0 */
560   PORT_START_TAG("IN0")      /* IN0 */
557561   PORT_BIT( 0x01, IP_ACTIVE_LOW , IPT_START2 )
558562   PORT_BIT( 0x02, IP_ACTIVE_LOW , IPT_START1 )
559563   PORT_BIT( 0x04, IP_ACTIVE_LOW , IPT_COIN2 ) PORT_IMPULSE(1)
r2864r2865
563567   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
564568   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
565569
566   PORT_START   /* IN1 */
570   PORT_START_TAG("IN1")      /* IN1 */
567571   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
568572   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
569573   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
r2864r2865
573577   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
574578   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
575579
576   PORT_START   /* IN2 */
580   PORT_START_TAG("IN2")      /* IN2 */
577581   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
578582   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
579583   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
r2864r2865
583587   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
584588   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
585589
586   PORT_START   /* DSW1 */
590   PORT_START_TAG("DSW1")      /* DSW1 */
587591   PORT_DIPNAME( 0x0c, 0x00, "DIP1-0c(982E)" )
588592   PORT_DIPSETTING(    0x0c, "0" )
589593   PORT_DIPSETTING(    0x08, "1" )
r2864r2865
601605   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
602606   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
603607
604   PORT_START      /* DSW2 */
608   PORT_START_TAG("DSW2")      /* DSW2 */
605609//  PORT_DIPNAME( 0x01, 0x00, "DSW2-0" )
606610//  PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
607611//  PORT_DIPSETTING(    0x01, DEF_STR( On ) )
src/mame/drivers/lethal.c
r2864r2865
176176#define SOUND_CLOCK      XTAL_18_432MHz
177177
178178
179#define GUNX( a ) (( ( input_port_read_indexed(machine,  a ) * 287 ) / 0xff ) + 16)
180#define GUNY( a ) (( ( input_port_read_indexed(machine,  a ) * 223 ) / 0xff ) + 10)
179static const char *gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" };
181180
181/* a = 1, 2 = player # */
182#define GUNX( a ) (( ( input_port_read(machine, gunnames[2 * (a - 1)]) * 287 ) / 0xff ) + 16)
183#define GUNY( a ) (( ( input_port_read(machine, gunnames[2 * (a - 1) + 1]) * 223 ) / 0xff ) + 10)
184
182185VIDEO_START(lethalen);
183186VIDEO_UPDATE(lethalen);
184187WRITE8_HANDLER(lethalen_palette_control);
r2864r2865
229232
230233static READ8_HANDLER( control2_r )
231234{
232   return 0x02 | eeprom_read_bit() | (input_port_read_indexed(machine, 1) & 0xf0);
235   return 0x02 | eeprom_read_bit() | (input_port_read(machine, "IN1") & 0xf0);
233236}
234237
235238static WRITE8_HANDLER( control2_w )
r2864r2865
455458   switch (offset)
456459   {
457460      case 0:
458         return GUNX(2)>>1;
461         return GUNX(1)>>1;
459462         break;
460463      case 1:
461         if ((240-GUNY(3)) == 7)
464         if ((240-GUNY(1)) == 7)
462465            return 0;
463466         else
464            return (240-GUNY(3));
467            return (240-GUNY(1));
465468         break;
466469      case 2:
467         return GUNX(4)>>1;
470         return GUNX(2)>>1;
468471         break;
469472      case 3:
470         if ((240-GUNY(5)) == 7)
473         if ((240-GUNY(2)) == 7)
471474            return 0;
472475         else
473            return (240-GUNY(5));
476            return (240-GUNY(2));
474477         break;
475478   }
476479
r2864r2865
481484{
482485   int res = 0;
483486
484   if (GUNX(2) & 1) res |= 0x80;
485   if (GUNX(4) & 1) res |= 0x40;
487   if (GUNX(1) & 1) res |= 0x80;
488   if (GUNX(2) & 1) res |= 0x40;
486489
487490   return res;
488491}
r2864r2865
499502   AM_RANGE(0x40c8, 0x40d0) AM_WRITE(lethalen_palette_control)   // PCU1-PCU3 on the schematics
500503   AM_RANGE(0x40d4, 0x40d7) AM_READ(guns_r)
501504   AM_RANGE(0x40d8, 0x40d8) AM_READ(control2_r)
502   AM_RANGE(0x40d9, 0x40d9) AM_READ(input_port_0_r)
505   AM_RANGE(0x40d9, 0x40d9) AM_READ_PORT("IN0")
503506   AM_RANGE(0x40db, 0x40db) AM_READ(gunsaux_r)      // top X bit of guns
504507   AM_RANGE(0x40dc, 0x40dc) AM_WRITE(le_bankswitch_w)
505508   AM_RANGE(0x47fe, 0x47ff) AM_WRITE(le_bgcolor_w)      // BG color
r2864r2865
520523
521524static INPUT_PORTS_START( lethalen )
522525   /* IN 0 */
523   PORT_START
526   PORT_START_TAG("IN0")
524527   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
525528   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
526529   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
531534   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
532535
533536   /* IN 1 */
534   PORT_START
537   PORT_START_TAG("IN1")
535538   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
536539   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
537540   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
538541   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
539        PORT_DIPNAME( 0x10, 0x10, DEF_STR(Language) )
540        PORT_DIPSETTING(    0x10, DEF_STR(English) )
541        PORT_DIPSETTING(    0x00, DEF_STR(Spanish) )
542   PORT_DIPNAME( 0x10, 0x10, DEF_STR(Language) )
543   PORT_DIPSETTING(    0x10, DEF_STR(English) )
544   PORT_DIPSETTING(    0x00, DEF_STR(Spanish) )
542545   PORT_DIPNAME( 0x20, 0x00, "Game Type" )
543546   PORT_DIPSETTING(    0x20, "Street" )
544547   PORT_DIPSETTING(    0x00, "Arcade" )
r2864r2865
550553   PORT_DIPSETTING(      0x0080, DEF_STR( Stereo ) )
551554
552555   /* IN 2 */
553   PORT_START
556   PORT_START_TAG("LIGHT0_X")
554557   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
555558
556559   /* IN 3 */
557   PORT_START
560   PORT_START_TAG("LIGHT0_Y")
558561   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, -1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
559562
560563   /* IN 4 */
561   PORT_START
564   PORT_START_TAG("LIGHT1_X")
562565   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(2)
563566
564567   /* IN 5 */
565   PORT_START
568   PORT_START_TAG("LIGHT1_Y")
566569   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, -1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(2)
567570INPUT_PORTS_END
568571
569572static INPUT_PORTS_START( lethalej )
570573   /* IN 0 */
571   PORT_START
574   PORT_START_TAG("IN0")
572575   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
573576   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
574577   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
579582   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
580583
581584   /* IN 1 */
582   PORT_START
585   PORT_START_TAG("IN1")
583586   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
584587   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
585588   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
598601   PORT_DIPSETTING(      0x0080, DEF_STR( Stereo ) )
599602
600603   /* IN 2 */
601   PORT_START
604   PORT_START_TAG("LIGHT0_X")
602605   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, -1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_REVERSE
603606
604607   /* IN 3 */
605   PORT_START
608   PORT_START_TAG("LIGHT0_Y")
606609   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, -1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1) PORT_REVERSE
607610
608611   /* IN 4 */
609   PORT_START
612   PORT_START_TAG("LIGHT1_X")
610613   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, -1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(2) PORT_REVERSE
611614
612615   /* IN 5 */
613   PORT_START
616   PORT_START_TAG("LIGHT1_Y")
614617   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, -1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(2) PORT_REVERSE
615618INPUT_PORTS_END
616619
src/mame/drivers/exprraid.c
r2864r2865
104104
105105static READ8_HANDLER( vblank_r )
106106{
107   return input_port_read_indexed(machine, 0 );
107   return input_port_read(machine, "IN0");
108108}
109109
110110static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 8 )
r2864r2865
115115    AM_RANGE(0x0c00, 0x0fff) AM_RAM_WRITE(exprraid_colorram_w) AM_BASE(&colorram)
116116   AM_RANGE(0x1317, 0x1317) AM_READNOP // ???
117117   AM_RANGE(0x1700, 0x1700) AM_READNOP // ???
118    AM_RANGE(0x1800, 0x1800) AM_READ(input_port_1_r) /* DSW 0 */
119    AM_RANGE(0x1801, 0x1801) AM_READ(input_port_2_r) /* Controls */
120    AM_RANGE(0x1802, 0x1802) AM_READ(input_port_3_r) /* Coins */
121    AM_RANGE(0x1803, 0x1803) AM_READ(input_port_4_r) /* DSW 1 */
118    AM_RANGE(0x1800, 0x1800) AM_READ_PORT("DSW0")   /* DSW 0 */
119    AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN1")   /* Controls */
120    AM_RANGE(0x1802, 0x1802) AM_READ_PORT("IN2")   /* Coins */
121    AM_RANGE(0x1803, 0x1803) AM_READ_PORT("DSW1")   /* DSW 1 */
122122   AM_RANGE(0x2000, 0x2000) AM_WRITENOP // ???
123123    AM_RANGE(0x2001, 0x2001) AM_WRITE(sound_cpu_command_w)
124124   AM_RANGE(0x2002, 0x2002) AM_WRITE(exprraid_flipscreen_w)
r2864r2865
143143
144144
145145static INPUT_PORTS_START( exprraid )
146   PORT_START /* IN 0 - 0x3800 */
146   PORT_START_TAG("IN0")   /* IN 0 - 0x3800 */
147147   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_VBLANK )
148148
149   PORT_START /* DSW 0 - 0x1800 */
149   PORT_START_TAG("DSW0")   /* DSW 0 - 0x1800 */
150150   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
151151   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
152152   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
r2864r2865
166166   PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
167167   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
168168
169   PORT_START /* IN 1 - 0x1801 */
169   PORT_START_TAG("IN1")   /* IN 1 - 0x1801 */
170170   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
171171   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
172172   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
r2864r2865
176176   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
177177   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
178178
179   PORT_START /* IN 2 - 0x1802 */
179   PORT_START_TAG("IN2")   /* IN 2 - 0x1802 */
180180   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
181181   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
182182   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
r2864r2865
186186   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
187187   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
188188
189   PORT_START /* IN 3 - 0x1803 */
189   PORT_START_TAG("DSW1")   /* IN 3 - 0x1803 */
190190   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
191191   PORT_DIPSETTING(    0x01, "1" )
192192   PORT_DIPSETTING(    0x03, "3" )
r2864r2865
287287{
288288   static int coin = 0;
289289
290   if ( ( ~input_port_read_indexed(machine,  3 ) ) & 0xc0 ) {
291      if ( coin == 0 ) {
290   if ((~input_port_read(machine, "IN2")) & 0xc0 )
291   {
292      if ( coin == 0 )
293      {
292294         coin = 1;
293295         cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
294296      }
295   } else
297   }
298   else
296299      coin = 0;
297300}
298301
src/mame/drivers/taitowlf.c
r2864r2865
692692{
693693   bios_ram = auto_malloc(0x10000);
694694
695   init_pc_common(PCCOMMON_KEYBOARD_AT, taitowlf_set_keyb_int);
695   init_pc_common(machine, PCCOMMON_KEYBOARD_AT, taitowlf_set_keyb_int);
696696   mc146818_init(MC146818_STANDARD);
697697
698698   intel82439tx_init();
src/mame/drivers/gunbustr.c
r2864r2865
9191   {
9292      case 0x00:
9393      {
94         return (input_port_read_indexed(machine,0) << 16) | input_port_read_indexed(machine,1) |
95              (eeprom_read_bit() << 7);
94         return (input_port_read(machine, "IN0") << 16) | input_port_read(machine, "IN1") | (eeprom_read_bit() << 7);
9695      }
9796
9897      case 0x01:
9998      {
100         return input_port_read_indexed(machine,2) | (coin_word << 16);
99         return input_port_read(machine, "IN2") | (coin_word << 16);
101100      }
102101    }
103102logerror("CPU #0 PC %06x: read input %06x\n",activecpu_get_pc(),offset);
r2864r2865
174173
175174static READ32_HANDLER( gunbustr_gun_r )
176175{
177   return ( input_port_read_indexed(machine,3) << 24) | (input_port_read_indexed(machine,4) << 16) |
178       ( input_port_read_indexed(machine,5) << 8)  |  input_port_read_indexed(machine,6);
176   return ( input_port_read(machine, "LIGHT0_X") << 24) | (input_port_read(machine, "LIGHT0_Y") << 16) |
177       ( input_port_read(machine, "LIGHT1_X") << 8)  |  input_port_read(machine, "LIGHT1_Y");
179178}
180179
181180static WRITE32_HANDLER( gunbustr_gun_w )
r2864r2865
221220***********************************************************/
222221
223222static INPUT_PORTS_START( gunbustr )
224   PORT_START      /* IN0 */
223   PORT_START_TAG("IN0")      /* IN0 */
225224   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_UNKNOWN )
226225   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_UNKNOWN )
227226   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r2864r2865
239238   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
240239   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
241240
242   PORT_START      /* IN1 */
241   PORT_START_TAG("IN1")      /* IN1 */
243242   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1)   /* Freeze input */
244243   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_UNKNOWN )
245244   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r2864r2865
257256   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(2)
258257   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(2)
259258
260   PORT_START      /* IN2 */
259   PORT_START_TAG("IN2")      /* IN2 */
261260   PORT_SERVICE_NO_TOGGLE( 0x0001, IP_ACTIVE_LOW )
262261   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_SERVICE1 )
263262   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_COIN1 )
r2864r2865
277276
278277   /* Light gun inputs */
279278
280   PORT_START   /* IN 3, P1X */
279   PORT_START_TAG("LIGHT0_X")      /* IN 3, P1X */
281280   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(1)
282281
283   PORT_START   /* IN 4, P1Y */
282   PORT_START_TAG("LIGHT0_Y")      /* IN 4, P1Y */
284283   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(1)
285284
286   PORT_START   /* IN 5, P2X */
285   PORT_START_TAG("LIGHT1_X")      /* IN 5, P2X */
287286   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(2)
288287
289   PORT_START   /* IN 6, P2Y */
288   PORT_START_TAG("LIGHT1_Y")      /* IN 6, P2Y */
290289   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(2)
291290INPUT_PORTS_END
292291
src/mame/drivers/taito_z.c
r2864r2865
771771***************************************************************************/
772772
773773#include "driver.h"
774#include "deprecat.h"
775774#include "cpu/m68000/m68000.h"
776775#include "machine/eeprom.h"
777776#include "video/taitoic.h"
r2864r2865
820819   COMBINE_DATA(&taitoz_sharedram[offset]);
821820}
822821
823static void parse_control(void)
822static void parse_control(running_machine *machine)
824823{
825824   /* bit 0 enables cpu B */
826825   /* however this fails when recovering from a save state
827826       if cpu B is disabled !! */
828   cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
827   cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
829828
830829}
831830
832static void parse_control_noz80(void)
831static void parse_control_noz80(running_machine *machine)
833832{
834833   /* bit 0 enables cpu B */
835834   /* however this fails when recovering from a save state
836835       if cpu B is disabled !! */
837   cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
836   cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
838837
839838}
840839
r2864r2865
844843      data = data >> 8;   /* for Wgp */
845844   cpua_ctrl = data;
846845
847   parse_control();
846   parse_control(machine);
848847
849848   // Chase HQ: handle the lights
850849   if ((!strcmp(machine->gamedrv->name, "chasehq")) || (!strcmp(machine->gamedrv->name, "chasehqj")))
r2864r2865
862861      data = data >> 8;   /* for Wgp */
863862   cpua_ctrl = data;
864863
865   parse_control_noz80();
864   parse_control_noz80(machine);
866865
867866   logerror("CPU #0 PC %06x: write %04x to cpu control\n",activecpu_get_pc(),data);
868867}
r2864r2865
14261425
14271426static STATE_POSTLOAD( taitoz_postload )
14281427{
1429   parse_control();
1428   parse_control(machine);
14301429   reset_sound_region();
14311430}
14321431
r2864r2865
43404339
43414340static STATE_POSTLOAD( bshark_postload )
43424341{
4343   parse_control_noz80();
4342   parse_control_noz80(machine);
43444343}
43454344
43464345static DRIVER_INIT( bshark )
src/mame/drivers/lastfght.c
r2864r2865
109109      {
110110         for ( x = 0; x < 512; x++ )
111111         {
112            data = ( ((count&0xf)==0)&&((count&0x1e00)==0) )? get_white_pen(Machine) : gfxdata[count];   // white grid or data
112            data = ( ((count&0xf)==0)&&((count&0x1e00)==0) )? get_white_pen(screen->machine) : gfxdata[count];   // white grid or data
113113            *BITMAP_ADDR16(bitmap, y, x) = data;
114114            count++;
115115         }
r2864r2865
306306{
307307   // high byte:
308308   // mask 0x1c: from sound?
309   return (mame_rand(machine) & 0x1c00) | input_port_read_indexed(machine, 0);
309   return (mame_rand(machine) & 0x1c00) | input_port_read(machine, "IN0");
310310}
311311
312312static READ16_HANDLER( lastfght_c00004_r )
313313{
314   return input_port_read_indexed(machine, 1);
314   return input_port_read(machine, "IN1");
315315}
316316
317317static READ16_HANDLER( lastfght_c00006_r )
r2864r2865
319319   // low byte:
320320   // bit 7 = protection?
321321   // bit 5 = blitter?
322   return input_port_read_indexed(machine, 2);
322   return input_port_read(machine, "IN2");
323323}
324324
325325static WRITE16_HANDLER( lastfght_c00006_w )
r2864r2865
384384***************************************************************************/
385385
386386static INPUT_PORTS_START( lastfght )
387   PORT_START   // IN0 - c00002&3
387   PORT_START_TAG("IN0")   /* IN0 - c00002&3 */
388388   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1      )
389389   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN      )
390390   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER         ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F1)
r2864r2865
403403   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN      )
404404   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN      )
405405
406   PORT_START   // IN1 - c00004&5
406   PORT_START_TAG("IN1")   /* IN1 - c00004&5 */
407407   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1      )
408408   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2      )
409409   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN      )
r2864r2865
422422   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN1         )
423423   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN2         )
424424
425   PORT_START   // IN2 - c00006&7
425   PORT_START_TAG("IN2")   /* IN2 - c00006&7 */
426426   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN      )
427427   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN      )
428428   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN      )
src/mame/drivers/embargo.c
r2864r2865
5858
5959static READ8_HANDLER( input_port_bit_r )
6060{
61   return (input_port_read_indexed(machine, 1) << (7 - input_select)) & 0x80;
61   return (input_port_read(machine, "IN1") << (7 - input_select)) & 0x80;
6262}
6363
6464
r2864r2865
8282
8383   if (dial_enable_1 && !dial_enable_2)
8484   {
85      lo = input_port_read_indexed(machine, 3);
86      hi = input_port_read_indexed(machine, 4);
85      lo = input_port_read(machine, "DIAL0");
86      hi = input_port_read(machine, "DIAL1");
8787   }
8888
8989   if (dial_enable_2 && !dial_enable_1)
9090   {
91      lo = input_port_read_indexed(machine, 5);
92      hi = input_port_read_indexed(machine, 6);
91      lo = input_port_read(machine, "DIAL2");
92      hi = input_port_read(machine, "DIAL3");
9393   }
9494
9595   lo = 12 * lo / 256;
r2864r2865
185185
186186static INPUT_PORTS_START( embargo )
187187
188   PORT_START /* port 0x01 */
188   PORT_START_TAG("IN0") /* port 0x01 */
189189   PORT_DIPNAME( 0x03, 0x00, "Rounds" )
190190   PORT_DIPSETTING(    0x00, "3" )
191191   PORT_DIPSETTING(    0x01, "4" )
192192   PORT_DIPSETTING(    0x02, "5" )
193193   PORT_DIPSETTING(    0x03, "6" )
194194
195   PORT_START /* S2650_CONTROL_PORT */
195   PORT_START_TAG("IN1") /* S2650_CONTROL_PORT */
196196   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
197197   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
198198   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 )
r2864r2865
202202   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
203203   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
204204
205   PORT_START /* S2650_DATA_PORT */
205   PORT_START_TAG("IN2") /* S2650_DATA_PORT */
206206   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 )
207207
208   PORT_START
208   PORT_START_TAG("DIAL0")
209209   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(8) PORT_PLAYER(1)
210210
211   PORT_START
211   PORT_START_TAG("DIAL1")
212212   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(8) PORT_PLAYER(2)
213213
214   PORT_START
214   PORT_START_TAG("DIAL2")
215215   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(8) PORT_PLAYER(3)
216216
217   PORT_START
217   PORT_START_TAG("DIAL3")
218218   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(8) PORT_PLAYER(4)
219219
220220INPUT_PORTS_END
src/mame/drivers/cyberbal.c
r2864r2865
995995static DRIVER_INIT( cyberbal )
996996{
997997   atarigen_eeprom_default = default_eeprom;
998   atarigen_slapstic_init(0, 0x018000, 0, 0);
998   atarigen_slapstic_init(machine, 0, 0x018000, 0, 0);
999999}
10001000
10011001
10021002static DRIVER_INIT( cyberbt )
10031003{
10041004   atarigen_eeprom_default = default_eeprom;
1005   atarigen_slapstic_init(0, 0x018000, 0, 116);
1005   atarigen_slapstic_init(machine, 0, 0x018000, 0, 116);
10061006}
10071007
10081008
10091009static DRIVER_INIT( cyberb2p )
10101010{
10111011   atarigen_eeprom_default = default_eeprom;
1012   atarijsa_init(machine, 2, 0x8000);
1012   atarijsa_init(machine, "IN2", 0x8000);
10131013}
10141014
10151015
src/mame/drivers/gijoe.c
r2864r2865
9696   /* bit 8  is EEPROM data */
9797   /* bit 9  is EEPROM ready */
9898   /* bit 11 is service button */
99   res = (eeprom_read_bit()<<8) | input_port_read_indexed(machine,0);
99   res = (eeprom_read_bit()<<8) | input_port_read(machine, "IN0");
100100
101101   if (init_eeprom_count)
102102   {
r2864r2865
269269ADDRESS_MAP_END
270270
271271static INPUT_PORTS_START( gijoe )
272   PORT_START
272   PORT_START_TAG("IN0")
273273   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_START1 )
274274   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_START2 )
275275   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_START3 )
r2864r2865
278278   PORT_BIT( 0x0200, IP_ACTIVE_LOW,  IPT_SPECIAL )  // EEPROM ready (always 1)
279279   PORT_SERVICE_NO_TOGGLE( 0x0800, IP_ACTIVE_LOW )
280280
281   PORT_START
281   PORT_START_TAG("IN1")
282282   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_COIN1 )
283283   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_COIN2 )
284284   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_COIN3 )
r2864r2865
288288   PORT_BIT( 0x0400, IP_ACTIVE_LOW,  IPT_SERVICE3 )
289289   PORT_BIT( 0x0800, IP_ACTIVE_LOW,  IPT_SERVICE4 )
290290
291   PORT_START
291   PORT_START_TAG("IN2")
292292   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
293293   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
294294   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
310310   PORT_DIPSETTING(      0x8000, "Common" )
311311   PORT_DIPSETTING(      0x0000, "Independant" )
312312
313   PORT_START
313   PORT_START_TAG("IN3")
314314   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
315315   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
316316   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
src/mame/drivers/wilytowr.c
r2864r2865
1111  rely on vblank for timing. It all seems to be controlled by the CPU clock.
1212  The NMI handler just handles the "Stop Mode" dip switch.
1313
14Tomasz Slanina 2008.06.14:
15- Addedd sound emulation - atomboy and fghtbskt req different interrupt (T1)
16  timing than wilytowr, otherwise music/fx tempo is too fast. Maybe both
17  tmings are wrong - must be verified on real pcb.
18- Extra space in atomboy 2764 eproms is filled with garbage z80 code
19  (taken from one of code roms, but from different offset)
20- Fghtbskt has one AY, but every frame writes 0 to 2nd AY regs - probably
21  leftover from Wily Tower sound driver/code
22- I'm not sure about sound_status write - maybe it's something else or
23  different data (p1?) is used as status
24
1425TODO:
15- Sound: it's difficult to guess how the I8039 is connected... there's also a
16  OKI MSM80C39RS chip.
17- One unknown ROM. Samples?
1826- Sprite positioning is wacky. The electric 'bands' that go along the pipes
1927  are drawn 2 pixels off in x/y directions. If you fix that, then the player
2028  sprite doesn't slide in the middle of the pipes when climbing...
29- Clocks
2130
2231Dip locations verified for:
2332- atomboy (manual)
2433
34
2535***************************************************************************/
2636
2737#include "driver.h"
r2864r2865
3343extern WRITE8_HANDLER( fghtbskt_samples_w );
3444
3545static UINT8 *wilytowr_videoram2, *wilytowr_scrollram;
36
3746static int pal_bank, fg_flag, sy_offset;
38
3947static tilemap *bg_tilemap, *fg_tilemap;
48static UINT8 sound_irq;
49static int sound_status;
50static int p1,p2;
4051
4152
4253static PALETTE_INIT( wilytowr )
4354{
4455   int i;
4556
46
4757   for (i = 0;i < 256;i++)
4858   {
4959      int bit0,bit1,bit2,bit3,r,g,b;
r2864r2865
217227   coin_counter_w(offset, data & 0x01);
218228}
219229
220
221230static WRITE8_HANDLER( snd_irq_w )
222231{
223   cpunum_set_input_line(machine, 1, 0, PULSE_LINE);
232   cpunum_set_input_line(machine, 1, 0, ASSERT_LINE);
233   timer_call_after_resynch(NULL, 0, NULL);
224234}
225235
226
227
228static int p1,p2;
229
230236static WRITE8_HANDLER( snddata_w )
231237{
232238   int num_ays = (sndti_exists(SOUND_AY8910, 1)) ? 2 : 1;
239
233240   if ((p2 & 0xf0) == 0xe0)
234241      AY8910_control_port_0_w(machine,0,offset);
235242   else if ((p2 & 0xf0) == 0xa0)
r2864r2865
237244   else if (num_ays == 2 && (p1 & 0xe0) == 0x60)
238245      AY8910_control_port_1_w(machine,0,offset);
239246   else if (num_ays == 2 && (p1 & 0xe0) == 0x40)
240      AY8910_write_port_1_w(machine,0,offset);
241   else // if ((p2 & 0xf0) != 0x70)
242      /* the port address is the data, while the data seems to be control bits */
243      logerror("%04x: snddata_w ctrl = %02x, p1 = %02x, p2 = %02x, data = %02x\n",activecpu_get_pc(),data,p1,p2,offset);
247       AY8910_write_port_1_w(machine,0,offset);
248   else if ((p2 & 0xf0) == 0x70 )
249      sound_status=offset;
244250}
245251
246252static WRITE8_HANDLER( p1_w )
r2864r2865
251257static WRITE8_HANDLER( p2_w )
252258{
253259   p2 = data;
260   if((p2&0xf0)==0x50)
261   {
262      cpunum_set_input_line(machine, 1, 0, CLEAR_LINE);
263   }
254264}
255265
266static READ8_HANDLER( snd_status_r )
267{
268   return sound_status;
269}
256270
271static READ8_HANDLER( irq_r )
272{
273   if (sound_irq)
274   {
275      sound_irq = 0;
276      return 1;
277   }
278   return 0;
279}
280
281static READ8_HANDLER( snddata_r )
282{
283   switch(p2&0xf0)
284   {
285      case 0x60:   return soundlatch_r(machine,0); ;
286      case 0x70:   return memory_region(REGION_USER1)[((p1&0x1f)<<8)|offset];
287   }
288   return 0xff;
289}
290
257291static ADDRESS_MAP_START( wilytowr_map, ADDRESS_SPACE_PROGRAM, 8 )
258292   AM_RANGE(0x0000, 0xbfff) AM_ROM
259293   AM_RANGE(0xd000, 0xdfff) AM_RAM
r2864r2865
284318   AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(wilytowr_videoram2_w) AM_BASE(&wilytowr_videoram2)
285319   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(wilytowr_videoram_w) AM_BASE(&videoram)
286320   AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(wilytowr_colorram_w) AM_BASE(&colorram)
287   AM_RANGE(0xf000, 0xf000) AM_READNOP //sound status
321   AM_RANGE(0xf000, 0xf000) AM_READ(snd_status_r)
288322   AM_RANGE(0xf001, 0xf001) AM_READ(input_port_0_r)
289323   AM_RANGE(0xf002, 0xf002) AM_READ(input_port_1_r)
290324   AM_RANGE(0xf003, 0xf003) AM_READ(input_port_2_r)
r2864r2865
307341
308342
309343static ADDRESS_MAP_START( i8039_port_map, ADDRESS_SPACE_IO, 8 )
310//  AM_RANGE(I8039_t1, I8039_t1)
311   AM_RANGE(0x00, 0xff) AM_WRITE(snddata_w)
344   AM_RANGE(0x00, 0xff) AM_READWRITE(snddata_r, snddata_w)
312345   AM_RANGE(I8039_p1, I8039_p1) AM_WRITE(p1_w)
313346   AM_RANGE(I8039_p2, I8039_p2) AM_WRITE(p2_w)
347   AM_RANGE(I8039_t1, I8039_t1) AM_READ(irq_r)
314348ADDRESS_MAP_END
315349
316350
r2864r2865
502536   fghtbskt_sh_start
503537};
504538
539static void snd_irq(running_machine *machine, int num)
540{
541   sound_irq = 1;
542}
505543
506544static MACHINE_DRIVER_START( wilytowr )
507545
508546   /* basic machine hardware */
509   MDRV_CPU_ADD(Z80,12000000/4)     /* 3 MHz */
547   MDRV_CPU_ADD_TAG("maincpu",Z80,12000000/4)     /* 3 MHz */
510548   MDRV_CPU_PROGRAM_MAP(wilytowr_map,0)
511549   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
512550
513551   /* audio CPU */
514   MDRV_CPU_ADD(I8039,12000000/4)   /* ????? */
552   MDRV_CPU_ADD_TAG("soundcpu",I8039,12000000/4)   /* ????? */
515553   MDRV_CPU_PROGRAM_MAP(i8039_map,0)
516554   MDRV_CPU_IO_MAP(i8039_port_map,0)
555   MDRV_CPU_PERIODIC_INT(snd_irq, 60)
517556
557
518558   /* video hardware */
519559   MDRV_SCREEN_ADD("main", RASTER)
520560   MDRV_SCREEN_REFRESH_RATE(60)
r2864r2865
540580   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
541581MACHINE_DRIVER_END
542582
583static MACHINE_DRIVER_START( atomboy )
584   MDRV_IMPORT_FROM(wilytowr)
585   MDRV_CPU_MODIFY("soundcpu")
586   MDRV_CPU_PERIODIC_INT(snd_irq, 60/2)
587MACHINE_DRIVER_END
588
543589static MACHINE_DRIVER_START( fghtbskt )
544590
545591   /* basic machine hardware */
r2864r2865
551597   MDRV_CPU_ADD(I8039,12000000/4)   /* ????? */
552598   MDRV_CPU_PROGRAM_MAP(i8039_map,0)
553599   MDRV_CPU_IO_MAP(i8039_port_map,0)
600   MDRV_CPU_PERIODIC_INT(snd_irq, 60/2)
554601
555602   /* video hardware */
556603   MDRV_SCREEN_ADD("main", RASTER)
r2864r2865
616663   ROM_LOAD( "wt_a-3p.bin",  0x4000, 0x1000, CRC(7299f362) SHA1(5ba309d789df8432c08d67e4f9e8bf6c447fc425) )
617664   ROM_LOAD( "wt_a-3s.bin",  0x5000, 0x1000, CRC(9b37d50d) SHA1(a08d4a7654b815cb652be66dbaa097011327f5d5) )
618665
619   ROM_REGION( 0x1000, REGION_USER1, 0 )   /* unknown; sound? */
666   ROM_REGION( 0x2000, REGION_USER1, 0 )
620667   ROM_LOAD( "wt_a-6d.bin",  0x0000, 0x1000, CRC(a5dde29b) SHA1(8f7545d2022da7c98d47112179dce717f6c3c5e2) )
621668
669
622670   ROM_REGION( 0x0320, REGION_PROMS, 0 )
623671   ROM_LOAD( "wt_a-5s-.bpr", 0x0000, 0x0100, CRC(041950e7) SHA1(8276068bec3f4c5013c773033fca3cd3ed9e82ef) )   /* red */
624672   ROM_LOAD( "wt_a-5r-.bpr", 0x0100, 0x0100, CRC(bc04bf25) SHA1(37d0e89296760f51df5a0d434dca390fb60bb052) )   /* green */
r2864r2865
656704   ROM_LOAD( "wt_a-3p-b.bin",  0x8000, 0x2000, CRC(3018b840) SHA1(77df9d4f1c8d76d30c435d03d51ef9e7509fab9c) )
657705   ROM_LOAD( "wt_a-3s-b.bin",  0xa000, 0x2000, CRC(05a251d4) SHA1(1cd9102871507ab988d5fe799024d63b93807448) )
658706
659   ROM_REGION( 0x1000, REGION_USER1, 0 )   /* unknown; sound? */
707   ROM_REGION( 0x2000, REGION_USER1, 0 )
660708   ROM_LOAD( "wt_a-6d.bin",  0x0000, 0x1000, CRC(a5dde29b) SHA1(8f7545d2022da7c98d47112179dce717f6c3c5e2) )
661709
662710   ROM_REGION( 0x0320, REGION_PROMS, 0 )
r2864r2865
697745   ROM_LOAD( "wt_a-3p.bin",  0x4000, 0x1000, CRC(7299f362) SHA1(5ba309d789df8432c08d67e4f9e8bf6c447fc425) )
698746   ROM_LOAD( "wt_a-3s.bin",  0x5000, 0x1000, CRC(9b37d50d) SHA1(a08d4a7654b815cb652be66dbaa097011327f5d5) )
699747
700   ROM_REGION( 0x1000, REGION_USER1, 0 )   /* unknown; sound? */
748   ROM_REGION( 0x1000, REGION_USER1, 0 )
701749   ROM_LOAD( "wt_a-6d.bin",  0x0000, 0x1000, CRC(a5dde29b) SHA1(8f7545d2022da7c98d47112179dce717f6c3c5e2) )
702750
703751   ROM_REGION( 0x0320, REGION_PROMS, 0 )
r2864r2865
715763   ROM_LOAD( "fb10.6f",      0x8000, 0x2000, CRC(6b47efba) SHA1(cb55c7a9d5afe748c1c88f87dd1909e106932798) )
716764   ROM_LOAD( "fb09.7f",      0xa000, 0x2000, CRC(be69e087) SHA1(be95ecafa494cb0787ee18eb3ecea4ad545a6ae3) )
717765
718   ROM_REGION( 0x3000, REGION_CPU2, 0 )   /* 8039 */
766   ROM_REGION( 0x1000, REGION_CPU2, 0 )   /* 8039 */
719767   ROM_LOAD( "fb07.0b",      0x0000, 0x1000, CRC(50432dbd) SHA1(35a2218ed243bde47dbe06b5a11a65502ba734ea) )
720   /* on the real pcb if you remove it the ay8910 doesn't sound anymore, probably the cpu reads it somehow */
721   ROM_LOAD( "fb06.12a",     0x1000, 0x2000, CRC(bea3df99) SHA1(18b795f8626b22f6a1620e04c23f4967c3122c89) )
722768
723769   ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
724770   ROM_LOAD( "fb08.12f",     0x0000, 0x1000, CRC(271cd7b8) SHA1(00cfeb6ba429cf6cc59d6542dea8de2ca79155ed) )
r2864r2865
744790   ROM_LOAD( "fb04.39a",     0x6000, 0x2000, CRC(02ddc42d) SHA1(9d40967071f674592c174b5a5470db56a5f99adf) )
745791   ROM_LOAD( "fb05.38a",     0x8000, 0x2000, CRC(72ea6b49) SHA1(e081a1cad5abf373a2489169b5c86ee63dcf5823) )
746792
793   ROM_REGION( 0x2000, REGION_USER1, 0 )
794   ROM_LOAD( "fb06.12a",     0x0000, 0x2000, CRC(bea3df99) SHA1(18b795f8626b22f6a1620e04c23f4967c3122c89) )
795
747796   ROM_REGION( 0x0300, REGION_PROMS, 0 )
748797   ROM_LOAD( "fb_r.9e",      0x0000, 0x0100, CRC(c5cdc8ba) SHA1(3fcef3ebe0dda72dfa35e042ff611758c345d749) )
749798   ROM_LOAD( "fb_g.10e",     0x0100, 0x0100, CRC(1460c936) SHA1(f99a544c83931de098a6cfac391f63ae43f5cdd0) )
750799   ROM_LOAD( "fb_b.11e",     0x0200, 0x0100, CRC(fca5bf0e) SHA1(5846f43aa2906cac58e300fdab197b99f896e3ef) )
800
801
751802ROM_END
752803
753804static DRIVER_INIT( wilytowr )
r2864r2865
760811   sy_offset = 240;
761812}
762813
763GAME( 1984, wilytowr, 0,        wilytowr, wilytowr, wilytowr, ROT180, "Irem",                    "Wily Tower", GAME_NO_SOUND )
764GAME( 1985, atomboy,  wilytowr, wilytowr, wilytowr, wilytowr, ROT180, "Irem (Memetron license)", "Atomic Boy (revision B)", GAME_NO_SOUND )
765GAME( 1985, atomboya, wilytowr, wilytowr, wilytowr, wilytowr, ROT180, "Irem (Memetron license)", "Atomic Boy (revision A)", GAME_NO_SOUND )
766GAME( 1984, fghtbskt, 0,        fghtbskt, fghtbskt, fghtbskt, ROT0,   "Paradise Co. Ltd.",       "Fighting Basketball", GAME_IMPERFECT_SOUND )
814GAME( 1984, wilytowr, 0,        wilytowr, wilytowr, wilytowr, ROT180, "Irem",                    "Wily Tower", 0 )
815GAME( 1985, atomboy,  wilytowr, atomboy,  wilytowr, wilytowr, ROT180, "Irem (Memetron license)", "Atomic Boy (revision B)", 0 )
816GAME( 1985, atomboya, wilytowr, atomboy,  wilytowr, wilytowr, ROT180, "Irem (Memetron license)", "Atomic Boy (revision A)", 0 )
817GAME( 1984, fghtbskt, 0,        fghtbskt, fghtbskt, fghtbskt, ROT0,   "Paradise Co. Ltd.",       "Fighting Basketball", 0 )
src/mame/drivers/looping.c
r2864r2865
11/*
22To Do:
3- redump COP420 internal ROM
34- get sound working
45- map and test any remaining input ports
56
r2864r2865
1011        TMS9995
1112
1213    COP420 Microcontroller
13        manages CPU communnication?
14        protection
1415
1516    Sound CPU
1617        TMS9980
r2864r2865
716717   ROM_LOAD( "i-o.11a",      0x2800, 0x1000, CRC(61c74c79) SHA1(9f34d18a919446dd76857b851cea23fc1526f3c2) ) /* speech */
717718
718719   ROM_REGION( 0x1000, REGION_CPU3, 0 ) /* COP420 microcontroller code */
719   ROM_LOAD( "cop.bin",      0x0000, 0x1000, CRC(bbfd26d5) SHA1(5f78b32b6e7c003841ef5b635084db2cdfebf0e1) )
720   ROM_LOAD( "cop.bin",      0x0000, 0x1000, BAD_DUMP CRC(bbfd26d5) SHA1(5f78b32b6e7c003841ef5b635084db2cdfebf0e1) ) // overdumped 4 times, and starting PC is not 0
720721
721722   ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE )
722723   ROM_LOAD( "log2.8a",      0x0000, 0x800, CRC(ef3284ac) SHA1(8719c9df8c972a56c306b3c707aaa53092ffa2d6) )
r2864r2865
740741   ROM_LOAD( "i-o.11a",      0x2800, 0x1000, CRC(61c74c79) SHA1(9f34d18a919446dd76857b851cea23fc1526f3c2) )
741742
742743   ROM_REGION( 0x1000, REGION_CPU3, 0 ) /* COP420 microcontroller code */
743   ROM_LOAD( "cop.bin",      0x0000, 0x1000, CRC(bbfd26d5) SHA1(5f78b32b6e7c003841ef5b635084db2cdfebf0e1) )
744   ROM_LOAD( "cop.bin",      0x0000, 0x1000, BAD_DUMP CRC(bbfd26d5) SHA1(5f78b32b6e7c003841ef5b635084db2cdfebf0e1) ) // overdumped 4 times, and starting PC is not 0
744745
745746   ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE )
746747   ROM_LOAD( "log2.8a",      0x0000, 0x800, CRC(ef3284ac) SHA1(8719c9df8c972a56c306b3c707aaa53092ffa2d6) )
r2864r2865
763764   ROM_LOAD( "snd.11a",      0x2800, 0x1000, CRC(61c74c79) SHA1(9f34d18a919446dd76857b851cea23fc1526f3c2) )
764765
765766   ROM_REGION( 0x1000, REGION_CPU3, 0 ) /* COP420 microcontroller code */
766   ROM_LOAD( "cop.bin",      0x0000, 0x1000, CRC(bbfd26d5) SHA1(5f78b32b6e7c003841ef5b635084db2cdfebf0e1) )
767   ROM_LOAD( "cop.bin",      0x0000, 0x1000, BAD_DUMP CRC(bbfd26d5) SHA1(5f78b32b6e7c003841ef5b635084db2cdfebf0e1) ) // overdumped 4 times, and starting PC is not 0
767768
768769   ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE )
769770   ROM_LOAD( "vid.8a",         0x0000, 0x800, CRC(459ccc55) SHA1(747f6789605b48be9e22f779f9e3f6c98ad4e594) )
src/mame/drivers/darkhors.c
r2864r2865
295295   // from bit mask to bit number
296296   int bit_p1 = mask_to_bit((input_sel & 0x00ff0000) >> 16);
297297   int bit_p2 = mask_to_bit((input_sel & 0xff000000) >> 24);
298   static const char *portnames[] = { "IN0", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6", "IN7" };
298299
299   return   (input_port_read_indexed(machine, 5 + bit_p1) & 0x00ffffff) |
300         (input_port_read_indexed(machine, 5 + bit_p2) & 0xff000000) ;
300   return   (input_port_read(machine, portnames[bit_p1]) & 0x00ffffff) |
301         (input_port_read(machine, portnames[bit_p2]) & 0xff000000) ;
301302}
302303
303304static WRITE32_HANDLER( darkhors_unk1_w )
r2864r2865
348349***************************************************************************/
349350
350351static INPUT_PORTS_START( darkhors )
351   PORT_START   // IN0 - 580000
352   PORT_START_TAG("580000")   /* IN0 - 580000 */
352353   PORT_BIT( 0xff7fffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
353354   PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("?") PORT_CODE(KEYCODE_RCONTROL)
354355
355   PORT_START   // IN1 - 580004
356   PORT_START_TAG("580004")   /* IN1 - 580004 */
356357   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
357358   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_BILL1 )   // bill in
358359   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_COIN1 )   // coin in s1
r2864r2865
365366   PORT_BIT( 0x08000000, IP_ACTIVE_LOW, IPT_COIN2 )   // coin drop p2
366367   PORT_BIT( 0x10000000, IP_ACTIVE_LOW, IPT_SPECIAL)   // hopper full p2
367368
368   PORT_START   // IN2 - 580400
369   PORT_START_TAG("580400")   /* IN2 - 580400 */
369370   PORT_BIT( 0xfffcffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
370371   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD)
371372   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("9") PORT_CODE(KEYCODE_9_PAD)
372373
373   PORT_START   // IN3 - 580420
374   PORT_START_TAG("580420")   /* IN3 - 580420 */
374375   PORT_BIT( 0xfffcffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
375376   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0*") PORT_CODE(KEYCODE_0_PAD)
376377   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("9*") PORT_CODE(KEYCODE_9_PAD)
377378
378   PORT_START   // IN4 - 4e0080
379   PORT_START_TAG("4e0080")   /* IN4 - 4e0080 */
379380   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW,  IPT_UNKNOWN )
380381   PORT_BIT( 0x00010000, IP_ACTIVE_LOW,  IPT_SERVICE1 )   // config
381382   PORT_BIT( 0x00020000, IP_ACTIVE_LOW,  IPT_SERVICE2 )   // reset
r2864r2865
394395   PORT_BIT( 0x40000000, IP_ACTIVE_LOW,  IPT_UNKNOWN  )
395396   PORT_BIT( 0x80000000, IP_ACTIVE_LOW,  IPT_UNKNOWN  )
396397
397   PORT_START   // IN5 - 580008(0)
398   PORT_START_TAG("IN0")   /* IN5 - 580008(0) */
398399   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
399400   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 1") PORT_CODE(KEYCODE_1_PAD)
400401   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 2") PORT_CODE(KEYCODE_2_PAD)
r2864r2865
413414   PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P2 Bet 7") //PORT_CODE(KEYCODE_)
414415   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P2 Bet 8") //PORT_CODE(KEYCODE_)
415416
416   PORT_START   // IN6 - 580008(1)
417   PORT_START_TAG("IN1")   /* IN6 - 580008(1) */
417418   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
418419   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 1-2") PORT_CODE(KEYCODE_Z)
419420   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 1-3") PORT_CODE(KEYCODE_A)
r2864r2865
432433   PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P2 Bet 1-8") //PORT_CODE(KEYCODE_)
433434   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
434435
435   PORT_START   // IN7 - 580008(2)
436   PORT_START_TAG("IN2")   /* IN7 - 580008(2) */
436437   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
437438   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 2-3") PORT_CODE(KEYCODE_X)
438439   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 2-4") PORT_CODE(KEYCODE_S)
r2864r2865
451452   PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
452453   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
453454
454   PORT_START   // IN - 580008(3)
455   PORT_START_TAG("IN3")   /* IN - 580008(3) */
455456   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
456457   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 3-4") PORT_CODE(KEYCODE_C)
457458   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 3-5") PORT_CODE(KEYCODE_D)
r2864r2865
470471   PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
471472   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
472473
473   PORT_START   // IN8 - 580008(4)
474   PORT_START_TAG("IN4")   /* IN8 - 580008(4) */
474475   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
475476   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 4-5") PORT_CODE(KEYCODE_V)
476477   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 4-6") PORT_CODE(KEYCODE_F)
r2864r2865
489490   PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
490491   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
491492
492   PORT_START   // IN9 - 580008(5)
493   PORT_START_TAG("IN5")   /* IN9 - 580008(5) */
493494   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
494495   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 5-6") PORT_CODE(KEYCODE_B)
495496   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 5-7") PORT_CODE(KEYCODE_G)
r2864r2865
508509   PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
509510   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
510511
511   PORT_START   // IN10 - 580008(6)
512   PORT_START_TAG("IN6")   /* IN10 - 580008(6) */
512513   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
513514   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 6-7") PORT_CODE(KEYCODE_N)
514515   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 6-8") PORT_CODE(KEYCODE_H)
r2864r2865
527528   PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
528529   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
529530
530   PORT_START   // IN11 - 580008(7)
531   PORT_START_TAG("IN7")   /* IN11 - 580008(7) */
531532   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
532533   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 7-8") PORT_CODE(KEYCODE_M)
533534   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/offtwall.c
r2864r2865
9090
9191static READ16_HANDLER( special_port3_r )
9292{
93   int result = input_port_read_indexed(machine, 3);
93   int result = input_port_read(machine, "260010");
9494   if (atarigen_cpu_to_sound_ready) result ^= 0x0020;
9595   return result;
9696}
r2864r2865
310310 *************************************/
311311
312312static INPUT_PORTS_START( offtwall )
313   PORT_START   /* 260000 */
313   PORT_START_TAG("260000")   /* 260000 */
314314   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
315315   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
316316   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
r2864r2865
328328   PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
329329   PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
330330
331   PORT_START   /* 260002 */
331   PORT_START_TAG("260002")   /* 260002 */
332332   PORT_BIT(  0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
333333   PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3)
334334   PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
r2864r2865
341341
342342   JSA_III_PORT   /* audio board port */
343343
344   PORT_START   /* 260010 */
344   PORT_START_TAG("260010")   /* 260010 */
345345   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
346346   PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Controls ) )
347347   PORT_DIPSETTING(      0x0000, "Whirly-gigs" )   /* this is official Atari terminology! */
r2864r2865
354354   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_VBLANK )
355355   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
356356
357   PORT_START   /* 260012 */
357   PORT_START_TAG("260012")   /* 260012 */
358358   PORT_BIT(  0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
359359
360   PORT_START   /* 260020 */
360   PORT_START_TAG("260020")   /* 260020 */
361361    PORT_BIT( 0xff, 0, IPT_DIAL_V ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
362362   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
363363
364   PORT_START   /* 260022 */
364   PORT_START_TAG("260022")   /* 260022 */
365365    PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
366366   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
367367
368   PORT_START   /* 260024 */
368   PORT_START_TAG("260024")   /* 260024 */
369369    PORT_BIT( 0xff, 0, IPT_DIAL_V ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(3)
370370   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
371371INPUT_PORTS_END
r2864r2865
500500static DRIVER_INIT( offtwall )
501501{
502502   atarigen_eeprom_default = default_eeprom;
503   atarijsa_init(machine, 3, 0x0040);
503   atarijsa_init(machine, "260010", 0x0040);
504504
505505   /* install son-of-slapstic workarounds */
506506   spritecache_count = memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3fde42, 0x3fde43, 0, 0, spritecache_count_r);
r2864r2865
512512static DRIVER_INIT( offtwalc )
513513{
514514   atarigen_eeprom_default = default_eeprom;
515   atarijsa_init(machine, 3, 0x0040);
515   atarijsa_init(machine, "260010", 0x0040);
516516
517517   /* install son-of-slapstic workarounds */
518518   spritecache_count = memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3fde42, 0x3fde43, 0, 0, spritecache_count_r);
src/mame/drivers/equites.c
r2864r2865
647647#if HVOLTAGE_DEBUG
648648static READ16_HANDLER(hvoltage_debug_r)
649649{
650   return(input_port_read_indexed(machine, 2));
650   return(input_port_read(machine, "FAKE"));
651651}
652652#endif
653653
r2864r2865
801801// Equites Port Map
802802
803803static INPUT_PORTS_START( equites )
804   PORT_START
804   PORT_START_TAG("IN0")
805805   EQUITES_PLAYER_INPUT_LSB( IPT_BUTTON1, IPT_BUTTON2, IPT_BUTTON3, IPT_START1 )
806806   EQUITES_PLAYER_INPUT_MSB( IPT_BUTTON1, IPT_BUTTON2, IPT_BUTTON3, IPT_START2 )
807807
808   PORT_START
808   PORT_START_TAG("IN1")
809809   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 )
810810   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_COIN2 )
811811#if EASY_TEST_MODE
r2864r2865
838838// Gekisou Port Map
839839
840840static INPUT_PORTS_START( gekisou )
841   PORT_START
841   PORT_START_TAG("IN0")
842842   EQUITES_PLAYER_INPUT_LSB( IPT_BUTTON1, IPT_BUTTON2, IPT_BUTTON3, IPT_START1 )
843843   EQUITES_PLAYER_INPUT_MSB( IPT_BUTTON1, IPT_BUTTON2, IPT_BUTTON3, IPT_START2 )
844844
845   PORT_START
845   PORT_START_TAG("IN1")
846846   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 )
847847   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_COIN2 )
848848#if EASY_TEST_MODE
r2864r2865
864864// Bull Fighter Port Map
865865
866866static INPUT_PORTS_START( bullfgtr )
867   PORT_START
867   PORT_START_TAG("IN0")
868868   EQUITES_PLAYER_INPUT_LSB( IPT_BUTTON1, IPT_BUTTON2, IPT_BUTTON3, IPT_START1 )
869869   EQUITES_PLAYER_INPUT_MSB( IPT_BUTTON1, IPT_BUTTON2, IPT_BUTTON3, IPT_START2 )
870870
871   PORT_START
871   PORT_START_TAG("IN1")
872872   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 )
873873   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_COIN2 )
874874#if EASY_TEST_MODE
r2864r2865
900900// Koukouyakyuh Port Map
901901
902902static INPUT_PORTS_START( kouyakyu )
903   PORT_START
903   PORT_START_TAG("IN0")
904904   EQUITES_PLAYER_INPUT_LSB( IPT_BUTTON1, IPT_BUTTON2, IPT_BUTTON3, IPT_START1 )
905905   EQUITES_PLAYER_INPUT_MSB( IPT_BUTTON1, IPT_BUTTON2, IPT_BUTTON3, IPT_START2 )
906906
907   PORT_START
907   PORT_START_TAG("IN1")
908908//  PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 )
909909//  PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNUSED )
910910   PORT_BIT( 0x0300, IP_ACTIVE_HIGH, IPT_COIN1 )
r2864r2865
937937// Splendor Blast Port Map
938938
939939static INPUT_PORTS_START( splndrbt )
940   PORT_START
940   PORT_START_TAG("IN0")
941941   EQUITES_PLAYER_INPUT_LSB( IPT_BUTTON1, IPT_BUTTON2, IPT_UNKNOWN, IPT_START1 )
942942   EQUITES_PLAYER_INPUT_MSB( IPT_BUTTON1, IPT_BUTTON2, IPT_UNKNOWN, IPT_START2 )
943943
944   PORT_START
944   PORT_START_TAG("IN1")
945945   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 )
946946   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_COIN2 )
947947#if EASY_TEST_MODE
r2864r2865
973973// High Voltage Port Map
974974
975975static INPUT_PORTS_START( hvoltage )
976   PORT_START
976   PORT_START_TAG("IN0")
977977   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
978978   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
979979   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
r2864r2865
993993   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_COCKTAIL
994994   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_START2 )
995995
996   PORT_START
996   PORT_START_TAG("IN1")
997997   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 )
998998   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_COIN2 )
999999#if EASY_TEST_MODE
r2864r2865
10271027
10281028#if HVOLTAGE_DEBUG
10291029   /* Fake port to handle debug mode */
1030   PORT_START
1030   PORT_START_TAG("FAKE")
10311031   PORT_DIPNAME( 0xffff, 0xffff, "Debug Mode" )
10321032   PORT_DIPSETTING(      0xffff, DEF_STR( Off ) )
10331033   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
src/mame/drivers/decocass.c
r2864r2865
149149ADDRESS_MAP_END
150150
151151static INPUT_PORTS_START( decocass )
152   PORT_START      /* IN0 */
152   PORT_START_TAG("IN0")      /* IN0 */
153153   PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_RIGHT )
154154   PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_LEFT )
155155   PORT_BIT( 0x04, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP )
r2864r2865
159159   PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_UNUSED )
160160   PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_UNUSED )
161161
162   PORT_START      /* IN1 */
162   PORT_START_TAG("IN1")      /* IN1 */
163163   PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
164164   PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
165165   PORT_BIT( 0x04, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP ) PORT_COCKTAIL
r2864r2865
169169   PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_UNUSED )
170170   PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_UNUSED )
171171
172   PORT_START      /* IN2 */
172   PORT_START_TAG("IN2")      /* IN2 */
173173   PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_UNKNOWN )
174174   PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_UNKNOWN )
175175   PORT_BIT( 0x04, IP_ACTIVE_HIGH,IPT_UNKNOWN )
r2864r2865
179179   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1)
180180   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1)
181181
182   PORT_START      /* IN3 */
182   PORT_START_TAG("AN0")      /* IN3 */
183183   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
184184
185   PORT_START      /* IN4 */
185   PORT_START_TAG("AN1")      /* IN4 */
186186   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
187187
188   PORT_START      /* IN5 */
188   PORT_START_TAG("AN2")      /* IN5 */
189189   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
190190
191   PORT_START      /* IN6 */
191   PORT_START_TAG("AN3")      /* IN6 */
192192   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
193193
194194   PORT_START_TAG("DSW1")
src/mame/drivers/fromance.c
r2864r2865
202202   int ret = 0xff;
203203
204204   if (fromance_portselect & 0x01)
205      ret &= input_port_read_indexed(machine, 4);
205      ret &= input_port_read(machine, "KEY1");
206206   if (fromance_portselect & 0x02)
207      ret &= input_port_read_indexed(machine, 5);
207      ret &= input_port_read(machine, "KEY2");
208208   if (fromance_portselect & 0x04)
209      ret &= input_port_read_indexed(machine, 6);
209      ret &= input_port_read(machine, "KEY3");
210210   if (fromance_portselect & 0x08)
211      ret &= input_port_read_indexed(machine, 7);
211      ret &= input_port_read(machine, "KEY4");
212212   if (fromance_portselect & 0x10)
213      ret &= input_port_read_indexed(machine, 8);
213      ret &= input_port_read(machine, "KEY5");
214214
215215   return ret;
216216}
r2864r2865
239239static ADDRESS_MAP_START( nekkyoku_readmem_main, ADDRESS_SPACE_PROGRAM, 8 )
240240   AM_RANGE(0x0000, 0xbfff) AM_READ(SMH_ROM)
241241   AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
242   AM_RANGE(0xf000, 0xf000) AM_READ(input_port_0_r)
242   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("IN0")
243243   AM_RANGE(0xf001, 0xf001) AM_READ(fromance_keymatrix_r)
244   AM_RANGE(0xf002, 0xf002) AM_READ(input_port_1_r)
244   AM_RANGE(0xf002, 0xf002) AM_READ_PORT("IN1")
245245   AM_RANGE(0xf003, 0xf003) AM_READ(fromance_busycheck_main_r)
246   AM_RANGE(0xf004, 0xf004) AM_READ(input_port_3_r)
247   AM_RANGE(0xf005, 0xf005) AM_READ(input_port_2_r)
246   AM_RANGE(0xf004, 0xf004) AM_READ_PORT("DSW2")
247   AM_RANGE(0xf005, 0xf005) AM_READ_PORT("DSW1")
248248ADDRESS_MAP_END
249249
250250static ADDRESS_MAP_START( nekkyoku_writemem_main, ADDRESS_SPACE_PROGRAM, 8 )
r2864r2865
261261   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
262262   AM_RANGE(0xc000, 0xdfff) AM_READ(SMH_RAM)
263263   AM_RANGE(0x9e89, 0x9e89) AM_READ(SMH_NOP)         // unknown (idolmj)
264   AM_RANGE(0xe000, 0xe000) AM_READ(input_port_0_r)
264   AM_RANGE(0xe000, 0xe000) AM_READ_PORT("IN0")
265265   AM_RANGE(0xe001, 0xe001) AM_READ(fromance_keymatrix_r)
266   AM_RANGE(0xe002, 0xe002) AM_READ(input_port_1_r)
266   AM_RANGE(0xe002, 0xe002) AM_READ_PORT("IN1")
267267   AM_RANGE(0xe003, 0xe003) AM_READ(fromance_busycheck_main_r)
268   AM_RANGE(0xe004, 0xe004) AM_READ(input_port_3_r)
269   AM_RANGE(0xe005, 0xe005) AM_READ(input_port_2_r)
268   AM_RANGE(0xe004, 0xe004) AM_READ_PORT("DSW2")
269   AM_RANGE(0xe005, 0xe005) AM_READ_PORT("DSW1")
270270ADDRESS_MAP_END
271271
272272static ADDRESS_MAP_START( fromance_writemem_main, ADDRESS_SPACE_PROGRAM, 8 )
r2864r2865
391391 *************************************/
392392
393393#define FROMANCE_KEYMATRIX1 \
394   PORT_START_TAG("IN4") \
394   PORT_START_TAG("KEY1") \
395395   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) \
396396   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) \
397397   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) \
r2864r2865
402402   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
403403
404404#define FROMANCE_KEYMATRIX2 \
405   PORT_START_TAG("IN5") \
405   PORT_START_TAG("KEY2") \
406406   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) \
407407   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) \
408408   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J ) \
r2864r2865
413413   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
414414
415415#define FROMANCE_KEYMATRIX3 \
416   PORT_START_TAG("IN6") \
416   PORT_START_TAG("KEY3") \
417417   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) \
418418   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) \
419419   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) \
r2864r2865
424424   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
425425
426426#define FROMANCE_KEYMATRIX4 \
427   PORT_START_TAG("IN7") \
427   PORT_START_TAG("KEY4") \
428428   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) \
429429   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) \
430430   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L ) \
r2864r2865
435435   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
436436
437437#define FROMANCE_KEYMATRIX5 \
438   PORT_START_TAG("IN8") \
438   PORT_START_TAG("KEY5") \
439439   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) \
440440   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) \
441441   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) \
r2864r2865
975975   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
976976   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
977977
978   PORT_START   /* (3) DIPSW-2 */
978   PORT_START_TAG("DSW2")   /* (3) DIPSW-2 */
979979   PORT_DIPNAME( 0x01, 0x00, "DIPSW 2-1" )
980980   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
981981   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
src/mame/drivers/irobot.c
r2864r2865
122122static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
123123    AM_RANGE(0x0000, 0x07ff) AM_READ(SMH_RAM)
124124    AM_RANGE(0x0800, 0x0fff) AM_READ(SMH_BANK2)
125    AM_RANGE(0x1000, 0x103f) AM_READ(input_port_0_r)
126    AM_RANGE(0x1040, 0x1040) AM_READ(input_port_1_r)
125    AM_RANGE(0x1000, 0x103f) AM_READ_PORT("IN0")
126    AM_RANGE(0x1040, 0x1040) AM_READ_PORT("IN1")
127127    AM_RANGE(0x1080, 0x1080) AM_READ(irobot_status_r)
128    AM_RANGE(0x10c0, 0x10c0) AM_READ(input_port_3_r)
128    AM_RANGE(0x10c0, 0x10c0) AM_READ_PORT("DSW1")
129129    AM_RANGE(0x1200, 0x12ff) AM_READ(SMH_RAM)
130130    AM_RANGE(0x1300, 0x13ff) AM_READ(irobot_control_r)
131131    AM_RANGE(0x1400, 0x143f) AM_READ(quad_pokey_r)
r2864r2865
163163 *************************************/
164164
165165static INPUT_PORTS_START( irobot )
166   PORT_START   /* IN0 */
166   PORT_START_TAG("IN0")   /* IN0 */
167167    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
168168    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
169169    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
173173    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
174174    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
175175
176   PORT_START   /* IN1 */
176   PORT_START_TAG("IN1")   /* IN1 */
177177    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
178178    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
179179    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
183183    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
184184    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
185185
186   PORT_START   /* IN2 */
186   PORT_START_TAG("IN2")   /* IN2 */
187187    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
188188    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
189189    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
193193    PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* EXT DONE */
194194    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
195195
196   PORT_START /* DSW1 */
196   PORT_START_TAG("DSW1") /* DSW1 */
197197   PORT_DIPNAME(    0x03, 0x00, "Coins Per Credit" )
198198   PORT_DIPSETTING( 0x00, "1 Coin 1 Credit" )
199199   PORT_DIPSETTING( 0x01, "2 Coins 1 Credit" )
r2864r2865
216216   PORT_DIPSETTING( 0x60, "2 Credits for 4 Coin Units" )
217217   PORT_DIPSETTING( 0xe0, DEF_STR( Free_Play ) )
218218
219   PORT_START /* DSW2 */
220   PORT_DIPNAME(    0x01, 0x01, DEF_STR( Language ) )
221   PORT_DIPSETTING( 0x01, DEF_STR( English ) )
222   PORT_DIPSETTING( 0x00, DEF_STR( German ) )
223   PORT_DIPNAME(    0x02, 0x02, "Min Game Time" )
224   PORT_DIPSETTING( 0x00, "90 Sec" )
225   PORT_DIPSETTING( 0x02, "3 Lives" )
226   PORT_DIPNAME(    0x0c, 0x0c, DEF_STR( Bonus_Life ) )
227   PORT_DIPSETTING( 0x08, DEF_STR( None ) )
228   PORT_DIPSETTING( 0x0c, "20000" )
229   PORT_DIPSETTING( 0x00, "30000" )
230   PORT_DIPSETTING( 0x04, "50000" )
231   PORT_DIPNAME(    0x30, 0x30, DEF_STR( Lives ) )
232   PORT_DIPSETTING( 0x20, "2" )
233   PORT_DIPSETTING( 0x30, "3" )
234   PORT_DIPSETTING( 0x00, "4" )
235   PORT_DIPSETTING( 0x10, "5" )
236   PORT_DIPNAME(    0x40, 0x40, DEF_STR( Difficulty ) )
237   PORT_DIPSETTING( 0x00, DEF_STR( Easy ) )
238   PORT_DIPSETTING( 0x40, DEF_STR( Medium ) )
239   PORT_DIPNAME(    0x80, 0x80, "Demo Mode" )
240   PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
241   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
219   PORT_START_TAG("DSW2") /* DSW2 */
220   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Language ) )
221   PORT_DIPSETTING(   0x01, DEF_STR( English ) )
222   PORT_DIPSETTING(   0x00, DEF_STR( German ) )
223   PORT_DIPNAME( 0x02, 0x02, "Min Game Time" )
224   PORT_DIPSETTING(   0x00, "90 Sec" )
225   PORT_DIPSETTING(   0x02, "3 Lives" )
226   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
227   PORT_DIPSETTING(   0x08, DEF_STR( None ) )
228   PORT_DIPSETTING(   0x0c, "20000" )
229   PORT_DIPSETTING(   0x00, "30000" )
230   PORT_DIPSETTING(   0x04, "50000" )
231   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
232   PORT_DIPSETTING(   0x20, "2" )
233   PORT_DIPSETTING(   0x30, "3" )
234   PORT_DIPSETTING(   0x00, "4" )
235   PORT_DIPSETTING(   0x10, "5" )
236   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) )
237   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
238   PORT_DIPSETTING(   0x40, DEF_STR( Medium ) )
239   PORT_DIPNAME( 0x80, 0x80, "Demo Mode" )
240   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
241   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
242242
243   PORT_START   /* IN4 */
243   PORT_START_TAG("AN0")   /* IN4 */
244244   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(96,163) PORT_SENSITIVITY(70) PORT_KEYDELTA(50)
245245
246   PORT_START   /* IN5 */
246   PORT_START_TAG("AN1")   /* IN5 */
247247   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(96,159) PORT_SENSITIVITY(50) PORT_KEYDELTA(50) PORT_REVERSE
248
249248INPUT_PORTS_END
250249
251250
src/mame/drivers/klax.c
r2864r2865
4747static void scanline_update(const device_config *screen, int scanline)
4848{
4949   /* generate 32V signals */
50   if ((scanline & 32) == 0 && !(input_port_read_indexed(screen->machine, 0) & 0x800))
50   if ((scanline & 32) == 0 && !(input_port_read(screen->machine, "IN0") & 0x800))
5151      atarigen_scanline_int_gen(screen->machine, 0);
5252}
5353
r2864r2865
137137 *************************************/
138138
139139static INPUT_PORTS_START( klax )
140   PORT_START
140   PORT_START_TAG("IN0")
141141   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
142142   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
143143   PORT_BIT( 0x00fc, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
149149   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
150150   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
151151
152   PORT_START
152   PORT_START_TAG("IN1")
153153   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
154154   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
155155   PORT_BIT( 0x0600, IP_ACTIVE_LOW, IPT_UNUSED )
src/mame/drivers/halleys.c
r2864r2865
16051605
16061606static READ8_HANDLER( io_mirror_r )
16071607{
1608   return(input_port_read_indexed(machine, offset + 3));
1608   static const char *portnames[] = { "IN0", "IN1", "IN2", "IN3" };
1609
1610   return input_port_read(machine, portnames[offset]);
16091611}
16101612
16111613
r2864r2865
16201622   AM_RANGE(0xff66, 0xff66) AM_READ(collision_id_r) // HACK: collision detection bypass(Halley's Comet only)
16211623   AM_RANGE(0xff71, 0xff71) AM_READ(blitter_status_r)
16221624   AM_RANGE(0xff80, 0xff83) AM_READ(io_mirror_r)
1623   AM_RANGE(0xff90, 0xff90) AM_READ(input_port_3_r) // coin/start
1624   AM_RANGE(0xff91, 0xff91) AM_READ(input_port_4_r) // player 1
1625   AM_RANGE(0xff92, 0xff92) AM_READ(input_port_5_r) // player 2
1626   AM_RANGE(0xff93, 0xff93) AM_READ(input_port_6_r) // unused?
1625   AM_RANGE(0xff90, 0xff90) AM_READ_PORT("IN0")   // coin/start
1626   AM_RANGE(0xff91, 0xff91) AM_READ_PORT("IN1")   // player 1
1627   AM_RANGE(0xff92, 0xff92) AM_READ_PORT("IN2")   // player 2
1628   AM_RANGE(0xff93, 0xff93) AM_READ_PORT("IN3")   // unused?
16271629   AM_RANGE(0xff94, 0xff94) AM_READ(coin_lockout_r)
1628   AM_RANGE(0xff95, 0xff95) AM_READ(input_port_0_r) // dipswitch 4
1629   AM_RANGE(0xff96, 0xff96) AM_READ(input_port_1_r) // dipswitch 3
1630   AM_RANGE(0xff97, 0xff97) AM_READ(input_port_2_r) // dipswitch 2
1631   AM_RANGE(0xff00, 0xffbf) AM_READ(SMH_RAM)        // I/O read fall-through
1630   AM_RANGE(0xff95, 0xff95) AM_READ_PORT("DSW1")      // dipswitch 4
1631   AM_RANGE(0xff96, 0xff96) AM_READ_PORT("DSW2")      // dipswitch 3
1632   AM_RANGE(0xff97, 0xff97) AM_READ_PORT("DSW3")      // dipswitch 2
1633   AM_RANGE(0xff00, 0xffbf) AM_READ(SMH_RAM)         // I/O read fall-through
16321634
16331635   AM_RANGE(0xffc0, 0xffdf) AM_READ(SMH_RAM)        // palette read
16341636   AM_RANGE(0xffe0, 0xffff) AM_READ(vector_r)
r2864r2865
16871689*/
16881690
16891691static INPUT_PORTS_START( halleys )
1690   PORT_START_TAG("DSW1") // 0xff95
1692   PORT_START_TAG("DSW1")   /* 0xff95 */
16911693   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
16921694   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
16931695   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
r2864r2865
17111713   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
17121714   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
17131715
1714   PORT_START_TAG("DSW2") // 0xff96
1716   PORT_START_TAG("DSW2")   /* 0xff96 */
17151717   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Difficulty ) )
17161718   PORT_DIPSETTING(    0x02, DEF_STR( Easiest ) )
17171719   PORT_DIPSETTING(    0x03, DEF_STR( Easy ) )
r2864r2865
17341736   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
17351737   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
17361738
1737   PORT_START_TAG("DSW3") // 0xff97
1739   PORT_START_TAG("DSW3")   /* 0xff97 */
17381740   PORT_DIPNAME( 0x01, 0x01, "Unknown(3-1)" )
17391741   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
17401742   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
17601762   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
17611763   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
17621764
1763   PORT_START_TAG("IN0") // 0xff90
1765   PORT_START_TAG("IN0")   /* 0xff90 */
17641766   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
17651767   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
17661768   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_START1 )
r2864r2865
17701772   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
17711773   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
17721774
1773   PORT_START_TAG("IN1") // 0xff91
1775   PORT_START_TAG("IN1")   /* 0xff91 */
17741776   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
17751777   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
17761778   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
r2864r2865
17801782   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Hyperspace")
17811783   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Fire")
17821784
1783   PORT_START_TAG("IN2") // 0xff92
1785   PORT_START_TAG("IN2")   /* 0xff92 */
17841786   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
17851787   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
17861788   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
17901792   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Hyperspace")
17911793   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Fire")
17921794
1793   PORT_START_TAG("IN3") // 0xff93
1795   PORT_START_TAG("IN3")   /* 0xff93 */
17941796
1795   PORT_START_TAG("FAKE") // just to be safe
1797   PORT_START_TAG("FAKE")   /* just to be safe */
17961798   PORT_DIPNAME( 0x01, 0x00, "Show Unused Layer" )
17971799   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
17981800   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
r2864r2865
18001802
18011803
18021804static INPUT_PORTS_START( benberob )
1803   PORT_START_TAG("DSW1") // 0xff95
1805   PORT_START_TAG("DSW1")   /* 0xff95 */
18041806   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Bonus_Life ) )
18051807   PORT_DIPSETTING(    0x02, "Every 100K" )
18061808   PORT_DIPSETTING(    0x00, "100K & Every 200K" )
r2864r2865
18241826   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
18251827   PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
18261828
1827   // 0xff96
1828   PORT_START_TAG("DSW2")
1829   PORT_START_TAG("DSW2")   /* 0xff96 */
18291830   PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) )
18301831   PORT_DIPSETTING(    0x0f, DEF_STR( 9C_1C ) )
18311832   PORT_DIPSETTING(    0x0e, DEF_STR( 8C_1C ) )
r2864r2865
18611862   PORT_DIPSETTING(    0x60, DEF_STR( 1C_7C ) )
18621863   PORT_DIPSETTING(    0x70, DEF_STR( 1C_8C ) )
18631864
1864   PORT_START_TAG("DSW3") // 0xff97
1865   PORT_START_TAG("DSW3")   /* 0xff97 */
18651866   PORT_DIPNAME( 0x01, 0x01, "Starting Round" )
18661867   PORT_DIPSETTING(    0x01, "1st Round" )
18671868   PORT_DIPSETTING(    0x00, "2nd Round" )
r2864r2865
18861887   PORT_DIPSETTING(    0x80, "9" )
18871888   PORT_DIPSETTING(    0x00, "16" )
18881889
1889   PORT_START_TAG("IN0") // 0xff90
1890   PORT_START_TAG("IN0")   /* 0xff90 */
18901891   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
18911892   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
18921893   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_START1 )
r2864r2865
18961897   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
18971898   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
18981899
1899   PORT_START_TAG("IN1") // 0xff91
1900   PORT_START_TAG("IN1")   /* 0xff91 */
19001901   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
19011902   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
19021903   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
r2864r2865
19061907   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Jump")
19071908   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Extinguisher")
19081909
1909   PORT_START_TAG("IN2") // 0xff92
1910   PORT_START_TAG("IN2")   /* 0xff92 */
19101911   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
19111912   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
19121913   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
19161917   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Jump")
19171918   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Extinguisher")
19181919
1919   PORT_START_TAG("IN3") // 0xff93
1920   PORT_START_TAG("IN3")   /* 0xff93 */
19201921INPUT_PORTS_END
19211922
19221923
src/mame/drivers/gomoku.c
r2864r2865
4949static READ8_HANDLER( input_port_r )
5050{
5151   int i, res;
52   static const char *portnames[] = { "IN0", "IN1", "DSW", "UNUSED0", "UNUSED1", "UNUSED2", "UNUSED3", "UNUSED4" };
5253
5354   res = 0;
5455   for (i = 0; i < 8; i++)
55      res |= ((input_port_read_indexed(machine, i) >> offset) & 1) << i;
56      res |= ((input_port_read(machine, portnames[i]) >> offset) & 1) << i;
5657
5758   return res;
5859}
r2864r2865
8485
8586
8687static INPUT_PORTS_START( gomoku )
87   PORT_START   /* 0 */
88   PORT_START_TAG("IN0")
8889   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
8990   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
9091   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
r2864r2865
9495   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
9596   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
9697
97   PORT_START   /* 1 */
98   PORT_START_TAG("IN1")
9899   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
99100   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
100101   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
r2864r2865
106107   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
107108   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN2 )
108109
109   PORT_START   /* 2 */
110   PORT_START_TAG("DSW")
110111   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )
111112   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Lives ))
112113   PORT_DIPSETTING(    0x00, "2" )
r2864r2865
127128   PORT_DIPSETTING(    0x40, DEF_STR( 1C_3C ) )
128129   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
129130
130   PORT_START   /* 3 */
131   PORT_START_TAG("UNUSED0")
131132   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
132133
133   PORT_START   /* 4 */
134   PORT_START_TAG("UNUSED1")
134135   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
135136
136   PORT_START   /* 5 */
137   PORT_START_TAG("UNUSED2")
137138   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
138139
139   PORT_START   /* 6 */
140   PORT_START_TAG("UNUSED3")
140141   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
141142
142   PORT_START   /* 7 */
143   PORT_START_TAG("UNUSED4")
143144   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
144145INPUT_PORTS_END
145146
src/mame/drivers/segas24.c
r2864r2865
344344UINT16* s24_mainram1;
345345
346346extern void s24_fd1094_machine_init(void);
347extern void s24_fd1094_driver_init(void);
347extern void s24_fd1094_driver_init(running_machine *machine);
348348
349349VIDEO_START(system24);
350350VIDEO_UPDATE(system24);
r2864r2865
688688
689689static UINT8 resetcontrol, prev_resetcontrol;
690690
691static void reset_reset(void)
691static void reset_reset(running_machine *machine)
692692{
693693   int changed = resetcontrol ^ prev_resetcontrol;
694694   if(changed & 2) {
695695      if(resetcontrol & 2) {
696         cpunum_set_input_line(Machine, 1, INPUT_LINE_HALT, CLEAR_LINE);
697         cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, PULSE_LINE);
696         cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, CLEAR_LINE);
697         cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, PULSE_LINE);
698698//          mame_printf_debug("enable 2nd cpu!\n");
699699//          DEBUGGER_BREAK;
700700         s24_fd1094_machine_init();
701701
702702      } else
703         cpunum_set_input_line(Machine, 1, INPUT_LINE_HALT, ASSERT_LINE);
703         cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, ASSERT_LINE);
704704   }
705705   if(changed & 4)
706706      sndti_reset(SOUND_YM2151, 0);
r2864r2865
711711{
712712   resetcontrol = data;
713713   logerror("Reset control %02x (%x:%x)\n", resetcontrol, cpu_getactivecpu(), activecpu_get_pc());
714   reset_reset();
714   reset_reset(Machine);
715715}
716716
717717
r2864r2865
11731173   system24temp_sys16_io_set_callbacks(hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
11741174   mlatch_table = 0;
11751175   track_size = 0x2d00;
1176   s24_fd1094_driver_init();
1176   s24_fd1094_driver_init(machine);
11771177
11781178}
11791179
r2864r2865
11821182   system24temp_sys16_io_set_callbacks(hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
11831183   mlatch_table = 0;
11841184   track_size = 0x2f00;
1185   s24_fd1094_driver_init();
1185   s24_fd1094_driver_init(machine);
11861186
11871187}
11881188
r2864r2865
11911191   system24temp_sys16_io_set_callbacks(dcclub_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
11921192   mlatch_table = dcclub_mlt;
11931193   track_size = 0x2d00;
1194   s24_fd1094_driver_init();
1194   s24_fd1094_driver_init(machine);
11951195
11961196}
11971197
r2864r2865
12031203   system24temp_sys16_io_set_callbacks(hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
12041204   mlatch_table = 0;
12051205   track_size = 0x2d00;
1206   s24_fd1094_driver_init();
1206   s24_fd1094_driver_init(machine);
12071207
12081208}
12091209
r2864r2865
12121212   system24temp_sys16_io_set_callbacks(hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
12131213   mlatch_table = 0;
12141214   track_size = 0x2d00;
1215   s24_fd1094_driver_init();
1215   s24_fd1094_driver_init(machine);
12161216}
12171217
12181218static DRIVER_INIT(gground)
r2864r2865
12201220   system24temp_sys16_io_set_callbacks(gground_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
12211221   mlatch_table = 0;
12221222   track_size = 0x2d00;
1223   s24_fd1094_driver_init();
1223   s24_fd1094_driver_init(machine);
12241224}
12251225
12261226static DRIVER_INIT(crkdown)
r2864r2865
12281228   system24temp_sys16_io_set_callbacks(hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
12291229   mlatch_table = 0;
12301230   track_size = 0x2d00;
1231   s24_fd1094_driver_init();
1231   s24_fd1094_driver_init(machine);
12321232}
12331233
12341234static DRIVER_INIT(roughrac)
r2864r2865
12361236   system24temp_sys16_io_set_callbacks(hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
12371237   mlatch_table = 0;
12381238   track_size = 0x2d00;
1239   s24_fd1094_driver_init();
1239   s24_fd1094_driver_init(machine);
12401240}
12411241
12421242/*************************************
src/mame/drivers/segas16a.c
r2864r2865
180180 *************************************/
181181
182182extern void fd1094_machine_init(void);
183extern void fd1094_driver_init(void (*set_decrypted)(UINT8 *));
183extern void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(UINT8 *));
184184
185185static READ16_HANDLER( misc_io_r );
186186static WRITE16_HANDLER( misc_io_w );
r2864r2865
220220   MACHINE_RESET_CALL(sys16_onetime);
221221
222222   /* init the FD1094 */
223   fd1094_driver_init(NULL);
223   fd1094_driver_init(machine, NULL);
224224
225225   /* reset the custom handlers and other pointers */
226226   custom_io_r = NULL;
r2864r2865
19731973
19741974/**************************************************************************************************************************
19751975    Alex Kidd, Sega System 16A
1976    CPU: FD1094? 317-????
1976    CPU: FD1089A 317-0021
19771977 */
19781978ROM_START( alexkid1 )
19791979   ROM_REGION( 0x40000, REGION_CPU1, 0 ) /* 68000 code */
r2864r2865
30113011 */
30123012ROM_START( wb31 )
30133013   ROM_REGION( 0x40000, REGION_CPU1, 0 ) /* 68000 code */
3014   ROM_LOAD16_BYTE( "epr12084.bin", 0x000000, 0x10000, CRC(b6deb654) SHA1(37066cc63902233bb8b56d3171c42bf8a8f82e58) )
30143015   ROM_LOAD16_BYTE( "epr12082.bin", 0x000001, 0x10000, CRC(38dc5b15) SHA1(b25bf60d269a87f9d8dbc1a3787c8ff9a6e7482c) )
3015   ROM_LOAD16_BYTE( "epr12084.bin", 0x000000, 0x10000, CRC(b6deb654) SHA1(37066cc63902233bb8b56d3171c42bf8a8f82e58) )
3016   ROM_LOAD16_BYTE( "epr12085.bin", 0x020000, 0x10000, CRC(0962098b) SHA1(150fc439dd5e773bef706f058abdb4d2ec44e355) )
30163017   ROM_LOAD16_BYTE( "epr12083.bin", 0x020001, 0x10000, CRC(3d631a8e) SHA1(4940ff6cf380fb914876ade39ea37f42b79bf11d) )
3017   ROM_LOAD16_BYTE( "epr12085.bin", 0x020000, 0x10000, CRC(0962098b) SHA1(150fc439dd5e773bef706f058abdb4d2ec44e355) )
30183018
30193019   ROM_REGION( 0x2000, REGION_USER1, 0 )   /* decryption key */
30203020   ROM_LOAD( "317-0084.key", 0x0000, 0x2000, CRC(2c58dafa) SHA1(24d06970eda896fdd5e3486132bd19834f7d3659) )
r2864r2865
30463046   ROM_LOAD( "epr12089.bin", 0x0000, 0x8000, CRC(8321eb0b) SHA1(61cf95833c0aa38e35fc18db39d4ec74e4aaf01e) )
30473047ROM_END
30483048
3049/**************************************************************************************************************************
3050 **************************************************************************************************************************
3051 **************************************************************************************************************************
3052    Wonder Boy III, Sega System 16A
3053    CPU: FD1089A (317-unknown)
3054 */
3055ROM_START( wb35 )
3056   ROM_REGION( 0x40000, REGION_CPU1, 0 ) /* 68000 code */
3057   ROM_LOAD16_BYTE( "epr12120.43", 0x000000, 0x10000, CRC(cf41adf1) SHA1(aab2146d990d6698d73edf8d8699e98a1f01d534) )
3058   ROM_LOAD16_BYTE( "epr12118.26", 0x000001, 0x10000, CRC(050ad6d0) SHA1(4d5e5b9a6b9b33ec767a18c30a8252063341eefb) )
3059   ROM_LOAD16_BYTE( "epr12121.42", 0x020000, 0x10000, CRC(5e44c0a9) SHA1(4d4c9575a6cd571a7cf635164e92afd92d4b63fe) )
3060   ROM_LOAD16_BYTE( "epr12119.25", 0x020001, 0x10000, CRC(b67b97a3) SHA1(0a5ab21c7b4ca6d6a31852dd8dfb94bb55c0f15d) )
30493061
3062   ROM_REGION( 0x30000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */
3063   ROM_LOAD( "epr12086.95", 0x00000, 0x10000, CRC(45b949df) SHA1(84390d16da00b775988e5f6c20950cb2304b1a74) )
3064   ROM_LOAD( "epr12087.94", 0x10000, 0x10000, CRC(5fb761aa) SHA1(dcf88e68732a8ec122d0603d87f6ea1f1614adef) )
3065   ROM_LOAD( "epr12088.83", 0x20000, 0x10000, CRC(00579c39) SHA1(12acdea75e3d040d60a9f32d05fd9e0191d38f21) )
30503066
3067   ROM_REGION16_BE( 0x80000, REGION_GFX2, 0 ) /* sprites */
3068   ROM_LOAD16_BYTE( "epr12090.10", 0x00001, 0x008000, CRC(c85904c1) SHA1(e5af26ce870813bd5a88b430fc3881c7fcb63aef) )
3069   ROM_CONTINUE(                   0x40001, 0x008000 )
3070   ROM_LOAD16_BYTE( "epr12094.11", 0x00000, 0x008000, CRC(615e4927) SHA1(d23f164973afa770714e284a77ddf10f18cc596b) )
3071   ROM_CONTINUE(                   0x40000, 0x008000 )
3072   ROM_LOAD16_BYTE( "epr12091.17", 0x10001, 0x008000, CRC(8409a243) SHA1(bcbb9510a6499d8147543d6befa5a49f4ac055d9) )
3073   ROM_CONTINUE(                   0x50001, 0x008000 )
3074   ROM_LOAD16_BYTE( "epr12095.18", 0x10000, 0x008000, CRC(e774ec2c) SHA1(a4aa15ec7be5539a740ad02ff720458018dbc536) )
3075   ROM_CONTINUE(                   0x50000, 0x008000 )
3076   ROM_LOAD16_BYTE( "epr12092.23", 0x20001, 0x008000, CRC(5c2f0d90) SHA1(e0fbc0f841e4607ad232931368b16e81440a75c4) )
3077   ROM_CONTINUE(                   0x60001, 0x008000 )
3078   ROM_LOAD16_BYTE( "epr12096.24", 0x20000, 0x008000, CRC(d55ca9c9) SHA1(cff95bd799cf9625f95261620d2df7f0891e34da) )
3079   ROM_CONTINUE(                   0x60000, 0x008000 )
3080   ROM_LOAD16_BYTE( "epr12093.29", 0x30001, 0x008000, CRC(9e6d9086) SHA1(1cfe7175f538db9a47ef576b33be49057db0927d) )
3081   ROM_CONTINUE(                   0x70001, 0x008000 )
3082   ROM_LOAD16_BYTE( "epr12097.30", 0x30000, 0x008000, CRC(e645902c) SHA1(497cfcf6c25cc2e042e16dbcb1963d2223def15a) )
3083   ROM_CONTINUE(                   0x70000, 0x008000 )
3084
3085   ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* sound CPU */
3086   ROM_LOAD( "epr12089.12", 0x0000, 0x8000, CRC(8321eb0b) SHA1(61cf95833c0aa38e35fc18db39d4ec74e4aaf01e) )
3087ROM_END
3088
30513089/*************************************
30523090 *
30533091 *  Generic driver initialization
r2864r2865
30773115static DRIVER_INIT( alexkid1 )
30783116{
30793117   system16a_generic_init(machine);
3080   fd1089_decrypt_alexkidd();
3118   fd1089_decrypt_0021();
30813119}
30823120
30833121
r2864r2865
31423180   fd1089_decrypt_0024();
31433181}
31443182
3183static DRIVER_INIT( wb35 )
3184{
3185   system16a_generic_init(machine);
3186   fd1089_decrypt_wb35();
3187}
31453188
3146
31473189/*************************************
31483190 *
31493191 *  Game driver(s)
r2864r2865
31663208GAME( 1988, aceattaa, aceattac, system16a       , aceattaa, aceattaa,    ROT270, "Sega",           "Ace Attacker (Japan, System 16A, FD1094 317-0060)", 0 )
31673209GAME( 1986, afighter, 0,        system16a_no7751, afighter, afighter,    ROT270, "Sega",           "Action Fighter, FD1089A 317-0018", 0 )
31683210GAME( 1986, alexkidd, 0,        system16a,        alexkidd, generic_16a, ROT0,   "Sega",           "Alex Kidd: The Lost Stars (set 2, unprotected)", 0 )
3169GAME( 1986, alexkid1, alexkidd, system16a,        alexkidd, alexkid1,    ROT0,   "Sega",           "Alex Kidd: The Lost Stars (set 1, FD1089A 317-unknown)", 0 )
3211GAME( 1986, alexkid1, alexkidd, system16a,        alexkidd, alexkid1,    ROT0,   "Sega",           "Alex Kidd: The Lost Stars (set 1, FD1089A 317-0021)", 0 )
31703212GAME( 1986, fantzone, 0,        system16a_no7751, fantzone, generic_16a, ROT0,   "Sega",           "Fantasy Zone (set 2, unprotected)", 0 )
31713213GAME( 1986, fantzon1, fantzone, system16a_no7751, fantzone, generic_16a, ROT0,   "Sega",           "Fantasy Zone (set 1, unprotected)", 0 )
31723214GAME( 1988, pshot16a, passsht,  system16a,        pshot16a, pshot16a,    ROT270, "Sega",           "Passing Shot (Japan, 4 Players, System 16A, FD1094 317-0071)", 0 )
r2864r2865
31793221GAME( 1988, tetris3,  tetris,   system16a_no7751, tetris,   generic_16a, ROT0,   "Sega",           "Tetris (set 3, Japan, System 16A, FD1094 317-0093a)", 0 )
31803222GAME( 1987, timesca1, timescan, system16a,        timescan, timesca1,    ROT270, "Sega",           "Time Scanner (set 1, System 16A, FD1089B 317-0024)", 0 )
31813223GAME( 1988, wb31,     wb3,      system16a_no7751, wb3,      generic_16a, ROT0,   "Sega / Westone", "Wonder Boy III - Monster Lair (set 1, System 16A, FD1094 317-0084)", 0 )
3224GAME( 1988, wb35,     wb3,      system16a_no7751, wb3,      wb35,        ROT0,   "Sega / Westone", "Wonder Boy III - Monster Lair (set 5, System 16A, FD1089A 317-xxxx)", GAME_NOT_WORKING )
src/mame/drivers/neogeo.c
r2864r2865
8080****************************************************************************/
8181
8282#include "driver.h"
83#include "deprecat.h"
8483#include "neogeo.h"
8584#include "machine/pd4990a.h"
8685#include "cpu/z80/z80.h"
r2864r2865
158157#define IRQ2CTRL_AUTOLOAD_REPEAT   (0x80)
159158
160159
161static void adjust_display_position_interrupt_timer(void)
160static void adjust_display_position_interrupt_timer(running_machine *machine)
162161{
163162   if ((display_counter + 1) != 0)
164163   {
165164      attotime period = attotime_mul(ATTOTIME_IN_HZ(NEOGEO_PIXEL_CLOCK), display_counter + 1);
166      if (LOG_VIDEO_SYSTEM) logerror("adjust_display_position_interrupt_timer  current y: %02x  current x: %02x   target y: %x  target x: %x\n", video_screen_get_vpos(Machine->primary_screen), video_screen_get_hpos(Machine->primary_screen), (display_counter + 1) / NEOGEO_HTOTAL, (display_counter + 1) % NEOGEO_HTOTAL);
165      if (LOG_VIDEO_SYSTEM) logerror("adjust_display_position_interrupt_timer  current y: %02x  current x: %02x   target y: %x  target x: %x\n", video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen), (display_counter + 1) / NEOGEO_HTOTAL, (display_counter + 1) % NEOGEO_HTOTAL);
167166
168167      timer_adjust_oneshot(display_position_interrupt_timer, period, 0);
169168   }
r2864r2865
184183}
185184
186185
187void neogeo_set_display_counter_lsb(UINT16 data)
186void neogeo_set_display_counter_lsb(running_machine *machine, UINT16 data)
188187{
189188   display_counter = (display_counter & 0xffff0000) | data;
190189
r2864r2865
193192   if (display_position_interrupt_control & IRQ2CTRL_LOAD_RELATIVE)
194193   {
195194      if (LOG_VIDEO_SYSTEM) logerror("AUTOLOAD_RELATIVE ");
196       adjust_display_position_interrupt_timer();
195       adjust_display_position_interrupt_timer(machine);
197196   }
198197}
199198
r2864r2865
215214}
216215
217216
218void neogeo_acknowledge_interrupt(UINT16 data)
217void neogeo_acknowledge_interrupt(running_machine *machine, UINT16 data)
219218{
220219   if (data & 0x01) irq3_pending = 0;
221220   if (data & 0x02) display_position_interrupt_pending = 0;
222221   if (data & 0x04) vblank_interrupt_pending = 0;
223222
224   update_interrupts(Machine);
223   update_interrupts(machine);
225224}
226225
227226
r2864r2865
239238   if (display_position_interrupt_control & IRQ2CTRL_AUTOLOAD_REPEAT)
240239   {
241240      if (LOG_VIDEO_SYSTEM) logerror("AUTOLOAD_REPEAT ");
242      adjust_display_position_interrupt_timer();
241      adjust_display_position_interrupt_timer(machine);
243242   }
244243}
245244
r2864r2865
249248   if (display_position_interrupt_control & IRQ2CTRL_AUTOLOAD_VBLANK)
250249   {
251250      if (LOG_VIDEO_SYSTEM) logerror("AUTOLOAD_VBLANK ");
252      adjust_display_position_interrupt_timer();
251      adjust_display_position_interrupt_timer(machine);
253252   }
254253
255254   /* set timer for next screen */
r2864r2865
737736}
738737
739738
740static void _set_audio_cpu_rom_source(void)
739static void _set_audio_cpu_rom_source(running_machine *machine)
741740{
742741/*  if (!memory_region(NEOGEO_REGION_AUDIO_CPU_BIOS))   */
743742      audio_cpu_rom_source = 1;
r2864r2865
749748   {
750749      audio_cpu_rom_source_last = audio_cpu_rom_source;
751750
752      cpunum_set_input_line(Machine, 1, INPUT_LINE_RESET, PULSE_LINE);
751      cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, PULSE_LINE);
753752
754753      if (LOG_AUDIO_CPU_BANKING) logerror("Audio CPU PC %03x: selectign %s ROM\n", safe_activecpu_get_pc(), audio_cpu_rom_source ? "CARTRIDGE" : "BIOS");
755754   }
756755}
757756
758757
759static void set_audio_cpu_rom_source(UINT8 data)
758static void set_audio_cpu_rom_source(running_machine *machine, UINT8 data)
760759{
761760   audio_cpu_rom_source = data;
762761
763   _set_audio_cpu_rom_source();
762   _set_audio_cpu_rom_source(machine);
764763}
765764
766765
767static void audio_cpu_banking_init(void)
766static void audio_cpu_banking_init(running_machine *machine)
768767{
769768   int region;
770769   int bank;
r2864r2865
797796   set_audio_cpu_banking();
798797
799798   audio_cpu_rom_source_last = 0;
800   set_audio_cpu_rom_source(0);
799   set_audio_cpu_rom_source(machine, 0);
801800}
802801
803802
r2864r2865
819818      default:
820819      case 0x00: neogeo_set_screen_dark(machine, bit); break;
821820      case 0x01: set_main_cpu_vector_table_source(bit);
822               set_audio_cpu_rom_source(bit); /* this is a guess */
821               set_audio_cpu_rom_source(machine, bit); /* this is a guess */
823822               break;
824823      case 0x05: neogeo_set_fixed_layer_source(bit); break;
825824      case 0x06: set_save_ram_unlock(bit); break;
r2864r2865
949948   _set_main_cpu_bank_address();
950949   _set_main_cpu_vector_table_source();
951950   set_audio_cpu_banking();
952   _set_audio_cpu_rom_source();
951   _set_audio_cpu_rom_source(machine);
953952   set_outputs();
954953}
955954
r2864r2865
962961   main_cpu_banking_init();
963962
964963   /* set the initial audio CPU ROM banks */
965   audio_cpu_banking_init();
964   audio_cpu_banking_init(machine);
966965
967966   create_interrupt_timers();
968967
src/mame/drivers/konamigx.c
r2864r2865
489489   //      excpuint stat, objdma stat, eeprom do
490490
491491   // note: racin' force expects bit 1 of the eeprom port to toggle
492   return(input_port_read_indexed(machine, 6)<<24 | input_port_read_indexed(machine, 7)<<16 | input_port_read_indexed(machine, 0)<<8 | eeprom_read_bit() | gx_rdport1_3);
492   return(input_port_read(machine, "DSW0")<<24 | input_port_read_safe(machine, "DSW1", 0)<<16 | input_port_read(machine, "IN0")<<8 | eeprom_read_bit() | gx_rdport1_3);
493493}
494494
495495static WRITE32_HANDLER( eeprom_w )
r2864r2865
817817   return(rv);
818818}
819819
820INLINE void write_snd_020(int reg, int val)
820INLINE void write_snd_020(running_machine *machine, int reg, int val)
821821{
822822   sndto000[reg] = val;
823823
824824   if (reg == 7)
825825   {
826      cpunum_set_input_line(Machine, 1, 1, HOLD_LINE);
826      cpunum_set_input_line(machine, 1, 1, HOLD_LINE);
827827   }
828828}
829829
r2864r2865
835835   {
836836      reg = offset<<1;
837837      val = data>>24;
838      write_snd_020(reg, val);
838      write_snd_020(machine, reg, val);
839839   }
840840
841841   if (ACCESSING_BITS_8_15)
842842   {
843843      reg = (offset<<1)+1;
844844      val = (data>>8)&0xff;
845      write_snd_020(reg, val);
845      write_snd_020(machine, reg, val);
846846   }
847847}
848848
r2864r2865
869869   switch( input )
870870   {
871871   case ADC083X_CH0:
872      return ( (double)5 * input_port_read_indexed(Machine,  9 ) ) / 255; // steer
872      return ( (double)5 * input_port_read(Machine,  "AN0" ) ) / 255; // steer
873873   case ADC083X_CH1:
874      return ( (double)5 * input_port_read_indexed(Machine,  10 ) ) / 255; // gas
874      return ( (double)5 * input_port_read(Machine,  "AN1" ) ) / 255; // gas
875875   case ADC083X_VREF:
876876      return 5;
877877   }
r2864r2865
880880
881881static READ32_HANDLER( le2_gun_H_r )
882882{
883   int p1x = input_port_read_indexed(machine, 9)*287/0xff+22;
884   int p2x = input_port_read_indexed(machine, 11)*287/0xff+22;
883   int p1x = input_port_read(machine, "LIGHT0_X")*287/0xff+22;
884   int p2x = input_port_read(machine, "LIGHT1_X")*287/0xff+22;
885885
886886   return (p1x<<16)|p2x;
887887}
888888
889889static READ32_HANDLER( le2_gun_V_r )
890890{
891   int p1y = input_port_read_indexed(machine, 10)*223/0xff+1;
892   int p2y = input_port_read_indexed(machine, 12)*223/0xff+1;
891   int p1y = input_port_read(machine, "LIGHT0_Y")*223/0xff+1;
892   int p2y = input_port_read(machine, "LIGHT1_Y")*223/0xff+1;
893893
894894   return (p1y<<16)|p2y;
895895}
896896
897897static READ32_HANDLER( service_r )
898898{
899   int res = (input_port_read_indexed(machine, 1)<<24) | (input_port_read_indexed(machine, 8)<<8);
899   int res = (input_port_read(machine, "IN1")<<24) | (input_port_read_safe(machine, "IN6", 0)<<8);
900900
901901   if (init_eeprom_count)
902902   {
r2864r2865
909909
910910static READ32_HANDLER( players_r )
911911{
912   return (input_port_read_indexed(machine, 2)<<24) | (input_port_read_indexed(machine, 3)<<16) | (input_port_read_indexed(machine, 4)<<8) | (input_port_read_indexed(machine, 5));
912   return (input_port_read(machine, "IN2")<<24) | (input_port_read(machine, "IN3")<<16) | (input_port_read(machine, "IN4")<<8) | (input_port_read(machine, "IN5"));
913913}
914914
915915
r2864r2865
13141314   MDRV_CPU_PROGRAM_MAP(gx_base_memmap, gx_type2_map)
13151315   MDRV_CPU_VBLANK_INT("main", konamigx_vbinterrupt)
13161316
1317   /* note: part is a -8, crystals are 18.4 and 32.0 MHz, and
1318       twinbee yahhoo will not pass POST if the 68000 isn't
1319       running at least this fast.  so the higher speed is probably a HACK... */
1320   MDRV_CPU_ADD_TAG("sound", M68000, 9200000)
1317   MDRV_CPU_ADD_TAG("sound", M68000, 8000000)
13211318   /* audio CPU */
13221319   MDRV_CPU_PROGRAM_MAP(gxsndmap, 0)
13231320   MDRV_CPU_PERIODIC_INT(irq2_line_hold, 480)
r2864r2865
13321329   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS | VIDEO_HAS_HIGHLIGHTS | VIDEO_UPDATE_AFTER_VBLANK)
13331330
13341331   MDRV_SCREEN_ADD("main", RASTER)
1335   MDRV_SCREEN_REFRESH_RATE(60)
1336   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(600))
1332//  MDRV_SCREEN_RAW_PARAMS(6000000, 288+17+32+49, 0, 287, 224+17+8+16, 0, 223)
1333   /* These parameters should be correct according to developer manual,
1334    but sound and graphics of tbyahhoo's attract mode doesn't sync correctly.
1335    (better than previous 60Hz, though) Setting refresh rate to 58Hz fixes this.
1336    We have to check actual value written to the CCU. */
1337   MDRV_SCREEN_REFRESH_RATE(58)
1338
1339//  MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(600))
13371340   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
13381341   MDRV_SCREEN_SIZE(64*8, 32*8)
13391342   MDRV_SCREEN_VISIBLE_AREA(24, 24+288-1, 16, 16+224-1)
r2864r2865
14431446/**********************************************************************************/
14441447/* port maps */
14451448
1446static INPUT_PORTS_START( konamigx )
1447   PORT_START
1449/* here we collect players' inputs: they are shared among all the ports */
1450static INPUT_PORTS_START( common )
1451   PORT_START_TAG("IN0")
14481452   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
14491453   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
14501454   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
14541458   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
14551459   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
14561460
1457   PORT_START
1461   PORT_START_TAG("IN1")
14581462   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
14591463   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1460   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)   /* for gun games */
1464   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
14611465   PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )
14621466   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
14631467   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
14641468   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
14651469   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
14661470
1467   PORT_START
1471   PORT_START_TAG("IN2")
14681472   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
14691473   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
14701474   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
14741478   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
14751479   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
14761480
1477   PORT_START
1481   PORT_START_TAG("IN3")
14781482   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
14791483   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
14801484   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
14841488   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
14851489   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
14861490
1487   PORT_START
1491   PORT_START_TAG("IN4")
14881492   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
14891493   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
14901494   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
r2864r2865
14941498   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
14951499   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
14961500
1497   PORT_START
1501   PORT_START_TAG("IN5")
14981502   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
14991503   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
15001504   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
r2864r2865
15031507   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
15041508   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
15051509   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
1510INPUT_PORTS_END
15061511
1507   PORT_START
1512
1513static INPUT_PORTS_START( konamigx )
1514   PORT_INCLUDE( common )
1515
1516   PORT_START_TAG("DSW0")
15081517   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Stereo ))
15091518   PORT_DIPSETTING(    0x00, DEF_STR( Stereo ))
15101519   PORT_DIPSETTING(    0x01, DEF_STR( Mono ))
r2864r2865
15301539   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
15311540   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
15321541
1533   PORT_START
1542   PORT_START_TAG("DSW1")
15341543   PORT_DIPNAME( 0x01, 0x01, "Foo")
15351544   PORT_DIPSETTING(    0x00, "Foo")
15361545   PORT_DIPSETTING(    0x01, "Bar")
r2864r2865
15591568
15601569
15611570static INPUT_PORTS_START( racinfrc )
1562   PORT_START
1563   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1564   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1565   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1566   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1567   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1568   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 )
1569   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1570   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1571   /* racin force needs Player 2 Button 1 ("IN3" & 0x10) set to get past the calibration screen */
1572   PORT_INCLUDE( konamigx )
15711573
1572   PORT_START
1573   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1574   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1575   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)   /* for gun games */
1576   PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )
1577   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1578   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1579   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1580   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1574   PORT_START_TAG("IN6")   /* no gun */
15811575
1582   PORT_START
1583   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1584   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1585   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1586   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1587   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1588   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1589   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
1590   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
1591
1592   PORT_START
1593   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1594   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1595   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1596   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1597   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)      // racin force needs this set to get past the calibration screen
1598   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1599   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1600   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
1601
1602   PORT_START
1603   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
1604   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
1605   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
1606   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
1607   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
1608   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
1609   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
1610   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
1611
1612   PORT_START
1613   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
1614   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
1615   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
1616   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
1617   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
1618   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
1619   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
1620   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
1621
1622   PORT_START
1623   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Stereo ))
1624   PORT_DIPSETTING(    0x00, DEF_STR( Stereo ))
1625   PORT_DIPSETTING(    0x01, DEF_STR( Mono ))
1626   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
1627   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1628   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1629   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1630   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1631   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1632   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1633   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1634   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1635   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1636   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1637   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1638   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1639   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1640   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1641   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1642   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1643   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1644   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1645   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1646   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1647
1648   PORT_START
1649   PORT_DIPNAME( 0x01, 0x01, "Foo")
1650   PORT_DIPSETTING(    0x00, "Foo")
1651   PORT_DIPSETTING(    0x01, "Bar")
1652   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
1653   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1654   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1655   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1656   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1657   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1658   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1659   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1660   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1661   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1662   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1663   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1664   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1665   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1666   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1667   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1668   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1669   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1670   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1671   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1672   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1673
1674   PORT_START   /* no gun */
1675
1676   PORT_START /* mask default type                     sens delta min max */
1576   PORT_START_TAG("AN0")   /* mask default type                     sens delta min max */
16771577   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x38,0xc8) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
16781578
1679   PORT_START
1579   PORT_START_TAG("AN1")
16801580   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0,0x68) PORT_SENSITIVITY(35) PORT_KEYDELTA(5) PORT_CODE_INC(KEYCODE_LCONTROL)
16811581INPUT_PORTS_END
16821582
16831583static INPUT_PORTS_START( le2 )
1684   PORT_START
1685   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1686   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1687   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1688   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1689   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1690   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 )
1691   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1692   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1584   PORT_INCLUDE( common )
16931585
1694   PORT_START
1695   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1696   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1586   PORT_MODIFY("IN1")
16971587   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)   /* for gun games */
1698   PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )
1699   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1700   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1701   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1702   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
17031588
1704   PORT_START
1705   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1706   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1707   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1708   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1709   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1710   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1711   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
1712   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
1713
1714   PORT_START
1715   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1716   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1717   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1718   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1719   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1720   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1721   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1722   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
1723
1724   PORT_START
1725   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
1726   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
1727   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
1728   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
1729   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
1730   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
1731   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
1732   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
1733
1734   PORT_START
1735   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
1736   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
1737   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
1738   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
1739   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
1740   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
1741   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
1742   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
1743
1744   PORT_START
1589   PORT_START_TAG("DSW0")
17451590   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Stereo ))
17461591   PORT_DIPSETTING(    0x01, DEF_STR( Stereo ))
17471592   PORT_DIPSETTING(    0x00, DEF_STR( Mono ))
r2864r2865
17671612   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
17681613   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
17691614
1770   PORT_START
1615   PORT_START_TAG("DSW1")
17711616   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
17721617
1773   PORT_START
1618   PORT_START_TAG("IN6")
17741619   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
17751620   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
17761621   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)   /* for gun games */
r2864r2865
17801625   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
17811626   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
17821627
1783   PORT_START /* mask default type                     sens delta min max */
1628   PORT_START_TAG("LIGHT0_X")   /* mask default type                     sens delta min max */
17841629   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(15) PORT_PLAYER(1)
17851630
1786   PORT_START
1631   PORT_START_TAG("LIGHT0_Y")
17871632   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(15) PORT_PLAYER(1)
17881633
1789   PORT_START
1634   PORT_START_TAG("LIGHT1_X")
17901635   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(15) PORT_PLAYER(2)
17911636
1792   PORT_START
1637   PORT_START_TAG("LIGHT1_Y")
17931638   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(15) PORT_PLAYER(2)
17941639INPUT_PORTS_END
17951640
17961641static INPUT_PORTS_START( gokuparo )
1797   PORT_START
1798   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1799   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1800   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1801   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1802   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1803   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 )
1804   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1642   PORT_INCLUDE( common )
1643
1644   PORT_MODIFY("IN0")
18051645   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
18061646
1807   PORT_START
1808   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1809   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1810   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1811   PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )
1812   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1813   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1814   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1815   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1816
1817   PORT_START
1818   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1819   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1820   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1821   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1822   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1823   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1824   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
1825   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
1826
1827   PORT_START
1828   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1829   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1830   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1831   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1832   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1833   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1834   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1835   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
1836
1837   PORT_START
1838   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
1839   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
1840   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
1841   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
1842   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
1843   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
1844   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
1845   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
1846
1847   PORT_START
1848   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
1849   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
1850   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
1851   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
1852   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
1853   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
1854   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
1855   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
1856
1857   PORT_START
1647   PORT_START_TAG("DSW0")
18581648   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Stereo ))
18591649   PORT_DIPSETTING(    0x00, DEF_STR( Stereo ))
18601650   PORT_DIPSETTING(    0x01, DEF_STR( Mono ))
r2864r2865
18821672INPUT_PORTS_END
18831673
18841674static INPUT_PORTS_START( puzldama )
1885   PORT_START
1886   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1887   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1888   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1889   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1890   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1891   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 )
1892   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1675   PORT_INCLUDE( common )
1676
1677   PORT_MODIFY("IN0")
18931678   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
18941679
1895   PORT_START
1896   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1897   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1898   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1899   PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )
1900   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1901   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1902   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1903   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1904
1905   PORT_START
1906   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1907   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1908   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1909   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1910   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1911   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1912   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
1913   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
1914
1915   PORT_START
1916   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1917   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1918   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1919   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1920   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1921   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1922   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1923   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
1924
1925   PORT_START
1926   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
1927   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
1928   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
1929   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
1930   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
1931   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
1932   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
1933   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
1934
1935   PORT_START
1936   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
1937   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
1938   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
1939   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
1940   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
1941   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
1942   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
1943   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
1944
1945   PORT_START
1680   PORT_START_TAG("DSW0")
19461681   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Stereo ))
19471682   PORT_DIPSETTING(    0x00, DEF_STR( Stereo ))
19481683   PORT_DIPSETTING(    0x01, DEF_STR( Mono ))
r2864r2865
19711706INPUT_PORTS_END
19721707
19731708static INPUT_PORTS_START( dragoonj )
1974   PORT_START
1975   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1976   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1977   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1978   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1979   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
1980   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 )
1981   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1709   PORT_INCLUDE( common )
1710
1711   PORT_MODIFY("IN0")
19821712   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
19831713
1984   PORT_START
1985   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1986   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1987   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1988   PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )
1989   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1990   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1991   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1992   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1993
1994   PORT_START
1995   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1996   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1997   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1998   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1999   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
2000   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
2001   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2002   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2003
2004   PORT_START
2005   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
2006   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
2007   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
2008   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
2009   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2010   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2011   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2012   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2013
2014   PORT_START
1714   PORT_MODIFY("IN4")
20151715   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
20161716   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
20171717   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
r2864r2865
20211721   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
20221722   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
20231723
2024   PORT_START
1724   PORT_MODIFY("IN5")
20251725   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
20261726   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
20271727   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
20311731   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
20321732   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
20331733
2034   PORT_START
1734   PORT_START_TAG("DSW0")
20351735   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Stereo ))
20361736   PORT_DIPSETTING(    0x00, DEF_STR( Stereo ))
20371737   PORT_DIPSETTING(    0x01, DEF_STR( Mono ))
r2864r2865
20601760INPUT_PORTS_END
20611761
20621762static INPUT_PORTS_START( type3 )
2063   PORT_START
2064   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
2065   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
2066   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
2067   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
2068   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
2069   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 )
2070   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1763   PORT_INCLUDE( common )
1764
1765   PORT_MODIFY("IN0")
20711766   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
20721767
2073   PORT_START
2074   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
2075   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
2076   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
2077   PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )
2078   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2079   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2080   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2081   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2082
2083   PORT_START
2084   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
2085   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
2086   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
2087   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
2088   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
2089   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
2090   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2091   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2092
2093   PORT_START
2094   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
2095   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
2096   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
2097   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
2098   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2099   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2100   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2101   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2102
2103   PORT_START
2104   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
2105   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
2106   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
2107   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
2108   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
2109   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
2110   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
2111   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
2112
2113   PORT_START
2114   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
2115   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
2116   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
2117   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
2118   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
2119   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
2120   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
2121   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
2122
2123   PORT_START
1768   PORT_START_TAG("DSW0")
21241769   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Stereo ))
21251770   PORT_DIPSETTING(    0x00, DEF_STR( Stereo ))
21261771   PORT_DIPSETTING(    0x01, DEF_STR( Mono ))
src/mame/drivers/thunderj.c
r2864r2865
7878
7979static READ16_HANDLER( special_port2_r )
8080{
81   int result = input_port_read_indexed(machine, 2);
81   int result = input_port_read(machine, "260012");
8282
8383   if (atarigen_sound_to_cpu_ready) result ^= 0x0004;
8484   if (atarigen_cpu_to_sound_ready) result ^= 0x0008;
r2864r2865
252252 *************************************/
253253
254254static INPUT_PORTS_START( thunderj )
255   PORT_START      /* 260000 */
255   PORT_START_TAG("260000")      /* 260000 */
256256   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
257257
258   PORT_START      /* 260010 */
258   PORT_START_TAG("260010")      /* 260010 */
259259   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
260260   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
261261   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r2864r2865
265265   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
266266   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
267267
268   PORT_START      /* 260012 */
268   PORT_START_TAG("260012")      /* 260012 */
269269   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_VBLANK )
270270   PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
271271   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )   /* Input buffer full (@260030) */
r2864r2865
456456static DRIVER_INIT( thunderj )
457457{
458458   atarigen_eeprom_default = NULL;
459   atarijsa_init(machine, 2, 0x0002);
459   atarijsa_init(machine, "260012", 0x0002);
460460}
461461
462462
src/mame/drivers/segac2.c
r2864r2865
99    Sega's C2 was used between 1989 and 1994, the hardware being very similar to that
1010    used by the Sega MegaDrive/Genesis Home Console Sega produced around the same time.
1111
12    The Columns manual call this system 'System 14' instead of system C/C2.
13
14
1215    todo: fill in protection chip data
1316
14    Year  Game                       Developer         Protection Chip  Board
15    ====  ====================       ================  ===============  =====
17    Year  Game                       Developer         Protection Chip  Board  Number
18    ====  ====================       ================  ===============  =====  ======
1619    1989  Bloxeed                    Sega / Elorg      n/a              C
17    1990  Columns                    Sega              317-0149         C
20    1990  Columns                    Sega              317-0149         C      171-5880B
1821    1990  Columns II                 Sega              317-0160         C
1922    1990  ThunderForce AC            Sega / Technosoft 317-0172         C2
2023    1990  Borench                    Sega              317-0173         C2
r2864r2865
352355
353356static READ16_HANDLER( io_chip_r )
354357{
358   static const char *portnames[] = { "P1", "P2", "PORTC", "PORTD", "SERVICE", "COINAGE", "DSW", "PORTH" };
355359   offset &= 0x1f/2;
356360
357361   switch (offset)
r2864r2865
371375
372376         /* otherwise, return an input port */
373377         if (offset == 0x04/2 && sound_banks)
374            return (input_port_read_indexed(machine, offset) & 0xbf) | (upd7759_0_busy_r(machine,0) << 6);
375         return input_port_read_indexed(machine, offset);
378            return (input_port_read(machine, portnames[offset]) & 0xbf) | (upd7759_0_busy_r(machine,0) << 6);
379         return input_port_read(machine, portnames[offset]);
376380
377381      /* 'SEGA' protection */
378382      case 0x10/2:
src/mame/drivers/gottlieb.c
r2864r2865
197197
198198static READ8_HANDLER( gottlieb_track_0_r )
199199{
200   return input_port_read_indexed(machine, 2) - track[0];
200   return input_port_read(machine, "IN2") - track[0];
201201}
202202
203203static READ8_HANDLER( gottlieb_track_1_r )
204204{
205   return input_port_read_indexed(machine, 3) - track[1];
205   return input_port_read(machine, "IN3") - track[1];
206206}
207207
208208static WRITE8_HANDLER( gottlieb_track_reset_w )
209209{
210210   /* reset the trackball counters */
211   track[0] = input_port_read_indexed(machine, 2);
212   track[1] = input_port_read_indexed(machine, 3);
211   track[0] = input_port_read(machine, "IN2");
212   track[1] = input_port_read(machine, "IN3");
213213}
214214
215215static int joympx;
r2864r2865
601601   PORT_DIPSETTING(    0x80, "Normal Hard" )
602602   PORT_DIPSETTING(    0xc0, DEF_STR( Hard ) )
603603
604   PORT_START_TAG("DSW1")   /* ? */
604   PORT_START_TAG("IN1")   /* ? */
605605   PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
606606   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Select in Service Mode") PORT_CODE(KEYCODE_F1) // cycle through test options, hold to do test
607607   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 )
src/mame/drivers/gpworld.c
r2864r2865
4040
4141
4242#include "driver.h"
43#include "deprecat.h"
4443#include "machine/laserdsc.h"
4544
4645/* Assumed to be the same as segald hardware */
r2864r2865
9392   *BITMAP_ADDR32(bitmap, y, x) = color;
9493}
9594
96static void gpworld_draw_sprites(bitmap_t *bitmap, const rectangle *cliprect)
95static void gpworld_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
9796{
9897   const int SPR_Y_TOP     = 0;
9998   const int SPR_Y_BOTTOM  = 1;
r2864r2865
179178               }
180179
181180               /* Daphne says "don't draw the pixel if it's black". */
182               draw_pixel(bitmap,cliprect,x+0,y,palette_get_color(Machine, pixel1 + (sprite_color*0x10 + 0x200)));
183               draw_pixel(bitmap,cliprect,x+1,y,palette_get_color(Machine, pixel2 + (sprite_color*0x10 + 0x200)));
184               draw_pixel(bitmap,cliprect,x+2,y,palette_get_color(Machine, pixel3 + (sprite_color*0x10 + 0x200)));
185               draw_pixel(bitmap,cliprect,x+3,y,palette_get_color(Machine, pixel4 + (sprite_color*0x10 + 0x200)));
181               draw_pixel(bitmap,cliprect,x+0,y,palette_get_color(machine, pixel1 + (sprite_color*0x10 + 0x200)));
182               draw_pixel(bitmap,cliprect,x+1,y,palette_get_color(machine, pixel2 + (sprite_color*0x10 + 0x200)));
183               draw_pixel(bitmap,cliprect,x+2,y,palette_get_color(machine, pixel3 + (sprite_color*0x10 + 0x200)));
184               draw_pixel(bitmap,cliprect,x+3,y,palette_get_color(machine, pixel4 + (sprite_color*0x10 + 0x200)));
186185
187186               x += 4;
188187
r2864r2865
207206   fillbitmap(bitmap, 0, cliprect);
208207
209208   gpworld_draw_tiles(screen->machine, bitmap, cliprect);
210   gpworld_draw_sprites(bitmap, cliprect);
209   gpworld_draw_sprites(screen->machine, bitmap, cliprect);
211210
212211   /* display disc information */
213212   if (discinfo != NULL)
src/mame/drivers/homedata.c
r2864r2865
255255static READ8_HANDLER( mrokumei_keyboard_r )
256256{
257257   int res = 0x3f,i;
258   static const char *keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
258259
259260   /* offset 0 is player 1, offset 1 player 2 (not supported) */
260261   if (offset == 0)
r2864r2865
263264      {
264265         if (keyb & (1 << i))
265266         {
266            res = input_port_read_indexed(machine, 3+i) & 0x3f;
267            res = input_port_read(machine, keynames[i]) & 0x3f;
267268            break;
268269         }
269270      }
r2864r2865
397398
398399static READ8_HANDLER( reikaids_io_r )
399400{
400   int res = input_port_read_indexed(machine, 2);   // bit 4 = coin, bit 5 = service
401   int res = input_port_read(machine, "IN2");   // bit 4 = coin, bit 5 = service
401402
402403   res |= BIT(upd7807_portc,2) * 0x01;      // bit 0 = upd7807 status
403404   res |= BIT(upd7807_portc,6) * 0x02;      // bit 1 = upd7807 data
r2864r2865
467468
468469static READ8_HANDLER( pteacher_keyboard_r )
469470{
470   int dips = input_port_read_indexed(machine, 0);
471   static const char *keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5" };
472   int dips = input_port_read(machine, "DSW");
471473
472474//  logerror("%04x: keyboard_r with port A = %02x\n",activecpu_get_pc(),upd7807_porta);
473475
r2864r2865
475477   {
476478      /* player 1 + dip switches */
477479      int row = (upd7807_porta & 0x07);
478      return input_port_read_indexed(machine, 2 + row) | (((dips >> row) & 1) << 5);   // 0-5
480      return input_port_read(machine, keynames[row]) | (((dips >> row) & 1) << 5);   // 0-5
479481   }
480482   if (upd7807_porta & 0x08)
481483   {
r2864r2865
571573   AM_RANGE(0x7000, 0x77ff) AM_READ(SMH_RAM) /* hourouki expects this to act as RAM */
572574   AM_RANGE(0x7800, 0x7800) AM_READ(SMH_RAM) /* only used to store the result of the ROM check */
573575   AM_RANGE(0x7801, 0x7802) AM_READ(mrokumei_keyboard_r)   // also vblank and active page
574   AM_RANGE(0x7803, 0x7803) AM_READ(input_port_2_r)   // coin, service
575   AM_RANGE(0x7804, 0x7804) AM_READ(input_port_0_r)   // DSW1
576   AM_RANGE(0x7805, 0x7805) AM_READ(input_port_1_r)   // DSW2
576   AM_RANGE(0x7803, 0x7803) AM_READ_PORT("IN0")         // coin, service
577   AM_RANGE(0x7804, 0x7804) AM_READ_PORT("DSW1")         // DSW1
578   AM_RANGE(0x7805, 0x7805) AM_READ_PORT("DSW2")         // DSW2
577579   AM_RANGE(0x7ffe, 0x7ffe) AM_READ(SMH_NOP)   // ??? read every vblank, value discarded
578580   AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
579581ADDRESS_MAP_END
r2864r2865
619621   AM_RANGE(0x4000, 0x5fff) AM_READ(SMH_RAM)
620622   AM_RANGE(0x6000, 0x6fff) AM_READ(SMH_RAM) /* work ram */
621623   AM_RANGE(0x7800, 0x7800) AM_READ(SMH_RAM)
622   AM_RANGE(0x7801, 0x7801) AM_READ(input_port_0_r)
623   AM_RANGE(0x7802, 0x7802) AM_READ(input_port_1_r)
624   AM_RANGE(0x7801, 0x7801) AM_READ_PORT("IN0")
625   AM_RANGE(0x7802, 0x7802) AM_READ_PORT("IN1")
624626   AM_RANGE(0x7803, 0x7803) AM_READ(reikaids_io_r)   // coin, blitter, upd7807
625627   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1)
626628   AM_RANGE(0xc000, 0xffff) AM_READ(SMH_ROM)
r2864r2865
707709static ADDRESS_MAP_START( pteacher_upd7807_readport, ADDRESS_SPACE_IO, 8 )
708710   AM_RANGE(UPD7807_PORTA, UPD7807_PORTA) AM_READ(pteacher_upd7807_porta_r)
709711   AM_RANGE(UPD7807_PORTT, UPD7807_PORTT) AM_READ(pteacher_keyboard_r)
710   AM_RANGE(UPD7807_PORTC, UPD7807_PORTC) AM_READ(input_port_1_r)
712   AM_RANGE(UPD7807_PORTC, UPD7807_PORTC) AM_READ_PORT("COIN")
711713ADDRESS_MAP_END
712714
713715static ADDRESS_MAP_START( pteacher_upd7807_writeport, ADDRESS_SPACE_IO, 8 )
r2864r2865
721723
722724
723725static INPUT_PORTS_START( mjhokite )
724   PORT_START
726   PORT_START_TAG("DSW1")
725727   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
726728   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
727729   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
746748   PORT_DIPSETTING(    0x20, "7" )
747749   PORT_DIPSETTING(    0x00, "8 (hardest)" )
748750
749   PORT_START
751   PORT_START_TAG("DSW2")
750752   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
751753   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
752754   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2864r2865
772774   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
773775   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
774776
775   PORT_START
777   PORT_START_TAG("IN0")
776778   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
777779   PORT_DIPNAME( 0x02, 0x02, "Freeze?" )
778780   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
r2864r2865
784786   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
785787   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
786788
787   PORT_START
788   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
789   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
790   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
791   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
792   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
789   PORT_START_TAG("KEY0")
790   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
791   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
792   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
793   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
794   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
793795   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1                              )
794796
795   PORT_START
796   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
797   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
798   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
799   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
800   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
801   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
797   PORT_START_TAG("KEY1")
798   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
799   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
800   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
801   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
802   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
803   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
802804
803   PORT_START
804   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
805   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
806   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
807   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
808   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
805   PORT_START_TAG("KEY2")
806   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
807   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
808   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
809   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
810   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
809811   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
810812
811   PORT_START
812   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
813   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
814   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
815   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
813   PORT_START_TAG("KEY3")
814   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
815   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
816   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
817   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
816818   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
817819   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
818820
819   PORT_START
821   PORT_START_TAG("KEY4")
820822   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
821823   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
822824   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
823   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
825   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
824826   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
825827   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
826828INPUT_PORTS_END
827829
828830static INPUT_PORTS_START( reikaids )
829   PORT_START   // IN0  - 0x7801
831   PORT_START_TAG("IN0")   // IN0  - 0x7801
830832   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
831833   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
832834   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1)
r2864r2865
836838   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) /* jump */
837839   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_START1 )
838840
839   PORT_START   // IN1 - 0x7802
841   PORT_START_TAG("IN1")   // IN1 - 0x7802
840842   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2)
841843   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
842844   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
r2864r2865
846848   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) /* jump */
847849   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_START2 )
848850
849   PORT_START   // IN2 - 0x7803
851   PORT_START_TAG("IN2")   // IN2 - 0x7803
850852   PORT_BIT(  0x01, IP_ACTIVE_HIGH,IPT_SPECIAL ) /* coprocessor status */
851853   PORT_BIT(  0x02, IP_ACTIVE_HIGH,IPT_SPECIAL ) /* coprocessor data */
852854   PORT_BIT(  0x04, IP_ACTIVE_HIGH,IPT_SPECIAL ) /* vblank */
r2864r2865
856858   PORT_BIT(  0x40, IP_ACTIVE_LOW,   IPT_UNKNOWN  )
857859   PORT_BIT(  0x80, IP_ACTIVE_LOW,   IPT_UNKNOWN  )
858860
859   PORT_START   // DSW1
861   PORT_START_TAG("DSW1")   // DSW1
860862   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Allow_Continue ) )
861863   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
862864   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2864r2865
880882   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
881883   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
882884
883   PORT_START   // DSW2
885   PORT_START_TAG("DSW2")   // DSW2
884886   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
885887   PORT_DIPSETTING(    0x03, DEF_STR( Easy ) )
886888   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )
r2864r2865
907909INPUT_PORTS_END
908910
909911static INPUT_PORTS_START( battlcry )
910   PORT_START   // IN0  - 0x7801
911   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
912   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
913   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1)
914   PORT_BIT(  0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
915   PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) /* punch */
916   PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) /* kick */
917   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) /* jump */
918   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_START1 )
912   PORT_INCLUDE( reikaids )
919913
920   PORT_START   // IN1 - 0x7802
921   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2)
922   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
923   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
924   PORT_BIT(  0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2)
925   PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* punch */
926   PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) /* kick */
927   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) /* jump */
928   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_START2 )
929
930   PORT_START   // IN2 - 0x7803
931   PORT_BIT(  0x01, IP_ACTIVE_HIGH,IPT_SPECIAL ) /* coprocessor status */
932   PORT_BIT(  0x02, IP_ACTIVE_HIGH,IPT_SPECIAL ) /* coprocessor data */
933   PORT_BIT(  0x04, IP_ACTIVE_HIGH,IPT_SPECIAL ) /* vblank */
934   PORT_BIT(  0x08, IP_ACTIVE_HIGH,IPT_SPECIAL ) /* visible page */
935   PORT_BIT(  0x10, IP_ACTIVE_LOW,   IPT_COIN1    )
936   PORT_BIT(  0x20, IP_ACTIVE_LOW,   IPT_SERVICE1 )
937   PORT_BIT(  0x40, IP_ACTIVE_LOW,   IPT_UNKNOWN  )
938   PORT_BIT(  0x80, IP_ACTIVE_LOW,   IPT_UNKNOWN  )
939
940   PORT_START   // DSW1
914   PORT_MODIFY("DSW1")
941915   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Allow_Continue ) )
942916   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
943917   PORT_DIPSETTING(    0x02, "Up To Stage 1" )
r2864r2865
958932   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
959933   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
960934
961   PORT_START   // DSW2
962   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
963   PORT_DIPSETTING(    0x03, DEF_STR( Easy ) )
964   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )
965   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
966   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
935   PORT_MODIFY("DSW2")
967936   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) )
968937   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
969938   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
r2864r2865
982951   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
983952   PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) )
984953   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
985
986954INPUT_PORTS_END
987955
988956
957static INPUT_PORTS_START( mj_keyboard )
958   PORT_START_TAG("KEY0")
959   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
960   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B )
961   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_C )
962   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_D )
963   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
964   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately) */
965   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
989966
967   PORT_START_TAG("KEY1")
968   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_E )
969   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
970   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_G )
971   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_H )
972   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
973   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately) */
974   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
990975
991#define MJ_KEYBOARD                                                            \
992   PORT_START                                                               \
993   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) \
994   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B ) \
995   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_C ) \
996   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_D ) \
997   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )                                    \
998   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately */      \
999   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )                                       \
1000                                                                        \
1001   PORT_START                                                               \
1002   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_E ) \
1003   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) \
1004   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_G ) \
1005   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_H ) \
1006   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )                                    \
1007   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately */      \
1008   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )                                       \
1009                                                                        \
1010   PORT_START                                                               \
1011   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_I ) \
1012   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_J ) \
1013   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) \
1014   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_L ) \
1015   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )                                    \
1016   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately */      \
1017   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )                                       \
1018                                                                        \
1019   PORT_START                                                               \
1020   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_M ) \
1021   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_N ) \
1022   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) \
1023   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) \
1024   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) \
1025   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately */      \
1026   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )                                       \
1027                                                                        \
1028   PORT_START                                                               \
1029   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) \
1030   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) \
1031   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) \
1032   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )                                    \
1033   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )                                    \
1034   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately */      \
1035   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )                                       \
1036                                                                        \
1037   PORT_START                                                               \
1038   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )                                       \
1039   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) \
1040   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )                                    \
1041   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )                                    \
1042   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )                                    \
1043   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately */      \
976   PORT_START_TAG("KEY2")
977   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_I )
978   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_J )
979   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
980   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_L )
981   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
982   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately) */
1044983   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
1045984
985   PORT_START_TAG("KEY3")
986   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_M )
987   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_N )
988   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
989   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
990   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
991   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately) */
992   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
1046993
994   PORT_START_TAG("KEY4")
995   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
996   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
997   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
998   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
999   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1000   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately) */
1001   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
1002
1003   PORT_START_TAG("KEY5")
1004   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1005   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
1006   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1007   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1008   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1009   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* dip switch (handled separately) */
1010   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
1011INPUT_PORTS_END
1012
10471013static INPUT_PORTS_START( pteacher )
1048   PORT_START   /* dip switches (handled by pteacher_keyboard_r) */
1014   PORT_START_TAG("DSW")   /* dip switches (handled by pteacher_keyboard_r) */
10491015   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) )
10501016   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
10511017   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
10821048   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
10831049   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
10841050
1085   PORT_START
1051   PORT_START_TAG("COIN")
10861052   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
10871053   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )
10881054   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
10891055
1090   MJ_KEYBOARD
1056   PORT_INCLUDE( mj_keyboard )
10911057INPUT_PORTS_END
10921058
10931059static INPUT_PORTS_START( jogakuen )
1094   PORT_START   /* dip switches (handled by pteacher_keyboard_r) */
1060   PORT_START_TAG("DSW")   /* dip switches (handled by pteacher_keyboard_r) */
10951061   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
10961062   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
10971063   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
11281094   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
11291095   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
11301096
1131   PORT_START
1097   PORT_START_TAG("COIN")
11321098   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
11331099   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )
11341100   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
11351101
1136   MJ_KEYBOARD
1102   PORT_INCLUDE( mj_keyboard )
11371103INPUT_PORTS_END
11381104
11391105static INPUT_PORTS_START( mjikaga )
1140   PORT_START   /* dip switches (handled by pteacher_keyboard_r) */
1106   PORT_START_TAG("DSW")   /* dip switches (handled by pteacher_keyboard_r) */
11411107   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
11421108   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
11431109   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2864r2865
11741140   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
11751141   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
11761142
1177   PORT_START
1143   PORT_START_TAG("COIN")
11781144   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
11791145   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )
11801146   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
11811147
1182   MJ_KEYBOARD
1148   PORT_INCLUDE( mj_keyboard )
11831149INPUT_PORTS_END
11841150
11851151
src/mame/drivers/imolagp.c
r2864r2865
130130static int imola_draw_mode;
131131
132132static void
133InitializeColors( void )
133InitializeColors( running_machine *machine )
134134{ /* optional runtime remapping of colors */
135135   static const UINT8 color[0x10][3] =
136136   { /* wrong! need color-accurate screenshots to fix */
r2864r2865
154154   int i;
155155   for( i=0; i<0x10; i++ )
156156   {
157      palette_set_color_rgb( Machine,i*2+0,0,0,0 );
158      palette_set_color_rgb( Machine,i*2+1,color[i][0],color[i][1],color[i][2] );
157      palette_set_color_rgb( machine,i*2+0,0,0,0 );
158      palette_set_color_rgb( machine,i*2+1,color[i][0],color[i][1],color[i][2] );
159159   }
160160}
161161
r2864r2865
167167      imola_videoram[i] = auto_malloc(0x4000);
168168      memset( imola_videoram[i], 0x00, 0x4000 );
169169   }
170   InitializeColors();
170   InitializeColors(machine);
171171}
172172
173173
r2864r2865
323323static ADDRESS_MAP_START( imolagp_master, ADDRESS_SPACE_PROGRAM, 8 )
324324   AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM)
325325   AM_RANGE(0x2000, 0x23ff) AM_READ(SMH_RAM) AM_WRITE(SMH_RAM)
326   AM_RANGE(0x2800, 0x2800) AM_READ(input_port_2_r)  /* gas */
326   AM_RANGE(0x2800, 0x2800) AM_READ_PORT("2800")   /* gas */
327327   AM_RANGE(0x2802, 0x2802) AM_READ(steerlatch_r) AM_WRITE(SMH_NOP)
328328   /*  AM_RANGE(0x2803, 0x2803) ? */
329329   AM_RANGE(0x3000, 0x3000) AM_WRITE(vreg_control_w)
r2864r2865
331331   /*  AM_RANGE(0x37f7, 0x37f7) ? */
332332   AM_RANGE(0x3800, 0x3800) AM_WRITE(vreg_data_w)
333333   AM_RANGE(0x3810, 0x3810) AM_WRITE(AY8910_write_port_0_w)
334   AM_RANGE(0x4000, 0x4000) AM_READ( input_port_0_r ) /* DSWA */
334   AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSWA")   /* DSWA */
335335   AM_RANGE(0x5000, 0x50ff) AM_WRITE(imola_ledram_w)
336336   AM_RANGE(0x47ff, 0x4800) AM_WRITE(transmit_data_w)
337   AM_RANGE(0x6000, 0x6000) AM_READ( input_port_1_r ) /* DSWB */
337   AM_RANGE(0x6000, 0x6000) AM_READ_PORT("DSWB")   /* DSWB */
338338ADDRESS_MAP_END
339339
340340static ADDRESS_MAP_START( readport_slave, ADDRESS_SPACE_IO, 8 )
r2864r2865
371371   else
372372   {
373373      static int oldsteer;
374      int newsteer = input_port_read_indexed(machine, 3)&0xf;
374      int newsteer = input_port_read(machine, "2802") & 0xf;
375375      if( newsteer!=oldsteer )
376376      {
377377         if( imola_steerlatch==0 )
r2864r2865
486486   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
487487   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
488488
489   PORT_START /* 2800 */ /* speed: 08 00 0F 1C 0F 00 1E 3D */
489   PORT_START_TAG("2800") /* 2800 */ /* speed: 08 00 0F 1C 0F 00 1E 3D */
490490//  PORT_DIPNAME( 0x03, 0x03, "Pedal" )
491491//  PORT_DIPSETTING( 0x01, "STOPPED" )
492492//  PORT_DIPSETTING( 0x00, "SLOW" )
r2864r2865
502502   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
503503   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
504504
505   PORT_START /* 2802 */
505   PORT_START_TAG("2802") /* 2802 */
506506   PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_PLAYER(1)
507507INPUT_PORTS_END
508508
src/mame/drivers/puckpkmn.c
r2864r2865
1818static UINT16* main_ram;
1919
2020static INPUT_PORTS_START( puckpkmn ) /* Puckman Pockimon Input Ports */
21   PORT_START   /* Player 2 Controls ($700011.b) */
21   PORT_START_TAG("P2")   /* Player 2 Controls ($700011.b) */
2222   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
2323   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
2424   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_START2 )
r2864r2865
2828   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2929   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3030
31   PORT_START   /* Player 1 Controls ($700013.b) */
31   PORT_START_TAG("P1")   /* Player 1 Controls ($700013.b) */
3232   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
3333   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
3434   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_START1 )
r2864r2865
3838   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
3939   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
4040
41   PORT_START   /* ? ($700015.b) */
41   PORT_START_TAG("IN0")   /* ? ($700015.b) */
4242
43   PORT_START   /* DSW 1 ($700017.b) */
43   PORT_START_TAG("DSW1")   /* DSW 1 ($700017.b) */
4444   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
4545   PORT_DIPSETTING(    0x03, DEF_STR( 5C_1C ) )
4646   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
r2864r2865
6565   PORT_DIPSETTING(    0x40, DEF_STR( Hard )    )
6666   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
6767
68   PORT_START   /* DSW 1 ($700019.b) */
68   PORT_START_TAG("DSW2")   /* DSW 1 ($700019.b) */
6969   PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
7070   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
7171   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
src/mame/drivers/kinstb.c
r2864r2865
4343   //check coins
4444   static INT32 oldinput=0;
4545   INT32 coincnt;
46#ifdef MAME_DEBUG
47   INT32   input=input_port_read_indexed(machine, 13);
48#else
49   INT32   input=input_port_read_indexed(machine, 10);
50#endif
46   INT32 input = input_port_read(machine, "COIN");
5147
5248   if(input&3)
5349   {
r2864r2865
9995ADDRESS_MAP_END
10096
10197static INPUT_PORTS_START( kinstb )
102   PORT_START  /* IN 0 : Joypad 1 - L */
98   PORT_START_TAG("PAD1L")      /* IN 0 : Joypad 1 - L */
10399   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Button A") PORT_PLAYER(1)
104100   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P1 Button X") PORT_PLAYER(1)
105101   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P1 Button L") PORT_PLAYER(1)
106102   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P1 Button R") PORT_PLAYER(1)
107   PORT_START  /* IN 1 : Joypad 1 - H */
103   PORT_START_TAG("PAD1H")      /* IN 1 : Joypad 1 - H */
108104   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Button B") PORT_PLAYER(1)
109105   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Button Y") PORT_PLAYER(1)
110106   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_NAME("P1 Select")
r2864r2865
114110   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
115111   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
116112
117   PORT_START  /* IN 2 : Joypad 2 - L */
113   PORT_START_TAG("PAD2L")      /* IN 2 : Joypad 2 - L */
118114   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P2 Button A") PORT_PLAYER(2)
119115   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P2 Button X") PORT_PLAYER(2)
120116   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P2 Button L") PORT_PLAYER(2)
121117   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P2 Button R") PORT_PLAYER(2)
122   PORT_START  /* IN 3 : Joypad 2 - H */
118   PORT_START_TAG("PAD2H")      /* IN 3 : Joypad 2 - H */
123119   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Button B") PORT_PLAYER(2)
124120   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Button Y") PORT_PLAYER(2)
125121   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE2 ) PORT_NAME("P2 Select")
r2864r2865
129125   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
130126   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
131127
132   PORT_START  /* IN 4 : Joypad 3 - L */
128   PORT_START_TAG("PAD3L")      /* IN 4 : Joypad 3 - L */
133129   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P3 Button A") PORT_PLAYER(3)
134130   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P3 Button X") PORT_PLAYER(3)
135131   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P3 Button L") PORT_PLAYER(3)
136132   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P3 Button R") PORT_PLAYER(3)
137   PORT_START  /* IN 5 : Joypad 3 - H */
133   PORT_START_TAG("PAD3H")      /* IN 5 : Joypad 3 - H */
138134   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P3 Button B") PORT_PLAYER(3)
139135   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P3 Button Y") PORT_PLAYER(3)
140136   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE3 ) PORT_NAME("P3 Select")
r2864r2865
144140   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)
145141   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)
146142
147   PORT_START  /* IN 6 : Joypad 4 - L */
143   PORT_START_TAG("PAD4L")      /* IN 6 : Joypad 4 - L */
148144   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P4 Button A") PORT_PLAYER(4)
149145   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("P4 Button X") PORT_PLAYER(4)
150146   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("P4 Button L") PORT_PLAYER(4)
151147   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("P4 Button R") PORT_PLAYER(4)
152   PORT_START  /* IN 7 : Joypad 4 - H */
148   PORT_START_TAG("PAD4H")      /* IN 7 : Joypad 4 - H */
153149   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P4 Button B") PORT_PLAYER(4)
154150   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P4 Button Y") PORT_PLAYER(4)
155151   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE4 ) PORT_NAME("P4 Select")
r2864r2865
159155   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
160156   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
161157
162   PORT_START   /* IN 8 : Internal switches */
158   PORT_START_TAG("INTERNAL")      /* IN 8 : Internal switches */
163159   PORT_DIPNAME( 0x1, 0x1, "Enforce 32 sprites/line" )
164160   PORT_DIPSETTING(   0x0, DEF_STR( No )  )
165161   PORT_DIPSETTING(   0x1, DEF_STR( Yes ) )
166162
167163#ifdef MAME_DEBUG
168   PORT_START   /* IN 9 : debug switches */
164   PORT_START_TAG("DEBUG1")   /* IN 9 : debug switches */
169165   PORT_DIPNAME( 0x3, 0x0, "Browse tiles" )
170166   PORT_DIPSETTING(   0x0, DEF_STR( Off ) )
171167   PORT_DIPSETTING(   0x1, "2bpl"  )
r2864r2865
177173   PORT_DIPSETTING(   0x8, "4bpl"  )
178174   PORT_DIPSETTING(   0xc, "8bpl"  )
179175
180   PORT_START   /* IN 10 : debug switches */
176   PORT_START_TAG("DEBUG2")   /* IN 10 : debug switches */
181177   PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Toggle BG 1") PORT_PLAYER(2)
182178   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Toggle BG 2") PORT_PLAYER(2)
183179   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Toggle BG 3") PORT_PLAYER(2)
r2864r2865
187183   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Toggle Back col") PORT_PLAYER(3)
188184   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Toggle Windows") PORT_PLAYER(3)
189185
190   PORT_START   /* IN 11 : debug input */
186   PORT_START_TAG("DEBUG3")   /* IN 11 : debug input */
191187   PORT_BIT( 0x1, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Pal prev")
192188   PORT_BIT( 0x2, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Pal next")
193189   PORT_BIT( 0x4, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Toggle Transparency") PORT_PLAYER(4)
194190#endif
195191
196   PORT_START   /* IN 12 : dip-switches */
192   PORT_START_TAG("DSW")   /* IN 12 : dip-switches */
197193
198   PORT_START   /* IN 13 : coins */
194   PORT_START_TAG("COIN")   /* IN 13 : coins */
199195   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
200196   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
201197
src/mame/drivers/eolith16.c
r2864r2865
4545static READ16_HANDLER( eolith16_custom_r )
4646{
4747   eolith_speedup_read();
48   return (input_port_read_indexed(machine, 0) & ~0x10) | (eeprom_read_bit() << 4);
48   return (input_port_read(machine, "IN0") & ~0x10) | (eeprom_read_bit() << 4);
4949}
5050
5151
r2864r2865
7575ADDRESS_MAP_END
7676
7777static INPUT_PORTS_START( eolith16 )
78   PORT_START
78   PORT_START_TAG("IN0")
7979   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SPECIAL ) // eeprom bit
8080   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(eolith_speedup_getvblank, 0)
8181   PORT_BIT( 0xff6f, IP_ACTIVE_LOW, IPT_UNUSED )
8282
83   PORT_START
83   PORT_START_TAG("IN1")
8484   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
8585   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED )
8686   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
r2864r2865
9090   PORT_SERVICE_NO_TOGGLE( 0x0040, IP_ACTIVE_LOW )
9191   PORT_BIT( 0xff80, IP_ACTIVE_LOW, IPT_UNUSED )
9292
93   PORT_START
93   PORT_START_TAG("IN2")
9494   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_PLAYER(1)
9595   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_PLAYER(1)
9696   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_PLAYER(1)
src/mame/drivers/groundfx.c
r2864r2865
163163   {
164164      case 0x00:
165165      {
166         return (input_port_read_indexed(machine,0) << 16) | input_port_read_indexed(machine,1) |
166         return (input_port_read(machine, "IN0") << 16) | input_port_read(machine, "IN1") |
167167              (eeprom_read_bit() << 7) | frame_counter;
168168      }
169169
170170      case 0x01:
171171      {
172         return input_port_read_indexed(machine,2) | (coin_word << 16);
172         return input_port_read(machine, "IN2") | (coin_word << 16);
173173      }
174174    }
175175
r2864r2865
214214
215215static READ32_HANDLER( groundfx_adc_r )
216216{
217   return (input_port_read_indexed(machine,3) << 8) | input_port_read_indexed(machine,4);
217   return (input_port_read(machine, "AN0") << 8) | input_port_read(machine, "AN1");
218218}
219219
220220static WRITE32_HANDLER( groundfx_adc_w )
r2864r2865
280280   AM_RANGE(0x200000, 0x21ffff) AM_WRITE(SMH_RAM) AM_BASE(&groundfx_ram)
281281   AM_RANGE(0x300000, 0x303fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram32) AM_SIZE(&spriteram_size)
282282   AM_RANGE(0x400000, 0x400003) AM_WRITE(motor_control_w)   /* gun vibration */
283   AM_RANGE(0x500000, 0x500007) AM_WRITE(groundfx_input_w)   /* eerom etc. */
283   AM_RANGE(0x500000, 0x500007) AM_WRITE(groundfx_input_w)   /* eeprom etc. */
284284   AM_RANGE(0x600000, 0x600003) AM_WRITE(groundfx_adc_w)
285285   AM_RANGE(0x700000, 0x7007ff) AM_WRITE(SMH_RAM) AM_BASE(&f3_shared_ram)
286286   AM_RANGE(0x800000, 0x80ffff) AM_WRITE(TC0480SCP_long_w)     /* tilemaps */
r2864r2865
298298***********************************************************/
299299
300300static INPUT_PORTS_START( groundfx )
301   PORT_START      /* IN0 */
301   PORT_START_TAG("IN0")   /* IN0 */
302302   PORT_BIT( 0xffff, IP_ACTIVE_LOW,  IPT_UNUSED )
303303
304   PORT_START      /* IN1 */
304   PORT_START_TAG("IN1")   /* IN1 */
305305   PORT_BIT( 0x0001, IP_ACTIVE_HIGH,  IPT_SPECIAL ) /* Frame counter */
306306   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_UNUSED )
307307   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_UNUSED )
r2864r2865
319319   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNUSED )
320320   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNUSED )
321321
322   PORT_START      /* IN2 */
322   PORT_START_TAG("IN2")   /* IN2 */
323323   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_LOW )
324324   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_SERVICE1 )
325325   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_COIN1 )
r2864r2865
329329   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
330330   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
331331
332   PORT_START   /* IN 2, steering wheel */
332   PORT_START_TAG("AN0")   /* IN 2, steering wheel */
333333   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_REVERSE PORT_PLAYER(1)
334334
335   PORT_START   /* IN 3, accel */
335   PORT_START_TAG("AN1")   /* IN 3, accel */
336336   PORT_BIT( 0xff, 0xff, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_PLAYER(1)
337337
338   PORT_START   /* IN 4, sound volume */
338   PORT_START_TAG("AN2")   /* IN 4, sound volume */
339339   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(2)
340340
341   PORT_START   /* IN 5, unknown */
341   PORT_START_TAG("AN3")   /* IN 5, unknown */
342342   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_PLAYER(2)
343343INPUT_PORTS_END
344344
src/mame/drivers/gamecstl.c
r2864r2865
726726{
727727   bios_ram = auto_malloc(0x10000);
728728
729   init_pc_common(PCCOMMON_KEYBOARD_AT, gamecstl_set_keyb_int);
729   init_pc_common(machine, PCCOMMON_KEYBOARD_AT, gamecstl_set_keyb_int);
730730   mc146818_init(MC146818_STANDARD);
731731
732732   intel82439tx_init();
src/mame/drivers/m92.c
r2864r2865
189189*****************************************************************************/
190190
191191#include "driver.h"
192#include "deprecat.h"
193192#include "includes/m92.h"
194193#include "drivers/m92.h"
195194#include "machine/irem_cpu.h"
r2864r2865
952951
953952/***************************************************************************/
954953
955void m92_sprite_interrupt(void)
954void m92_sprite_interrupt(running_machine *machine)
956955{
957   cpunum_set_input_line_and_vector(Machine, 0, 0, HOLD_LINE, M92_IRQ_1);
956   cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, M92_IRQ_1);
958957}
959958
960959static MACHINE_DRIVER_START( m92 )
src/mame/drivers/hal21.c
r2864r2865
450450   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
451451   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
452452
453   PORT_START_TAG("DSW0")
453   PORT_START_TAG("DSW1")
454454   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Allow_Continue ) )
455455   PORT_DIPSETTING(    0x01, DEF_STR( No ) )
456456   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
r2864r2865
475475   PORT_DIPSETTING(    0x40, "100k 200k" )
476476   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
477477
478   PORT_START_TAG("DSW1")
478   PORT_START_TAG("DSW2")
479479   PORT_DIPNAME( 0x01, 0x01, "Bonus Occurrence" )
480480   PORT_DIPSETTING(    0x01, "1st & every 2nd" )
481481   PORT_DIPSETTING(    0x00, "1st & 2nd only" )
r2864r2865
550550
551551static READ8_HANDLER( CPUC_ready_r ) { snk_sound_busy_bit = 0; return 0; }
552552
553static READ8_HANDLER( hal21_input_port_0_r ) { return input_port_read_indexed(machine, 0) | snk_sound_busy_bit; }
553static READ8_HANDLER( hal21_input_port_0_r ) { return input_port_read(machine, "IN0") | snk_sound_busy_bit; }
554554
555555static WRITE8_HANDLER( hal21_soundcommand_w ) { hal21_sound_scheduler(machine, 1, data); }
556556static WRITE8_HANDLER( hal21_soundack_w ) { hal21_sound_scheduler(machine,2, data); }
r2864r2865
611611
612612static ADDRESS_MAP_START( aso_cpuA_map, ADDRESS_SPACE_PROGRAM, 8 )
613613   AM_RANGE(0x0000, 0xbfff) AM_ROM
614   AM_RANGE(0xc000, 0xc000) AM_READ(hal21_input_port_0_r) /* coin, start */
615   AM_RANGE(0xc100, 0xc100) AM_READ(input_port_1_r) /* P1 */
616   AM_RANGE(0xc200, 0xc200) AM_READ(input_port_2_r) /* P2 */
614   AM_RANGE(0xc000, 0xc000) AM_READ(hal21_input_port_0_r)   /* coin, start */
615   AM_RANGE(0xc100, 0xc100) AM_READ_PORT("IN1")         /* P1 */
616   AM_RANGE(0xc200, 0xc200) AM_READ_PORT("IN2")         /* P2 */
617617   AM_RANGE(0xc400, 0xc400) AM_WRITE(aso_soundcommand_w)
618   AM_RANGE(0xc500, 0xc500) AM_READ(input_port_3_r) /* DSW1 */
619   AM_RANGE(0xc600, 0xc600) AM_READ(input_port_4_r) /* DSW2 */
618   AM_RANGE(0xc500, 0xc500) AM_READ_PORT("DSW1")         /* DSW1 */
619   AM_RANGE(0xc600, 0xc600) AM_READ_PORT("DSW2")         /* DSW2 */
620620   AM_RANGE(0xc700, 0xc700) AM_READWRITE(snk_cpuB_nmi_trigger_r, snk_cpuA_nmi_ack_w)
621621   AM_RANGE(0xc800, 0xc800) AM_WRITE(hal21_vreg1_w)
622622   AM_RANGE(0xc900, 0xc900) AM_WRITE(hal21_vreg2_w)
r2864r2865
646646
647647static ADDRESS_MAP_START( hal21_cpuA_map, ADDRESS_SPACE_PROGRAM, 8 )
648648   AM_RANGE(0x0000, 0x7fff) AM_ROM
649   AM_RANGE(0xc000, 0xc000) AM_READ(hal21_input_port_0_r) /* coin, start */
650   AM_RANGE(0xc100, 0xc100) AM_READ(input_port_1_r) /* P1 */
651   AM_RANGE(0xc200, 0xc200) AM_READ(input_port_2_r) /* P2 */
649   AM_RANGE(0xc000, 0xc000) AM_READ(hal21_input_port_0_r)   /* coin, start */
650   AM_RANGE(0xc100, 0xc100) AM_READ_PORT("IN1")         /* P1 */
651   AM_RANGE(0xc200, 0xc200) AM_READ_PORT("IN2")         /* P2 */
652652   AM_RANGE(0xc300, 0xc300) AM_WRITE(hal21_soundcommand_w)
653   AM_RANGE(0xc400, 0xc400) AM_READ(input_port_3_r) /* DSW1 */
654   AM_RANGE(0xc500, 0xc500) AM_READ(input_port_4_r) /* DSW2 */
653   AM_RANGE(0xc400, 0xc400) AM_READ_PORT("DSW1")         /* DSW1 */
654   AM_RANGE(0xc500, 0xc500) AM_READ_PORT("DSW2")         /* DSW2 */
655655   AM_RANGE(0xc600, 0xc600) AM_WRITE(hal21_vreg0_w)
656656   AM_RANGE(0xc700, 0xc700) AM_READWRITE(snk_cpuB_nmi_trigger_r, snk_cpuA_nmi_ack_w)
657657   AM_RANGE(0xd300, 0xd300) AM_WRITE(hal21_vreg1_w)
src/mame/drivers/fcombat.c
r2864r2865
146146static READ8_HANDLER( fcombat_port01_r )
147147{
148148   /* the cocktail flip bit muxes between ports 0 and 1 */
149   return fcombat_cocktail_flip ? input_port_read_indexed(machine, 1) : input_port_read_indexed(machine, 0);
149   return fcombat_cocktail_flip ? input_port_read(machine, "IN1") : input_port_read(machine, "IN0");
150150}
151151
152152
r2864r2865
201201   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
202202   AM_RANGE(0xd800, 0xd8ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
203203   AM_RANGE(0xe000, 0xe000) AM_READ(fcombat_port01_r)
204   AM_RANGE(0xe100, 0xe100) AM_READ(input_port_2_r)
205   AM_RANGE(0xe200, 0xe200) AM_READ(input_port_3_r)
204   AM_RANGE(0xe100, 0xe100) AM_READ_PORT("DSW0")
205   AM_RANGE(0xe200, 0xe200) AM_READ_PORT("DSW1")
206206   AM_RANGE(0xe300, 0xe300) AM_READ(e300_r)
207207   AM_RANGE(0xe400, 0xe400) AM_READ(fcombat_protection_r) // protection?
208208   AM_RANGE(0xe800, 0xe800) AM_WRITE(fcombat_videoreg_w)   // at least bit 0 for flip screen and joystick input multiplexor
src/mame/drivers/segas16b.c
r2864r2865
930930 *************************************/
931931
932932extern void fd1094_machine_init(void);
933extern void fd1094_driver_init(void (*set_decrypted)(UINT8 *));
933extern void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(UINT8 *));
934934
935935static READ16_HANDLER( misc_io_r );
936936static WRITE16_HANDLER( misc_io_w );
r2864r2865
10621062   segaic16_memory_mapper_init(machine, 0, region_info_list[rom_board], sound_w, NULL);
10631063
10641064   /* init the FD1094 */
1065   fd1094_driver_init(segaic16_memory_mapper_set_decrypted);
1065   fd1094_driver_init(machine, segaic16_memory_mapper_set_decrypted);
10661066
10671067   /* reset the custom handlers and other pointers */
10681068   custom_io_r = NULL;
r2864r2865
55855585    ROM Board: 171-5704
55865586*/
55875587ROM_START( tetris2 )
5588   ROM_REGION( 0x020000, REGION_CPU1, 0 ) /* 68000 code */
5589   ROM_LOAD16_BYTE( "epr12193.rom", 0x000000, 0x10000, CRC(9ce15ac9) SHA1(0fdbd3ca37e4c0efa7c66415714bfc10637ced6c) )
5590   ROM_LOAD16_BYTE( "epr12192.rom", 0x000001, 0x10000, CRC(98d590ca) SHA1(4d18409c0b5734d0adcea5646d13f65b687dd05d) )
5588   ROM_REGION( 0x040000, REGION_CPU1, 0 ) /* 68000 code */
5589   ROM_LOAD16_BYTE( "epr12193.a7", 0x000000, 0x20000, CRC(44466ed4) SHA1(ddb4f0310987e54ce4cd9ffa2813e2d1309aeaaa) )
5590   ROM_LOAD16_BYTE( "epr12192.a5", 0x000001, 0x20000, CRC(a1c8af00) SHA1(a8e4b289eb3939d6798bb78df1b4ae51c8ccc2d6) )
55915591
55925592   ROM_REGION( 0x2000, REGION_USER1, 0 )   /* decryption key */
55935593   ROM_LOAD( "317-0092.key", 0x0000, 0x2000, CRC(d10e1ad9) SHA1(26e81b5f62d96ea50bf203f66dc3643f29dd1596) )
src/mame/drivers/pktgaldx.c
r2864r2865
205205/**********************************************************************************/
206206
207207static INPUT_PORTS_START( pktgaldx )
208   PORT_START   /* 16bit */
208   PORT_START_TAG("IN0")   /* 16bit */
209209   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
210210   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
211211   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2864r2865
216216   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
217217   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
218218
219   PORT_START   /* 16bit */
219   PORT_START_TAG("DSW")   /* 16bit */
220220   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
221221   PORT_DIPSETTING(      0x0000, DEF_STR( 3C_1C ) )
222222   PORT_DIPSETTING(      0x0001, DEF_STR( 2C_1C ) )
r2864r2865
264264   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
265265   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
266266
267   PORT_START   /* 16bit */
267   PORT_START_TAG("IN1")   /* 16bit */
268268   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
269269   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
270270   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
src/mame/drivers/atarigx2.c
r2864r2865
20392039static DRIVER_INIT( spclords )
20402040{
20412041   atarigen_eeprom_default = NULL;
2042   atarijsa_init(machine, 2, 0x0040);
2042   atarijsa_init(machine, "IN2", 0x0040);
20432043   atarijsa3_init_adpcm(REGION_SOUND1);
20442044
20452045   atarigx2_playfield_base = 0x000;
r2864r2865
20512051static DRIVER_INIT( motofren )
20522052{
20532053   atarigen_eeprom_default = NULL;
2054   atarijsa_init(machine, 2, 0x0040);
2054   atarijsa_init(machine, "IN2", 0x0040);
20552055   atarijsa3_init_adpcm(REGION_SOUND1);
20562056
20572057   atarigx2_playfield_base = 0x400;
r2864r2865
20892089static DRIVER_INIT( rrreveng )
20902090{
20912091   atarigen_eeprom_default = NULL;
2092   atarijsa_init(machine, 2, 0x0040);
2092   atarijsa_init(machine, "IN2", 0x0040);
20932093   atarijsa3_init_adpcm(REGION_SOUND1);
20942094
20952095   atarigx2_playfield_base = 0x000;
src/mame/drivers/gaelco2.c
r2864r2865
8080
8181
8282static INPUT_PORTS_START( maniacsq )
83PORT_START   /* DSW #1 + 1P INPUTS */
83PORT_START_TAG("IN0")   /* DSW #1 + 1P INPUTS */
8484   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
8585   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
8686   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
116116   PORT_DIPSETTING(      0xa000, DEF_STR( 1C_6C ) )
117117   PORT_DIPSETTING(      0x0000, "Disabled or Free Play (if Coin A too)" )
118118
119PORT_START   /* DSW #2 + 2P INPUTS */
119PORT_START_TAG("IN1")   /* DSW #2 + 2P INPUTS */
120120   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
121121   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
122122   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
147147   PORT_DIPSETTING(      0x4000, DEF_STR( On ) )
148148   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
149149
150PORT_START   /* COINSW & SERVICESW */
150PORT_START_TAG("COIN")   /* COINSW & SERVICESW */
151151   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
152152   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
153153   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
243243   }
244244}
245245
246static READ16_HANDLER(p1_gun_x) {return (input_port_read_indexed(machine, 3)*320/0x100)+1;}
247static READ16_HANDLER(p1_gun_y) {return (input_port_read_indexed(machine, 5)*240/0x100)-4;}
248static READ16_HANDLER(p2_gun_x) {return (input_port_read_indexed(machine, 4)*320/0x100)+1;}
249static READ16_HANDLER(p2_gun_y) {return (input_port_read_indexed(machine, 6)*240/0x100)-4;}
246static READ16_HANDLER(p1_gun_x) {return (input_port_read(machine, "LIGHT0_X") * 320 / 0x100) + 1;}
247static READ16_HANDLER(p1_gun_y) {return (input_port_read(machine, "LIGHT0_Y") * 240 / 0x100) - 4;}
248static READ16_HANDLER(p2_gun_x) {return (input_port_read(machine, "LIGHT1_X") * 320 / 0x100) + 1;}
249static READ16_HANDLER(p2_gun_y) {return (input_port_read(machine, "LIGHT1_Y") * 240 / 0x100) - 4;}
250250
251251static ADDRESS_MAP_START( bang_readmem, ADDRESS_SPACE_PROGRAM, 16 )
252252    AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM) /* ROM */
r2864r2865
282282
283283
284284static INPUT_PORTS_START( bang )
285PORT_START   /* 1P INPUTS */
285PORT_START_TAG("P1")   /* 1P INPUTS */
286286   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_IMPULSE(1) PORT_PLAYER(1)
287287
288PORT_START   /* 2P INPUTS */
288PORT_START_TAG("P2")   /* 2P INPUTS */
289289   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
290290
291PORT_START   /* COINSW & Service */
291PORT_START_TAG("COIN")   /* COINSW & Service */
292292   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
293293   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
294294   PORT_SERVICE_NO_TOGGLE( 0x0004, IP_ACTIVE_LOW)   /* go to service mode NOW */
r2864r2865
297297   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 )
298298   /* bits 6 & 7 are used for accessing the NVRAM */
299299
300   PORT_START /* Gun 1 X */
300   PORT_START_TAG("LIGHT0_X")   /* Gun 1 X */
301301   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(15) PORT_PLAYER(1)
302302
303   PORT_START /* Gun 2 X */
303   PORT_START_TAG("LIGHT1_X")   /* Gun 2 X */
304304   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(15) PORT_PLAYER(2)
305305
306   PORT_START /* Gun 1 Y */
306   PORT_START_TAG("LIGHT0_Y")   /* Gun 1 Y */
307307   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, -6.0 / 240, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(15) PORT_PLAYER(1)
308308
309   PORT_START /* Gun 2 Y */
309   PORT_START_TAG("LIGHT1_Y")   /* Gun 2 Y */
310310   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, -6.0 / 240, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(15) PORT_PLAYER(2)
311311INPUT_PORTS_END
312312
r2864r2865
439439
440440static INPUT_PORTS_START( alighunt )
441441
442PORT_START   /* DSW #1 */
442PORT_START_TAG("IN0")   /* DSW #1 */
443443   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
444444   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
445445   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
475475   PORT_DIPSETTING(      0xa000, DEF_STR( 1C_6C ) )
476476   PORT_DIPSETTING(      0x0000, "Disabled or Free Play (if Coin A too)" )
477477
478PORT_START   /* DSW #2 */
478PORT_START_TAG("IN1")   /* DSW #2 */
479479   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
480480   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
481481   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
505505   PORT_DIPSETTING(      0x4000, DEF_STR( Standard ) )
506506   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
507507
508PORT_START   /* COINSW & Service */
508PORT_START_TAG("COIN")   /* COINSW & Service */
509509   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
510510   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
511511   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2864r2865
672672
673673static INPUT_PORTS_START( touchgo )
674674
675PORT_START   /* DSW #2 + 1P INPUTS */
675PORT_START_TAG("IN0")   /* DSW #2 + 1P INPUTS */
676676   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
677677   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
678678   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
701701   PORT_DIPSETTING(      0x4000, DEF_STR( On ) )
702702   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
703703
704PORT_START   /* DSW #1 + 2P INPUTS */
704PORT_START_TAG("IN1")   /* DSW #1 + 2P INPUTS */
705705   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
706706   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
707707   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
745745   PORT_DIPSETTING(      0xb000, DEF_STR( 1C_5C ) )
746746   PORT_DIPSETTING(      0xa000, DEF_STR( 1C_6C ) )
747747
748PORT_START   /* COINSW + 3P */
748PORT_START_TAG("IN2")   /* COINSW + 3P */
749749   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
750750   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
751751   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
r2864r2865
760760   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_COIN4 )
761761   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNKNOWN )
762762
763PORT_START   /* SERVICESW + 4P INPUTS */
763PORT_START_TAG("IN3")   /* SERVICESW + 4P INPUTS */
764764   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
765765   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
766766   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
r2864r2865
774774   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_SERVICE2 )
775775   PORT_BIT( 0xf800, IP_ACTIVE_LOW, IPT_UNKNOWN )
776776
777PORT_START   /* Fake: To switch between monitors at run time */
778   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SERVICE4 ) PORT_TOGGLE
777PORT_START_TAG("FAKE")   /* Fake: To switch between monitors at run time */
778   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE4 ) PORT_TOGGLE
779779INPUT_PORTS_END
780780
781781static const struct gaelcosnd_interface touchgo_snd_interface =
r2864r2865
951951
952952
953953static INPUT_PORTS_START( snowboar )
954PORT_START   /* 1P INPUTS */
954PORT_START_TAG("P1")   /* 1P INPUTS */
955955   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
956956   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
957957   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
961961   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
962962   PORT_BIT( 0xff80, IP_ACTIVE_LOW, IPT_UNKNOWN )
963963
964PORT_START   /* 2P INPUTS */
964PORT_START_TAG("P2")   /* 2P INPUTS */
965965   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
966966   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
967967   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
971971   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
972972   PORT_BIT( 0xff80, IP_ACTIVE_LOW, IPT_UNKNOWN )
973973
974PORT_START   /* COINSW & Service */
974PORT_START_TAG("COIN")   /* COINSW & Service */
975975   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
976976   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
977977   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW)   /* go to service mode NOW */
r2864r2865
11441144
11451145
11461146static INPUT_PORTS_START( wrally2 )
1147PORT_START   /* DIPSW #2 + 1P INPUTS */
1147PORT_START_TAG("IN0")   /* DIPSW #2 + 1P INPUTS */
11481148   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
11491149   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
11501150   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
r2864r2865
11751175   PORT_DIPSETTING(      0x8000, DEF_STR( Hard ) )
11761176   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
11771177
1178PORT_START   /* DIPSW #1 */
1178PORT_START_TAG("IN1")   /* DIPSW #1 */
11791179   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
11801180   PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Free_Play ) )
11811181   PORT_DIPSETTING(    0x0100, DEF_STR( Off ) )
r2864r2865
12021202   PORT_DIPSETTING(      0xa000, DEF_STR( 1C_3C ) )
12031203   PORT_DIPSETTING(      0x2000, DEF_STR( 1C_4C ) )
12041204
1205PORT_START   /* 2P INPUTS */
1205PORT_START_TAG("IN2")   /* 2P INPUTS */
12061206   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
12071207   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
12081208   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
r2864r2865
12151215   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN2 )
12161216   PORT_BIT( 0xfa00, IP_ACTIVE_LOW, IPT_UNKNOWN )
12171217
1218PORT_START   /* SERVICESW */
1218PORT_START_TAG("IN3")   /* SERVICESW */
12191219   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
12201220   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_SERVICE1 )
12211221   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SERVICE3 ) /* go to test mode NOW */
12221222   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_SERVICE2 )
12231223   PORT_BIT( 0xf800, IP_ACTIVE_LOW, IPT_UNKNOWN )
12241224
1225PORT_START   /* Fake: To switch between monitors at run time */
1225PORT_START_TAG("FAKE")   /* Fake: To switch between monitors at run time */
12261226   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SERVICE4 ) PORT_TOGGLE
12271227INPUT_PORTS_END
12281228
src/mame/drivers/homerun.c
r2864r2865
9090static READ8_HANDLER(homerun_40_r)
9191{
9292   if(video_screen_get_vpos(machine->primary_screen)>116)
93      return input_port_read_indexed(machine, 0)|0x40;
93      return input_port_read(machine, "IN0") | 0x40;
9494   else
95      return input_port_read_indexed(machine, 0);
95      return input_port_read(machine, "IN0");
9696}
9797
9898static ADDRESS_MAP_START( homerun_iomap, ADDRESS_SPACE_IO, 8 )
r2864r2865
101101   AM_RANGE(0x20, 0x20) AM_WRITE(SMH_NOP) /* ?? */
102102   AM_RANGE(0x30, 0x33) AM_DEVREADWRITE(PPI8255, "ppi8255", ppi8255_r, ppi8255_w)
103103   AM_RANGE(0x40, 0x40) AM_READ(homerun_40_r)
104   AM_RANGE(0x50, 0x50) AM_READ(input_port_2_r)
105   AM_RANGE(0x60, 0x60) AM_READ(input_port_1_r)
104   AM_RANGE(0x50, 0x50) AM_READ_PORT("IN2")
105   AM_RANGE(0x60, 0x60) AM_READ_PORT("IN1")
106106   AM_RANGE(0x70, 0x70) AM_READWRITE(YM2203_status_port_0_r, YM2203_control_port_0_w)
107107   AM_RANGE(0x71, 0x71) AM_READWRITE(YM2203_read_port_0_r, YM2203_write_port_0_w)
108108ADDRESS_MAP_END
r2864r2865
122122
123123
124124static INPUT_PORTS_START( homerun )
125   PORT_START
125   PORT_START_TAG("IN0")
126126   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1  )
127127   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
128   PORT_DIPSETTING(      0x00, DEF_STR( Off ) )
129   PORT_DIPSETTING(      0x80, DEF_STR( On ) )
128   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
129   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
130130
131   PORT_START
131   PORT_START_TAG("IN1")
132132   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
133133   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  )
134134   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
r2864r2865
136136   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1   )
137137   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 )
138138
139   PORT_START
139   PORT_START_TAG("IN2")
140140   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2  )
141141
142   PORT_START
142   PORT_START_TAG("DSW")
143143   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coin_B ) )
144   PORT_DIPSETTING(      0x00, DEF_STR( 5C_1C ) )
145   PORT_DIPSETTING(      0x01, DEF_STR( 3C_1C ) )
146   PORT_DIPSETTING(      0x02, DEF_STR( 2C_1C ) )
147   PORT_DIPSETTING(      0x03, DEF_STR( Free_Play ) )
144   PORT_DIPSETTING(   0x00, DEF_STR( 5C_1C ) )
145   PORT_DIPSETTING(   0x01, DEF_STR( 3C_1C ) )
146   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
147   PORT_DIPSETTING(   0x03, DEF_STR( Free_Play ) )
148148   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Coin_A ) )
149   PORT_DIPSETTING(      0x80, DEF_STR( 1C_1C ) )
150   PORT_DIPSETTING(      0x00, DEF_STR( 1C_2C ) )
151
149   PORT_DIPSETTING(   0x80, DEF_STR( 1C_1C ) )
150   PORT_DIPSETTING(   0x00, DEF_STR( 1C_2C ) )
152151INPUT_PORTS_END
153152
154153static INPUT_PORTS_START( dynashot )
155   PORT_START
154   PORT_START_TAG("IN0")
156155   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1  )
157156   PORT_BIT( 0xf7, IP_ACTIVE_HIGH, IPT_UNUSED )
158157
159   PORT_START
158   PORT_START_TAG("IN1")
160159   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
161160   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  )
162161   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
r2864r2865
166165   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
167166   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 )
168167
169   PORT_START
168   PORT_START_TAG("IN2")
170169   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2  )
171170   PORT_BIT( 0xdf, IP_ACTIVE_HIGH, IPT_UNUSED )
172171
173   PORT_START
172   PORT_START_TAG("DSW")
174173   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coin_B ) )
175   PORT_DIPSETTING(      0x00, DEF_STR( 5C_1C ) )
176   PORT_DIPSETTING(      0x01, DEF_STR( 3C_1C ) )
177   PORT_DIPSETTING(      0x02, DEF_STR( 2C_1C ) )
178   PORT_DIPSETTING(      0x03, DEF_STR( Free_Play ) )
174   PORT_DIPSETTING(   0x00, DEF_STR( 5C_1C ) )
175   PORT_DIPSETTING(   0x01, DEF_STR( 3C_1C ) )
176   PORT_DIPSETTING(   0x02, DEF_STR( 2C_1C ) )
177   PORT_DIPSETTING(   0x03, DEF_STR( Free_Play ) )
179178   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Coin_A ) )
180   PORT_DIPSETTING(      0x80, DEF_STR( 1C_1C ) )
181   PORT_DIPSETTING(      0x00, DEF_STR( 1C_2C ) )
179   PORT_DIPSETTING(   0x80, DEF_STR( 1C_1C ) )
180   PORT_DIPSETTING(   0x00, DEF_STR( 1C_2C ) )
182181
183
184182   PORT_DIPNAME( 0x7c, 0x7c, "Collisions ?" ) //not all bits
185   PORT_DIPSETTING(      0x00, DEF_STR( Off ) )
186   PORT_DIPSETTING(      0x7c, DEF_STR( On ) )
187
183   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
184   PORT_DIPSETTING(   0x7c, DEF_STR( On ) )
188185INPUT_PORTS_END
189186
190187
r2864r2865
256253
257254GAME( 1988, homerun, 0, homerun, homerun, 0, ROT0, "Jaleco", "Moero Pro Yakyuu Homerun",GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND)
258255GAME( 1988, dynashot, 0, homerun, dynashot, 0, ROT0, "Jaleco", "Dynamic Shooting",GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND)
259
260
src/mame/drivers/guab.c
r2864r2865
2323#include "machine/6840ptm.h"
2424#include "video/tms34061.h"
2525#include "sound/sn76496.h"
26#include "deprecat.h"
2726
2827
2928/*************************************
r2864r2865
239238         UINT8 pen = src[x >> 1];
240239
241240         /* Draw two 4-bit pixels */
242         *dest++ = Machine->pens[pen >> 4];
243         *dest++ = Machine->pens[pen & 0x0f];
241         *dest++ = screen->machine->pens[pen >> 4];
242         *dest++ = screen->machine->pens[pen & 0x0f];
244243      }
245244   }
246245
r2864r2865
546545
547546static READ16_HANDLER( io_r )
548547{
548   static const char *portnames[] = { "IN0", "IN1", "IN2" };
549
549550   switch (offset)
550551   {
551552      case 0x00:
552553      case 0x01:
553554      case 0x02:
554555      {
555         return input_port_read_indexed(machine, offset);
556         return input_port_read(machine, portnames[offset]);
556557      }
557558      case 0x30:
558559      {
r2864r2865
666667 *************************************/
667668
668669static INPUT_PORTS_START( guab )
669   PORT_START
670   PORT_START_TAG("IN0")
670671   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_NAME("50p")
671672   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_NAME("100p")
672673   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Back door")  PORT_CODE(KEYCODE_R) PORT_TOGGLE
r2864r2865
675676   PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_UNUSED )  PORT_NAME("50p level")
676677   PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_UNUSED )  PORT_NAME("100p level")
677678   PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_UNUSED )
678   PORT_START
679
680   PORT_START_TAG("IN1")
679681   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
680682   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
681683   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START )
r2864r2865
684686   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
685687   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A")
686688   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B")
687   PORT_START
689
690   PORT_START_TAG("IN2")
688691   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Select")
689692   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
690693   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2864r2865
696699INPUT_PORTS_END
697700
698701static INPUT_PORTS_START( tenup )
699   PORT_START
702   PORT_START_TAG("IN0")
700703   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_NAME("50p")
701704   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_NAME("100p")
702705   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Back door")  PORT_CODE(KEYCODE_R) PORT_TOGGLE
r2864r2865
705708   PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_UNUSED )  PORT_NAME("10p level")
706709   PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_UNUSED )  PORT_NAME("100p level")
707710   PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_UNUSED )
708   PORT_START
711
712   PORT_START_TAG("IN1")
709713   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
710714   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
711715   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START )
r2864r2865
714718   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
715719   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
716720   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Pass")
717   PORT_START
721
722   PORT_START_TAG("IN2")
718723   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Collect")
719724   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
720725   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
src/mame/drivers/ninjaw.c
r2864r2865
190190***************************************************************************/
191191
192192#include "driver.h"
193#include "deprecat.h"
194193#include "taitoipt.h"
195194#include "cpu/m68000/m68000.h"
196195#include "video/taitoic.h"
r2864r2865
208207
209208static UINT16 cpua_ctrl = 0xff;
210209
211static void parse_control(void)   /* assumes Z80 sandwiched between 68Ks */
210static void parse_control(running_machine *machine)   /* assumes Z80 sandwiched between 68Ks */
212211{
213212   /* bit 0 enables cpu B */
214213   /* however this fails when recovering from a save state
215214       if cpu B is disabled !! */
216   cpunum_set_input_line(Machine, 2, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
215   cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, (cpua_ctrl &0x1) ? CLEAR_LINE : ASSERT_LINE);
217216
218217}
219218
r2864r2865
223222      data = data >> 8;   /* for Wgp */
224223   cpua_ctrl = data;
225224
226   parse_control();
225   parse_control(machine);
227226
228227   logerror("CPU #0 PC %06x: write %04x to cpu control\n",activecpu_get_pc(),data);
229228}
r2864r2865
929928
930929static STATE_POSTLOAD( ninjaw_postload )
931930{
932   parse_control();
931   parse_control(machine);
933932   reset_sound_region();
934933}
935934
src/mame/drivers/dcheese.c
r2864r2865
2929
3030
3131#include "driver.h"
32#include "deprecat.h"
3332#include "machine/eeprom.h"
3433#include "machine/ticket.h"
3534#include "sound/bsmt2000.h"
r2864r2865
8887}
8988
9089
91void dcheese_signal_irq(int which)
90void dcheese_signal_irq(running_machine *machine, int which)
9291{
9392   irq_state[which] = 1;
94   update_irq_state(Machine);
93   update_irq_state(machine);
9594}
9695
9796
9897static INTERRUPT_GEN( dcheese_vblank )
9998{
10099   logerror("---- VBLANK ----\n");
101   dcheese_signal_irq(4);
100   dcheese_signal_irq(machine, 4);
102101}
103102
104103
src/mame/drivers/srmp6.c
r2864r2865
9191   8*64
9292};
9393
94static void update_palette(void)
94static void update_palette(running_machine *machine)
9595{
9696   INT8 r, g ,b;
9797   int brg = brightness - 0x60;
r2864r2865
119119         b += ((0x1F - b) * brg) >> 5;
120120         if(b > 0x1F) b = 0x1F;
121121      }
122      palette_set_color(Machine, i, MAKE_RGB(r << 3, g << 3, b << 3));
122      palette_set_color(machine, i, MAKE_RGB(r << 3, g << 3, b << 3));
123123   }
124124}
125125
r2864r2865
146146
147147/* Debug code */
148148#ifdef UNUSED_FUNCTION
149static void srmp6_decode_charram(void)
149static void srmp6_decode_charram(running_machine *machine)
150150{
151151   if(input_code_pressed_once(KEYCODE_Z))
152152   {
153153      int i;
154154      for (i=0;i<(0x100000*16)/0x40;i++)
155155      {
156         decodechar(Machine->gfx[0], i, (UINT8*)tileram);
156         decodechar(machine->gfx[0], i, (UINT8*)tileram);
157157         dirty_tileram[i] = 0;
158158      }
159159   }
r2864r2865
181181
182182#if 0
183183   /* debug */
184   srmp6_decode_charram();
184   srmp6_decode_charram(screen->machine);
185185
186186
187187
r2864r2865
381381         data = (!data)?0x60:(data == 0x5e)?0x60:data;
382382         if(brightness != data) {
383383            brightness = data;
384            update_palette();
384            update_palette(machine);
385385         }
386386         break;
387387
src/mame/drivers/lsasquad.c
r2864r2865
171171   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
172172   AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK1)
173173   AM_RANGE(0xa000, 0xe5ff) AM_READ(SMH_RAM)
174   AM_RANGE(0xe800, 0xe800) AM_READ(input_port_0_r)   /* DSWA */
175   AM_RANGE(0xe801, 0xe801) AM_READ(input_port_1_r)   /* DSWB */
176   AM_RANGE(0xe802, 0xe802) AM_READ(input_port_2_r)   /* DSWC */
174   AM_RANGE(0xe800, 0xe800) AM_READ_PORT("DSWA")   /* DSWA */
175   AM_RANGE(0xe801, 0xe801) AM_READ_PORT("DSWB")   /* DSWB */
176   AM_RANGE(0xe802, 0xe802) AM_READ_PORT("DSWC")   /* DSWC */
177177   AM_RANGE(0xe803, 0xe803) AM_READ(lsasquad_mcu_status_r)   /* COIN + 68705 status */
178   AM_RANGE(0xe804, 0xe804) AM_READ(input_port_4_r)   /* IN0 */
179   AM_RANGE(0xe805, 0xe805) AM_READ(input_port_5_r)   /* IN1 */
180   AM_RANGE(0xe806, 0xe806) AM_READ(input_port_6_r)   /* START */
181   AM_RANGE(0xe807, 0xe807) AM_READ(input_port_7_r)   /* SERVICE/TILT */
178   AM_RANGE(0xe804, 0xe804) AM_READ_PORT("IN0")   /* IN0 */
179   AM_RANGE(0xe805, 0xe805) AM_READ_PORT("IN1")   /* IN1 */
180   AM_RANGE(0xe806, 0xe806) AM_READ_PORT("IN2")   /* START */
181   AM_RANGE(0xe807, 0xe807) AM_READ_PORT("IN3")   /* SERVICE/TILT */
182182   AM_RANGE(0xec00, 0xec00) AM_READ(lsasquad_sound_result_r)
183183   AM_RANGE(0xec01, 0xec01) AM_READ(lsasquad_sound_status_r)
184184   AM_RANGE(0xee00, 0xee00) AM_READ(lsasquad_mcu_r)
src/mame/drivers/fuukifg3.c
r2864r2865
218218
219219***************************************************************************/
220220
221static const char *portnames[] = { "IN0", "IN1", "DSW0", "DSW1" };
221222
222223#define FUUKI32_INPUT( _N_ ) \
223224\
224225static READ32_HANDLER( io32_##_N_##_r ) \
225226{ \
226   return (input_port_read_indexed(machine, _N_ ) << 16) | input_port_read_indexed(machine, _N_ ); \
227   return (input_port_read(machine, portnames[ _N_ ]) << 16) | input_port_read(machine, portnames[ _N_ ]); \
227228}
228229
229230FUUKI32_INPUT( 0 ) /* $800000.l Coins Inputs */
r2864r2865
387388***************************************************************************/
388389
389390static INPUT_PORTS_START( asurabld )
390   PORT_START   // IN0 - $800000.w/$800002.w
391   PORT_START_TAG("IN0")   // IN0 - $800000.w/$800002.w
391392   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
392393   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
393394   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
r2864r2865
399400   PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_SERVICE1 )
400401   PORT_BIT(  0xfe00, IP_ACTIVE_LOW, IPT_UNKNOWN  )
401402
402   PORT_START   // IN1 - $810000.w/$810002.w
403   PORT_START_TAG("IN1")   // IN1 - $810000.w/$810002.w
403404   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
404405   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
405406   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
r2864r2865
417418   PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
418419   PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN                      )
419420
420   PORT_START   // IN2 - $880000.w/$880002.w
421   PORT_START_TAG("DSW0")   // IN2 - $880000.w/$880002.w
421422   PORT_SERVICE( 0x0001, 0x0001 )
422423   PORT_DIPNAME( 0x0002, 0x0002, "Blood Colour" ) // Any other censorship? (Tested in 3 locations)
423424   PORT_DIPSETTING(      0x0002, "Red" )
r2864r2865
438439   PORT_DIPSETTING(      0x0000, "Joint" )
439440   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
440441
441   PORT_START   // IN3 - $890000.w/$890002.w
442   PORT_START_TAG("DSW1")   // IN3 - $890000.w/$890002.w
442443   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )
443444   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
444445   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
src/mame/drivers/dec8.c
r2864r2865
118118{
119119   switch (offset) {
120120      case 0: /* Rotary low byte */
121         return ~((1 << (input_port_read_indexed(machine, 5) * 12 / 256))&0xff);
121         return ~((1 << (input_port_read(machine, "AN0") * 12 / 256))&0xff);
122122      case 1: /* Joystick = bottom 4 bits, rotary = top 4 */
123         return ((~((1 << (input_port_read_indexed(machine, 5) * 12 / 256))>>4))&0xf0) | (input_port_read_indexed(machine, 0)&0xf);
123         return ((~((1 << (input_port_read(machine, "AN0") * 12 / 256))>>4))&0xf0) | (input_port_read(machine, "IN0") & 0xf);
124124   }
125125   return 0xff;
126126}
r2864r2865
129129{
130130   switch (offset) {
131131      case 0: /* Rotary low byte */
132         return ~((1 << (input_port_read_indexed(machine, 6) * 12 / 256))&0xff);
132         return ~((1 << (input_port_read(machine, "AN1") * 12 / 256))&0xff);
133133      case 1: /* Joystick = bottom 4 bits, rotary = top 4 */
134         return ((~((1 << (input_port_read_indexed(machine, 6) * 12 / 256))>>4))&0xf0) | (input_port_read_indexed(machine, 1)&0xf);
134         return ((~((1 << (input_port_read(machine, "AN1") * 12 / 256))>>4))&0xf0) | (input_port_read(machine, "IN1") & 0xf);
135135   }
136136   return 0xff;
137137}
r2864r2865
177177    if (i8751_value==0x5000) i8751_return=((coins / 10) << 4) | (coins % 10); /* Coin request */
178178    if (i8751_value==0x6000) {i8751_value=-1; coins--; } /* Coin clear */
179179   /* Nb:  Command 0x4000 for setting coinage options is not supported */
180    if ((input_port_read_indexed(machine, 4)&1)==1) latch=1;
181    if ((input_port_read_indexed(machine, 4)&1)!=1 && latch) {coins++; latch=0;}
180    if ((input_port_read(machine, "FAKE") & 1) == 1) latch=1;
181    if ((input_port_read(machine, "FAKE") & 1) != 1 && latch) {coins++; latch=0;}
182182
183183   /* This next value is the index to a series of tables,
184184    each table controls the end of level bad guy, wrong values crash the
r2864r2865
245245   }
246246
247247   /* Coins are controlled by the i8751 */
248    if ((input_port_read_indexed(machine, 4)&3)==3) latch=1;
249    if ((input_port_read_indexed(machine, 4)&1)!=1 && latch) {coin1++; snd=1; latch=0;}
250    if ((input_port_read_indexed(machine, 4)&2)!=2 && latch) {coin2++; snd=1; latch=0;}
248    if ((input_port_read(machine, "I8751") & 3) == 3) latch=1;
249    if ((input_port_read(machine, "I8751") & 1) != 1 && latch) {coin1++; snd=1; latch=0;}
250    if ((input_port_read(machine, "I8751") & 2) != 2 && latch) {coin2++; snd=1; latch=0;}
251251
252252   /* Work out return values */
253253   if (i8751_value==0x0000) {i8751_return=0; coin1=coin2=snd=0;}
r2864r2865
278278   }
279279
280280   /* Coins are controlled by the i8751 */
281    if (/*(input_port_read_indexed(machine, 2)&3)==3*/!latch) {latch=1;coin1=coin2=0;}
282    if ((input_port_read_indexed(machine, 2)&1)!=1 && latch) {coin1=1; latch=0;}
283    if ((input_port_read_indexed(machine, 2)&2)!=2 && latch) {coin2=1; latch=0;}
281    if (/*(input_port_read(machine, "IN2") & 3) == 3*/!latch) {latch=1;coin1=coin2=0;}
282    if ((input_port_read(machine, "IN2") & 1) != 1 && latch) {coin1=1; latch=0;}
283    if ((input_port_read(machine, "IN2") & 2) != 2 && latch) {coin2=1; latch=0;}
284284
285285   if (i8751_value==0x0050) i8751_return=0; /* Breywood ID */
286286   if (i8751_value==0x0051) i8751_return=0; /* Shackled ID */
r2864r2865
308308   if(offset==0)
309309   {
310310      /* Coins are controlled by the i8751 */
311       if ((input_port_read_indexed(machine, 2)&3)==3 && !latch) latch=1;
312       if ((input_port_read_indexed(machine, 2)&3)!=3 && latch) {coin++; latch=0;snd=0x400;i8751_return=0x400;return;}
311       if ((input_port_read(machine, "IN2") & 3) == 3 && !latch) latch=1;
312       if ((input_port_read(machine, "IN2") & 3) != 3 && latch) {coin++; latch=0;snd=0x400;i8751_return=0x400;return;}
313313      if (i8751_value==0x007a) i8751_return=0x0185; /* Japan ID code */
314314      if (i8751_value==0x007b) i8751_return=0x0184; /* USA ID code */
315315      if (i8751_value==0x0001) {coin=snd=0;}//???
r2864r2865
339339   if(offset==0)
340340   {
341341      /* Coins are controlled by the i8751 */
342       if ((input_port_read_indexed(machine, 2)&3)==3 && !latch) latch=1;
343       if ((input_port_read_indexed(machine, 2)&3)!=3 && latch) {coin++; latch=0;snd=0x1200; i8751_return=0x1200;return;}
342       if ((input_port_read(machine, "IN2") & 3) == 3 && !latch) latch=1;
343       if ((input_port_read(machine, "IN2") & 3) != 3 && latch) {coin++; latch=0; snd=0x1200; i8751_return=0x1200;return;}
344344
345345      if (i8751_value==0x054a) {i8751_return=~(0x4a); coin=0; snd=0;} /* Captain Silver (Japan) ID */
346346      if (i8751_value==0x054c) {i8751_return=~(0x4c); coin=0; snd=0;} /* Captain Silver (World) ID */
r2864r2865
365365   }
366366
367367   /* Coins are controlled by the i8751 */
368    if ((input_port_read_indexed(machine, 2)&3)==3) latch=1;
369    if ((input_port_read_indexed(machine, 2)&1)!=1 && latch) {coin1++; latch=0;}
370    if ((input_port_read_indexed(machine, 2)&2)!=2 && latch) {coin2++; latch=0;}
368    if ((input_port_read(machine, "I8751") & 3) == 3) latch=1;
369    if ((input_port_read(machine, "I8751") & 1) != 1 && latch) {coin1++; latch=0;}
370    if ((input_port_read(machine, "I8751") & 2) != 2 && latch) {coin2++; latch=0;}
371371
372372   /* Work out return values */
373373   if ((i8751_value>>8)==0x00) {i8751_return=0; coin1=coin2=0;}
r2864r2865
542542   AM_RANGE(0x1000, 0x17ff) AM_READ(dec8_pf1_data_r)
543543   AM_RANGE(0x1800, 0x2fff) AM_READ(SMH_RAM)
544544   AM_RANGE(0x3000, 0x31ff) AM_READ(SMH_RAM)
545   AM_RANGE(0x3800, 0x3800) AM_READ(input_port_0_r) /* Player 1 */
546   AM_RANGE(0x3801, 0x3801) AM_READ(input_port_1_r) /* Player 2 */
547   AM_RANGE(0x3802, 0x3802) AM_READ(input_port_3_r) /* Dip 1 */
548   AM_RANGE(0x3803, 0x3803) AM_READ(input_port_4_r) /* Dip 2 */
549   AM_RANGE(0x3a00, 0x3a00) AM_READ(input_port_2_r) /* VBL & coins */
545   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("IN0")   /* Player 1 */
546   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("IN1")   /* Player 2 */
547   AM_RANGE(0x3802, 0x3802) AM_READ_PORT("DSW0")   /* Dip 1 */
548   AM_RANGE(0x3803, 0x3803) AM_READ_PORT("DSW1")   /* Dip 2 */
549   AM_RANGE(0x3a00, 0x3a00) AM_READ_PORT("IN2")   /* VBL & coins */
550550   AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
551551   AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
552552ADDRESS_MAP_END
r2864r2865
574574   AM_RANGE(0x2000, 0x27ff) AM_READ(dec8_pf0_data_r)
575575   AM_RANGE(0x2800, 0x2dff) AM_READ(SMH_RAM)
576576   AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM)
577   AM_RANGE(0x3800, 0x3800) AM_READ(input_port_0_r) /* Player 1 */
578   AM_RANGE(0x3801, 0x3801) AM_READ(input_port_1_r) /* Player 2 */
579   AM_RANGE(0x3802, 0x3802) AM_READ(input_port_2_r) /* Player 3 */
580   AM_RANGE(0x3803, 0x3803) AM_READ(input_port_3_r) /* Start buttons + VBL */
581   AM_RANGE(0x3820, 0x3820) AM_READ(input_port_5_r) /* Dip */
577   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("IN0")   /* Player 1 */
578   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("IN1")   /* Player 2 */
579   AM_RANGE(0x3802, 0x3802) AM_READ_PORT("IN2")   /* Player 3 */
580   AM_RANGE(0x3803, 0x3803) AM_READ_PORT("DSW0")   /* Start buttons + VBL */
581   AM_RANGE(0x3820, 0x3820) AM_READ_PORT("DSW1")   /* Dip */
582582   AM_RANGE(0x3840, 0x3840) AM_READ(i8751_h_r)
583583   AM_RANGE(0x3860, 0x3860) AM_READ(i8751_l_r)
584584   AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
r2864r2865
606606   AM_RANGE(0x1400, 0x17ff) AM_READ(dec8_pf0_data_r)
607607   AM_RANGE(0x2000, 0x2000) AM_READ(i8751_h_r)
608608   AM_RANGE(0x2001, 0x2001) AM_READ(i8751_l_r)
609   AM_RANGE(0x3800, 0x3800) AM_READ(input_port_2_r) /* Dip 1 */
610   AM_RANGE(0x3801, 0x3801) AM_READ(input_port_0_r) /* Player 1 */
611   AM_RANGE(0x3802, 0x3802) AM_READ(input_port_1_r) /* Player 2 (cocktail) + VBL */
612   AM_RANGE(0x3803, 0x3803) AM_READ(input_port_3_r) /* Dip 2 */
609   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("DSW0")   /* Dip 1 */
610   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("IN0")   /* Player 1 */
611   AM_RANGE(0x3802, 0x3802) AM_READ_PORT("IN1")   /* Player 2 (cocktail) + VBL */
612   AM_RANGE(0x3803, 0x3803) AM_READ_PORT("DSW1")   /* Dip 2 */
613613   AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
614614   AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
615615ADDRESS_MAP_END
r2864r2865
638638   AM_RANGE(0x2000, 0x27ff) AM_READ(dec8_pf0_data_r)
639639   AM_RANGE(0x2800, 0x2bff) AM_READ(SMH_RAM)
640640   AM_RANGE(0x2c00, 0x2fff) AM_READ(SMH_RAM)
641   AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM)          /* Sprites */
642   AM_RANGE(0x3800, 0x3800) AM_READ(input_port_7_r)   /* Dip 1 */
643   AM_RANGE(0x3801, 0x3801) AM_READ(input_port_8_r)   /* Dip 2 */
644   AM_RANGE(0x380a, 0x380b) AM_READ(gondo_player_1_r) /* Player 1 rotary */
645   AM_RANGE(0x380c, 0x380d) AM_READ(gondo_player_2_r) /* Player 2 rotary */
646   AM_RANGE(0x380e, 0x380e) AM_READ(input_port_3_r)   /* VBL */
647   AM_RANGE(0x380f, 0x380f) AM_READ(input_port_2_r)   /* Fire buttons */
641   AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM)         /* Sprites */
642   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("DSW0")      /* Dip 1 */
643   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("DSW1")      /* Dip 2 */
644   AM_RANGE(0x380a, 0x380b) AM_READ(gondo_player_1_r)   /* Player 1 rotary */
645   AM_RANGE(0x380c, 0x380d) AM_READ(gondo_player_2_r)   /* Player 2 rotary */
646   AM_RANGE(0x380e, 0x380e) AM_READ_PORT("IN3")      /* VBL */
647   AM_RANGE(0x380f, 0x380f) AM_READ_PORT("IN2")      /* Fire buttons */
648648   AM_RANGE(0x3838, 0x3838) AM_READ(i8751_h_r)
649649   AM_RANGE(0x3839, 0x3839) AM_READ(i8751_l_r)
650650   AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
r2864r2865
671671   AM_RANGE(0x1000, 0x1fff) AM_READ(SMH_RAM) AM_SHARE(2)
672672   AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM)
673673   AM_RANGE(0x2800, 0x2fff) AM_READ(dec8_pf0_data_r)
674   AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM) /* Sprites */
674   AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM)      /* Sprites */
675675   AM_RANGE(0x3800, 0x3bff) AM_READ(SMH_RAM)
676   AM_RANGE(0x3c00, 0x3c00) AM_READ(input_port_0_r)
677   AM_RANGE(0x3c01, 0x3c01) AM_READ(input_port_1_r)
678   AM_RANGE(0x3c02, 0x3c02) AM_READ(input_port_2_r) /* VBL & coins */
679   AM_RANGE(0x3c03, 0x3c03) AM_READ(input_port_3_r) /* Dip 1 */
680   AM_RANGE(0x3c04, 0x3c04) AM_READ(input_port_4_r)
676   AM_RANGE(0x3c00, 0x3c00) AM_READ_PORT("IN0")
677   AM_RANGE(0x3c01, 0x3c01) AM_READ_PORT("IN1")
678   AM_RANGE(0x3c02, 0x3c02) AM_READ_PORT("IN2")   /* VBL & coins */
679   AM_RANGE(0x3c03, 0x3c03) AM_READ_PORT("DSW0")   /* Dip 1 */
680   AM_RANGE(0x3c04, 0x3c04) AM_READ_PORT("DSW1")
681681   AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
682682   AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
683683ADDRESS_MAP_END
r2864r2865
718718   AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM) AM_SHARE(1)
719719   AM_RANGE(0x1000, 0x13ff) AM_READ(SMH_RAM) AM_SHARE(3)
720720   AM_RANGE(0x1400, 0x17ff) AM_READ(SMH_RAM) AM_SHARE(4)
721   AM_RANGE(0x1800, 0x1800) AM_READ(input_port_0_r)
722   AM_RANGE(0x1801, 0x1801) AM_READ(input_port_1_r)
723   AM_RANGE(0x1802, 0x1802) AM_READ(input_port_2_r)
724   AM_RANGE(0x1803, 0x1803) AM_READ(input_port_3_r) /* Dip 1 */
725   AM_RANGE(0x1804, 0x1804) AM_READ(input_port_4_r) /* Dip 2 */
721   AM_RANGE(0x1800, 0x1800) AM_READ_PORT("IN0")
722   AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN1")
723   AM_RANGE(0x1802, 0x1802) AM_READ_PORT("IN2")
724   AM_RANGE(0x1803, 0x1803) AM_READ_PORT("DSW0")   /* Dip 1 */
725   AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1")   /* Dip 2 */
726726   AM_RANGE(0x1806, 0x1806) AM_READ(i8751_h_r)
727727   AM_RANGE(0x1807, 0x1807) AM_READ(i8751_l_r)
728728   AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM)
r2864r2865
756756   AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM) AM_SHARE(1)
757757   AM_RANGE(0x1000, 0x13ff) AM_READ(SMH_RAM) AM_SHARE(3)
758758   AM_RANGE(0x1400, 0x17ff) AM_READ(SMH_RAM) AM_SHARE(4)
759   AM_RANGE(0x1800, 0x1800) AM_READ(input_port_0_r)
760   AM_RANGE(0x1801, 0x1801) AM_READ(input_port_1_r)
761   AM_RANGE(0x1802, 0x1802) AM_READ(input_port_2_r)
762   AM_RANGE(0x1803, 0x1803) AM_READ(input_port_3_r) /* Dip 1 */
763   AM_RANGE(0x1804, 0x1804) AM_READ(input_port_4_r) /* Dip 2 */
759   AM_RANGE(0x1800, 0x1800) AM_READ_PORT("IN0")
760   AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN1")
761   AM_RANGE(0x1802, 0x1802) AM_READ_PORT("IN2")
762   AM_RANGE(0x1803, 0x1803) AM_READ_PORT("DSW0")   /* Dip 1 */
763   AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1")   /* Dip 2 */
764764   AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM)
765765   AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM) AM_SHARE(2)
766766   AM_RANGE(0x3800, 0x3fff) AM_READ(dec8_pf0_data_r)
r2864r2865
786786   AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM) AM_SHARE(1)
787787   AM_RANGE(0x1000, 0x13ff) AM_READ(SMH_RAM) AM_SHARE(3)
788788   AM_RANGE(0x1400, 0x17ff) AM_READ(SMH_RAM) AM_SHARE(4)
789   AM_RANGE(0x1800, 0x1800) AM_READ(input_port_0_r)
790   AM_RANGE(0x1801, 0x1801) AM_READ(input_port_1_r)
791   AM_RANGE(0x1802, 0x1802) AM_READ(input_port_2_r)
792   AM_RANGE(0x1803, 0x1803) AM_READ(input_port_3_r)
793   AM_RANGE(0x1804, 0x1804) AM_READ(input_port_4_r)
789   AM_RANGE(0x1800, 0x1800) AM_READ_PORT("IN0")
790   AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN1")
791   AM_RANGE(0x1802, 0x1802) AM_READ_PORT("IN2")
792   AM_RANGE(0x1803, 0x1803) AM_READ_PORT("DSW0")
793   AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1")
794794   AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM)
795795   AM_RANGE(0x2800, 0x2fff) AM_READ(shackled_sprite_r)
796796   AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM) AM_SHARE(2)
r2864r2865
821821   AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM) AM_SHARE(1)
822822   AM_RANGE(0x1000, 0x13ff) AM_READ(SMH_RAM) AM_SHARE(3)
823823   AM_RANGE(0x1400, 0x17ff) AM_READ(SMH_RAM) AM_SHARE(4)
824   AM_RANGE(0x1800, 0x1800) AM_READ(input_port_0_r)
825   AM_RANGE(0x1801, 0x1801) AM_READ(input_port_1_r)
826   AM_RANGE(0x1802, 0x1802) AM_READ(input_port_2_r)
827   AM_RANGE(0x1803, 0x1803) AM_READ(input_port_3_r)
828   AM_RANGE(0x1804, 0x1804) AM_READ(input_port_4_r)
824   AM_RANGE(0x1800, 0x1800) AM_READ_PORT("IN0")
825   AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN1")
826   AM_RANGE(0x1802, 0x1802) AM_READ_PORT("IN2")
827   AM_RANGE(0x1803, 0x1803) AM_READ_PORT("DSW0")
828   AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1")
829829   AM_RANGE(0x1806, 0x1806) AM_READ(i8751_h_r)
830830   AM_RANGE(0x1807, 0x1807) AM_READ(i8751_l_r)
831831   AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM)
r2864r2865
858858   AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM) AM_SHARE(1)
859859   AM_RANGE(0x1000, 0x13ff) AM_READ(SMH_RAM) AM_SHARE(3)
860860   AM_RANGE(0x1400, 0x17ff) AM_READ(SMH_RAM) AM_SHARE(4)
861   AM_RANGE(0x1800, 0x1800) AM_READ(input_port_1_r)
862   AM_RANGE(0x1801, 0x1801) AM_READ(input_port_0_r)
863   AM_RANGE(0x1803, 0x1803) AM_READ(input_port_2_r)
864   AM_RANGE(0x1804, 0x1804) AM_READ(input_port_4_r) /* Dip 2 */
865   AM_RANGE(0x1805, 0x1805) AM_READ(input_port_3_r) /* Dip 1 */
861   AM_RANGE(0x1800, 0x1800) AM_READ_PORT("IN1")
862   AM_RANGE(0x1801, 0x1801) AM_READ_PORT("IN0")
863   AM_RANGE(0x1803, 0x1803) AM_READ_PORT("IN2")
864   AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1")   /* Dip 2 */
865   AM_RANGE(0x1805, 0x1805) AM_READ_PORT("DSW0")   /* Dip 1 */
866866   AM_RANGE(0x1c00, 0x1c00) AM_READ(i8751_h_r)
867867   AM_RANGE(0x1e00, 0x1e00) AM_READ(i8751_l_r)
868868   AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM)
r2864r2865
895895   AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM) AM_SHARE(1)
896896   AM_RANGE(0x1000, 0x13ff) AM_READ(SMH_RAM) AM_SHARE(3)
897897   AM_RANGE(0x1400, 0x17ff) AM_READ(SMH_RAM) AM_SHARE(4)
898   AM_RANGE(0x1803, 0x1803) AM_READ(input_port_2_r)
899   AM_RANGE(0x1804, 0x1804) AM_READ(input_port_4_r)
900   AM_RANGE(0x1805, 0x1805) AM_READ(input_port_3_r)
898   AM_RANGE(0x1803, 0x1803) AM_READ_PORT("IN2")
899   AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1")
900   AM_RANGE(0x1805, 0x1805) AM_READ_PORT("DSW0")
901901   AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM)
902902   AM_RANGE(0x2800, 0x2fff) AM_READ(SMH_RAM)
903903   AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM) AM_SHARE(2)
r2864r2865
925925   AM_RANGE(0x2000, 0x27ff) AM_READ(dec8_pf0_data_r)
926926   AM_RANGE(0x2800, 0x2bff) AM_READ(SMH_RAM)
927927   AM_RANGE(0x2c00, 0x2fff) AM_READ(SMH_RAM)
928   AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM)          /* Sprites */
929   AM_RANGE(0x3800, 0x3800) AM_READ(input_port_3_r)   /* Dip 1 */
930   AM_RANGE(0x3801, 0x3801) AM_READ(input_port_4_r)   /* Dip 2 */
931   AM_RANGE(0x3808, 0x3808) AM_READ(SMH_NOP)          /* ? */
932   AM_RANGE(0x380a, 0x380a) AM_READ(input_port_1_r)   /* Player 2 + VBL */
933   AM_RANGE(0x380b, 0x380b) AM_READ(input_port_0_r)   /* Player 1 */
928   AM_RANGE(0x3000, 0x37ff) AM_READ(SMH_RAM)      /* Sprites */
929   AM_RANGE(0x3800, 0x3800) AM_READ_PORT("DSW0")   /* Dip 1 */
930   AM_RANGE(0x3801, 0x3801) AM_READ_PORT("DSW1")   /* Dip 2 */
931   AM_RANGE(0x3808, 0x3808) AM_READ(SMH_NOP)      /* ? */
932   AM_RANGE(0x380a, 0x380a) AM_READ_PORT("IN1")   /* Player 2 + VBL */
933   AM_RANGE(0x380b, 0x380b) AM_READ_PORT("IN0")   /* Player 1 */
934934   AM_RANGE(0x383a, 0x383a) AM_READ(i8751_h_r)
935935   AM_RANGE(0x383b, 0x383b) AM_READ(i8751_l_r)
936936   AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
r2864r2865
11461146   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
11471147   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
11481148
1149   PORT_START_TAG("I8571")   /* Dummy input for i8751 */
1149   PORT_START_TAG("I8751")   /* Dummy input for i8751 */
11501150   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN4 )
11511151   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN3 )
11521152   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r2864r2865
20452045static INTERRUPT_GEN( ghostb_interrupt )
20462046{
20472047   static int latch[4];
2048   int i8751_out=input_port_read_indexed(machine, 4);
2048   int i8751_out=input_port_read(machine, "I8751");
20492049
20502050   /* Ghostbusters coins are controlled by the i8751 */
20512051   if ((i8751_out & 0x8) == 0x8) latch[0]=1;
r2864r2865
20722072{
20732073   static int latch=1;
20742074
2075   if ((input_port_read_indexed(machine, 2) & 0x7) == 0x7) latch=1;
2076   if (latch && (input_port_read_indexed(machine, 2) & 0x7) != 0x7) {
2075   if ((input_port_read(machine, "IN2") & 0x7) == 0x7) latch=1;
2076   if (latch && (input_port_read(machine, "IN2") & 0x7) != 0x7) {
20772077      latch=0;
20782078       cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
20792079    }
src/mame/drivers/genesis.c
r2864r2865
444444
445445UINT16 *genesis_io_ram;
446446
447READ16_HANDLER ( genesis_io_r )
448{
449   /* 8-bit only, data is mirrored in both halves */
450
451   UINT8 return_value = 0;
452
453   switch (offset)
454   {
455      case 0:
456      /* Charles MacDonald ( http://cgfm2.emuviews.com/ )
457            D7 : Console is 1= Export (USA, Europe, etc.) 0= Domestic (Japan)
458            D6 : Video type is 1= PAL, 0= NTSC
459            D5 : Sega CD unit is 1= not present, 0= connected.
460            D4 : Unused (always returns zero)
461            D3 : Bit 3 of version number
462            D2 : Bit 2 of version number
463            D1 : Bit 1 of version number
464            D0 : Bit 0 of version number
465        */
466         return_value = 0x80; /* ? megatech is usa? */
467         break;
468
469      case 1: /* port A data (joypad 1) */
470
471         if (genesis_io_ram[offset] & 0x40)
472         {
473            int iport = input_port_read_indexed(machine, 9);
474            return_value = iport & 0x3f;
475         }
476         else
477         {
478            int iport1 = input_port_read_indexed(machine, 12);
479            int iport2 = input_port_read_indexed(machine, 7) >> 1;
480            return_value = (iport1 & 0x10) + (iport2 & 0x20);
481            if(iport1 & 0x10 || iport2 & 0x20)
482               return_value+=1;
483         }
484
485         return_value = (genesis_io_ram[offset] & 0x80) | return_value;
486//          logerror ("reading joypad 1 , type %02x %02x\n",genesis_io_ram[offset] & 0x80, return_value &0x7f);
487         if(bios_ctrl_inputs & 0x04) return_value = 0xff;
488         break;
489
490      case 2: /* port B data (joypad 2) */
491
492         if (genesis_io_ram[offset] & 0x40)
493         {
494            int iport1 = (input_port_read_indexed(machine, 9) & 0xc0) >> 6;
495            int iport2 = (input_port_read_indexed(machine, 8) & 0x0f) << 2;
496            return_value = (iport1 + iport2) & 0x3f;
497         }
498         else
499         {
500            int iport1 = input_port_read_indexed(machine, 12) << 2;
501            int iport2 = input_port_read_indexed(machine, 7) >> 2;
502            return_value = (iport1 & 0x10) + (iport2 & 0x20);
503            if(iport1 & 0x10 || iport2 & 0x20)
504               return_value+=1;
505         }
506         return_value = (genesis_io_ram[offset] & 0x80) | return_value;
507//          logerror ("reading joypad 2 , type %02x %02x\n",genesis_io_ram[offset] & 0x80, return_value &0x7f);
508         if(bios_ctrl_inputs & 0x04) return_value = 0xff;
509         break;
510
511      default:
512         return_value = 0xe0;
513
514   }
515   return return_value | return_value << 8;
516}
517
518READ16_HANDLER ( megaplay_genesis_io_r )
519{
520   /* 8-bit only, data is mirrored in both halves */
521
522   UINT8 return_value = 0;
523
524   switch (offset)
525   {
526      case 0:
527      /* Charles MacDonald ( http://cgfm2.emuviews.com/ )
528            D7 : Console is 1= Export (USA, Europe, etc.) 0= Domestic (Japan)
529            D6 : Video type is 1= PAL, 0= NTSC
530            D5 : Sega CD unit is 1= not present, 0= connected.
531            D4 : Unused (always returns zero)
532            D3 : Bit 3 of version number
533            D2 : Bit 2 of version number
534            D1 : Bit 1 of version number
535            D0 : Bit 0 of version number
536        */
537         return_value = 0x80; /* ? megatech is usa? */
538         break;
539
540      case 1: /* port A data (joypad 1) */
541
542         if (genesis_io_ram[offset] & 0x40)
543            return_value = input_port_read_indexed(machine, 1) & (genesis_io_ram[4]^0xff);
544         else
545         {
546            return_value = input_port_read_indexed(machine, 2) & (genesis_io_ram[4]^0xff);
547            return_value |= input_port_read_indexed(machine, 1) & 0x03;
548         }
549         return_value = (genesis_io_ram[offset] & 0x80) | return_value;
550//          logerror ("reading joypad 1 , type %02x %02x\n",genesis_io_ram[offset] & 0xb0, return_value &0x7f);
551         break;
552
553      case 2: /* port B data (joypad 2) */
554
555         if (genesis_io_ram[offset] & 0x40)
556            return_value = input_port_read_indexed(machine, 3) & (genesis_io_ram[5]^0xff);
557         else
558         {
559            return_value = input_port_read_indexed(machine, 4) & (genesis_io_ram[5]^0xff);
560            return_value |= input_port_read_indexed(machine, 3) & 0x03;
561         }
562         return_value = (genesis_io_ram[offset] & 0x80) | return_value;
563//          logerror ("reading joypad 2 , type %02x %02x\n",genesis_io_ram[offset] & 0xb0, return_value &0x7f);
564         break;
565
566//      case 3: /* port C data */
567//          return_value = bios_6402 << 3;
568//          break;
569
570   default:
571         return_value = genesis_io_ram[offset];
572
573   }
574   return return_value | return_value << 8;
575}
576
447/* This handler is still used in hshavoc.c & topshoot.c ;   */
448/* megaplay.c uses a local copy 'OLD_megaplay_genesis_io_w' */
577449WRITE16_HANDLER ( genesis_io_w )
578450{
579451//  logerror ("write io offset :%02x data %04x PC: 0x%06x\n",offset,data,activecpu_get_previouspc());
src/mame/drivers/triplhnt.c
r2864r2865
1111***************************************************************************/
1212
1313#include "driver.h"
14#include "deprecat.h"
1514#include "triplhnt.h"
1615
1716static UINT8 triplhnt_cmos[16];
r2864r2865
2827}
2928
3029
31void triplhnt_set_collision(int code)
30void triplhnt_set_collision(running_machine *machine, int code)
3231{
3332   triplhnt_hit_code = code;
3433
35   cpunum_set_input_line(Machine, 0, 0, HOLD_LINE);
34   cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
3635}
3736
3837
src/mame/drivers/starwars.c
r2864r2865
570570   generic_nvram = auto_malloc(generic_nvram_size);
571571
572572   /* init the slapstic */
573   slapstic_init(101);
573   slapstic_init(machine, 101);
574574   slapstic_source = &memory_region(REGION_CPU1)[0x14000];
575575   slapstic_base = &memory_region(REGION_CPU1)[0x08000];
576576
src/mame/drivers/exerion.c
r2864r2865
3131static READ8_HANDLER( exerion_port01_r )
3232{
3333   /* the cocktail flip bit muxes between ports 0 and 1 */
34   return exerion_cocktail_flip ? input_port_read_indexed(machine, 1) : input_port_read_indexed(machine, 0);
34   return exerion_cocktail_flip ? input_port_read(machine, "IN1") : input_port_read(machine, "IN0");
3535}
3636
3737
r2864r2865
9595   AM_RANGE(0x8800, 0x887f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
9696   AM_RANGE(0x8800, 0x8bff) AM_RAM
9797   AM_RANGE(0xa000, 0xa000) AM_READ(exerion_port01_r)
98   AM_RANGE(0xa800, 0xa800) AM_READ(input_port_2_r)
99   AM_RANGE(0xb000, 0xb000) AM_READ(input_port_3_r)
98   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("DSW0")
99   AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW1")
100100   AM_RANGE(0xc000, 0xc000) AM_WRITE(exerion_videoreg_w)
101101   AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
102102   AM_RANGE(0xd000, 0xd000) AM_WRITE(AY8910_control_port_0_w)
src/mame/drivers/segas18.c
r2864r2865
7676 *************************************/
7777
7878extern void fd1094_machine_init(void);
79extern void fd1094_driver_init(void (*set_decrypted)(UINT8 *));
79extern void fd1094_driver_init(running_machine *machine, void (*set_decrypted)(UINT8 *));
8080
8181static READ16_HANDLER( misc_io_r );
8282static WRITE16_HANDLER( misc_io_w );
r2864r2865
176176   segaic16_memory_mapper_init(machine, 0, region_info_list[rom_board], sound_w, sound_r);
177177
178178   /* init the FD1094 */
179   fd1094_driver_init(segaic16_memory_mapper_set_decrypted);
179   fd1094_driver_init(machine, segaic16_memory_mapper_set_decrypted);
180180
181181   /* reset the custom handlers and other pointers */
182182   custom_io_r = NULL;
r2864r2865
218218
219219static READ16_HANDLER( io_chip_r )
220220{
221   static const char *portnames[] = { "P1", "P2", "PORTC", "PORTD", "SERVICE", "COINAGE", "DSW", "PORTH" };
221222   offset &= 0x1f/2;
222223
223224   switch (offset)
r2864r2865
236237            return misc_io_data[offset];
237238
238239         /* otherwise, return an input port */
239         return input_port_read_indexed(machine, offset);
240         return input_port_read(machine, portnames[offset]);
240241
241242      /* 'SEGA' protection */
242243      case 0x10/2:
r2864r2865
320321
321322static READ16_HANDLER( misc_io_r )
322323{
324   static const char *portnames[] = { "SERVICE", "COINAGE" };
325
323326   offset &= 0x1fff;
327
324328   switch (offset & (0x3000/2))
325329   {
326330      /* I/O chip */
r2864r2865
330334
331335      /* video control latch */
332336      case 0x2000/2:
333         return input_port_read_indexed(machine, 4 + (offset & 1));
337         return input_port_read(machine, portnames[offset & 1]);
334338   }
335339   if (custom_io_r)
336340      return custom_io_r(machine, offset, mem_mask);
r2864r2865
13261330/**************************************************************************************************************************
13271331 **************************************************************************************************************************
13281332 **************************************************************************************************************************
1329    Alien Storm (2 players version), Sega System 18
1330    CPU: FD1094 (317-????)
1333    Alien Storm (2 players World version), Sega System 18
1334    CPU: FD1094 (317-0154)
13311335    ROM Board: 171-5873B
13321336*/
13331337ROM_START( astorm )
13341338   ROM_REGION( 0x080000, REGION_CPU1, 0 ) /* 68000 code */
1335   ROM_LOAD16_BYTE( "epr13182.bin", 0x000000, 0x40000, CRC(e31f2a1c) SHA1(690ee10c36e5bb6175470fb5564527e0e4a94d2c) )
1336   ROM_LOAD16_BYTE( "epr13181.bin", 0x000001, 0x40000, CRC(78cd3b26) SHA1(a81b807c5da625d8e4648ae80c41e4ca3870c0fa) )
1339   ROM_LOAD16_BYTE( "epr13182.a6", 0x000000, 0x40000, CRC(e31f2a1c) SHA1(690ee10c36e5bb6175470fb5564527e0e4a94d2c) )
1340   ROM_LOAD16_BYTE( "epr13181.a5", 0x000001, 0x40000, CRC(78cd3b26) SHA1(a81b807c5da625d8e4648ae80c41e4ca3870c0fa) )
13371341
13381342   ROM_REGION( 0x2000, REGION_USER1, 0 )   /* decryption key */
1339   ROM_LOAD( "317-xxxx.key", 0x0000, 0x2000, NO_DUMP )
1343   ROM_LOAD( "317-0154.key", 0x0000, 0x2000, CRC(b86b6b8f) SHA1(869405383d563a3f3842c89462a7b2e184928532) )
13401344
13411345   ROM_REGION( 0xc0000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */
13421346   ROM_LOAD( "epr13073.bin", 0x00000, 0x40000, CRC(df5d0a61) SHA1(79ad71de348f280bad847566c507b7a31f022292) )
r2864r2865
13541358   ROM_LOAD16_BYTE( "epr13086.bin", 0x180000, 0x40000, CRC(8c9a71c4) SHA1(40b774765ac888792aad46b6351a24b7ef40d2dc) )
13551359
13561360   ROM_REGION( 0x210000, REGION_CPU2, ROMREGION_ERASEFF ) /* sound CPU */
1357   ROM_LOAD( "ep13083a.bin", 0x010000, 0x20000, CRC(e7528e06) SHA1(1f4e618692c20aeb316d578c5ded12440eb072ab) )
1358   ROM_LOAD( "epr13076.bin", 0x090000, 0x40000, CRC(94e6c76e) SHA1(f99e58a9bf372c41af211bd9b9ea3ac5b924c6ed) )
1359   ROM_LOAD( "epr13077.bin", 0x110000, 0x40000, CRC(e2ec0d8d) SHA1(225b0d223b7282cba7710300a877fb4a2c6dbabb) )
1360   ROM_LOAD( "epr13078.bin", 0x190000, 0x40000, CRC(15684dc5) SHA1(595051006de24f791dae937584e502ff2fa31d9c) )
1361   ROM_LOAD( "epr13083a.bin", 0x010000, 0x20000, CRC(e7528e06) SHA1(1f4e618692c20aeb316d578c5ded12440eb072ab) )
1362   ROM_LOAD( "epr13076.bin",  0x090000, 0x40000, CRC(94e6c76e) SHA1(f99e58a9bf372c41af211bd9b9ea3ac5b924c6ed) )
1363   ROM_LOAD( "epr13077.bin",  0x110000, 0x40000, CRC(e2ec0d8d) SHA1(225b0d223b7282cba7710300a877fb4a2c6dbabb) )
1364   ROM_LOAD( "epr13078.bin",  0x190000, 0x40000, CRC(15684dc5) SHA1(595051006de24f791dae937584e502ff2fa31d9c) )
13611365ROM_END
13621366
13631367/**************************************************************************************************************************
1364    Alien Storm (3 players version), Sega System 18
1368    Alien Storm (3 players World version), Sega System 18
13651369    CPU: FD1094 (317-0148)
13661370    ROM Board: 171-5873B
13671371    Game numbers: 833-7379-02 (main pcb: 834-7381-02, rom pcb: 834-7380-02)
r2864r2865
14371441*/
14381442ROM_START( astormj )
14391443   ROM_REGION( 0x080000, REGION_CPU1, 0 ) /* 68000 code */
1440   ROM_LOAD16_BYTE( "epr13085.bin", 0x000000, 0x40000, CRC(15f74e2d) SHA1(30d9d099ec18907edd3d20df312565c3bd5a80de) )
1441   ROM_LOAD16_BYTE( "epr13084.bin", 0x000001, 0x40000, CRC(9687b38f) SHA1(cdeb5b4f06ad4ad8ca579392c1ec901487b08e76) )
1444   ROM_LOAD16_BYTE( "epr13085.a6", 0x000000, 0x40000, CRC(15f74e2d) SHA1(30d9d099ec18907edd3d20df312565c3bd5a80de) )
1445   ROM_LOAD16_BYTE( "epr13084.a5", 0x000001, 0x40000, CRC(9687b38f) SHA1(cdeb5b4f06ad4ad8ca579392c1ec901487b08e76) )
14421446
14431447   ROM_REGION( 0x2000, REGION_USER1, 0 )   /* decryption key */
14441448   ROM_LOAD( "317-0146.key", 0x0000, 0x2000, CRC(e94991c5) SHA1(c9a8b56e01792654436f24b219d7a92c0852461f) )
r2864r2865
22482252 *
22492253 *************************************/
22502254
2251GAME( 1990, astorm,   0,        system18,      astorm2p, generic_5874, ROT0,   "Sega",    "Alien Storm (set 4, 2 Players, FD1094 317-?)", GAME_NOT_WORKING ) // not decrypted
2255GAME( 1990, astorm,   0,        system18,      astorm2p, generic_5874, ROT0,   "Sega",    "Alien Storm (set 4, World, 2 Players, FD1094 317-0154)", 0 )
22522256GAME( 1990, astorm3,  astorm,   system18,      astorm,   generic_5874, ROT0,   "Sega",    "Alien Storm (set 3, World, 3 Players, FD1094 317-0148)", 0 )
22532257GAME( 1990, astormu,  astorm,   system18,      astorm,   generic_5874, ROT0,   "Sega",    "Alien Storm (set 2, US, 3 Players, FD1094 317-0147)", 0 )
22542258GAME( 1990, astormj,  astorm,   system18,      astorm2p, generic_5874, ROT0,   "Sega",    "Alien Storm (set 1, Japan, 2 Players, FD1094 317-0146)", 0 )
src/osd/windows/drawgdi.c
r2864r2865
1313
1414// MAME headers
1515#include "mamecore.h"
16#include "restrack.h"
1617
1718// MAMEOS headers
1819#include "window.h"
src/osd/windows/window.c
r2864r2865
843843static void set_starting_view(running_machine *machine, int index, win_window_info *window, const char *view)
844844{
845845   const char *defview = options_get_string(mame_options(), WINOPTION_VIEW);
846   int viewindex = -1;
846   int viewindex;
847847
848848   assert(GetCurrentThreadId() == main_threadid);
849849
r2864r2865
851851   if (strcmp(view, "auto") == 0 && strcmp(defview, "auto") != 0)
852852      view = defview;
853853
854   // auto view just selects the nth view
855   if (strcmp(view, "auto") != 0)
856   {
857      // scan for a matching view name
858      for (viewindex = 0; ; viewindex++)
859      {
860         const char *name = render_target_get_view_name(window->target, viewindex);
854   // query the video system to help us pick a view
855   viewindex = video_get_view_for_target(machine, window->target, view, index, video_config.numscreens);
861856
862         // stop scanning if we hit NULL
863         if (name == NULL)
864         {
865            viewindex = -1;
866            break;
867         }
868         if (mame_strnicmp(name, view, strlen(view)) == 0)
869            break;
870      }
871   }
872
873   // if we don't have a match, default to the nth view
874   if (viewindex == -1)
875   {
876      int scrcount = video_screen_count(machine->config);
877
878      // if we have enough screens to be one per monitor, assign in order
879      if (video_config.numscreens >= scrcount)
880      {
881         // find the first view with this screen and this screen only
882         for (viewindex = 0; ; viewindex++)
883         {
884            UINT32 viewscreens = render_target_get_view_screens(window->target, viewindex);
885            if (viewscreens == (1 << index))
886               break;
887            if (viewscreens == 0)
888            {
889               viewindex = -1;
890               break;
891            }
892         }
893      }
894
895      // otherwise, find the first view that has all the screens
896      if (viewindex == -1)
897      {
898         for (viewindex = 0; ; viewindex++)
899         {
900            UINT32 viewscreens = render_target_get_view_screens(window->target, viewindex);
901            if (viewscreens == (1 << scrcount) - 1)
902               break;
903            if (viewscreens == 0)
904               break;
905         }
906      }
907   }
908
909   // make sure it's a valid view
910   if (render_target_get_view_name(window->target, viewindex) == NULL)
911      viewindex = 0;
912
913857   // set the view
914858   render_target_set_view(window->target, viewindex);
915859}
src/emu/debug/debugcmd.c
r2864r2865
20282028         return;
20292029      }
20302030
2031      video_screen_save_snapshot(screen, fp);
2031      video_screen_save_snapshot(screen->machine, screen, fp);
20322032      mame_fclose(fp);
20332033      debug_console_printf("Saved screen #%d snapshot as '%s'\n", scrnum, filename);
20342034   }
src/emu/cpu/cpu.mak
r2864r2865
1515
1616
1717#-------------------------------------------------
18# Shared code
19#-------------------------------------------------
20
21OBJDIRS += $(CPUOBJ)
22CPUOBJS += $(CPUOBJ)/vtlb.o
23
24
25
26#-------------------------------------------------
1827# Dynamic recompiler objects
1928#-------------------------------------------------
2029
src/emu/cpu/drcuml.c
r2864r2865
113113#define PTYPES_IANY      (PTYPES_IRM | PTYPES_IMV)
114114#define PTYPES_FANY      (PTYPES_FRM)
115115
116/* test result undefined */
117#define UNDEFINED      0x19bb7a1005fde439
118#define UNDEFINED_U64   U64(0x19bb7a1005fde439)
116119
117120
121
118122/***************************************************************************
119123    TYPE DEFINITIONS
120124***************************************************************************/
r2864r2865
173177{
174178   drcuml_opcode         opcode;
175179   UINT8               size;
176   UINT8               destmask;
177180   UINT8               iflags;
178181   UINT8               flags;
179182   UINT64               param[4];
r2864r2865
315318
316319static void validate_instruction(drcuml_block *block, const drcuml_instruction *inst);
317320
318#if 0
319321static void validate_backend(drcuml_state *drcuml);
320322static void bevalidate_iterate_over_params(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, drcuml_parameter *paramlist, int pnum);
321323static void bevalidate_iterate_over_flags(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, drcuml_parameter *paramlist);
322324static void bevalidate_execute(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, const drcuml_parameter *paramlist, UINT8 flagmask);
323325static void bevalidate_initialize_random_state(drcuml_block *block, drcuml_machine_state *state);
324326static int bevalidate_populate_state(drcuml_block *block, drcuml_machine_state *state, const bevalidate_test *test, const drcuml_parameter *paramlist, drcuml_parameter *params, UINT64 *parammem);
325static int bevalidate_verify_state(drcuml_state *drcuml, const drcuml_machine_state *istate, drcuml_machine_state *state, const bevalidate_test *test, const drcuml_parameter *params, const drcuml_instruction *testinst, drccodeptr codestart, drccodeptr codeend, UINT8 flagmask);
326#endif
327static int bevalidate_verify_state(drcuml_state *drcuml, const drcuml_machine_state *istate, drcuml_machine_state *state, const bevalidate_test *test, UINT32 flags, const drcuml_parameter *params, const drcuml_instruction *testinst, drccodeptr codestart, drccodeptr codeend, UINT8 flagmask);
327328
328329
329330
r2864r2865
427428
428429
429430/*-------------------------------------------------
431    effective_test_psize - return the effective
432    parameter size based on the size and fixed
433    array of parameter values
434-------------------------------------------------*/
435
436INLINE UINT8 effective_test_psize(const drcuml_opcode_info *opinfo, int pnum, int instsize, const UINT64 *params)
437{
438   switch (opinfo->param[pnum].size)
439   {
440      case PSIZE_4:   return 4;
441      case PSIZE_8:   return 8;
442      case PSIZE_OP:   return instsize;
443      case PSIZE_P1:   return 1 << (params[0] & 3);
444      case PSIZE_P2:   return 1 << (params[1] & 3);
445      case PSIZE_P3:   return 1 << (params[2] & 3);
446      case PSIZE_P4:   return 1 << (params[3] & 3);
447   }
448   return instsize;
449}
450
451
452/*-------------------------------------------------
430453    param_is_immediate - return TRUE if the
431454    given instruction parameter is an immediate
432455-------------------------------------------------*/
r2864r2865
588611   (*drcuml->beintf->be_reset)(drcuml->bestate);
589612
590613   /* do a one-time validation if requested */
591/*  if (VALIDATE_BACKEND)
592    {
593        static int validated = FALSE;
594        if (!validated)
595        {
596            validated = TRUE;
597            validate_backend(drcuml);
598        }
599    }*/
614   if (VALIDATE_BACKEND)
615   {
616      static int validated = FALSE;
617      if (!validated)
618      {
619         validated = TRUE;
620         validate_backend(drcuml);
621      }
622   }
600623}
601624
602625
r2864r2865
18611884
18621885
18631886
1864#if 0
1865
18661887/***************************************************************************
18671888    BACK-END VALIDATION
18681889***************************************************************************/
18691890
1870#define TEST_ENTRY_DSS(op, size, p1, p2, p3, flags) { DRCUML_OP_##op, size, 0x01, 0, flags, { U64(p1), U64(p2), U64(p3) } },
1871#define TEST_ENTRY_DSSI(op, size, p1, p2, p3, iflags, flags) { DRCUML_OP_##op, size, 0x01, iflags, flags, { U64(p1), U64(p2), U64(p3) } },
1891#define TEST_ENTRY_2(op, size, p1, p2, flags) { DRCUML_OP_##op, size, 0, flags, { U64(p1), U64(p2) } },
1892#define TEST_ENTRY_2F(op, size, p1, p2, iflags, flags) { DRCUML_OP_##op, size, iflags, flags, { U64(p1), U64(p2) } },
1893#define TEST_ENTRY_3(op, size, p1, p2, p3, flags) { DRCUML_OP_##op, size, 0, flags, { U64(p1), U64(p2), U64(p3) } },
1894#define TEST_ENTRY_3F(op, size, p1, p2, p3, iflags, flags) { DRCUML_OP_##op, size, iflags, flags, { U64(p1), U64(p2), U64(p3) } },
1895#define TEST_ENTRY_4(op, size, p1, p2, p3, p4, flags) { DRCUML_OP_##op, size, 0, flags, { U64(p1), U64(p2), U64(p3), U64(p4) } },
1896#define TEST_ENTRY_4F(op, size, p1, p2, p3, p4, iflags, flags) { DRCUML_OP_##op, size, iflags, flags, { U64(p1), U64(p2), U64(p3), U64(p4) } },
18721897
18731898static const bevalidate_test bevalidate_test_list[] =
18741899{
1875   TEST_ENTRY_DSS(ADD, 4, 0x7fffffff, 0x12345678, 0x6dcba987, 0)
1876   TEST_ENTRY_DSS(ADD, 4, 0x80000000, 0x12345678, 0x6dcba988, FLAGS_V | FLAGS_S)
1877   TEST_ENTRY_DSS(ADD, 4, 0xffffffff, 0x92345678, 0x6dcba987, FLAGS_S)
1878   TEST_ENTRY_DSS(ADD, 4, 0x00000000, 0x92345678, 0x6dcba988, FLAGS_C | FLAGS_Z)
1900   TEST_ENTRY_3(ADD, 4, 0x7fffffff, 0x12345678, 0x6dcba987, 0)
1901   TEST_ENTRY_3(ADD, 4, 0x80000000, 0x12345678, 0x6dcba988, DRCUML_FLAG_V | DRCUML_FLAG_S)
1902   TEST_ENTRY_3(ADD, 4, 0xffffffff, 0x92345678, 0x6dcba987, DRCUML_FLAG_S)
1903   TEST_ENTRY_3(ADD, 4, 0x00000000, 0x92345678, 0x6dcba988, DRCUML_FLAG_C | DRCUML_FLAG_Z)
18791904
1880   TEST_ENTRY_DSS(ADD, 8, 0x7fffffffffffffff, 0x0123456789abcdef, 0x7edcba9876543210, 0)
1881   TEST_ENTRY_DSS(ADD, 8, 0x8000000000000000, 0x0123456789abcdef, 0x7edcba9876543211, FLAGS_V | FLAGS_S)
1882   TEST_ENTRY_DSS(ADD, 8, 0xffffffffffffffff, 0x8123456789abcdef, 0x7edcba9876543210, FLAGS_S)
1883   TEST_ENTRY_DSS(ADD, 8, 0x0000000000000000, 0x8123456789abcdef, 0x7edcba9876543211, FLAGS_C | FLAGS_Z)
1905   TEST_ENTRY_3(ADD, 8, 0x7fffffffffffffff, 0x0123456789abcdef, 0x7edcba9876543210, 0)
1906   TEST_ENTRY_3(ADD, 8, 0x8000000000000000, 0x0123456789abcdef, 0x7edcba9876543211, DRCUML_FLAG_V | DRCUML_FLAG_S)
1907   TEST_ENTRY_3(ADD, 8, 0xffffffffffffffff, 0x8123456789abcdef, 0x7edcba9876543210, DRCUML_FLAG_S)
1908   TEST_ENTRY_3(ADD, 8, 0x0000000000000000, 0x8123456789abcdef, 0x7edcba9876543211, DRCUML_FLAG_C | DRCUML_FLAG_Z)
18841909
1885   TEST_ENTRY_DSSI(ADDC, 4, 0x7fffffff, 0x12345678, 0x6dcba987, 0,       0)
1886   TEST_ENTRY_DSSI(ADDC, 4, 0x7fffffff, 0x12345678, 0x6dcba986, FLAGS_C, 0)
1887   TEST_ENTRY_DSSI(ADDC, 4, 0x80000000, 0x12345678, 0x6dcba988, 0,       FLAGS_V | FLAGS_S)
1888   TEST_ENTRY_DSSI(ADDC, 4, 0x80000000, 0x12345678, 0x6dcba987, FLAGS_C, FLAGS_V | FLAGS_S)
1889   TEST_ENTRY_DSSI(ADDC, 4, 0xffffffff, 0x92345678, 0x6dcba987, 0,       FLAGS_S)
1890   TEST_ENTRY_DSSI(ADDC, 4, 0xffffffff, 0x92345678, 0x6dcba986, FLAGS_C, FLAGS_S)
1891   TEST_ENTRY_DSSI(ADDC, 4, 0x00000000, 0x92345678, 0x6dcba988, 0,       FLAGS_C | FLAGS_Z)
1892   TEST_ENTRY_DSSI(ADDC, 4, 0x00000000, 0x92345678, 0x6dcba987, FLAGS_C, FLAGS_C | FLAGS_Z)
1893   TEST_ENTRY_DSSI(ADDC, 4, 0x12345678, 0x12345678, 0xffffffff, FLAGS_C, FLAGS_C)
1910   TEST_ENTRY_3F(ADDC, 4, 0x7fffffff, 0x12345678, 0x6dcba987, 0,       0)
1911   TEST_ENTRY_3F(ADDC, 4, 0x7fffffff, 0x12345678, 0x6dcba986, DRCUML_FLAG_C, 0)
1912   TEST_ENTRY_3F(ADDC, 4, 0x80000000, 0x12345678, 0x6dcba988, 0,             DRCUML_FLAG_V | DRCUML_FLAG_S)
1913   TEST_ENTRY_3F(ADDC, 4, 0x80000000, 0x12345678, 0x6dcba987, DRCUML_FLAG_C, DRCUML_FLAG_V | DRCUML_FLAG_S)
1914   TEST_ENTRY_3F(ADDC, 4, 0xffffffff, 0x92345678, 0x6dcba987, 0,             DRCUML_FLAG_S)
1915   TEST_ENTRY_3F(ADDC, 4, 0xffffffff, 0x92345678, 0x6dcba986, DRCUML_FLAG_C, DRCUML_FLAG_S)
1916   TEST_ENTRY_3F(ADDC, 4, 0x00000000, 0x92345678, 0x6dcba988, 0,             DRCUML_FLAG_C | DRCUML_FLAG_Z)
1917   TEST_ENTRY_3F(ADDC, 4, 0x00000000, 0x92345678, 0x6dcba987, DRCUML_FLAG_C, DRCUML_FLAG_C | DRCUML_FLAG_Z)
1918   TEST_ENTRY_3F(ADDC, 4, 0x12345678, 0x12345678, 0xffffffff, DRCUML_FLAG_C, DRCUML_FLAG_C)
18941919
1895   TEST_ENTRY_DSSI(ADDC, 8, 0x7fffffffffffffff, 0x0123456789abcdef, 0x7edcba9876543210, 0,       0)
1896   TEST_ENTRY_DSSI(ADDC, 8, 0x7fffffffffffffff, 0x0123456789abcdef, 0x7edcba987654320f, FLAGS_C, 0)
1897   TEST_ENTRY_DSSI(ADDC, 8, 0x8000000000000000, 0x0123456789abcdef, 0x7edcba9876543211, 0,       FLAGS_V | FLAGS_S)
1898   TEST_ENTRY_DSSI(ADDC, 8, 0x8000000000000000, 0x0123456789abcdef, 0x7edcba9876543210, FLAGS_C, FLAGS_V | FLAGS_S)
1899   TEST_ENTRY_DSSI(ADDC, 8, 0xffffffffffffffff, 0x8123456789abcdef, 0x7edcba9876543210, 0,       FLAGS_S)
1900   TEST_ENTRY_DSSI(ADDC, 8, 0xffffffffffffffff, 0x8123456789abcdef, 0x7edcba987654320f, FLAGS_C, FLAGS_S)
1901   TEST_ENTRY_DSSI(ADDC, 8, 0x0000000000000000, 0x8123456789abcdef, 0x7edcba9876543211, 0,       FLAGS_C | FLAGS_Z)
1902   TEST_ENTRY_DSSI(ADDC, 8, 0x0000000000000000, 0x8123456789abcdef, 0x7edcba9876543210, FLAGS_C, FLAGS_C | FLAGS_Z)
1903   TEST_ENTRY_DSSI(ADDC, 8, 0x123456789abcdef0, 0x123456789abcdef0, 0xffffffffffffffff, FLAGS_C, FLAGS_C)
1920   TEST_ENTRY_3F(ADDC, 8, 0x7fffffffffffffff, 0x0123456789abcdef, 0x7edcba9876543210, 0,             0)
1921   TEST_ENTRY_3F(ADDC, 8, 0x7fffffffffffffff, 0x0123456789abcdef, 0x7edcba987654320f, DRCUML_FLAG_C, 0)
1922   TEST_ENTRY_3F(ADDC, 8, 0x8000000000000000, 0x0123456789abcdef, 0x7edcba9876543211, 0,             DRCUML_FLAG_V | DRCUML_FLAG_S)
1923   TEST_ENTRY_3F(ADDC, 8, 0x8000000000000000, 0x0123456789abcdef, 0x7edcba9876543210, DRCUML_FLAG_C, DRCUML_FLAG_V | DRCUML_FLAG_S)
1924   TEST_ENTRY_3F(ADDC, 8, 0xffffffffffffffff, 0x8123456789abcdef, 0x7edcba9876543210, 0,             DRCUML_FLAG_S)
1925   TEST_ENTRY_3F(ADDC, 8, 0xffffffffffffffff, 0x8123456789abcdef, 0x7edcba987654320f, DRCUML_FLAG_C, DRCUML_FLAG_S)
1926   TEST_ENTRY_3F(ADDC, 8, 0x0000000000000000, 0x8123456789abcdef, 0x7edcba9876543211, 0,             DRCUML_FLAG_C | DRCUML_FLAG_Z)
1927   TEST_ENTRY_3F(ADDC, 8, 0x0000000000000000, 0x8123456789abcdef, 0x7edcba9876543210, DRCUML_FLAG_C, DRCUML_FLAG_C | DRCUML_FLAG_Z)
1928   TEST_ENTRY_3F(ADDC, 8, 0x123456789abcdef0, 0x123456789abcdef0, 0xffffffffffffffff, DRCUML_FLAG_C, DRCUML_FLAG_C)
1929
1930   TEST_ENTRY_3(SUB, 4, 0x12345678, 0x7fffffff, 0x6dcba987, 0)
1931   TEST_ENTRY_3(SUB, 4, 0x12345678, 0x80000000, 0x6dcba988, DRCUML_FLAG_V)
1932   TEST_ENTRY_3(SUB, 4, 0x92345678, 0xffffffff, 0x6dcba987, DRCUML_FLAG_S)
1933   TEST_ENTRY_3(SUB, 4, 0x92345678, 0x00000000, 0x6dcba988, DRCUML_FLAG_C | DRCUML_FLAG_S)
1934   TEST_ENTRY_3(SUB, 4, 0x00000000, 0x12345678, 0x12345678, DRCUML_FLAG_Z)
1935
1936   TEST_ENTRY_3(SUB, 8, 0x0123456789abcdef, 0x7fffffffffffffff, 0x7edcba9876543210, 0)
1937   TEST_ENTRY_3(SUB, 8, 0x0123456789abcdef, 0x8000000000000000, 0x7edcba9876543211, DRCUML_FLAG_V)
1938   TEST_ENTRY_3(SUB, 8, 0x8123456789abcdef, 0xffffffffffffffff, 0x7edcba9876543210, DRCUML_FLAG_S)
1939   TEST_ENTRY_3(SUB, 8, 0x8123456789abcdef, 0x0000000000000000, 0x7edcba9876543211, DRCUML_FLAG_C | DRCUML_FLAG_S)
1940   TEST_ENTRY_3(SUB, 8, 0x0000000000000000, 0x0123456789abcdef, 0x0123456789abcdef, DRCUML_FLAG_Z)
1941
1942   TEST_ENTRY_3F(SUBB, 4, 0x12345678, 0x7fffffff, 0x6dcba987, 0,             0)
1943   TEST_ENTRY_3F(SUBB, 4, 0x12345678, 0x7fffffff, 0x6dcba986, DRCUML_FLAG_C, 0)
1944   TEST_ENTRY_3F(SUBB, 4, 0x12345678, 0x80000000, 0x6dcba988, 0,             DRCUML_FLAG_V)
1945   TEST_ENTRY_3F(SUBB, 4, 0x12345678, 0x80000000, 0x6dcba987, DRCUML_FLAG_C, DRCUML_FLAG_V)
1946   TEST_ENTRY_3F(SUBB, 4, 0x92345678, 0xffffffff, 0x6dcba987, 0,             DRCUML_FLAG_S)
1947   TEST_ENTRY_3F(SUBB, 4, 0x92345678, 0xffffffff, 0x6dcba986, DRCUML_FLAG_C, DRCUML_FLAG_S)
1948   TEST_ENTRY_3F(SUBB, 4, 0x92345678, 0x00000000, 0x6dcba988, 0,             DRCUML_FLAG_C | DRCUML_FLAG_S)
1949   TEST_ENTRY_3F(SUBB, 4, 0x92345678, 0x00000000, 0x6dcba987, DRCUML_FLAG_C, DRCUML_FLAG_C | DRCUML_FLAG_S)
1950   TEST_ENTRY_3F(SUBB, 4, 0x12345678, 0x12345678, 0xffffffff, DRCUML_FLAG_C, DRCUML_FLAG_C)
1951   TEST_ENTRY_3F(SUBB, 4, 0x00000000, 0x12345678, 0x12345677, DRCUML_FLAG_C, DRCUML_FLAG_Z)
1952
1953   TEST_ENTRY_3F(SUBB, 8, 0x0123456789abcdef, 0x7fffffffffffffff, 0x7edcba9876543210, 0,             0)
1954   TEST_ENTRY_3F(SUBB, 8, 0x0123456789abcdef, 0x7fffffffffffffff, 0x7edcba987654320f, DRCUML_FLAG_C, 0)
1955   TEST_ENTRY_3F(SUBB, 8, 0x0123456789abcdef, 0x8000000000000000, 0x7edcba9876543211, 0,             DRCUML_FLAG_V)
1956   TEST_ENTRY_3F(SUBB, 8, 0x0123456789abcdef, 0x8000000000000000, 0x7edcba9876543210, DRCUML_FLAG_C, DRCUML_FLAG_V)
1957   TEST_ENTRY_3F(SUBB, 8, 0x8123456789abcdef, 0xffffffffffffffff, 0x7edcba9876543210, 0,             DRCUML_FLAG_S)
1958   TEST_ENTRY_3F(SUBB, 8, 0x8123456789abcdef, 0xffffffffffffffff, 0x7edcba987654320f, DRCUML_FLAG_C, DRCUML_FLAG_S)
1959   TEST_ENTRY_3F(SUBB, 8, 0x8123456789abcdef, 0x0000000000000000, 0x7edcba9876543211, 0,             DRCUML_FLAG_C | DRCUML_FLAG_S)
1960   TEST_ENTRY_3F(SUBB, 8, 0x8123456789abcdef, 0x0000000000000000, 0x7edcba9876543210, DRCUML_FLAG_C, DRCUML_FLAG_C | DRCUML_FLAG_S)
1961   TEST_ENTRY_3F(SUBB, 8, 0x123456789abcdef0, 0x123456789abcdef0, 0xffffffffffffffff, DRCUML_FLAG_C, DRCUML_FLAG_C)
1962   TEST_ENTRY_3F(SUBB, 8, 0x0000000000000000, 0x123456789abcdef0, 0x123456789abcdeef, DRCUML_FLAG_C, DRCUML_FLAG_Z)
1963
1964   TEST_ENTRY_2(CMP, 4, 0x7fffffff, 0x6dcba987, 0)
1965   TEST_ENTRY_2(CMP, 4, 0x80000000, 0x6dcba988, DRCUML_FLAG_V)
1966   TEST_ENTRY_2(CMP, 4, 0xffffffff, 0x6dcba987, DRCUML_FLAG_S)
1967   TEST_ENTRY_2(CMP, 4, 0x00000000, 0x6dcba988, DRCUML_FLAG_C | DRCUML_FLAG_S)
1968   TEST_ENTRY_2(CMP, 4, 0x12345678, 0x12345678, DRCUML_FLAG_Z)
1969
1970   TEST_ENTRY_2(CMP, 8, 0x7fffffffffffffff, 0x7edcba9876543210, 0)
1971   TEST_ENTRY_2(CMP, 8, 0x8000000000000000, 0x7edcba9876543211, DRCUML_FLAG_V)
1972   TEST_ENTRY_2(CMP, 8, 0xffffffffffffffff, 0x7edcba9876543210, DRCUML_FLAG_S)
1973   TEST_ENTRY_2(CMP, 8, 0x0000000000000000, 0x7edcba9876543211, DRCUML_FLAG_C | DRCUML_FLAG_S)
1974   TEST_ENTRY_2(CMP, 8, 0x0123456789abcdef, 0x0123456789abcdef, DRCUML_FLAG_Z)
1975
1976   TEST_ENTRY_4(MULU, 4, 0x77777777, 0x00000000, 0x11111111, 0x00000007, 0)
1977   TEST_ENTRY_4(MULU, 4, 0xffffffff, 0x00000000, 0x11111111, 0x0000000f, 0)
1978   TEST_ENTRY_4(MULU, 4, 0x00000000, 0x00000000, 0x11111111, 0x00000000, DRCUML_FLAG_Z)
1979   TEST_ENTRY_4(MULU, 4, 0xea61d951, 0x37c048d0, 0x77777777, 0x77777777, DRCUML_FLAG_V)
1980   TEST_ENTRY_4(MULU, 4, 0x32323233, 0xcdcdcdcc, 0xcdcdcdcd, 0xffffffff, DRCUML_FLAG_V | DRCUML_FLAG_S)
1981
1982   TEST_ENTRY_4(MULU, 8, 0x7777777777777777, 0x0000000000000000, 0x1111111111111111, 0x0000000000000007, 0)
1983   TEST_ENTRY_4(MULU, 8, 0xffffffffffffffff, 0x0000000000000000, 0x1111111111111111, 0x000000000000000f, 0)
1984   TEST_ENTRY_4(MULU, 8, 0x0000000000000000, 0x0000000000000000, 0x1111111111111111, 0x0000000000000000, DRCUML_FLAG_Z)
1985   TEST_ENTRY_4(MULU, 8, 0x0c83fb72ea61d951, 0x37c048d159e26af3, 0x7777777777777777, 0x7777777777777777, DRCUML_FLAG_V)
1986   TEST_ENTRY_4(MULU, 8, 0x3232323232323233, 0xcdcdcdcdcdcdcdcc, 0xcdcdcdcdcdcdcdcd, 0xffffffffffffffff, DRCUML_FLAG_V | DRCUML_FLAG_S)
1987
1988   TEST_ENTRY_4(MULS, 4, 0x77777777, 0x00000000, 0x11111111, 0x00000007, 0)
1989   TEST_ENTRY_4(MULS, 4, 0xffffffff, 0x00000000, 0x11111111, 0x0000000f, DRCUML_FLAG_V)
1990   TEST_ENTRY_4(MULS, 4, 0x00000000, 0x00000000, 0x11111111, 0x00000000, DRCUML_FLAG_Z)
1991   TEST_ENTRY_4(MULS, 4, 0x9e26af38, 0xc83fb72e, 0x77777777, 0x88888888, DRCUML_FLAG_V | DRCUML_FLAG_S)
1992   TEST_ENTRY_4(MULS, 4, 0x32323233, 0x00000000, 0xcdcdcdcd, 0xffffffff, 0)
1993
1994   TEST_ENTRY_4(MULS, 8, 0x7777777777777777, 0x0000000000000000, 0x1111111111111111, 0x0000000000000007, 0)
1995   TEST_ENTRY_4(MULS, 8, 0xffffffffffffffff, 0x0000000000000000, 0x1111111111111111, 0x000000000000000f, DRCUML_FLAG_V)
1996   TEST_ENTRY_4(MULS, 8, 0x0000000000000000, 0x0000000000000000, 0x1111111111111111, 0x0000000000000000, DRCUML_FLAG_Z)
1997   TEST_ENTRY_4(MULS, 8, 0x7c048d159e26af38, 0xc83fb72ea61d950c, 0x7777777777777777, 0x8888888888888888, DRCUML_FLAG_V | DRCUML_FLAG_S)
1998   TEST_ENTRY_4(MULS, 8, 0x3232323232323233, 0x0000000000000000, 0xcdcdcdcdcdcdcdcd, 0xffffffffffffffff, 0)
1999
2000   TEST_ENTRY_4(DIVU, 4, 0x02702702, 0x00000003, 0x11111111, 0x00000007, 0)
2001   TEST_ENTRY_4(DIVU, 4, 0x00000000, 0x11111111, 0x11111111, 0x11111112, DRCUML_FLAG_Z)
2002   TEST_ENTRY_4(DIVU, 4, 0x7fffffff, 0x00000000, 0xfffffffe, 0x00000002, 0)
2003   TEST_ENTRY_4(DIVU, 4, 0xfffffffe, 0x00000000, 0xfffffffe, 0x00000001, DRCUML_FLAG_S)
2004   TEST_ENTRY_4(DIVU, 4, UNDEFINED,  UNDEFINED,  0xffffffff, 0x00000000, DRCUML_FLAG_V)
2005
2006   TEST_ENTRY_4(DIVU, 8, 0x0270270270270270, 0x0000000000000001, 0x1111111111111111, 0x0000000000000007, 0)
2007   TEST_ENTRY_4(DIVU, 8, 0x0000000000000000, 0x1111111111111111, 0x1111111111111111, 0x1111111111111112, DRCUML_FLAG_Z)
2008   TEST_ENTRY_4(DIVU, 8, 0x7fffffffffffffff, 0x0000000000000000, 0xfffffffffffffffe, 0x0000000000000002, 0)
2009   TEST_ENTRY_4(DIVU, 8, 0xfffffffffffffffe, 0x0000000000000000, 0xfffffffffffffffe, 0x0000000000000001, DRCUML_FLAG_S)
2010   TEST_ENTRY_4(DIVU, 8, UNDEFINED,          UNDEFINED,          0xffffffffffffffff, 0x0000000000000000, DRCUML_FLAG_V)
2011
2012   TEST_ENTRY_4(DIVS, 4, 0x02702702, 0x00000003, 0x11111111, 0x00000007, 0)
2013   TEST_ENTRY_4(DIVS, 4, 0x00000000, 0x11111111, 0x11111111, 0x11111112, DRCUML_FLAG_Z)
2014   TEST_ENTRY_4(DIVS, 4, 0xffffffff, 0x00000000, 0xfffffffe, 0x00000002, DRCUML_FLAG_S)
2015   TEST_ENTRY_4(DIVS, 4, UNDEFINED,  UNDEFINED,  0xffffffff, 0x00000000, DRCUML_FLAG_V)
2016
2017   TEST_ENTRY_4(DIVS, 8, 0x0270270270270270, 0x0000000000000001, 0x1111111111111111, 0x0000000000000007, 0)
2018   TEST_ENTRY_4(DIVS, 8, 0x0000000000000000, 0x1111111111111111, 0x1111111111111111, 0x1111111111111112, DRCUML_FLAG_Z)
2019   TEST_ENTRY_4(DIVS, 8, 0xffffffffffffffff, 0x0000000000000000, 0xfffffffffffffffe, 0x0000000000000002, DRCUML_FLAG_S)
2020   TEST_ENTRY_4(DIVS, 8, UNDEFINED,          UNDEFINED,          0xffffffffffffffff, 0x0000000000000000, DRCUML_FLAG_V)
19042021};
19052022
19062023
r2864r2865
19212038
19222039   /* iterate over test entries */
19232040   printf("Backend validation....\n");
1924   for (tnum = 0; tnum < ARRAY_LENGTH(bevalidate_test_list); tnum++)
2041   for (tnum = 31; tnum < ARRAY_LENGTH(bevalidate_test_list); tnum++)
19252042   {
19262043      const bevalidate_test *test = &bevalidate_test_list[tnum];
19272044      drcuml_parameter param[ARRAY_LENGTH(test->param)];
2045      char mnemonic[20], *dst;
2046      const char *src;
19282047
2048      /* progress */
2049      dst = mnemonic;
2050      for (src = opcode_info_table[test->opcode]->mnemonic; *src != 0; src++)
2051      {
2052         if (*src == '!')
2053         {
2054            if (test->size == 8)
2055               *dst++ = 'd';
2056         }
2057         else if (*src == '#')
2058            *dst++ = (test->size == 8) ? 'd' : 's';
2059         else
2060            *dst++ = *src;
2061      }
2062      *dst = 0;
2063      printf("Executing test %d/%d (%s)", tnum + 1, (int)ARRAY_LENGTH(bevalidate_test_list), mnemonic);
2064
19292065      /* reset parameter list and iterate */
19302066      memset(param, 0, sizeof(param));
1931      printf("Executing test %d/%d", tnum + 1, (int)ARRAY_LENGTH(bevalidate_test_list));
19322067      bevalidate_iterate_over_params(drcuml, handles, test, param, 0);
19332068      printf("\n");
19342069   }
r2864r2865
19462081static void bevalidate_iterate_over_params(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, drcuml_parameter *paramlist, int pnum)
19472082{
19482083   const drcuml_opcode_info *opinfo = opcode_info_table[test->opcode];
2084   drcuml_ptype ptype;
19492085
19502086   /* if no parameters, execute now */
1951   if (pnum >= ARRAY_LENGTH(opinfo->ptypes) || opinfo->ptypes[pnum] == OV_PARAM_ALLOWED_NONE)
2087   if (pnum >= ARRAY_LENGTH(opinfo->param) || opinfo->param[pnum].typemask == PTYPES_NONE)
19522088   {
19532089      bevalidate_iterate_over_flags(drcuml, handles, test, paramlist);
19542090      return;
19552091   }
19562092
19572093   /* iterate over valid parameter types */
1958   for (paramlist[pnum].type = DRCUML_PTYPE_IMMEDIATE; paramlist[pnum].type < DRCUML_PTYPE_MAX; paramlist[pnum].type++)
1959      if (opinfo->ptypes[pnum] & (1 << paramlist[pnum].type))
2094   for (ptype = DRCUML_PTYPE_IMMEDIATE; ptype < DRCUML_PTYPE_MAX; ptype++)
2095      if (opinfo->param[pnum].typemask & (1 << ptype))
19602096      {
19612097         int pindex, pcount;
19622098
19632099         /* mapvars can only do 32-bit tests */
1964         if (paramlist[pnum].type == DRCUML_PTYPE_MAPVAR && size_for_param(test->size, opinfo->ptypes[pnum]) == 8)
2100         if (ptype == DRCUML_PTYPE_MAPVAR && effective_test_psize(opinfo, pnum, test->size, test->param) == 8)
19652101            continue;
19662102
19672103         /* for some parameter types, we wish to iterate over all possibilities */
1968         switch (paramlist[pnum].type)
2104         switch (ptype)
19692105         {
19702106            case DRCUML_PTYPE_INT_REGISTER:      pcount = DRCUML_REG_I_END - DRCUML_REG_I0;      break;
19712107            case DRCUML_PTYPE_FLOAT_REGISTER:   pcount = DRCUML_REG_F_END - DRCUML_REG_F0;      break;
1972            case DRCUML_PTYPE_MAPVAR:         pcount = DRCUML_MAPVAR_END - DRCUML_MAPVAR_M0;   break;
19732108            default:                     pcount = 1;                              break;
19742109         }
19752110
r2864r2865
19842119               printf(".");
19852120
19862121            /* can't duplicate multiple source parameters unless they are immediates */
1987            if (paramlist[pnum].type != DRCUML_PTYPE_IMMEDIATE && ((test->destmask >> pnum) & 1) == 0)
2122            if (ptype != DRCUML_PTYPE_IMMEDIATE && (opinfo->param[pnum].output & PIO_IN))
19882123
19892124               /* loop over all parameters we've done before; if the parameter is a source and matches us, skip this case */
19902125               for (pscannum = 0; pscannum < pnum; pscannum++)
1991                  if (((test->destmask >> pscannum) & 1) == 0 && paramlist[pnum].type == paramlist[pscannum].type && pindex == paramlist[pscannum].value)
2126                  if ((opinfo->param[pscannum].output & PIO_IN) && ptype == paramlist[pscannum].type && pindex == paramlist[pscannum].value)
19922127                     skip = TRUE;
19932128
2129            /* can't duplicate multiple dest parameters */
2130            if (opinfo->param[pnum].output & PIO_OUT)
2131
2132               /* loop over all parameters we've done before; if the parameter is a source and matches us, skip this case */
2133               for (pscannum = 0; pscannum < pnum; pscannum++)
2134                  if ((opinfo->param[pscannum].output & PIO_OUT) && ptype == paramlist[pscannum].type && pindex == paramlist[pscannum].value)
2135                     skip = TRUE;
2136
19942137            /* iterate over the next parameter in line */
19952138            if (!skip)
19962139            {
2140               paramlist[pnum].type = ptype;
19972141               paramlist[pnum].value = pindex;
19982142               bevalidate_iterate_over_params(drcuml, handles, test, paramlist, pnum + 1);
19992143            }
r2864r2865
20102154static void bevalidate_iterate_over_flags(drcuml_state *drcuml, drcuml_codehandle **handles, const bevalidate_test *test, drcuml_parameter *paramlist)
20112155{
20122156   const drcuml_opcode_info *opinfo = opcode_info_table[test->opcode];
2013   UINT8 flagmask = opinfo->flags & 0x1f;
2157   UINT8 flagmask = opinfo->outflags;
20142158   UINT8 curmask;
20152159
20162160   /* iterate over all possible flag combinations */
r2864r2865
20362180   int numparams;
20372181
20382182   /* allocate memory for parameters */
2039   parammem = drccache_memory_alloc_near(drcuml->cache, sizeof(UINT64) * ARRAY_LENGTH(test->param));
2183   parammem = drccache_memory_alloc_near(drcuml->cache, sizeof(UINT64) * (ARRAY_LENGTH(test->param) + 1));
20402184
20412185   /* flush the cache */
20422186   drcuml_reset(drcuml);
r2864r2865
20572201   switch (numparams)
20582202   {
20592203      case 0:
2060         drcuml_block_append_0(block, test->opcode, test->size, DRCUML_COND_ALWAYS, flagmask);
2204         drcuml_block_append_0(block, test->opcode, test->size, DRCUML_COND_ALWAYS);
20612205         break;
20622206
20632207      case 1:
2064         drcuml_block_append_1(block, test->opcode, test->size, DRCUML_COND_ALWAYS, flagmask, params[0].type, params[0].value);
2208         drcuml_block_append_1(block, test->opcode, test->size, DRCUML_COND_ALWAYS, params[0].type, params[0].value);
20652209         break;
20662210
20672211      case 2:
2068         drcuml_block_append_2(block, test->opcode, test->size, DRCUML_COND_ALWAYS, flagmask, params[0].type, params[0].value, params[1].type, params[1].value);
2212         drcuml_block_append_2(block, test->opcode, test->size, DRCUML_COND_ALWAYS, params[0].type, params[0].value, params[1].type, params[1].value);
20692213         break;
20702214
20712215      case 3:
2072         drcuml_block_append_3(block, test->opcode, test->size, DRCUML_COND_ALWAYS, flagmask, params[0].type, params[0].value, params[1].type, params[1].value, params[2].type, params[2].value);
2216         drcuml_block_append_3(block, test->opcode, test->size, DRCUML_COND_ALWAYS, params[0].type, params[0].value, params[1].type, params[1].value, params[2].type, params[2].value);
20732217         break;
20742218
20752219      case 4:
2076         drcuml_block_append_4(block, test->opcode, test->size, DRCUML_COND_ALWAYS, flagmask, params[0].type, params[0].value, params[1].type, params[1].value, params[2].type, params[2].value, params[3].type, params[3].value);
2220         drcuml_block_append_4(block, test->opcode, test->size, DRCUML_COND_ALWAYS, params[0].type, params[0].value, params[1].type, params[1].value, params[2].type, params[2].value, params[3].type, params[3].value);
20772221         break;
20782222   }
20792223   testinst = block->inst[block->nextinst - 1];
20802224   UML_HANDLE(block, handles[2]);
2225   UML_GETFLGS(block, MEM(&parammem[ARRAY_LENGTH(test->param)]), flagmask);
20812226   UML_SAVE(block, &fstate);
20822227   UML_EXIT(block, IMM(0));
20832228
r2864r2865
20882233   drcuml_execute(drcuml, handles[0]);
20892234
20902235   /* verify the results */
2091   bevalidate_verify_state(drcuml, &istate, &fstate, test, params, &testinst, handles[1]->code, handles[2]->code, flagmask);
2236   bevalidate_verify_state(drcuml, &istate, &fstate, test, *(UINT32 *)&parammem[ARRAY_LENGTH(test->param)], params, &testinst, handles[1]->code, handles[2]->code, flagmask);
20922237
20932238   /* free memory */
2094   drccache_memory_free(drcuml->cache, parammem, sizeof(UINT64) * ARRAY_LENGTH(test->param));
2239   drccache_memory_free(drcuml->cache, parammem, sizeof(UINT64) * (ARRAY_LENGTH(test->param) + 1));
20952240}
20962241
20972242
r2864r2865
21472292   /* iterate over parameters */
21482293   for (pnum = 0; pnum < ARRAY_LENGTH(test->param); pnum++)
21492294   {
2150      int psize = size_for_param(test->size, opinfo->ptypes[pnum]);
2295      int psize = effective_test_psize(opinfo, pnum, test->size, test->param);
21512296      drcuml_parameter *curparam = &params[pnum];
21522297
21532298      /* start with a copy of the parameter from the list */
r2864r2865
22062351    discrepancies
22072352-------------------------------------------------*/
22082353
2209static int bevalidate_verify_state(drcuml_state *drcuml, const drcuml_machine_state *istate, drcuml_machine_state *state, const bevalidate_test *test, const drcuml_parameter *params, const drcuml_instruction *testinst, drccodeptr codestart, drccodeptr codeend, UINT8 flagmask)
2354static int bevalidate_verify_state(drcuml_state *drcuml, const drcuml_machine_state *istate, drcuml_machine_state *state, const bevalidate_test *test, UINT32 flags, const drcuml_parameter *params, const drcuml_instruction *testinst, drccodeptr codestart, drccodeptr codeend, UINT8 flagmask)
22102355{
22112356   const drcuml_opcode_info *opinfo = opcode_info_table[test->opcode];
22122357   UINT8 ireg[DRCUML_REG_I_END - DRCUML_REG_I0] = { 0 };
r2864r2865
22182363   *errend = 0;
22192364
22202365   /* check flags */
2221   if ((state->flags & flagmask) != (test->flags & flagmask))
2366   if (flags != (test->flags & flagmask))
22222367   {
22232368      errend += sprintf(errend, "  Flags ... result:%c%c%c%c%c  expected:%c%c%c%c%c\n",
2224         (flagmask & DRCUML_FLAG_U) ? ((state->flags & DRCUML_FLAG_U) ? 'U' : '.') : '-',
2225         (flagmask & DRCUML_FLAG_S) ? ((state->flags & DRCUML_FLAG_S) ? 'S' : '.') : '-',
2226         (flagmask & DRCUML_FLAG_Z) ? ((state->flags & DRCUML_FLAG_Z) ? 'Z' : '.') : '-',
2227         (flagmask & DRCUML_FLAG_V) ? ((state->flags & DRCUML_FLAG_V) ? 'V' : '.') : '-',
2228         (flagmask & DRCUML_FLAG_C) ? ((state->flags & DRCUML_FLAG_C) ? 'C' : '.') : '-',
2369         (flagmask & DRCUML_FLAG_U) ? ((flags & DRCUML_FLAG_U) ? 'U' : '.') : '-',
2370         (flagmask & DRCUML_FLAG_S) ? ((flags & DRCUML_FLAG_S) ? 'S' : '.') : '-',
2371         (flagmask & DRCUML_FLAG_Z) ? ((flags & DRCUML_FLAG_Z) ? 'Z' : '.') : '-',
2372         (flagmask & DRCUML_FLAG_V) ? ((flags & DRCUML_FLAG_V) ? 'V' : '.') : '-',
2373         (flagmask & DRCUML_FLAG_C) ? ((flags & DRCUML_FLAG_C) ? 'C' : '.') : '-',
22292374         (flagmask & DRCUML_FLAG_U) ? ((test->flags & DRCUML_FLAG_U) ? 'U' : '.') : '-',
22302375         (flagmask & DRCUML_FLAG_S) ? ((test->flags & DRCUML_FLAG_S) ? 'S' : '.') : '-',
22312376         (flagmask & DRCUML_FLAG_Z) ? ((test->flags & DRCUML_FLAG_Z) ? 'Z' : '.') : '-',
r2864r2865
22352380
22362381   /* check destination parameters */
22372382   for (pnum = 0; pnum < ARRAY_LENGTH(test->param); pnum++)
2238      if (test->destmask & (1 << pnum))
2383      if (opinfo->param[pnum].output & PIO_OUT)
22392384      {
2240         UINT64 mask = mask_for_param(test->size, opinfo->ptypes[pnum]);
2241         int psize = size_for_param(test->size, opinfo->ptypes[pnum]);
2385         int psize = effective_test_psize(opinfo, pnum, test->size, test->param);
2386         UINT64 mask = U64(0xffffffffffffffff) >> (64 - 8 * psize);
22422387         UINT64 result = 0;
22432388
22442389         /* fetch the result from the parameters */
r2864r2865
22692414         }
22702415
22712416         /* check against the mask */
2272         if ((result & mask) != (test->param[pnum] & mask))
2417         if (test->param[pnum] != UNDEFINED_U64 && (result & mask) != (test->param[pnum] & mask))
22732418         {
22742419            if ((UINT32)mask == mask)
22752420               errend += sprintf(errend, "  Parameter %d ... result:%08X  expected:%08X\n", pnum,
r2864r2865
23152460   }
23162461   return errend != errorbuf;
23172462}
2318
2319#endif
src/emu/cpu/drcbex64.c
r2864r2865
37293729   /* validate instruction */
37303730   assert(inst->size == 4);
37313731   assert_no_condition(inst);
3732   assert_no_flags(inst);
37333732
37343733   /* normalize parameters */
37353734   param_normalize_1(drcbe, inst, &dstp, PTYPE_M);
r2864r2865
44834482
44844483   /* normalize parameters */
44854484   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI, &sizep, PTYPE_I);
4486   assert(srcp.type != DRCUML_PTYPE_IMMEDIATE);
44874485
44884486   /* pick a target register for the general case */
44894487   dstreg = param_select_register(REG_EAX, &dstp, NULL);
r2864r2865
46654663
46664664   /* normalize parameters */
46674665   param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
4668   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
46694666
46704667   /* pick a target register for the general case */
46714668   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
47924789
47934790   /* normalize parameters */
47944791   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
4795   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
47964792
47974793   /* pick a target register for the general case */
47984794   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
48254821         emit_sub_m64_p64(drcbe, &dst, MABS(drcbe, dstp.value), &src2p, inst);      // sub   [dstp],src2p
48264822
48274823      /* reg = reg - imm */
4828      else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && short_immediate(src2p.type) && inst->flags == 0)
4824      else if (dstp.type == DRCUML_PTYPE_INT_REGISTER && src1p.type == DRCUML_PTYPE_INT_REGISTER && src2p.type == DRCUML_PTYPE_IMMEDIATE && short_immediate(src2p.value) && inst->flags == 0)
48294825         emit_lea_r64_m64(&dst, dstp.value, MBD(src1p.value, -src2p.value));         // lea   dstp,[src1p-src2p]
48304826
48314827      /* general case */
r2864r2865
49564952
49574953static x86code *op_mulu(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst)
49584954{
4955   UINT8 zsflags = inst->flags & (DRCUML_FLAG_Z | DRCUML_FLAG_S);
4956   UINT8 vflag =  inst->flags & DRCUML_FLAG_V;
49594957   drcuml_parameter dstp, edstp, src1p, src2p;
49604958   int compute_hi;
49614959
49624960   /* validate instruction */
49634961   assert(inst->size == 4 || inst->size == 8);
49644962   assert_no_condition(inst);
4965   assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S);
4963   assert_flags(inst, DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S);
49664964
49674965   /* normalize parameters */
49684966   param_normalize_4_commutative(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
r2864r2865
49894987      /* compute flags */
49904988      if (inst->flags != 0)
49914989      {
4992         if (compute_hi)
4990         if (zsflags != 0)
49934991         {
4994            if (inst->flags == DRCUML_FLAG_Z)
4995               emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                     // or    edx,eax
4996            else if (inst->flags == DRCUML_FLAG_S)
4997               emit_test_r32_r32(&dst, REG_EDX, REG_EDX);                     // test  edx,edx
4992            if (vflag)
4993               emit_pushf(&dst);                                       // pushf
4994            if (compute_hi)
4995            {
4996               if (zsflags == DRCUML_FLAG_Z)
4997                  emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                  // or    edx,eax
4998               else if (zsflags == DRCUML_FLAG_S)
4999                  emit_test_r32_r32(&dst, REG_EDX, REG_EDX);                  // test  edx,edx
5000               else
5001               {
5002                  emit_movzx_r32_r16(&dst, REG_ECX, REG_AX);                  // movzx ecx,ax
5003                  emit_shr_r32_imm(&dst, REG_EAX, 16);                     // shr   eax,16
5004                  emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                  // or    edx,ecx
5005                  emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                  // or    edx,eax
5006               }
5007            }
49985008            else
5009               emit_test_r32_r32(&dst, REG_EAX, REG_EAX);                     // test  eax,eax
5010
5011            /* we rely on the fact that OF is cleared by all logical operations above */
5012            if (vflag)
49995013            {
5000               emit_movzx_r32_r16(&dst, REG_ECX, REG_AX);                     // movzx ecx,ax
5001               emit_shr_r32_imm(&dst, REG_EAX, 16);                        // shr   eax,16
5002               emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                     // or    edx,ecx
5003               emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                     // or    edx,eax
5014               emit_pushf(&dst);                                       // pushf
5015               emit_pop_r64(&dst, REG_RAX);                              // pop   rax
5016               emit_and_m64_imm(&dst, MBD(REG_RSP, 0), ~0x84);                  // and   [rsp],~0x84
5017               emit_or_m64_r64(&dst, MBD(REG_RSP, 0), REG_RAX);               // or    [rsp],rax
5018               emit_popf(&dst);                                       // popf
50045019            }
50055020         }
5006         else
5007            emit_test_r32_r32(&dst, REG_EAX, REG_EAX);                        // test  eax,eax
50085021      }
50095022   }
50105023
r2864r2865
50295042      /* compute flags */
50305043      if (inst->flags != 0)
50315044      {
5032         if (compute_hi)
5045         if (zsflags != 0)
50335046         {
5034            if (inst->flags == DRCUML_FLAG_Z)
5035               emit_or_r64_r64(&dst, REG_RDX, REG_RAX);                     // or    rdx,rax
5036            else if (inst->flags == DRCUML_FLAG_S)
5037               emit_test_r64_r64(&dst, REG_RDX, REG_RDX);                     // test  rdx,rdx
5047            if (vflag)
5048               emit_pushf(&dst);                                       // pushf
5049            if (compute_hi)
5050            {
5051               if (zsflags == DRCUML_FLAG_Z)
5052                  emit_or_r64_r64(&dst, REG_RDX, REG_RAX);                  // or    rdx,rax
5053               else if (zsflags == DRCUML_FLAG_S)
5054                  emit_test_r64_r64(&dst, REG_RDX, REG_RDX);                  // test  rdx,rdx
5055               else
5056               {
5057                  emit_mov_r32_r32(&dst, REG_ECX, REG_EAX);                  // mov   ecx,eax
5058                  emit_shr_r64_imm(&dst, REG_RAX, 32);                     // shr   rax,32
5059                  emit_or_r64_r64(&dst, REG_RDX, REG_RCX);                  // or    rdx,rcx
5060                  emit_or_r64_r64(&dst, REG_RDX, REG_RAX);                  // or    rdx,rax
5061               }
5062            }
50385063            else
5064               emit_test_r64_r64(&dst, REG_RAX, REG_RAX);                     // test  rax,rax
5065
5066            /* we rely on the fact that OF is cleared by all logical operations above */
5067            if (vflag)
50395068            {
5040               emit_mov_r32_r32(&dst, REG_ECX, REG_EAX);                     // mov   ecx,eax
5041               emit_shr_r64_imm(&dst, REG_RAX, 32);                        // shr   rax,32
5042               emit_or_r64_r64(&dst, REG_RDX, REG_RCX);                     // or    rdx,rcx
5043               emit_or_r64_r64(&dst, REG_RDX, REG_RAX);                     // or    rdx,rax
5069               emit_pushf(&dst);                                       // pushf
5070               emit_pop_r64(&dst, REG_RAX);                              // pop   rax
5071               emit_and_m64_imm(&dst, MBD(REG_RSP, 0), ~0x84);                  // and   [rsp],~0x84
5072               emit_or_m64_r64(&dst, MBD(REG_RSP, 0), REG_RAX);               // or    [rsp],rax
5073               emit_popf(&dst);                                       // popf
50445074            }
50455075         }
5046         else
5047            emit_test_r64_r64(&dst, REG_RAX, REG_RAX);                        // test  rax,rax
50485076      }
50495077   }
50505078   return dst;
r2864r2865
50575085
50585086static x86code *op_muls(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst)
50595087{
5088   UINT8 zsflags = inst->flags & (DRCUML_FLAG_Z | DRCUML_FLAG_S);
5089   UINT8 vflag =  inst->flags & DRCUML_FLAG_V;
50605090   drcuml_parameter dstp, edstp, src1p, src2p;
50615091   int compute_hi;
50625092
50635093   /* validate instruction */
50645094   assert(inst->size == 4 || inst->size == 8);
50655095   assert_no_condition(inst);
5066   assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S);
5096   assert_flags(inst, DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S);
50675097
50685098   /* normalize parameters */
50695099   param_normalize_4_commutative(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
r2864r2865
51135143      /* compute flags */
51145144      if (inst->flags != 0)
51155145      {
5116         if (compute_hi)
5146         if (zsflags != 0)
51175147         {
5118            if (inst->flags == DRCUML_FLAG_Z)
5119               emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                     // or    edx,eax
5120            else if (inst->flags == DRCUML_FLAG_S)
5121               emit_test_r32_r32(&dst, REG_EDX, REG_EDX);                     // test  edx,edx
5148            if (vflag)
5149               emit_pushf(&dst);                                       // pushf
5150            if (compute_hi)
5151            {
5152               if (zsflags == DRCUML_FLAG_Z)
5153                  emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                  // or    edx,eax
5154               else if (zsflags == DRCUML_FLAG_S)
5155                  emit_test_r32_r32(&dst, REG_EDX, REG_EDX);                  // test  edx,edx
5156               else
5157               {
5158                  emit_movzx_r32_r16(&dst, REG_ECX, REG_AX);                  // movzx ecx,ax
5159                  emit_shr_r32_imm(&dst, REG_EAX, 16);                     // shr   eax,16
5160                  emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                  // or    edx,ecx
5161                  emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                  // or    edx,eax
5162               }
5163            }
51225164            else
5165               emit_test_r32_r32(&dst, REG_EAX, REG_EAX);                     // test  eax,eax
5166
5167            /* we rely on the fact that OF is cleared by all logical operations above */
5168            if (vflag)
51235169            {
5124               emit_movzx_r32_r16(&dst, REG_ECX, REG_AX);                     // movzx ecx,ax
5125               emit_shr_r32_imm(&dst, REG_EAX, 16);                        // shr   eax,16
5126               emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                     // or    edx,ecx
5127               emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                     // or    edx,eax
5170               emit_pushf(&dst);                                       // pushf
5171               emit_pop_r64(&dst, REG_RAX);                              // pop   rax
5172               emit_and_m64_imm(&dst, MBD(REG_RSP, 0), ~0x84);                  // and   [rsp],~0x84
5173               emit_or_m64_r64(&dst, MBD(REG_RSP, 0), REG_RAX);               // or    [rsp],rax
5174               emit_popf(&dst);                                       // popf
51285175            }
51295176         }
5130         else
5131            emit_test_r32_r32(&dst, REG_EAX, REG_EAX);                        // test  eax,eax
51325177      }
51335178   }
51345179
r2864r2865
51765221      /* compute flags */
51775222      if (inst->flags != 0)
51785223      {
5179         if (compute_hi)
5224         if (zsflags != 0)
51805225         {
5181            if (inst->flags == DRCUML_FLAG_Z)
5182               emit_or_r64_r64(&dst, REG_RDX, REG_RAX);                     // or    rdx,rax
5183            else if (inst->flags == DRCUML_FLAG_S)
5184               emit_test_r64_r64(&dst, REG_RDX, REG_RDX);                     // test  rdx,rdx
5226            if (vflag)
5227               emit_pushf(&dst);                                       // pushf
5228            if (compute_hi)
5229            {
5230               if (zsflags == DRCUML_FLAG_Z)
5231                  emit_or_r64_r64(&dst, REG_RDX, REG_RAX);                  // or    rdx,rax
5232               else if (zsflags == DRCUML_FLAG_S)
5233                  emit_test_r64_r64(&dst, REG_RDX, REG_RDX);                  // test  rdx,rdx
5234               else
5235               {
5236                  emit_mov_r32_r32(&dst, REG_ECX, REG_EAX);                  // mov   ecx,eax
5237                  emit_shr_r64_imm(&dst, REG_RAX, 32);                     // shr   rax,32
5238                  emit_or_r64_r64(&dst, REG_RDX, REG_RCX);                  // or    rdx,rcx
5239                  emit_or_r64_r64(&dst, REG_RDX, REG_RAX);                  // or    rdx,rax
5240               }
5241            }
51855242            else
5243               emit_test_r64_r64(&dst, REG_RAX, REG_RAX);                     // test  rax,rax
5244
5245            /* we rely on the fact that OF is cleared by all logical operations above */
5246            if (vflag)
51865247            {
5187               emit_mov_r32_r32(&dst, REG_ECX, REG_EAX);                     // mov   ecx,eax
5188               emit_shr_r64_imm(&dst, REG_RAX, 32);                        // shr   rax,32
5189               emit_or_r64_r64(&dst, REG_RDX, REG_RCX);                     // or    rdx,rcx
5190               emit_or_r64_r64(&dst, REG_RDX, REG_RAX);                     // or    rdx,rax
5248               emit_pushf(&dst);                                       // pushf
5249               emit_pop_r64(&dst, REG_RAX);                              // pop   rax
5250               emit_and_m64_imm(&dst, MBD(REG_RSP, 0), ~0x84);                  // and   [rsp],~0x84
5251               emit_or_m64_r64(&dst, MBD(REG_RSP, 0), REG_RAX);               // or    [rsp],rax
5252               emit_popf(&dst);                                       // popf
51915253            }
51925254         }
5193         else
5194            emit_test_r64_r64(&dst, REG_RAX, REG_RAX);                        // test  rax,rax
51955255      }
51965256   }
51975257   return dst;
r2864r2865
52115271   /* validate instruction */
52125272   assert(inst->size == 4 || inst->size == 8);
52135273   assert_no_condition(inst);
5214   assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S);
5274   assert_flags(inst, DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S);
52155275
52165276   /* normalize parameters */
52175277   param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
r2864r2865
52225282   {
52235283      /* general case */
52245284      emit_mov_r32_p32(drcbe, &dst, REG_ECX, &src2p);                           // mov   ecx,src2p
5285      if (inst->flags != 0)
5286      {
5287         emit_mov_r32_imm(&dst, REG_EAX, 0xa0000000);                        // mov   eax,0xa0000000
5288         emit_add_r32_r32(&dst, REG_EAX, REG_EAX);                           // add   eax,eax
5289      }
52255290      emit_jecxz_link(&dst, &skip);                                       // jecxz skip
52265291      emit_mov_r32_p32(drcbe, &dst, REG_EAX, &src1p);                           // mov   eax,src1p
52275292      emit_xor_r32_r32(&dst, REG_EDX, REG_EDX);                              // xor   edx,edx
r2864r2865
52395304   {
52405305      /* general case */
52415306      emit_mov_r64_p64(drcbe, &dst, REG_RCX, &src2p);                           // mov   rcx,src2p
5307      if (inst->flags != 0)
5308      {
5309         emit_mov_r32_imm(&dst, REG_EAX, 0xa0000000);                        // mov   eax,0xa0000000
5310         emit_add_r32_r32(&dst, REG_EAX, REG_EAX);                           // add   eax,eax
5311      }
52425312      emit_jrcxz_link(&dst, &skip);                                       // jrcxz skip
52435313      emit_mov_r64_p64(drcbe, &dst, REG_RAX, &src1p);                           // mov   rax,src1p
52445314      emit_xor_r32_r32(&dst, REG_EDX, REG_EDX);                              // xor   edx,edx
r2864r2865
52675337   /* validate instruction */
52685338   assert(inst->size == 4 || inst->size == 8);
52695339   assert_no_condition(inst);
5270   assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S);
5340   assert_flags(inst, DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S);
52715341
52725342   /* normalize parameters */
52735343   param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
r2864r2865
52785348   {
52795349      /* general case */
52805350      emit_mov_r32_p32(drcbe, &dst, REG_ECX, &src2p);                           // mov   ecx,src2p
5351      if (inst->flags != 0)
5352      {
5353         emit_mov_r32_imm(&dst, REG_EAX, 0xa0000000);                        // mov   eax,0xa0000000
5354         emit_add_r32_r32(&dst, REG_EAX, REG_EAX);                           // add   eax,eax
5355      }
52815356      emit_jecxz_link(&dst, &skip);                                       // jecxz skip
52825357      emit_mov_r32_p32(drcbe, &dst, REG_EAX, &src1p);                           // mov   eax,src1p
52835358      emit_cdq(&dst);                                                   // cdq
r2864r2865
52955370   {
52965371      /* general case */
52975372      emit_mov_r64_p64(drcbe, &dst, REG_RCX, &src2p);                           // mov   rcx,src2p
5373      if (inst->flags != 0)
5374      {
5375         emit_mov_r32_imm(&dst, REG_EAX, 0xa0000000);                        // mov   eax,0xa0000000
5376         emit_add_r32_r32(&dst, REG_EAX, REG_EAX);                           // add   eax,eax
5377      }
52985378      emit_jrcxz_link(&dst, &skip);                                       // jrcxz skip
52995379      emit_mov_r64_p64(drcbe, &dst, REG_RAX, &src1p);                           // mov   rax,src1p
53005380      emit_cqo(&dst);                                                   // cqo
r2864r2865
53265406
53275407   /* normalize parameters */
53285408   param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5329   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
53305409
53315410   /* pick a target register for the general case */
53325411   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
54355514
54365515   /* normalize parameters */
54375516   param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5438   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
54395517
54405518   /* pick a target register for the general case */
54415519   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
54915569
54925570   /* normalize parameters */
54935571   param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5494   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
54955572
54965573   /* pick a target register for the general case */
54975574   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
55475624
55485625   /* normalize parameters */
55495626   param_normalize_2(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI);
5550   assert(srcp.type != DRCUML_PTYPE_IMMEDIATE);
55515627
55525628   /* pick a target register for the general case */
55535629   dstreg = param_select_register(REG_EAX, &dstp, NULL);
r2864r2865
55915667
55925668   /* normalize parameters */
55935669   param_normalize_2(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI);
5594   assert(srcp.type != DRCUML_PTYPE_IMMEDIATE);
55955670
55965671   /* pick a target register for the general case */
55975672   dstreg = param_select_register(REG_RAX, &dstp, NULL);
r2864r2865
56315706
56325707   /* normalize parameters */
56335708   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5634   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
56355709
56365710   /* pick a target register for the general case */
56375711   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
56875761
56885762   /* normalize parameters */
56895763   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5690   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
56915764
56925765   /* pick a target register for the general case */
56935766   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
57435816
57445817   /* normalize parameters */
57455818   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5746   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
57475819
57485820   /* pick a target register for the general case */
57495821   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
57995871
58005872   /* normalize parameters */
58015873   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5802   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
58035874
58045875   /* pick a target register for the general case */
58055876   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
58555926
58565927   /* normalize parameters */
58575928   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5858   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
58595929
58605930   /* pick a target register for the general case */
58615931   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
src/emu/cpu/drcbec.c
r2864r2865
710710            break;
711711
712712         case MAKE_OPCODE_SHORT(DRCUML_OP_RESTORE, 4, 0):   /* RESTORE dst                    */
713         case MAKE_OPCODE_SHORT(DRCUML_OP_RESTORE, 4, 1):   /* RESTORE dst                    */
713714            drcbe->state = *inst[0].state;
714715            flags = inst[0].state->flags;
715716            break;
r2864r2865
916917            flags = FLAGS64_NZ(temp64);
917918            PARAM1 = temp64 >> 32;
918919            PARAM0 = (UINT32)temp64;
920            if (temp64 != (UINT32)temp64)
921               flags |= DRCUML_FLAG_V;
919922            break;
920923
921924         case MAKE_OPCODE_SHORT(DRCUML_OP_MULS, 4, 0):      /* MULS    dst,edst,src1,src2[,f] */
r2864r2865
929932            flags = FLAGS64_NZ(temp64);
930933            PARAM1 = temp64 >> 32;
931934            PARAM0 = (UINT32)temp64;
935            if (temp64 != (INT32)temp64)
936               flags |= DRCUML_FLAG_V;
932937            break;
933938
934939         case MAKE_OPCODE_SHORT(DRCUML_OP_DIVU, 4, 0):      /* DIVU    dst,edst,src1,src2[,f] */
r2864r2865
948953               flags = FLAGS32_NZ(temp32);
949954               PARAM0 = temp32;
950955            }
956            else
957               flags = DRCUML_FLAG_V;
951958            break;
952959
953960         case MAKE_OPCODE_SHORT(DRCUML_OP_DIVS, 4, 0):      /* DIVS    dst,edst,src1,src2[,f] */
r2864r2865
967974               flags = FLAGS32_NZ(temp32);
968975               PARAM0 = temp32;
969976            }
977            else
978               flags = DRCUML_FLAG_V;
970979            break;
971980
972981         case MAKE_OPCODE_SHORT(DRCUML_OP_AND, 4, 0):      /* AND     dst,src1,src2[,f]      */
r2864r2865
13871396               flags = FLAGS64_NZ(temp64);
13881397               DPARAM0 = temp64;
13891398            }
1399            else
1400               flags = DRCUML_FLAG_V;
13901401            break;
13911402
13921403         case MAKE_OPCODE_SHORT(DRCUML_OP_DIVS, 8, 0):      /* DDIVS   dst,edst,src1,src2[,f] */
r2864r2865
14061417               flags = FLAGS64_NZ(temp64);
14071418               DPARAM0 = temp64;
14081419            }
1420            else
1421               flags = DRCUML_FLAG_V;
14091422            break;
14101423
14111424         case MAKE_OPCODE_SHORT(DRCUML_OP_AND, 8, 0):      /* DAND    dst,src1,src2[,f]      */
r2864r2865
19521965   UINT64 a, b, temp;
19531966
19541967   /* shortcut if we don't care about the high bits or the flags */
1955   if (dstlo == dsthi && !flags)
1968   if (dstlo == dsthi && flags == 0)
19561969   {
19571970      *dstlo = src1 * src2;
19581971      return 0;
r2864r2865
19851998   /* store the results */
19861999   *dsthi = hi;
19872000   *dstlo = lo;
1988   return ((hi >> 60) & DRCUML_FLAG_S);
2001   return ((hi >> 60) & DRCUML_FLAG_S) | ((*dsthi != 0) << 1);
19892002}
19902003
19912004
r2864r2865
19992012   UINT64 a, b, temp;
20002013
20012014   /* shortcut if we don't care about the high bits or the flags */
2002   if (dstlo == dsthi && !flags)
2015   if (dstlo == dsthi && flags == 0)
20032016   {
20042017      *dstlo = src1 * src2;
20052018      return 0;
r2864r2865
20392052   /* store the results */
20402053   *dsthi = hi;
20412054   *dstlo = lo;
2042   return ((hi >> 60) & DRCUML_FLAG_S);
2055   return ((hi >> 60) & DRCUML_FLAG_S) | ((*dsthi != ((INT64)lo >> 63)) << 1);
20432056}
src/emu/cpu/cop400/cop420ds.c
r2864r2865
269269               break;
270270
271271            case 0x2C:
272               sprintf(buffer, "COMA");
272               sprintf(buffer, "CQMA");
273273               break;
274274
275275            case 0x2E:
src/emu/cpu/powerpc/ppcdrc.c
r2864r2865
199199   drcuml_codehandle *   out_of_cycles;            /* out of cycles exception handler */
200200   drcuml_codehandle *   tlb_mismatch;            /* tlb mismatch handler */
201201   drcuml_codehandle *   swap_tgpr;               /* swap TGPR handler */
202   drcuml_codehandle *   lsw[4][32];               /* lsw entries */
203   drcuml_codehandle *   stsw[4][32];            /* stsw entries */
204   drcuml_codehandle *   read8[4];               /* read byte */
205   drcuml_codehandle *   write8[4];               /* write byte */
206   drcuml_codehandle *   read16[4];               /* read half */
207   drcuml_codehandle *   read16mask[4];            /* read half */
208   drcuml_codehandle *   write16[4];               /* write half */
209   drcuml_codehandle *   write16mask[4];            /* write half */
210   drcuml_codehandle *   read32[4];               /* read word */
211   drcuml_codehandle *   read32align[4];            /* read word aligned */
212   drcuml_codehandle *   read32mask[4];            /* read word */
213   drcuml_codehandle *   write32[4];               /* write word */
214   drcuml_codehandle *   write32align[4];         /* write word aligned */
215   drcuml_codehandle *   write32mask[4];            /* write word */
216   drcuml_codehandle *   read64[4];               /* read double */
217   drcuml_codehandle *   read64mask[4];            /* read double */
218   drcuml_codehandle *   write64[4];               /* write double */
219   drcuml_codehandle *   write64mask[4];            /* write double */
202   drcuml_codehandle *   lsw[8][32];               /* lsw entries */
203   drcuml_codehandle *   stsw[8][32];            /* stsw entries */
204   drcuml_codehandle *   read8[8];               /* read byte */
205   drcuml_codehandle *   write8[8];               /* write byte */
206   drcuml_codehandle *   read16[8];               /* read half */
207   drcuml_codehandle *   read16mask[8];            /* read half */
208   drcuml_codehandle *   write16[8];               /* write half */
209   drcuml_codehandle *   write16mask[8];            /* write half */
210   drcuml_codehandle *   read32[8];               /* read word */
211   drcuml_codehandle *   read32align[8];            /* read word aligned */
212   drcuml_codehandle *   read32mask[8];            /* read word */
213   drcuml_codehandle *   write32[8];               /* write word */
214   drcuml_codehandle *   write32align[8];         /* write word aligned */
215   drcuml_codehandle *   write32mask[8];            /* write word */
216   drcuml_codehandle *   read64[8];               /* read double */
217   drcuml_codehandle *   read64mask[8];            /* read double */
218   drcuml_codehandle *   write64[8];               /* write double */
219   drcuml_codehandle *   write64mask[8];            /* write double */
220220   drcuml_codehandle *   exception[EXCEPTION_COUNT];   /* array of exception handlers */
221221   drcuml_codehandle *   exception_norecover[EXCEPTION_COUNT];   /* array of exception handlers */
222222
r2864r2865
545545   };
546546   drcbe_info beinfo;
547547   UINT32 flags = 0;
548   size_t extrasize;
549548   drccache *cache;
550   void *extramem;
551549   int regnum;
552550
553   /* determine how much memory beyond the core size we need */
554    extrasize = ppccom_init(NULL, flavor, cap, tb_divisor, clock, config, irqcallback, NULL);
555
556551   /* allocate enough space for the cache and the core */
557   cache = drccache_alloc(CACHE_SIZE + sizeof(*ppc) + extrasize);
552   cache = drccache_alloc(CACHE_SIZE + sizeof(*ppc));
558553   if (cache == NULL)
559      fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(*ppc) + extrasize));
554      fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(*ppc)));
560555
561   /* allocate the core from the near cache, and the extra memory from the full cache */
556   /* allocate the core from the near cache */
562557   ppc = drccache_memory_alloc_near(cache, sizeof(*ppc));
563558   memset(ppc, 0, sizeof(*ppc));
564   extramem = drccache_memory_alloc(cache, extrasize);
565   memset(extramem, 0, extrasize);
566559
567560   /* initialize the core */
568   ppccom_init(ppc, flavor, cap, tb_divisor, clock, config, irqcallback, extramem);
561   ppccom_init(ppc, flavor, cap, tb_divisor, clock, config, irqcallback);
569562
570563   /* allocate the implementation-specific state from the full cache */
571564   ppc->impstate = drccache_memory_alloc_near(cache, sizeof(*ppc->impstate));
r2864r2865
729722
730723static void ppcdrc_exit(void)
731724{
725   ppccom_exit(ppc);
726
732727   /* clean up the DRC */
733728   drcfe_exit(ppc->impstate->drcfe);
734729   drcuml_free(ppc->impstate->drcuml);
r2864r2865
897892   }
898893
899894   /* add subroutines for memory accesses */
900   for (mode = 0; mode < 4; mode++)
895   for (mode = 0; mode < 8; mode++)
901896   {
902897      static_generate_memory_accessor(drcuml, mode, 1, FALSE, FALSE, "read8",       &ppc->impstate->read8[mode],       NULL);
903898      static_generate_memory_accessor(drcuml, mode, 1, TRUE,  FALSE, "write8",      &ppc->impstate->write8[mode],      NULL);
r2864r2865
12321227   UML_MOV(block, MEM(&ppc->param0), IREG(0));                                    // mov     [param0],i0
12331228   UML_MOV(block, MEM(&ppc->param1), IMM(TRANSLATE_FETCH));                        // mov     [param1],TRANSLATE_FETCH
12341229   UML_CALLC(block, ppccom_tlb_fill, ppc);                                       // callc   tlbfill,ppc
1235   UML_CMP(block, MEM(&ppc->param0), IMM(1));                                    // cmp     [param0],1
1236   UML_JMPc(block, IF_A, isi = label++);                                       // jmp     isi,A
1230   UML_SHR(block, IREG(1), IREG(0), IMM(12));                                    // shr     i1,i0,11
1231   UML_LOAD(block, IREG(1), (void *)vtlb_table(ppc->vtlb), IREG(1), DWORD);            // load    i1,[vtlb],i1,dword
1232   UML_TEST(block, IREG(1), IMM(VTLB_FETCH_ALLOWED));                              // test    i1,VTLB_FETCH_ALLOWED
1233   UML_JMPc(block, IF_Z, isi = label++);                                       // jmp     isi,z
12371234   UML_MOV(block, MEM(&ppc->pc), IREG(0));                                       // mov     <pc>,i0
12381235   save_fast_iregs(block);                                                   // <save fastregs>
12391236   UML_EXIT(block, IMM(EXECUTE_MISSING_CODE));                                    // exit    EXECUTE_MISSING_CODE
r2864r2865
14471444   int fastxor = BYTE8_XOR_BE(0) >> (activecpu_databus_width(ADDRESS_SPACE_PROGRAM) < 64);
14481445   drcuml_block *block;
14491446   jmp_buf errorbuf;
1447   int translate_type;
14501448   int tlbreturn = 0;
14511449   int unaligned = 0;
14521450   int alignex = 0;
r2864r2865
14541452   int label = 1;
14551453   int ramnum;
14561454
1455   if (mode & MODE_USER)
1456      translate_type = iswrite ? TRANSLATE_WRITE_USER : TRANSLATE_READ_USER;
1457   else
1458      translate_type = iswrite ? TRANSLATE_WRITE : TRANSLATE_READ;
1459
14571460   /* if we get an error back, we're screwed */
14581461   if (setjmp(errorbuf) != 0)
14591462      fatalerror("Unrecoverable error in static_generate_exception");
r2864r2865
14981501   if (((ppc->cap & PPCCAP_OEA) && (mode & MODE_DATA_TRANSLATION)) || (iswrite && (ppc->cap & PPCCAP_4XX) && (mode & MODE_PROTECTION)))
14991502   {
15001503      UML_SHR(block, IREG(3), IREG(0), IMM(12));                                 // shr     i3,i0,12
1501      UML_LOAD(block, IREG(3), ppc->tlb_table, IREG(3), DWORD);                     // load    i3,[tlb_table],i3,dword
1502      UML_TEST(block, IREG(3), IMM(iswrite ? TLB_WRITE : TLB_READ));                  // test    i3,iswrite ? TLB_WRITE : TLB_READ
1504      UML_LOAD(block, IREG(3), (void *)vtlb_table(ppc->vtlb), IREG(3), DWORD);         // load    i3,[vtlb],i3,dword
1505      UML_TEST(block, IREG(3), IMM((UINT64)1 << translate_type));                     // test    i3,1 << translate_type
15031506      UML_JMPc(block, IF_Z, tlbmiss = label++);                                 // jmp     tlbmiss,z
15041507      UML_LABEL(block, tlbreturn = label++);                                 // tlbreturn:
15051508      UML_ROLINS(block, IREG(0), IREG(3), IMM(0), IMM(0xfffff000));                  // rolins  i0,i3,0,0xfffff000
r2864r2865
17861789   /* handle a TLB miss */
17871790   if (tlbmiss != 0)
17881791   {
1789      int dsi;
1790
17911792      UML_LABEL(block, tlbmiss);                                          // tlbmiss:
17921793      UML_MOV(block, MEM(&ppc->param0), IREG(0));                                 // mov     [param0],i0
1793      UML_MOV(block, MEM(&ppc->param1), IMM(iswrite ? TRANSLATE_WRITE : TRANSLATE_READ));   // mov     [param1],TRANSLATE_READ/WRITE
1794      UML_MOV(block, MEM(&ppc->param1), IMM(translate_type));                        // mov     [param1],translate_type
17941795      UML_CALLC(block, ppccom_tlb_fill, ppc);                                    // callc   tlbfill,ppc
1795      UML_CMP(block, MEM(&ppc->param0), IMM(1));                                 // cmp     [param0],1
1796      UML_JMPc(block, IF_A, dsi = label++);                                    // jmp     dsi,A
17971796      UML_SHR(block, IREG(3), IREG(0), IMM(12));                                 // shr     i3,i0,12
1798      UML_LOAD(block, IREG(3), ppc->tlb_table, IREG(3), DWORD);                     // load    i3,[tlb_table],i3,dword
1799      UML_JMP(block, tlbreturn);                                             // jmp     tlbreturn
1800      UML_LABEL(block, dsi);                                             // dsi:
1797      UML_LOAD(block, IREG(3), (void *)vtlb_table(ppc->vtlb), IREG(3), DWORD);         // load    i3,[vtlb],i3,dword
1798      UML_TEST(block, IREG(3), IMM((UINT64)1 << translate_type));                     // test    i3,1 << translate_type
1799      UML_JMPc(block, IF_NZ, tlbreturn);                                       // jmp     tlbreturn,nz
18011800
18021801      /* 4XX case: protection exception */
18031802      if (ppc->cap & PPCCAP_4XX)
r2864r2865
21662165   /* validate our TLB entry at this PC; if we fail, we need to handle it */
21672166   if ((desc->flags & OPFLAG_VALIDATE_TLB) && (ppc->impstate->mode & MODE_DATA_TRANSLATION))
21682167   {
2168      const vtlb_entry *tlbtable = vtlb_table(ppc->vtlb);
2169
21692170      /* if we currently have a valid TLB read entry, we just verify */
2170      if (ppc->tlb_table[desc->pc >> 12] != 0)
2171      if (tlbtable[desc->pc >> 12] != 0)
21712172      {
21722173         if (PRINTF_MMU)
21732174         {
21742175            UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->pc));               // mov     [arg0],desc->pc
21752176            UML_CALLC(block, cfunc_printf_debug, "Checking TLB at @ %08X\n");         // callc   printf_debug
21762177         }
2177         UML_LOAD(block, IREG(0), &ppc->tlb_table[desc->pc >> 12], IMM(0), DWORD);      // load    i0,tlb_table[desc->pc >> 12],dword
2178         UML_CMP(block, IREG(0), IMM(ppc->tlb_table[desc->pc >> 12]));               // cmp     i0,*tlbentry
2178         UML_LOAD(block, IREG(0), &tlbtable[desc->pc >> 12], IMM(0), DWORD);            // load    i0,tlbtable[desc->pc >> 12],dword
2179         UML_CMP(block, IREG(0), IMM(tlbtable[desc->pc >> 12]));                     // cmp     i0,*tlbentry
21792180         UML_EXHc(block, IF_NE, ppc->impstate->tlb_mismatch, IMM(0));               // exh     tlb_mismatch,0,NE
21802181      }
21812182
r2864r2865
21842185      {
21852186         if (PRINTF_MMU)
21862187         {
2187            UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->pc));                  // mov     [arg0],desc->pc
2188            UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->pc));               // mov     [arg0],desc->pc
21882189            UML_CALLC(block, cfunc_printf_debug, "No valid TLB @ %08X\n");            // callc   printf_debug
21892190         }
2190         UML_EXH(block, ppc->impstate->tlb_mismatch, IMM(0));                              // exh     tlb_mismatch,0
2191         UML_EXH(block, ppc->impstate->tlb_mismatch, IMM(0));                     // exh     tlb_mismatch,0
21912192      }
21922193   }
21932194
21942195   /* if this is an invalid opcode, generate the exception now */
21952196   if (desc->flags & OPFLAG_INVALID_OPCODE)
2196      UML_EXH(block, ppc->impstate->exception[EXCEPTION_PROGRAM], IMM(0x80000));                  // exh    exception_program,0x80000
2197      UML_EXH(block, ppc->impstate->exception[EXCEPTION_PROGRAM], IMM(0x80000));         // exh    exception_program,0x80000
21972198
21982199   /* if this is a privileged opcode in user mode, generate the exception */
21992200   else if ((desc->flags & OPFLAG_PRIVILEGED) && (ppc->impstate->mode & MODE_USER))
2200      UML_EXH(block, ppc->impstate->exception[EXCEPTION_PROGRAM], IMM(0x40000));                  // exh    exception_program,0x40000
2201      UML_EXH(block, ppc->impstate->exception[EXCEPTION_PROGRAM], IMM(0x40000));         // exh    exception_program,0x40000
22012202
22022203   /* otherwise, unless this is a virtual no-op, it's a regular instruction */
22032204   else if (!(desc->flags & OPFLAG_VIRTUAL_NOOP))
r2864r2865
22052206      /* compile the instruction */
22062207      if (!generate_opcode(block, compiler, desc))
22072208      {
2208         UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc));                        // mov     [pc],desc->pc
2209         UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc));                           // mov     [pc],desc->pc
22092210         UML_CALLC(block, cfunc_unimplemented, (void *)(FPTR)*desc->opptr.l);         // callc   cfunc_unimplemented
22102211      }
22112212   }
r2864r2865
24932494      case 0x22:   /* LBZ */
24942495         UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op)));            // add     i0,ra,simm
24952496         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op));                           // mapvar  dsisr,DSISR_IMM(op)
2496         UML_CALLH(block, ppc->impstate->read8[ppc->impstate->mode & 3]);            // callh   read8
2497         UML_CALLH(block, ppc->impstate->read8[ppc->impstate->mode]);               // callh   read8
24972498         UML_AND(block, R32(G_RD(op)), IREG(0), IMM(0xff));                        // and     rd,i0,0xff
24982499         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
24992500         return TRUE;
r2864r2865
25012502      case 0x28:   /* LHZ */
25022503         UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op)));            // add     i0,ra,simm
25032504         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op));                           // mapvar  dsisr,DSISR_IMM(op)
2504         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode & 3]);            // callh   read16
2505         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode]);               // callh   read16
25052506         UML_AND(block, R32(G_RD(op)), IREG(0), IMM(0xffff));                     // and     rd,i0,0xffff
25062507         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
25072508         return TRUE;
r2864r2865
25092510      case 0x2a:   /* LHA */
25102511         UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op)));            // add     i0,ra,simm
25112512         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op));                           // mapvar  dsisr,DSISR_IMM(op)
2512         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode & 3]);            // callh   read16
2513         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode]);               // callh   read16
25132514         UML_SEXT(block, R32(G_RD(op)), IREG(0), WORD);                           // sext    rd,i0,word
25142515         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
25152516         return TRUE;
r2864r2865
25172518      case 0x20:   /* LWZ */
25182519         UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op)));            // add     i0,ra,simm
25192520         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op));                           // mapvar  dsisr,DSISR_IMM(op)
2520         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]);            // callh   read32
2521         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode]);               // callh   read32
25212522         UML_MOV(block, R32(G_RD(op)), IREG(0));                                 // mov     rd,i0
25222523         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
25232524         return TRUE;
r2864r2865
25262527         UML_ADD(block, IREG(0), R32(G_RA(op)), IMM((INT16)G_SIMM(op)));               // add     i0,ra,simm
25272528         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
25282529         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op));                        // mapvar  dsisr,DSISR_IMMU(op)
2529         UML_CALLH(block, ppc->impstate->read8[ppc->impstate->mode & 3]);            // callh   read8
2530         UML_CALLH(block, ppc->impstate->read8[ppc->impstate->mode]);               // callh   read8
25302531         UML_AND(block, R32(G_RD(op)), IREG(0), IMM(0xff));                        // and     rd,i0,0xff
25312532         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
25322533         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
25362537         UML_ADD(block, IREG(0), R32(G_RA(op)), IMM((INT16)G_SIMM(op)));               // add     i0,ra,simm
25372538         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
25382539         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op));                        // mapvar  dsisr,DSISR_IMMU(op)
2539         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode & 3]);            // callh   read16
2540         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode]);               // callh   read16
25402541         UML_AND(block, R32(G_RD(op)), IREG(0), IMM(0xffff));                     // and     rd,i0,0xffff
25412542         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
25422543         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
25462547         UML_ADD(block, IREG(0), R32(G_RA(op)), IMM((INT16)G_SIMM(op)));               // add     i0,ra,simm
25472548         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
25482549         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op));                        // mapvar  dsisr,DSISR_IMMU(op)
2549         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode & 3]);            // callh   read16
2550         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode]);               // callh   read16
25502551         UML_SEXT(block, R32(G_RD(op)), IREG(0), WORD);                           // sext    rd,i0,word
25512552         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
25522553         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
25562557         UML_ADD(block, IREG(0), R32(G_RA(op)), IMM((INT16)G_SIMM(op)));               // add     i0,ra,simm
25572558         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
25582559         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op));                        // mapvar  dsisr,DSISR_IMMU(op)
2559         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]);            // callh   read32
2560         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode]);               // callh   read32
25602561         UML_MOV(block, R32(G_RD(op)), IREG(0));                                 // mov     rd,i0
25612562         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
25622563         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
25662567         UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op)));            // add     i0,ra,simm
25672568         UML_AND(block, IREG(1), R32(G_RS(op)), IMM(0xff));                        // and     i1,rs,0xff
25682569         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op));                           // mapvar  dsisr,DSISR_IMM(op)
2569         UML_CALLH(block, ppc->impstate->write8[ppc->impstate->mode & 3]);            // callh   write8
2570         UML_CALLH(block, ppc->impstate->write8[ppc->impstate->mode]);               // callh   write8
25702571         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
25712572         return TRUE;
25722573
r2864r2865
25742575         UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op)));            // add     i0,ra,simm
25752576         UML_AND(block, IREG(1), R32(G_RS(op)), IMM(0xffff));                     // and     i1,rs,0xffff
25762577         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op));                           // mapvar  dsisr,DSISR_IMM(op)
2577         UML_CALLH(block, ppc->impstate->write16[ppc->impstate->mode & 3]);            // callh   write16
2578         UML_CALLH(block, ppc->impstate->write16[ppc->impstate->mode]);               // callh   write16
25782579         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
25792580         return TRUE;
25802581
r2864r2865
25822583         UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op)));            // add     i0,ra,simm
25832584         UML_MOV(block, IREG(1), R32(G_RS(op)));                                 // mov     i1,rs
25842585         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op));                           // mapvar  dsisr,DSISR_IMM(op)
2585         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]);            // callh   write32
2586         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode]);               // callh   write32
25862587         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
25872588         return TRUE;
25882589
r2864r2865
25912592         UML_AND(block, IREG(1), R32(G_RS(op)), IMM(0xff));                        // and     i1,rs,0xff
25922593         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
25932594         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op));                        // mapvar  dsisr,DSISR_IMMU(op)
2594         UML_CALLH(block, ppc->impstate->write8[ppc->impstate->mode & 3]);            // callh   write8
2595         UML_CALLH(block, ppc->impstate->write8[ppc->impstate->mode]);               // callh   write8
25952596         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
25962597         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
25972598         return TRUE;
r2864r2865
26012602         UML_AND(block, IREG(1), R32(G_RS(op)), IMM(0xffff));                     // and     i1,rs,0xffff
26022603         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
26032604         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op));                        // mapvar  dsisr,DSISR_IMMU(op)
2604         UML_CALLH(block, ppc->impstate->write16[ppc->impstate->mode & 3]);            // callh   write16
2605         UML_CALLH(block, ppc->impstate->write16[ppc->impstate->mode]);               // callh   write16
26052606         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
26062607         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
26072608         return TRUE;
r2864r2865
26112612         UML_MOV(block, IREG(1), R32(G_RS(op)));                                 // mov     i1,rs
26122613         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
26132614         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op));                        // mapvar  dsisr,DSISR_IMMU(op)
2614         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]);            // callh   write32
2615         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode]);               // callh   write32
26152616         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
26162617         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
26172618         return TRUE;
r2864r2865
26232624         {
26242625            UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM((INT16)G_SIMM(op) + 4 * (regnum - G_RD(op))));
26252626                                                                     // add     i0,[tempaddr],simm + 4*(regnum-rd)
2626            UML_CALLH(block, ppc->impstate->read32align[ppc->impstate->mode & 3]);      // callh   read32align
2627            UML_CALLH(block, ppc->impstate->read32align[ppc->impstate->mode]);         // callh   read32align
26272628            UML_MOV(block, R32(regnum), IREG(0));                              // mov     regnum,i0
26282629         }
26292630         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
26372638            UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM((INT16)G_SIMM(op) + 4 * (regnum - G_RS(op))));
26382639                                                                     // add     i0,[tempaddr],simm + 4*(regnum-rs)
26392640            UML_MOV(block, IREG(1), R32(regnum));                              // mov     i1,regnum
2640            UML_CALLH(block, ppc->impstate->write32align[ppc->impstate->mode & 3]);      // callh   write32align
2641            UML_CALLH(block, ppc->impstate->write32align[ppc->impstate->mode]);         // callh   write32align
26412642         }
26422643         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
26432644         return TRUE;
r2864r2865
26452646      case 0x30:   /* LFS */
26462647         UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op)));            // add     i0,ra,simm
26472648         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op));                           // mapvar  dsisr,DSISR_IMM(op)
2648         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]);            // callh   read32
2649         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode]);               // callh   read32
26492650         UML_MOV(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0));                  // mov     [tempdata],i0
26502651         UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.w.l), DWORD);   // fdfrflt fd,[tempdata],dword
26512652         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
26542655      case 0x32:   /* LFD */
26552656         UML_ADD(block, IREG(0), R32Z(G_RA(op)), IMM((INT16)G_SIMM(op)));            // add     i0,ra,simm
26562657         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op));                           // mapvar  dsisr,DSISR_IMM(op)
2657         UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode & 3]);            // callh   read64
2658         UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode]);               // callh   read64
26582659         UML_DMOV(block, MEM(&ppc->impstate->tempdata.d), IREG(0));                  // dmov    [tempdata],i0
26592660         UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.d));            // fdmov   fd,[tempdata]
26602661         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
26642665         UML_ADD(block, IREG(0), R32(G_RA(op)), IMM((INT16)G_SIMM(op)));               // add     i0,ra,simm
26652666         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
26662667         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op));                        // mapvar  dsisr,DSISR_IMMU(op)
2667         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]);            // callh   read32
2668         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode]);               // callh   read32
26682669         UML_MOV(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0));                  // mov     [tempdata],i0
26692670         UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.w.l), DWORD);   // fdfrflt fd,[tempdata],dword
26702671         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
r2864r2865
26752676         UML_ADD(block, IREG(0), R32(G_RA(op)), IMM((INT16)G_SIMM(op)));               // add     i0,ra,simm
26762677         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
26772678         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op));                        // mapvar  dsisr,DSISR_IMMU(op)
2678         UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode & 3]);            // callh   read64
2679         UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode]);               // callh   read64
26792680         UML_DMOV(block, MEM(&ppc->impstate->tempdata.d), IREG(0));                  // dmov    [tempdata],i0
26802681         UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.d));            // fdmov   fd,[tempdata]
26812682         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
r2864r2865
26872688         UML_FSFRFLT(block, MEM(&ppc->impstate->tempdata.w.l), F64(G_RS(op)), QWORD);   // fsfrflt [tempdata],rs,qword
26882689         UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l));                  // mov     i1,[tempdata]
26892690         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op));                           // mapvar  dsisr,DSISR_IMM(op)
2690         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]);            // callh   write32
2691         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode]);               // callh   write32
26912692         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
26922693         return TRUE;
26932694
r2864r2865
26962697         UML_FDMOV(block, MEM(&ppc->impstate->tempdata.d), F64(G_RS(op)));            // fdmov   [tempdata],rs
26972698         UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata.d));                  // dmov    i1,[tempdata]
26982699         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMM(op));                           // mapvar  dsisr,DSISR_IMM(op)
2699         UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode & 3]);            // callh   write64
2700         UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode]);               // callh   write64
27002701         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
27012702         return TRUE;
27022703
r2864r2865
27062707         UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l));                  // mov     i1,[tempdata]
27072708         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
27082709         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op));                        // mapvar  dsisr,DSISR_IMMU(op)
2709         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]);            // callh   write32
2710         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode]);               // callh   write32
27102711         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
27112712         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
27122713         return TRUE;
r2864r2865
27172718         UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata.d));                  // dmov    i1,[tempdata]
27182719         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
27192720         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IMMU(op));                        // mapvar  dsisr,DSISR_IMMU(op)
2720         UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode & 3]);            // callh   write64
2721         UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode]);               // callh   write64
27212722         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
27222723         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
27232724         return TRUE;
r2864r2865
31693170      case 0x057:   /* LBZX */
31703171         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
31713172         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3172         UML_CALLH(block, ppc->impstate->read8[ppc->impstate->mode & 3]);            // callh   read8
3173         UML_CALLH(block, ppc->impstate->read8[ppc->impstate->mode]);               // callh   read8
31733174         UML_AND(block, R32(G_RD(op)), IREG(0), IMM(0xff));                        // and     rd,i0,0xff
31743175         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
31753176         return TRUE;
r2864r2865
31773178      case 0x117:   /* LHZX */
31783179         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
31793180         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3180         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode & 3]);            // callh   read16
3181         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode]);               // callh   read16
31813182         UML_AND(block, R32(G_RD(op)), IREG(0), IMM(0xffff));                     // and     rd,i0,0xffff
31823183         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
31833184         return TRUE;
r2864r2865
31853186      case 0x157:   /* LHAX */
31863187         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
31873188         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3188         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode & 3]);            // callh   read16
3189         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode]);               // callh   read16
31893190         UML_SEXT(block, R32(G_RD(op)), IREG(0), WORD);                           // sext    rd,i0,word
31903191         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
31913192         return TRUE;
r2864r2865
31933194      case 0x017:   /* LWZX */
31943195         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
31953196         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3196         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]);            // callh   read32
3197         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode]);               // callh   read32
31973198         UML_MOV(block, R32(G_RD(op)), IREG(0));                                 // mov     rd,i0
31983199         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
31993200         return TRUE;
r2864r2865
32013202      case 0x217:   /* LFSX */
32023203         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
32033204         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3204         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]);            // callh   read32
3205         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode]);               // callh   read32
32053206         UML_MOV(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0));                  // mov     [tempdata],i0
32063207         UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.w.l), DWORD);   // fdfrflt fd,[tempdata],dword
32073208         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
32103211      case 0x257:   /* LFDX */
32113212         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
32123213         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3213         UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode & 3]);            // callh   read64
3214         UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode]);               // callh   read64
32143215         UML_DMOV(block, MEM(&ppc->impstate->tempdata.d), IREG(0));                  // dmov    [tempdata],i0
32153216         UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.d));            // fdmov   fd,[tempdata]
32163217         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
32193220      case 0x316:   /* LHBRX */
32203221         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
32213222         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3222         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode & 3]);            // callh   read16
3223         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode]);               // callh   read16
32233224         UML_BSWAP(block, IREG(0), IREG(0));                                    // bswap   i0,i0
32243225         UML_SHR(block, R32(G_RD(op)), IREG(0), IMM(16));                        // shr     rd,i0,16
32253226         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
32283229      case 0x216:   /* LWBRX */
32293230         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
32303231         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3231         UML_CALLH(block, ppc->impstate->read32align[ppc->impstate->mode & 3]);         // callh   read32align
3232         UML_CALLH(block, ppc->impstate->read32align[ppc->impstate->mode]);            // callh   read32align
32323233         UML_BSWAP(block, R32(G_RD(op)), IREG(0));                              // bswap   rd,i0
32333234         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
32343235         return TRUE;
r2864r2865
32373238         UML_ADD(block, IREG(0), R32(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
32383239         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
32393240         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDXU(op));                        // mapvar  dsisr,DSISR_IDXU(op)
3240         UML_CALLH(block, ppc->impstate->read8[ppc->impstate->mode & 3]);            // callh   read8
3241         UML_CALLH(block, ppc->impstate->read8[ppc->impstate->mode]);               // callh   read8
32413242         UML_AND(block, R32(G_RD(op)), IREG(0), IMM(0xff));                        // and     rd,i0,0xff
32423243         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
32433244         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
32473248         UML_ADD(block, IREG(0), R32(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
32483249         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
32493250         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDXU(op));                        // mapvar  dsisr,DSISR_IDXU(op)
3250         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode & 3]);            // callh   read16
3251         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode]);               // callh   read16
32513252         UML_AND(block, R32(G_RD(op)), IREG(0), IMM(0xffff));                     // and     rd,i0,0xffff
32523253         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
32533254         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
32573258         UML_ADD(block, IREG(0), R32(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
32583259         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
32593260         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDXU(op));                        // mapvar  dsisr,DSISR_IDXU(op)
3260         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode & 3]);            // callh   read16
3261         UML_CALLH(block, ppc->impstate->read16[ppc->impstate->mode]);               // callh   read16
32613262         UML_SEXT(block, R32(G_RD(op)), IREG(0), WORD);                           // sext    rd,i0,word
32623263         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
32633264         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
32673268         UML_ADD(block, IREG(0), R32(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
32683269         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
32693270         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDXU(op));                        // mapvar  dsisr,DSISR_IDXU(op)
3270         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]);            // callh   read32
3271         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode]);               // callh   read32
32713272         UML_MOV(block, R32(G_RD(op)), IREG(0));                                 // mov     rd,i0
32723273         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
32733274         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
r2864r2865
32773278         UML_ADD(block, IREG(0), R32(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
32783279         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
32793280         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3280         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode & 3]);            // callh   read32
3281         UML_CALLH(block, ppc->impstate->read32[ppc->impstate->mode]);               // callh   read32
32813282         UML_MOV(block, MEM(&ppc->impstate->tempdata.w.l), IREG(0));                  // mov     [tempdata],i0
32823283         UML_FDFRFLT(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.w.l), DWORD);   // fdfrflt fd,[tempdata],dword
32833284         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
r2864r2865
32883289         UML_ADD(block, IREG(0), R32(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
32893290         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
32903291         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3291         UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode & 3]);            // callh   read64
3292         UML_CALLH(block, ppc->impstate->read64[ppc->impstate->mode]);               // callh   read64
32923293         UML_DMOV(block, MEM(&ppc->impstate->tempdata.d), IREG(0));                  // dmov    [tempdata],i0
32933294         UML_FDMOV(block, F64(G_RD(op)), MEM(&ppc->impstate->tempdata.d));            // fdmov   fd,[tempdata]
32943295         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
r2864r2865
32983299      case 0x014:   /* LWARX */
32993300         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
33003301         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3301         UML_CALLH(block, ppc->impstate->read32align[ppc->impstate->mode & 3]);         // callh   read32align
3302         UML_CALLH(block, ppc->impstate->read32align[ppc->impstate->mode]);            // callh   read32align
33023303         UML_MOV(block, R32(G_RD(op)), IREG(0));                                 // mov     rd,i0
33033304         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
33043305         return TRUE;
r2864r2865
33063307      case 0x255:   /* LSWI */
33073308         UML_MOV(block, MEM(&ppc->impstate->updateaddr), R32Z(G_RA(op)));            // mov     [updateaddr],ra
33083309         UML_MOV(block, MEM(&ppc->impstate->swcount), IMM(((G_NB(op) - 1) & 0x1f) + 1));   // mov     [swcount],G_NB
3309         UML_CALLH(block, ppc->impstate->lsw[ppc->impstate->mode & 3][G_RD(op)]);      // call    lsw[rd]
3310         UML_CALLH(block, ppc->impstate->lsw[ppc->impstate->mode][G_RD(op)]);      // call    lsw[rd]
33103311         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
33113312         return TRUE;
33123313
r2864r2865
33143315         UML_ADD(block, MEM(&ppc->impstate->updateaddr), R32Z(G_RA(op)), R32(G_RB(op)));   // add     [updateaddr],ra,rb
33153316         UML_AND(block, MEM(&ppc->impstate->swcount), SPR32(SPR_XER), IMM(0x7f));      // and     [swcount],[xer],0x7f
33163317         UML_SUB(block, MEM(&ppc->icount), MEM(&ppc->icount), MEM(&ppc->impstate->swcount));// sub  icount,icount,[swcount]
3317         UML_CALLHc(block, IF_NZ, ppc->impstate->lsw[ppc->impstate->mode & 3][G_RD(op)]);// call    lsw[rd],nz
3318         UML_CALLHc(block, IF_NZ, ppc->impstate->lsw[ppc->impstate->mode][G_RD(op)]);// call    lsw[rd],nz
33183319         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
33193320         return TRUE;
33203321
r2864r2865
33263327         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
33273328         UML_AND(block, IREG(1), R32(G_RS(op)), IMM(0xff));                        // and     i1,rs,0xff
33283329         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3329         UML_CALLH(block, ppc->impstate->write8[ppc->impstate->mode & 3]);            // callh   write8
3330         UML_CALLH(block, ppc->impstate->write8[ppc->impstate->mode]);               // callh   write8
33303331         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
33313332         return TRUE;
33323333
r2864r2865
33343335         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
33353336         UML_AND(block, IREG(1), R32(G_RS(op)), IMM(0xffff));                     // and     i1,rs
33363337         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3337         UML_CALLH(block, ppc->impstate->write16[ppc->impstate->mode & 3]);            // callh   write16
3338         UML_CALLH(block, ppc->impstate->write16[ppc->impstate->mode]);               // callh   write16
33383339         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
33393340         return TRUE;
33403341
r2864r2865
33423343         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
33433344         UML_MOV(block, IREG(1), R32(G_RS(op)));                                 // mov     i1,rs
33443345         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3345         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]);            // callh   write32
3346         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode]);               // callh   write32
33463347         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
33473348         return TRUE;
33483349
r2864r2865
33513352         UML_FSFRFLT(block, MEM(&ppc->impstate->tempdata.w.l), F64(G_RS(op)), QWORD);   // fsfrflt [tempdata],rs,qword
33523353         UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l));                  // mov     i1,[tempdata]
33533354         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3354         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]);            // callh   write32
3355         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode]);               // callh   write32
33553356         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
33563357         return TRUE;
33573358
r2864r2865
33603361         UML_FDMOV(block, MEM(&ppc->impstate->tempdata.d), F64(G_RS(op)));            // fdmov   [tempdata],rs
33613362         UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l));                  // mov     i1,[tempdata.lo]
33623363         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3363         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]);            // callh   write32
3364         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode]);               // callh   write32
33643365         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
33653366         return TRUE;
33663367
r2864r2865
33693370         UML_FDMOV(block, MEM(&ppc->impstate->tempdata.d), F64(G_RS(op)));            // fdmov   [tempdata],rs
33703371         UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata.d));                  // dmov    i1,[tempdata]
33713372         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3372         UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode & 3]);            // callh   write64
3373         UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode]);               // callh   write64
33733374         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
33743375         return TRUE;
33753376
r2864r2865
33783379         UML_BSWAP(block, IREG(1), R32(G_RS(op)));                              // bswap   i1,rs
33793380         UML_SHR(block, IREG(1), IREG(1), IMM(16));                              // shr     i1,i1,16
33803381         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3381         UML_CALLH(block, ppc->impstate->write16[ppc->impstate->mode & 3]);            // callh   write16
3382         UML_CALLH(block, ppc->impstate->write16[ppc->impstate->mode]);               // callh   write16
33823383         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
33833384         return TRUE;
33843385
r2864r2865
33863387         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
33873388         UML_BSWAP(block, IREG(1), R32(G_RS(op)));                              // bswap   i1,rs
33883389         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3389         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]);            // callh   write32
3390         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode]);               // callh   write32
33903391         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
33913392         return TRUE;
33923393
r2864r2865
33953396         UML_AND(block, IREG(1), R32(G_RS(op)), IMM(0xff));                        // and     i1,rs,0xff
33963397         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
33973398         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3398         UML_CALLH(block, ppc->impstate->write8[ppc->impstate->mode & 3]);            // callh   write8
3399         UML_CALLH(block, ppc->impstate->write8[ppc->impstate->mode]);               // callh   write8
33993400         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
34003401         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
34013402         return TRUE;
r2864r2865
34053406         UML_AND(block, IREG(1), R32(G_RS(op)), IMM(0xffff));                     // and     i1,rs,0xffff
34063407         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
34073408         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3408         UML_CALLH(block, ppc->impstate->write16[ppc->impstate->mode & 3]);            // callh   write16
3409         UML_CALLH(block, ppc->impstate->write16[ppc->impstate->mode]);               // callh   write16
34093410         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
34103411         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
34113412         return TRUE;
r2864r2865
34153416         UML_MOV(block, IREG(1), R32(G_RS(op)));                                 // mov     i1,rs
34163417         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
34173418         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDXU(op));                        // mapvar  dsisr,DSISR_IDXU(op)
3418         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]);            // callh   write32
3419         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode]);               // callh   write32
34193420         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
34203421         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
34213422         return TRUE;
r2864r2865
34263427         UML_MOV(block, IREG(1), MEM(&ppc->impstate->tempdata.w.l));                  // mov     i1,[tempdata]
34273428         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
34283429         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3429         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode & 3]);            // callh   write32
3430         UML_CALLH(block, ppc->impstate->write32[ppc->impstate->mode]);               // callh   write32
34303431         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
34313432         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
34323433         return TRUE;
r2864r2865
34373438         UML_DMOV(block, IREG(1), MEM(&ppc->impstate->tempdata.d));                  // dmov    i1,[tempdata]
34383439         UML_MOV(block, MEM(&ppc->impstate->updateaddr), IREG(0));                  // mov     [updateaddr],i0
34393440         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3440         UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode & 3]);            // callh   write64
3441         UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode]);               // callh   write64
34413442         UML_MOV(block, R32(G_RA(op)), MEM(&ppc->impstate->updateaddr));               // mov     ra,[updateaddr]
34423443         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
34433444         return TRUE;
r2864r2865
34463447         UML_ADD(block, IREG(0), R32Z(G_RA(op)), R32(G_RB(op)));                     // add     i0,ra,rb
34473448         UML_MOV(block, IREG(1), R32(G_RS(op)));                                 // mov     i1,rs
34483449         UML_MAPVAR(block, MAPVAR_DSISR, DSISR_IDX(op));                           // mapvar  dsisr,DSISR_IDX(op)
3449         UML_CALLH(block, ppc->impstate->write32align[ppc->impstate->mode & 3]);         // callh   write32align
3450         UML_CALLH(block, ppc->impstate->write32align[ppc->impstate->mode]);            // callh   write32align
34503451         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
34513452         UML_CMP(block, IREG(0), IREG(0));                                    // cmp     i0,i0
34523453         generate_compute_flags(block, desc, TRUE, 0, FALSE);                     // <update flags>
r2864r2865
34553456      case 0x2d5:   /* STSWI */
34563457         UML_MOV(block, MEM(&ppc->impstate->updateaddr), R32Z(G_RA(op)));            // mov     [updateaddr],ra
34573458         UML_MOV(block, MEM(&ppc->impstate->swcount), IMM(((G_NB(op) - 1) & 0x1f) + 1));   // mov     [swcount],G_NB
3458         UML_CALLH(block, ppc->impstate->stsw[ppc->impstate->mode & 3][G_RD(op)]);      // call    stsw[rd]
3459         UML_CALLH(block, ppc->impstate->stsw[ppc->impstate->mode][G_RD(op)]);      // call    stsw[rd]
34593460         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
34603461         return TRUE;
34613462
r2864r2865
34633464         UML_ADD(block, MEM(&ppc->impstate->updateaddr), R32Z(G_RA(op)), R32(G_RB(op)));   // add     [updateaddr],ra,rb
34643465         UML_AND(block, MEM(&ppc->impstate->swcount), SPR32(SPR_XER), IMM(0x7f));      // and     [swcount],[xer],0x7f
34653466         UML_SUB(block, MEM(&ppc->icount), MEM(&ppc->icount), MEM(&ppc->impstate->swcount));// sub  icount,icount,[swcount]
3466         UML_CALLHc(block, IF_NZ, ppc->impstate->stsw[ppc->impstate->mode & 3][G_RD(op)]);// call   stsw[rd]
3467         UML_CALLHc(block, IF_NZ, ppc->impstate->stsw[ppc->impstate->mode][G_RD(op)]);// call   stsw[rd]
34673468         generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);            // <update cycles>
34683469         return TRUE;
34693470
r2864r2865
34913492         {
34923493            UML_ADD(block, IREG(0), MEM(&ppc->impstate->tempaddr), IMM(8 * item));      // add     i0,[tempaddr],8*item
34933494            UML_DMOV(block, IREG(1), IMM(0));                                 // dmov    i1,0
3494            UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode & 3]);         // callh   write64
3495            UML_CALLH(block, ppc->impstate->write64[ppc->impstate->mode]);            // callh   write64
34953496         }
34963497         return TRUE;
34973498
src/emu/cpu/powerpc/ppccom.c
r2864r2865
1414    DEBUGGING
1515***************************************************************************/
1616 
17#define PRINTF_TLB_FILL         (1)
1817#define PRINTF_SPU            (0)
1918#define PRINTF_DECREMENTER      (0)
2019 
r2864r2865
6160 
6261 
6362/*-------------------------------------------------
64    tlb_entry_free - free an entry from the TLB,
65    by index
66-------------------------------------------------*/
67 
68INLINE void tlb_entry_free(powerpc_state *ppc, int entrynum)
69{
70   int oldentry = ppc->tlb_entries[entrynum];
71 
72   /* if we're mapped to something, free the entry in the table */
73   if (oldentry != 0)
74   {
75      ppc->tlb_table[oldentry - 1] = 0;
76      ppc->tlb_entries[entrynum] = 0;
77   }
78}
79 
80 
81/*-------------------------------------------------
82    tlb_entry_allocate - allocate a TLB entry
83    for the given address, if needed, and set its
84    new value
85-------------------------------------------------*/
86 
87INLINE int tlb_entry_allocate(powerpc_state *ppc, int entrynum, offs_t address, UINT32 value)
88{
89   UINT32 *entry = &ppc->tlb_table[address >> 12];
90   int allocated = FALSE;
91 
92   /* only need to allocate if we are empty */
93   if (*entry == 0)
94   {
95      /* if there's already a TLB entry at the current index, zap it */
96      tlb_entry_free(ppc, entrynum);
97 
98      /* allocate a new entry and advance to the next one */
99      ppc->tlb_entries[entrynum] = (address >> 12) + 1;
100      allocated = TRUE;
101   }
102   *entry = value;
103 
104   return allocated;
105}
106 
107 
108/*-------------------------------------------------
10963    get_cr - return the current CR value
11064-------------------------------------------------*/
11165 
r2864r2865
229183    structure based on the configured type
230184-------------------------------------------------*/
231185 
232size_t ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, int clock, const powerpc_config *config, int (*irqcallback)(int), void *memory)
186void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, int clock, const powerpc_config *config, int (*irqcallback)(int))
233187{
234   /* if no memory, return the amount needed */
235   if (memory == NULL)
236      return sizeof(ppc->tlb_table[0]) * (POWERPC_TLB_ENTRIES + PPC603_FIXED_TLB_ENTRIES + (1 << (32 - POWERPC_MIN_PAGE_SHIFT)));
237 
238188   /* initialize based on the config */
239189   memset(ppc, 0, sizeof(*ppc));
240190   ppc->cpunum = cpu_getactivecpu();
r2864r2865
247197   ppc->system_clock = (config != NULL) ? config->bus_frequency : clock;
248198   ppc->tb_divisor = (ppc->tb_divisor * clock + ppc->system_clock / 2 - 1) / ppc->system_clock;
249199 
250   /* initialize the TLB state */
251   ppc->tlb_entries = memory;
252   ppc->tlb_table = ppc->tlb_entries + POWERPC_TLB_ENTRIES + PPC603_FIXED_TLB_ENTRIES;
200   /* allocate the virtual TLB */
201   ppc->vtlb = vtlb_alloc(cpu_getactivecpu(), ADDRESS_SPACE_PROGRAM, (cap & PPCCAP_603_MMU) ? PPC603_FIXED_TLB_ENTRIES : 0, POWERPC_TLB_ENTRIES);
253202 
254203   /* allocate a timer for the compare interrupt */
255204   if (cap & PPCCAP_OEA)
r2864r2865
265214 
266215   /* reset the state */
267216   ppccom_reset(ppc);
268   return 0;
269217}
270218 
271219 
272220/*-------------------------------------------------
221    ppccom_exit - common cleanup/exit
222-------------------------------------------------*/
223 
224void ppccom_exit(powerpc_state *ppc)
225{
226   if (ppc->vtlb != NULL)
227      vtlb_free(ppc->vtlb);
228}
229 
230 
231/*-------------------------------------------------
273232    ppccom_reset - reset the state of all the
274233    registers
275234-------------------------------------------------*/
276235 
277236void ppccom_reset(powerpc_state *ppc)
278237{
238   int tlbindex;
239 
279240   /* initialize the OEA state */
280241   if (ppc->cap & PPCCAP_OEA)
281242   {
r2864r2865
307268   ppc->irq_pending = 0;
308269 
309270   /* flush the TLB */
310   ppc->tlb_index = 0;
311   memset(ppc->tlb_entries, 0, sizeof(ppc->tlb_entries[0]) * (POWERPC_TLB_ENTRIES + PPC603_FIXED_TLB_ENTRIES));
312   memset(ppc->tlb_table, 0, sizeof(ppc->tlb_table[0]) * (1 << (32 - POWERPC_MIN_PAGE_SHIFT)));
271   vtlb_flush_dynamic(ppc->vtlb);
272   if (ppc->cap & PPCCAP_603_MMU)
273      for (tlbindex = 0; tlbindex < PPC603_FIXED_TLB_ENTRIES; tlbindex++)
274         vtlb_load(ppc->vtlb, tlbindex, 0, 0, 0);
313275}
314276 
315277 
r2864r2865
349311   int batbase, batnum, hashnum;
350312   UINT32 segreg;
351313 
314   /* 4xx case: "TLB" really just caches writes and checks compare registers */
315   if (ppc->cap & PPCCAP_4XX)
316   {
317      /* we don't support the MMU of the 403GCX */
318      if (ppc->flavor == PPC_MODEL_403GCX && (ppc->msr & MSROEA_DR))
319         fatalerror("MMU enabled but not supported!");
320 
321      /* only check if PE is enabled */
322      if (transtype == TRANSLATE_WRITE && (ppc->msr & MSR4XX_PE))
323      {
324         /* are we within one of the protection ranges? */
325         int inrange1 = ((*address >> 12) >= (ppc->spr[SPR4XX_PBL1] >> 12) && (*address >> 12) < (ppc->spr[SPR4XX_PBU1] >> 12));
326         int inrange2 = ((*address >> 12) >= (ppc->spr[SPR4XX_PBL2] >> 12) && (*address >> 12) < (ppc->spr[SPR4XX_PBU2] >> 12));
327 
328         /* if PX == 1, writes are only allowed OUTSIDE of the bounds */
329         if (((ppc->msr & MSR4XX_PX) && (inrange1 || inrange2)) || (!(ppc->msr & MSR4XX_PX) && (!inrange1 && !inrange2)))
330            return 0x002;
331      }
332      *address &= 0x7fffffff;
333      return 0x001;
334   }
335 
352336   /* only applies if we support the OEA */
353337   if (!(ppc->cap & PPCCAP_OEA))
354338      return 0x001;
r2864r2865
471455 
472456void ppccom_tlb_fill(powerpc_state *ppc)
473457{
474   int transuser = (ppc->msr & MSR_PR) ? TRANSLATE_USER_MASK : 0;
475   offs_t address = ppc->param0;
476   int transtype = ppc->param1;
477   offs_t transaddr = address;
478   UINT32 entryval;
479 
480   /* 4xx case: "TLB" really just caches writes and checks compare registers */
481   if (ppc->cap & PPCCAP_4XX)
482   {
483      /* assume success and direct translation */
484      ppc->param0 = 1;
485      transaddr = address & 0x7fffffff;
486 
487      /* we don't support the MMU of the 403GCX */
488      if (ppc->flavor == PPC_MODEL_403GCX && (ppc->msr & MSROEA_DR))
489         fatalerror("MMU enabled but not supported!");
490 
491      /* only check if PE is enabled */
492      if (transtype == TRANSLATE_WRITE && (ppc->msr & MSR4XX_PE))
493      {
494         /* are we within one of the protection ranges? */
495         int inrange1 = ((address >> 12) >= (ppc->spr[SPR4XX_PBL1] >> 12) && (address >> 12) < (ppc->spr[SPR4XX_PBU1] >> 12));
496         int inrange2 = ((address >> 12) >= (ppc->spr[SPR4XX_PBL2] >> 12) && (address >> 12) < (ppc->spr[SPR4XX_PBU2] >> 12));
497 
498         /* if PX == 1, writes are only allowed OUTSIDE of the bounds */
499         if (((ppc->msr & MSR4XX_PX) && (inrange1 || inrange2)) || (!(ppc->msr & MSR4XX_PX) && (!inrange1 && !inrange2)))
500            ppc->param0 = 2;
501      }
502   }
503 
504   /* OEA case: perform an address translation */
505   else
506      ppc->param0 = ppccom_translate_address_internal(ppc, transtype | transuser, &transaddr);
507 
508   /* log information and return upon failure */
509   if (PRINTF_TLB_FILL)
510      printf("tlb_fill: %08X (%s%s) -> ", address, (transtype == TRANSLATE_READ) ? "R" : (transtype == TRANSLATE_WRITE) ? "W" : "F", transuser ? "U" : "S");
511   if (ppc->param0 > 1)
512   {
513      if (PRINTF_TLB_FILL)
514         printf("failed(%08X)\n", ppc->param0);
515      return;
516   }
517 
518   /* if we did translate the address, get a pointer to our entry in the TLB table and fill it in */
519   if (PRINTF_TLB_FILL)
520      printf("succeeded(%d) -> %08X\n", ppc->param0, transaddr);
521   entryval = (transaddr & 0xfffff000) | TLB_READ | ((ppc->param0 & 1) ? TLB_WRITE : 0);
522   if (tlb_entry_allocate(ppc, ppc->tlb_index, address, entryval))
523      ppc->tlb_index = (ppc->tlb_index + 1) % POWERPC_TLB_ENTRIES;
458   vtlb_fill(ppc->vtlb, ppc->param0, ppc->param1);
524459}
525460 
526461 
r2864r2865
531466 
532467void ppccom_tlb_flush(powerpc_state *ppc)
533468{
534   int entnum;
535 
536   /* iterate over entries and invalidate them */
537   for (entnum = 0; entnum < POWERPC_TLB_ENTRIES; entnum++)
538      tlb_entry_free(ppc, entnum);
469   vtlb_flush_dynamic(ppc->vtlb);
539470}
540471 
541472 
r2864r2865
551482 
552483void ppccom_execute_tlbie(powerpc_state *ppc)
553484{
554   offs_t address = ppc->param0;
555 
556   /* just nuke it in the table; we may have spare entries referencing it, but no harm */
557   ppc->tlb_table[address >> 12] = 0;
485   vtlb_flush_address(ppc->vtlb, ppc->param0);
558486}
559487 
560488 
r2864r2865
565493 
566494void ppccom_execute_tlbia(powerpc_state *ppc)
567495{
568   ppccom_tlb_flush(ppc);
496   vtlb_flush_dynamic(ppc->vtlb);
569497}
570498 
571499 
r2864r2865
578506{
579507   UINT32 address = ppc->param0;
580508   int isitlb = ppc->param1;
581   UINT32 entrynum, entryval;
509   vtlb_entry flags = 0;
510   int entrynum;
582511 
583512   /* determine entry number; we use rand() for associativity */
584513   entrynum = ((address >> 12) & 0x1f) | (mame_rand(Machine) & 0x20) | (isitlb ? 0x40 : 0);
585514 
586   /* invalidate any existing TLB entry here */
587   ppc->tlb_table[address >> 12] = 0;
515   /* determine the flags */
516   flags = VTLB_FLAG_VALID | VTLB_READ_ALLOWED | VTLB_FETCH_ALLOWED;
517   if (ppc->spr[SPR603_RPA] & 0x80)
518      flags |= VTLB_WRITE_ALLOWED;
519   if (isitlb)
520      flags |= VTLB_FETCH_ALLOWED;
588521 
589   /* allocate this entry */
590   entryval = (ppc->spr[SPR603_RPA] & 0xfffff000) | TLB_READ | ((ppc->spr[SPR603_RPA] & 0x80) ? TLB_WRITE : 0);
591   tlb_entry_allocate(ppc, POWERPC_TLB_ENTRIES + entrynum, address, entryval);
592   if (PRINTF_TLB_FILL)
593      printf("tlb_load: %08X (%sS) -> %08X\n", address, isitlb ? "F" : "R", ppc->spr[SPR603_RPA] & 0xfffff000);
522   /* load the entry */
523   vtlb_load(ppc->vtlb, entrynum, 1, address, (ppc->spr[SPR603_RPA] & 0xfffff000) | flags);
594524}
595525 
596526 
r2864r2865
18971827 
18981828      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
18991829      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 31;               break;
1900      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1901      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = 0;               break;
1830      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1831      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = POWERPC_MIN_PAGE_SHIFT;break;
19021832 
19031833      /* --- the following bits of info are returned as pointers to data or functions --- */
19041834      case CPUINFO_PTR_INIT:                     /* provided per-CPU */               break;
src/emu/cpu/powerpc/ppccom.h
r2864r2865
1111 
1212#include "cpuintrf.h"
1313#include "ppc.h"
14#include "cpu/vtlb.h"
1415 
1516 
1617/***************************************************************************
r2864r2865
3940#define PPCCAP_603_MMU            0x20      /* TRUE if we have 603-class MMU features */
4041 
4142 
42/* bits in our internal TLB */
43#define TLB_READ               0x01      /* reads are allowed */
44#define TLB_WRITE               0x02      /* writes are allowed */
45 
46 
4743/* PowerPC flavors */
4844enum _powerpc_flavor
4945{
r2864r2865
531527   UINT32         param1;
532528 
533529   /* MMU */
534   UINT32 *      tlb_table;
535   UINT32 *      tlb_entries;
536   UINT32         tlb_index;
530   vtlb_state *   vtlb;
537531 
538532   /* architectural distinctions */
539533   powerpc_flavor   flavor;
r2864r2865
574568    FUNCTION PROTOTYPES
575569***************************************************************************/
576570 
577size_t ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, int clock, const powerpc_config *config, int (*irqcallback)(int), void *memory);
571void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, int clock, const powerpc_config *config, int (*irqcallback)(int));
572void ppccom_exit(powerpc_state *ppc);
573 
578574void ppccom_reset(powerpc_state *ppc);
579575#ifdef ENABLE_DEBUGGER
580576offs_t ppccom_dasm(powerpc_state *ppc, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
src/emu/cpu/vtlb.c
r0r2865
1/***************************************************************************
2
3    vtlb.c
4
5    Generic virtual TLB implementation.
6
7    Copyright Aaron Giles
8    Released for general non-commercial use under the MAME license
9    Visit http://mamedev.org for licensing and usage restrictions.
10
11***************************************************************************/
12
13#include "vtlb.h"
14
15
16
17/***************************************************************************
18    DEBUGGING
19***************************************************************************/
20
21#define PRINTF_TLB         (0)
22
23
24
25/***************************************************************************
26    TYPE DEFINITIONS
27***************************************************************************/
28
29/* VTLB state */
30struct _vtlb_state
31{
32   int               space;            /* address space */
33   int             dynamic;         /* number of dynamic entries */
34   int               fixed;            /* number of fixed entries */
35   int               dynindex;         /* index of next dynamic entry */
36   int               pageshift;         /* bits to shift to get page index */
37   int               addrwidth;         /* logical address bus width */
38   offs_t *         live;            /* array of live entries by table index */
39   int *            fixedpages;         /* number of pages each fixed entry covers */
40   vtlb_entry *      table;            /* table of entries by address */
41   cpu_translate_func   translate;         /* translate function */
42};
43
44
45
46/***************************************************************************
47    INITIALIZATION/TEARDOWN
48***************************************************************************/
49
50/*-------------------------------------------------
51    vtlb_alloc - allocate a new VTLB for the
52    given CPU
53-------------------------------------------------*/
54
55vtlb_state *vtlb_alloc(int cpunum, int space, int fixed_entries, int dynamic_entries)
56{
57   vtlb_state *vtlb;
58
59   /* allocate memory for the core structure */
60   vtlb = malloc_or_die(sizeof(*vtlb));
61   memset(vtlb, 0, sizeof(*vtlb));
62
63   /* fill in CPU information */
64   vtlb->space = space;
65   vtlb->dynamic = dynamic_entries;
66   vtlb->fixed = fixed_entries;
67   vtlb->pageshift = cpunum_page_shift(cpunum, space);
68   vtlb->addrwidth = cpunum_logaddr_width(cpunum, space);
69   vtlb->translate = (cpu_translate_func)cpunum_get_info_fct(cpunum, CPUINFO_PTR_TRANSLATE);
70
71   /* validate CPU information */
72   assert((1 << vtlb->pageshift) > VTLB_FLAGS_MASK);
73   assert(vtlb->translate != NULL);
74   assert(vtlb->addrwidth > vtlb->pageshift);
75
76   /* allocate the entry array */
77   vtlb->live = malloc_or_die(sizeof(vtlb->live[0]) * (fixed_entries + dynamic_entries));
78   memset(vtlb->live, 0, sizeof(vtlb->live[0]) * (fixed_entries + dynamic_entries));
79
80   /* allocate the lookup table */
81   vtlb->table = malloc_or_die(sizeof(vtlb->table[0]) << (vtlb->addrwidth - vtlb->pageshift));
82   memset(vtlb->table, 0, sizeof(vtlb->table[0]) << (vtlb->addrwidth - vtlb->pageshift));
83
84   /* allocate the fixed page count array */
85   if (fixed_entries > 0)
86   {
87      vtlb->fixedpages = malloc_or_die(sizeof(vtlb->fixedpages[0]) * fixed_entries);
88      memset(vtlb->fixedpages, 0, sizeof(vtlb->fixedpages[0]) * fixed_entries);
89   }
90
91   return vtlb;
92}
93
94
95/*-------------------------------------------------
96    vtlb_free - free an allocated VTLB
97-------------------------------------------------*/
98
99void vtlb_free(vtlb_state *vtlb)
100{
101   /* free the fixed pages if allocated */
102   if (vtlb->fixedpages != NULL)
103      free(vtlb->fixedpages);
104
105   /* free the table and array if they exist */
106   if (vtlb->live != NULL)
107      free(vtlb->live);
108   if (vtlb->table != NULL)
109      free(vtlb->table);
110
111   /* and then the VTLB object itself */
112   free(vtlb);
113}
114
115
116
117/***************************************************************************
118    FILLING
119***************************************************************************/
120
121/*-------------------------------------------------
122    vtlb_fill - rcalled by the CPU core in
123    response to an unmapped access
124-------------------------------------------------*/
125
126int vtlb_fill(vtlb_state *vtlb, offs_t address, int intention)
127{
128   offs_t tableindex = address >> vtlb->pageshift;
129   vtlb_entry entry = vtlb->table[tableindex];
130   offs_t taddress;
131
132   if (PRINTF_TLB)
133      printf("vtlb_fill: %08X(%X) ... ", address, intention);
134
135   /* should not be called here if the entry is in the table already */
136//  assert((entry & (1 << intention)) == 0);
137
138   /* if we have no dynamic entries, we always fail */
139   if (vtlb->dynamic == 0)
140   {
141      if (PRINTF_TLB)
142         printf("failed: no dynamic entries\n");
143      return FALSE;
144   }
145
146   /* ask the CPU core to translate for us */
147   taddress = address;
148   if (!(*vtlb->translate)(vtlb->space, intention, &taddress))
149   {
150      if (PRINTF_TLB)
151         printf("failed: no translation\n");
152      return FALSE;
153   }
154
155   /* if this is the first successful translation for this address, allocate a new entry */
156   if ((entry & VTLB_FLAGS_MASK) == 0)
157   {
158      int liveindex = vtlb->dynindex++ % vtlb->dynamic;
159
160      /* if an entry already exists at this index, free it */
161      if (vtlb->live[liveindex] != 0)
162         vtlb->table[vtlb->live[liveindex] - 1] = 0;
163
164      /* claim this new entry */
165      vtlb->live[liveindex] = tableindex + 1;
166
167      /* form a new blank entry */
168      entry = (taddress >> vtlb->pageshift) << vtlb->pageshift;
169      entry |= VTLB_FLAG_VALID;
170
171      if (PRINTF_TLB)
172         printf("success (%08X), new entry\n", taddress);
173   }
174
175   /* otherwise, ensure that different intentions do not produce different addresses */
176   else
177   {
178      assert((entry >> vtlb->pageshift) == (taddress >> vtlb->pageshift));
179      assert(entry & VTLB_FLAG_VALID);
180
181      if (PRINTF_TLB)
182         printf("success (%08X), existing entry\n", taddress);
183   }
184
185   /* add the intention to the list of valid intentions and store */
186   entry |= 1 << (intention & (TRANSLATE_TYPE_MASK | TRANSLATE_USER_MASK));
187   vtlb->table[tableindex] = entry;
188   return TRUE;
189}
190
191
192/*-------------------------------------------------
193    vtlb_load - load a fixed VTLB entry
194-------------------------------------------------*/
195
196void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtlb_entry value)
197{
198   offs_t tableindex = address >> vtlb->pageshift;
199   int liveindex = vtlb->dynamic + entrynum;
200   int pagenum;
201
202   /* must be in range */
203   assert(entrynum >= 0 && entrynum < vtlb->fixed);
204
205   if (PRINTF_TLB)
206      printf("vtlb_load %d for %d pages at %08X == %08X\n", entrynum, numpages, address, value);
207
208   /* if an entry already exists at this index, free it */
209   if (vtlb->live[liveindex] != 0)
210   {
211      int pagecount = vtlb->fixedpages[entrynum];
212      for (pagenum = 0; pagenum < pagecount; pagenum++)
213         vtlb->table[vtlb->live[liveindex] - 1 + pagenum] = 0;
214   }
215
216   /* claim this new entry */
217   vtlb->live[liveindex] = tableindex + 1;
218
219   /* store the raw value, making sure the "fixed" flag is set */
220   value |= VTLB_FLAG_FIXED;
221   for (pagenum = 0; pagenum < numpages; pagenum++)
222      vtlb->table[tableindex + pagenum] = value + (pagenum << vtlb->pageshift);
223}
224
225
226
227/***************************************************************************
228    FLUSHING
229***************************************************************************/
230
231/*-------------------------------------------------
232    vtlb_flush_dynamic - flush all knowledge
233    from the dynamic part of the VTLB
234-------------------------------------------------*/
235
236void vtlb_flush_dynamic(vtlb_state *vtlb)
237{
238   int liveindex;
239
240   if (PRINTF_TLB)
241      printf("vtlb_flush_dynamic\n");
242
243   /* loop over live entries and release them from the table */
244   for (liveindex = 0; liveindex < vtlb->dynamic; liveindex++)
245      if (vtlb->live[liveindex] != 0)
246      {
247         offs_t tableindex = vtlb->live[liveindex] - 1;
248         vtlb->table[tableindex] = 0;
249         vtlb->live[liveindex] = 0;
250      }
251}
252
253
254/*-------------------------------------------------
255    vtlb_flush_address - flush knowledge of a
256    particular address from the VTLB
257-------------------------------------------------*/
258
259void vtlb_flush_address(vtlb_state *vtlb, offs_t address)
260{
261   offs_t tableindex = address >> vtlb->pageshift;
262
263   if (PRINTF_TLB)
264      printf("vtlb_flush_address %08X\n", address);
265
266   /* free the entry in the table; for speed, we leave the entry in the live array */
267   vtlb->table[tableindex] = 0;
268}
269
270
271
272/***************************************************************************
273    ACCESSORS
274***************************************************************************/
275
276/*-------------------------------------------------
277    vtlb_table - return a pointer to the base of
278    the linear VTLB lookup table
279-------------------------------------------------*/
280
281const vtlb_entry *vtlb_table(vtlb_state *vtlb)
282{
283   return vtlb->table;
284}
src/emu/cpu/vtlb.h
r0r2865
1/***************************************************************************
2
3    vtlb.h
4
5    Generic virtual TLB implementation.
6
7    Copyright Aaron Giles
8    Released for general non-commercial use under the MAME license
9    Visit http://mamedev.org for licensing and usage restrictions.
10
11***************************************************************************/
12
13#pragma once
14
15#ifndef __VTLB_H__
16#define __VTLB_H__
17
18#include "cpuintrf.h"
19
20
21/***************************************************************************
22    CONSTANTS
23***************************************************************************/
24
25#define VTLB_FLAGS_MASK            0xff
26
27#define VTLB_READ_ALLOWED         0x01      /* (1 << TRANSLATE_READ) */
28#define VTLB_WRITE_ALLOWED         0x02      /* (1 << TRANSLATE_WRITE) */
29#define VTLB_FETCH_ALLOWED         0x04      /* (1 << TRANSLATE_FETCH) */
30#define VTLB_FLAG_VALID            0x08
31#define VTLB_USER_READ_ALLOWED      0x10      /* (1 << TRANSLATE_READ_USER) */
32#define VTLB_USER_WRITE_ALLOWED      0x20      /* (1 << TRANSLATE_WRITE_USER) */
33#define VTLB_USER_FETCH_ALLOWED      0x40      /* (1 << TRANSLATE_FETCH_USER) */
34#define VTLB_FLAG_FIXED            0x80
35
36
37
38/***************************************************************************
39    TYPE DEFINITIONS
40***************************************************************************/
41
42/* represents an entry in the VTLB */
43typedef UINT32 vtlb_entry;
44
45
46/* opaque structure describing VTLB state */
47typedef struct _vtlb_state vtlb_state;
48
49
50
51/***************************************************************************
52    FUNCTION PROTOTYPES
53***************************************************************************/
54
55
56/* ----- initialization/teardown ----- */
57
58/* allocate a new VTLB for the given CPU */
59vtlb_state *vtlb_alloc(int cpunum, int space, int fixed_entries, int dynamic_entries);
60
61/* free an allocated VTLB */
62void vtlb_free(vtlb_state *vtlb);
63
64
65/* ----- filling ----- */
66
67/* called by the CPU core in response to an unmapped access */
68int vtlb_fill(vtlb_state *vtlb, offs_t address, int intention);
69
70/* load a fixed VTLB entry */
71void vtlb_load(vtlb_state *vtlb, int entrynum, int numpages, offs_t address, vtlb_entry value);
72
73
74/* ----- flushing ----- */
75
76/* flush all knowledge from the dynamic part of the VTLB */
77void vtlb_flush_dynamic(vtlb_state *vtlb);
78
79/* flush knowledge of a particular address from the VTLB */
80void vtlb_flush_address(vtlb_state *vtlb, offs_t address);
81
82
83/* ----- accessors ----- */
84
85/* return a pointer to the base of the linear VTLB lookup table */
86const vtlb_entry *vtlb_table(vtlb_state *vtlb);
87
88
89#endif
src/emu/cpu/mips/mips3com.h
r2864r2865
1111
1212#include "cpuintrf.h"
1313#include "mips3.h"
14#include "cpu/vtlb.h"
1415
1516
1617/***************************************************************************
r2864r2865
186187   /* COP registers */
187188   UINT64         cpr[3][32];
188189   UINT64         ccr[3][32];
189   UINT8         cf[3][8];
190   UINT32         llbit;
190191
191192   /* internal stuff */
192193   mips3_flavor   flavor;
r2864r2865
201202   data_accessors   memory;
202203
203204   /* cache memory */
204   UINT32 *      icache;
205   UINT32 *      dcache;
206205   size_t         icache_size;
207206   size_t         dcache_size;
208207
209208   /* MMU */
209   vtlb_state *   vtlb;
210210   mips3_tlb_entry tlb[MIPS3_TLB_ENTRIES];
211   UINT32 *      tlb_table;
212211
213212   /* for use by specific implementations */
214213   mips3imp_state *impstate;
r2864r2865
220219    FUNCTION PROTOTYPES
221220***************************************************************************/
222221
223size_t mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int index, int clock, const mips3_config *config, int (*irqcallback)(int), void *memory);
222void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int index, int clock, const mips3_config *config, int (*irqcallback)(int));
223void mips3com_exit(mips3_state *mips);
224
224225void mips3com_reset(mips3_state *mips);
225226#ifdef ENABLE_DEBUGGER
226227offs_t mips3com_dasm(mips3_state *mips, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
227228#endif
228229void mips3com_update_cycle_counting(mips3_state *mips);
229230
231void mips3com_map_tlb_entry(mips3_state *mips, int tlbindex);
230232void mips3com_map_tlb_entries(mips3_state *mips);
231void mips3com_unmap_tlb_entries(mips3_state *mips);
232void mips3com_recompute_tlb_table(mips3_state *mips);
233void mips3com_asid_changed(mips3_state *mips);
233234int mips3com_translate_address(mips3_state *mips, int space, int intention, offs_t *address);
234235void mips3com_tlbr(mips3_state *mips);
235236void mips3com_tlbwi(mips3_state *mips);
src/emu/cpu/mips/mips3fe.c
r2864r2865
168168      case 0x2c:   /* SDL */
169169      case 0x2d:   /* SDR */
170170      case 0x2e:   /* SWR */
171      case 0x3f:   /* SD */
172         desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG);
173         desc->flags |= OPFLAG_WRITES_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION;
174         return TRUE;
175
171176      case 0x38:   /* SC */
172177      case 0x3c:   /* SCD */
173      case 0x3f:   /* SD */
174178         desc->regin[0] |= REGFLAG_R(RSREG) | REGFLAG_R(RTREG);
179         desc->regout[0] |= REGFLAG_R(RTREG);
175180         desc->flags |= OPFLAG_WRITES_MEMORY | OPFLAG_CAN_CAUSE_EXCEPTION;
176181         return TRUE;
177182
src/emu/cpu/mips/mips3drc.c
r2864r2865
4444***************************************************************************/
4545
4646#define FORCE_C_BACKEND               (0)
47#define LOG_UML                     (1)
48#define LOG_NATIVE                  (1)
47#define LOG_UML                     (0)
48#define LOG_NATIVE                  (0)
4949
5050#define DISABLE_FAST_REGISTERS         (0)
5151#define SINGLE_INSTRUCTION_MODE         (0)
r2864r2865
353353   drccache *cache;
354354   drcbe_info beinfo;
355355   UINT32 flags = 0;
356   size_t extrasize;
357   void *extramem;
358356   int regnum;
359357
360   /* determine how much memory beyond the core size we need */
361    extrasize = mips3com_init(NULL, flavor, bigendian, index, clock, config, irqcallback, NULL);
362
363358   /* allocate enough space for the cache and the core */
364   cache = drccache_alloc(CACHE_SIZE + sizeof(*mips3) + extrasize);
359   cache = drccache_alloc(CACHE_SIZE + sizeof(*mips3));
365360   if (cache == NULL)
366      fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(*mips3) + extrasize));
361      fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(*mips3)));
367362
368   /* allocate the core and the extra memory */
363   /* allocate the core memory */
369364   mips3 = drccache_memory_alloc_near(cache, sizeof(*mips3));
370365   memset(mips3, 0, sizeof(*mips3));
371   extramem = drccache_memory_alloc(cache, extrasize);
372   memset(extramem, 0, extrasize);
373366
374367   /* initialize the core */
375   mips3com_init(mips3, flavor, bigendian, index, clock, config, irqcallback, extramem);
368   mips3com_init(mips3, flavor, bigendian, index, clock, config, irqcallback);
376369
377370   /* allocate the implementation-specific state from the full cache */
378371   mips3->impstate = drccache_memory_alloc_near(cache, sizeof(*mips3->impstate));
r2864r2865
390383   if (mips3->impstate->drcuml == NULL)
391384      fatalerror("Error initializing the UML");
392385
386   /* add symbols for our stuff */
387   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->pc, sizeof(mips3->pc), "pc");
388   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->icount, sizeof(mips3->icount), "icount");
389   for (regnum = 0; regnum < 32; regnum++)
390   {
391      char buf[10];
392      sprintf(buf, "r%d", regnum);
393      drcuml_symbol_add(mips3->impstate->drcuml, &mips3->r[regnum], sizeof(mips3->r[regnum]), buf);
394      sprintf(buf, "f%d", regnum);
395      drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[1][regnum], sizeof(mips3->cpr[1][regnum]), buf);
396   }
397   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->r[REG_LO], sizeof(mips3->r[REG_LO]), "lo");
398   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->r[REG_HI], sizeof(mips3->r[REG_LO]), "hi");
399   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_Index], sizeof(mips3->cpr[0][COP0_Index]), "Index");
400   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_Random], sizeof(mips3->cpr[0][COP0_Random]), "Random");
401   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_EntryLo0], sizeof(mips3->cpr[0][COP0_EntryLo0]), "EntryLo0");
402   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_EntryLo1], sizeof(mips3->cpr[0][COP0_EntryLo1]), "EntryLo1");
403   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_Context], sizeof(mips3->cpr[0][COP0_Context]), "Context");
404   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_PageMask], sizeof(mips3->cpr[0][COP0_PageMask]), "PageMask");
405   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_Wired], sizeof(mips3->cpr[0][COP0_Wired]), "Wired");
406   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_BadVAddr], sizeof(mips3->cpr[0][COP0_BadVAddr]), "BadVAddr");
407   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_Count], sizeof(mips3->cpr[0][COP0_Count]), "Count");
408   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_EntryHi], sizeof(mips3->cpr[0][COP0_EntryHi]), "EntryHi");
409   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_Compare], sizeof(mips3->cpr[0][COP0_Compare]), "Compare");
410   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_Status], sizeof(mips3->cpr[0][COP0_Status]), "Status");
411   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_Cause], sizeof(mips3->cpr[0][COP0_Cause]), "Cause");
412   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_EPC], sizeof(mips3->cpr[0][COP0_EPC]), "EPC");
413   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_PRId], sizeof(mips3->cpr[0][COP0_PRId]), "PRId");
414   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_Config], sizeof(mips3->cpr[0][COP0_Config]), "Config");
415   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_LLAddr], sizeof(mips3->cpr[0][COP0_LLAddr]), "LLAddr");
416   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_XContext], sizeof(mips3->cpr[0][COP0_XContext]), "XContext");
417   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_ECC], sizeof(mips3->cpr[0][COP0_ECC]), "ECC");
418   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_CacheErr], sizeof(mips3->cpr[0][COP0_CacheErr]), "CacheErr");
419   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_TagLo], sizeof(mips3->cpr[0][COP0_TagLo]), "TagLo");
420   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_TagHi], sizeof(mips3->cpr[0][COP0_TagHi]), "TagHi");
421   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->cpr[0][COP0_ErrorPC], sizeof(mips3->cpr[0][COP0_ErrorPC]), "ErrorPC");
422   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->ccr[1][31], sizeof(mips3->cpr[1][31]), "fcr31");
423   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->impstate->mode, sizeof(mips3->impstate->mode), "mode");
424   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->impstate->arg0, sizeof(mips3->impstate->arg0), "arg0");
425   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->impstate->arg1, sizeof(mips3->impstate->arg1), "arg1");
426   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->impstate->numcycles, sizeof(mips3->impstate->numcycles), "numcycles");
427   drcuml_symbol_add(mips3->impstate->drcuml, &mips3->impstate->fpmode, sizeof(mips3->impstate->fpmode), "fpmode");
428
393429   /* initialize the front-end helper */
394430   if (SINGLE_INSTRUCTION_MODE)
395431      feconfig.max_sequence = 1;
r2864r2865
489525
490526static void mips3_exit(void)
491527{
528   mips3com_exit(mips3);
529
492530   /* clean up the DRC */
493531   drcfe_exit(mips3->impstate->drcfe);
494532   drcuml_free(mips3->impstate->drcuml);
r2864r2865
10201058   UML_RECOVER(block, IREG(0), MAPVAR_PC);                                 // recover i0,PC
10211059   UML_MOV(block, MEM(&mips3->pc), IREG(0));                              // mov     <pc>,i0
10221060   UML_SHR(block, IREG(1), IREG(0), IMM(12));                              // shr     i1,i0,12
1023   UML_LOAD(block, IREG(1), mips3->tlb_table, IREG(1), DWORD);                  // load    i1,[tlb_table],i1,dword
1061   UML_LOAD(block, IREG(1), (void *)vtlb_table(mips3->vtlb), IREG(1), DWORD);      // load    i1,[vtlb_table],i1,dword
10241062   if (PRINTF_MMU)
10251063   {
10261064      UML_MOV(block, MEM(&mips3->impstate->arg0), IREG(0));                  // mov     [arg0],i0
10271065      UML_MOV(block, MEM(&mips3->impstate->arg1), IREG(1));                  // mov     [arg1],i1
10281066      UML_CALLC(block, cfunc_printf_debug, "TLB mismatch @ %08X (ent=%08X)\n");   // callc   printf_debug
10291067   }
1030   UML_TEST(block, IREG(1), IMM(TLB_VALID));                              // test    i1,TLB_VALID
1068   UML_TEST(block, IREG(1), IMM(VTLB_FETCH_ALLOWED));                        // test    i1,VTLB_FETCH_ALLOWED
10311069   UML_JMPc(block, IF_NZ, 1);                                          // jmp     1,nz
1032   UML_TEST(block, IREG(1), IMM(TLB_PRESENT));                              // test    i1,TLB_PRESENT
1033   UML_EXHc(block, IF_NZ, mips3->impstate->exception[EXCEPTION_TLBLOAD], IREG(0));   // exh     exception[TLBLOAD],i0,nz
1070   UML_TEST(block, IREG(1), IMM(VTLB_FLAG_VALID));                           // test    i1,VTLB_FLAG_VALID
1071   UML_EXHc(block, IF_Z, mips3->impstate->exception[EXCEPTION_TLBLOAD], IREG(0));   // exh     exception[TLBLOAD],i0,z
10341072   UML_EXH(block, mips3->impstate->exception[EXCEPTION_TLBLOAD_FILL], IREG(0));   // exh     exception[TLBLOAD_FILL],i0
10351073   UML_LABEL(block, 1);                                          // 1:
10361074   save_fast_iregs(block);
r2864r2865
11861224
11871225   /* general case: assume paging and perform a translation */
11881226   UML_SHR(block, IREG(3), IREG(0), IMM(12));                              // shr     i3,i0,12
1189   UML_LOAD(block, IREG(3), mips3->tlb_table, IREG(3), DWORD);                  // load    i3,[tlb_table],i3,dword
1190   UML_TEST(block, IREG(3), IMM(iswrite ? TLB_DIRTY : TLB_VALID));               // test    i3,iswrite ? TLB_DIRTY : TLB_VALID
1227   UML_LOAD(block, IREG(3), (void *)vtlb_table(mips3->vtlb), IREG(3), DWORD);      // load    i3,[vtlb_table],i3,dword
1228   UML_TEST(block, IREG(3), IMM(iswrite ? VTLB_WRITE_ALLOWED : VTLB_READ_ALLOWED));// test    i3,iswrite ? VTLB_WRITE_ALLOWED : VTLB_READ_ALLOWED
11911229   UML_JMPc(block, IF_Z, tlbmiss = label++);                              // jmp     tlbmiss,z
11921230   UML_ROLINS(block, IREG(0), IREG(3), IMM(0), IMM(0xfffff000));               // rolins  i0,i3,0,0xfffff000
11931231
r2864r2865
13421380      UML_LABEL(block, tlbmiss);                                    // tlbmiss:
13431381      if (iswrite)
13441382      {
1345         UML_TEST(block, IREG(3), IMM(TLB_VALID));                        // test    i3,TLB_VALID
1383         UML_TEST(block, IREG(3), IMM(VTLB_READ_ALLOWED));                  // test    i3,VTLB_READ_ALLOWED
13461384         UML_EXHc(block, IF_NZ, mips3->impstate->exception[EXCEPTION_TLBMOD], IREG(0));
13471385                                                               // exh     tlbmod,i0,nz
13481386      }
1349      UML_TEST(block, IREG(3), IMM(TLB_PRESENT));                           // test    i3,TLB_PRESENT
1350      UML_EXHc(block, IF_NZ, exception_tlb, IREG(0));                        // exh     tlb,i0,nz
1387      UML_TEST(block, IREG(3), IMM(VTLB_FLAG_VALID));                        // test    i3,VTLB_FLAG_VALID
1388      UML_EXHc(block, IF_Z, exception_tlb, IREG(0));                        // exh     tlb,i0,z
13511389      UML_EXH(block, exception_tlbfill, IREG(0));                           // exh     tlbfill,i0
13521390   }
13531391
r2864r2865
15471585   /* validate our TLB entry at this PC; if we fail, we need to handle it */
15481586   if ((desc->flags & OPFLAG_VALIDATE_TLB) && (desc->pc < 0x80000000 || desc->pc >= 0xc0000000))
15491587   {
1588      const vtlb_entry *tlbtable = vtlb_table(mips3->vtlb);
1589
15501590      /* if we currently have a valid TLB read entry, we just verify */
1551      if (mips3->tlb_table[desc->pc >> 12] & TLB_VALID)
1591      if (tlbtable[desc->pc >> 12] & VTLB_FETCH_ALLOWED)
15521592      {
15531593         if (PRINTF_MMU)
15541594         {
15551595            UML_MOV(block, MEM(&mips3->impstate->arg0), IMM(desc->pc));         // mov     [arg0],desc->pc
15561596            UML_CALLC(block, cfunc_printf_debug, "Checking TLB at @ %08X\n");   // callc   printf_debug
15571597         }
1558         UML_LOAD(block, IREG(0), &mips3->tlb_table[desc->pc >> 12], IMM(0), DWORD);// load i0,tlb_table[desc->pc >> 12],0,dword
1559         UML_CMP(block, IREG(0), IMM(mips3->tlb_table[desc->pc >> 12]));         // cmp     i0,*tlbentry
1598         UML_LOAD(block, IREG(0), &tlbtable[desc->pc >> 12], IMM(0), DWORD);      // load i0,tlbtable[desc->pc >> 12],0,dword
1599         UML_CMP(block, IREG(0), IMM(tlbtable[desc->pc >> 12]));               // cmp     i0,*tlbentry
15601600         UML_EXHc(block, IF_NE, mips3->impstate->tlb_mismatch, IMM(0));         // exh     tlb_mismatch,0,NE
15611601      }
15621602
r2864r2865
18051845            generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);
18061846         return TRUE;
18071847
1848      case 0x30:  /* LL - MIPS II */
1849         UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL));                  // add     i0,<rsreg>,SIMMVAL
1850         UML_CALLH(block, mips3->impstate->read32[mips3->impstate->mode >> 1]);   // callh   read32
1851         if (RTREG != 0)
1852            UML_DSEXT(block, R64(RTREG), IREG(0), DWORD);                  // dsext   <rtreg>,i0
1853         UML_MOV(block, MEM(&mips3->llbit), IMM(1));                        // mov     [llbit],1
1854         if (!in_delay_slot)
1855            generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);
1856         return TRUE;
1857
18081858      case 0x24:   /* LBU - MIPS I */
18091859         UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL));                  // add     i0,<rsreg>,SIMMVAL
18101860         UML_CALLH(block, mips3->impstate->read8[mips3->impstate->mode >> 1]);   // callh   read8
r2864r2865
18411891            generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);
18421892         return TRUE;
18431893
1894      case 0x34:  /* LLD - MIPS III */
1895         UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL));                  // add     i0,<rsreg>,SIMMVAL
1896         UML_CALLH(block, mips3->impstate->read64[mips3->impstate->mode >> 1]);   // callh   read64
1897         if (RTREG != 0)
1898            UML_DMOV(block, R64(RTREG), IREG(0));                        // dmov    <rtreg>,i0
1899         UML_MOV(block, MEM(&mips3->llbit), IMM(1));                        // mov     [llbit],1
1900         if (!in_delay_slot)
1901            generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);
1902         return TRUE;
1903
18441904      case 0x22:   /* LWL - MIPS I */
18451905         UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL));                  // add     i0,<rsreg>,SIMMVAL
18461906         UML_SHL(block, IREG(1), IREG(0), IMM(3));                        // shl     i1,i0,3
r2864r2865
19782038            generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);
19792039         return TRUE;
19802040
2041      case 0x38:  /* SC - MIPS II */
2042         UML_CMP(block, MEM(&mips3->llbit), IMM(0));                        // cmp     [llbit],0
2043         UML_JMPc(block, IF_E, skip = compiler->labelnum++);                  // je      skip
2044         UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL));                  // add     i0,<rsreg>,SIMMVAL
2045         UML_MOV(block, IREG(1), R32(RTREG));                           // mov     i1,<rtreg>
2046         UML_CALLH(block, mips3->impstate->write32[mips3->impstate->mode >> 1]);   // callh   write32
2047         UML_LABEL(block, skip);                                    // skip:
2048         UML_DSEXT(block, R64(RTREG), MEM(&mips3->llbit), DWORD);            // dsext   <rtreg>,[llbit],dword
2049         if (!in_delay_slot)
2050            generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);
2051         return TRUE;
2052
19812053      case 0x3f:   /* SD - MIPS III */
19822054         UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL));                  // add     i0,<rsreg>,SIMMVAL
19832055         UML_DMOV(block, IREG(1), R64(RTREG));                           // dmov    i1,<rtreg>
r2864r2865
19862058            generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);
19872059         return TRUE;
19882060
2061      case 0x3c:  /* SCD - MIPS III */
2062         UML_CMP(block, MEM(&mips3->llbit), IMM(0));                        // cmp     [llbit],0
2063         UML_JMPc(block, IF_E, skip = compiler->labelnum++);                  // je      skip
2064         UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL));                  // add     i0,<rsreg>,SIMMVAL
2065         UML_DMOV(block, IREG(1), R64(RTREG));                           // dmov    i1,<rtreg>
2066         UML_CALLH(block, mips3->impstate->write64[mips3->impstate->mode >> 1]);   // callh   write64
2067         UML_LABEL(block, skip);                                    // skip:
2068         UML_DSEXT(block, R64(RTREG), MEM(&mips3->llbit), DWORD);            // dsext   <rtreg>,[llbit],dword
2069         if (!in_delay_slot)
2070            generate_update_cycles(block, compiler, IMM(desc->pc + 4), TRUE);
2071         return TRUE;
2072
19892073      case 0x2a:   /* SWL - MIPS I */
19902074         UML_ADD(block, IREG(0), R32(RSREG), IMM(SIMMVAL));                  // add     i0,<rsreg>,SIMMVAL
19912075         UML_SHL(block, IREG(3), IREG(0), IMM(3));                        // shl     i3,i0,3
r2864r2865
21042188
21052189      /* ----- unimplemented/illegal instructions ----- */
21062190
2107//      case 0x30:  /* LL - MIPS II */        logerror("mips3 Unhandled op: LL\n");                                   break;
2108//      case 0x34:  /* LLD - MIPS III */       logerror("mips3 Unhandled op: LLD\n");                                  break;
2109//      case 0x38:  /* SC - MIPS II */        logerror("mips3 Unhandled op: SC\n");                                   break;
2110//      case 0x3c:  /* SCD - MIPS III */       logerror("mips3 Unhandled op: SCD\n");                                  break;
21112191//      default:    /* ??? */       invalid_instruction(op);                                                break;
21122192   }
21132193
r2864r2865
26982778         UML_MOV(block, CPR032(reg), IREG(0));                           // mov     cpr0[reg],i0
26992779         UML_TEST(block, IREG(1), IMM(0xff));                           // test    i1,0xff
27002780         UML_JMPc(block, IF_Z, link = compiler->labelnum++);                  // jmp     link,z
2701         UML_CALLC(block, mips3com_unmap_tlb_entries, mips3);               // callc   mips3com_unmap_tlb_entries
2702         UML_CALLC(block, mips3com_map_tlb_entries, mips3);                  // callc   mips3com_map_tlb_entries
2781         UML_CALLC(block, mips3com_asid_changed, mips3);                     // callc   mips3com_asid_changed
27032782         UML_LABEL(block, link);                                    // link:
27042783         return TRUE;
27052784
r2864r2865
28442923               return TRUE;
28452924
28462925            case 0x18:   /* ERET */
2926               UML_MOV(block, MEM(&mips3->llbit), IMM(0));                  // mov     [llbit],0
28472927               UML_MOV(block, IREG(0), CPR032(COP0_Status));               // mov     i0,[Status]
28482928               UML_TEST(block, IREG(0), IMM(SR_ERL));                     // test    i0,SR_ERL
28492929               UML_JMPc(block, IF_NZ, skip = compiler->labelnum++);         // jmp     skip,nz
src/emu/cpu/mips/mips3com.c
r2864r2865
1313    DEBUGGING
1414***************************************************************************/
1515
16#define PRINTF_TLB            (1)
16#define PRINTF_TLB            (0)
1717
1818
1919
r2864r2865
2626static UINT32 compute_config_register(const mips3_state *mips);
2727static UINT32 compute_prid_register(const mips3_state *mips);
2828
29static void tlb_write_common(mips3_state *mips, int index);
30static void tlb_entry_log_half(mips3_tlb_entry *tlbent, int index, int which);
29static void tlb_map_entry(mips3_state *mips, int tlbindex);
30static void tlb_write_common(mips3_state *mips, int tlbindex);
31static void tlb_entry_log_half(mips3_tlb_entry *entry, int tlbindex, int which);
3132
3233
3334
3435/***************************************************************************
36    INLINE FUNCTIONS
37***************************************************************************/
38
39/*-------------------------------------------------
40    tlb_entry_matches_asid - TRUE if the given
41    TLB entry matches the provided ASID
42-------------------------------------------------*/
43
44INLINE int tlb_entry_matches_asid(const mips3_tlb_entry *entry, UINT8 asid)
45{
46   return (entry->entry_hi & 0xff) == asid;
47}
48
49
50/*-------------------------------------------------
51    tlb_entry_is_global - TRUE if the given
52    TLB entry is global
53-------------------------------------------------*/
54
55INLINE int tlb_entry_is_global(const mips3_tlb_entry *entry)
56{
57   return (entry->entry_lo[0] & entry->entry_lo[1] & TLB_GLOBAL);
58}
59
60
61
62/***************************************************************************
3563    INITIALIZATION AND SHUTDOWN
3664***************************************************************************/
3765
r2864r2865
4068    structure based on the configured type
4169-------------------------------------------------*/
4270
43size_t mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int index, int clock, const mips3_config *config, int (*irqcallback)(int), void *memory)
71void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, int index, int clock, const mips3_config *config, int (*irqcallback)(int))
4472{
45   int tlbindex;
46
47   /* if no memory, return the amount needed */
48   if (memory == NULL)
49      return config->icache + config->dcache + (sizeof(mips->tlb_table[0]) * (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT)));
50
5173   /* initialize based on the config */
5274   memset(mips, 0, sizeof(*mips));
5375   mips->flavor = flavor;
r2864r2865
6183   /* set up the endianness */
6284   mips->memory = *memory_get_accessors(ADDRESS_SPACE_PROGRAM, 32, mips->bigendian ? CPU_IS_BE : CPU_IS_LE);
6385
64   /* allocate memory */
65   mips->icache = memory;
66   mips->dcache = (void *)((UINT8 *)memory + config->icache);
67   mips->tlb_table = (void *)((UINT8 *)memory + config->dcache);
86   /* allocate the virtual TLB */
87   mips->vtlb = vtlb_alloc(cpu_getactivecpu(), ADDRESS_SPACE_PROGRAM, 2 * MIPS3_TLB_ENTRIES + 2, 0);
6888
69   /* initialize the TLB state */
70   for (tlbindex = 0; tlbindex < ARRAY_LENGTH(mips->tlb); tlbindex++)
71   {
72      mips3_tlb_entry *tlbent = &mips->tlb[tlbindex];
73      tlbent->page_mask = 0;
74      tlbent->entry_hi = 0xffffffff;
75      tlbent->entry_lo[0] = 0xfffffff8;
76      tlbent->entry_lo[1] = 0xfffffff8;
77   }
78
7989   /* allocate a timer for the compare interrupt */
8090   mips->compare_int_timer = timer_alloc(compare_int_callback, NULL);
8191
8292   /* reset the state */
8393   mips3com_reset(mips);
84   return 0;
8594}
8695
8796
8897/*-------------------------------------------------
98    mips3com_exit - common cleanup/exit
99-------------------------------------------------*/
100
101void mips3com_exit(mips3_state *mips)
102{
103   if (mips->vtlb != NULL)
104      vtlb_free(mips->vtlb);
105}
106
107
108/*-------------------------------------------------
89109    mips3com_reset - reset the state of all the
90110    registers
91111-------------------------------------------------*/
92112
93113void mips3com_reset(mips3_state *mips)
94114{
115   int tlbindex;
116
95117   /* initialize the state */
96118   mips->pc = 0xbfc00000;
97119   mips->cpr[0][COP0_Status] = SR_BEV | SR_ERL;
r2864r2865
102124   mips->cpr[0][COP0_PRId] = compute_prid_register(mips);
103125   mips->count_zero_time = activecpu_gettotalcycles();
104126
105   /* recompute the TLB table */
106   mips3com_recompute_tlb_table(mips);
127   /* initialize the TLB state */
128   for (tlbindex = 0; tlbindex < ARRAY_LENGTH(mips->tlb); tlbindex++)
129   {
130      mips3_tlb_entry *entry = &mips->tlb[tlbindex];
131      entry->page_mask = 0;
132      entry->entry_hi = 0xffffffff;
133      entry->entry_lo[0] = 0xfffffff8;
134      entry->entry_lo[1] = 0xfffffff8;
135      vtlb_load(mips->vtlb, 2 * tlbindex + 0, 0, 0, 0);
136      vtlb_load(mips->vtlb, 2 * tlbindex + 1, 0, 0, 0);
137   }
138
139   /* load the fixed TLB range */
140   vtlb_load(mips->vtlb, 2 * MIPS3_TLB_ENTRIES + 0, (0xa0000000 - 0x80000000) >> MIPS3_MIN_PAGE_SHIFT, 0x80000000, 0x00000000 | VTLB_READ_ALLOWED | VTLB_WRITE_ALLOWED | VTLB_FETCH_ALLOWED | VTLB_FLAG_VALID);
141   vtlb_load(mips->vtlb, 2 * MIPS3_TLB_ENTRIES + 1, (0xc0000000 - 0xa0000000) >> MIPS3_MIN_PAGE_SHIFT, 0xa0000000, 0x00000000 | VTLB_READ_ALLOWED | VTLB_WRITE_ALLOWED | VTLB_FETCH_ALLOWED | VTLB_FLAG_VALID);
107142}
108143
109144
r2864r2865
156191***************************************************************************/
157192
158193/*-------------------------------------------------
159    mips3com_map_tlb_entries - map entries from the
160    TLB into the tlb_table
194    mips3com_asid_changed - remap all non-global
195    TLB entries
161196-------------------------------------------------*/
162197
163void mips3com_map_tlb_entries(mips3_state *mips)
198void mips3com_asid_changed(mips3_state *mips)
164199{
165   int valid_asid = mips->cpr[0][COP0_EntryHi] & 0xff;
166   int index;
200   int tlbindex;
167201
168   /* iterate over all TLB entries */
169   for (index = 0; index < ARRAY_LENGTH(mips->tlb); index++)
170   {
171      mips3_tlb_entry *tlbent = &mips->tlb[index];
172
173      /* only process if the ASID matches or if global */
174      if (valid_asid == (tlbent->entry_hi & 0xff) || ((tlbent->entry_lo[0] & tlbent->entry_lo[1]) & TLB_GLOBAL))
175      {
176         UINT32 count = (tlbent->page_mask >> 13) & 0x00fff;
177         UINT32 vpn = ((tlbent->entry_hi >> 13) & 0x07ffffff) << 1;
178         int which, i;
179
180         /* ignore if the virtual address is beyond 32 bits */
181         if (vpn < (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT)))
182
183            /* loop over both the even and odd pages */
184            for (which = 0; which < 2; which++)
185            {
186               UINT64 lo = tlbent->entry_lo[which];
187               UINT32 pfn = (lo >> 6) & 0x00ffffff;
188               UINT32 wp = (lo & 7) | TLB_PRESENT;
189
190               /* ensure that if the valid bit is clear, the dirty bit is as well */
191               /* this way we can always test dirty for writes, and valid for reads */
192               if (!(wp & TLB_VALID))
193                  wp &= ~TLB_DIRTY;
194
195               for (i = 0; i <= count; i++, vpn++, pfn++)
196                  if (vpn < 0x80000 || vpn >= 0xc0000)
197                     mips->tlb_table[vpn] = (pfn << MIPS3_MIN_PAGE_SHIFT) | wp;
198            }
199      }
200   }
202   /* iterate over all non-global TLB entries and remap them */
203   for (tlbindex = 0; tlbindex < ARRAY_LENGTH(mips->tlb); tlbindex++)
204      if (!tlb_entry_is_global(&mips->tlb[tlbindex]))
205         tlb_map_entry(mips, tlbindex);
201206}
202207
203208
204209/*-------------------------------------------------
205    mips3com_unmap_tlb_entries - unmap entries from
206    the TLB into the tlb_table
207-------------------------------------------------*/
208
209void mips3com_unmap_tlb_entries(mips3_state *mips)
210{
211   int index;
212
213   /* iterate over all TLB entries */
214   for (index = 0; index < ARRAY_LENGTH(mips->tlb); index++)
215   {
216      mips3_tlb_entry *tlbent = &mips->tlb[index];
217      UINT32 count = (tlbent->page_mask >> 13) & 0x00fff;
218      UINT32 vpn = ((tlbent->entry_hi >> 13) & 0x07ffffff) << 1;
219      int which, i;
220
221      /* ignore if the virtual address is beyond 32 bits */
222      if (vpn < (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT)))
223
224         /* loop over both the even and odd pages */
225         for (which = 0; which < 2; which++)
226            for (i = 0; i <= count; i++, vpn++)
227               if (vpn < 0x80000 || vpn >= 0xc0000)
228                  mips->tlb_table[vpn] = 0;
229   }
230}
231
232
233/*-------------------------------------------------
234    mips3com_recompute_tlb_table - recompute the TLB
235    table from scratch
236-------------------------------------------------*/
237
238void mips3com_recompute_tlb_table(mips3_state *mips)
239{
240   UINT32 addr;
241
242   /* map in the hard-coded spaces */
243   for (addr = 0x80000000; addr < 0xc0000000; addr += MIPS3_MIN_PAGE_SIZE)
244      mips->tlb_table[addr >> MIPS3_MIN_PAGE_SHIFT] = (addr & 0x1ffff000) | TLB_PRESENT | TLB_DIRTY | TLB_VALID | TLB_GLOBAL;
245
246   /* reset everything else to unmapped */
247   memset(&mips->tlb_table[0x00000000 >> MIPS3_MIN_PAGE_SHIFT], 0, sizeof(mips->tlb_table[0]) * (0x80000000 >> MIPS3_MIN_PAGE_SHIFT));
248   memset(&mips->tlb_table[0xc0000000 >> MIPS3_MIN_PAGE_SHIFT], 0, sizeof(mips->tlb_table[0]) * (0x40000000 >> MIPS3_MIN_PAGE_SHIFT));
249
250   /* remap all the entries in the TLB */
251   mips3com_map_tlb_entries(mips);
252}
253
254
255/*-------------------------------------------------
256210    mips3com_translate_address - translate an address
257211    from logical to physical
258212-------------------------------------------------*/
r2864r2865
262216   /* only applies to the program address space */
263217   if (space == ADDRESS_SPACE_PROGRAM)
264218   {
265      UINT32 result = mips->tlb_table[*address >> MIPS3_MIN_PAGE_SHIFT];
266      if (!(result & TLB_PRESENT) || !(result & TLB_VALID))
219      const vtlb_entry *table = vtlb_table(mips->vtlb);
220      vtlb_entry entry = table[*address >> MIPS3_MIN_PAGE_SHIFT];
221      if ((entry & (1 << (intention & (TRANSLATE_TYPE_MASK | TRANSLATE_USER_MASK)))) == 0)
267222         return FALSE;
268      *address = (result & ~MIPS3_MIN_PAGE_MASK) | (*address & MIPS3_MIN_PAGE_MASK);
223      *address = (entry & ~MIPS3_MIN_PAGE_MASK) | (*address & MIPS3_MIN_PAGE_MASK);
269224   }
270225   return TRUE;
271226}
r2864r2865
277232
278233void mips3com_tlbr(mips3_state *mips)
279234{
280   UINT32 index = mips->cpr[0][COP0_Index] & 0x3f;
235   UINT32 tlbindex = mips->cpr[0][COP0_Index] & 0x3f;
281236
282237   /* only handle entries within the TLB */
283   if (index < ARRAY_LENGTH(mips->tlb))
238   if (tlbindex < ARRAY_LENGTH(mips->tlb))
284239   {
285      mips3_tlb_entry *tlbent = &mips->tlb[index];
240      mips3_tlb_entry *entry = &mips->tlb[tlbindex];
286241
287242      /* copy data from the TLB entry into the COP0 registers */
288      mips->cpr[0][COP0_PageMask] = tlbent->page_mask;
289      mips->cpr[0][COP0_EntryHi] = tlbent->entry_hi;
290      mips->cpr[0][COP0_EntryLo0] = tlbent->entry_lo[0];
291      mips->cpr[0][COP0_EntryLo1] = tlbent->entry_lo[1];
243      mips->cpr[0][COP0_PageMask] = entry->page_mask;
244      mips->cpr[0][COP0_EntryHi] = entry->entry_hi;
245      mips->cpr[0][COP0_EntryLo0] = entry->entry_lo[0];
246      mips->cpr[0][COP0_EntryLo1] = entry->entry_lo[1];
292247   }
293248}
294249
r2864r2865
312267{
313268   UINT32 wired = mips->cpr[0][COP0_Wired] & 0x3f;
314269   UINT32 unwired = ARRAY_LENGTH(mips->tlb) - wired;
315   UINT32 index = ARRAY_LENGTH(mips->tlb) - 1;
270   UINT32 tlbindex = ARRAY_LENGTH(mips->tlb) - 1;
316271
317272   /* "random" is based off of the current cycle counting through the non-wired pages */
318273   if (unwired > 0)
319      index = ((activecpu_gettotalcycles() - mips->count_zero_time) % unwired + wired) & 0x3f;
274      tlbindex = ((activecpu_gettotalcycles() - mips->count_zero_time) % unwired + wired) & 0x3f;
320275
321   /* use the common handler to write to this index */
322   tlb_write_common(mips, index);
276   /* use the common handler to write to this tlbindex */
277   tlb_write_common(mips, tlbindex);
323278}
324279
325280
r2864r2865
329284
330285void mips3com_tlbp(mips3_state *mips)
331286{
332   UINT32 index;
287   UINT32 tlbindex;
333288   UINT64 vpn;
334289
335290   /* iterate over TLB entries */
336   for (index = 0; index < ARRAY_LENGTH(mips->tlb); index++)
291   for (tlbindex = 0; tlbindex < ARRAY_LENGTH(mips->tlb); tlbindex++)
337292   {
338      mips3_tlb_entry *tlbent = &mips->tlb[index];
339      UINT64 mask = ~((tlbent->page_mask >> 13) & 0xfff) << 13;
293      mips3_tlb_entry *entry = &mips->tlb[tlbindex];
294      UINT64 mask = ~((entry->page_mask >> 13) & 0xfff) << 13;
340295
341296      /* if the relevant bits of EntryHi match the relevant bits of the TLB */
342      if ((tlbent->entry_hi & mask) == (mips->cpr[0][COP0_EntryHi] & mask))
297      if ((entry->entry_hi & mask) == (mips->cpr[0][COP0_EntryHi] & mask))
343298
344299         /* and if we are either global or matching the current ASID, then stop */
345         if ((tlbent->entry_hi & 0xff) == (mips->cpr[0][COP0_EntryHi] & 0xff) || ((tlbent->entry_lo[0] & tlbent->entry_lo[1]) & TLB_GLOBAL))
300         if ((entry->entry_hi & 0xff) == (mips->cpr[0][COP0_EntryHi] & 0xff) || ((entry->entry_lo[0] & entry->entry_lo[1]) & TLB_GLOBAL))
346301            break;
347302   }
348303
349304   /* validate that our tlb_table was in sync */
350305   vpn = ((mips->cpr[0][COP0_EntryHi] >> 13) & 0x07ffffff) << 1;
351   if (index != ARRAY_LENGTH(mips->tlb))
352   {
353      assert(mips->tlb_table[vpn & 0xfffff] & TLB_PRESENT);
354      mips->cpr[0][COP0_Index] = index;
355   }
306   if (tlbindex != ARRAY_LENGTH(mips->tlb))
307      mips->cpr[0][COP0_Index] = tlbindex;
356308   else
357   {
358      assert(!(mips->tlb_table[vpn & 0xfffff] & TLB_PRESENT));
359309      mips->cpr[0][COP0_Index] = 0x80000000;
360   }
361310}
362311
363312
r2864r2865
830779
831780
832781/*-------------------------------------------------
782    tlb_map_entry - map a single TLB
783    entry
784-------------------------------------------------*/
785
786static void tlb_map_entry(mips3_state *mips, int tlbindex)
787{
788   int current_asid = mips->cpr[0][COP0_EntryHi] & 0xff;
789   mips3_tlb_entry *entry = &mips->tlb[tlbindex];
790   UINT32 count, vpn;
791   int which;
792
793   /* the ASID doesn't match the current ASID, and if the page isn't global, unmap it from the TLB */
794   if (!tlb_entry_matches_asid(entry, current_asid) && !tlb_entry_is_global(entry))
795   {
796      vtlb_load(mips->vtlb, 2 * tlbindex + 0, 0, 0, 0);
797      vtlb_load(mips->vtlb, 2 * tlbindex + 1, 0, 0, 0);
798      return;
799   }
800
801   /* extract the VPN index; ignore if the virtual address is beyond 32 bits */
802   vpn = ((entry->entry_hi >> 13) & 0x07ffffff) << 1;
803   if (vpn >= (1 << (MIPS3_MAX_PADDR_SHIFT - MIPS3_MIN_PAGE_SHIFT)))
804   {
805      vtlb_load(mips->vtlb, 2 * tlbindex + 0, 0, 0, 0);
806      vtlb_load(mips->vtlb, 2 * tlbindex + 1, 0, 0, 0);
807      return;
808   }
809
810   /* get the number of pages from the page mask */
811   count = ((entry->page_mask >> 13) & 0x00fff) + 1;
812
813   /* loop over both the even and odd pages */
814   for (which = 0; which < 2; which++)
815   {
816      UINT32 effvpn = vpn + count * which;
817      UINT64 lo = entry->entry_lo[which];
818      UINT32 pfn = (lo >> 6) & 0x00ffffff;
819      UINT32 flags = 0;
820
821      /* valid? */
822      if ((lo & 2) != 0)
823      {
824         flags |= VTLB_FLAG_VALID | VTLB_READ_ALLOWED | VTLB_FETCH_ALLOWED;
825
826         /* writable? */
827         if ((lo & 4) != 0)
828            flags |= VTLB_WRITE_ALLOWED;
829
830         /* mirror the flags for user mode if the VPN is in user space */
831         if (effvpn < (0x80000000 >> MIPS3_MIN_PAGE_SHIFT))
832            flags |= (flags << 4) & (VTLB_USER_READ_ALLOWED | VTLB_USER_WRITE_ALLOWED | VTLB_USER_FETCH_ALLOWED);
833      }
834
835      /* load the virtual TLB with the corresponding entries */
836      if ((effvpn + count) <= (0x80000000 >> MIPS3_MIN_PAGE_SHIFT) || effvpn >= (0xc0000000 >> MIPS3_MIN_PAGE_SHIFT))
837         vtlb_load(mips->vtlb, 2 * tlbindex + which, count, effvpn << MIPS3_MIN_PAGE_SHIFT, (pfn << MIPS3_MIN_PAGE_SHIFT) | flags);
838   }
839}
840
841
842/*-------------------------------------------------
833843    tlb_write_common - common routine for writing
834844    a TLB entry
835845-------------------------------------------------*/
836846
837static void tlb_write_common(mips3_state *mips, int index)
847static void tlb_write_common(mips3_state *mips, int tlbindex)
838848{
839849   /* only handle entries within the TLB */
840   if (index < ARRAY_LENGTH(mips->tlb))
850   if (tlbindex < ARRAY_LENGTH(mips->tlb))
841851   {
842      mips3_tlb_entry *tlbent = &mips->tlb[index];
852      mips3_tlb_entry *entry = &mips->tlb[tlbindex];
843853
844      /* unmap what we have */
845      mips3com_unmap_tlb_entries(mips);
846
847854      /* fill in the new TLB entry from the COP0 registers */
848      tlbent->page_mask = mips->cpr[0][COP0_PageMask];
849      tlbent->entry_hi = mips->cpr[0][COP0_EntryHi] & ~(tlbent->page_mask & U64(0x0000000001ffe000));
850      tlbent->entry_lo[0] = mips->cpr[0][COP0_EntryLo0];
851      tlbent->entry_lo[1] = mips->cpr[0][COP0_EntryLo1];
855      entry->page_mask = mips->cpr[0][COP0_PageMask];
856      entry->entry_hi = mips->cpr[0][COP0_EntryHi] & ~(entry->page_mask & U64(0x0000000001ffe000));
857      entry->entry_lo[0] = mips->cpr[0][COP0_EntryLo0];
858      entry->entry_lo[1] = mips->cpr[0][COP0_EntryLo1];
852859
853      /* remap the TLB */
854      mips3com_map_tlb_entries(mips);
860      /* remap this TLB entry */
861      tlb_map_entry(mips, tlbindex);
855862
856863      /* log the two halves once they are in */
857      tlb_entry_log_half(tlbent, index, 0);
858      tlb_entry_log_half(tlbent, index, 1);
864      tlb_entry_log_half(entry, tlbindex, 0);
865      tlb_entry_log_half(entry, tlbindex, 1);
859866   }
860867}
861868
r2864r2865
865872    entry
866873-------------------------------------------------*/
867874
868static void tlb_entry_log_half(mips3_tlb_entry *tlbent, int index, int which)
875static void tlb_entry_log_half(mips3_tlb_entry *entry, int tlbindex, int which)
869876{
870877#if PRINTF_TLB
871   UINT64 hi = tlbent->entry_hi;
872   UINT64 lo = tlbent->entry_lo[which];
878   UINT64 hi = entry->entry_hi;
879   UINT64 lo = entry->entry_lo[which];
873880   UINT32 vpn = (((hi >> 13) & 0x07ffffff) << 1);
874881   UINT32 asid = hi & 0xff;
875882   UINT32 r = (hi >> 62) & 3;
876883   UINT32 pfn = (lo >> 6) & 0x00ffffff;
877884   UINT32 c = (lo >> 3) & 7;
878   UINT32 pagesize = (((tlbent->page_mask >> 13) & 0xfff) + 1) << MIPS3_MIN_PAGE_SHIFT;
885   UINT32 pagesize = (((entry->page_mask >> 13) & 0xfff) + 1) << MIPS3_MIN_PAGE_SHIFT;
879886   UINT64 vaddr = (UINT64)vpn * MIPS3_MIN_PAGE_SIZE;
880887   UINT64 paddr = (UINT64)pfn * MIPS3_MIN_PAGE_SIZE;
881888
882889   vaddr += pagesize * which;
883890
884   mame_printf_debug("index=%08X  pagesize=%08X  vaddr=%08X%08X  paddr=%08X%08X  asid=%02X  r=%X  c=%X  dvg=%c%c%c\n",
885         index, pagesize, (UINT32)(vaddr >> 32), (UINT32)vaddr, (UINT32)(paddr >> 32), (UINT32)paddr,
891   printf("index=%08X  pagesize=%08X  vaddr=%08X%08X  paddr=%08X%08X  asid=%02X  r=%X  c=%X  dvg=%c%c%c\n",
892         tlbindex, pagesize, (UINT32)(vaddr >> 32), (UINT32)vaddr, (UINT32)(paddr >> 32), (UINT32)paddr,
886893         asid, r, c, (lo & 4) ? 'd' : '.', (lo & 2) ? 'v' : '.', (lo & 1) ? 'g' : '.');
887894#endif
888895}
src/emu/cpu/mips/mips3.c
r2864r2865
556556         if ((mips3.core.cpr[0][idx] ^ val) & 0xff)
557557         {
558558            mips3.core.cpr[0][idx] = val;
559            mips3com_unmap_tlb_entries(&mips3.core);
560            mips3com_map_tlb_entries(&mips3.core);
559            mips3com_asid_changed(&mips3.core);
561560         }
562561         mips3.core.cpr[0][idx] = val;
563562         break;
src/emu/cpu/drcbex86.c
r2864r2865
169169   x86_entry_point_func   entry;               /* entry point */
170170   x86code *            exit;               /* exit point */
171171   x86code *            nocode;               /* nocode handler */
172   x86code *            save;               /* save handler */
173   x86code *            restore;            /* restore handler */
172174
173175   UINT32 *            reglo[REG_MAX];         /* pointer to low part of data for each register */
174176   UINT32 *            reghi[REG_MAX];         /* pointer to high part of data for each register */
r2864r2865
184186   UINT64               reshi;               /* extended high result */
185187
186188   x86log_context *      log;               /* logging */
189   UINT8               logged_common;         /* logged common code already? */
187190};
188191
189192
r2864r2865
205208static void fixup_label(void *parameter, drccodeptr labelcodeptr);
206209
207210/* miscellaneous functions */
208static void dmulu(UINT64 *dstlo, UINT64 *dsthi, UINT64 src1, UINT64 src2);
209static void dmuls(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2);
210static void ddivu(UINT64 *dstlo, UINT64 *dsthi, UINT64 src1, UINT64 src2);
211static void ddivs(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2);
211static int dmulu(UINT64 *dstlo, UINT64 *dsthi, UINT64 src1, UINT64 src2, int flags);
212static int dmuls(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2, int flags);
213static int ddivu(UINT64 *dstlo, UINT64 *dsthi, UINT64 src1, UINT64 src2);
214static int ddivs(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2);
212215
213216
214217
r2864r2865
619622{
620623   UINT32 (*cpuid_ecx_stub)(void);
621624   x86code **dst;
625   int regnum;
622626
623627   /* output a note to the log */
624628   if (drcbe->log != NULL)
r2864r2865
654658   emit_mov_m32_r32(dst, MABS(&drcbe->stacksave), REG_ESP);                     // mov   [stacksave],esp
655659   emit_fstcw_m16(dst, MABS(&drcbe->fpumode));                                 // fstcw [fpumode]
656660   emit_jmp_r32(dst, REG_EAX);                                             // jmp   eax
657   if (drcbe->log != NULL)
661   if (drcbe->log != NULL && !drcbe->logged_common)
658662      x86log_disasm_code_range(drcbe->log, "entry_point", (x86code *)drcbe->entry, *dst);
659663
660664   /* generate an exit point */
r2864r2865
667671   emit_pop_r32(dst, REG_ESI);                                             // pop   esi
668672   emit_pop_r32(dst, REG_EBX);                                             // pop   ebx
669673   emit_ret(dst);                                                      // ret
670   if (drcbe->log != NULL)
674   if (drcbe->log != NULL && !drcbe->logged_common)
671675      x86log_disasm_code_range(drcbe->log, "exit_point", drcbe->exit, *dst);
672676
673677   /* generate a no code point */
674678   drcbe->nocode = *dst;
675679   emit_ret(dst);                                                      // ret
676   if (drcbe->log != NULL)
680   if (drcbe->log != NULL && !drcbe->logged_common)
677681      x86log_disasm_code_range(drcbe->log, "nocode", drcbe->nocode, *dst);
678682
683   /* generate a save subroutine */
684   drcbe->save = *dst;
685   emit_pushf(dst);                                                   // pushf
686   emit_pop_r32(dst, REG_EAX);                                             // pop    eax
687   emit_and_r32_imm(dst, REG_EAX, 0x8c5);                                    // and    eax,0x8c5
688   emit_mov_r8_m8(dst, REG_AL, MBD(REG_EAX, flags_map));                        // mov    al,[flags_map]
689   emit_mov_m8_r8(dst, MBD(REG_ECX, offsetof(drcuml_machine_state, flags)), REG_AL);   // mov    state->flags,al
690   emit_mov_r8_m8(dst, REG_AL, MABS(&drcbe->state.fmod));                        // mov    al,[fmod]
691   emit_mov_m8_r8(dst, MBD(REG_ECX, offsetof(drcuml_machine_state, fmod)), REG_AL);   // mov    state->fmod,al
692   emit_mov_r32_m32(dst, REG_EAX, MABS(&drcbe->state.exp));                     // mov    eax,[exp]
693   emit_mov_m32_r32(dst, MBD(REG_ECX, offsetof(drcuml_machine_state, exp)), REG_EAX);   // mov    state->exp,eax
694   for (regnum = 0; regnum < ARRAY_LENGTH(drcbe->state.r); regnum++)
695   {
696      if (int_register_map[regnum] != 0)
697         emit_mov_m32_r32(dst, MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.l)), int_register_map[regnum]);
698      else
699      {
700         emit_mov_r32_m32(dst, REG_EAX, MABS(&drcbe->state.r[regnum].w.l));
701         emit_mov_m32_r32(dst, MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.l)), REG_EAX);
702      }
703      emit_mov_r32_m32(dst, REG_EAX, MABS(&drcbe->state.r[regnum].w.h));
704      emit_mov_m32_r32(dst, MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.h)), REG_EAX);
705   }
706   for (regnum = 0; regnum < ARRAY_LENGTH(drcbe->state.f); regnum++)
707   {
708      emit_mov_r32_m32(dst, REG_EAX, MABS(&drcbe->state.f[regnum].s.l));
709      emit_mov_m32_r32(dst, MBD(REG_ECX, offsetof(drcuml_machine_state, f[regnum].s.l)), REG_EAX);
710      emit_mov_r32_m32(dst, REG_EAX, MABS(&drcbe->state.f[regnum].s.h));
711      emit_mov_m32_r32(dst, MBD(REG_ECX, offsetof(drcuml_machine_state, f[regnum].s.h)), REG_EAX);
712   }
713   emit_ret(dst);                                                      // ret
714   if (drcbe->log != NULL && !drcbe->logged_common)
715      x86log_disasm_code_range(drcbe->log, "save", drcbe->save, *dst);
716
717   /* generate a restore subroutine */
718   drcbe->restore = *dst;
719   for (regnum = 0; regnum < ARRAY_LENGTH(drcbe->state.r); regnum++)
720   {
721      if (int_register_map[regnum] != 0)
722         emit_mov_r32_m32(dst, int_register_map[regnum], MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.l)));
723      else
724      {
725         emit_mov_r32_m32(dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.l)));
726         emit_mov_m32_r32(dst, MABS(&drcbe->state.r[regnum].w.l), REG_EAX);
727      }
728      emit_mov_r32_m32(dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.h)));
729      emit_mov_m32_r32(dst, MABS(&drcbe->state.r[regnum].w.h), REG_EAX);
730   }
731   for (regnum = 0; regnum < ARRAY_LENGTH(drcbe->state.f); regnum++)
732   {
733      emit_mov_r32_m32(dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, f[regnum].s.l)));
734      emit_mov_m32_r32(dst, MABS(&drcbe->state.f[regnum].s.l), REG_EAX);
735      emit_mov_r32_m32(dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, f[regnum].s.h)));
736      emit_mov_m32_r32(dst, MABS(&drcbe->state.f[regnum].s.h), REG_EAX);
737   }
738   emit_movzx_r32_m8(dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, fmod)));// movzx eax,state->fmod
739   emit_and_r32_imm(dst, REG_EAX, 3);                                       // and    eax,3
740   emit_mov_m8_r8(dst, MABS(&drcbe->state.fmod), REG_AL);                        // mov    [fmod],al
741   emit_fldcw_m16(dst, MISD(REG_EAX, 2, &fp_control[0]));                        // fldcw  fp_control[eax]
742   emit_mov_r32_m32(dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, exp)));   // mov    eax,state->exp
743   emit_mov_m32_r32(dst, MABS(&drcbe->state.exp), REG_EAX);                     // mov    [exp],eax
744   emit_movzx_r32_m8(dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, flags)));// movzx eax,state->flags
745   emit_push_m32(dst, MISD(REG_EAX, 4, flags_unmap));                           // push   flags_unmap[eax*4]
746   emit_popf(dst);                                                      // popf
747   emit_ret(dst);                                                      // ret
748   if (drcbe->log != NULL && !drcbe->logged_common)
749      x86log_disasm_code_range(drcbe->log, "restore", drcbe->restore, *dst);
750
679751   /* finish up codegen */
680752   drccache_end_codegen(drcbe->cache);
753   drcbe->logged_common = TRUE;
681754
682755   /* reset our hash tables */
683756   drchash_reset(drcbe->hash);
r2864r2865
37173790static x86code *op_save(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst)
37183791{
37193792   drcuml_parameter dstp;
3720   int regnum;
37213793
37223794   /* validate instruction */
37233795   assert(inst->size == 4);
r2864r2865
37293801
37303802   /* copy live state to the destination */
37313803   emit_mov_r32_imm(&dst, REG_ECX, dstp.value);                              // mov    ecx,dstp
3732
3733   /* copy flags */
3734   emit_pushf(&dst);                                                   // pushf
3735   emit_pop_r32(&dst, REG_EAX);                                          // pop    eax
3736   emit_and_r32_imm(&dst, REG_EAX, 0x8c5);                                    // and    eax,0x8c5
3737   emit_mov_r8_m8(&dst, REG_AL, MBD(REG_EAX, flags_map));                        // mov    al,[flags_map]
3738   emit_mov_m8_r8(&dst, MBD(REG_ECX, offsetof(drcuml_machine_state, flags)), REG_AL);   // mov    state->flags,al
3739
3740   /* copy fmod and exp */
3741   emit_mov_r8_m8(&dst, REG_AL, MABS(&drcbe->state.fmod));                        // mov    al,[fmod]
3742   emit_mov_m8_r8(&dst, MBD(REG_ECX, offsetof(drcuml_machine_state, fmod)), REG_AL);   // mov    state->fmod,al
3743   emit_mov_r32_m32(&dst, REG_EAX, MABS(&drcbe->state.exp));                     // mov    eax,[exp]
3744   emit_mov_m32_r32(&dst, MBD(REG_ECX, offsetof(drcuml_machine_state, exp)), REG_EAX);   // mov    state->exp,eax
3745
3746   /* copy integer registers */
3747   for (regnum = 0; regnum < ARRAY_LENGTH(drcbe->state.r); regnum++)
3748   {
3749      if (int_register_map[regnum] != 0)
3750         emit_mov_m32_r32(&dst, MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.l)), int_register_map[regnum]);
3751      else
3752      {
3753         emit_mov_r32_m32(&dst, REG_EAX, MABS(&drcbe->state.r[regnum].w.l));
3754         emit_mov_m32_r32(&dst, MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.l)), REG_EAX);
3755      }
3756      emit_mov_r32_m32(&dst, REG_EAX, MABS(&drcbe->state.r[regnum].w.h));
3757      emit_mov_m32_r32(&dst, MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.h)), REG_EAX);
3758   }
3759
3760   /* copy FP registers */
3761   for (regnum = 0; regnum < ARRAY_LENGTH(drcbe->state.f); regnum++)
3762   {
3763      emit_mov_r32_m32(&dst, REG_EAX, MABS(&drcbe->state.f[regnum].s.l));
3764      emit_mov_m32_r32(&dst, MBD(REG_ECX, offsetof(drcuml_machine_state, f[regnum].s.l)), REG_EAX);
3765      emit_mov_r32_m32(&dst, REG_EAX, MABS(&drcbe->state.f[regnum].s.h));
3766      emit_mov_m32_r32(&dst, MBD(REG_ECX, offsetof(drcuml_machine_state, f[regnum].s.h)), REG_EAX);
3767   }
3768
3804   emit_call(&dst, drcbe->save);                                          // call   save
37693805   return dst;
37703806}
37713807
r2864r2865
37773813static x86code *op_restore(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst)
37783814{
37793815   drcuml_parameter dstp;
3780   int regnum;
37813816
37823817   /* validate instruction */
37833818   assert(inst->size == 4);
37843819   assert_no_condition(inst);
3785   assert_no_flags(inst);
37863820
37873821   /* normalize parameters */
37883822   param_normalize_1(drcbe, inst, &dstp, PTYPE_M);
37893823
37903824   /* copy live state from the destination */
37913825   emit_mov_r32_imm(&dst, REG_ECX, dstp.value);                              // mov    ecx,dstp
3792
3793   /* copy integer registers */
3794   for (regnum = 0; regnum < ARRAY_LENGTH(drcbe->state.r); regnum++)
3795   {
3796      if (int_register_map[regnum] != 0)
3797         emit_mov_r32_m32(&dst, int_register_map[regnum], MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.l)));
3798      else
3799      {
3800         emit_mov_r32_m32(&dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.l)));
3801         emit_mov_m32_r32(&dst, MABS(&drcbe->state.r[regnum].w.l), REG_EAX);
3802      }
3803      emit_mov_r32_m32(&dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, r[regnum].w.h)));
3804      emit_mov_m32_r32(&dst, MABS(&drcbe->state.r[regnum].w.h), REG_EAX);
3805   }
3806
3807   /* copy FP registers */
3808   for (regnum = 0; regnum < ARRAY_LENGTH(drcbe->state.f); regnum++)
3809   {
3810      emit_mov_r32_m32(&dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, f[regnum].s.l)));
3811      emit_mov_m32_r32(&dst, MABS(&drcbe->state.f[regnum].s.l), REG_EAX);
3812      emit_mov_r32_m32(&dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, f[regnum].s.h)));
3813      emit_mov_m32_r32(&dst, MABS(&drcbe->state.f[regnum].s.h), REG_EAX);
3814   }
3815
3816   /* copy fmod and exp */
3817   emit_movzx_r32_m8(&dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, fmod)));// movzx eax,state->fmod
3818   emit_and_r32_imm(&dst, REG_EAX, 3);                                       // and    eax,3
3819   emit_mov_m8_r8(&dst, MABS(&drcbe->state.fmod), REG_AL);                        // mov    [fmod],al
3820   emit_fldcw_m16(&dst, MISD(REG_EAX, 2, &fp_control[0]));                        // fldcw  fp_control[eax]
3821   emit_mov_r32_m32(&dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, exp)));   // mov    eax,state->exp
3822   emit_mov_m32_r32(&dst, MABS(&drcbe->state.exp), REG_EAX);                     // mov    [exp],eax
3823
3824   /* copy flags */
3825   emit_movzx_r32_m8(&dst, REG_EAX, MBD(REG_ECX, offsetof(drcuml_machine_state, flags)));// movzx eax,state->flags
3826   emit_push_m32(&dst, MISD(REG_EAX, 4, flags_unmap));                           // push   flags_unmap[eax*4]
3827   emit_popf(&dst);                                                   // popf
3828
3826   emit_call(&dst, drcbe->restore);                                       // call   restore
38293827   return dst;
38303828}
38313829
r2864r2865
45624560
45634561   /* normalize parameters */
45644562   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI, &sizep, PTYPE_I);
4565   assert(srcp.type != DRCUML_PTYPE_IMMEDIATE);
45664563
45674564   /* pick a target register for the general case */
45684565   dstreg = (inst->size == 8) ? REG_EAX : param_select_register(REG_EAX, &dstp, NULL);
r2864r2865
47734770
47744771   /* normalize parameters */
47754772   param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
4776   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
47774773
47784774   /* pick a target register for the general case */
47794775   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
48924888
48934889   /* normalize parameters */
48944890   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
4895   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
48964891
48974892   /* pick a target register for the general case */
48984893   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
50655060
50665061static x86code *op_mulu(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst)
50675062{
5063   UINT8 zsflags = inst->flags & (DRCUML_FLAG_Z | DRCUML_FLAG_S);
5064   UINT8 vflag =  inst->flags & DRCUML_FLAG_V;
50685065   drcuml_parameter dstp, edstp, src1p, src2p;
50695066   int compute_hi;
50705067
50715068   /* validate instruction */
50725069   assert(inst->size == 4 || inst->size == 8);
50735070   assert_no_condition(inst);
5074   assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S);
5071   assert_flags(inst, DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S);
50755072
50765073   /* normalize parameters */
50775074   param_normalize_4_commutative(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
r2864r2865
50985095      /* compute flags */
50995096      if (inst->flags != 0)
51005097      {
5101         if (compute_hi)
5098         if (zsflags != 0)
51025099         {
5103            if (inst->flags == DRCUML_FLAG_Z)
5104               emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                     // or    edx,eax
5105            else if (inst->flags == DRCUML_FLAG_S)
5106               emit_test_r32_r32(&dst, REG_EDX, REG_EDX);                     // test  edx,edx
5100            if (vflag)
5101               emit_pushf(&dst);                                       // pushf
5102            if (compute_hi)
5103            {
5104               if (zsflags == DRCUML_FLAG_Z)
5105                  emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                  // or    edx,eax
5106               else if (zsflags == DRCUML_FLAG_S)
5107                  emit_test_r32_r32(&dst, REG_EDX, REG_EDX);                  // test  edx,edx
5108               else
5109               {
5110                  emit_movzx_r32_r16(&dst, REG_ECX, REG_AX);                  // movzx ecx,ax
5111                  emit_shr_r32_imm(&dst, REG_EAX, 16);                     // shr   eax,16
5112                  emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                  // or    edx,ecx
5113                  emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                  // or    edx,eax
5114               }
5115            }
51075116            else
5117               emit_test_r32_r32(&dst, REG_EAX, REG_EAX);                     // test  eax,eax
5118
5119            /* we rely on the fact that OF is cleared by all logical operations above */
5120            if (vflag)
51085121            {
5109               emit_movzx_r32_r16(&dst, REG_ECX, REG_AX);                     // movzx ecx,ax
5110               emit_shr_r32_imm(&dst, REG_EAX, 16);                        // shr   eax,16
5111               emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                     // or    edx,ecx
5112               emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                     // or    edx,eax
5122               emit_pushf(&dst);                                       // pushf
5123               emit_pop_r32(&dst, REG_EAX);                              // pop   eax
5124               emit_and_m32_imm(&dst, MBD(REG_ESP, 0), ~0x84);                  // and   [esp],~0x84
5125               emit_or_m32_r32(&dst, MBD(REG_ESP, 0), REG_EAX);               // or    [esp],eax
5126               emit_popf(&dst);                                       // popf
51135127            }
51145128         }
5115         else
5116            emit_test_r32_r32(&dst, REG_EAX, REG_EAX);                        // test  eax,eax
51175129      }
51185130   }
51195131
r2864r2865
51215133   else if (inst->size == 8)
51225134   {
51235135      /* general case */
5136      emit_mov_m32_imm(&dst, MBD(REG_ESP, 24), inst->flags);                     // mov   [esp+24],flags
51245137      emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 16), &src2p);                  // mov   [esp+16],src2p
51255138      emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 8), &src1p);                     // mov   [esp+8],src1p
51265139      if (!compute_hi)
51275140         emit_mov_m32_imm(&dst, MBD(REG_ESP, 4), (FPTR)&drcbe->reslo);            // mov   [esp+4],&reslo
51285141      else
5129         emit_mov_m32_imm(&dst, MBD(REG_ESP, 4), (FPTR)&drcbe->reshi);            // push  [esp+4],&reshi
5142         emit_mov_m32_imm(&dst, MBD(REG_ESP, 4), (FPTR)&drcbe->reshi);            // mov   [esp+4],&reshi
51305143      emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (FPTR)&drcbe->reslo);               // mov   [esp],&reslo
51315144      emit_call(&dst, (x86code *)dmulu);                                    // call  dmulu
5145      if (inst->flags != 0)
5146         emit_push_m32(&dst, MISD(REG_EAX, 4, flags_unmap));                     // push   flags_unmap[eax*4]
51325147      emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reslo + 0));            // mov   eax,reslo.lo
51335148      emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reslo + 1));            // mov   edx,reslo.hi
51345149      emit_mov_p64_r64(drcbe, &dst, &dstp, REG_EAX, REG_EDX);                     // mov   dstp,edx:eax
5135      if (inst->flags != 0 && !compute_hi)
5136      {
5137         if (inst->flags == DRCUML_FLAG_Z)
5138            emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                        // or    edx,eax
5139         else if (inst->flags == DRCUML_FLAG_S)
5140            emit_test_r32_r32(&dst, REG_EDX, REG_EDX);                        // test  edx,edx
5141         else
5142         {
5143            emit_movzx_r32_r16(&dst, REG_ECX, REG_AX);                        // movzx ecx,ax
5144            emit_shr_r32_imm(&dst, REG_EAX, 16);                           // shr   eax,16
5145            emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                        // or    edx,ecx
5146            emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                        // or    edx,eax
5147         }
5148      }
51495150      if (compute_hi)
51505151      {
5151         if (inst->flags & DRCUML_FLAG_Z)
5152            emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                        // or    edx,eax
51535152         emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reshi + 0));         // mov   eax,reshi.lo
51545153         emit_mov_r32_m32(&dst, REG_ECX, MABS((UINT32 *)&drcbe->reshi + 1));         // mov   ecx,reshi.hi
51555154         emit_mov_p64_r64(drcbe, &dst, &edstp, REG_EAX, REG_ECX);               // mov   edstp,ecx:eax
5156         if (inst->flags != 0)
5157         {
5158            if (inst->flags == DRCUML_FLAG_Z)
5159            {
5160               emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                     // or    edx,eax
5161               emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                     // or    edx,ecx
5162            }
5163            else if (inst->flags == DRCUML_FLAG_S)
5164               emit_test_r32_r32(&dst, REG_ECX, REG_ECX);                     // test  ecx,ecx
5165            else
5166            {
5167               emit_or_r32_r32(&dst, REG_EAX, REG_EDX);                     // or    eax,edx
5168               emit_movzx_r32_r16(&dst, REG_EDX, REG_AX);                     // movzx edx,ax
5169               emit_shr_r32_imm(&dst, REG_EAX, 16);                        // shr   eax,16
5170               emit_or_r32_r32(&dst, REG_ECX, REG_EDX);                     // or    edx,ecx
5171               emit_or_r32_r32(&dst, REG_ECX, REG_EAX);                     // or    edx,eax
5172            }
5173         }
51745155      }
5156      if (inst->flags != 0)
5157         emit_popf(&dst);                                             // popf
51755158   }
51765159   return dst;
51775160}
r2864r2865
51835166
51845167static x86code *op_muls(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst)
51855168{
5169   UINT8 zsflags = inst->flags & (DRCUML_FLAG_Z | DRCUML_FLAG_S);
5170   UINT8 vflag =  inst->flags & DRCUML_FLAG_V;
51865171   drcuml_parameter dstp, edstp, src1p, src2p;
51875172   int compute_hi;
51885173
51895174   /* validate instruction */
51905175   assert(inst->size == 4 || inst->size == 8);
51915176   assert_no_condition(inst);
5192   assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S);
5177   assert_flags(inst, DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S);
51935178
51945179   /* normalize parameters */
51955180   param_normalize_4_commutative(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
r2864r2865
52395224      /* compute flags */
52405225      if (inst->flags != 0)
52415226      {
5242         if (compute_hi)
5227         if (zsflags != 0)
52435228         {
5244            if (inst->flags == DRCUML_FLAG_Z)
5245               emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                     // or    edx,eax
5246            else if (inst->flags == DRCUML_FLAG_S)
5247               emit_test_r32_r32(&dst, REG_EDX, REG_EDX);                     // test  edx,edx
5229            if (vflag)
5230               emit_pushf(&dst);                                       // pushf
5231            if (compute_hi)
5232            {
5233               if (inst->flags == DRCUML_FLAG_Z)
5234                  emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                  // or    edx,eax
5235               else if (inst->flags == DRCUML_FLAG_S)
5236                  emit_test_r32_r32(&dst, REG_EDX, REG_EDX);                  // test  edx,edx
5237               else
5238               {
5239                  emit_movzx_r32_r16(&dst, REG_ECX, REG_AX);                  // movzx ecx,ax
5240                  emit_shr_r32_imm(&dst, REG_EAX, 16);                     // shr   eax,16
5241                  emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                  // or    edx,ecx
5242                  emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                  // or    edx,eax
5243               }
5244            }
52485245            else
5246               emit_test_r32_r32(&dst, REG_EAX, REG_EAX);                     // test  eax,eax
5247
5248            /* we rely on the fact that OF is cleared by all logical operations above */
5249            if (vflag)
52495250            {
5250               emit_movzx_r32_r16(&dst, REG_ECX, REG_AX);                     // movzx ecx,ax
5251               emit_shr_r32_imm(&dst, REG_EAX, 16);                        // shr   eax,16
5252               emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                     // or    edx,ecx
5253               emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                     // or    edx,eax
5251               emit_pushf(&dst);                                       // pushf
5252               emit_pop_r32(&dst, REG_EAX);                              // pop   eax
5253               emit_and_m32_imm(&dst, MBD(REG_ESP, 0), ~0x84);                  // and   [esp],~0x84
5254               emit_or_m32_r32(&dst, MBD(REG_ESP, 0), REG_EAX);               // or    [esp],eax
5255               emit_popf(&dst);                                       // popf
52545256            }
52555257         }
5256         else
5257            emit_test_r32_r32(&dst, REG_EAX, REG_EAX);                        // test  eax,eax
52585258      }
52595259   }
52605260
r2864r2865
52625262   else if (inst->size == 8)
52635263   {
52645264      /* general case */
5265      emit_mov_m32_imm(&dst, MBD(REG_ESP, 24), inst->flags);                     // mov   [esp+24],flags
52655266      emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 16), &src2p);                  // mov   [esp+16],src2p
52665267      emit_mov_m64_p64(drcbe, &dst, MBD(REG_ESP, 8), &src1p);                     // mov   [esp+8],src1p
52675268      if (!compute_hi)
r2864r2865
52705271         emit_mov_m32_imm(&dst, MBD(REG_ESP, 4), (FPTR)&drcbe->reshi);            // push  [esp+4],&reshi
52715272      emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (FPTR)&drcbe->reslo);               // mov   [esp],&reslo
52725273      emit_call(&dst, (x86code *)dmuls);                                    // call  dmuls
5274      if (inst->flags != 0)
5275         emit_push_m32(&dst, MISD(REG_EAX, 4, flags_unmap));                     // push   flags_unmap[eax*4]
52735276      emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reslo + 0));            // mov   eax,reslo.lo
52745277      emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reslo + 1));            // mov   edx,reslo.hi
52755278      emit_mov_p64_r64(drcbe, &dst, &dstp, REG_EAX, REG_EDX);                     // mov   dstp,edx:eax
5276      if (inst->flags != 0 && !compute_hi)
5277      {
5278         if (inst->flags == DRCUML_FLAG_Z)
5279            emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                        // or    edx,eax
5280         else if (inst->flags == DRCUML_FLAG_S)
5281            emit_test_r32_r32(&dst, REG_EDX, REG_EDX);                        // test  edx,edx
5282         else
5283         {
5284            emit_movzx_r32_r16(&dst, REG_ECX, REG_AX);                        // movzx ecx,ax
5285            emit_shr_r32_imm(&dst, REG_EAX, 16);                           // shr   eax,16
5286            emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                        // or    edx,ecx
5287            emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                        // or    edx,eax
5288         }
5289      }
52905279      if (compute_hi)
52915280      {
52925281         emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reshi + 0));         // mov   eax,reshi.lo
52935282         emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reshi + 1));         // mov   edx,reshi.hi
52945283         emit_mov_p64_r64(drcbe, &dst, &edstp, REG_EAX, REG_EDX);               // mov   edstp,edx:eax
5295         if (inst->flags != 0)
5296         {
5297            if (inst->flags == DRCUML_FLAG_Z)
5298            {
5299               emit_or_r32_r32(&dst, REG_EDX, REG_EAX);                     // or    edx,eax
5300               emit_or_r32_r32(&dst, REG_EDX, REG_ECX);                     // or    edx,ecx
5301            }
5302            else if (inst->flags == DRCUML_FLAG_S)
5303               emit_test_r32_r32(&dst, REG_ECX, REG_ECX);                     // test  ecx,ecx
5304            else
5305            {
5306               emit_or_r32_r32(&dst, REG_EAX, REG_EDX);                     // or    eax,edx
5307               emit_movzx_r32_r16(&dst, REG_EDX, REG_AX);                     // movzx edx,ax
5308               emit_shr_r32_imm(&dst, REG_EAX, 16);                        // shr   eax,16
5309               emit_or_r32_r32(&dst, REG_ECX, REG_EDX);                     // or    edx,ecx
5310               emit_or_r32_r32(&dst, REG_ECX, REG_EAX);                     // or    edx,eax
5311            }
5312         }
53135284      }
5285      if (inst->flags != 0)
5286         emit_popf(&dst);                                             // popf
53145287   }
53155288   return dst;
53165289}
r2864r2865
53295302   /* validate instruction */
53305303   assert(inst->size == 4 || inst->size == 8);
53315304   assert_no_condition(inst);
5332   assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S);
5305   assert_flags(inst, DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S);
53335306
53345307   /* normalize parameters */
53355308   param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
r2864r2865
53405313   {
53415314      /* general case */
53425315      emit_mov_r32_p32(drcbe, &dst, REG_ECX, &src2p);                           // mov   ecx,src2p
5316      if (inst->flags != 0)
5317      {
5318         emit_mov_r32_imm(&dst, REG_EAX, 0xa0000000);                        // mov   eax,0xa0000000
5319         emit_add_r32_r32(&dst, REG_EAX, REG_EAX);                           // add   eax,eax
5320      }
53435321      emit_jecxz_link(&dst, &skip);                                       // jecxz skip
53445322      emit_mov_r32_p32(drcbe, &dst, REG_EAX, &src1p);                           // mov   eax,src1p
53455323      emit_xor_r32_r32(&dst, REG_EDX, REG_EDX);                              // xor   edx,edx
r2864r2865
53645342         emit_mov_m32_imm(&dst, MBD(REG_ESP, 4), (FPTR)&drcbe->reshi);            // push  [esp+4],&reshi
53655343      emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (FPTR)&drcbe->reslo);               // mov   [esp],&reslo
53665344      emit_call(&dst, (x86code *)ddivu);                                    // call  ddivu
5345      if (inst->flags != 0)
5346         emit_push_m32(&dst, MISD(REG_EAX, 4, flags_unmap));                     // push   flags_unmap[eax*4]
53675347      emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reslo + 0));            // mov   eax,reslo.lo
53685348      emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reslo + 1));            // mov   edx,reslo.hi
53695349      emit_mov_p64_r64(drcbe, &dst, &dstp, REG_EAX, REG_EDX);                     // mov   dstp,edx:eax
5370      if (inst->flags != 0)
5371         emit_or_r32_r32(&dst, REG_EAX, REG_EDX);                           // or    eax,edx
53725350      if (compute_rem)
53735351      {
53745352         emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reshi + 0));         // mov   eax,reshi.lo
53755353         emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reshi + 1));         // mov   edx,reshi.hi
53765354         emit_mov_p64_r64(drcbe, &dst, &edstp, REG_EAX, REG_EDX);               // mov   edstp,edx:eax
53775355      }
5356      if (inst->flags != 0)
5357         emit_popf(&dst);                                             // popf
53785358   }
53795359   return dst;
53805360}
r2864r2865
53935373   /* validate instruction */
53945374   assert(inst->size == 4 || inst->size == 8);
53955375   assert_no_condition(inst);
5396   assert_flags(inst, /*DRCUML_FLAG_V |*/ DRCUML_FLAG_Z | DRCUML_FLAG_S);
5376   assert_flags(inst, DRCUML_FLAG_V | DRCUML_FLAG_Z | DRCUML_FLAG_S);
53975377
53985378   /* normalize parameters */
53995379   param_normalize_4(drcbe, inst, &dstp, PTYPE_MR, &edstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
r2864r2865
54045384   {
54055385      /* general case */
54065386      emit_mov_r32_p32(drcbe, &dst, REG_ECX, &src2p);                           // mov   ecx,src2p
5387      if (inst->flags != 0)
5388      {
5389         emit_mov_r32_imm(&dst, REG_EAX, 0xa0000000);                        // mov   eax,0xa0000000
5390         emit_add_r32_r32(&dst, REG_EAX, REG_EAX);                           // add   eax,eax
5391      }
54075392      emit_jecxz_link(&dst, &skip);                                       // jecxz skip
54085393      emit_mov_r32_p32(drcbe, &dst, REG_EAX, &src1p);                           // mov   eax,src1p
54095394      emit_cdq(&dst);                                                   // cdq
r2864r2865
54285413         emit_mov_m32_imm(&dst, MBD(REG_ESP, 4), (FPTR)&drcbe->reshi);            // push  [esp+4],&reshi
54295414      emit_mov_m32_imm(&dst, MBD(REG_ESP, 0), (FPTR)&drcbe->reslo);               // mov   [esp],&reslo
54305415      emit_call(&dst, (x86code *)ddivs);                                    // call  ddivs
5416      if (inst->flags != 0)
5417         emit_push_m32(&dst, MISD(REG_EAX, 4, flags_unmap));                     // push   flags_unmap[eax*4]
54315418      emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reslo + 0));            // mov   eax,reslo.lo
54325419      emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reslo + 1));            // mov   edx,reslo.hi
54335420      emit_mov_p64_r64(drcbe, &dst, &dstp, REG_EAX, REG_EDX);                     // mov   dstp,edx:eax
5434      if (inst->flags != 0)
5435         emit_or_r32_r32(&dst, REG_EAX, REG_EDX);                           // or    eax,edx
54365421      if (compute_rem)
54375422      {
54385423         emit_mov_r32_m32(&dst, REG_EAX, MABS((UINT32 *)&drcbe->reshi + 0));         // mov   eax,reshi.lo
54395424         emit_mov_r32_m32(&dst, REG_EDX, MABS((UINT32 *)&drcbe->reshi + 1));         // mov   edx,reshi.hi
54405425         emit_mov_p64_r64(drcbe, &dst, &edstp, REG_EAX, REG_EDX);               // mov   edstp,edx:eax
54415426      }
5427      if (inst->flags != 0)
5428         emit_popf(&dst);                                             // popf
54425429   }
54435430   return dst;
54445431}
r2864r2865
54605447
54615448   /* normalize parameters */
54625449   param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5463   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
54645450
54655451   /* pick a target register for the general case */
54665452   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
55695555
55705556   /* normalize parameters */
55715557   param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5572   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
55735558
55745559   /* pick a target register for the general case */
55755560   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
56255610
56265611   /* normalize parameters */
56275612   param_normalize_3_commutative(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5628   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
56295613
56305614   /* pick a target register for the general case */
56315615   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
56815665
56825666   /* normalize parameters */
56835667   param_normalize_2(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI);
5684   assert(srcp.type != DRCUML_PTYPE_IMMEDIATE);
56855668
56865669   /* pick a target register for the general case */
56875670   dstreg = param_select_register(REG_EAX, &dstp, NULL);
r2864r2865
57325715
57335716   /* normalize parameters */
57345717   param_normalize_2(drcbe, inst, &dstp, PTYPE_MR, &srcp, PTYPE_MRI);
5735   assert(srcp.type != DRCUML_PTYPE_IMMEDIATE);
57365718
57375719   /* pick a target register for the general case */
57385720   dstreg = param_select_register(REG_EAX, &dstp, NULL);
r2864r2865
57735755
57745756   /* normalize parameters */
57755757   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5776   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
57775758
57785759   /* pick a target register for the general case */
57795760   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
58225803
58235804   /* normalize parameters */
58245805   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5825   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
58265806
58275807   /* pick a target register for the general case */
58285808   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
58715851
58725852   /* normalize parameters */
58735853   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5874   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
58755854
58765855   /* pick a target register for the general case */
58775856   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
59205899
59215900   /* normalize parameters */
59225901   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5923   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
59245902
59255903   /* pick a target register for the general case */
59265904   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
59695947
59705948   /* normalize parameters */
59715949   param_normalize_3(drcbe, inst, &dstp, PTYPE_MR, &src1p, PTYPE_MRI, &src2p, PTYPE_MRI);
5972   assert(src1p.type != DRCUML_PTYPE_IMMEDIATE || src2p.type != DRCUML_PTYPE_IMMEDIATE);
59735950
59745951   /* pick a target register for the general case */
59755952   dstreg = param_select_register(REG_EAX, &dstp, &src2p);
r2864r2865
67386715    dmulu - perform a double-wide unsigned multiply
67396716-------------------------------------------------*/
67406717
6741static void dmulu(UINT64 *dstlo, UINT64 *dsthi, UINT64 src1, UINT64 src2)
6718static int dmulu(UINT64 *dstlo, UINT64 *dsthi, UINT64 src1, UINT64 src2, int flags)
67426719{
67436720   UINT64 lo, hi, prevlo;
67446721   UINT64 a, b, temp;
67456722
6746   /* shortcut if we don't care about the high bits */
6747   if (dstlo == dsthi)
6723   /* shortcut if we don't care about the high bits or the flags */
6724   if (dstlo == dsthi && flags == 0)
67486725   {
67496726      *dstlo = src1 * src2;
6750      return;
6727      return 0;
67516728   }
67526729
67536730   /* fetch source values */
r2864r2865
67566733   if (a == 0 || b == 0)
67576734   {
67586735      *dsthi = *dstlo = 0;
6759      return;
6736      return DRCUML_FLAG_Z;
67606737   }
67616738
67626739   /* compute high and low parts first */
r2864r2865
67776754   /* store the results */
67786755   *dsthi = hi;
67796756   *dstlo = lo;
6757   return ((hi >> 60) & DRCUML_FLAG_S) | ((*dsthi != 0) << 1);
67806758}
67816759
67826760
r2864r2865
67846762    dmuls - perform a double-wide signed multiply
67856763-------------------------------------------------*/
67866764
6787static void dmuls(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2)
6765static int dmuls(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2, int flags)
67886766{
67896767   UINT64 lo, hi, prevlo;
67906768   UINT64 a, b, temp;
67916769
6792   /* shortcut if we don't care about the high bits */
6793   if (dstlo == dsthi)
6770   /* shortcut if we don't care about the high bits or the flags */
6771   if (dstlo == dsthi && flags == 0)
67946772   {
67956773      *dstlo = src1 * src2;
6796      return;
6774      return 0;
67976775   }
67986776
67996777   /* fetch absolute source values */
r2864r2865
68026780   if (a == 0 || b == 0)
68036781   {
68046782      *dsthi = *dstlo = 0;
6805      return;
6783      return DRCUML_FLAG_Z;
68066784   }
68076785
68086786   /* compute high and low parts first */
r2864r2865
68306808   /* store the results */
68316809   *dsthi = hi;
68326810   *dstlo = lo;
6811   return ((hi >> 60) & DRCUML_FLAG_S) | ((*dsthi != ((INT64)lo >> 63)) << 1);
68336812}
68346813
68356814
r2864r2865
68376816    ddivu - perform a double-wide unsigned divide
68386817-------------------------------------------------*/
68396818
6840static void ddivu(UINT64 *dstlo, UINT64 *dsthi, UINT64 src1, UINT64 src2)
6819static int ddivu(UINT64 *dstlo, UINT64 *dsthi, UINT64 src1, UINT64 src2)
68416820{
68426821   /* do nothing if src2 == 0 */
68436822   if (src2 == 0)
6844      return;
6823      return DRCUML_FLAG_V;
68456824
68466825   /* shortcut if no remainder */
68476826   *dstlo = src1 / src2;
68486827   if (dstlo != dsthi)
68496828      *dsthi = src1 % src2;
6829   return ((*dstlo == 0) << 2) | ((*dstlo >> 60) & DRCUML_FLAG_S);
68506830}
68516831
68526832
r2864r2865
68546834    ddivs - perform a double-wide signed divide
68556835-------------------------------------------------*/
68566836
6857static void ddivs(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2)
6837static int ddivs(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2)
68586838{
68596839   /* do nothing if src2 == 0 */
68606840   if (src2 == 0)
6861      return;
6841      return DRCUML_FLAG_V;
68626842
68636843   /* shortcut if no remainder */
68646844   *dstlo = src1 / src2;
68656845   if (dstlo != dsthi)
68666846      *dsthi = src1 % src2;
6847   return ((*dstlo == 0) << 2) | ((*dstlo >> 60) & DRCUML_FLAG_S);
68676848}
src/emu/audio/generic.h
r2864r2865
5555/* If you're going to use soundlatchX_clear_w, and the cleared value is
5656   something other than 0x00, use this function from machine_init. Note
5757   that this one call effects all 4 latches */
58void soundlatch_setclearedvalue(int value);
58void soundlatch_setclearedvalue(running_machine *machine, int value);
5959
6060
6161#endif   /* __SOUND_GENERIC_H__ */
src/emu/audio/generic.c
r2864r2865
1111
1212#include "driver.h"
1313#include "generic.h"
14#include "deprecat.h"
1514
1615
1716
r2864r2865
157156    value for all sound latches
158157-------------------------------------------------*/
159158
160void soundlatch_setclearedvalue(int value)
159void soundlatch_setclearedvalue(running_machine *machine, int value)
161160{
162   assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!");
161   assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!");
163162   latch_clear_value = value;
164163}
src/emu/emuopts.c
r2864r2865
6464   { "autosave",                    "0",         OPTION_BOOLEAN,    "enable automatic restore at startup, and automatic save at exit time" },
6565   { "playback;pb",                 NULL,        0,                 "playback an input file" },
6666   { "record;rec",                  NULL,        0,                 "record an input file" },
67   { "snapname",                    "%g/%i",     0,                 "override of the default snapshot naming; %g == gamename, %i == index" },
6867   { "mngwrite",                    NULL,        0,                 "optional filename to write a MNG movie of the current session" },
6968   { "aviwrite",                    NULL,        0,                 "optional filename to write an AVI movie of the current session" },
7069   { "wavwrite",                    NULL,        0,                 "optional filename to write a WAV file of the current session" },
70   { "snapname",                    "%g/%i",     0,                 "override of the default snapshot/movie naming; %g == gamename, %i == index" },
71   { "snapsize",                    "auto",      0,                 "specify snapshot/movie resolution (<width>x<height>) or 'auto' to use minimal size " },
72   { "snapview",                    "internal",  0,                 "specify snapshot/movie view or 'internal' to use internal pixel-aspect views" },
7173
7274   /* performance options */
7375   { NULL,                          NULL,        OPTION_HEADER,     "CORE PERFORMANCE OPTIONS" },
src/emu/emuopts.h
r2864r2865
6363#define OPTION_AUTOSAVE            "autosave"
6464#define OPTION_PLAYBACK            "playback"
6565#define OPTION_RECORD            "record"
66#define OPTION_SNAPNAME            "snapname"
6766#define OPTION_MNGWRITE            "mngwrite"
6867#define OPTION_AVIWRITE            "aviwrite"
6968#define OPTION_WAVWRITE            "wavwrite"
69#define OPTION_SNAPNAME            "snapname"
70#define OPTION_SNAPSIZE            "snapsize"
71#define OPTION_SNAPVIEW            "snapview"
7072
7173/* core performance options */
7274#define OPTION_AUTOFRAMESKIP      "autoframeskip"
src/emu/video.c
r2864r2865
3838#define SUBSECONDS_PER_SPEED_UPDATE   (ATTOSECONDS_PER_SECOND / 4)
3939#define PAUSED_REFRESH_RATE         (30)
4040#define MAX_VBLANK_CALLBACKS      (10)
41#define DEFAULT_FRAME_PERIOD      ATTOTIME_IN_HZ(60)
41#define DEFAULT_FRAME_RATE         60
42#define DEFAULT_FRAME_PERIOD      ATTOTIME_IN_HZ(DEFAULT_FRAME_RATE)
4243
4344
4445
r2864r2865
7879
7980   /* screen specific VBLANK callbacks */
8081   vblank_state_changed_func vblank_callback[MAX_VBLANK_CALLBACKS]; /* the array of callbacks */
81
82   /* movie recording */
83   mame_file *            mng_file;            /* handle to the open movie file */
84   avi_file *            avi_file;            /* handle to the open movie file */
85   UINT32                movie_frame;         /* current movie frame number */
8682};
8783
8884
r2864r2865
128124   /* snapshot stuff */
129125   render_target *         snap_target;         /* screen shapshot target */
130126   bitmap_t *            snap_bitmap;         /* screen snapshot bitmap */
127   UINT8               snap_native;         /* are we using native per-screen layouts? */
128   INT32               snap_width;            /* width of snapshots (0 == auto) */
129   INT32               snap_height;         /* height of snapshots (0 == auto) */
130
131   /* movie recording */
132   mame_file *            mng_file;            /* handle to the open movie file */
133   avi_file *            avi_file;            /* handle to the open movie file */
134   attotime            movie_frame_period;      /* period of a single movie frame */
135   attotime            movie_next_frame_time;   /* time of next frame */
136   UINT32                movie_frame;         /* current movie frame number */
131137};
132138
133139
r2864r2865
190196static file_error mame_fopen_next(running_machine *machine, const char *pathoption, const char *extension, mame_file **file);
191197
192198/* movie recording */
193static void video_mng_record_frame(const device_config *screen);
194static void video_avi_record_frame(const device_config *screen);
199static void video_mng_record_frame(running_machine *machine);
200static void video_avi_record_frame(running_machine *machine);
195201
196202/* software rendering */
197203static void rgb888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
r2864r2865
295301void video_init(running_machine *machine)
296302{
297303   const char *filename;
304   const char *viewname;
298305
299306   /* validate */
300307   assert(machine != NULL);
r2864r2865
339346   pdrawgfx_shadow_lowpri = 0;
340347
341348   /* create a render target for snapshots */
342   if (machine->primary_screen != NULL)
343   {
349   viewname = options_get_string(mame_options(), OPTION_SNAPVIEW);
350   global.snap_native = (machine->primary_screen != NULL && (viewname[0] == 0 || strcmp(viewname, "native") == 0));
351   if (global.snap_native)
344352      global.snap_target = render_target_alloc(layout_snap, RENDER_CREATE_SINGLE_FILE | RENDER_CREATE_HIDDEN);
345      assert(global.snap_target != NULL);
353   else
354      global.snap_target = render_target_alloc(NULL, RENDER_CREATE_HIDDEN);
355   assert(global.snap_target != NULL);
356
357   /* if we are using the native layout, turn off all accoutrements */
358   if (global.snap_native)
346359      render_target_set_layer_config(global.snap_target, 0);
347   }
348360
361   /* otherwise, find the requested view and select it */
362   else
363      render_target_set_view(global.snap_target, video_get_view_for_target(machine, global.snap_target, viewname, 0, 1));
364
365   /* extract snap resolution if present */
366   if (sscanf(options_get_string(mame_options(), OPTION_SNAPSIZE), "%dx%d", &global.snap_width, &global.snap_height) != 2)
367      global.snap_width = global.snap_height = 0;
368
349369   /* start recording movie if specified */
350370   filename = options_get_string(mame_options(), OPTION_MNGWRITE);
351   if (filename[0] != 0 && machine->primary_screen != NULL)
352      video_mng_begin_recording(machine->primary_screen, filename);
371   if (filename[0] != 0)
372      video_mng_begin_recording(machine, filename);
353373
354374   filename = options_get_string(mame_options(), OPTION_AVIWRITE);
355   if (filename[0] != 0 && machine->primary_screen != NULL)
356      video_avi_begin_recording(machine->primary_screen, filename);
375   if (filename[0] != 0)
376      video_avi_begin_recording(machine, filename);
357377
358378   /* if no screens, create a periodic timer to drive updates */
359379   if (machine->primary_screen == NULL)
r2864r2865
379399   /* stop recording any movie */
380400   if (machine->primary_screen != NULL)
381401   {
382      video_mng_end_recording(machine->primary_screen);
383      video_avi_end_recording(machine->primary_screen);
402      video_mng_end_recording(machine);
403      video_avi_end_recording(machine);
384404   }
385405
386406   /* free all the graphics elements */
r2864r2865
15151535            render_container_empty(render_container_get_screen(screen));
15161536            render_screen_add_quad(screen, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), state->texture[state->curtexture], PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
15171537         }
1518
1519         /* update our movie recording state */
1520         if (!mame_is_paused(machine))
1521         {
1522            video_mng_record_frame(screen);
1523            video_avi_record_frame(screen);
1524         }
15251538      }
15261539
15271540      /* reset the screen changed flags */
r2864r2865
15301543      state->changed = FALSE;
15311544   }
15321545
1546   /* update our movie recording state */
1547   if (!mame_is_paused(machine))
1548   {
1549      video_mng_record_frame(machine);
1550      video_avi_record_frame(machine);
1551   }
1552
15331553   /* draw any crosshairs */
15341554   for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen))
15351555      crosshair_render(screen);
r2864r2865
20892109         filerr = mame_fopen(SEARCHPATH_SCREENSHOT, astring_c(fname), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
20902110         if (filerr == FILERR_NONE)
20912111         {
2092            video_screen_save_snapshot(machine->primary_screen, file);
2112            video_screen_save_snapshot(machine, machine->primary_screen, file);
20932113            mame_fclose(file);
20942114         }
20952115         astring_free(fname);
r2864r2865
21112131    to  the given file handle
21122132-------------------------------------------------*/
21132133
2114void video_screen_save_snapshot(const device_config *screen, mame_file *fp)
2134void video_screen_save_snapshot(running_machine *machine, const device_config *screen, mame_file *fp)
21152135{
2136   png_info pnginfo = { 0 };
21162137   const rgb_t *palette;
2117   png_info pnginfo = { 0 };
21182138   png_error error;
21192139   char text[256];
21202140
21212141   /* validate */
2122   assert(screen != NULL);
2142   assert(!global.snap_native || screen != NULL);
21232143   assert(fp != NULL);
21242144
21252145   /* create the bitmap to pass in */
r2864r2865
21282148   /* add two text entries describing the image */
21292149   sprintf(text, APPNAME " %s", build_version);
21302150   png_add_text(&pnginfo, "Software", text);
2131   sprintf(text, "%s %s", screen->machine->gamedrv->manufacturer, screen->machine->gamedrv->description);
2151   sprintf(text, "%s %s", machine->gamedrv->manufacturer, machine->gamedrv->description);
21322152   png_add_text(&pnginfo, "System", text);
21332153
21342154   /* now do the actual work */
2135   palette = (screen->machine->palette != NULL) ? palette_entry_list_adjusted(screen->machine->palette) : NULL;
2136   error = png_write_bitmap(mame_core_file(fp), &pnginfo, global.snap_bitmap, screen->machine->config->total_colors, palette);
2155   palette = (machine->palette != NULL) ? palette_entry_list_adjusted(machine->palette) : NULL;
2156   error = png_write_bitmap(mame_core_file(fp), &pnginfo, global.snap_bitmap, machine->config->total_colors, palette);
21372157
21382158   /* free any data allocated */
21392159   png_free(&pnginfo);
r2864r2865
21542174   assert(machine != NULL);
21552175   assert(machine->config != NULL);
21562176
2157   /* write one snapshot per visible screen */
2158   for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen))
2159      if (render_is_live_screen(screen))
2160      {
2161         file_error filerr = mame_fopen_next(machine, SEARCHPATH_SCREENSHOT, "png", &fp);
2162         if (filerr == FILERR_NONE)
2177   /* if we're native, then write one snapshot per visible screen */
2178   if (global.snap_native)
2179   {
2180      /* write one snapshot per visible screen */
2181      for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen))
2182         if (render_is_live_screen(screen))
21632183         {
2164            video_screen_save_snapshot(screen, fp);
2165            mame_fclose(fp);
2184            file_error filerr = mame_fopen_next(machine, SEARCHPATH_SCREENSHOT, "png", &fp);
2185            if (filerr == FILERR_NONE)
2186            {
2187               video_screen_save_snapshot(machine, screen, fp);
2188               mame_fclose(fp);
2189            }
21662190         }
2191   }
2192
2193   /* otherwise, just write a single snapshot */
2194   else
2195   {
2196      file_error filerr = mame_fopen_next(machine, SEARCHPATH_SCREENSHOT, "png", &fp);
2197      if (filerr == FILERR_NONE)
2198      {
2199         video_screen_save_snapshot(machine, NULL, fp);
2200         mame_fclose(fp);
21672201      }
2202   }
21682203}
21692204
21702205
r2864r2865
21812216   int view_index;
21822217
21832218   /* select the appropriate view in our dummy target */
2184   view_index = device_list_index(screen->machine->config->devicelist, VIDEO_SCREEN, screen->tag);
2185   assert(view_index != -1);
2186   render_target_set_view(global.snap_target, view_index);
2219   if (global.snap_native && screen != NULL)
2220   {
2221      view_index = device_list_index(screen->machine->config->devicelist, VIDEO_SCREEN, screen->tag);
2222      assert(view_index != -1);
2223      render_target_set_view(global.snap_target, view_index);
2224   }
21872225
21882226   /* get the minimum width/height and set it on the target */
2189   render_target_get_minimum_size(global.snap_target, &width, &height);
2227   width = global.snap_width;
2228   height = global.snap_height;
2229   if (width == 0 || height == 0)
2230      render_target_get_minimum_size(global.snap_target, &width, &height);
21902231   render_target_set_bounds(global.snap_target, width, height, 0);
21912232
21922233   /* if we don't have a bitmap, or if it's not the right size, allocate a new one */
r2864r2865
22852326    MNG movie is currently being recorded
22862327-------------------------------------------------*/
22872328
2288int video_mng_is_movie_active(const device_config *screen)
2329int video_mng_is_movie_active(running_machine *machine)
22892330{
2290   screen_state *state = get_safe_token(screen);
2291   return (state->mng_file != NULL);
2331   return (global.mng_file != NULL);
22922332}
22932333
22942334
r2864r2865
22972337    of a MNG movie
22982338-------------------------------------------------*/
22992339
2300void video_mng_begin_recording(const device_config *screen, const char *name)
2340void video_mng_begin_recording(running_machine *machine, const char *name)
23012341{
2302   screen_state *state = get_safe_token(screen);
2342   screen_state *state = NULL;
23032343   file_error filerr;
2344   png_error pngerr;
2345   int rate;
23042346
23052347   /* close any existing movie file */
2306   if (state->mng_file != NULL)
2307      video_mng_end_recording(screen);
2348   if (global.mng_file != NULL)
2349      video_mng_end_recording(machine);
23082350
2351   /* look up the primary screen */
2352   if (machine->primary_screen != NULL)
2353      state = get_safe_token(machine->primary_screen);
2354
2355   /* create a snapshot bitmap so we know what the target size is */
2356   create_snapshot_bitmap(NULL);
2357
23092358   /* create a new movie file and start recording */
23102359   if (name != NULL)
2311      filerr = mame_fopen(SEARCHPATH_MOVIE, name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &state->mng_file);
2360      filerr = mame_fopen(SEARCHPATH_MOVIE, name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &global.mng_file);
23122361   else
2313      filerr = mame_fopen_next(screen->machine, SEARCHPATH_MOVIE, "mng", &state->mng_file);
2314   state->movie_frame = 0;
2362      filerr = mame_fopen_next(machine, SEARCHPATH_MOVIE, "mng", &global.mng_file);
2363
2364   /* start the capture */
2365   rate = (state != NULL) ? ATTOSECONDS_TO_HZ(state->frame_period) : DEFAULT_FRAME_RATE;
2366   pngerr = mng_capture_start(mame_core_file(global.mng_file), global.snap_bitmap, rate);
2367   if (pngerr != PNGERR_NONE)
2368   {
2369      video_mng_end_recording(machine);
2370      return;
2371   }
2372
2373   /* compute the frame time */
2374   global.movie_next_frame_time = timer_get_time();
2375   global.movie_frame_period = ATTOTIME_IN_HZ(rate);
2376   global.movie_frame = 0;
23152377}
23162378
23172379
r2864r2865
23202382    a MNG movie
23212383-------------------------------------------------*/
23222384
2323void video_mng_end_recording(const device_config *screen)
2385void video_mng_end_recording(running_machine *machine)
23242386{
2325   screen_state *state = get_safe_token(screen);
2326
23272387   /* close the file if it exists */
2328   if (state->mng_file != NULL)
2388   if (global.mng_file != NULL)
23292389   {
2330      mng_capture_stop(mame_core_file(state->mng_file));
2331      mame_fclose(state->mng_file);
2332      state->mng_file = NULL;
2333      state->movie_frame = 0;
2390      mng_capture_stop(mame_core_file(global.mng_file));
2391      mame_fclose(global.mng_file);
2392      global.mng_file = NULL;
2393      global.movie_frame = 0;
23342394   }
23352395}
23362396
r2864r2865
23402400    movie
23412401-------------------------------------------------*/
23422402
2343static void video_mng_record_frame(const device_config *screen)
2403static void video_mng_record_frame(running_machine *machine)
23442404{
2345   screen_state *state = get_safe_token(screen);
2346   const rgb_t *palette;
2347
23482405   /* only record if we have a file */
2349   if (state->mng_file != NULL)
2406   if (global.mng_file != NULL)
23502407   {
2408      attotime curtime = timer_get_time();
23512409      png_info pnginfo = { 0 };
23522410      png_error error;
23532411
23542412      profiler_mark(PROFILER_MOVIE_REC);
23552413
23562414      /* create the bitmap */
2357      create_snapshot_bitmap(screen);
2415      create_snapshot_bitmap(NULL);
23582416
2359      /* track frames */
2360      if (state->movie_frame++ == 0)
2417      /* loop until we hit the right time */
2418      while (attotime_compare(global.movie_next_frame_time, curtime) <= 0)
23612419      {
2362         char text[256];
2420         const rgb_t *palette;
23632421
23642422         /* set up the text fields in the movie info */
2365         sprintf(text, APPNAME " %s", build_version);
2366         png_add_text(&pnginfo, "Software", text);
2367         sprintf(text, "%s %s", screen->machine->gamedrv->manufacturer, screen->machine->gamedrv->description);
2368         png_add_text(&pnginfo, "System", text);
2423         if (global.movie_frame == 0)
2424         {
2425            char text[256];
23692426
2370         /* start the capture */
2371         error = mng_capture_start(mame_core_file(state->mng_file), global.snap_bitmap, ATTOSECONDS_TO_HZ(state->frame_period));
2427            sprintf(text, APPNAME " %s", build_version);
2428            png_add_text(&pnginfo, "Software", text);
2429            sprintf(text, "%s %s", machine->gamedrv->manufacturer, machine->gamedrv->description);
2430            png_add_text(&pnginfo, "System", text);
2431         }
2432
2433         /* write the next frame */
2434         palette = (machine->palette != NULL) ? palette_entry_list_adjusted(machine->palette) : NULL;
2435         error = mng_capture_frame(mame_core_file(global.mng_file), &pnginfo, global.snap_bitmap, machine->config->total_colors, palette);
2436         png_free(&pnginfo);
23722437         if (error != PNGERR_NONE)
23732438         {
2374            png_free(&pnginfo);
2375            video_mng_end_recording(screen);
2376            return;
2439            video_mng_end_recording(machine);
2440            break;
23772441         }
2442
2443         /* advance time */
2444         global.movie_next_frame_time = attotime_add(global.movie_next_frame_time, global.movie_frame_period);
2445         global.movie_frame++;
23782446      }
23792447
2380      /* write the next frame */
2381      palette = (screen->machine->palette != NULL) ? palette_entry_list_adjusted(screen->machine->palette) : NULL;
2382      error = mng_capture_frame(mame_core_file(state->mng_file), &pnginfo, global.snap_bitmap, screen->machine->config->total_colors, palette);
2383      png_free(&pnginfo);
2384      if (error != PNGERR_NONE)
2385         video_mng_end_recording(screen);
2386
23872448      profiler_mark(PROFILER_END);
23882449   }
23892450}
r2864r2865
23992460    of an AVI movie
24002461-------------------------------------------------*/
24012462
2402void video_avi_begin_recording(const device_config *screen, const char *name)
2463void video_avi_begin_recording(running_machine *machine, const char *name)
24032464{
2404   screen_state *state = get_safe_token(screen);
2465   screen_state *state = NULL;
24052466   avi_movie_info info;
24062467   mame_file *tempfile;
24072468   file_error filerr;
24082469   avi_error avierr;
24092470
24102471   /* close any existing movie file */
2411   if (state->avi_file != NULL)
2412      video_avi_end_recording(screen);
2472   if (global.avi_file != NULL)
2473      video_avi_end_recording(machine);
24132474
2475   /* look up the primary screen */
2476   if (machine->primary_screen != NULL)
2477      state = get_safe_token(machine->primary_screen);
2478
24142479   /* create a snapshot bitmap so we know what the target size is */
2415   create_snapshot_bitmap(screen);
2480   create_snapshot_bitmap(NULL);
24162481
24172482   /* build up information about this new movie */
24182483   info.video_format = 0;
2419   info.video_timescale = 1000 * ATTOSECONDS_TO_HZ(state->frame_period);
2484   info.video_timescale = 1000 * ((state != NULL) ? ATTOSECONDS_TO_HZ(state->frame_period) : DEFAULT_FRAME_RATE);
24202485   info.video_sampletime = 1000;
24212486   info.video_numsamples = 0;
24222487   info.video_width = global.snap_bitmap->width;
r2864r2865
24252490
24262491   info.audio_format = 0;
24272492   info.audio_timescale = 1;
2428   info.audio_sampletime = screen->machine->sample_rate;
2493   info.audio_sampletime = machine->sample_rate;
24292494   info.audio_numsamples = 0;
24302495   info.audio_channels = 2;
24312496   info.audio_samplebits = 16;
2432   info.audio_samplerate = screen->machine->sample_rate;
2497   info.audio_samplerate = machine->sample_rate;
24332498
24342499   /* create a new temporary movie file */
24352500   if (name != NULL)
24362501      filerr = mame_fopen(SEARCHPATH_MOVIE, name, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &tempfile);
24372502   else
2438      filerr = mame_fopen_next(screen->machine, SEARCHPATH_MOVIE, "avi", &tempfile);
2439   state->movie_frame = 0;
2503      filerr = mame_fopen_next(machine, SEARCHPATH_MOVIE, "avi", &tempfile);
24402504
2505   /* reset our tracking */
2506   global.movie_frame = 0;
2507   global.movie_next_frame_time = timer_get_time();
2508   global.movie_frame_period = attotime_div(ATTOTIME_IN_SEC(1000), info.video_timescale);
2509
24412510   /* if we succeeded, make a copy of the name and create the real file over top */
24422511   if (filerr == FILERR_NONE)
24432512   {
r2864r2865
24452514      mame_fclose(tempfile);
24462515
24472516      /* create the file and free the string */
2448      avierr = avi_create(astring_c(fullname), &info, &state->avi_file);
2517      avierr = avi_create(astring_c(fullname), &info, &global.avi_file);
24492518      astring_free(fullname);
24502519   }
24512520}
r2864r2865
24562525    a avi movie
24572526-------------------------------------------------*/
24582527
2459void video_avi_end_recording(const device_config *screen)
2528void video_avi_end_recording(running_machine *machine)
24602529{
2461   screen_state *state = get_safe_token(screen);
2462
24632530   /* close the file if it exists */
2464   if (state->avi_file != NULL)
2531   if (global.avi_file != NULL)
24652532   {
2466      avi_close(state->avi_file);
2467      state->avi_file = NULL;
2468      state->movie_frame = 0;
2533      avi_close(global.avi_file);
2534      global.avi_file = NULL;
2535      global.movie_frame = 0;
24692536   }
24702537}
24712538
r2864r2865
24752542    movie
24762543-------------------------------------------------*/
24772544
2478static void video_avi_record_frame(const device_config *screen)
2545static void video_avi_record_frame(running_machine *machine)
24792546{
2480   screen_state *state = get_safe_token(screen);
2481
24822547   /* only record if we have a file */
2483   if (state->avi_file != NULL)
2548   if (global.avi_file != NULL)
24842549   {
2550      attotime curtime = timer_get_time();
24852551      avi_error avierr;
24862552
24872553      profiler_mark(PROFILER_MOVIE_REC);
24882554
24892555      /* create the bitmap */
2490      create_snapshot_bitmap(screen);
2556      create_snapshot_bitmap(NULL);
24912557
2492      /* write the next frame */
2493      avierr = avi_append_video_frame_rgb32(state->avi_file, global.snap_bitmap);
2494      if (avierr != AVIERR_NONE)
2495         video_avi_end_recording(screen);
2558      /* loop until we hit the right time */
2559      while (attotime_compare(global.movie_next_frame_time, curtime) <= 0)
2560      {
2561         /* write the next frame */
2562         avierr = avi_append_video_frame_rgb32(global.avi_file, global.snap_bitmap);
2563         if (avierr != AVIERR_NONE)
2564         {
2565            video_avi_end_recording(machine);
2566            break;
2567         }
24962568
2569         /* advance time */
2570         global.movie_next_frame_time = attotime_add(global.movie_next_frame_time, global.movie_frame_period);
2571         global.movie_frame++;
2572      }
2573
24972574      profiler_mark(PROFILER_END);
24982575   }
24992576}
r2864r2865
25062583
25072584void video_avi_add_sound(running_machine *machine, const INT16 *sound, int numsamples)
25082585{
2509   const device_config *screen;
2586   /* only record if we have a file */
2587   if (global.avi_file != NULL)
2588   {
2589      avi_error avierr;
25102590
2511   /* loop over screens that might be recording */
2512   for (screen = video_screen_first(machine->config); screen != NULL; screen = video_screen_next(screen))
2591      profiler_mark(PROFILER_MOVIE_REC);
2592
2593      /* write the next frame */
2594      avierr = avi_append_sound_samples(global.avi_file, 0, sound + 0, numsamples, 1);
2595      if (avierr == AVIERR_NONE)
2596         avierr = avi_append_sound_samples(global.avi_file, 1, sound + 1, numsamples, 1);
2597      if (avierr != AVIERR_NONE)
2598         video_avi_end_recording(machine);
2599
2600      profiler_mark(PROFILER_END);
2601   }
2602}
2603
2604
2605
2606/***************************************************************************
2607    CONFIGURATION HELPERS
2608***************************************************************************/
2609
2610/*-------------------------------------------------
2611    video_get_view_for_target - select a view
2612    for a given target
2613-------------------------------------------------*/
2614
2615int video_get_view_for_target(running_machine *machine, render_target *target, const char *viewname, int targetindex, int numtargets)
2616{
2617   int viewindex = -1;
2618
2619   /* auto view just selects the nth view */
2620   if (strcmp(viewname, "auto") != 0)
25132621   {
2514      screen_state *state = get_safe_token(screen);
2515
2516      /* only record if we have a file */
2517      if (state->avi_file != NULL)
2622      /* scan for a matching view name */
2623      for (viewindex = 0; ; viewindex++)
25182624      {
2519         avi_error avierr;
2625         const char *name = render_target_get_view_name(target, viewindex);
25202626
2521         profiler_mark(PROFILER_MOVIE_REC);
2627         /* stop scanning when we hit NULL */
2628         if (name == NULL)
2629         {
2630            viewindex = -1;
2631            break;
2632         }
2633         if (mame_strnicmp(name, viewname, strlen(viewname)) == 0)
2634            break;
2635      }
2636   }
25222637
2523         /* write the next frame */
2524         avierr = avi_append_sound_samples(state->avi_file, 0, sound + 0, numsamples, 1);
2525         if (avierr == AVIERR_NONE)
2526            avierr = avi_append_sound_samples(state->avi_file, 1, sound + 1, numsamples, 1);
2527         if (avierr != AVIERR_NONE)
2528            video_avi_end_recording(screen);
2638   /* if we don't have a match, default to the nth view */
2639   if (viewindex == -1)
2640   {
2641      int scrcount = video_screen_count(machine->config);
25292642
2530         profiler_mark(PROFILER_END);
2643      /* if we have enough targets to be one per screen, assign in order */
2644      if (numtargets >= scrcount)
2645      {
2646         /* find the first view with this screen and this screen only */
2647         for (viewindex = 0; ; viewindex++)
2648         {
2649            UINT32 viewscreens = render_target_get_view_screens(target, viewindex);
2650            if (viewscreens == (1 << targetindex))
2651               break;
2652            if (viewscreens == 0)
2653            {
2654               viewindex = -1;
2655               break;
2656            }
2657         }
25312658      }
2659
2660      /* otherwise, find the first view that has all the screens */
2661      if (viewindex == -1)
2662      {
2663         for (viewindex = 0; ; viewindex++)
2664         {
2665            UINT32 viewscreens = render_target_get_view_screens(target, viewindex);
2666            if (viewscreens == (1 << scrcount) - 1)
2667               break;
2668            if (viewscreens == 0)
2669               break;
2670         }
2671      }
25322672   }
2673
2674   /* make sure it's a valid view */
2675   if (render_target_get_view_name(target, viewindex) == NULL)
2676      viewindex = 0;
2677
2678   return viewindex;
25332679}
25342680
25352681
r2864r2865
25462692#define DSTSHIFT_R         16
25472693#define DSTSHIFT_G         8
25482694#define DSTSHIFT_B         0
2695#define BILINEAR_FILTER      1
25492696
25502697#include "rendersw.c"
src/emu/video.h
r2864r2865
1717#include "mamecore.h"
1818#include "devintrf.h"
1919#include "timer.h"
20#include "render.h"
2021
2122
2223/***************************************************************************
r2864r2865
255256/* ----- snapshots ----- */
256257
257258/* save a snapshot of a given screen */
258void video_screen_save_snapshot(const device_config *screen, mame_file *fp);
259void video_screen_save_snapshot(running_machine *machine, const device_config *screen, mame_file *fp);
259260
260261/* save a snapshot of all the active screens */
261262void video_save_active_screen_snapshots(running_machine *machine);
r2864r2865
263264
264265/* ----- movie recording ----- */
265266
266int video_mng_is_movie_active(const device_config *screen);
267void video_mng_begin_recording(const device_config *screen, const char *name);
268void video_mng_end_recording(const device_config *screen);
267int video_mng_is_movie_active(running_machine *machine);
268void video_mng_begin_recording(running_machine *machine, const char *name);
269void video_mng_end_recording(running_machine *machine);
269270
270void video_avi_begin_recording(const device_config *screen, const char *name);
271void video_avi_end_recording(const device_config *screen);
271void video_avi_begin_recording(running_machine *machine, const char *name);
272void video_avi_end_recording(running_machine *machine);
272273void video_avi_add_sound(running_machine *machine, const INT16 *sound, int numsamples);
273274
275
276/* ----- configuration helpers ----- */
277
278/* select a view for a given target */
279int video_get_view_for_target(running_machine *machine, render_target *target, const char *viewname, int targetindex, int numtargets);
280
274281#endif   /* __VIDEO_H__ */
src/emu/inptport.c
r2864r2865
12751275input_port_value input_port_read(running_machine *machine, const char *tag)
12761276{
12771277   const input_port_config *port = input_port_by_tag(machine->portconfig, tag);
1278   assert_always(mame_get_phase(machine) != MAME_PHASE_INIT, "Input ports cannot be read at init time!");
12781279   if (port == NULL)
12791280      fatalerror("Unable to locate input port '%s'", tag);
12801281   return input_port_read_direct(port);
r2864r2865
12901291input_port_value input_port_read_safe(running_machine *machine, const char *tag, UINT32 defvalue)
12911292{
12921293   const input_port_config *port = input_port_by_tag(machine->portconfig, tag);
1294   assert_always(mame_get_phase(machine) != MAME_PHASE_INIT, "Input ports cannot be read at init time!");
12931295   return (port == NULL) ? defvalue : input_port_read_direct(port);
12941296}
12951297
r2864r2865
13021304input_port_value input_port_read_indexed(running_machine *machine, int portnum)
13031305{
13041306   const input_port_config *port = input_port_by_index(machine->portconfig, portnum);
1307   assert_always(mame_get_phase(machine) != MAME_PHASE_INIT, "Input ports cannot be read at init time!");
13051308   return (port == NULL) ? 0 : input_port_read_direct(port);
13061309}
13071310
src/emu/rendersw.c
r2864r2865
171171    16bpp source
172172-------------------------------------------------*/
173173
174INLINE UINT32 get_texel_palette16_nearest(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv, const rgb_t *palbase)
174INLINE UINT32 get_texel_palette16_nearest(const render_texinfo *texture, INT32 curu, INT32 curv)
175175{
176   return palbase[texbase[(curv >> 16) * texrp + (curu >> 16)]];
176   const UINT16 *texbase = (const UINT16 *)texture->base + (curv >> 16) * texture->rowpixels + (curu >> 16);
177   return texture->palette[texbase[0]];
177178}
178179
179180
r2864r2865
183184    16bpp source
184185-------------------------------------------------*/
185186
186INLINE UINT32 get_texel_palette16_bilinear(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv, const rgb_t *palbase)
187INLINE UINT32 get_texel_palette16_bilinear(const render_texinfo *texture, INT32 curu, INT32 curv)
187188{
189   const UINT16 *texbase = (const UINT16 *)texture->base + (curv >> 16) * texture->rowpixels + (curu >> 16);
190   INT32 u1 = (((curu >> 16) + 1) < texture->width) ? 1 : 0;
191   INT32 v1 = (((curv >> 16) + 1) < texture->height) ? texture->rowpixels : 0;
188192   rgb_t pix00, pix01, pix10, pix11;
189   texbase += (curv >> 16) * texrp + (curu >> 16);
190   pix00 = palbase[texbase[0]];
191   pix01 = palbase[texbase[1]];
192   pix10 = palbase[texbase[texrp + 0]];
193   pix11 = palbase[texbase[texrp + 1]];
193
194   pix00 = texture->palette[texbase[0]];
195   pix01 = texture->palette[texbase[u1]];
196   pix10 = texture->palette[texbase[v1]];
197   pix11 = texture->palette[texbase[u1 + v1]];
194198   return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8);
195199}
196200
r2864r2865
200204    nearest neighbor texel from a 15bpp RGB source
201205-------------------------------------------------*/
202206
203INLINE UINT32 get_texel_rgb15_nearest(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv)
207INLINE UINT32 get_texel_rgb15_nearest(const render_texinfo *texture, INT32 curu, INT32 curv)
204208{
205   return texbase[(curv >> 16) * texrp + (curu >> 16)];
209   const UINT16 *texbase = (const UINT16 *)texture->base + (curv >> 16) * texture->rowpixels + (curu >> 16);
210   return texbase[0];
206211}
207212
208213
r2864r2865
212217    source
213218-------------------------------------------------*/
214219
215INLINE UINT32 get_texel_rgb15_bilinear(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv)
220INLINE UINT32 get_texel_rgb15_bilinear(const render_texinfo *texture, INT32 curu, INT32 curv)
216221{
222   const UINT16 *texbase = (const UINT16 *)texture->base + (curv >> 16) * texture->rowpixels + (curu >> 16);
223   INT32 u1 = (((curu >> 16) + 1) < texture->width) ? 1 : 0;
224   INT32 v1 = (((curv >> 16) + 1) < texture->height) ? texture->rowpixels : 0;
217225   rgb_t pix00, pix01, pix10, pix11, filtered;
218   texbase += (curv >> 16) * texrp + (curu >> 16);
226
219227   pix00 = texbase[0];
220   pix01 = texbase[1];
221   pix10 = texbase[texrp + 0];
222   pix11 = texbase[texrp + 1];
228   pix01 = texbase[u1];
229   pix10 = texbase[v1];
230   pix11 = texbase[u1 + v1];
223231   pix00 = ((pix00 & 0x7fe0) << 6) | (pix00 & 0x1f);
224232   pix01 = ((pix01 & 0x7fe0) << 6) | (pix01 & 0x1f);
225233   pix10 = ((pix10 & 0x7fe0) << 6) | (pix10 & 0x1f);
r2864r2865
235243    source (pixel is returned as Cr-Cb-Y
236244-------------------------------------------------*/
237245
238INLINE UINT32 get_texel_yuy16_nearest(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv)
246INLINE UINT32 get_texel_yuy16_nearest(const render_texinfo *texture, INT32 curu, INT32 curv)
239247{
240   const UINT16 *spix = &texbase[(curv >> 16) * texrp + (curu >> 17) * 2];
241   return (spix[(curu >> 16) & 1] >> 8) | ((spix[0] & 0xff) << 8) | ((spix[1] & 0xff) << 16);
248   const UINT16 *texbase = (const UINT16 *)texture->base + (curv >> 16) * texture->rowpixels + (curu >> 17) * 2;
249   return (texbase[(curu >> 16) & 1] >> 8) | ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16);
242250}
243251
244252
r2864r2865
248256    source (pixel is returned as Cr-Cb-Y
249257-------------------------------------------------*/
250258
251INLINE UINT32 get_texel_yuy16_bilinear(const UINT16 *texbase, INT32 texrp, INT32 curu, INT32 curv)
259INLINE UINT32 get_texel_yuy16_bilinear(const render_texinfo *texture, INT32 curu, INT32 curv)
252260{
261   const UINT16 *texbase = (const UINT16 *)texture->base + (curv >> 16) * texture->rowpixels + (curu >> 17) * 2;
262   INT32 u1 = (((curu >> 16) + 1) < texture->width) ? 1 : 0;
263   INT32 v1 = (((curv >> 16) + 1) < texture->height) ? texture->rowpixels : 0;
253264   rgb_t pix00, pix01, pix10, pix11;
254   texbase += (curv >> 16) * texrp + (curu >> 17) * 2;
265
255266   if ((curu & 0x10000) == 0)
256267   {
257268      rgb_t cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16);
258269      pix00 = (texbase[0] >> 8) | cbcr;
259      pix01 = (texbase[1] >> 8) | cbcr;
260      cbcr = ((texbase[texrp + 0] & 0xff) << 8) | ((texbase[texrp + 1] & 0xff) << 16);
261      pix10 = (texbase[texrp + 0] >> 8) | cbcr;
262      pix11 = (texbase[texrp + 1] >> 8) | cbcr;
270      pix01 = u1 ? ((texbase[1] >> 8) | cbcr) : pix00;
271      cbcr = ((texbase[v1 + 0] & 0xff) << 8) | ((texbase[v1 + 1] & 0xff) << 16);
272      pix10 = (texbase[v1 + 0] >> 8) | cbcr;
273      pix11 = u1 ? ((texbase[v1 + 1] >> 8) | cbcr) : pix10;
263274   }
264275   else
265276   {
266277      rgb_t cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16);
267278      pix00 = (texbase[1] >> 8) | cbcr;
268      cbcr = ((texbase[2] & 0xff) << 8) | ((texbase[3] & 0xff) << 16);
269      pix01 = (texbase[2] >> 8) | cbcr;
270      cbcr = ((texbase[texrp + 0] & 0xff) << 8) | ((texbase[texrp + 1] & 0xff) << 16);
271      pix10 = (texbase[texrp + 1] >> 8) | cbcr;
272      cbcr = ((texbase[texrp + 2] & 0xff) << 8) | ((texbase[texrp + 3] & 0xff) << 16);
273      pix11 = (texbase[texrp + 2] >> 8) | cbcr;
279      if (u1)
280      {
281         cbcr = ((texbase[2] & 0xff) << 8) | ((texbase[3] & 0xff) << 16);
282         pix01 = (texbase[2] >> 8) | cbcr;
283      }
284      else
285         pix01 = pix00;
286      cbcr = ((texbase[v1 + 0] & 0xff) << 8) | ((texbase[v1 + 1] & 0xff) << 16);
287      pix10 = (texbase[v1 + 1] >> 8) | cbcr;
288      if (u1)
289      {
290         cbcr = ((texbase[v1 + 2] & 0xff) << 8) | ((texbase[v1 + 3] & 0xff) << 16);
291         pix11 = (texbase[v1 + 2] >> 8) | cbcr;
292      }
293      else
294         pix11 = pix10;
274295   }
275296   return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8);
276297}
r2864r2865
281302    nearest neighbor texel from a 32bpp RGB source
282303-------------------------------------------------*/
283304
284INLINE UINT32 get_texel_rgb32_nearest(const UINT32 *texbase, INT32 texrp, INT32 curu, INT32 curv)
305INLINE UINT32 get_texel_rgb32_nearest(const render_texinfo *texture, INT32 curu, INT32 curv)
285306{
286   return texbase[(curv >> 16) * texrp + (curu >> 16)];
307   const UINT32 *texbase = (const UINT32 *)texture->base + (curv >> 16) * texture->rowpixels + (curu >> 16);
308   return texbase[0];
287309}
288310
289311
r2864r2865
293315    source
294316-------------------------------------------------*/
295317
296INLINE UINT32 get_texel_rgb32_bilinear(const UINT32 *texbase, INT32 texrp, INT32 curu, INT32 curv)
318INLINE UINT32 get_texel_rgb32_bilinear(const render_texinfo *texture, INT32 curu, INT32 curv)
297319{
320   const UINT32 *texbase = (const UINT32 *)texture->base + (curv >> 16) * texture->rowpixels + (curu >> 16);
321   INT32 u1 = (((curu >> 16) + 1) < texture->width) ? 1 : 0;
322   INT32 v1 = (((curv >> 16) + 1) < texture->height) ? texture->rowpixels : 0;
298323   rgb_t pix00, pix01, pix10, pix11;
299   texbase += (curv >> 16) * texrp + (curu >> 16);
324
300325   pix00 = texbase[0];
301   pix01 = texbase[1];
302   pix10 = texbase[texrp + 0];
303   pix11 = texbase[texrp + 1];
326   pix01 = texbase[u1];
327   pix10 = texbase[v1];
328   pix11 = texbase[u1 + v1];
304329   return rgb_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8);
305330}
306331
r2864r2865
311336    source
312337-------------------------------------------------*/
313338
314INLINE UINT32 get_texel_argb32_nearest(const UINT32 *texbase, INT32 texrp, INT32 curu, INT32 curv)
339INLINE UINT32 get_texel_argb32_nearest(const render_texinfo *texture, INT32 curu, INT32 curv)
315340{
316   return texbase[(curv >> 16) * texrp + (curu >> 16)];
341   const UINT32 *texbase = (const UINT32 *)texture->base + (curv >> 16) * texture->rowpixels + (curu >> 16);
342   return texbase[0];
317343}
318344
319345
r2864r2865
323349    source
324350-------------------------------------------------*/
325351
326INLINE UINT32 get_texel_argb32_bilinear(const UINT32 *texbase, INT32 texrp, INT32 curu, INT32 curv)
352INLINE UINT32 get_texel_argb32_bilinear(const render_texinfo *texture, INT32 curu, INT32 curv)
327353{
354   const UINT32 *texbase = (const UINT32 *)texture->base + (curv >> 16) * texture->rowpixels + (curu >> 16);
355   INT32 u1 = (((curu >> 16) + 1) < texture->width) ? 1 : 0;
356   INT32 v1 = (((curv >> 16) + 1) < texture->height) ? texture->rowpixels : 0;
328357   rgb_t pix00, pix01, pix10, pix11;
329   texbase += (curv >> 16) * texrp + (curu >> 16);
358
330359   pix00 = texbase[0];
331   pix01 = texbase[1];
332   pix10 = texbase[texrp + 0];
333   pix11 = texbase[texrp + 1];
360   pix01 = texbase[u1];
361   pix10 = texbase[v1];
362   pix11 = texbase[u1 + v1];
334363   return rgba_bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8);
335364}
336365
r2864r2865
701730
702731static void FUNC_PREFIX(draw_quad_palette16_none)(const render_primitive *prim, void *dstdata, UINT32 pitch, quad_setup_data *setup)
703732{
704   UINT16 *texbase = prim->texture.base;
705   const rgb_t *palbase = prim->texture.palette;
706   UINT32 texrp = prim->texture.rowpixels;
707733   INT32 dudx = setup->dudx;
708734   INT32 dvdx = setup->dvdx;
709735   INT32 endx = setup->endx;
710736   INT32 x, y;
711737
712738   /* ensure all parameters are valid */
713   assert(palbase != NULL);
739   assert(prim->texture.palette != NULL);
714740
715741   /* fast case: no coloring, no alpha */
716742   if (prim->color.r >= 1.0f && prim->color.g >= 1.0f && prim->color.b >= 1.0f && IS_OPAQUE(prim->color.a))
r2864r2865
725751         /* loop over cols */
726752         for (x = setup->startx; x < endx; x++)
727753         {
728            UINT32 pix = GET_TEXEL(palette16)(texbase, texrp, curu, curv, palbase);
754            UINT32 pix = GET_TEXEL(palette16)(&prim->texture, curu, curv);
729755            *dest++ = SOURCE32_TO_DEST(pix);
730756            curu += dudx;
731757            curv += dvdx;
r2864r2865
755781         /* loop over cols */
756782         for (x = setup->startx; x < endx; x++)
757783         {
758            UINT32 pix = GET_TEXEL(palette16)(texbase, texrp, curu, curv, palbase);
784            UINT32 pix = GET_TEXEL(palette16)(&prim->texture, curu, curv);
759785            UINT32 r = (SOURCE32_R(pix) * sr) >> 8;
760786            UINT32 g = (SOURCE32_G(pix) * sg) >> 8;
761787            UINT32 b = (SOURCE32_B(pix) * sb) >> 8;
r2864r2865
791817         /* loop over cols */
792818         for (x = setup->startx; x < endx; x++)
793819         {
794            UINT32 pix = GET_TEXEL(palette16)(texbase, texrp, curu, curv, palbase);
820            UINT32 pix = GET_TEXEL(palette16)(&prim->texture, curu, curv);
795821            UINT32 dpix = NO_DEST_READ ? 0 : *dest;
796822            UINT32 r = (SOURCE32_R(pix) * sr + DEST_R(dpix) * invsa) >> 8;
797823            UINT32 g = (SOURCE32_G(pix) * sg + DEST_G(dpix) * invsa) >> 8;
r2864r2865
813839
814840static void FUNC_PREFIX(draw_quad_palette16_add)(const render_primitive *prim, void *dstdata, UINT32 pitch, quad_setup_data *setup)
815841{
816   UINT16 *texbase = prim->texture.base;
817   const rgb_t *palbase = prim->texture.palette;
818   UINT32 texrp = prim->texture.rowpixels;
819842   INT32 dudx = setup->dudx;
820843   INT32 dvdx = setup->dvdx;
821844   INT32 endx = setup->endx;
822845   INT32 x, y;
823846
824847   /* ensure all parameters are valid */
825   assert(palbase != NULL);
848   assert(prim->texture.palette != NULL);
826849
827850   /* fast case: no coloring, no alpha */
828851   if (prim->color.r >= 1.0f && prim->color.g >= 1.0f && prim->color.b >= 1.0f && IS_OPAQUE(prim->color.a))
r2864r2865
837860         /* loop over cols */
838861         for (x = setup->startx; x < endx; x++)
839862         {
840            UINT32 pix = GET_TEXEL(palette16)(texbase, texrp, curu, curv, palbase);
863            UINT32 pix = GET_TEXEL(palette16)(&prim->texture, curu, curv);
841864            if ((pix & 0xffffff) != 0)
842865            {
843866               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
r2864r2865
878901         /* loop over cols */
879902         for (x = setup->startx; x < endx; x++)
880903         {
881            UINT32 pix = GET_TEXEL(palette16)(texbase, texrp, curu, curv, palbase);
904            UINT32 pix = GET_TEXEL(palette16)(&prim->texture, curu, curv);
882905            if ((pix & 0xffffff) != 0)
883906            {
884907               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
r2864r2865
910933
911934static void FUNC_PREFIX(draw_quad_palettea16_alpha)(const render_primitive *prim, void *dstdata, UINT32 pitch, quad_setup_data *setup)
912935{
913   UINT16 *texbase = prim->texture.base;
914   const rgb_t *palbase = prim->texture.palette;
915   UINT32 texrp = prim->texture.rowpixels;
916936   INT32 dudx = setup->dudx;
917937   INT32 dvdx = setup->dvdx;
918938   INT32 endx = setup->endx;
919939   INT32 x, y;
920940
921941   /* ensure all parameters are valid */
922   assert(palbase != NULL);
942   assert(prim->texture.palette != NULL);
923943
924944   /* fast case: no coloring, no alpha */
925945   if (prim->color.r >= 1.0f && prim->color.g >= 1.0f && prim->color.b >= 1.0f && IS_OPAQUE(prim->color.a))
r2864r2865
934954         /* loop over cols */
935955         for (x = setup->startx; x < endx; x++)
936956         {
937            UINT32 pix = GET_TEXEL(palette16)(texbase, texrp, curu, curv, palbase);
957            UINT32 pix = GET_TEXEL(palette16)(&prim->texture, curu, curv);
938958            UINT32 ta = pix >> 24;
939959            if (ta != 0)
940960            {
r2864r2865
977997         /* loop over cols */
978998         for (x = setup->startx; x < endx; x++)
979999         {
980            UINT32 pix = GET_TEXEL(palette16)(texbase, texrp, curu, curv, palbase);
1000            UINT32 pix = GET_TEXEL(palette16)(&prim->texture, curu, curv);
9811001            UINT32 ta = (pix >> 24) * sa;
9821002            if (ta != 0)
9831003            {
r2864r2865
10101030
10111031static void FUNC_PREFIX(draw_quad_yuy16_none)(const render_primitive *prim, void *dstdata, UINT32 pitch, quad_setup_data *setup)
10121032{
1013   UINT16 *texbase = prim->texture.base;
10141033   const rgb_t *palbase = prim->texture.palette;
1015   UINT32 texrp = prim->texture.rowpixels;
10161034   INT32 dudx = setup->dudx;
10171035   INT32 dvdx = setup->dvdx;
10181036   INT32 endx = setup->endx;
r2864r2865
10341052            /* loop over cols */
10351053            for (x = setup->startx; x < endx; x++)
10361054            {
1037               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv));
1055               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(&prim->texture, curu, curv));
10381056               *dest++ = SOURCE32_TO_DEST(pix);
10391057               curu += dudx;
10401058               curv += dvdx;
r2864r2865
10471065            /* loop over cols */
10481066            for (x = setup->startx; x < endx; x++)
10491067            {
1050               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv));
1068               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(&prim->texture, curu, curv));
10511069               *dest++ = SOURCE32_TO_DEST(pix);
10521070               curu += dudx;
10531071               curv += dvdx;
r2864r2865
10811099            /* loop over cols */
10821100            for (x = setup->startx; x < endx; x++)
10831101            {
1084               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv));
1102               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(&prim->texture, curu, curv));
10851103               UINT32 r = (SOURCE32_R(pix) * sr) >> 8;
10861104               UINT32 g = (SOURCE32_G(pix) * sg) >> 8;
10871105               UINT32 b = (SOURCE32_B(pix) * sb) >> 8;
r2864r2865
10981116            /* loop over cols */
10991117            for (x = setup->startx; x < endx; x++)
11001118            {
1101               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv));
1119               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(&prim->texture, curu, curv));
11021120               UINT32 r = (SOURCE32_R(pix) * sr) >> 8;
11031121               UINT32 g = (SOURCE32_G(pix) * sg) >> 8;
11041122               UINT32 b = (SOURCE32_B(pix) * sb) >> 8;
r2864r2865
11381156            /* loop over cols */
11391157            for (x = setup->startx; x < endx; x++)
11401158            {
1141               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv));
1159               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(&prim->texture, curu, curv));
11421160               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
11431161               UINT32 r = (SOURCE32_R(pix) * sr + DEST_R(dpix) * invsa) >> 8;
11441162               UINT32 g = (SOURCE32_G(pix) * sg + DEST_G(dpix) * invsa) >> 8;
r2864r2865
11561174            /* loop over cols */
11571175            for (x = setup->startx; x < endx; x++)
11581176            {
1159               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(texbase, texrp, curu, curv));
1177               UINT32 pix = ycc_to_rgb(GET_TEXEL(yuy16)(&prim->texture, curu, curv));
11601178               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
11611179               UINT32 r = (SOURCE32_R(pix) * sr + DEST_R(dpix) * invsa) >> 8;
11621180               UINT32 g = (SOURCE32_G(pix) * sg + DEST_G(dpix) * invsa) >> 8;
r2864r2865
11831201
11841202static void FUNC_PREFIX(draw_quad_rgb15)(const render_primitive *prim, void *dstdata, UINT32 pitch, quad_setup_data *setup)
11851203{
1186   UINT16 *texbase = prim->texture.base;
11871204   const rgb_t *palbase = prim->texture.palette;
1188   UINT32 texrp = prim->texture.rowpixels;
11891205   INT32 dudx = setup->dudx;
11901206   INT32 dvdx = setup->dvdx;
11911207   INT32 endx = setup->endx;
r2864r2865
12071223            /* loop over cols */
12081224            for (x = setup->startx; x < endx; x++)
12091225            {
1210               UINT32 pix = GET_TEXEL(rgb15)(texbase, texrp, curu, curv);
1226               UINT32 pix = GET_TEXEL(rgb15)(&prim->texture, curu, curv);
12111227               *dest++ = SOURCE15_TO_DEST(pix);
12121228               curu += dudx;
12131229               curv += dvdx;
r2864r2865
12201236            /* loop over cols */
12211237            for (x = setup->startx; x < endx; x++)
12221238            {
1223               UINT32 pix = GET_TEXEL(rgb15)(texbase, texrp, curu, curv);
1239               UINT32 pix = GET_TEXEL(rgb15)(&prim->texture, curu, curv);
12241240               UINT32 r = palbase[(pix >> 10) & 0x1f] >> SRCSHIFT_R;
12251241               UINT32 g = palbase[(pix >> 5) & 0x1f] >> SRCSHIFT_G;
12261242               UINT32 b = palbase[(pix >> 0) & 0x1f] >> SRCSHIFT_B;
r2864r2865
12581274            /* loop over cols */
12591275            for (x = setup->startx; x < endx; x++)
12601276            {
1261               UINT32 pix = GET_TEXEL(rgb15)(texbase, texrp, curu, curv);
1277               UINT32 pix = GET_TEXEL(rgb15)(&prim->texture, curu, curv);
12621278               UINT32 r = (SOURCE15_R(pix) * sr) >> 8;
12631279               UINT32 g = (SOURCE15_G(pix) * sg) >> 8;
12641280               UINT32 b = (SOURCE15_B(pix) * sb) >> 8;
r2864r2865
12751291            /* loop over cols */
12761292            for (x = setup->startx; x < endx; x++)
12771293            {
1278               UINT32 pix = GET_TEXEL(rgb15)(texbase, texrp, curu, curv);
1294               UINT32 pix = GET_TEXEL(rgb15)(&prim->texture, curu, curv);
12791295               UINT32 r = (palbase[(pix >> 10) & 0x1f] * sr) >> (8 + SRCSHIFT_R);
12801296               UINT32 g = (palbase[(pix >> 5) & 0x1f] * sg) >> (8 + SRCSHIFT_G);
12811297               UINT32 b = (palbase[(pix >> 0) & 0x1f] * sb) >> (8 + SRCSHIFT_B);
r2864r2865
13151331            /* loop over cols */
13161332            for (x = setup->startx; x < endx; x++)
13171333            {
1318               UINT32 pix = GET_TEXEL(rgb15)(texbase, texrp, curu, curv);
1334               UINT32 pix = GET_TEXEL(rgb15)(&prim->texture, curu, curv);
13191335               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
13201336               UINT32 r = (SOURCE15_R(pix) * sr + DEST_R(dpix) * invsa) >> 8;
13211337               UINT32 g = (SOURCE15_G(pix) * sg + DEST_G(dpix) * invsa) >> 8;
r2864r2865
13331349            /* loop over cols */
13341350            for (x = setup->startx; x < endx; x++)
13351351            {
1336               UINT32 pix = GET_TEXEL(rgb15)(texbase, texrp, curu, curv);
1352               UINT32 pix = GET_TEXEL(rgb15)(&prim->texture, curu, curv);
13371353               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
13381354               UINT32 r = ((palbase[(pix >> 10) & 0x1f] >> SRCSHIFT_R) * sr + DEST_R(dpix) * invsa) >> 8;
13391355               UINT32 g = ((palbase[(pix >> 5) & 0x1f] >> SRCSHIFT_G) * sg + DEST_G(dpix) * invsa) >> 8;
r2864r2865
13611377
13621378static void FUNC_PREFIX(draw_quad_rgb32)(const render_primitive *prim, void *dstdata, UINT32 pitch, quad_setup_data *setup)
13631379{
1364   UINT32 *texbase = prim->texture.base;
13651380   const rgb_t *palbase = prim->texture.palette;
1366   UINT32 texrp = prim->texture.rowpixels;
13671381   INT32 dudx = setup->dudx;
13681382   INT32 dvdx = setup->dvdx;
13691383   INT32 endx = setup->endx;
r2864r2865
13851399            /* loop over cols */
13861400            for (x = setup->startx; x < endx; x++)
13871401            {
1388               UINT32 pix = GET_TEXEL(rgb32)(texbase, texrp, curu, curv);
1402               UINT32 pix = GET_TEXEL(rgb32)(&prim->texture, curu, curv);
13891403               *dest++ = SOURCE32_TO_DEST(pix);
13901404               curu += dudx;
13911405               curv += dvdx;
r2864r2865
13981412            /* loop over cols */
13991413            for (x = setup->startx; x < endx; x++)
14001414            {
1401               UINT32 pix = GET_TEXEL(rgb32)(texbase, texrp, curu, curv);
1415               UINT32 pix = GET_TEXEL(rgb32)(&prim->texture, curu, curv);
14021416               UINT32 r = palbase[(pix >> 16) & 0xff] >> SRCSHIFT_R;
14031417               UINT32 g = palbase[(pix >> 8) & 0xff] >> SRCSHIFT_G;
14041418               UINT32 b = palbase[(pix >> 0) & 0xff] >> SRCSHIFT_B;
r2864r2865
14361450            /* loop over cols */
14371451            for (x = setup->startx; x < endx; x++)
14381452            {
1439               UINT32 pix = GET_TEXEL(rgb32)(texbase, texrp, curu, curv);
1453               UINT32 pix = GET_TEXEL(rgb32)(&prim->texture, curu, curv);
14401454               UINT32 r = (SOURCE32_R(pix) * sr) >> 8;
14411455               UINT32 g = (SOURCE32_G(pix) * sg) >> 8;
14421456               UINT32 b = (SOURCE32_B(pix) * sb) >> 8;
r2864r2865
14531467            /* loop over cols */
14541468            for (x = setup->startx; x < endx; x++)
14551469            {
1456               UINT32 pix = GET_TEXEL(rgb32)(texbase, texrp, curu, curv);
1470               UINT32 pix = GET_TEXEL(rgb32)(&prim->texture, curu, curv);
14571471               UINT32 r = (palbase[(pix >> 16) & 0xff] * sr) >> (8 + SRCSHIFT_R);
14581472               UINT32 g = (palbase[(pix >> 8) & 0xff] * sg) >> (8 + SRCSHIFT_G);
14591473               UINT32 b = (palbase[(pix >> 0) & 0xff] * sb) >> (8 + SRCSHIFT_B);
r2864r2865
14931507            /* loop over cols */
14941508            for (x = setup->startx; x < endx; x++)
14951509            {
1496               UINT32 pix = GET_TEXEL(rgb32)(texbase, texrp, curu, curv);
1510               UINT32 pix = GET_TEXEL(rgb32)(&prim->texture, curu, curv);
14971511               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
14981512               UINT32 r = (SOURCE32_R(pix) * sr + DEST_R(dpix) * invsa) >> 8;
14991513               UINT32 g = (SOURCE32_G(pix) * sg + DEST_G(dpix) * invsa) >> 8;
r2864r2865
15111525            /* loop over cols */
15121526            for (x = setup->startx; x < endx; x++)
15131527            {
1514               UINT32 pix = GET_TEXEL(rgb32)(texbase, texrp, curu, curv);
1528               UINT32 pix = GET_TEXEL(rgb32)(&prim->texture, curu, curv);
15151529               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
15161530               UINT32 r = ((palbase[(pix >> 16) & 0xff] >> SRCSHIFT_R) * sr + DEST_R(dpix) * invsa) >> 8;
15171531               UINT32 g = ((palbase[(pix >> 8) & 0xff] >> SRCSHIFT_G) * sg + DEST_G(dpix) * invsa) >> 8;
r2864r2865
15391553
15401554static void FUNC_PREFIX(draw_quad_argb32_alpha)(const render_primitive *prim, void *dstdata, UINT32 pitch, quad_setup_data *setup)
15411555{
1542   UINT32 *texbase = prim->texture.base;
15431556   const rgb_t *palbase = prim->texture.palette;
1544   UINT32 texrp = prim->texture.rowpixels;
15451557   INT32 dudx = setup->dudx;
15461558   INT32 dvdx = setup->dvdx;
15471559   INT32 endx = setup->endx;
r2864r2865
15631575            /* loop over cols */
15641576            for (x = setup->startx; x < endx; x++)
15651577            {
1566               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1578               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
15671579               UINT32 ta = pix >> 24;
15681580               if (ta != 0)
15691581               {
r2864r2865
15871599            /* loop over cols */
15881600            for (x = setup->startx; x < endx; x++)
15891601            {
1590               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1602               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
15911603               UINT32 ta = pix >> 24;
15921604               if (ta != 0)
15931605               {
r2864r2865
16341646            /* loop over cols */
16351647            for (x = setup->startx; x < endx; x++)
16361648            {
1637               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1649               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
16381650               UINT32 ta = (pix >> 24) * sa;
16391651               if (ta != 0)
16401652               {
r2864r2865
16591671            /* loop over cols */
16601672            for (x = setup->startx; x < endx; x++)
16611673            {
1662               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1674               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
16631675               UINT32 ta = (pix >> 24) * sa;
16641676               if (ta != 0)
16651677               {
r2864r2865
16881700
16891701static void FUNC_PREFIX(draw_quad_argb32_multiply)(const render_primitive *prim, void *dstdata, UINT32 pitch, quad_setup_data *setup)
16901702{
1691   UINT32 *texbase = prim->texture.base;
16921703   const rgb_t *palbase = prim->texture.palette;
1693   UINT32 texrp = prim->texture.rowpixels;
16941704   INT32 dudx = setup->dudx;
16951705   INT32 dvdx = setup->dvdx;
16961706   INT32 endx = setup->endx;
r2864r2865
17161726            /* loop over cols */
17171727            for (x = setup->startx; x < endx; x++)
17181728            {
1719               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1729               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
17201730               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
17211731               UINT32 r = (SOURCE32_R(pix) * DEST_R(dpix)) >> (8 - SRCSHIFT_R);
17221732               UINT32 g = (SOURCE32_G(pix) * DEST_G(dpix)) >> (8 - SRCSHIFT_G);
r2864r2865
17321742            /* loop over cols */
17331743            for (x = setup->startx; x < endx; x++)
17341744            {
1735               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1745               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
17361746               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
17371747               UINT32 r = (palbase[(pix >> 16) & 0xff] * DEST_R(dpix)) >> 8;
17381748               UINT32 g = (palbase[(pix >> 8) & 0xff] * DEST_G(dpix)) >> 8;
r2864r2865
17711781            /* loop over cols */
17721782            for (x = setup->startx; x < endx; x++)
17731783            {
1774               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1784               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
17751785               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
17761786               UINT32 r = (SOURCE32_R(pix) * sr * DEST_R(dpix)) >> (16 - SRCSHIFT_R);
17771787               UINT32 g = (SOURCE32_G(pix) * sg * DEST_G(dpix)) >> (16 - SRCSHIFT_G);
r2864r2865
17871797            /* loop over cols */
17881798            for (x = setup->startx; x < endx; x++)
17891799            {
1790               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1800               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
17911801               UINT32 dpix = NO_DEST_READ ? 0 : *dest;
17921802               UINT32 r = (palbase[(pix >> 16) & 0xff] * sr * DEST_R(dpix)) >> 16;
17931803               UINT32 g = (palbase[(pix >> 8) & 0xff] * sg * DEST_G(dpix)) >> 16;
r2864r2865
18101820
18111821static void FUNC_PREFIX(draw_quad_argb32_add)(const render_primitive *prim, void *dstdata, UINT32 pitch, quad_setup_data *setup)
18121822{
1813   UINT32 *texbase = prim->texture.base;
18141823   const rgb_t *palbase = prim->texture.palette;
1815   UINT32 texrp = prim->texture.rowpixels;
18161824   INT32 dudx = setup->dudx;
18171825   INT32 dvdx = setup->dvdx;
18181826   INT32 endx = setup->endx;
r2864r2865
18381846            /* loop over cols */
18391847            for (x = setup->startx; x < endx; x++)
18401848            {
1841               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1849               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
18421850               UINT32 ta = pix >> 24;
18431851               if (ta != 0)
18441852               {
r2864r2865
18631871            /* loop over cols */
18641872            for (x = setup->startx; x < endx; x++)
18651873            {
1866               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1874               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
18671875               UINT32 ta = pix >> 24;
18681876               if (ta != 0)
18691877               {
r2864r2865
19111919            /* loop over cols */
19121920            for (x = setup->startx; x < endx; x++)
19131921            {
1914               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1922               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
19151923               UINT32 ta = (pix >> 24) * sa;
19161924               if (ta != 0)
19171925               {
r2864r2865
19361944            /* loop over cols */
19371945            for (x = setup->startx; x < endx; x++)
19381946            {
1939               UINT32 pix = GET_TEXEL(argb32)(texbase, texrp, curu, curv);
1947               UINT32 pix = GET_TEXEL(argb32)(&prim->texture, curu, curv);
19401948               UINT32 ta = (pix >> 24) * sa;
19411949               if (ta != 0)
19421950               {
src/emu/ui.c
r2864r2865
322322      show_disclaimer = FALSE;
323323#endif /* MESS */
324324
325   /* disable everything if we are using -str */
326   if (!first_time || (str > 0 && str < 60*5) || machine->gamedrv == &driver_empty)
325   /* disable everything if we are using -str for 300 or fewer seconds, or if we're the empty driver,
326       or if we are debugging */
327   if (!first_time || (str > 0 && str < 60*5) || machine->gamedrv == &driver_empty || machine->debug_mode)
327328      show_gameinfo = show_warnings = show_disclaimer = FALSE;
328329
329330   /* initialize the on-screen display system */
r2864r2865
13211322   /* toggle movie recording */
13221323   if (input_ui_pressed(machine, IPT_UI_RECORD_MOVIE))
13231324   {
1324      if (!video_mng_is_movie_active(machine->primary_screen))
1325      if (!video_mng_is_movie_active(machine))
13251326      {
1326         video_mng_begin_recording(machine->primary_screen, NULL);
1327         video_mng_begin_recording(machine, NULL);
13271328         popmessage("REC START");
13281329      }
13291330      else
13301331      {
1331         video_mng_end_recording(machine->primary_screen);
1332         video_mng_end_recording(machine);
13321333         popmessage("REC STOP");
13331334      }
13341335   }
src/emu/render.h
r2864r2865
1212#ifndef __RENDER_H__
1313#define __RENDER_H__
1414
15#include "driver.h"
1615#include "osdepend.h"
1716
1817#include <math.h>
src/mess/tools/messtest/testmess.c
r2864r2865
235235         /* did we find a live screen? */
236236         if (screen != NULL)
237237         {
238            video_screen_save_snapshot(screen, fp);
238            video_screen_save_snapshot(screen->machine, screen, fp);
239239            report_message(MSG_INFO, "Saved screenshot as %s", buf);
240240         }
241241         else
src/mess/osd/windows/tapedlg.c
r2864r2865
1717#include "window.h"
1818#include "winutf8.h"
1919#include "uimess.h"
20#include "device.h"
2021
2122
23
2224//============================================================
2325//   STRUCTURES
2426//============================================================
src/mess/machine/pc.c
r2864r2865
807807   pc_set_irq_line( 1, state );
808808}
809809
810void mess_init_pc_common(UINT32 flags, void (*set_keyb_int_func)(int), void (*set_hdc_int_func)(int,int)) {
811   init_pc_common(flags, set_keyb_int_func);
810void mess_init_pc_common(UINT32 flags, void (*set_keyb_int_func)(int), void (*set_hdc_int_func)(int,int))
811{
812   init_pc_common(Machine, flags, set_keyb_int_func);
812813
813814   /* MESS managed RAM */
814815   if ( mess_ram )
src/mess/drivers/pcw16.c
r2864r2865
13641364   pc_mouse_set_serial_port( device_list_find_by_tag( machine->config->devicelist, NS16550, "ns16550_0" ) );
13651365
13661366   /* initialise keyboard */
1367   at_keyboard_init(AT_KEYBOARD_TYPE_AT);
1367   at_keyboard_init(machine, AT_KEYBOARD_TYPE_AT);
13681368   at_keyboard_set_scan_code_set(3);
13691369
13701370   pcw16_reset(machine);
src/mess/drivers/n64.c
r2864r2865
7171
7272static INTERRUPT_GEN( n64_vblank )
7373{
74   signal_rcp_interrupt(VI_INTERRUPT);
74   signal_rcp_interrupt(machine, VI_INTERRUPT);
7575}
7676
7777static MACHINE_RESET( n64 )
7878{
79   n64_machine_reset();
79   n64_machine_reset(machine);
8080}
8181
8282static MACHINE_DRIVER_START( n64 )
src/mess/drivers/ip22.c
r2864r2865
14571457
14581458   // IP22 uses 2 pieces of PC-compatible hardware: the 8042 PS/2 keyboard/mouse
14591459   // interface and the 8254 PIT.  Both are licensed cores embedded in the IOC custom chip.
1460   init_pc_common(PCCOMMON_KEYBOARD_AT, NULL);
1460   init_pc_common(machine, PCCOMMON_KEYBOARD_AT, NULL);
14611461   kbdc8042_init(&at8042);
14621462
14631463   nIOC_ParReadCnt = 0;
src/mess/drivers/saturn.c
r2864r2865
12381238      /*DSP section*/
12391239      /*Use functions so it is easier to work out*/
12401240      case 32:
1241      dsp_prg_ctrl(data);
1241      dsp_prg_ctrl(machine, data);
12421242      if(LOG_SCU) logerror("SCU DSP: Program Control Port Access %08x\n",data);
12431243      break;
12441244      case 33:
docs/messnew.txt
r2864r2865
130130
131131Source Changes:
132132----------------
133- The core is based on MAME 0.125u5.  This incorporates all features of the
133- The core is based on MAME 0.125u6.  This incorporates all features of the
134134  update to this core.  [MAME team]
135135
136136- Fixed performance problems with -triplebuffer.  (bug #1539) [Justin Kerk]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team