Previous 15994 Revisions Next

r14884 Monday 9th April, 2012 at 14:35:02 UTC by Miodrag Milanović
Sync with MAME r15926 (no whatsnew)
[src/emu]driver.h
[src/emu/machine]generic.c generic.h
[src/mame/audio]gottlieb.c jedi.c
[src/mame/drivers]8080bw.c acefruit.c alg.c arcadia.c arkanoid.c artmagic.c asteroid.c astrocde.c astrof.c balsente.c battlex.c bwidow.c bzone.c cave.c ccastles.c cd32.c champbas.c cidelsa.c cloud9.c cop01.c crbaloon.c crshrace.c dacholer.c dbz.c dcheese.c ddayjlc.c ddenlovr.c ddragon.c dlair.c dorachan.c dreamwld.c dynax.c ecoinfr.c enigma2.c eolith.c eolith16.c eolithsp.c equites.c exerion.c exidy.c exidy440.c expro02.c famibox.c fantland.c fgoal.c firefox.c firetrk.c flstory.c fromanc2.c fuukifg3.c gaelco2.c gaelco3d.c gal3.c galaga.c galastrm.c galaxi.c galaxian.c galaxold.c galdrvr.c gottlieb.c groundfx.c gstream.c gunbustr.c homerun.c igs009.c igs011.c igspoker.c inufuku.c itech32.c itech8.c jack.c jackie.c jaguar.c jankenmn.c jedi.c junofrst.c konamigx.c ksys573.c ladybug.c lethalj.c limenko.c littlerb.c m92.c mainsnk.c majorpkr.c merit.c metro.c mhavoc.c micro3d.c midvunit.c midyunit.c midzeus.c missile.c model2.c mquake.c ms32.c multfish.c multigam.c mw18w.c mw8080bw.c namcos22.c neodrvr.c neogeo.c niyanpai.c nova2001.c pastelg.c peplus.c peyper.c phoenix.c pirates.c playch10.c polepos.c policetr.c psikyo.c psikyo4.c punchout.c pzletime.c qdrmfgp.c quizshow.c r2dtank.c renegade.c rgum.c rpunch.c sandscrp.c scobra.c scramble.c segag80v.c seibuspi.c snk.c snk6502.c spoker.c sprint4.c ssingles.c stactics.c stadhero.c starshp1.c starwars.c statriv2.c suprnova.c suprridr.c system1.c taito_f3.c taitojc.c taitosj.c tempest.c tetrisp2.c thayers.c toaplan2.c ultratnk.c ultrsprt.c undrfire.c vamphalf.c vegaeo.c vicdual.c welltris.c williams.c wolfpack.c wwfsstar.c wwfwfest.c xain.c xmen.c xxmissio.c zaccaria.c zaxxon.c zn.c zr107.c
[src/mame/includes]8080bw.h amiga.h arkanoid.h artmagic.h asteroid.h astrocde.h astrof.h balsente.h battlex.h bzone.h cave.h ccastles.h cd32.h champbas.h cidelsa.h cloud9.h cop01.h crbaloon.h crshrace.h dcheese.h ddragon.h dynax.h eolith.h eolithsp.h equites.h exerion.h exidy.h exidy440.h fantland.h fgoal.h firetrk.h flstory.h fromanc2.h gaelco2.h gaelco3d.h galaga.h galastrm.h galaxian.h galaxold.h gottlieb.h groundfx.h gunbustr.h homerun.h inufuku.h itech32.h itech8.h jack.h jedi.h konamigx.h ladybug.h lethalj.h m92.h mainsnk.h metro.h mhavoc.h micro3d.h midyunit.h midzeus.h model2.h ms32.h mw8080bw.h namcos22.h neogeo.h niyanpai.h nova2001.h pastelg.h phoenix.h pirates.h playch10.h polepos.h policetr.h psikyo.h psikyo4.h punchout.h qdrmfgp.h renegade.h rpunch.h scramble.h segag80v.h seibuspi.h snk.h snk6502.h sprint4.h stactics.h starshp1.h starwars.h suprnova.h suprridr.h system1.h taito_f3.h taitojc.h taitosj.h tetrisp2.h toaplan2.h ultratnk.h undrfire.h vicdual.h welltris.h williams.h wolfpack.h wwfsstar.h wwfwfest.h xain.h xmen.h xxmissio.h zaccaria.h zaxxon.h
[src/mame/machine]amiga.c arkanoid.c balsente.c gaelco2.c galaxold.c mhavoc.c micro3d.c playch10.c scramble.c starwars.c williams.c
[src/mame/video]phoenix.c stactics.c
[src/mess/drivers]ami1200.c amiga.c

src/mame/audio/gottlieb.c
r14883r14884
785785      }
786786      else
787787      {
788         device_t *ay = machine().device((data & 0x08) ? "ay1" : "ay2");
788         ay8913_device *ay = (data & 0x08) ? m_ay1 : m_ay2;
789789         ay8910_address_w(ay, 0, m_psg_latch);
790790         ay8910_data_w(ay, 0, m_psg_data_latch);
791791      }
src/mame/audio/jedi.c
r14883r14884
101101}
102102
103103
104CUSTOM_INPUT( jedi_audio_comm_stat_r )
104CUSTOM_INPUT_MEMBER(jedi_state::jedi_audio_comm_stat_r)
105105{
106   jedi_state *state = field.machine().driver_data<jedi_state>();
107   return *state->m_audio_comm_stat >> 6;
106   return *m_audio_comm_stat >> 6;
108107}
109108
110109
src/mame/machine/mhavoc.c
r14883r14884
205205 *
206206 *************************************/
207207
208CUSTOM_INPUT( tms5220_r )
208CUSTOM_INPUT_MEMBER(mhavoc_state::tms5220_r)
209209{
210   return tms5220_readyq_r(field.machine().device("tms")) ? 1 : 0;
210   return tms5220_readyq_r(machine().device("tms")) ? 1 : 0;
211211}
212212
213CUSTOM_INPUT( mhavoc_bit67_r )
213CUSTOM_INPUT_MEMBER(mhavoc_state::mhavoc_bit67_r)
214214{
215   mhavoc_state *state = field.machine().driver_data<mhavoc_state>();
216215   const char *tag1 = (const char *)param;
217216   const char *tag2 = tag1 + strlen(tag1) + 1;
218   return input_port_read(field.machine(), state->m_player_1 ? tag2 : tag1) & 0x03;
217   return input_port_read(machine(), m_player_1 ? tag2 : tag1) & 0x03;
219218}
220219
221CUSTOM_INPUT( gamma_rcvd_r )
220CUSTOM_INPUT_MEMBER(mhavoc_state::gamma_rcvd_r)
222221{
223   mhavoc_state *state = field.machine().driver_data<mhavoc_state>();
224222   /* Gamma rcvd flag */
225   return state->m_gamma_rcvd;
223   return m_gamma_rcvd;
226224}
227225
228CUSTOM_INPUT( gamma_xmtd_r )
226CUSTOM_INPUT_MEMBER(mhavoc_state::gamma_xmtd_r)
229227{
230   mhavoc_state *state = field.machine().driver_data<mhavoc_state>();
231228   /* Gamma xmtd flag */
232   return state->m_gamma_xmtd;
229   return m_gamma_xmtd;
233230}
234231
235CUSTOM_INPUT( alpha_rcvd_r )
232CUSTOM_INPUT_MEMBER(mhavoc_state::alpha_rcvd_r)
236233{
237   mhavoc_state *state = field.machine().driver_data<mhavoc_state>();
238234   /* Alpha rcvd flag */
239   return (state->m_has_gamma_cpu && state->m_alpha_rcvd);
235   return (m_has_gamma_cpu && m_alpha_rcvd);
240236}
241237
242CUSTOM_INPUT( alpha_xmtd_r )
238CUSTOM_INPUT_MEMBER(mhavoc_state::alpha_xmtd_r)
243239{
244   mhavoc_state *state = field.machine().driver_data<mhavoc_state>();
245240   /* Alpha xmtd flag */
246   return (state->m_has_gamma_cpu && state->m_alpha_xmtd);
241   return (m_has_gamma_cpu && m_alpha_xmtd);
247242}
248243
249244/*************************************
src/mame/machine/balsente.c
r14883r14884
10911091 *
10921092 *************************************/
10931093
1094CUSTOM_INPUT( nstocker_bits_r )
1094CUSTOM_INPUT_MEMBER(balsente_state::nstocker_bits_r)
10951095{
1096   balsente_state *state = field.machine().driver_data<balsente_state>();
1097   return state->m_nstocker_bits;
1096   return m_nstocker_bits;
10981097}
10991098
11001099
src/mame/machine/amiga.c
r14883r14884
417417 *
418418 *************************************/
419419
420CUSTOM_INPUT( amiga_joystick_convert )
420CUSTOM_INPUT_MEMBER( amiga_state::amiga_joystick_convert )
421421{
422   UINT8 bits = input_port_read(field.machine(), (const char *)param);
422   UINT8 bits = input_port_read(machine(), (const char *)param);
423423   int up = (bits >> 0) & 1;
424424   int down = (bits >> 1) & 1;
425425   int left = (bits >> 2) & 1;
src/mame/machine/micro3d.c
r14883r14884
537537   machine().scheduler().timer_set(attotime::from_usec(40), FUNC(adc_done_callback), data & ~4);
538538}
539539
540CUSTOM_INPUT( botssa_hwchk_r )
540CUSTOM_INPUT_MEMBER(micro3d_state::botssa_hwchk_r)
541541{
542   micro3d_state *state = field.machine().driver_data<micro3d_state>();
543542
544   return state->m_botssa_latch;
543   return m_botssa_latch;
545544}
546545
547546READ16_MEMBER(micro3d_state::botssa_140000_r)
src/mame/machine/playch10.c
r14883r14884
8686 *
8787 *************************************/
8888
89CUSTOM_INPUT( pc10_int_detect_r )
89CUSTOM_INPUT_MEMBER(playch10_state::pc10_int_detect_r)
9090{
91   playch10_state *state = field.machine().driver_data<playch10_state>();
92   return ~state->m_pc10_int_detect & 1;
91   return ~m_pc10_int_detect & 1;
9392}
9493
9594WRITE8_MEMBER(playch10_state::pc10_SDCS_w)
src/mame/machine/scramble.c
r14883r14884
3333}
3434
3535
36CUSTOM_INPUT( darkplnt_custom_r )
36CUSTOM_INPUT_MEMBER(scramble_state::darkplnt_custom_r)
3737{
3838   static const UINT8 remap[] = {0x03, 0x02, 0x00, 0x01, 0x21, 0x20, 0x22, 0x23,
3939                       0x33, 0x32, 0x30, 0x31, 0x11, 0x10, 0x12, 0x13,
r14883r14884
4343                       0x2b, 0x2a, 0x28, 0x29, 0x09, 0x08, 0x0a, 0x0b,
4444                       0x0f, 0x0e, 0x0c, 0x0d, 0x2d, 0x2c, 0x2e, 0x2f,
4545                       0x27, 0x26, 0x24, 0x25, 0x05, 0x04, 0x06, 0x07 };
46   UINT8 val = input_port_read(field.machine(), (const char *)param);
46   UINT8 val = input_port_read(machine(), (const char *)param);
4747
4848   return remap[val >> 2];
4949}
src/mame/machine/gaelco2.c
r14883r14884
218218***************************************************************************/
219219
220220
221CUSTOM_INPUT( wrally2_analog_bit_r )
221CUSTOM_INPUT_MEMBER(gaelco2_state::wrally2_analog_bit_r)
222222{
223   gaelco2_state *state = field.machine().driver_data<gaelco2_state>();
224223   int which = (FPTR)param;
225   return (state->m_analog_ports[which] >> 7) & 0x01;
224   return (m_analog_ports[which] >> 7) & 0x01;
226225}
227226
228227
src/mame/machine/arkanoid.c
r14883r14884
9797   m_ddr_c = data;
9898}
9999
100CUSTOM_INPUT( arkanoid_68705_input_r )
100CUSTOM_INPUT_MEMBER(arkanoid_state::arkanoid_68705_input_r)
101101{
102   arkanoid_state *state = field.machine().driver_data<arkanoid_state>();
103102   int res = 0;
104103
105104   /* bit 0x40 of comes from the sticky bit */
106   if (!state->m_z80write)
105   if (!m_z80write)
107106      res |= 0x01;
108107
109108   /* bit 0x80 comes from a write latch */
110   if (!state->m_m68705write)
109   if (!m_m68705write)
111110      res |= 0x02;
112111
113112   return res;
114113}
115114
116CUSTOM_INPUT( arkanoid_input_mux )
115CUSTOM_INPUT_MEMBER(arkanoid_state::arkanoid_input_mux)
117116{
118   arkanoid_state *state = field.machine().driver_data<arkanoid_state>();
119117   const char *tag1 = (const char *)param;
120118   const char *tag2 = tag1 + strlen(tag1) + 1;
121   return input_port_read(field.machine(), (state->m_paddle_select == 0) ? tag1 : tag2);
119   return input_port_read(machine(), (m_paddle_select == 0) ? tag1 : tag2);
122120}
123121
124122/*
src/mame/machine/galaxold.c
r14883r14884
254254   memory_set_bank(machine(), "bank1", m__4in1_bank);
255255}
256256
257CUSTOM_INPUT( _4in1_fake_port_r )
257CUSTOM_INPUT_MEMBER(galaxold_state::_4in1_fake_port_r)
258258{
259   galaxold_state *state = field.machine().driver_data<galaxold_state>();
260259   static const char *const portnames[] = { "FAKE1", "FAKE2", "FAKE3", "FAKE4" };
261260   int bit_mask = (FPTR)param;
262261
263   return (input_port_read(field.machine(), portnames[state->m__4in1_bank]) & bit_mask) ? 0x01 : 0x00;
262   return (input_port_read(machine(), portnames[m__4in1_bank]) & bit_mask) ? 0x01 : 0x00;
264263}
265264
266265#ifdef UNUSED_FUNCTION
src/mame/machine/williams.c
r14883r14884
616616   state->m_port_select = data;
617617}
618618
619CUSTOM_INPUT( williams_mux_r )
619CUSTOM_INPUT_MEMBER(williams_state::williams_mux_r)
620620{
621   williams_state *state = field.machine().driver_data<williams_state>();
622621   const char *tag = (const char *)param;
623622
624   if (state->m_port_select != 0)
623   if (m_port_select != 0)
625624      tag += strlen(tag) + 1;
626625
627   return input_port_read(field.machine(), tag);
626   return input_port_read(machine(), tag);
628627}
629628
630629/*
src/mame/machine/starwars.c
r14883r14884
107107 *
108108 *************************************/
109109
110CUSTOM_INPUT( matrix_flag_r )
110CUSTOM_INPUT_MEMBER(starwars_state::matrix_flag_r)
111111{
112   starwars_state *state = field.machine().driver_data<starwars_state>();
113112   /* set the matrix processor flag */
114   return state->m_math_run ? 1 : 0;
113   return m_math_run ? 1 : 0;
115114}
116115
117116
src/mame/includes/fgoal.h
r14883r14884
4040   DECLARE_WRITE8_MEMBER(fgoal_color_w);
4141   DECLARE_WRITE8_MEMBER(fgoal_ypos_w);
4242   DECLARE_WRITE8_MEMBER(fgoal_xpos_w);
43   DECLARE_CUSTOM_INPUT_MEMBER(fgoal_80_r);
4344};
4445
4546
src/mame/includes/mainsnk.h
r14883r14884
1818   DECLARE_WRITE8_MEMBER(mainsnk_c600_w);
1919   DECLARE_WRITE8_MEMBER(mainsnk_fgram_w);
2020   DECLARE_WRITE8_MEMBER(mainsnk_bgram_w);
21   DECLARE_CUSTOM_INPUT_MEMBER(mainsnk_sound_r);
2122};
2223
2324
src/mame/includes/midyunit.h
r14883r14884
7575   DECLARE_WRITE16_MEMBER(midyunit_paletteram_w);
7676   DECLARE_READ16_MEMBER(midyunit_dma_r);
7777   DECLARE_WRITE16_MEMBER(midyunit_dma_w);
78   DECLARE_CUSTOM_INPUT_MEMBER(narc_talkback_strobe_r);
79   DECLARE_CUSTOM_INPUT_MEMBER(narc_talkback_data_r);
80   DECLARE_CUSTOM_INPUT_MEMBER(adpcm_irq_state_r);
7881};
7982
8083
src/mame/includes/mhavoc.h
r14883r14884
5050   DECLARE_WRITE8_MEMBER(mhavoc_out_1_w);
5151   DECLARE_WRITE8_MEMBER(mhavocrv_speech_data_w);
5252   DECLARE_WRITE8_MEMBER(mhavocrv_speech_strobe_w);
53   DECLARE_CUSTOM_INPUT_MEMBER(tms5220_r);
54   DECLARE_CUSTOM_INPUT_MEMBER(mhavoc_bit67_r);
55   DECLARE_CUSTOM_INPUT_MEMBER(gamma_rcvd_r);
56   DECLARE_CUSTOM_INPUT_MEMBER(gamma_xmtd_r);
57   DECLARE_CUSTOM_INPUT_MEMBER(alpha_rcvd_r);
58   DECLARE_CUSTOM_INPUT_MEMBER(alpha_xmtd_r);
59   DECLARE_CUSTOM_INPUT_MEMBER(clock_r);
5360};
5461
5562
r14883r14884
6370DRIVER_INIT( mhavocrv );
6471
6572
66
67
68CUSTOM_INPUT( tms5220_r );
69CUSTOM_INPUT( gamma_rcvd_r );
70CUSTOM_INPUT( gamma_xmtd_r );
71CUSTOM_INPUT( alpha_rcvd_r );
72CUSTOM_INPUT( alpha_xmtd_r );
73CUSTOM_INPUT( mhavoc_bit67_r );
74
75
76
src/mame/includes/bzone.h
r14883r14884
2020   DECLARE_WRITE8_MEMBER(bzone_coin_counter_w);
2121   DECLARE_READ8_MEMBER(analog_data_r);
2222   DECLARE_WRITE8_MEMBER(analog_select_w);
23   DECLARE_CUSTOM_INPUT_MEMBER(clock_r);
2324};
2425
2526
src/mame/includes/artmagic.h
r14883r14884
3838   DECLARE_READ16_MEMBER(unk_r);
3939   DECLARE_READ16_MEMBER(artmagic_blitter_r);
4040   DECLARE_WRITE16_MEMBER(artmagic_blitter_w);
41   DECLARE_CUSTOM_INPUT_MEMBER(prot_r);
4142};
4243
4344
src/mame/includes/ccastles.h
r14883r14884
6161   DECLARE_READ8_MEMBER(ccastles_bitmode_r);
6262   DECLARE_WRITE8_MEMBER(ccastles_bitmode_w);
6363   DECLARE_WRITE8_MEMBER(ccastles_bitmode_addr_w);
64   DECLARE_CUSTOM_INPUT_MEMBER(get_vblank);
6465};
6566
6667
src/mame/includes/policetr.h
r14883r14884
3939   DECLARE_READ32_MEMBER(policetr_video_r);
4040   DECLARE_WRITE32_MEMBER(policetr_palette_offset_w);
4141   DECLARE_WRITE32_MEMBER(policetr_palette_data_w);
42   DECLARE_CUSTOM_INPUT_MEMBER(bsmt_status_r);
4243};
4344
4445
src/mame/includes/seibuspi.h
r14883r14884
5353   DECLARE_WRITE32_MEMBER(sprite_dma_start_w);
5454   DECLARE_WRITE32_MEMBER(video_dma_length_w);
5555   DECLARE_WRITE32_MEMBER(video_dma_address_w);
56   DECLARE_CUSTOM_INPUT_MEMBER(ejsakura_keyboard_r);
57   DECLARE_CUSTOM_INPUT_MEMBER(ejanhs_encode);
5658};
5759
5860
src/mame/includes/system1.h
r14883r14884
5050   DECLARE_READ8_MEMBER(system1_videoram_r);
5151   DECLARE_WRITE8_MEMBER(system1_videoram_w);
5252   DECLARE_WRITE8_MEMBER(system1_paletteram_w);
53   DECLARE_CUSTOM_INPUT_MEMBER(dakkochn_mux_data_r);
54   DECLARE_CUSTOM_INPUT_MEMBER(dakkochn_mux_status_r);
5355};
5456
5557
src/mame/includes/niyanpai.h
r14883r14884
7575   DECLARE_WRITE16_MEMBER(niyanpai_clutsel_0_w);
7676   DECLARE_WRITE16_MEMBER(niyanpai_clutsel_1_w);
7777   DECLARE_WRITE16_MEMBER(niyanpai_clutsel_2_w);
78   DECLARE_CUSTOM_INPUT_MEMBER(musobana_outcoin_flag_r);
7879};
7980
8081
src/mame/includes/jedi.h
r14883r14884
5454   DECLARE_WRITE8_MEMBER(nvram_enable_w);
5555   DECLARE_WRITE8_MEMBER(jedi_vscroll_w);
5656   DECLARE_WRITE8_MEMBER(jedi_hscroll_w);
57   DECLARE_CUSTOM_INPUT_MEMBER(jedi_audio_comm_stat_r);
5758};
5859
5960
r14883r14884
6465WRITE8_HANDLER( jedi_audio_reset_w );
6566WRITE8_HANDLER( jedi_audio_latch_w );
6667READ8_HANDLER( jedi_audio_ack_latch_r );
67CUSTOM_INPUT( jedi_audio_comm_stat_r );
6868
6969
7070/*----------- defined in video/jedi.c -----------*/
src/mame/includes/suprnova.h
r14883r14884
9494   DECLARE_WRITE32_MEMBER(skns_tilemapA_w);
9595   DECLARE_WRITE32_MEMBER(skns_tilemapB_w);
9696   DECLARE_WRITE32_MEMBER(skns_v3_regs_w);
97   DECLARE_CUSTOM_INPUT_MEMBER(paddle_r);
9798};
9899
99100
src/mame/includes/dynax.h
r14883r14884
207207   DECLARE_READ8_MEMBER(htengoku_coin_r);
208208   DECLARE_WRITE8_MEMBER(htengoku_rombank_w);
209209   DECLARE_WRITE8_MEMBER(htengoku_blit_romregion_w);
210   DECLARE_READ8_MEMBER(unk_r);
211210   DECLARE_WRITE8_MEMBER(tenkai_ipsel_w);
212211   DECLARE_WRITE8_MEMBER(tenkai_ip_w);
213212   DECLARE_READ8_MEMBER(tenkai_ip_r);
r14883r14884
266265   DECLARE_WRITE8_MEMBER(jantouki_blitter2_rev2_w);
267266   DECLARE_WRITE8_MEMBER(hanamai_priority_w);
268267   DECLARE_WRITE8_MEMBER(tenkai_priority_w);
268   DECLARE_CUSTOM_INPUT_MEMBER(ddenlovr_special_r);
269   DECLARE_CUSTOM_INPUT_MEMBER(ddenlovj_blitter_r);
270   DECLARE_CUSTOM_INPUT_MEMBER(nettoqc_special_r);
271   DECLARE_CUSTOM_INPUT_MEMBER(mjflove_blitter_r);
272   DECLARE_WRITE8_MEMBER(ddenlovr_bgcolor_w);
273   DECLARE_WRITE8_MEMBER(ddenlovr_bgcolor2_w);
274   DECLARE_WRITE16_MEMBER(ddenlovr16_bgcolor_w);
275   DECLARE_WRITE8_MEMBER(ddenlovr_priority_w);
276   DECLARE_WRITE8_MEMBER(ddenlovr_priority2_w);
277   DECLARE_WRITE16_MEMBER(ddenlovr16_priority_w);
278   DECLARE_WRITE8_MEMBER(ddenlovr_layer_enable_w);
279   DECLARE_WRITE8_MEMBER(ddenlovr_layer_enable2_w);
280   DECLARE_WRITE16_MEMBER(ddenlovr16_layer_enable_w);
281   DECLARE_WRITE8_MEMBER(hanakanz_blitter_reg_w);
282   DECLARE_WRITE8_MEMBER(hanakanz_blitter_data_w);
283   DECLARE_WRITE8_MEMBER(rongrong_blitter_w);
284   DECLARE_WRITE16_MEMBER(ddenlovr_blitter_w);
285   DECLARE_WRITE16_MEMBER(ddenlovr_blitter_irq_ack_w);
286   DECLARE_READ8_MEMBER(rongrong_gfxrom_r);
287   DECLARE_READ16_MEMBER(ddenlovr_gfxrom_r);
288   DECLARE_WRITE16_MEMBER(ddenlovr_coincounter_0_w);
289   DECLARE_WRITE16_MEMBER(ddenlovr_coincounter_1_w);
290   DECLARE_WRITE8_MEMBER(rongrong_palette_w);
291   DECLARE_WRITE16_MEMBER(ddenlovr_palette_w);
292   DECLARE_WRITE8_MEMBER(ddenlovr_palette_base_w);
293   DECLARE_WRITE8_MEMBER(ddenlovr_palette_base2_w);
294   DECLARE_WRITE8_MEMBER(ddenlovr_palette_mask_w);
295   DECLARE_WRITE8_MEMBER(ddenlovr_palette_mask2_w);
296   DECLARE_WRITE8_MEMBER(ddenlovr_transparency_pen_w);
297   DECLARE_WRITE8_MEMBER(ddenlovr_transparency_pen2_w);
298   DECLARE_WRITE8_MEMBER(ddenlovr_transparency_mask_w);
299   DECLARE_WRITE8_MEMBER(ddenlovr_transparency_mask2_w);
300   DECLARE_WRITE16_MEMBER(ddenlovr16_palette_base_w);
301   DECLARE_WRITE16_MEMBER(ddenlovr16_palette_mask_w);
302   DECLARE_WRITE16_MEMBER(ddenlovr16_transparency_pen_w);
303   DECLARE_WRITE16_MEMBER(ddenlovr16_transparency_mask_w);
304   DECLARE_READ8_MEMBER(unk_r);
305   DECLARE_READ16_MEMBER(unk16_r);
306   DECLARE_WRITE16_MEMBER(ddenlovr_select_16_w);
307   DECLARE_WRITE8_MEMBER(ddenlovr_select2_w);
308   DECLARE_WRITE16_MEMBER(ddenlovr_select2_16_w);
309   DECLARE_READ8_MEMBER(rongrong_input2_r);
310   DECLARE_READ16_MEMBER(quiz365_input2_r);
311   DECLARE_WRITE8_MEMBER(rongrong_blitter_busy_w);
312   DECLARE_READ8_MEMBER(rongrong_blitter_busy_r);
313   DECLARE_WRITE16_MEMBER(quiz365_coincounter_w);
314   DECLARE_READ16_MEMBER(quiz365_protection_r);
315   DECLARE_WRITE16_MEMBER(quiz365_protection_w);
316   DECLARE_READ16_MEMBER(ddenlovj_dsw_r);
317   DECLARE_WRITE16_MEMBER(ddenlovj_coincounter_w);
318   DECLARE_READ16_MEMBER(ddenlovrk_protection1_r);
319   DECLARE_READ16_MEMBER(ddenlovrk_protection2_r);
320   DECLARE_WRITE16_MEMBER(ddenlovrk_protection2_w);
321   DECLARE_READ16_MEMBER(nettoqc_input_r);
322   DECLARE_READ16_MEMBER(nettoqc_protection_r);
323   DECLARE_WRITE16_MEMBER(nettoqc_coincounter_w);
324   DECLARE_READ8_MEMBER(rongrong_input_r);
325   DECLARE_WRITE8_MEMBER(rongrong_select_w);
326   DECLARE_READ8_MEMBER(magic_r);
327   DECLARE_WRITE8_MEMBER(mmpanic_rombank_w);
328   DECLARE_WRITE8_MEMBER(mmpanic_soundlatch_w);
329   DECLARE_WRITE8_MEMBER(mmpanic_blitter_w);
330   DECLARE_WRITE8_MEMBER(mmpanic_blitter2_w);
331   DECLARE_WRITE8_MEMBER(mmpanic_leds_w);
332   DECLARE_WRITE8_MEMBER(mmpanic_leds2_w);
333   DECLARE_WRITE8_MEMBER(mmpanic_lockout_w);
334   DECLARE_READ8_MEMBER(mmpanic_link_r);
335   DECLARE_READ8_MEMBER(funkyfig_busy_r);
336   DECLARE_WRITE8_MEMBER(funkyfig_blitter_w);
337   DECLARE_WRITE8_MEMBER(funkyfig_rombank_w);
338   DECLARE_READ8_MEMBER(funkyfig_dsw_r);
339   DECLARE_READ8_MEMBER(funkyfig_coin_r);
340   DECLARE_READ8_MEMBER(funkyfig_key_r);
341   DECLARE_WRITE8_MEMBER(funkyfig_lockout_w);
342   DECLARE_WRITE8_MEMBER(hanakanz_rombank_w);
343   DECLARE_WRITE8_MEMBER(hanakanz_keyb_w);
344   DECLARE_WRITE8_MEMBER(hanakanz_dsw_w);
345   DECLARE_READ8_MEMBER(hanakanz_keyb_r);
346   DECLARE_READ8_MEMBER(hanakanz_dsw_r);
347   DECLARE_READ8_MEMBER(hanakanz_busy_r);
348   DECLARE_READ8_MEMBER(hanakanz_gfxrom_r);
349   DECLARE_WRITE8_MEMBER(hanakanz_coincounter_w);
350   DECLARE_WRITE8_MEMBER(hanakanz_palette_w);
351   DECLARE_READ8_MEMBER(hanakanz_rand_r);
352   DECLARE_WRITE8_MEMBER(mjreach1_protection_w);
353   DECLARE_READ8_MEMBER(mjreach1_protection_r);
354   DECLARE_READ8_MEMBER(mjchuuka_keyb_r);
355   DECLARE_WRITE8_MEMBER(mjchuuka_blitter_w);
356   DECLARE_READ8_MEMBER(mjchuuka_gfxrom_0_r);
357   DECLARE_READ8_MEMBER(mjchuuka_gfxrom_1_r);
358   DECLARE_WRITE8_MEMBER(mjchuuka_palette_w);
359   DECLARE_WRITE8_MEMBER(mjchuuka_coincounter_w);
360   DECLARE_WRITE8_MEMBER(mjmyster_rambank_w);
361   DECLARE_WRITE8_MEMBER(mjmyster_select2_w);
362   DECLARE_READ8_MEMBER(mjmyster_coins_r);
363   DECLARE_READ8_MEMBER(mjmyster_keyb_r);
364   DECLARE_READ8_MEMBER(mjmyster_dsw_r);
365   DECLARE_WRITE8_MEMBER(mjmyster_coincounter_w);
366   DECLARE_WRITE8_MEMBER(mjmyster_blitter_w);
367   DECLARE_WRITE8_MEMBER(hginga_rombank_w);
368   DECLARE_READ8_MEMBER(hginga_protection_r);
369   DECLARE_WRITE8_MEMBER(hginga_input_w);
370   DECLARE_READ8_MEMBER(hginga_coins_r);
371   DECLARE_WRITE8_MEMBER(hginga_80_w);
372   DECLARE_WRITE8_MEMBER(hginga_coins_w);
373   DECLARE_READ8_MEMBER(hginga_input_r);
374   DECLARE_WRITE8_MEMBER(hginga_blitter_w);
375   DECLARE_WRITE8_MEMBER(hgokou_dsw_sel_w);
376   DECLARE_READ8_MEMBER(hgokou_input_r);
377   DECLARE_WRITE8_MEMBER(hgokou_input_w);
378   DECLARE_READ8_MEMBER(hgokou_protection_r);
379   DECLARE_READ8_MEMBER(hgokbang_input_r);
380   DECLARE_WRITE8_MEMBER(hparadis_select_w);
381   DECLARE_READ8_MEMBER(hparadis_input_r);
382   DECLARE_READ8_MEMBER(hparadis_dsw_r);
383   DECLARE_WRITE8_MEMBER(hparadis_coin_w);
384   DECLARE_READ8_MEMBER(mjmywrld_coins_r);
385   DECLARE_READ16_MEMBER(akamaru_protection1_r);
386   DECLARE_WRITE16_MEMBER(akamaru_protection1_w);
387   DECLARE_READ16_MEMBER(akamaru_protection2_r);
388   DECLARE_READ16_MEMBER(akamaru_dsw_r);
389   DECLARE_READ16_MEMBER(akamaru_blitter_r);
390   DECLARE_READ16_MEMBER(akamaru_e0010d_r);
391   DECLARE_WRITE8_MEMBER(mjflove_rombank_w);
392   DECLARE_READ8_MEMBER(mjflove_protection_r);
393   DECLARE_READ8_MEMBER(mjflove_keyb_r);
394   DECLARE_WRITE8_MEMBER(mjflove_blitter_w);
395   DECLARE_WRITE8_MEMBER(mjflove_coincounter_w);
396   DECLARE_WRITE8_MEMBER(jongtei_dsw_keyb_w);
397   DECLARE_READ8_MEMBER(jongtei_busy_r);
398   DECLARE_READ8_MEMBER(sryudens_keyb_r);
399   DECLARE_WRITE8_MEMBER(sryudens_coincounter_w);
400   DECLARE_WRITE8_MEMBER(sryudens_rambank_w);
401   DECLARE_READ8_MEMBER(daimyojn_keyb1_r);
402   DECLARE_READ8_MEMBER(daimyojn_keyb2_r);
403   DECLARE_WRITE8_MEMBER(daimyojn_protection_w);
404   DECLARE_READ8_MEMBER(daimyojn_protection_r);
405   DECLARE_READ8_MEMBER(momotaro_protection_r);
406   DECLARE_WRITE8_MEMBER(daimyojn_palette_sel_w);
407   DECLARE_WRITE8_MEMBER(daimyojn_blitter_data_palette_w);
408   DECLARE_READ8_MEMBER(daimyojn_year_hack_r);
269409};
270410
271411//----------- defined in drivers/dynax.c -----------
r14883r14884
276416void neruton_update_irq(running_machine &machine);
277417
278418//----------- defined in video/dynax.c -----------
279
280
281
282
283
284
285
286
287419VIDEO_START( hanamai );
288420VIDEO_START( hnoridur );
289421VIDEO_START( mcnpshnt );
r14883r14884
307439
308440//----------- defined in drivers/ddenlovr.c -----------
309441
310WRITE8_HANDLER( ddenlovr_bgcolor_w );
311WRITE8_HANDLER( ddenlovr_priority_w );
312WRITE8_HANDLER( ddenlovr_layer_enable_w );
313WRITE8_HANDLER( ddenlovr_palette_base_w );
314WRITE8_HANDLER( ddenlovr_palette_mask_w );
315WRITE8_HANDLER( ddenlovr_transparency_pen_w );
316WRITE8_HANDLER( ddenlovr_transparency_mask_w );
317
318442VIDEO_START(ddenlovr);
319443SCREEN_UPDATE_IND16(ddenlovr);
src/mame/includes/balsente.h
r14883r14884
158158   DECLARE_WRITE8_MEMBER(balsente_palette_select_w);
159159   DECLARE_WRITE8_MEMBER(balsente_paletteram_w);
160160   DECLARE_WRITE8_MEMBER(shrike_sprite_select_w);
161   DECLARE_CUSTOM_INPUT_MEMBER(nstocker_bits_r);
161162};
162163
163164
r14883r14884
184185
185186
186187
187CUSTOM_INPUT( nstocker_bits_r );
188188
189189
190190
191
192191/*----------- defined in video/balsente.c -----------*/
193192
194193VIDEO_START( balsente );
src/mame/includes/itech32.h
r14883r14884
123123   DECLARE_WRITE32_MEMBER(itech020_video_w);
124124   DECLARE_WRITE32_MEMBER(drivedge_zbuf_control_w);
125125   DECLARE_READ32_MEMBER(itech020_video_r);
126   DECLARE_CUSTOM_INPUT_MEMBER(special_port_r);
126127};
127128
128129
src/mame/includes/undrfire.h
r14883r14884
3737   DECLARE_WRITE32_MEMBER(cbombers_cpua_ctrl_w);
3838   DECLARE_READ32_MEMBER(cbombers_adc_r);
3939   DECLARE_WRITE32_MEMBER(cbombers_adc_w);
40   DECLARE_CUSTOM_INPUT_MEMBER(frame_counter_r);
4041};
4142
4243
src/mame/includes/amiga.h
r14883r14884
426426   UINT16 m_aga_sprdatb[8][4];
427427   int m_aga_sprite_fetched_words;
428428   int m_aga_sprite_dma_used_words[8];
429   
430   DECLARE_CUSTOM_INPUT_MEMBER( amiga_joystick_convert );
429431};
430432
431433
r14883r14884
439441
440442MACHINE_RESET( amiga );
441443
442CUSTOM_INPUT( amiga_joystick_convert );
443
444444READ16_HANDLER( amiga_cia_r );
445445WRITE16_HANDLER( amiga_cia_w );
446446
src/mame/includes/midzeus.h
r14883r14884
3535   DECLARE_READ8_MEMBER(PIC16C5X_T0_clk_r);
3636   DECLARE_READ32_MEMBER(zeus_r);
3737   DECLARE_WRITE32_MEMBER(zeus_w);
38   DECLARE_CUSTOM_INPUT_MEMBER(custom_49way_r);
39   DECLARE_CUSTOM_INPUT_MEMBER(keypad_r);
3840};
3941
4042
src/mame/includes/zaxxon.h
r14883r14884
4848   DECLARE_WRITE8_MEMBER(zaxxon_videoram_w);
4949   DECLARE_WRITE8_MEMBER(congo_colorram_w);
5050   DECLARE_WRITE8_MEMBER(congo_sprite_custom_w);
51   DECLARE_CUSTOM_INPUT_MEMBER(razmataz_dial_r);
52   DECLARE_CUSTOM_INPUT_MEMBER(zaxxon_coin_r);
5153};
5254
5355
src/mame/includes/astrof.h
r14883r14884
4848   DECLARE_READ8_MEMBER(abattle_coin_prot_r);
4949   DECLARE_READ8_MEMBER(afire_coin_prot_r);
5050   DECLARE_READ8_MEMBER(tomahawk_protection_r);
51   DECLARE_CUSTOM_INPUT_MEMBER(astrof_p1_controls_r);
52   DECLARE_CUSTOM_INPUT_MEMBER(astrof_p2_controls_r);
53   DECLARE_CUSTOM_INPUT_MEMBER(tomahawk_controls_r);
5154};
5255
5356/*----------- defined in audio/astrof.c -----------*/
src/mame/includes/punchout.h
r14883r14884
3535   DECLARE_WRITE8_MEMBER(armwrest_fg_videoram_w);
3636   DECLARE_WRITE8_MEMBER(punchout_spr1_videoram_w);
3737   DECLARE_WRITE8_MEMBER(punchout_spr2_videoram_w);
38   DECLARE_CUSTOM_INPUT_MEMBER(punchout_vlm5030_busy_r);
3839};
3940
4041
src/mame/includes/sprint4.h
r14883r14884
2424   DECLARE_WRITE8_MEMBER(sprint4_lamp_w);
2525   DECLARE_WRITE8_MEMBER(sprint4_lockout_w);
2626   DECLARE_WRITE8_MEMBER(sprint4_video_ram_w);
27   DECLARE_CUSTOM_INPUT_MEMBER(get_lever);
28   DECLARE_CUSTOM_INPUT_MEMBER(get_wheel);
29   DECLARE_CUSTOM_INPUT_MEMBER(get_collision);
2730};
2831
2932
src/mame/includes/ms32.h
r14883r14884
6565   DECLARE_WRITE8_MEMBER(to_main_w);
6666   DECLARE_WRITE32_MEMBER(ms32_brightness_w);
6767   DECLARE_WRITE32_MEMBER(ms32_gfxctrl_w);
68   DECLARE_CUSTOM_INPUT_MEMBER(mahjong_ctrl_r);
6869};
6970
7071
src/mame/includes/wwfsstar.h
r14883r14884
1818   DECLARE_WRITE16_MEMBER(wwfsstar_irqack_w);
1919   DECLARE_WRITE16_MEMBER(wwfsstar_fg0_videoram_w);
2020   DECLARE_WRITE16_MEMBER(wwfsstar_bg0_videoram_w);
21   DECLARE_CUSTOM_INPUT_MEMBER(wwfsstar_vblank_r);
2122};
2223
2324
src/mame/includes/polepos.h
r14883r14884
5858   DECLARE_WRITE16_MEMBER(polepos_alpha16_w);
5959   DECLARE_READ8_MEMBER(polepos_alpha_r);
6060   DECLARE_WRITE8_MEMBER(polepos_alpha_w);
61   DECLARE_CUSTOM_INPUT_MEMBER(high_port_r);
62   DECLARE_CUSTOM_INPUT_MEMBER(low_port_r);
63   DECLARE_CUSTOM_INPUT_MEMBER(auto_start_r);
6164};
6265
6366
src/mame/includes/mw8080bw.h
r14883r14884
8989   DECLARE_READ8_MEMBER(bowler_shift_result_r);
9090   DECLARE_WRITE8_MEMBER(bowler_lights_1_w);
9191   DECLARE_WRITE8_MEMBER(bowler_lights_2_w);
92   DECLARE_CUSTOM_INPUT_MEMBER(seawolf_erase_input_r);
93   DECLARE_CUSTOM_INPUT_MEMBER(tornbase_hit_left_input_r);
94   DECLARE_CUSTOM_INPUT_MEMBER(tornbase_hit_right_input_r);
95   DECLARE_CUSTOM_INPUT_MEMBER(tornbase_pitch_left_input_r);
96   DECLARE_CUSTOM_INPUT_MEMBER(tornbase_pitch_right_input_r);
97   DECLARE_CUSTOM_INPUT_MEMBER(tornbase_score_input_r);
98   DECLARE_CUSTOM_INPUT_MEMBER(desertgu_gun_input_r);
99   DECLARE_CUSTOM_INPUT_MEMBER(desertgu_dip_sw_0_1_r);
100   DECLARE_CUSTOM_INPUT_MEMBER(dplay_pitch_left_input_r);
101   DECLARE_CUSTOM_INPUT_MEMBER(dplay_pitch_right_input_r);
102   DECLARE_CUSTOM_INPUT_MEMBER(clowns_controller_r);
103   DECLARE_CUSTOM_INPUT_MEMBER(invaders_coin_input_r);
104   DECLARE_CUSTOM_INPUT_MEMBER(invaders_sw6_sw7_r);
105   DECLARE_CUSTOM_INPUT_MEMBER(invaders_sw5_r);
106   DECLARE_CUSTOM_INPUT_MEMBER(blueshrk_coin_input_r);
107   DECLARE_CUSTOM_INPUT_MEMBER(invaders_in0_control_r);
108   DECLARE_CUSTOM_INPUT_MEMBER(invaders_in1_control_r);
109   DECLARE_CUSTOM_INPUT_MEMBER(invaders_in2_control_r);
92110};
93111
94112
r14883r14884
136154
137155UINT8 tornbase_get_cabinet_type(running_machine &machine);
138156
139CUSTOM_INPUT( invaders_in1_control_r );
140CUSTOM_INPUT( invaders_in2_control_r );
141
142157int invaders_is_cabinet_cocktail(running_machine &machine);
143158
144159
src/mame/includes/qdrmfgp.h
r14883r14884
88      { }
99
1010   required_device<cpu_device> m_maincpu;
11   required_shared_ptr<UINT8>   m_nvram;
11   required_shared_ptr<UINT16>   m_nvram;
1212   UINT8 *m_sndram;
1313   UINT16 *m_workram;
1414   UINT16 m_control;
r14883r14884
2424   DECLARE_READ16_MEMBER(sndram_r);
2525   DECLARE_WRITE16_MEMBER(sndram_w);
2626   DECLARE_READ16_MEMBER(gp2_ide_std_r);
27   DECLARE_CUSTOM_INPUT_MEMBER(inputs_r);
28   DECLARE_CUSTOM_INPUT_MEMBER(battery_sensor_r);
2729};
2830
2931/*----------- defined in video/qdrmfgp.c -----------*/
src/mame/includes/nova2001.h
r14883r14884
2121   DECLARE_WRITE8_MEMBER(nova2001_scroll_y_w);
2222   DECLARE_WRITE8_MEMBER(nova2001_flipscreen_w);
2323   DECLARE_WRITE8_MEMBER(pkunwar_flipscreen_w);
24   DECLARE_CUSTOM_INPUT_MEMBER(ninjakun_io_A002_ctrl_r);
2425};
2526
2627
src/mame/includes/stactics.h
r14883r14884
4343   DECLARE_WRITE8_MEMBER(stactics_speed_latch_w);
4444   DECLARE_WRITE8_MEMBER(stactics_shot_trigger_w);
4545   DECLARE_WRITE8_MEMBER(stactics_shot_flag_clear_w);
46   DECLARE_CUSTOM_INPUT_MEMBER(stactics_get_frame_count_d3);
47   DECLARE_CUSTOM_INPUT_MEMBER(stactics_get_shot_standby);
48   DECLARE_CUSTOM_INPUT_MEMBER(stactics_get_not_shot_arrive);
49   DECLARE_CUSTOM_INPUT_MEMBER(get_motor_not_ready);
50   DECLARE_CUSTOM_INPUT_MEMBER(get_rng);
4651};
4752
4853
r14883r14884
5055
5156MACHINE_CONFIG_EXTERN( stactics_video );
5257
53CUSTOM_INPUT( stactics_get_frame_count_d3 );
54CUSTOM_INPUT( stactics_get_shot_standby );
55CUSTOM_INPUT( stactics_get_not_shot_arrive );
5658
59
src/mame/includes/gaelco3d.h
r14883r14884
9797   DECLARE_WRITE32_MEMBER(gaelco3d_render_w);
9898   DECLARE_WRITE16_MEMBER(gaelco3d_paletteram_w);
9999   DECLARE_WRITE32_MEMBER(gaelco3d_paletteram_020_w);
100   DECLARE_CUSTOM_INPUT_MEMBER(analog_bit_r);
100101};
101102
102103
src/mame/includes/lethalj.h
r14883r14884
2424   DECLARE_READ16_MEMBER(lethalj_gun_r);
2525   DECLARE_WRITE16_MEMBER(lethalj_blitter_w);
2626   void do_blit();
27   DECLARE_CUSTOM_INPUT_MEMBER(cclownz_paddle);
2728};
2829
2930
src/mame/includes/itech8.h
r14883r14884
7171   DECLARE_READ8_MEMBER(itech8_tms34061_r);
7272   DECLARE_WRITE8_MEMBER(grmatch_palette_w);
7373   DECLARE_WRITE8_MEMBER(grmatch_xscroll_w);
74   DECLARE_CUSTOM_INPUT_MEMBER(special_r);
75   DECLARE_CUSTOM_INPUT_MEMBER(gtg_mux);
7476};
7577
7678
src/mame/includes/galaxian.h
r14883r14884
9090   DECLARE_WRITE8_MEMBER(scramble_background_green_w);
9191   DECLARE_WRITE8_MEMBER(scramble_background_blue_w);
9292   DECLARE_WRITE8_MEMBER(galaxian_gfxbank_w);
93   DECLARE_CUSTOM_INPUT_MEMBER(scramble_protection_alt_r);
94   DECLARE_CUSTOM_INPUT_MEMBER(gmgalax_port_r);
95   DECLARE_CUSTOM_INPUT_MEMBER(azurian_port_r);
96   DECLARE_CUSTOM_INPUT_MEMBER(kingball_muxbit_r);
97   DECLARE_CUSTOM_INPUT_MEMBER(kingball_noise_r);
98   DECLARE_CUSTOM_INPUT_MEMBER(moonwar_dial_r);
9399};
94100
95101
src/mame/includes/snk.h
r14883r14884
129129   DECLARE_WRITE8_MEMBER(gwara_sp_scroll_msb_w);
130130   DECLARE_WRITE8_MEMBER(tdfever_sp_scroll_msb_w);
131131   DECLARE_WRITE8_MEMBER(tdfever_spriteram_w);
132   DECLARE_CUSTOM_INPUT_MEMBER(marvins_sound_busy);
133   DECLARE_CUSTOM_INPUT_MEMBER(snk_sound_busy);
134   DECLARE_CUSTOM_INPUT_MEMBER(gwar_rotary);
135   DECLARE_CUSTOM_INPUT_MEMBER(gwarb_rotary);
136   DECLARE_CUSTOM_INPUT_MEMBER(countryc_trackball_x);
137   DECLARE_CUSTOM_INPUT_MEMBER(countryc_trackball_y);
138   DECLARE_CUSTOM_INPUT_MEMBER(snk_bonus_r);
132139};
133140
134141
src/mame/includes/flstory.h
r14883r14884
9797   DECLARE_READ8_MEMBER(victnine_gfxctrl_r);
9898   DECLARE_WRITE8_MEMBER(victnine_gfxctrl_w);
9999   DECLARE_WRITE8_MEMBER(flstory_scrlram_w);
100   DECLARE_CUSTOM_INPUT_MEMBER(victnine_mcu_status_bit01_r);
100101};
101102
102103
src/mame/includes/model2.h
r14883r14884
6969   bitmap_rgb32 m_sys24_bitmap;
7070
7171   required_device<cpu_device> m_maincpu;
72   DECLARE_CUSTOM_INPUT_MEMBER(_1c00000_r);
73   DECLARE_CUSTOM_INPUT_MEMBER(_1c0001c_r);
74   DECLARE_CUSTOM_INPUT_MEMBER(rchase2_devices_r);
7275};
7376
7477
src/mame/includes/scramble.h
r14883r14884
1111   UINT8 m_cavelon_bank;
1212   UINT8 m_security_2B_counter;
1313   UINT8 m_xb;
14   DECLARE_CUSTOM_INPUT_MEMBER(darkplnt_custom_r);
15   DECLARE_CUSTOM_INPUT_MEMBER(ckongs_coinage_r);
1416};
1517
1618
r14883r14884
5456READ8_HANDLER( hunchbks_mirror_r );
5557WRITE8_HANDLER( hunchbks_mirror_w );
5658
57CUSTOM_INPUT( darkplnt_custom_r );
5859
59
6060/*----------- defined in audio/scramble.c -----------*/
6161
6262void scramble_sh_init(running_machine &machine);
src/mame/includes/taitojc.h
r14883r14884
102102   DECLARE_READ32_MEMBER(taitojc_char_r);
103103   DECLARE_WRITE32_MEMBER(taitojc_tile_w);
104104   DECLARE_WRITE32_MEMBER(taitojc_char_w);
105   DECLARE_CUSTOM_INPUT_MEMBER(mascon_state_r);
105106};
106107
107108
src/mame/includes/suprridr.h
r14883r14884
3131   DECLARE_WRITE8_MEMBER(suprridr_bgscrolly_w);
3232   DECLARE_WRITE8_MEMBER(suprridr_bgram_w);
3333   DECLARE_WRITE8_MEMBER(suprridr_fgram_w);
34   DECLARE_CUSTOM_INPUT_MEMBER(suprridr_control_r);
3435};
3536
3637
src/mame/includes/psikyo.h
r14883r14884
7171   DECLARE_WRITE8_MEMBER(gunbird_sound_bankswitch_w);
7272   DECLARE_WRITE32_MEMBER(psikyo_vram_0_w);
7373   DECLARE_WRITE32_MEMBER(psikyo_vram_1_w);
74   DECLARE_CUSTOM_INPUT_MEMBER(z80_nmi_r);
75   DECLARE_CUSTOM_INPUT_MEMBER(mcu_status_r);
7476};
7577
7678
src/mame/includes/battlex.h
r14883r14884
2727   DECLARE_WRITE8_MEMBER(battlex_scroll_starfield_w);
2828   DECLARE_WRITE8_MEMBER(battlex_videoram_w);
2929   DECLARE_WRITE8_MEMBER(battlex_flipscreen_w);
30   DECLARE_CUSTOM_INPUT_MEMBER(battlex_in0_b4_r);
3031};
3132
3233
src/mame/includes/toaplan2.h
r14883r14884
9696   DECLARE_WRITE16_MEMBER(batrider_textdata_dma_w);
9797   DECLARE_WRITE16_MEMBER(batrider_unknown_dma_w);
9898   DECLARE_WRITE16_MEMBER(batrider_objectbank_w);
99   DECLARE_CUSTOM_INPUT_MEMBER(c2map_r);
99100};
100101
101102/*----------- defined in video/toaplan2.c -----------*/
src/mame/includes/crbaloon.h
r14883r14884
2727   DECLARE_WRITE8_MEMBER(port_sound_w);
2828   DECLARE_WRITE8_MEMBER(crbaloon_videoram_w);
2929   DECLARE_WRITE8_MEMBER(crbaloon_colorram_w);
30   DECLARE_CUSTOM_INPUT_MEMBER(pc3092_r);
3031};
3132
3233
src/mame/includes/pastelg.h
r14883r14884
3030   DECLARE_WRITE8_MEMBER(threeds_output_w);
3131   DECLARE_READ8_MEMBER(threeds_rom_readback_r);
3232   DECLARE_WRITE8_MEMBER(pastelg_romsel_w);
33   DECLARE_CUSTOM_INPUT_MEMBER(nb1413m3_hackbusyflag_r);
3334};
3435
3536
src/mame/includes/galastrm.h
r14883r14884
4141   DECLARE_WRITE32_MEMBER(galastrm_input_w);
4242   DECLARE_READ32_MEMBER(galastrm_adstick_ctrl_r);
4343   DECLARE_WRITE32_MEMBER(galastrm_adstick_ctrl_w);
44   DECLARE_CUSTOM_INPUT_MEMBER(frame_counter_r);
45   DECLARE_CUSTOM_INPUT_MEMBER(coin_word_r);
4446};
4547
4648
src/mame/includes/tetrisp2.h
r14883r14884
7373   DECLARE_WRITE16_MEMBER(rocknms_sub_vram_bg_w);
7474   DECLARE_WRITE16_MEMBER(rocknms_sub_vram_fg_w);
7575   DECLARE_WRITE16_MEMBER(rocknms_sub_vram_rot_w);
76   DECLARE_CUSTOM_INPUT_MEMBER(rocknms_main2sub_status_r);
7677};
7778
7879/*----------- defined in video/tetrisp2.c -----------*/
src/mame/includes/namcos22.h
r14883r14884
127127   DECLARE_WRITE16_MEMBER(namcos22_dspram16_bank_w);
128128   DECLARE_READ16_MEMBER(namcos22_dspram16_r);
129129   DECLARE_WRITE16_MEMBER(namcos22_dspram16_w);
130   DECLARE_CUSTOM_INPUT_MEMBER(alpine_motor_read);
130131};
131132
132133
src/mame/includes/vicdual.h
r14883r14884
6464   DECLARE_READ8_MEMBER(invinco_io_r);
6565   DECLARE_WRITE8_MEMBER(invinco_io_w);
6666   DECLARE_WRITE8_MEMBER(vicdual_palette_bank_w);
67   DECLARE_CUSTOM_INPUT_MEMBER(vicdual_read_coin_status);
68   DECLARE_CUSTOM_INPUT_MEMBER(vicdual_get_64v);
69   DECLARE_CUSTOM_INPUT_MEMBER(vicdual_get_vblank_comp);
70   DECLARE_CUSTOM_INPUT_MEMBER(vicdual_get_composite_blank_comp);
71   DECLARE_CUSTOM_INPUT_MEMBER(vicdual_get_timer_value);
72   DECLARE_CUSTOM_INPUT_MEMBER(brdrline_lives);
73   DECLARE_CUSTOM_INPUT_MEMBER(samurai_protection_r);
6774};
6875
6976
src/mame/includes/galaxold.h
r14883r14884
123123   DECLARE_READ8_MEMBER(rockclim_videoram_r);
124124   DECLARE_WRITE8_MEMBER(dambustr_bg_split_line_w);
125125   DECLARE_WRITE8_MEMBER(dambustr_bg_color_w);
126   DECLARE_CUSTOM_INPUT_MEMBER(_4in1_fake_port_r);
127   DECLARE_CUSTOM_INPUT_MEMBER(vpool_lives_r);
128   DECLARE_CUSTOM_INPUT_MEMBER(ckongg_coinage_r);
129   DECLARE_CUSTOM_INPUT_MEMBER(dkongjrm_coinage_r);
126130};
127131
128132
r14883r14884
192196#define galaxold_coin_counter_0_w galaxold_coin_counter_w
193197
194198
195CUSTOM_INPUT( _4in1_fake_port_r );
196199
197200INTERRUPT_GEN( hunchbks_vh_interrupt );
198201
src/mame/includes/welltris.h
r14883r14884
2727   DECLARE_WRITE16_MEMBER(welltris_scrollreg_w);
2828   DECLARE_WRITE16_MEMBER(welltris_charvideoram_w);
2929   void setbank(int num, int bank);
30   DECLARE_CUSTOM_INPUT_MEMBER(pending_sound_r);
3031};
3132
3233
src/mame/includes/cop01.h
r14883r14884
3636   DECLARE_WRITE8_MEMBER(cop01_background_w);
3737   DECLARE_WRITE8_MEMBER(cop01_foreground_w);
3838   DECLARE_WRITE8_MEMBER(cop01_vreg_w);
39   DECLARE_CUSTOM_INPUT_MEMBER(mightguy_area_r);
3940};
4041
4142
src/mame/includes/metro.h
r14883r14884
118118   DECLARE_WRITE16_MEMBER(metro_vram_2_w);
119119   DECLARE_WRITE16_MEMBER(metro_window_w);
120120   void blt_write( address_space *space, const int tmap, const offs_t offs, const UINT16 data, const UINT16 mask );
121   DECLARE_CUSTOM_INPUT_MEMBER(custom_soundstatus_r);
121122};
122123
123124
src/mame/includes/zaccaria.h
r14883r14884
2727   DECLARE_WRITE8_MEMBER(zaccaria_attributes_w);
2828   DECLARE_WRITE8_MEMBER(zaccaria_flip_screen_x_w);
2929   DECLARE_WRITE8_MEMBER(zaccaria_flip_screen_y_w);
30   DECLARE_CUSTOM_INPUT_MEMBER(acs_r);
3031};
3132
3233
src/mame/includes/eolith.h
r14883r14884
1717   DECLARE_READ32_MEMBER(hidctch3_pen2_r);
1818   DECLARE_WRITE32_MEMBER(eolith_vram_w);
1919   DECLARE_READ32_MEMBER(eolith_vram_r);
20   DECLARE_CUSTOM_INPUT_MEMBER(eolith_speedup_getvblank);
21   DECLARE_CUSTOM_INPUT_MEMBER(stealsee_speedup_getvblank);
2022};
2123
2224
src/mame/includes/inufuku.h
r14883r14884
3939   DECLARE_WRITE16_MEMBER(inufuku_bg_videoram_w);
4040   DECLARE_READ16_MEMBER(inufuku_tx_videoram_r);
4141   DECLARE_WRITE16_MEMBER(inufuku_tx_videoram_w);
42   DECLARE_CUSTOM_INPUT_MEMBER(soundflag_r);
4243};
4344
4445
src/mame/includes/asteroid.h
r14883r14884
2323   DECLARE_WRITE8_MEMBER(asteroid_bank_switch_w);
2424   DECLARE_WRITE8_MEMBER(astdelux_bank_switch_w);
2525   DECLARE_WRITE8_MEMBER(astdelux_led_w);
26   DECLARE_CUSTOM_INPUT_MEMBER(clock_r);
2627};
2728
2829
src/mame/includes/fromanc2.h
r14883r14884
7878   DECLARE_WRITE16_MEMBER(fromanc4_gfxreg_0_w);
7979   DECLARE_WRITE16_MEMBER(fromanc4_gfxreg_1_w);
8080   DECLARE_WRITE16_MEMBER(fromanc4_gfxreg_2_w);
81   DECLARE_CUSTOM_INPUT_MEMBER(subcpu_int_r);
82   DECLARE_CUSTOM_INPUT_MEMBER(sndcpu_nmi_r);
83   DECLARE_CUSTOM_INPUT_MEMBER(subcpu_nmi_r);
8184};
8285
8386
src/mame/includes/segag80v.h
r14883r14884
3434   DECLARE_READ8_MEMBER(multiply_r);
3535   DECLARE_WRITE8_MEMBER(coin_count_w);
3636   DECLARE_WRITE8_MEMBER(unknown_w);
37   DECLARE_CUSTOM_INPUT_MEMBER(elim4_joint_coin_r);
3738};
3839
3940
src/mame/includes/xain.h
r14883r14884
5757   DECLARE_WRITE8_MEMBER(xain_scrollxP1_w);
5858   DECLARE_WRITE8_MEMBER(xain_scrollyP1_w);
5959   DECLARE_WRITE8_MEMBER(xain_flipscreen_w);
60   DECLARE_CUSTOM_INPUT_MEMBER(xain_vblank_r);
61   DECLARE_CUSTOM_INPUT_MEMBER(mcu_status_r);
6062};
6163
6264
src/mame/includes/astrocde.h
r14883r14884
100100   DECLARE_WRITE8_MEMBER(profpac_screenram_ctrl_w);
101101   DECLARE_READ8_MEMBER(profpac_videoram_r);
102102   DECLARE_WRITE8_MEMBER(profpac_videoram_w);
103   DECLARE_CUSTOM_INPUT_MEMBER(ebases_trackball_r);
104   DECLARE_CUSTOM_INPUT_MEMBER(demndragn_joystick_r);
103105};
104106
105107
src/mame/includes/renegade.h
r14883r14884
6060   DECLARE_WRITE8_MEMBER(renegade_flipscreen_w);
6161   DECLARE_WRITE8_MEMBER(renegade_scroll0_w);
6262   DECLARE_WRITE8_MEMBER(renegade_scroll1_w);
63   DECLARE_CUSTOM_INPUT_MEMBER(mcu_status_r);
6364};
6465
6566
src/mame/includes/galaga.h
r14883r14884
3737   DECLARE_WRITE8_MEMBER(bosco_latch_w);
3838   DECLARE_WRITE8_MEMBER(galaga_videoram_w);
3939   DECLARE_WRITE8_MEMBER(gatsbee_bank_w);
40   DECLARE_CUSTOM_INPUT_MEMBER(shifted_port_r);
4041};
4142
4243class xevious_state : public galaga_state
src/mame/includes/8080bw.h
r14883r14884
3232   UINT8       m_screen_red;
3333
3434   device_t *m_speaker;
35   DECLARE_CUSTOM_INPUT_MEMBER(sflush_80_r);
3536};
3637
3738
src/mame/includes/psikyo4.h
r14883r14884
3636   DECLARE_WRITE32_MEMBER(ps4_screen2_brt_w);
3737   DECLARE_WRITE32_MEMBER(ps4_vidregs_w);
3838   DECLARE_WRITE32_MEMBER(hotgmck_pcm_bank_w);
39   DECLARE_CUSTOM_INPUT_MEMBER(system_port_r);
40   DECLARE_CUSTOM_INPUT_MEMBER(mahjong_ctrl_r);
3941};
4042
4143
src/mame/includes/jack.h
r14883r14884
3838   DECLARE_WRITE8_MEMBER(jack_paletteram_w);
3939   DECLARE_READ8_MEMBER(jack_flipscreen_r);
4040   DECLARE_WRITE8_MEMBER(jack_flipscreen_w);
41   DECLARE_CUSTOM_INPUT_MEMBER(sound_check_r);
4142};
4243
4344
src/mame/includes/taitosj.h
r14883r14884
6060   DECLARE_WRITE8_MEMBER(taitosj_characterram_w);
6161   DECLARE_WRITE8_MEMBER(junglhbr_characterram_w);
6262   DECLARE_WRITE8_MEMBER(taitosj_collision_reg_clear_w);
63   DECLARE_CUSTOM_INPUT_MEMBER(input_port_4_f0_r);
64   DECLARE_CUSTOM_INPUT_MEMBER(kikstart_gear_r);
6365};
6466
6567
src/mame/includes/snk6502.h
r14883r14884
4040   DECLARE_WRITE8_MEMBER(snk6502_scrolly_w);
4141   DECLARE_WRITE8_MEMBER(satansat_b002_w);
4242   DECLARE_WRITE8_MEMBER(satansat_backcolor_w);
43   DECLARE_CUSTOM_INPUT_MEMBER(snk6502_music0_r);
44   DECLARE_CUSTOM_INPUT_MEMBER(sasuke_count_r);
4345};
4446
4547
src/mame/includes/exidy440.h
r14883r14884
5050   DECLARE_WRITE8_MEMBER(exidy440_spriteram_w);
5151   DECLARE_WRITE8_MEMBER(exidy440_control_w);
5252   DECLARE_WRITE8_MEMBER(exidy440_interrupt_clear_w);
53   DECLARE_CUSTOM_INPUT_MEMBER(firq_beam_r);
54   DECLARE_CUSTOM_INPUT_MEMBER(firq_vblank_r);
55   DECLARE_CUSTOM_INPUT_MEMBER(hitnmiss_button1_r);
5356};
5457
5558
src/mame/includes/fantland.h
r14883r14884
4040   DECLARE_WRITE8_MEMBER(borntofi_nmi_enable_w);
4141   DECLARE_READ8_MEMBER(borntofi_inputs_r);
4242   DECLARE_WRITE8_MEMBER(borntofi_msm5205_w);
43   DECLARE_CUSTOM_INPUT_MEMBER(wheelrun_wheel_r);
4344};
4445
4546
src/mame/includes/xmen.h
r14883r14884
4141   DECLARE_WRITE16_MEMBER(sound_irq_w);
4242   DECLARE_WRITE16_MEMBER(xmen_18fa00_w);
4343   DECLARE_WRITE8_MEMBER(sound_bankswitch_w);
44   DECLARE_CUSTOM_INPUT_MEMBER(xmen_frame_r);
4445};
4546
4647/*----------- defined in video/xmen.c -----------*/
src/mame/includes/cd32.h
r14883r14884
2525   int m_cd32_shifter[2];
2626   void (*m_input_hack)(running_machine &machine);
2727   int m_oldstate[2];
28   DECLARE_CUSTOM_INPUT_MEMBER(cubo_input);
2829};
2930
3031/*----------- defined in machine/cd32.c -----------*/
src/mame/includes/micro3d.h
r14883r14884
9999   DECLARE_WRITE32_MEMBER(micro3d_fifo_w);
100100   DECLARE_WRITE32_MEMBER(micro3d_alt_fifo_w);
101101   DECLARE_READ32_MEMBER(micro3d_pipe_r);
102   DECLARE_CUSTOM_INPUT_MEMBER(botssa_hwchk_r);
102103};
103104
104105typedef struct _micro3d_vtx_
r14883r14884
115116
116117
117118
118CUSTOM_INPUT( botssa_hwchk_r );
119
120
121
122
123119void micro3d_duart_irq_handler(device_t *device, UINT8 vector);
124120UINT8 micro3d_duart_input_r(device_t *device);
125121void micro3d_duart_output_w(device_t *device, UINT8 data);
src/mame/includes/ultratnk.h
r14883r14884
2828   DECLARE_WRITE8_MEMBER(ultratnk_led_2_w);
2929   DECLARE_WRITE8_MEMBER(ultratnk_lockout_w);
3030   DECLARE_WRITE8_MEMBER(ultratnk_video_ram_w);
31   DECLARE_CUSTOM_INPUT_MEMBER(get_collision);
32   DECLARE_CUSTOM_INPUT_MEMBER(get_joystick);
3133};
3234
3335
src/mame/includes/gunbustr.h
r14883r14884
2626   DECLARE_READ32_MEMBER(gunbustr_gun_r);
2727   DECLARE_WRITE32_MEMBER(gunbustr_gun_w);
2828   DECLARE_READ32_MEMBER(main_cycle_r);
29   DECLARE_CUSTOM_INPUT_MEMBER(coin_word_r);
2930};
3031
3132
src/mame/includes/phoenix.h
r14883r14884
2525   DECLARE_WRITE8_MEMBER(pleiads_videoreg_w);
2626   DECLARE_WRITE8_MEMBER(phoenix_scroll_w);
2727   DECLARE_READ8_MEMBER(survival_input_port_0_r);
28   DECLARE_CUSTOM_INPUT_MEMBER(player_input_r);
29   DECLARE_CUSTOM_INPUT_MEMBER(pleiads_protection_r);
2830};
2931
3032
r14883r14884
6062SCREEN_UPDATE_IND16( phoenix );
6163
6264
63CUSTOM_INPUT( player_input_r );
64CUSTOM_INPUT( pleiads_protection_r );
6565READ8_DEVICE_HANDLER( survival_protection_r );
6666
6767READ_LINE_DEVICE_HANDLER( survival_sid_callback );
src/mame/includes/playch10.h
r14883r14884
8080   DECLARE_WRITE8_MEMBER(hboard_rom_switch_w);
8181   void pc10_set_mirroring(int mirroring);
8282   DECLARE_WRITE8_MEMBER(playch10_videoram_w);
83   DECLARE_CUSTOM_INPUT_MEMBER(pc10_int_detect_r);
8384};
8485
8586
r14883r14884
104105DRIVER_INIT( pchboard );   /* h-board games */
105106DRIVER_INIT( pciboard );   /* i-board games */
106107DRIVER_INIT( pckboard );   /* k-board games */
107CUSTOM_INPUT( pc10_int_detect_r );
108108
109109
110110
src/mame/includes/equites.h
r14883r14884
7979   DECLARE_WRITE16_MEMBER(splndrbt_flip1_w);
8080   DECLARE_WRITE16_MEMBER(splndrbt_bg_scrollx_w);
8181   DECLARE_WRITE16_MEMBER(splndrbt_bg_scrolly_w);
82   DECLARE_CUSTOM_INPUT_MEMBER(gekisou_unknown_status);
8283};
8384
8485
src/mame/includes/eolithsp.h
r14883r14884
33void eolith_speedup_read(address_space *space);
44void init_eolith_speedup(running_machine &machine);
55TIMER_DEVICE_CALLBACK( eolith_speedup );
6CUSTOM_INPUT( eolith_speedup_getvblank );
7CUSTOM_INPUT( stealsee_speedup_getvblank );
86
7
src/mame/includes/firetrk.h
r14883r14884
7272   DECLARE_WRITE8_MEMBER(montecar_drone_reset_w);
7373   DECLARE_WRITE8_MEMBER(steer_reset_w);
7474   DECLARE_WRITE8_MEMBER(crash_reset_w);
75   DECLARE_CUSTOM_INPUT_MEMBER(steer_dir_r);
76   DECLARE_CUSTOM_INPUT_MEMBER(steer_flag_r);
77   DECLARE_CUSTOM_INPUT_MEMBER(skid_r);
78   DECLARE_CUSTOM_INPUT_MEMBER(crash_r);
79   DECLARE_CUSTOM_INPUT_MEMBER(gear_r);
7580};
7681
7782
src/mame/includes/neogeo.h
r14883r14884
128128   DECLARE_WRITE16_MEMBER(neogeo_paletteram_w);
129129   DECLARE_READ16_MEMBER(neogeo_video_register_r);
130130   DECLARE_WRITE16_MEMBER(neogeo_video_register_w);
131   DECLARE_CUSTOM_INPUT_MEMBER(multiplexed_controller_r);
132   DECLARE_CUSTOM_INPUT_MEMBER(mahjong_controller_r);
133   DECLARE_CUSTOM_INPUT_MEMBER(get_calendar_status);
134   DECLARE_CUSTOM_INPUT_MEMBER(get_memcard_status);
135   DECLARE_CUSTOM_INPUT_MEMBER(get_audio_result);
131136};
132137
133138
src/mame/includes/konamigx.h
r14883r14884
4242   DECLARE_WRITE32_MEMBER(konamigx_tilebank_w);
4343   DECLARE_WRITE32_MEMBER(konamigx_t1_psacmap_w);
4444   DECLARE_WRITE32_MEMBER(konamigx_t4_psacmap_w);
45   DECLARE_CUSTOM_INPUT_MEMBER(gx_rdport1_3_r);
4546};
4647
4748
src/mame/includes/ladybug.h
r14883r14884
5151   DECLARE_WRITE8_MEMBER(ladybug_colorram_w);
5252   DECLARE_WRITE8_MEMBER(ladybug_flipscreen_w);
5353   DECLARE_WRITE8_MEMBER(sraider_io_w);
54   DECLARE_CUSTOM_INPUT_MEMBER(ladybug_p1_control_r);
55   DECLARE_CUSTOM_INPUT_MEMBER(ladybug_p2_control_r);
5456};
5557
5658
src/mame/includes/starshp1.h
r14883r14884
6767   DECLARE_WRITE8_MEMBER(starshp1_ssadd_w);
6868   DECLARE_WRITE8_MEMBER(starshp1_sspic_w);
6969   DECLARE_WRITE8_MEMBER(starshp1_playfield_w);
70   DECLARE_CUSTOM_INPUT_MEMBER(starshp1_analog_r);
71   DECLARE_CUSTOM_INPUT_MEMBER(collision_latch_r);
7072};
7173
7274
src/mame/includes/gottlieb.h
r14883r14884
253253   DECLARE_WRITE8_MEMBER(gottlieb_laserdisc_video_control_w);
254254   DECLARE_WRITE8_MEMBER(gottlieb_videoram_w);
255255   DECLARE_WRITE8_MEMBER(gottlieb_charram_w);
256   DECLARE_CUSTOM_INPUT_MEMBER(analog_delta_r);
257   DECLARE_CUSTOM_INPUT_MEMBER(stooges_joystick_r);
256258};
257259
258260
src/mame/includes/ddragon.h
r14883r14884
6060   device_t *m_adpcm_2;
6161   DECLARE_WRITE8_MEMBER(ddragon_bgvideoram_w);
6262   DECLARE_WRITE8_MEMBER(ddragon_fgvideoram_w);
63   DECLARE_CUSTOM_INPUT_MEMBER(sub_cpu_busy);
6364};
6465
6566
src/mame/includes/exidy.h
r14883r14884
4545   bitmap_ind16 m_motion_object_2_clip;
4646   DECLARE_WRITE8_MEMBER(fax_bank_select_w);
4747   DECLARE_READ8_MEMBER(exidy_interrupt_r);
48   DECLARE_CUSTOM_INPUT_MEMBER(teetert_input_r);
4849};
4950
5051
src/mame/includes/xxmissio.h
r14883r14884
2020   DECLARE_WRITE8_MEMBER(xxmissio_bgram_w);
2121   DECLARE_READ8_MEMBER(xxmissio_bgram_r);
2222   DECLARE_WRITE8_MEMBER(xxmissio_paletteram_w);
23   DECLARE_CUSTOM_INPUT_MEMBER(xxmissio_status_r);
2324};
2425
2526
src/mame/includes/groundfx.h
r14883r14884
3030   DECLARE_WRITE32_MEMBER(rotate_control_w);
3131   DECLARE_WRITE32_MEMBER(motor_control_w);
3232   DECLARE_READ32_MEMBER(irq_speedup_r_groundfx);
33   DECLARE_CUSTOM_INPUT_MEMBER(frame_counter_r);
34   DECLARE_CUSTOM_INPUT_MEMBER(coin_word_r);
3335};
3436
3537
src/mame/includes/cidelsa.h
r14883r14884
7070   UINT8 *m_pageram;
7171   UINT8 *m_pcbram;
7272   UINT8 *m_charram;
73   DECLARE_CUSTOM_INPUT_MEMBER(cdp1869_pcb_r);
7374};
7475
7576class draco_state : public cidelsa_state
src/mame/includes/m92.h
r14883r14884
5454   DECLARE_WRITE16_MEMBER(m92_pf2_control_w);
5555   DECLARE_WRITE16_MEMBER(m92_pf3_control_w);
5656   DECLARE_WRITE16_MEMBER(m92_master_control_w);
57   DECLARE_CUSTOM_INPUT_MEMBER(m92_sprite_busy_r);
5758};
5859
5960
src/mame/includes/wwfwfest.h
r14883r14884
3232   DECLARE_WRITE16_MEMBER(wwfwfest_fg0_videoram_w);
3333   DECLARE_WRITE16_MEMBER(wwfwfest_bg0_videoram_w);
3434   DECLARE_WRITE16_MEMBER(wwfwfest_bg1_videoram_w);
35   DECLARE_CUSTOM_INPUT_MEMBER(dsw_3f_r);
36   DECLARE_CUSTOM_INPUT_MEMBER(dsw_c0_r);
3537};
3638
3739
src/mame/includes/taito_f3.h
r14883r14884
216216   DECLARE_READ16_MEMBER(f3_lineram_r);
217217   DECLARE_WRITE16_MEMBER(f3_lineram_w);
218218   DECLARE_WRITE32_MEMBER(f3_palette_24bit_w);
219   DECLARE_CUSTOM_INPUT_MEMBER(f3_analog_r);
220   DECLARE_CUSTOM_INPUT_MEMBER(f3_coin_r);
219221};
220222
221223
src/mame/includes/gaelco2.h
r14883r14884
3636   DECLARE_WRITE16_MEMBER(snowboar_protection_w);
3737   DECLARE_WRITE16_MEMBER(gaelco2_vram_w);
3838   DECLARE_WRITE16_MEMBER(gaelco2_palette_w);
39   DECLARE_CUSTOM_INPUT_MEMBER(wrally2_analog_bit_r);
3940};
4041
4142
r14883r14884
4647DRIVER_INIT( snowboar );
4748DRIVER_INIT( bang );
4849TIMER_DEVICE_CALLBACK( bang_irq );
49CUSTOM_INPUT( wrally2_analog_bit_r );
5050WRITE16_DEVICE_HANDLER( gaelco2_eeprom_cs_w );
5151WRITE16_DEVICE_HANDLER( gaelco2_eeprom_sk_w );
5252WRITE16_DEVICE_HANDLER( gaelco2_eeprom_data_w );
src/mame/includes/homerun.h
r14883r14884
2727   int        m_gc_down;
2828   DECLARE_WRITE8_MEMBER(homerun_videoram_w);
2929   DECLARE_WRITE8_MEMBER(homerun_color_w);
30   DECLARE_CUSTOM_INPUT_MEMBER(homerun_40_r);
3031};
3132
3233
src/mame/includes/champbas.h
r14883r14884
4343   DECLARE_WRITE8_MEMBER(champbas_gfxbank_w);
4444   DECLARE_WRITE8_MEMBER(champbas_palette_bank_w);
4545   DECLARE_WRITE8_MEMBER(champbas_flipscreen_w);
46   DECLARE_CUSTOM_INPUT_MEMBER(champbas_watchdog_bit2);
4647};
4748
4849
src/mame/includes/arkanoid.h
r14883r14884
6262   DECLARE_WRITE8_MEMBER(arkanoid_d008_w);
6363   DECLARE_WRITE8_MEMBER(tetrsark_d008_w);
6464   DECLARE_WRITE8_MEMBER(hexa_d008_w);
65   DECLARE_CUSTOM_INPUT_MEMBER(arkanoid_68705_input_r);
66   DECLARE_CUSTOM_INPUT_MEMBER(arkanoid_input_mux);
6567};
6668
6769
r14883r14884
7476extern SCREEN_UPDATE_IND16( arkanoid );
7577extern SCREEN_UPDATE_IND16( hexa );
7678
77
78/*----------- defined in machine/arkanoid.c -----------*/
79
80
81
82
83extern CUSTOM_INPUT( arkanoid_68705_input_r );
84extern CUSTOM_INPUT( arkanoid_input_mux );
85
src/mame/includes/crshrace.h
r14883r14884
4040   DECLARE_WRITE16_MEMBER(crshrace_videoram2_w);
4141   DECLARE_WRITE16_MEMBER(crshrace_roz_bank_w);
4242   DECLARE_WRITE16_MEMBER(crshrace_gfxctrl_w);
43   DECLARE_CUSTOM_INPUT_MEMBER(country_sndpending_r);
4344};
4445
4546/*----------- defined in video/crshrace.c -----------*/
src/mame/includes/dcheese.h
r14883r14884
4242   DECLARE_WRITE16_MEMBER(madmax_blitter_vidparam_w);
4343   DECLARE_WRITE16_MEMBER(madmax_blitter_unknown_w);
4444   DECLARE_READ16_MEMBER(madmax_blitter_vidparam_r);
45   DECLARE_CUSTOM_INPUT_MEMBER(sound_latch_state_r);
4546};
4647
4748
src/mame/includes/cave.h
r14883r14884
148148   DECLARE_WRITE16_MEMBER(cave_vram_1_8x8_w);
149149   DECLARE_WRITE16_MEMBER(cave_vram_2_8x8_w);
150150   DECLARE_WRITE16_MEMBER(cave_vram_3_8x8_w);
151   DECLARE_CUSTOM_INPUT_MEMBER(korokoro_hopper_r);
152   DECLARE_CUSTOM_INPUT_MEMBER(tjumpman_hopper_r);
151153};
152154
153155/*----------- defined in video/cave.c -----------*/
src/mame/includes/williams.h
r14883r14884
6565   DECLARE_WRITE8_MEMBER(blaster_video_control_w);
6666   DECLARE_WRITE8_MEMBER(williams_blitter_w);
6767   DECLARE_WRITE8_MEMBER(williams2_blit_window_enable_w);
68   DECLARE_CUSTOM_INPUT_MEMBER(williams_mux_r);
6869};
6970
7071
r14883r14884
124125
125126/* banking */
126127
127/* misc */
128CUSTOM_INPUT( williams_mux_r );
129
130128/* Mayday protection */
131129
132130
src/mame/includes/rpunch.h
r14883r14884
2828   DECLARE_WRITE16_MEMBER(rpunch_crtc_data_w);
2929   DECLARE_WRITE16_MEMBER(rpunch_crtc_register_w);
3030   DECLARE_WRITE16_MEMBER(rpunch_ins_w);
31   DECLARE_CUSTOM_INPUT_MEMBER(hi_bits_r);
3132};
3233
3334
src/mame/includes/cloud9.h
r14883r14884
5252   DECLARE_READ8_MEMBER(cloud9_bitmode_r);
5353   DECLARE_WRITE8_MEMBER(cloud9_bitmode_w);
5454   DECLARE_WRITE8_MEMBER(cloud9_bitmode_addr_w);
55   DECLARE_CUSTOM_INPUT_MEMBER(get_vblank);
5556};
5657
5758
src/mame/includes/starwars.h
r14883r14884
5050   DECLARE_READ8_MEMBER(starwars_div_reh_r);
5151   DECLARE_READ8_MEMBER(starwars_div_rel_r);
5252   DECLARE_WRITE8_MEMBER(starwars_math_w);
53   DECLARE_CUSTOM_INPUT_MEMBER(matrix_flag_r);
5354};
5455
5556
5657/*----------- defined in machine/starwars.c -----------*/
5758
5859
59CUSTOM_INPUT( matrix_flag_r );
60
61
6260void starwars_mproc_init(running_machine &machine);
6361void starwars_mproc_reset(running_machine &machine);
6462
src/mame/includes/wolfpack.h
r14883r14884
4747   DECLARE_WRITE8_MEMBER(wolfpack_ship_pic_w);
4848   DECLARE_WRITE8_MEMBER(wolfpack_torpedo_h_w);
4949   DECLARE_WRITE8_MEMBER(wolfpack_torpedo_v_w);
50   DECLARE_CUSTOM_INPUT_MEMBER(wolfpack_dial_r);
5051};
5152
5253
src/mame/includes/pirates.h
r14883r14884
1717   DECLARE_WRITE16_MEMBER(pirates_tx_tileram_w);
1818   DECLARE_WRITE16_MEMBER(pirates_fg_tileram_w);
1919   DECLARE_WRITE16_MEMBER(pirates_bg_tileram_w);
20   DECLARE_CUSTOM_INPUT_MEMBER(prot_r);
2021};
2122
2223
src/mame/includes/exerion.h
r14883r14884
5050   DECLARE_WRITE8_MEMBER(exerion_videoreg_w);
5151   DECLARE_WRITE8_MEMBER(exerion_video_latch_w);
5252   DECLARE_READ8_MEMBER(exerion_video_timing_r);
53   DECLARE_CUSTOM_INPUT_MEMBER(exerion_controls_r);
5354};
5455
5556
src/mame/video/stactics.c
r14883r14884
111111 *
112112 *************************************/
113113
114CUSTOM_INPUT( stactics_get_frame_count_d3 )
114CUSTOM_INPUT_MEMBER(stactics_state::stactics_get_frame_count_d3)
115115{
116   stactics_state *state = field.machine().driver_data<stactics_state>();
117116
118   return (state->m_frame_count >> 3) & 0x01;
117   return (m_frame_count >> 3) & 0x01;
119118}
120119
121120
r14883r14884
166165}
167166
168167
169CUSTOM_INPUT( stactics_get_shot_standby )
168CUSTOM_INPUT_MEMBER(stactics_state::stactics_get_shot_standby)
170169{
171   stactics_state *state = field.machine().driver_data<stactics_state>();
172170
173   return state->m_shot_standby;
171   return m_shot_standby;
174172}
175173
176174
177CUSTOM_INPUT( stactics_get_not_shot_arrive )
175CUSTOM_INPUT_MEMBER(stactics_state::stactics_get_not_shot_arrive)
178176{
179   stactics_state *state = field.machine().driver_data<stactics_state>();
180177
181   return !state->m_shot_arrive;
178   return !m_shot_arrive;
182179}
183180
184181
src/mame/video/phoenix.c
r14883r14884
304304}
305305
306306
307CUSTOM_INPUT( player_input_r )
307CUSTOM_INPUT_MEMBER(phoenix_state::player_input_r)
308308{
309   phoenix_state *state = field.machine().driver_data<phoenix_state>();
310   if (state->m_cocktail_mode)
311      return (input_port_read(field.machine(), "CTRL") & 0xf0) >> 4;
309   if (m_cocktail_mode)
310      return (input_port_read(machine(), "CTRL") & 0xf0) >> 4;
312311   else
313      return (input_port_read(field.machine(), "CTRL") & 0x0f) >> 0;
312      return (input_port_read(machine(), "CTRL") & 0x0f) >> 0;
314313}
315314
316CUSTOM_INPUT( pleiads_protection_r )
315CUSTOM_INPUT_MEMBER(phoenix_state::pleiads_protection_r)
317316{
318   phoenix_state *state = field.machine().driver_data<phoenix_state>();
319317   /* handle Pleiads protection */
320   switch (state->m_pleiads_protection_question)
318   switch (m_pleiads_protection_question)
321319   {
322320   case 0x00:
323321   case 0x20:
r14883r14884
328326      /* Bit 3 is 1 */
329327      return 1;
330328   default:
331      logerror("%s:Unknown protection question %02X\n", field.machine().describe_context(), state->m_pleiads_protection_question);
329      logerror("%s:Unknown protection question %02X\n", machine().describe_context(), m_pleiads_protection_question);
332330      return 0;
333331   }
334332}
src/mame/drivers/fgoal.c
r14883r14884
103103}
104104
105105
106static CUSTOM_INPUT( fgoal_80_r )
106CUSTOM_INPUT_MEMBER(fgoal_state::fgoal_80_r)
107107{
108   UINT8 ret = (field.machine().primary_screen->vpos() & 0x80) ? 1 : 0;
108   UINT8 ret = (machine().primary_screen->vpos() & 0x80) ? 1 : 0;
109109
110110   return ret;
111111}
r14883r14884
257257   /* extra credit score changes depending on player's performance */
258258
259259   PORT_START("IN1")
260   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(fgoal_80_r, NULL) /* 128V */
260   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, fgoal_state,fgoal_80_r, NULL) /* 128V */
261261   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ))
262262   PORT_DIPSETTING(    0x00, DEF_STR( Upright ))
263263   PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ))
src/mame/drivers/expro02.c
r14883r14884
343343      {
344344         if(m_vram[0][i])
345345         {
346            kaneko16_vram_0_w(*&space, i+1, data << 8, 0xFF00);
346            kaneko16_vram_0_w(space, i+1, data << 8, 0xFF00);
347347         }
348348      }
349349      m_vram_0_bank_num = data;
r14883r14884
360360      {
361361         if(m_vram[1][i])
362362         {
363            kaneko16_vram_1_w(*&space, i+1, data << 8, 0xFF00);
363            kaneko16_vram_1_w(space, i+1, data << 8, 0xFF00);
364364         }
365365      }
366366      m_vram_1_bank_num = data;
src/mame/drivers/mainsnk.c
r14883r14884
132132   return 0xff;
133133}
134134
135static CUSTOM_INPUT( mainsnk_sound_r )
135CUSTOM_INPUT_MEMBER(mainsnk_state::mainsnk_sound_r)
136136{
137   mainsnk_state *state = field.machine().driver_data<mainsnk_state>();
138137
139   return (state->m_sound_cpu_busy) ? 0x01 : 0x00;
138   return (m_sound_cpu_busy) ? 0x01 : 0x00;
140139}
141140
142141
r14883r14884
181180   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )
182181   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
183182   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
184   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mainsnk_sound_r, NULL)   /* sound CPU status */
183   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mainsnk_state,mainsnk_sound_r, NULL)   /* sound CPU status */
185184   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
186185   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_SERVICE )
187186
r14883r14884
275274   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )
276275   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
277276   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
278   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mainsnk_sound_r, NULL)   /* sound CPU status */
277   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mainsnk_state,mainsnk_sound_r, NULL)   /* sound CPU status */
279278   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
280279   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_SERVICE )
281280
src/mame/drivers/ccastles.c
r14883r14884
171171}
172172
173173
174static CUSTOM_INPUT( get_vblank )
174CUSTOM_INPUT_MEMBER(ccastles_state::get_vblank)
175175{
176   ccastles_state *state = field.machine().driver_data<ccastles_state>();
177   int scanline = field.machine().primary_screen->vpos();
178   return state->m_syncprom[scanline & 0xff] & 1;
176   int scanline = machine().primary_screen->vpos();
177   return m_syncprom[scanline & 0xff] & 1;
179178}
180179
181180
r14883r14884
366365   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
367366   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT )
368367   PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
369   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_vblank, NULL)
368   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ccastles_state,get_vblank, NULL)
370369   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )               /* 1p Jump, non-cocktail start1 */
371370   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)      /* 2p Jump, non-cocktail start2 */
372371
src/mame/drivers/policetr.c
r14883r14884
178178}
179179
180180
181static CUSTOM_INPUT( bsmt_status_r )
181CUSTOM_INPUT_MEMBER(policetr_state::bsmt_status_r)
182182{
183   return field.machine().device<bsmt2000_device>("bsmt")->read_status();
183   return machine().device<bsmt2000_device>("bsmt")->read_status();
184184}
185185
186186
r14883r14884
321321   PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_UNKNOWN )
322322   PORT_SERVICE( 0x00200000, IP_ACTIVE_LOW )      /* Not actually a dipswitch */
323323   PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_UNKNOWN )
324   PORT_BIT( 0x00800000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(bsmt_status_r, NULL)
324   PORT_BIT( 0x00800000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, policetr_state,bsmt_status_r, NULL)
325325   PORT_BIT( 0x01000000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
326326   PORT_BIT( 0x02000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
327327   PORT_BIT( 0x04000000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
src/mame/drivers/jedi.c
r14883r14884
320320   PORT_BIT( 0x03, IP_ACTIVE_LOW,  IPT_UNUSED )
321321   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_TILT )
322322   PORT_BIT( 0x18, IP_ACTIVE_LOW,  IPT_UNUSED )
323   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(jedi_audio_comm_stat_r, NULL)
323   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF,jedi_state,jedi_audio_comm_stat_r, NULL)
324324   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
325325
326326   PORT_START("STICKY")   /* analog Y */
src/mame/drivers/zn.c
r14883r14884
5555   int m_cbaj_to_z80;
5656   int m_cbaj_to_r3k;
5757   int m_latch_to_z80;
58   DECLARE_CUSTOM_INPUT_MEMBER(jdredd_gun_mux_read);
5859};
5960
6061INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... )
r14883r14884
20422043   }
20432044}
20442045
2045static CUSTOM_INPUT( jdredd_gun_mux_read )
2046CUSTOM_INPUT_MEMBER(zn_state::jdredd_gun_mux_read)
20462047{
2047   zn_state *state = field.machine().driver_data<zn_state>();
20482048
2049   return state->m_jdredd_gun_mux;
2049   return m_jdredd_gun_mux;
20502050}
20512051
20522052void jdredd_vblank(zn_state *state, screen_device &screen, bool vblank_state)
r14883r14884
27462746   PORT_BIT( 0x6f, IP_ACTIVE_LOW, IPT_UNUSED )
27472747
27482748   PORT_MODIFY("SERVICE")
2749   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(jdredd_gun_mux_read, NULL)
2749   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, zn_state,jdredd_gun_mux_read, NULL)
27502750   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
27512751   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
27522752
src/mame/drivers/balsente.c
r14883r14884
877877   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "G1:7" )
878878
879879   PORT_MODIFY("IN0")
880   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(nstocker_bits_r, NULL)
880   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, balsente_state,nstocker_bits_r, NULL)
881881
882882   /* cheese alert -- we have to map this to player 2 so that it doesn't interfere with
883883       the crosshair controls */
src/mame/drivers/midzeus.c
r14883r14884
420420 *
421421 *************************************/
422422
423static CUSTOM_INPUT( custom_49way_r )
423CUSTOM_INPUT_MEMBER(midzeus_state::custom_49way_r)
424424{
425425   static const UINT8 translate49[7] = { 0x8, 0xc, 0xe, 0xf, 0x3, 0x1, 0x0 };
426426   const char *namex = (const char *)param;
427427   const char *namey = namex + strlen(namex) + 1;
428   return (translate49[input_port_read(field.machine(), namey) >> 4] << 4) | translate49[input_port_read(field.machine(), namex) >> 4];
428   return (translate49[input_port_read(machine(), namey) >> 4] << 4) | translate49[input_port_read(machine(), namex) >> 4];
429429}
430430
431431
r14883r14884
436436}
437437
438438
439static CUSTOM_INPUT( keypad_r )
439CUSTOM_INPUT_MEMBER(midzeus_state::keypad_r)
440440{
441   UINT32 bits = input_port_read(field.machine(), (const char *)param);
441   UINT32 bits = input_port_read(machine(), (const char *)param);
442442   UINT8 select = keypad_select;
443443   while ((select & 1) != 0)
444444   {
r14883r14884
931931   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
932932
933933   PORT_START("IN2")
934   PORT_BIT( 0x0007, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM( keypad_r, "KEYPAD" )
934   PORT_BIT( 0x0007, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, midzeus_state, keypad_r, "KEYPAD" )
935935   PORT_BIT( 0xfff8, IP_ACTIVE_LOW, IPT_UNUSED )
936936
937937   PORT_START("KEYPAD")
r14883r14884
10671067   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
10681068
10691069   PORT_START("IN2")
1070   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(custom_49way_r, "49WAYX\0" "49WAYY")
1070   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, midzeus_state,custom_49way_r, "49WAYX\0" "49WAYY")
10711071   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
10721072
10731073   PORT_START("49WAYX")
src/mame/drivers/zaxxon.c
r14883r14884
350350}
351351
352352
353static CUSTOM_INPUT( razmataz_dial_r )
353CUSTOM_INPUT_MEMBER(zaxxon_state::razmataz_dial_r)
354354{
355   zaxxon_state *state = field.machine().driver_data<zaxxon_state>();
356355   static const char *const dialname[2] = { "DIAL0", "DIAL1" };
357356   int num = (FPTR)param;
358357   int delta, res;
359358
360   delta = input_port_read(field.machine(), dialname[num]);
359   delta = input_port_read(machine(), dialname[num]);
361360
362361   if (delta < 0x80)
363362   {
364363      // right
365      state->m_razmataz_dial_pos[num] -= delta;
366      res = (state->m_razmataz_dial_pos[num] << 1) | 1;
364      m_razmataz_dial_pos[num] -= delta;
365      res = (m_razmataz_dial_pos[num] << 1) | 1;
367366   }
368367   else
369368   {
370369      // left
371      state->m_razmataz_dial_pos[num] += delta;
372      res = (state->m_razmataz_dial_pos[num] << 1);
370      m_razmataz_dial_pos[num] += delta;
371      res = (m_razmataz_dial_pos[num] << 1);
373372   }
374373
375374   return res;
r14883r14884
411410}
412411
413412
414static CUSTOM_INPUT( zaxxon_coin_r )
413CUSTOM_INPUT_MEMBER(zaxxon_state::zaxxon_coin_r)
415414{
416   zaxxon_state *state = field.machine().driver_data<zaxxon_state>();
417415
418   return state->m_coin_status[(int)(FPTR)param];
416   return m_coin_status[(int)(FPTR)param];
419417}
420418
421419
r14883r14884
514512   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
515513   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
516514   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
517   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)0)
518   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)1)
519   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)2)
515   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaxxon_state,zaxxon_coin_r, (void *)0)
516   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaxxon_state,zaxxon_coin_r, (void *)1)
517   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaxxon_state,zaxxon_coin_r, (void *)2)
520518
521519   PORT_START("COIN")
522520   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )    PORT_CHANGED(zaxxon_coin_inserted, (void *)0)
r14883r14884
675673
676674static INPUT_PORTS_START( razmataz )
677675   PORT_START("SW00")
678   PORT_BIT( 0xff, 0x00, IPT_SPECIAL) PORT_CUSTOM(razmataz_dial_r, (void *)0)
676   PORT_BIT( 0xff, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaxxon_state,razmataz_dial_r, (void *)0)
679677
680678   PORT_START("DIAL0")
681679   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_RESET PORT_PLAYER(1)
r14883r14884
690688   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
691689
692690   PORT_START("SW08")
693   PORT_BIT( 0xff, 0x00, IPT_SPECIAL) PORT_CUSTOM(razmataz_dial_r, (void *)1)
691   PORT_BIT( 0xff, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaxxon_state,razmataz_dial_r, (void *)1)
694692
695693   PORT_START("DIAL1")
696694   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_RESET PORT_PLAYER(2)
r14883r14884
703701
704702   PORT_START("SW100")
705703   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNUSED )
706   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)0)
707   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)1)
708   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(zaxxon_coin_r, (void *)2)
704   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaxxon_state,zaxxon_coin_r, (void *)0)
705   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaxxon_state,zaxxon_coin_r, (void *)1)
706   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaxxon_state,zaxxon_coin_r, (void *)2)
709707
710708   PORT_START("COIN")
711709   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )    PORT_CHANGED(zaxxon_coin_inserted, (void *)0)
r14883r14884
768766   PORT_INCLUDE(zaxxon)
769767
770768   PORT_MODIFY("SW00")
771   PORT_BIT( 0xff, 0x00, IPT_SPECIAL) PORT_CUSTOM(razmataz_dial_r, (void *)0)
769   PORT_BIT( 0xff, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaxxon_state,razmataz_dial_r, (void *)0)
772770
773771   PORT_START("DIAL0")
774772   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_RESET
src/mame/drivers/punchout.c
r14883r14884
119119#include "includes/punchout.h"
120120
121121
122static CUSTOM_INPUT( punchout_vlm5030_busy_r )
122CUSTOM_INPUT_MEMBER(punchout_state::punchout_vlm5030_busy_r)
123123{
124124   /* bit 4 of DSW1 is busy pin level */
125   return (vlm5030_bsy(field.machine().device("vlm"))) ? 0x00 : 0x01;
125   return (vlm5030_bsy(machine().device("vlm"))) ? 0x00 : 0x01;
126126}
127127
128128static WRITE8_DEVICE_HANDLER( punchout_speech_reset_w )
r14883r14884
437437   PORT_DIPSETTING(    0x0a, DEF_STR( 1C_5C ) )
438438   PORT_DIPSETTING(    0x07, DEF_STR( 1C_6C ) )
439439   PORT_DIPSETTING(    0x0f, DEF_STR( Free_Play ) )
440   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(punchout_vlm5030_busy_r, NULL)   /* VLM5030 busy signal */
440   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, punchout_state,punchout_vlm5030_busy_r, NULL)   /* VLM5030 busy signal */
441441   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
442442   PORT_DIPUNUSED_DIPLOC( 0x40, 0x00, "R18:!1" )      /* Not documented, R18 resistor */
443443   PORT_DIPNAME( 0x80, 0x00, "Copyright" )            PORT_DIPLOCATION("R19:!1") /* Not documented, R19 resistor */
r14883r14884
868868   PORT_DIPSETTING(    0x0d, "1101" )
869869   PORT_DIPSETTING(    0x0e, "1110" )
870870   PORT_DIPSETTING(    0x0f, "1111" )
871   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(punchout_vlm5030_busy_r, NULL)   /* VLM5030 busy signal */
871   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, punchout_state,punchout_vlm5030_busy_r, NULL)   /* VLM5030 busy signal */
872872   PORT_DIPNAME( 0x40, 0x00, "Coin Slots" )         PORT_DIPLOCATION("R18:!1") /* R18 resistor */
873873   PORT_DIPSETTING(    0x40, "1" )
874874   PORT_DIPSETTING(    0x00, "2" )
src/mame/drivers/ddenlovr.c
r14883r14884
283283   state->m_ddenlovr_blit_flip = data;
284284}
285285
286WRITE8_HANDLER( ddenlovr_bgcolor_w )
286WRITE8_MEMBER(dynax_state::ddenlovr_bgcolor_w)
287287{
288   dynax_state *state = space->machine().driver_data<dynax_state>();
289   state->m_ddenlovr_bgcolor = data;
288   m_ddenlovr_bgcolor = data;
290289}
291290
292static WRITE8_HANDLER( ddenlovr_bgcolor2_w )
291WRITE8_MEMBER(dynax_state::ddenlovr_bgcolor2_w)
293292{
294   dynax_state *state = space->machine().driver_data<dynax_state>();
295   state->m_ddenlovr_bgcolor2 = data;
293   m_ddenlovr_bgcolor2 = data;
296294}
297295
298static WRITE16_HANDLER( ddenlovr16_bgcolor_w )
296WRITE16_MEMBER(dynax_state::ddenlovr16_bgcolor_w)
299297{
300298   if (ACCESSING_BITS_0_7)
301299      ddenlovr_bgcolor_w(space, offset, data);
302300}
303301
304302
305WRITE8_HANDLER( ddenlovr_priority_w )
303WRITE8_MEMBER(dynax_state::ddenlovr_priority_w)
306304{
307   dynax_state *state = space->machine().driver_data<dynax_state>();
308   state->m_ddenlovr_priority = data;
305   m_ddenlovr_priority = data;
309306}
310307
311static WRITE8_HANDLER( ddenlovr_priority2_w )
308WRITE8_MEMBER(dynax_state::ddenlovr_priority2_w)
312309{
313   dynax_state *state = space->machine().driver_data<dynax_state>();
314   state->m_ddenlovr_priority2 = data;
310   m_ddenlovr_priority2 = data;
315311}
316312
317static WRITE16_HANDLER( ddenlovr16_priority_w )
313WRITE16_MEMBER(dynax_state::ddenlovr16_priority_w)
318314{
319315   if (ACCESSING_BITS_0_7)
320316      ddenlovr_priority_w(space, offset, data);
321317}
322318
323319
324WRITE8_HANDLER( ddenlovr_layer_enable_w )
320WRITE8_MEMBER(dynax_state::ddenlovr_layer_enable_w)
325321{
326   dynax_state *state = space->machine().driver_data<dynax_state>();
327   state->m_ddenlovr_layer_enable = data;
322   m_ddenlovr_layer_enable = data;
328323}
329324
330static WRITE8_HANDLER( ddenlovr_layer_enable2_w )
325WRITE8_MEMBER(dynax_state::ddenlovr_layer_enable2_w)
331326{
332   dynax_state *state = space->machine().driver_data<dynax_state>();
333   state->m_ddenlovr_layer_enable2 = data;
327   m_ddenlovr_layer_enable2 = data;
334328}
335329
336330
337static WRITE16_HANDLER( ddenlovr16_layer_enable_w )
331WRITE16_MEMBER(dynax_state::ddenlovr16_layer_enable_w)
338332{
339333   if (ACCESSING_BITS_0_7)
340334      ddenlovr_layer_enable_w(space, offset, data);
r14883r14884
10131007
10141008
10151009
1016static WRITE8_HANDLER( hanakanz_blitter_reg_w )
1010WRITE8_MEMBER(dynax_state::hanakanz_blitter_reg_w)
10171011{
1018   dynax_state *state = space->machine().driver_data<dynax_state>();
1019   state->m_ddenlovr_blit_latch = data;
1012   m_ddenlovr_blit_latch = data;
10201013}
10211014
10221015// differences wrt blitter_data_w: registers are shuffled around, hi_bits in the low bits, clip_w/h, includes layers registers
1023static WRITE8_HANDLER( hanakanz_blitter_data_w )
1016WRITE8_MEMBER(dynax_state::hanakanz_blitter_data_w)
10241017{
1025   dynax_state *state = space->machine().driver_data<dynax_state>();
10261018   int hi_bits;
10271019
10281020g_profiler.start(PROFILER_VIDEO);
10291021
1030   hi_bits = (state->m_ddenlovr_blit_latch & 0x03) << 8;
1022   hi_bits = (m_ddenlovr_blit_latch & 0x03) << 8;
10311023
1032   switch (state->m_ddenlovr_blit_latch & 0xfe)
1024   switch (m_ddenlovr_blit_latch & 0xfe)
10331025   {
10341026      case 0x00:
1035         state->m_ddenlovr_dest_layer = data;
1027         m_ddenlovr_dest_layer = data;
10361028         break;
10371029
10381030      case 0x04:
r14883r14884
10401032         break;
10411033
10421034      case 0x08:
1043         state->m_ddenlovr_blit_y = data | hi_bits;
1035         m_ddenlovr_blit_y = data | hi_bits;
10441036         break;
10451037
10461038      case 0x0c:
1047         ddenlovr_blit_flip_w(space->machine(), data);
1039         ddenlovr_blit_flip_w(machine(), data);
10481040         break;
10491041
10501042      case 0x10:
1051         state->m_ddenlovr_blit_pen = data;
1043         m_ddenlovr_blit_pen = data;
10521044         break;
10531045
10541046      case 0x14:
1055         state->m_ddenlovr_blit_pen_mask = data;
1047         m_ddenlovr_blit_pen_mask = data;
10561048         break;
10571049
10581050      case 0x18:
10591051         // related to pen, can be 0 or 1 for 0x10 blitter command
10601052         // 0 = only bits 7-4 of ddenlovr_blit_pen contain data
10611053         // 1 = bits 3-0 contain data as well
1062         state->m_ddenlovr_blit_pen_mode = data;
1054         m_ddenlovr_blit_pen_mode = data;
10631055         break;
10641056
10651057      case 0x28:
1066         state->m_ddenlovr_rect_width = data | hi_bits;
1058         m_ddenlovr_rect_width = data | hi_bits;
10671059         break;
10681060
10691061      case 0x2c:
1070         state->m_ddenlovr_rect_height = data | hi_bits;
1062         m_ddenlovr_rect_height = data | hi_bits;
10711063         break;
10721064
10731065      case 0x30:
1074         state->m_ddenlovr_line_length = data | hi_bits;
1066         m_ddenlovr_line_length = data | hi_bits;
10751067         break;
10761068
10771069      case 0x34:
1078         state->m_ddenlovr_blit_address = (state->m_ddenlovr_blit_address & 0xffff00) | (data <<  0);
1070         m_ddenlovr_blit_address = (m_ddenlovr_blit_address & 0xffff00) | (data <<  0);
10791071         break;
10801072      case 0x38:
1081         state->m_ddenlovr_blit_address = (state->m_ddenlovr_blit_address & 0xff00ff) | (data <<  8);
1073         m_ddenlovr_blit_address = (m_ddenlovr_blit_address & 0xff00ff) | (data <<  8);
10821074         break;
10831075      case 0x3c:
1084         state->m_ddenlovr_blit_address = (state->m_ddenlovr_blit_address & 0x00ffff) | (data << 16);
1076         m_ddenlovr_blit_address = (m_ddenlovr_blit_address & 0x00ffff) | (data << 16);
10851077         break;
10861078
10871079      case 0x50:
1088         state->m_ddenlovr_blit_x = data | hi_bits;
1080         m_ddenlovr_blit_x = data | hi_bits;
10891081         break;
10901082
10911083      case 0x58:
1092         state->m_ddenlovr_clip_x = data | hi_bits;
1084         m_ddenlovr_clip_x = data | hi_bits;
10931085         break;
10941086
10951087      case 0x5c:
1096         state->m_ddenlovr_clip_y = data | hi_bits;
1088         m_ddenlovr_clip_y = data | hi_bits;
10971089         break;
10981090
10991091      case 0x60:
r14883r14884
11041096      case 0x74:
11051097      case 0x78:
11061098      case 0x7c:
1107         state->m_ddenlovr_scroll[(state->m_ddenlovr_blit_latch & 0x1c) >> 2] = data | hi_bits;
1099         m_ddenlovr_scroll[(m_ddenlovr_blit_latch & 0x1c) >> 2] = data | hi_bits;
11081100         break;
11091101
11101102      case 0x80:
1111         state->m_ddenlovr_clip_ctrl = data;
1103         m_ddenlovr_clip_ctrl = data;
11121104         break;
11131105
11141106      case 0x88:
11151107      case 0x8a:   // can be 3ff
1116         state->m_ddenlovr_clip_height = data | hi_bits;
1108         m_ddenlovr_clip_height = data | hi_bits;
11171109         break;
11181110
11191111      case 0x8c:
11201112      case 0x8e:   // can be 3ff
1121         state->m_ddenlovr_clip_width = data | hi_bits;
1113         m_ddenlovr_clip_width = data | hi_bits;
11221114         break;
11231115
11241116      case 0xc0:
11251117      case 0xc2:
11261118      case 0xc4:
11271119      case 0xc6:
1128         state->m_ddenlovr_palette_base[(state->m_ddenlovr_blit_latch >> 1) & 3] = data | (hi_bits & 0x100);
1120         m_ddenlovr_palette_base[(m_ddenlovr_blit_latch >> 1) & 3] = data | (hi_bits & 0x100);
11291121         break;
11301122
11311123      case 0xc8:
11321124      case 0xca:
11331125      case 0xcc:
11341126      case 0xce:
1135         state->m_ddenlovr_palette_mask[(state->m_ddenlovr_blit_latch >> 1) & 3] = data;
1127         m_ddenlovr_palette_mask[(m_ddenlovr_blit_latch >> 1) & 3] = data;
11361128         break;
11371129
11381130      case 0xd0:
11391131      case 0xd2:
11401132      case 0xd4:
11411133      case 0xd6:
1142         state->m_ddenlovr_transparency_pen[(state->m_ddenlovr_blit_latch >> 1) & 3] = data;
1134         m_ddenlovr_transparency_pen[(m_ddenlovr_blit_latch >> 1) & 3] = data;
11431135         break;
11441136
11451137      case 0xd8:
11461138      case 0xda:
11471139      case 0xdc:
11481140      case 0xde:
1149         state->m_ddenlovr_transparency_mask[(state->m_ddenlovr_blit_latch >> 1) & 3] = data;
1141         m_ddenlovr_transparency_mask[(m_ddenlovr_blit_latch >> 1) & 3] = data;
11501142         break;
11511143
11521144      case 0xe4:
r14883r14884
11581150         break;
11591151
11601152      case 0xe8:
1161         state->m_ddenlovr_bgcolor = data | hi_bits;
1153         m_ddenlovr_bgcolor = data | hi_bits;
11621154         break;
11631155
11641156      case 0x90:
11651157
1166         log_blit(space->machine(), data);
1158         log_blit(machine(), data);
11671159
11681160         switch (data)
11691161         {
1170            case 0x04:   blit_fill_xy(space->machine(), 0, 0);
1162            case 0x04:   blit_fill_xy(machine(), 0, 0);
11711163                     break;
1172            case 0x14:   blit_fill_xy(space->machine(), state->m_ddenlovr_blit_x, state->m_ddenlovr_blit_y);
1164            case 0x14:   blit_fill_xy(machine(), m_ddenlovr_blit_x, m_ddenlovr_blit_y);
11731165                     break;
11741166
1175            case 0x10:   state->m_ddenlovr_blit_address = blit_draw(space->machine(), state->m_ddenlovr_blit_address, state->m_ddenlovr_blit_x);
1167            case 0x10:   m_ddenlovr_blit_address = blit_draw(machine(), m_ddenlovr_blit_address, m_ddenlovr_blit_x);
11761168                     break;
11771169
1178            case 0x13:   blit_horiz_line(space->machine());
1170            case 0x13:   blit_horiz_line(machine());
11791171                     break;
1180            case 0x1b:   blit_vert_line(space->machine());
1172            case 0x1b:   blit_vert_line(machine());
11811173                     break;
11821174
1183            case 0x1c:   blit_rect_xywh(space->machine());
1175            case 0x1c:   blit_rect_xywh(machine());
11841176                     break;
11851177
11861178            // These two are issued one after the other (43 then 8c)
11871179            // 8c is issued immediately after 43 has finished, without
11881180            // changing any argument
11891181            case 0x43:   break;
1190            case 0x8c:   blit_rect_yh(space->machine());
1182            case 0x8c:   blit_rect_yh(machine());
11911183                     break;
11921184
11931185            default:
11941186                     ;
11951187            #ifdef MAME_DEBUG
11961188               popmessage("unknown blitter command %02x", data);
1197               logerror("%06x: unknown blitter command %02x\n", cpu_get_pc(&space->device()), data);
1189               logerror("%06x: unknown blitter command %02x\n", cpu_get_pc(&space.device()), data);
11981190            #endif
11991191         }
12001192
r14883r14884
12031195         break;
12041196
12051197      default:
1206         logerror("%06x: Blitter 0 reg %02x = %02x\n", cpu_get_pc(&space->device()), state->m_ddenlovr_blit_latch, data);
1198         logerror("%06x: Blitter 0 reg %02x = %02x\n", cpu_get_pc(&space.device()), m_ddenlovr_blit_latch, data);
12071199         break;
12081200   }
12091201
r14883r14884
12111203}
12121204
12131205
1214static WRITE8_HANDLER( rongrong_blitter_w )
1206WRITE8_MEMBER(dynax_state::rongrong_blitter_w)
12151207{
1216   blitter_w(space, 0, offset, data, 0xf8);
1208   blitter_w(&space, 0, offset, data, 0xf8);
12171209}
12181210
1219static WRITE16_HANDLER( ddenlovr_blitter_w )
1211WRITE16_MEMBER(dynax_state::ddenlovr_blitter_w)
12201212{
12211213   if (ACCESSING_BITS_0_7)
1222      blitter_w(space, 0, offset, data & 0xff, 0);
1214      blitter_w(&space, 0, offset, data & 0xff, 0);
12231215}
12241216
12251217
1226static WRITE16_HANDLER( ddenlovr_blitter_irq_ack_w )
1218WRITE16_MEMBER(dynax_state::ddenlovr_blitter_irq_ack_w)
12271219{
1228   dynax_state *state = space->machine().driver_data<dynax_state>();
12291220
12301221   if (ACCESSING_BITS_0_7)
12311222   {
12321223      if (data & 1)
12331224      {
1234         state->m_ddenlovr_blitter_irq_enable = 1;
1225         m_ddenlovr_blitter_irq_enable = 1;
12351226      }
12361227      else
12371228      {
1238         state->m_ddenlovr_blitter_irq_enable = 0;
1239         state->m_ddenlovr_blitter_irq_flag = 0;
1229         m_ddenlovr_blitter_irq_enable = 0;
1230         m_ddenlovr_blitter_irq_flag = 0;
12401231      }
12411232   }
12421233}
12431234
12441235
1245static READ8_HANDLER( rongrong_gfxrom_r )
1236READ8_MEMBER(dynax_state::rongrong_gfxrom_r)
12461237{
1247   dynax_state *state = space->machine().driver_data<dynax_state>();
1248   UINT8 *rom  = space->machine().region("blitter")->base();
1249   size_t size = space->machine().region("blitter")->bytes();
1250   int address = state->m_ddenlovr_blit_address;
1238   UINT8 *rom  = machine().region("blitter")->base();
1239   size_t size = machine().region("blitter")->bytes();
1240   int address = m_ddenlovr_blit_address;
12511241
12521242   if (address >= size)
12531243   {
1254      logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", cpu_get_pc(&space->device()), address);
1244      logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", cpu_get_pc(&space.device()), address);
12551245      address %= size;
12561246   }
12571247
1258   state->m_ddenlovr_blit_address = (state->m_ddenlovr_blit_address + 1) & 0xffffff;
1248   m_ddenlovr_blit_address = (m_ddenlovr_blit_address + 1) & 0xffffff;
12591249
12601250   return rom[address];
12611251}
12621252
1263static READ16_HANDLER( ddenlovr_gfxrom_r )
1253READ16_MEMBER(dynax_state::ddenlovr_gfxrom_r)
12641254{
12651255   return rongrong_gfxrom_r(space, offset);
12661256}
r14883r14884
14071397   return 0;
14081398}
14091399
1410static CUSTOM_INPUT( ddenlovr_special_r )
1400CUSTOM_INPUT_MEMBER(dynax_state::ddenlovr_special_r)
14111401{
1412   dynax_state *state = field.machine().driver_data<dynax_state>();
1413   return state->m_ddenlovr_blitter_irq_flag;
1402   return m_ddenlovr_blitter_irq_flag;
14141403}
14151404
1416static WRITE16_HANDLER( ddenlovr_coincounter_0_w )
1405WRITE16_MEMBER(dynax_state::ddenlovr_coincounter_0_w)
14171406{
14181407   if (ACCESSING_BITS_0_7)
1419      coin_counter_w(space->machine(), 0, data & 1);
1408      coin_counter_w(machine(), 0, data & 1);
14201409}
1421static WRITE16_HANDLER( ddenlovr_coincounter_1_w )
1410WRITE16_MEMBER(dynax_state::ddenlovr_coincounter_1_w)
14221411{
14231412   if (ACCESSING_BITS_0_7)
1424      coin_counter_w(space->machine(), 1, data & 1);
1413      coin_counter_w(machine(), 1, data & 1);
14251414}
14261415
14271416
1428static WRITE8_HANDLER( rongrong_palette_w )
1417WRITE8_MEMBER(dynax_state::rongrong_palette_w)
14291418{
1430   dynax_state *state = space->machine().driver_data<dynax_state>();
14311419   int r, g, b, d1, d2, indx;
14321420
1433   state->m_palram[offset] = data;
1421   m_palram[offset] = data;
14341422
14351423   indx = ((offset & 0x1e0) >> 1) | (offset & 0x00f);
1436   d1 = state->m_palram[offset & ~0x10];
1437   d2 = state->m_palram[offset |  0x10];
1424   d1 = m_palram[offset & ~0x10];
1425   d2 = m_palram[offset |  0x10];
14381426
14391427   r = d1 & 0x1f;
14401428   g = d2 & 0x1f;
14411429   /* what were they smoking??? */
14421430   b = ((d1 & 0xe0) >> 5) | (d2 & 0xc0) >> 3;
14431431
1444   palette_set_color_rgb(space->machine(), indx, pal5bit(r), pal5bit(g), pal5bit(b));
1432   palette_set_color_rgb(machine(), indx, pal5bit(r), pal5bit(g), pal5bit(b));
14451433}
14461434
1447static WRITE16_HANDLER( ddenlovr_palette_w )
1435WRITE16_MEMBER(dynax_state::ddenlovr_palette_w)
14481436{
14491437   if (ACCESSING_BITS_0_7)
14501438      rongrong_palette_w(space, offset, data & 0xff);
14511439}
14521440
14531441
1454WRITE8_HANDLER( ddenlovr_palette_base_w )
1442WRITE8_MEMBER(dynax_state::ddenlovr_palette_base_w)
14551443{
1456   dynax_state *state = space->machine().driver_data<dynax_state>();
1457   state->m_ddenlovr_palette_base[offset] = data;
1444   m_ddenlovr_palette_base[offset] = data;
14581445}
14591446
1460static WRITE8_HANDLER( ddenlovr_palette_base2_w )
1447WRITE8_MEMBER(dynax_state::ddenlovr_palette_base2_w)
14611448{
1462   dynax_state *state = space->machine().driver_data<dynax_state>();
1463   state->m_ddenlovr_palette_base[offset + 4] = data;
1449   m_ddenlovr_palette_base[offset + 4] = data;
14641450}
14651451
1466WRITE8_HANDLER( ddenlovr_palette_mask_w )
1452WRITE8_MEMBER(dynax_state::ddenlovr_palette_mask_w)
14671453{
1468   dynax_state *state = space->machine().driver_data<dynax_state>();
1469   state->m_ddenlovr_palette_mask[offset] = data;
1454   m_ddenlovr_palette_mask[offset] = data;
14701455}
14711456
1472static WRITE8_HANDLER( ddenlovr_palette_mask2_w )
1457WRITE8_MEMBER(dynax_state::ddenlovr_palette_mask2_w)
14731458{
1474   dynax_state *state = space->machine().driver_data<dynax_state>();
1475   state->m_ddenlovr_palette_mask[offset + 4] = data;
1459   m_ddenlovr_palette_mask[offset + 4] = data;
14761460}
14771461
14781462
1479WRITE8_HANDLER( ddenlovr_transparency_pen_w )
1463WRITE8_MEMBER(dynax_state::ddenlovr_transparency_pen_w)
14801464{
1481   dynax_state *state = space->machine().driver_data<dynax_state>();
1482   state->m_ddenlovr_transparency_pen[offset] = data;
1465   m_ddenlovr_transparency_pen[offset] = data;
14831466}
14841467
1485static WRITE8_HANDLER( ddenlovr_transparency_pen2_w )
1468WRITE8_MEMBER(dynax_state::ddenlovr_transparency_pen2_w)
14861469{
1487   dynax_state *state = space->machine().driver_data<dynax_state>();
1488   state->m_ddenlovr_transparency_pen[offset + 4] = data;
1470   m_ddenlovr_transparency_pen[offset + 4] = data;
14891471}
14901472
14911473
1492WRITE8_HANDLER( ddenlovr_transparency_mask_w )
1474WRITE8_MEMBER(dynax_state::ddenlovr_transparency_mask_w)
14931475{
1494   dynax_state *state = space->machine().driver_data<dynax_state>();
1495   state->m_ddenlovr_transparency_mask[offset] = data;
1476   m_ddenlovr_transparency_mask[offset] = data;
14961477}
14971478
1498static WRITE8_HANDLER( ddenlovr_transparency_mask2_w )
1479WRITE8_MEMBER(dynax_state::ddenlovr_transparency_mask2_w)
14991480{
1500   dynax_state *state = space->machine().driver_data<dynax_state>();
1501   state->m_ddenlovr_transparency_mask[offset + 4] = data;
1481   m_ddenlovr_transparency_mask[offset + 4] = data;
15021482}
15031483
15041484
1505static WRITE16_HANDLER( ddenlovr16_palette_base_w )
1485WRITE16_MEMBER(dynax_state::ddenlovr16_palette_base_w)
15061486{
1507   dynax_state *state = space->machine().driver_data<dynax_state>();
15081487
15091488   if (ACCESSING_BITS_0_7)
1510      state->m_ddenlovr_palette_base[offset] = data & 0xff;
1489      m_ddenlovr_palette_base[offset] = data & 0xff;
15111490}
15121491
1513static WRITE16_HANDLER( ddenlovr16_palette_mask_w )
1492WRITE16_MEMBER(dynax_state::ddenlovr16_palette_mask_w)
15141493{
1515   dynax_state *state = space->machine().driver_data<dynax_state>();
15161494
15171495   if (ACCESSING_BITS_0_7)
1518      state->m_ddenlovr_palette_mask[offset] = data & 0xff;
1496      m_ddenlovr_palette_mask[offset] = data & 0xff;
15191497}
15201498
1521static WRITE16_HANDLER( ddenlovr16_transparency_pen_w )
1499WRITE16_MEMBER(dynax_state::ddenlovr16_transparency_pen_w)
15221500{
1523   dynax_state *state = space->machine().driver_data<dynax_state>();
15241501
15251502   if (ACCESSING_BITS_0_7)
1526      state->m_ddenlovr_transparency_pen[offset] = data & 0xff;
1503      m_ddenlovr_transparency_pen[offset] = data & 0xff;
15271504}
15281505
1529static WRITE16_HANDLER( ddenlovr16_transparency_mask_w )
1506WRITE16_MEMBER(dynax_state::ddenlovr16_transparency_mask_w)
15301507{
1531   dynax_state *state = space->machine().driver_data<dynax_state>();
15321508
15331509   if (ACCESSING_BITS_0_7)
1534      state->m_ddenlovr_transparency_mask[offset] = data & 0xff;
1510      m_ddenlovr_transparency_mask[offset] = data & 0xff;
15351511}
15361512
15371513
r14883r14884
15781554
15791555
15801556
1581static READ8_HANDLER( unk_r )
1557READ8_MEMBER(dynax_state::unk_r)
15821558{
15831559   return 0x78;
15841560}
15851561
1586static READ16_HANDLER( unk16_r )
1562READ16_MEMBER(dynax_state::unk16_r)
15871563{
15881564   return unk_r(space, offset);
15891565}
r14883r14884
15951571   state->m_dsw_sel = data;
15961572}
15971573
1598static WRITE16_HANDLER( ddenlovr_select_16_w )
1574WRITE16_MEMBER(dynax_state::ddenlovr_select_16_w)
15991575{
1600   dynax_state *state = space->machine().driver_data<dynax_state>();
16011576
16021577   if (ACCESSING_BITS_0_7)
1603      state->m_dsw_sel = data;
1578      m_dsw_sel = data;
16041579}
16051580
1606static WRITE8_HANDLER( ddenlovr_select2_w )
1581WRITE8_MEMBER(dynax_state::ddenlovr_select2_w)
16071582{
1608   dynax_state *state = space->machine().driver_data<dynax_state>();
1609   state->m_input_sel = data;
1583   m_input_sel = data;
16101584}
16111585
1612static WRITE16_HANDLER( ddenlovr_select2_16_w )
1586WRITE16_MEMBER(dynax_state::ddenlovr_select2_16_w)
16131587{
1614   dynax_state *state = space->machine().driver_data<dynax_state>();
16151588
16161589   if (ACCESSING_BITS_0_7)
1617      state->m_input_sel = data;
1590      m_input_sel = data;
16181591}
16191592
1620static READ8_HANDLER( rongrong_input2_r )
1593READ8_MEMBER(dynax_state::rongrong_input2_r)
16211594{
1622   dynax_state *state = space->machine().driver_data<dynax_state>();
16231595
1624//  logerror("%04x: input2_r offset %d select %x\n", cpu_get_pc(&space->device()), offset, state->m_input_sel);
1596//  logerror("%04x: input2_r offset %d select %x\n", cpu_get_pc(&space.device()), offset, m_input_sel);
16251597   /* 0 and 1 are read from offset 1, 2 from offset 0... */
1626   switch (state->m_input_sel)
1598   switch (m_input_sel)
16271599   {
1628      case 0x00:   return input_port_read(space->machine(), "P1");
1629      case 0x01:   return input_port_read(space->machine(), "P2");
1630      case 0x02:   return input_port_read(space->machine(), "SYSTEM");
1600      case 0x00:   return input_port_read(machine(), "P1");
1601      case 0x01:   return input_port_read(machine(), "P2");
1602      case 0x02:   return input_port_read(machine(), "SYSTEM");
16311603   }
16321604   return 0xff;
16331605}
r14883r14884
16451617   return 0xff;
16461618}
16471619
1648static READ16_HANDLER( quiz365_input2_r )
1620READ16_MEMBER(dynax_state::quiz365_input2_r)
16491621{
1650   dynax_state *state = space->machine().driver_data<dynax_state>();
16511622
1652//  logerror("%04x: input2_r offset %d select %x\n",cpu_get_pc(&space->device()), offset, state->m_input_sel);
1623//  logerror("%04x: input2_r offset %d select %x\n",cpu_get_pc(&space.device()), offset, m_input_sel);
16531624   /* 0 and 1 are read from offset 1, 2 from offset 0... */
1654   switch (state->m_input_sel)
1625   switch (m_input_sel)
16551626   {
1656      case 0x10:   return input_port_read(space->machine(), "P1");
1657      case 0x11:   return input_port_read(space->machine(), "P2");
1658      case 0x12:   return input_port_read(space->machine(), "SYSTEM");
1627      case 0x10:   return input_port_read(machine(), "P1");
1628      case 0x11:   return input_port_read(machine(), "P2");
1629      case 0x12:   return input_port_read(machine(), "SYSTEM");
16591630   }
16601631   return 0xff;
16611632}
16621633
16631634
1664static WRITE8_HANDLER( rongrong_blitter_busy_w )
1635WRITE8_MEMBER(dynax_state::rongrong_blitter_busy_w)
16651636{
1666   dynax_state *state = space->machine().driver_data<dynax_state>();
1667   state->m_rongrong_blitter_busy_select = data;
1637   m_rongrong_blitter_busy_select = data;
16681638
16691639   if (data != 0x18)
1670      logerror("%04x: rongrong_blitter_busy_w data = %02x\n", cpu_get_pc(&space->device()), data);
1640      logerror("%04x: rongrong_blitter_busy_w data = %02x\n", cpu_get_pc(&space.device()), data);
16711641}
16721642
1673static READ8_HANDLER( rongrong_blitter_busy_r )
1643READ8_MEMBER(dynax_state::rongrong_blitter_busy_r)
16741644{
1675   dynax_state *state = space->machine().driver_data<dynax_state>();
16761645
1677   switch (state->m_rongrong_blitter_busy_select)
1646   switch (m_rongrong_blitter_busy_select)
16781647   {
16791648      case 0x18:   return 0;   // bit 5 = blitter busy
16801649
16811650      default:
1682         logerror("%04x: rongrong_blitter_busy_r with select = %02x\n", cpu_get_pc(&space->device()), state->m_rongrong_blitter_busy_select);
1651         logerror("%04x: rongrong_blitter_busy_r with select = %02x\n", cpu_get_pc(&space.device()), m_rongrong_blitter_busy_select);
16831652   }
16841653   return 0xff;
16851654}
16861655
16871656
1688static WRITE16_HANDLER( quiz365_coincounter_w )
1657WRITE16_MEMBER(dynax_state::quiz365_coincounter_w)
16891658{
1690   dynax_state *state = space->machine().driver_data<dynax_state>();
16911659
16921660   if (ACCESSING_BITS_0_7)
16931661   {
1694      if (state->m_input_sel == 0x1c)
1662      if (m_input_sel == 0x1c)
16951663      {
1696         coin_counter_w(space->machine(), 0, ~data & 1);
1697         coin_counter_w(space->machine(), 1, ~data & 4);
1664         coin_counter_w(machine(), 0, ~data & 1);
1665         coin_counter_w(machine(), 1, ~data & 4);
16981666      }
16991667   }
17001668}
r14883r14884
1703167137,28,12    11      ->      88
1704167267,4c,3a    ??      ->      51
17051673*/
1706static READ16_HANDLER( quiz365_protection_r )
1674READ16_MEMBER(dynax_state::quiz365_protection_r)
17071675{
1708   dynax_state *state = space->machine().driver_data<dynax_state>();
17091676
1710   switch (state->m_quiz365_protection[0])
1677   switch (m_quiz365_protection[0])
17111678   {
17121679      case 0x3a:
17131680         return 0x0051;
r14883r14884
17161683   }
17171684}
17181685
1719static WRITE16_HANDLER( quiz365_protection_w )
1686WRITE16_MEMBER(dynax_state::quiz365_protection_w)
17201687{
1721   dynax_state *state = space->machine().driver_data<dynax_state>();
1722   COMBINE_DATA(state->m_quiz365_protection + offset);
1688   COMBINE_DATA(m_quiz365_protection + offset);
17231689}
17241690
17251691static ADDRESS_MAP_START( quiz365_map, AS_PROGRAM, 16, dynax_state )
17261692   AM_RANGE(0x000000, 0x17ffff) AM_ROM                                       // ROM
17271693
1728   AM_RANGE(0x200000, 0x2003ff) AM_WRITE_LEGACY(ddenlovr_palette_w)                     // Palette
1694   AM_RANGE(0x200000, 0x2003ff) AM_WRITE(ddenlovr_palette_w)                     // Palette
17291695
1730   AM_RANGE(0x200c02, 0x200c03) AM_READ_LEGACY(quiz365_protection_r)                     // Protection
1731   AM_RANGE(0x200e0a, 0x200e0d) AM_WRITE_LEGACY(quiz365_protection_w)                     // Protection
1696   AM_RANGE(0x200c02, 0x200c03) AM_READ(quiz365_protection_r)                     // Protection
1697   AM_RANGE(0x200e0a, 0x200e0d) AM_WRITE(quiz365_protection_w)                     // Protection
17321698//  AM_RANGE(0x201000, 0x2017ff) AM_WRITEONLY                                      // ?
17331699
1734   AM_RANGE(0x300200, 0x300201) AM_WRITE_LEGACY(ddenlovr_select2_16_w)
1735   AM_RANGE(0x300202, 0x300203) AM_WRITE_LEGACY(quiz365_coincounter_w)                  // Coin Counters + more stuff written on startup
1736   AM_RANGE(0x300204, 0x300207) AM_READ_LEGACY(quiz365_input2_r)                        //
1700   AM_RANGE(0x300200, 0x300201) AM_WRITE(ddenlovr_select2_16_w)
1701   AM_RANGE(0x300202, 0x300203) AM_WRITE(quiz365_coincounter_w)                  // Coin Counters + more stuff written on startup
1702   AM_RANGE(0x300204, 0x300207) AM_READ(quiz365_input2_r)                        //
17371703
1738   AM_RANGE(0x300240, 0x300247) AM_WRITE_LEGACY(ddenlovr16_palette_base_w)
1739   AM_RANGE(0x300248, 0x30024f) AM_WRITE_LEGACY(ddenlovr16_palette_mask_w)
1740   AM_RANGE(0x300250, 0x300257) AM_WRITE_LEGACY(ddenlovr16_transparency_pen_w)
1741   AM_RANGE(0x300258, 0x30025f) AM_WRITE_LEGACY(ddenlovr16_transparency_mask_w)
1742   AM_RANGE(0x300268, 0x300269) AM_WRITE_LEGACY(ddenlovr16_bgcolor_w)
1743   AM_RANGE(0x30026a, 0x30026b) AM_WRITE_LEGACY(ddenlovr16_priority_w)
1744   AM_RANGE(0x30026c, 0x30026d) AM_WRITE_LEGACY(ddenlovr16_layer_enable_w)
1745   AM_RANGE(0x300270, 0x300271) AM_READ_LEGACY(unk16_r)                              // ? must be 78 on startup (not necessary in ddlover)
1746   AM_RANGE(0x300280, 0x300283) AM_WRITE_LEGACY(ddenlovr_blitter_w)
1747   AM_RANGE(0x300286, 0x300287) AM_READ_LEGACY(ddenlovr_gfxrom_r)                        // Video Chip
1704   AM_RANGE(0x300240, 0x300247) AM_WRITE(ddenlovr16_palette_base_w)
1705   AM_RANGE(0x300248, 0x30024f) AM_WRITE(ddenlovr16_palette_mask_w)
1706   AM_RANGE(0x300250, 0x300257) AM_WRITE(ddenlovr16_transparency_pen_w)
1707   AM_RANGE(0x300258, 0x30025f) AM_WRITE(ddenlovr16_transparency_mask_w)
1708   AM_RANGE(0x300268, 0x300269) AM_WRITE(ddenlovr16_bgcolor_w)
1709   AM_RANGE(0x30026a, 0x30026b) AM_WRITE(ddenlovr16_priority_w)
1710   AM_RANGE(0x30026c, 0x30026d) AM_WRITE(ddenlovr16_layer_enable_w)
1711   AM_RANGE(0x300270, 0x300271) AM_READ(unk16_r)                              // ? must be 78 on startup (not necessary in ddlover)
1712   AM_RANGE(0x300280, 0x300283) AM_WRITE(ddenlovr_blitter_w)
1713   AM_RANGE(0x300286, 0x300287) AM_READ(ddenlovr_gfxrom_r)                        // Video Chip
17481714
17491715   AM_RANGE(0x3002c0, 0x3002c1) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)// Sound
17501716   AM_RANGE(0x300300, 0x300303) AM_DEVWRITE8_LEGACY("ymsnd", ym2413_w, 0x00ff)
r14883r14884
17521718   AM_RANGE(0x300380, 0x300383) AM_DEVWRITE8_LEGACY("aysnd", ay8910_address_data_w, 0x00ff)
17531719   AM_RANGE(0x300384, 0x300385) AM_DEVREAD8_LEGACY("aysnd", ay8910_r, 0x00ff)
17541720   AM_RANGE(0x3003c2, 0x3003c3) AM_DEVWRITE_LEGACY("oki", quiz365_oki_bank1_w)
1755   AM_RANGE(0x3003ca, 0x3003cb) AM_WRITE_LEGACY(ddenlovr_blitter_irq_ack_w)               // Blitter irq acknowledge
1721   AM_RANGE(0x3003ca, 0x3003cb) AM_WRITE(ddenlovr_blitter_irq_ack_w)               // Blitter irq acknowledge
17561722   AM_RANGE(0x3003cc, 0x3003cd) AM_DEVWRITE_LEGACY("oki", quiz365_oki_bank2_w)
17571723
17581724   AM_RANGE(0xff0000, 0xffffff) AM_RAM                                       // RAM
17591725ADDRESS_MAP_END
17601726
17611727
1762static READ16_HANDLER( ddenlovj_dsw_r )
1728READ16_MEMBER(dynax_state::ddenlovj_dsw_r)
17631729{
1764   dynax_state *state = space->machine().driver_data<dynax_state>();
17651730   UINT16 dsw = 0;
1766   if ((~*state->m_dsw_sel16) & 0x01)   dsw |= input_port_read(space->machine(), "DSW1");
1767   if ((~*state->m_dsw_sel16) & 0x02)   dsw |= input_port_read(space->machine(), "DSW2");
1768   if ((~*state->m_dsw_sel16) & 0x04)   dsw |= input_port_read(space->machine(), "DSW3");
1731   if ((~*m_dsw_sel16) & 0x01)   dsw |= input_port_read(machine(), "DSW1");
1732   if ((~*m_dsw_sel16) & 0x02)   dsw |= input_port_read(machine(), "DSW2");
1733   if ((~*m_dsw_sel16) & 0x04)   dsw |= input_port_read(machine(), "DSW3");
17691734   return dsw;
17701735}
17711736
1772static WRITE16_HANDLER( ddenlovj_coincounter_w )
1737WRITE16_MEMBER(dynax_state::ddenlovj_coincounter_w)
17731738{
17741739   if (ACCESSING_BITS_0_7)
17751740   {
1776      coin_counter_w(space->machine(), 0, data & 0x01);
1777      coin_counter_w(space->machine(), 1, data & 0x04);
1741      coin_counter_w(machine(), 0, data & 0x01);
1742      coin_counter_w(machine(), 1, data & 0x04);
17781743      //                data & 0x80 ?
17791744   }
17801745}
17811746
1782static CUSTOM_INPUT( ddenlovj_blitter_r )
1747CUSTOM_INPUT_MEMBER(dynax_state::ddenlovj_blitter_r)
17831748{
1784   dynax_state *state = field.machine().driver_data<dynax_state>();
1785   return state->m_ddenlovr_blitter_irq_flag ? 0x03 : 0x00;      // bit 4 = 1 -> blitter busy
1749   return m_ddenlovr_blitter_irq_flag ? 0x03 : 0x00;      // bit 4 = 1 -> blitter busy
17861750}
17871751
17881752static ADDRESS_MAP_START( ddenlovj_map, AS_PROGRAM, 16, dynax_state )
17891753   AM_RANGE(0x000000, 0x07ffff) AM_ROM // ROM
17901754
1791   AM_RANGE(0x200000, 0x2003ff) AM_WRITE_LEGACY(ddenlovr_palette_w)                     // Palette
1755   AM_RANGE(0x200000, 0x2003ff) AM_WRITE(ddenlovr_palette_w)                     // Palette
17921756//  AM_RANGE(0x201000, 0x2017ff) AM_WRITEONLY                                      // ? B0 on startup, then 00
17931757
1794   AM_RANGE(0x300040, 0x300047) AM_WRITE_LEGACY(ddenlovr16_palette_base_w)
1795   AM_RANGE(0x300048, 0x30004f) AM_WRITE_LEGACY(ddenlovr16_palette_mask_w)
1796   AM_RANGE(0x300050, 0x300057) AM_WRITE_LEGACY(ddenlovr16_transparency_pen_w)
1797   AM_RANGE(0x300058, 0x30005f) AM_WRITE_LEGACY(ddenlovr16_transparency_mask_w)
1798   AM_RANGE(0x300068, 0x300069) AM_WRITE_LEGACY(ddenlovr16_bgcolor_w)
1799   AM_RANGE(0x30006a, 0x30006b) AM_WRITE_LEGACY(ddenlovr16_priority_w)
1800   AM_RANGE(0x30006c, 0x30006d) AM_WRITE_LEGACY(ddenlovr16_layer_enable_w)
1801   AM_RANGE(0x300070, 0x300071) AM_READ_LEGACY(unk16_r)                              // ? must be 78 on startup (not necessary in ddlover)
1802   AM_RANGE(0x300080, 0x300083) AM_WRITE_LEGACY(ddenlovr_blitter_w)
1803   AM_RANGE(0x300086, 0x300087) AM_READ_LEGACY(ddenlovr_gfxrom_r)                        // Video Chip
1758   AM_RANGE(0x300040, 0x300047) AM_WRITE(ddenlovr16_palette_base_w)
1759   AM_RANGE(0x300048, 0x30004f) AM_WRITE(ddenlovr16_palette_mask_w)
1760   AM_RANGE(0x300050, 0x300057) AM_WRITE(ddenlovr16_transparency_pen_w)
1761   AM_RANGE(0x300058, 0x30005f) AM_WRITE(ddenlovr16_transparency_mask_w)
1762   AM_RANGE(0x300068, 0x300069) AM_WRITE(ddenlovr16_bgcolor_w)
1763   AM_RANGE(0x30006a, 0x30006b) AM_WRITE(ddenlovr16_priority_w)
1764   AM_RANGE(0x30006c, 0x30006d) AM_WRITE(ddenlovr16_layer_enable_w)
1765   AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r)                              // ? must be 78 on startup (not necessary in ddlover)
1766   AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w)
1767   AM_RANGE(0x300086, 0x300087) AM_READ(ddenlovr_gfxrom_r)                        // Video Chip
18041768   AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8_LEGACY("ymsnd", ym2413_w, 0x00ff)
18051769   AM_RANGE(0x300100, 0x30011f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
18061770   AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8_LEGACY("aysnd", ay8910_address_data_w, 0x00ff)
18071771   AM_RANGE(0x300180, 0x300181) AM_READ_PORT("P1")
18081772   AM_RANGE(0x300182, 0x300183) AM_READ_PORT("P2")
18091773   AM_RANGE(0x300184, 0x300185) AM_READ_PORT("SYSTEM")
1810   AM_RANGE(0x300186, 0x300187) AM_READ_LEGACY(ddenlovj_dsw_r)                        // DSW
1811   AM_RANGE(0x300188, 0x300189) AM_WRITE_LEGACY(ddenlovj_coincounter_w)                  // Coin Counters
1774   AM_RANGE(0x300186, 0x300187) AM_READ(ddenlovj_dsw_r)                        // DSW
1775   AM_RANGE(0x300188, 0x300189) AM_WRITE(ddenlovj_coincounter_w)                  // Coin Counters
18121776   AM_RANGE(0x30018a, 0x30018b) AM_WRITEONLY AM_BASE(m_dsw_sel16)         // DSW select
18131777   AM_RANGE(0x30018c, 0x30018d) AM_DEVWRITE_LEGACY("oki", ddenlovr_oki_bank_w)
1814   AM_RANGE(0x3001ca, 0x3001cb) AM_WRITE_LEGACY(ddenlovr_blitter_irq_ack_w)               // Blitter irq acknowledge
1778   AM_RANGE(0x3001ca, 0x3001cb) AM_WRITE(ddenlovr_blitter_irq_ack_w)               // Blitter irq acknowledge
18151779   AM_RANGE(0x300240, 0x300241) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)// Sound
18161780   AM_RANGE(0xff0000, 0xffffff) AM_RAM                                       // RAM
18171781ADDRESS_MAP_END
18181782
18191783
1820static READ16_HANDLER( ddenlovrk_protection1_r )
1784READ16_MEMBER(dynax_state::ddenlovrk_protection1_r)
18211785{
1822   dynax_state *state = space->machine().driver_data<dynax_state>();
1823   switch (*state->m_protection1)
1786   switch (*m_protection1)
18241787   {
18251788      case 0x007e:   return 0x00aa;
18261789   }
1827   return *state->m_protection1;
1790   return *m_protection1;
18281791}
18291792
1830static READ16_HANDLER( ddenlovrk_protection2_r )
1793READ16_MEMBER(dynax_state::ddenlovrk_protection2_r)
18311794{
1832   dynax_state *state = space->machine().driver_data<dynax_state>();
1833   switch (*state->m_protection1)
1795   switch (*m_protection1)
18341796   {
1835      case 0x0000:   return *state->m_protection2;
1797      case 0x0000:   return *m_protection2;
18361798   }
18371799   return 0x80;
18381800}
1839static WRITE16_HANDLER( ddenlovrk_protection2_w )
1801WRITE16_MEMBER(dynax_state::ddenlovrk_protection2_w)
18401802{
1841   dynax_state *state = space->machine().driver_data<dynax_state>();
18421803
1843   COMBINE_DATA(state->m_protection2);
1844   state->m_oki->set_bank_base(((*state->m_protection2) & 0x7) * 0x40000);
1804   COMBINE_DATA(m_protection2);
1805   m_oki->set_bank_base(((*m_protection2) & 0x7) * 0x40000);
18451806}
18461807
18471808static ADDRESS_MAP_START( ddenlovrk_map, AS_PROGRAM, 16, dynax_state )
18481809   AM_RANGE(0x000000, 0x07ffff) AM_ROM                                          // ROM
18491810
1850   AM_RANGE(0x100000, 0x100001) AM_RAM_READ_LEGACY(ddenlovrk_protection1_r) AM_BASE(m_protection1)
1851   AM_RANGE(0x200000, 0x200001) AM_READWRITE_LEGACY(ddenlovrk_protection2_r, ddenlovrk_protection2_w) AM_BASE(m_protection2)
1811   AM_RANGE(0x100000, 0x100001) AM_RAM_READ(ddenlovrk_protection1_r) AM_BASE(m_protection1)
1812   AM_RANGE(0x200000, 0x200001) AM_READWRITE(ddenlovrk_protection2_r, ddenlovrk_protection2_w) AM_BASE(m_protection2)
18521813
1853   AM_RANGE(0xd00000, 0xd003ff) AM_WRITE_LEGACY(ddenlovr_palette_w)                        // Palette
1814   AM_RANGE(0xd00000, 0xd003ff) AM_WRITE(ddenlovr_palette_w)                        // Palette
18541815//  AM_RANGE(0xd01000, 0xd017ff) AM_RAM                                                    // ? B0 on startup, then 00
18551816
1856   AM_RANGE(0xe00040, 0xe00047) AM_WRITE_LEGACY(ddenlovr16_palette_base_w)
1857   AM_RANGE(0xe00048, 0xe0004f) AM_WRITE_LEGACY(ddenlovr16_palette_mask_w)
1858   AM_RANGE(0xe00050, 0xe00057) AM_WRITE_LEGACY(ddenlovr16_transparency_pen_w)
1859   AM_RANGE(0xe00058, 0xe0005f) AM_WRITE_LEGACY(ddenlovr16_transparency_mask_w)
1860   AM_RANGE(0xe00068, 0xe00069) AM_WRITE_LEGACY(ddenlovr16_bgcolor_w)
1861   AM_RANGE(0xe0006a, 0xe0006b) AM_WRITE_LEGACY(ddenlovr16_priority_w)
1862   AM_RANGE(0xe0006c, 0xe0006d) AM_WRITE_LEGACY(ddenlovr16_layer_enable_w)
1817   AM_RANGE(0xe00040, 0xe00047) AM_WRITE(ddenlovr16_palette_base_w)
1818   AM_RANGE(0xe00048, 0xe0004f) AM_WRITE(ddenlovr16_palette_mask_w)
1819   AM_RANGE(0xe00050, 0xe00057) AM_WRITE(ddenlovr16_transparency_pen_w)
1820   AM_RANGE(0xe00058, 0xe0005f) AM_WRITE(ddenlovr16_transparency_mask_w)
1821   AM_RANGE(0xe00068, 0xe00069) AM_WRITE(ddenlovr16_bgcolor_w)
1822   AM_RANGE(0xe0006a, 0xe0006b) AM_WRITE(ddenlovr16_priority_w)
1823   AM_RANGE(0xe0006c, 0xe0006d) AM_WRITE(ddenlovr16_layer_enable_w)
18631824   AM_RANGE(0xe00070, 0xe00071) AM_READNOP
1864   AM_RANGE(0xe00080, 0xe00083) AM_WRITE_LEGACY(ddenlovr_blitter_w)
1865   AM_RANGE(0xe00086, 0xe00087) AM_READ_LEGACY(ddenlovr_gfxrom_r)                           // Video Chip
1825   AM_RANGE(0xe00080, 0xe00083) AM_WRITE(ddenlovr_blitter_w)
1826   AM_RANGE(0xe00086, 0xe00087) AM_READ(ddenlovr_gfxrom_r)                           // Video Chip
18661827
18671828   AM_RANGE(0xe00100, 0xe00101) AM_READ_PORT("P1")
18681829   AM_RANGE(0xe00102, 0xe00103) AM_READ_PORT("P2")
18691830   AM_RANGE(0xe00104, 0xe00105) AM_READ_PORT("SYSTEM")
18701831   AM_RANGE(0xe00200, 0xe00201) AM_READ_PORT("DSW")
1871   AM_RANGE(0xe00302, 0xe00303) AM_WRITE_LEGACY(ddenlovr_blitter_irq_ack_w)                  // Blitter irq acknowledge
1872   AM_RANGE(0xe00308, 0xe00309) AM_WRITE_LEGACY(ddenlovr_coincounter_0_w)                     // Coin Counters
1873   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE_LEGACY(ddenlovr_coincounter_1_w)                     //
1832   AM_RANGE(0xe00302, 0xe00303) AM_WRITE(ddenlovr_blitter_irq_ack_w)                  // Blitter irq acknowledge
1833   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                     // Coin Counters
1834   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                     //
18741835
18751836   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8_LEGACY("ymsnd", ym2413_w, 0x00ff)
18761837   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
r14883r14884
18881849
18891850   AM_RANGE(0x300000, 0x300001) AM_DEVWRITE_LEGACY("oki", ddenlovr_oki_bank_w)
18901851
1891   AM_RANGE(0xd00000, 0xd003ff) AM_WRITE_LEGACY(ddenlovr_palette_w)                        // Palette
1852   AM_RANGE(0xd00000, 0xd003ff) AM_WRITE(ddenlovr_palette_w)                        // Palette
18921853//  AM_RANGE(0xd01000, 0xd017ff) AM_RAM                                                   // ? B0 on startup, then 00
18931854
1894   AM_RANGE(0xe00040, 0xe00047) AM_WRITE_LEGACY(ddenlovr16_palette_base_w)
1895   AM_RANGE(0xe00048, 0xe0004f) AM_WRITE_LEGACY(ddenlovr16_palette_mask_w)
1896   AM_RANGE(0xe00050, 0xe00057) AM_WRITE_LEGACY(ddenlovr16_transparency_pen_w)
1897   AM_RANGE(0xe00058, 0xe0005f) AM_WRITE_LEGACY(ddenlovr16_transparency_mask_w)
1898   AM_RANGE(0xe00068, 0xe00069) AM_WRITE_LEGACY(ddenlovr16_bgcolor_w)
1899   AM_RANGE(0xe0006a, 0xe0006b) AM_WRITE_LEGACY(ddenlovr16_priority_w)
1900   AM_RANGE(0xe0006c, 0xe0006d) AM_WRITE_LEGACY(ddenlovr16_layer_enable_w)
1901   AM_RANGE(0xe00070, 0xe00071) AM_READ_LEGACY(unk16_r)                                 // ? must be 78 on startup (not necessary in ddlover)
1902   AM_RANGE(0xe00080, 0xe00083) AM_WRITE_LEGACY(ddenlovr_blitter_w)
1903   AM_RANGE(0xe00086, 0xe00087) AM_READ_LEGACY(ddenlovr_gfxrom_r)                           // Video Chip
1855   AM_RANGE(0xe00040, 0xe00047) AM_WRITE(ddenlovr16_palette_base_w)
1856   AM_RANGE(0xe00048, 0xe0004f) AM_WRITE(ddenlovr16_palette_mask_w)
1857   AM_RANGE(0xe00050, 0xe00057) AM_WRITE(ddenlovr16_transparency_pen_w)
1858   AM_RANGE(0xe00058, 0xe0005f) AM_WRITE(ddenlovr16_transparency_mask_w)
1859   AM_RANGE(0xe00068, 0xe00069) AM_WRITE(ddenlovr16_bgcolor_w)
1860   AM_RANGE(0xe0006a, 0xe0006b) AM_WRITE(ddenlovr16_priority_w)
1861   AM_RANGE(0xe0006c, 0xe0006d) AM_WRITE(ddenlovr16_layer_enable_w)
1862   AM_RANGE(0xe00070, 0xe00071) AM_READ(unk16_r)                                 // ? must be 78 on startup (not necessary in ddlover)
1863   AM_RANGE(0xe00080, 0xe00083) AM_WRITE(ddenlovr_blitter_w)
1864   AM_RANGE(0xe00086, 0xe00087) AM_READ(ddenlovr_gfxrom_r)                           // Video Chip
19041865
19051866   AM_RANGE(0xe00100, 0xe00101) AM_READ_PORT("P1")
19061867   AM_RANGE(0xe00102, 0xe00103) AM_READ_PORT("P2")
19071868   AM_RANGE(0xe00104, 0xe00105) AM_READ_PORT("SYSTEM")
19081869   AM_RANGE(0xe00200, 0xe00201) AM_READ_PORT("DSW")
1909   AM_RANGE(0xe00302, 0xe00303) AM_WRITE_LEGACY(ddenlovr_blitter_irq_ack_w)                  // Blitter irq acknowledge
1910   AM_RANGE(0xe00308, 0xe00309) AM_WRITE_LEGACY(ddenlovr_coincounter_0_w)                     // Coin Counters
1911   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE_LEGACY(ddenlovr_coincounter_1_w)                     //
1870   AM_RANGE(0xe00302, 0xe00303) AM_WRITE(ddenlovr_blitter_irq_ack_w)                  // Blitter irq acknowledge
1871   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                     // Coin Counters
1872   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                     //
19121873
19131874   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8_LEGACY("ymsnd", ym2413_w, 0x00ff)
19141875   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
r14883r14884
19191880ADDRESS_MAP_END
19201881
19211882
1922static CUSTOM_INPUT( nettoqc_special_r )
1883CUSTOM_INPUT_MEMBER(dynax_state::nettoqc_special_r)
19231884{
1924   dynax_state *state = field.machine().driver_data<dynax_state>();
1925   return state->m_ddenlovr_blitter_irq_flag ? 0x03 : 0x00;
1885   return m_ddenlovr_blitter_irq_flag ? 0x03 : 0x00;
19261886}
19271887
1928static READ16_HANDLER( nettoqc_input_r )
1888READ16_MEMBER(dynax_state::nettoqc_input_r)
19291889{
1930   dynax_state *state = space->machine().driver_data<dynax_state>();
19311890
1932   if (!BIT(state->m_dsw_sel, 0))   return input_port_read(space->machine(), "DSW1");
1933   if (!BIT(state->m_dsw_sel, 1))   return input_port_read(space->machine(), "DSW2");
1934   if (!BIT(state->m_dsw_sel, 2))   return input_port_read(space->machine(), "DSW3");
1891   if (!BIT(m_dsw_sel, 0))   return input_port_read(machine(), "DSW1");
1892   if (!BIT(m_dsw_sel, 1))   return input_port_read(machine(), "DSW2");
1893   if (!BIT(m_dsw_sel, 2))   return input_port_read(machine(), "DSW3");
19351894   return 0xffff;
19361895}
19371896
r14883r14884
19421901    Writes 67 4c 3a to 200e0b then 19 to 200e0d. Expects to read 51 from 200c03
19431902*/
19441903
1945static READ16_HANDLER( nettoqc_protection_r )
1904READ16_MEMBER(dynax_state::nettoqc_protection_r)
19461905{
1947   dynax_state *state = space->machine().driver_data<dynax_state>();
19481906
1949   switch (state->m_protection1[0] & 0xff)
1907   switch (m_protection1[0] & 0xff)
19501908   {
19511909      case 0x3a:   return 0x0051;
19521910      default:   return 0x0088;
19531911   }
19541912}
19551913
1956static WRITE16_HANDLER( nettoqc_coincounter_w )
1914WRITE16_MEMBER(dynax_state::nettoqc_coincounter_w)
19571915{
19581916   if (ACCESSING_BITS_0_7)
19591917   {
1960      coin_counter_w(space->machine(), 0, data & 0x01);
1961      coin_counter_w(space->machine(), 1, data & 0x04);
1918      coin_counter_w(machine(), 0, data & 0x01);
1919      coin_counter_w(machine(), 1, data & 0x04);
19621920      //                data & 0x80 ?
19631921   }
19641922}
r14883r14884
19751933static ADDRESS_MAP_START( nettoqc_map, AS_PROGRAM, 16, dynax_state )
19761934   AM_RANGE(0x000000, 0x17ffff) AM_ROM                                          // ROM
19771935
1978   AM_RANGE(0x200000, 0x2003ff) AM_WRITE_LEGACY(ddenlovr_palette_w)                        // Palette
1979   AM_RANGE(0x200c02, 0x200c03) AM_READ_LEGACY(nettoqc_protection_r)                        //
1936   AM_RANGE(0x200000, 0x2003ff) AM_WRITE(ddenlovr_palette_w)                        // Palette
1937   AM_RANGE(0x200c02, 0x200c03) AM_READ(nettoqc_protection_r)                        //
19801938   AM_RANGE(0x200e0a, 0x200e0d) AM_WRITEONLY AM_BASE(m_protection1)         //
19811939   AM_RANGE(0x201000, 0x2017ff) AM_WRITEONLY                                 // ?
19821940
1983   AM_RANGE(0x300040, 0x300047) AM_WRITE_LEGACY(ddenlovr16_palette_base_w)
1984   AM_RANGE(0x300048, 0x30004f) AM_WRITE_LEGACY(ddenlovr16_palette_mask_w)
1985   AM_RANGE(0x300050, 0x300057) AM_WRITE_LEGACY(ddenlovr16_transparency_pen_w)
1986   AM_RANGE(0x300058, 0x30005f) AM_WRITE_LEGACY(ddenlovr16_transparency_mask_w)
1987   AM_RANGE(0x300068, 0x300069) AM_WRITE_LEGACY(ddenlovr16_bgcolor_w)
1988   AM_RANGE(0x30006a, 0x30006b) AM_WRITE_LEGACY(ddenlovr16_priority_w)
1989   AM_RANGE(0x30006c, 0x30006d) AM_WRITE_LEGACY(ddenlovr16_layer_enable_w)
1990   AM_RANGE(0x300070, 0x300071) AM_READ_LEGACY(unk16_r)                                 // ? must be 78 on startup (not necessary in ddlover)
1991   AM_RANGE(0x300080, 0x300083) AM_WRITE_LEGACY(ddenlovr_blitter_w)
1992   AM_RANGE(0x300086, 0x300087) AM_READ_LEGACY(ddenlovr_gfxrom_r)                           // Video Chip
1941   AM_RANGE(0x300040, 0x300047) AM_WRITE(ddenlovr16_palette_base_w)
1942   AM_RANGE(0x300048, 0x30004f) AM_WRITE(ddenlovr16_palette_mask_w)
1943   AM_RANGE(0x300050, 0x300057) AM_WRITE(ddenlovr16_transparency_pen_w)
1944   AM_RANGE(0x300058, 0x30005f) AM_WRITE(ddenlovr16_transparency_mask_w)
1945   AM_RANGE(0x300068, 0x300069) AM_WRITE(ddenlovr16_bgcolor_w)
1946   AM_RANGE(0x30006a, 0x30006b) AM_WRITE(ddenlovr16_priority_w)
1947   AM_RANGE(0x30006c, 0x30006d) AM_WRITE(ddenlovr16_layer_enable_w)
1948   AM_RANGE(0x300070, 0x300071) AM_READ(unk16_r)                                 // ? must be 78 on startup (not necessary in ddlover)
1949   AM_RANGE(0x300080, 0x300083) AM_WRITE(ddenlovr_blitter_w)
1950   AM_RANGE(0x300086, 0x300087) AM_READ(ddenlovr_gfxrom_r)                           // Video Chip
19931951   AM_RANGE(0x3000c0, 0x3000c3) AM_DEVWRITE8_LEGACY("ymsnd", ym2413_w, 0x00ff)
19941952   AM_RANGE(0x300100, 0x30011f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write,0x00ff)
19951953   AM_RANGE(0x300140, 0x300143) AM_DEVWRITE8_LEGACY("aysnd", ay8910_address_data_w, 0x00ff)
19961954   AM_RANGE(0x300180, 0x300181) AM_READ_PORT("P1")
19971955   AM_RANGE(0x300182, 0x300183) AM_READ_PORT("P2")
19981956   AM_RANGE(0x300184, 0x300185) AM_READ_PORT("SYSTEM")
1999   AM_RANGE(0x300186, 0x300187) AM_READ_LEGACY(nettoqc_input_r)                           // DSW's
2000   AM_RANGE(0x300188, 0x300189) AM_WRITE_LEGACY(nettoqc_coincounter_w)                     // Coin Counters
2001   AM_RANGE(0x30018a, 0x30018b) AM_WRITE_LEGACY(ddenlovr_select_16_w)                        //
1957   AM_RANGE(0x300186, 0x300187) AM_READ(nettoqc_input_r)                           // DSW's
1958   AM_RANGE(0x300188, 0x300189) AM_WRITE(nettoqc_coincounter_w)                     // Coin Counters
1959   AM_RANGE(0x30018a, 0x30018b) AM_WRITE(ddenlovr_select_16_w)                        //
20021960   AM_RANGE(0x30018c, 0x30018d) AM_DEVWRITE_LEGACY("oki", nettoqc_oki_bank_w)
2003   AM_RANGE(0x3001ca, 0x3001cb) AM_WRITE_LEGACY(ddenlovr_blitter_irq_ack_w)                  // Blitter irq acknowledge
1961   AM_RANGE(0x3001ca, 0x3001cb) AM_WRITE(ddenlovr_blitter_irq_ack_w)                  // Blitter irq acknowledge
20041962   AM_RANGE(0x300240, 0x300241) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)   // Sound
20051963   AM_RANGE(0xff0000, 0xffffff) AM_RAM                                          // RAM
20061964ADDRESS_MAP_END
r14883r14884
20101968                                Rong Rong
20111969***************************************************************************/
20121970
2013static READ8_HANDLER( rongrong_input_r )
1971READ8_MEMBER(dynax_state::rongrong_input_r)
20141972{
2015   dynax_state *state = space->machine().driver_data<dynax_state>();
20161973
2017   if (!BIT(state->m_dsw_sel, 0))   return input_port_read(space->machine(), "DSW1");
2018   if (!BIT(state->m_dsw_sel, 1))   return input_port_read(space->machine(), "DSW2");
2019   if (!BIT(state->m_dsw_sel, 2))   return 0xff;//space->machine().rand();
2020   if (!BIT(state->m_dsw_sel, 3))   return 0xff;//space->machine().rand();
2021   if (!BIT(state->m_dsw_sel, 4))   return input_port_read(space->machine(), "DSW3");
1974   if (!BIT(m_dsw_sel, 0))   return input_port_read(machine(), "DSW1");
1975   if (!BIT(m_dsw_sel, 1))   return input_port_read(machine(), "DSW2");
1976   if (!BIT(m_dsw_sel, 2))   return 0xff;//machine().rand();
1977   if (!BIT(m_dsw_sel, 3))   return 0xff;//machine().rand();
1978   if (!BIT(m_dsw_sel, 4))   return input_port_read(machine(), "DSW3");
20221979   return 0xff;
20231980}
20241981
2025static WRITE8_HANDLER( rongrong_select_w )
1982WRITE8_MEMBER(dynax_state::rongrong_select_w)
20261983{
2027   dynax_state *state = space->machine().driver_data<dynax_state>();
20281984
2029//logerror("%04x: rongrong_select_w %02x\n",cpu_get_pc(&space->device()),data);
1985//logerror("%04x: rongrong_select_w %02x\n",cpu_get_pc(&space.device()),data);
20301986
20311987   /* bits 0-4 = **both** ROM bank **AND** input select */
2032   memory_set_bank(space->machine(), "bank1", data & 0x1f);
2033   state->m_dsw_sel = data;
1988   memory_set_bank(machine(), "bank1", data & 0x1f);
1989   m_dsw_sel = data;
20341990
20351991   /* bits 5-7 = RAM bank */
2036   memory_set_bank(space->machine(), "bank2", ((data & 0xe0) >> 5));
1992   memory_set_bank(machine(), "bank2", ((data & 0xe0) >> 5));
20371993}
20381994
20391995
r14883r14884
20411997   AM_RANGE(0x0000, 0x5fff) AM_ROM                                 // ROM
20421998   AM_RANGE(0x6000, 0x6fff) AM_RAM                                 // RAM
20431999   AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank2")                           // RAM (Banked)
2044   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") AM_WRITE_LEGACY(rongrong_palette_w)      // ROM (Banked)
2000   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") AM_WRITE(rongrong_palette_w)      // ROM (Banked)
20452001ADDRESS_MAP_END
20462002
20472003static ADDRESS_MAP_START( quizchq_portmap, AS_IO, 8, dynax_state )
20482004   ADDRESS_MAP_GLOBAL_MASK(0xff)
2049   AM_RANGE(0x00, 0x01) AM_WRITE_LEGACY(rongrong_blitter_w)
2050   AM_RANGE(0x03, 0x03) AM_READ_LEGACY(rongrong_gfxrom_r)
2051   AM_RANGE(0x1b, 0x1b) AM_READWRITE_LEGACY(rongrong_blitter_busy_r, rongrong_blitter_busy_w)
2005   AM_RANGE(0x00, 0x01) AM_WRITE(rongrong_blitter_w)
2006   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
2007   AM_RANGE(0x1b, 0x1b) AM_READWRITE(rongrong_blitter_busy_r, rongrong_blitter_busy_w)
20522008
2053   AM_RANGE(0x1c, 0x1c) AM_READ_LEGACY(rongrong_input_r)
2054   AM_RANGE(0x1e, 0x1e) AM_WRITE_LEGACY(rongrong_select_w)
2055   AM_RANGE(0x20, 0x20) AM_WRITE_LEGACY(ddenlovr_select2_w)
2056   AM_RANGE(0x22, 0x23) AM_READ_LEGACY(rongrong_input2_r)
2009   AM_RANGE(0x1c, 0x1c) AM_READ(rongrong_input_r)
2010   AM_RANGE(0x1e, 0x1e) AM_WRITE(rongrong_select_w)
2011   AM_RANGE(0x20, 0x20) AM_WRITE(ddenlovr_select2_w)
2012   AM_RANGE(0x22, 0x23) AM_READ(rongrong_input2_r)
20572013
20582014   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
20592015   AM_RANGE(0x60, 0x61) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
20602016
2061   AM_RANGE(0x80, 0x83) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
2062   AM_RANGE(0x84, 0x87) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
2063   AM_RANGE(0x88, 0x8b) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
2064   AM_RANGE(0x8c, 0x8f) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
2065   AM_RANGE(0x94, 0x94) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
2066   AM_RANGE(0x95, 0x95) AM_WRITE_LEGACY(ddenlovr_priority_w)
2067   AM_RANGE(0x96, 0x96) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
2068   AM_RANGE(0x98, 0x98) AM_READ_LEGACY(unk_r)                     // ? must be 78 on startup
2017   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
2018   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
2019   AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w)
2020   AM_RANGE(0x8c, 0x8f) AM_WRITE(ddenlovr_transparency_mask_w)
2021   AM_RANGE(0x94, 0x94) AM_WRITE(ddenlovr_bgcolor_w)
2022   AM_RANGE(0x95, 0x95) AM_WRITE(ddenlovr_priority_w)
2023   AM_RANGE(0x96, 0x96) AM_WRITE(ddenlovr_layer_enable_w)
2024   AM_RANGE(0x98, 0x98) AM_READ(unk_r)                     // ? must be 78 on startup
20692025
20702026   AM_RANGE(0xa0, 0xaf) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
20712027   AM_RANGE(0xc0, 0xc0) AM_DEVWRITE_LEGACY("oki", quizchq_oki_bank_w)
r14883r14884
20782034   AM_RANGE(0x0000, 0x5fff) AM_ROM                                 // ROM
20792035   AM_RANGE(0x6000, 0x6fff) AM_RAM                                 // RAM
20802036   AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank2")                           // RAM (Banked)
2081   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") AM_WRITE_LEGACY(rongrong_palette_w)      // ROM (Banked)
2037   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") AM_WRITE(rongrong_palette_w)      // ROM (Banked)
20822038ADDRESS_MAP_END
20832039
20842040static ADDRESS_MAP_START( rongrong_portmap, AS_IO, 8, dynax_state )
20852041   ADDRESS_MAP_GLOBAL_MASK(0xff)
2086   AM_RANGE(0x00, 0x01) AM_WRITE_LEGACY(rongrong_blitter_w)
2087   AM_RANGE(0x03, 0x03) AM_READ_LEGACY(rongrong_gfxrom_r)
2088   AM_RANGE(0x1b, 0x1b) AM_READWRITE_LEGACY(rongrong_blitter_busy_r, rongrong_blitter_busy_w)
2042   AM_RANGE(0x00, 0x01) AM_WRITE(rongrong_blitter_w)
2043   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
2044   AM_RANGE(0x1b, 0x1b) AM_READWRITE(rongrong_blitter_busy_r, rongrong_blitter_busy_w)
20892045
2090   AM_RANGE(0x1c, 0x1c) AM_READ_LEGACY(rongrong_input_r)
2091   AM_RANGE(0x1e, 0x1e) AM_WRITE_LEGACY(rongrong_select_w)
2046   AM_RANGE(0x1c, 0x1c) AM_READ(rongrong_input_r)
2047   AM_RANGE(0x1e, 0x1e) AM_WRITE(rongrong_select_w)
20922048
20932049   AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
20942050   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
20952051   AM_RANGE(0x60, 0x61) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
20962052
2097   AM_RANGE(0x80, 0x83) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
2098   AM_RANGE(0x84, 0x87) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
2099   AM_RANGE(0x88, 0x8b) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
2100   AM_RANGE(0x8c, 0x8f) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
2101   AM_RANGE(0x94, 0x94) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
2102   AM_RANGE(0x95, 0x95) AM_WRITE_LEGACY(ddenlovr_priority_w)
2103   AM_RANGE(0x96, 0x96) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
2104   AM_RANGE(0x98, 0x98) AM_READ_LEGACY(unk_r)                           // ? must be 78 on startup
2053   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
2054   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
2055   AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w)
2056   AM_RANGE(0x8c, 0x8f) AM_WRITE(ddenlovr_transparency_mask_w)
2057   AM_RANGE(0x94, 0x94) AM_WRITE(ddenlovr_bgcolor_w)
2058   AM_RANGE(0x95, 0x95) AM_WRITE(ddenlovr_priority_w)
2059   AM_RANGE(0x96, 0x96) AM_WRITE(ddenlovr_layer_enable_w)
2060   AM_RANGE(0x98, 0x98) AM_READ(unk_r)                           // ? must be 78 on startup
21052061
2106   AM_RANGE(0xa0, 0xa0) AM_WRITE_LEGACY(ddenlovr_select2_w)
2107   AM_RANGE(0xa2, 0xa3) AM_READ_LEGACY(rongrong_input2_r)
2062   AM_RANGE(0xa0, 0xa0) AM_WRITE(ddenlovr_select2_w)
2063   AM_RANGE(0xa2, 0xa3) AM_READ(rongrong_input2_r)
21082064   AM_RANGE(0xc2, 0xc2) AM_WRITENOP                           // enables palette RAM at f000, and protection device at f705/f706/f601
21092065ADDRESS_MAP_END
21102066/*
r14883r14884
21202076***************************************************************************/
21212077
21222078
2123static READ8_HANDLER( magic_r )
2079READ8_MEMBER(dynax_state::magic_r)
21242080{
21252081   return 0x01;
21262082}
21272083
2128static WRITE8_HANDLER( mmpanic_rombank_w )
2084WRITE8_MEMBER(dynax_state::mmpanic_rombank_w)
21292085{
2130   memory_set_bank(space->machine(), "bank1", data & 0x7);
2086   memory_set_bank(machine(), "bank1", data & 0x7);
21312087   /* Bit 4? */
21322088}
21332089
2134static WRITE8_HANDLER( mmpanic_soundlatch_w )
2090WRITE8_MEMBER(dynax_state::mmpanic_soundlatch_w)
21352091{
2136   dynax_state *state = space->machine().driver_data<dynax_state>();
21372092
2138   state->soundlatch_w(*space, 0, data);
2139   device_set_input_line(state->m_soundcpu, INPUT_LINE_NMI, PULSE_LINE);
2093   soundlatch_w(*&space, 0, data);
2094   device_set_input_line(m_soundcpu, INPUT_LINE_NMI, PULSE_LINE);
21402095}
21412096
2142static WRITE8_HANDLER( mmpanic_blitter_w )
2097WRITE8_MEMBER(dynax_state::mmpanic_blitter_w)
21432098{
2144   blitter_w(space, 0, offset, data, 0xdf);   // RST 18
2099   blitter_w(&space, 0, offset, data, 0xdf);   // RST 18
21452100}
2146static WRITE8_HANDLER( mmpanic_blitter2_w )
2101WRITE8_MEMBER(dynax_state::mmpanic_blitter2_w)
21472102{
2148   blitter_w(space, 1, offset, data, 0xdf);   // RST 18
2103   blitter_w(&space, 1, offset, data, 0xdf);   // RST 18
21492104}
21502105
21512106static void mmpanic_update_leds(running_machine &machine)
r14883r14884
21552110}
21562111
21572112/* leds 1-8 */
2158static WRITE8_HANDLER( mmpanic_leds_w )
2113WRITE8_MEMBER(dynax_state::mmpanic_leds_w)
21592114{
2160   dynax_state *state = space->machine().driver_data<dynax_state>();
2161   state->m_mmpanic_leds = (state->m_mmpanic_leds & 0xff00) | data;
2162   mmpanic_update_leds(space->machine());
2115   m_mmpanic_leds = (m_mmpanic_leds & 0xff00) | data;
2116   mmpanic_update_leds(machine());
21632117}
21642118/* led 9 */
2165static WRITE8_HANDLER( mmpanic_leds2_w )
2119WRITE8_MEMBER(dynax_state::mmpanic_leds2_w)
21662120{
2167   dynax_state *state = space->machine().driver_data<dynax_state>();
2168   state->m_mmpanic_leds = (state->m_mmpanic_leds & 0xfeff) | (data ? 0x0100 : 0);
2169   mmpanic_update_leds(space->machine());
2121   m_mmpanic_leds = (m_mmpanic_leds & 0xfeff) | (data ? 0x0100 : 0);
2122   mmpanic_update_leds(machine());
21702123}
21712124
21722125
2173static WRITE8_HANDLER( mmpanic_lockout_w )
2126WRITE8_MEMBER(dynax_state::mmpanic_lockout_w)
21742127{
2175   dynax_state *state = space->machine().driver_data<dynax_state>();
21762128
2177   if (state->m_dsw_sel == 0x0c)
2129   if (m_dsw_sel == 0x0c)
21782130   {
2179      coin_counter_w(space->machine(), 0, (~data) & 0x01);
2180      coin_lockout_w(space->machine(), 0, (~data) & 0x02);
2181      set_led_status(space->machine(), 1, (~data) & 0x04);
2131      coin_counter_w(machine(), 0, (~data) & 0x01);
2132      coin_lockout_w(machine(), 0, (~data) & 0x02);
2133      set_led_status(machine(), 1, (~data) & 0x04);
21822134   }
21832135}
21842136
2185static READ8_HANDLER( mmpanic_link_r )   { return 0xff; }
2137READ8_MEMBER(dynax_state::mmpanic_link_r){ return 0xff; }
21862138
21872139/* Main CPU */
21882140
21892141static ADDRESS_MAP_START( mmpanic_map, AS_PROGRAM, 8, dynax_state )
2190   AM_RANGE(0x0051, 0x0051) AM_READ_LEGACY(magic_r)                        // ?
2142   AM_RANGE(0x0051, 0x0051) AM_READ(magic_r)                        // ?
21912143   AM_RANGE(0x0000, 0x5fff) AM_ROM                                 // ROM
21922144   AM_RANGE(0x6000, 0x6fff) AM_RAM                                 // RAM
21932145   AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank2")                           // RAM (Banked)
2194   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") AM_WRITE_LEGACY(rongrong_palette_w)      // ROM (Banked)
2146   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1") AM_WRITE(rongrong_palette_w)      // ROM (Banked)
21952147ADDRESS_MAP_END
21962148
21972149static ADDRESS_MAP_START( mmpanic_portmap, AS_IO, 8, dynax_state )
r14883r14884
21992151   AM_RANGE(0x00, 0x0f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
22002152
22012153   // Layers 0-3:
2202   AM_RANGE(0x20, 0x23) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
2203   AM_RANGE(0x24, 0x27) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
2204   AM_RANGE(0x28, 0x2b) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
2205   AM_RANGE(0x2c, 0x2f) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
2206   AM_RANGE(0x34, 0x34) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
2207   AM_RANGE(0x35, 0x35) AM_WRITE_LEGACY(ddenlovr_priority_w)
2208   AM_RANGE(0x36, 0x36) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
2209   AM_RANGE(0x38, 0x38) AM_READ_LEGACY(unk_r)            // ? must be 78 on startup
2154   AM_RANGE(0x20, 0x23) AM_WRITE(ddenlovr_palette_base_w)
2155   AM_RANGE(0x24, 0x27) AM_WRITE(ddenlovr_palette_mask_w)
2156   AM_RANGE(0x28, 0x2b) AM_WRITE(ddenlovr_transparency_pen_w)
2157   AM_RANGE(0x2c, 0x2f) AM_WRITE(ddenlovr_transparency_mask_w)
2158   AM_RANGE(0x34, 0x34) AM_WRITE(ddenlovr_bgcolor_w)
2159   AM_RANGE(0x35, 0x35) AM_WRITE(ddenlovr_priority_w)
2160   AM_RANGE(0x36, 0x36) AM_WRITE(ddenlovr_layer_enable_w)
2161   AM_RANGE(0x38, 0x38) AM_READ(unk_r)            // ? must be 78 on startup
22102162
22112163   // Layers 4-7:
2212   AM_RANGE(0x40, 0x43) AM_WRITE_LEGACY(ddenlovr_palette_base2_w)
2213   AM_RANGE(0x44, 0x47) AM_WRITE_LEGACY(ddenlovr_palette_mask2_w)
2214   AM_RANGE(0x48, 0x4b) AM_WRITE_LEGACY(ddenlovr_transparency_pen2_w)
2215   AM_RANGE(0x4c, 0x4f) AM_WRITE_LEGACY(ddenlovr_transparency_mask2_w)
2216   AM_RANGE(0x54, 0x54) AM_WRITE_LEGACY(ddenlovr_bgcolor2_w)
2217   AM_RANGE(0x55, 0x55) AM_WRITE_LEGACY(ddenlovr_priority2_w)
2218   AM_RANGE(0x56, 0x56) AM_WRITE_LEGACY(ddenlovr_layer_enable2_w)
2219   AM_RANGE(0x58, 0x58) AM_READ_LEGACY(unk_r)            // ? must be 78 on startup
2164   AM_RANGE(0x40, 0x43) AM_WRITE(ddenlovr_palette_base2_w)
2165   AM_RANGE(0x44, 0x47) AM_WRITE(ddenlovr_palette_mask2_w)
2166   AM_RANGE(0x48, 0x4b) AM_WRITE(ddenlovr_transparency_pen2_w)
2167   AM_RANGE(0x4c, 0x4f) AM_WRITE(ddenlovr_transparency_mask2_w)
2168   AM_RANGE(0x54, 0x54) AM_WRITE(ddenlovr_bgcolor2_w)
2169   AM_RANGE(0x55, 0x55) AM_WRITE(ddenlovr_priority2_w)
2170   AM_RANGE(0x56, 0x56) AM_WRITE(ddenlovr_layer_enable2_w)
2171   AM_RANGE(0x58, 0x58) AM_READ(unk_r)            // ? must be 78 on startup
22202172
2221   AM_RANGE(0x60, 0x61) AM_WRITE_LEGACY(mmpanic_blitter_w)
2222   AM_RANGE(0x63, 0x63) AM_READ_LEGACY(rongrong_gfxrom_r)   // Video Chip
2223   AM_RANGE(0x64, 0x65) AM_WRITE_LEGACY(mmpanic_blitter2_w)
2173   AM_RANGE(0x60, 0x61) AM_WRITE(mmpanic_blitter_w)
2174   AM_RANGE(0x63, 0x63) AM_READ(rongrong_gfxrom_r)   // Video Chip
2175   AM_RANGE(0x64, 0x65) AM_WRITE(mmpanic_blitter2_w)
22242176   AM_RANGE(0x68, 0x68) AM_DEVWRITE_LEGACY("aysnd", ddenlovr_select_w)
2225   AM_RANGE(0x69, 0x69) AM_WRITE_LEGACY(mmpanic_lockout_w)
2177   AM_RANGE(0x69, 0x69) AM_WRITE(mmpanic_lockout_w)
22262178   AM_RANGE(0x6a, 0x6a) AM_READ_PORT("IN0")
22272179   AM_RANGE(0x6b, 0x6b) AM_READ_PORT("IN1")
2228   AM_RANGE(0x6c, 0x6d) AM_READ_LEGACY(mmpanic_link_r)   // Other cabinets?
2229   AM_RANGE(0x74, 0x74) AM_WRITE_LEGACY(mmpanic_rombank_w)
2180   AM_RANGE(0x6c, 0x6d) AM_READ(mmpanic_link_r)   // Other cabinets?
2181   AM_RANGE(0x74, 0x74) AM_WRITE(mmpanic_rombank_w)
22302182   AM_RANGE(0x78, 0x78) AM_WRITENOP            // 0, during RST 08 (irq acknowledge?)
22312183   AM_RANGE(0x7c, 0x7c) AM_DEVREADWRITE("oki", okim6295_device, read, write)   // Sound
2232   AM_RANGE(0x8c, 0x8c) AM_WRITE_LEGACY(mmpanic_soundlatch_w)   //
2233   AM_RANGE(0x88, 0x88) AM_WRITE_LEGACY(mmpanic_leds_w)      // Leds
2184   AM_RANGE(0x8c, 0x8c) AM_WRITE(mmpanic_soundlatch_w)   //
2185   AM_RANGE(0x88, 0x88) AM_WRITE(mmpanic_leds_w)      // Leds
22342186   AM_RANGE(0x90, 0x90) AM_WRITENOP            // written just before port 8c
22352187   AM_RANGE(0x94, 0x94) AM_READ_PORT("DSW1")
22362188   AM_RANGE(0x98, 0x98) AM_READ_PORT("DSW2")
22372189   AM_RANGE(0x9c, 0x9c) AM_READ_PORT("DSW3")      // DSW 1&2 high bits
2238   AM_RANGE(0xa6, 0xa6) AM_WRITE_LEGACY(mmpanic_leds2_w)      //
2190   AM_RANGE(0xa6, 0xa6) AM_WRITE(mmpanic_leds2_w)      //
22392191ADDRESS_MAP_END
22402192
22412193/* Sound CPU */
r14883r14884
22712223   AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank2")         // RAM (Banked)
22722224
22732225   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1")
2274   AM_RANGE(0x8000, 0x81ff) AM_WRITE_LEGACY(rongrong_palette_w)
2226   AM_RANGE(0x8000, 0x81ff) AM_WRITE(rongrong_palette_w)
22752227   AM_RANGE(0x8400, 0x87ff) AM_WRITENOP
22762228ADDRESS_MAP_END
22772229
22782230
2279static READ8_HANDLER( funkyfig_busy_r )
2231READ8_MEMBER(dynax_state::funkyfig_busy_r)
22802232{
22812233               // bit 0 ?
22822234   return 0x00;   // bit 7 = blitter busy
22832235}
22842236
2285static WRITE8_HANDLER( funkyfig_blitter_w )
2237WRITE8_MEMBER(dynax_state::funkyfig_blitter_w)
22862238{
2287   blitter_w_funkyfig(space->machine(), 0, offset, data, 0xe0);
2239   blitter_w_funkyfig(machine(), 0, offset, data, 0xe0);
22882240}
22892241
2290static WRITE8_HANDLER( funkyfig_rombank_w )
2242WRITE8_MEMBER(dynax_state::funkyfig_rombank_w)
22912243{
2292   dynax_state *state = space->machine().driver_data<dynax_state>();
22932244
2294   state->m_dsw_sel = data;
2245   m_dsw_sel = data;
22952246
2296   memory_set_bank(space->machine(), "bank1", data & 0x0f);
2247   memory_set_bank(machine(), "bank1", data & 0x0f);
22972248   // bit 4 selects palette ram at 8000?
2298   memory_set_bank(space->machine(), "bank2", ((data & 0xe0) >> 5));
2249   memory_set_bank(machine(), "bank2", ((data & 0xe0) >> 5));
22992250}
23002251
2301static READ8_HANDLER( funkyfig_dsw_r )
2252READ8_MEMBER(dynax_state::funkyfig_dsw_r)
23022253{
2303   dynax_state *state = space->machine().driver_data<dynax_state>();
23042254
2305   if (!BIT(state->m_dsw_sel, 0))  return input_port_read(space->machine(), "DSW1");
2306   if (!BIT(state->m_dsw_sel, 1))  return input_port_read(space->machine(), "DSW2");
2307   if (!BIT(state->m_dsw_sel, 2))  return input_port_read(space->machine(), "DSW3");
2308   logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", cpu_get_pc(&space->device()), state->m_dsw_sel);
2255   if (!BIT(m_dsw_sel, 0))  return input_port_read(machine(), "DSW1");
2256   if (!BIT(m_dsw_sel, 1))  return input_port_read(machine(), "DSW2");
2257   if (!BIT(m_dsw_sel, 2))  return input_port_read(machine(), "DSW3");
2258   logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel);
23092259   return 0xff;
23102260}
23112261
2312static READ8_HANDLER( funkyfig_coin_r )
2262READ8_MEMBER(dynax_state::funkyfig_coin_r)
23132263{
2314   dynax_state *state = space->machine().driver_data<dynax_state>();
23152264
2316   switch (state->m_input_sel)
2265   switch (m_input_sel)
23172266   {
2318      case 0x22:   return input_port_read(space->machine(), "IN2");
2319      case 0x23:   return state->m_funkyfig_lockout;
2267      case 0x22:   return input_port_read(machine(), "IN2");
2268      case 0x23:   return m_funkyfig_lockout;
23202269   }
2321   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space->device()), state->m_input_sel);
2270   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
23222271   return 0xff;
23232272}
23242273
2325static READ8_HANDLER( funkyfig_key_r )
2274READ8_MEMBER(dynax_state::funkyfig_key_r)
23262275{
2327   dynax_state *state = space->machine().driver_data<dynax_state>();
23282276
2329   switch (state->m_input_sel)
2277   switch (m_input_sel)
23302278   {
2331      case 0x20:   return input_port_read(space->machine(), "IN0");
2332      case 0x21:   return input_port_read(space->machine(), "IN1");
2279      case 0x20:   return input_port_read(machine(), "IN0");
2280      case 0x21:   return input_port_read(machine(), "IN1");
23332281   }
2334   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space->device()), state->m_input_sel);
2282   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
23352283   return 0xff;
23362284}
23372285
2338static WRITE8_HANDLER( funkyfig_lockout_w )
2286WRITE8_MEMBER(dynax_state::funkyfig_lockout_w)
23392287{
2340   dynax_state *state = space->machine().driver_data<dynax_state>();
23412288
2342   switch (state->m_input_sel)
2289   switch (m_input_sel)
23432290   {
23442291      case 0x2c:
2345         state->m_funkyfig_lockout = data;
2346         coin_counter_w(space->machine(), 0,   data  & 0x01);
2347         coin_lockout_w(space->machine(), 0, (~data) & 0x02);
2292         m_funkyfig_lockout = data;
2293         coin_counter_w(machine(), 0,   data  & 0x01);
2294         coin_lockout_w(machine(), 0, (~data) & 0x02);
23482295         if (data & ~0x03)
2349            logerror("%06x: warning, unknown bits written, lockout = %02x\n", cpu_get_pc(&space->device()), data);
2296            logerror("%06x: warning, unknown bits written, lockout = %02x\n", cpu_get_pc(&space.device()), data);
23502297         break;
23512298
23522299//      case 0xef:  16 bytes on startup
23532300
23542301      default:
2355         logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", cpu_get_pc(&space->device()), state->m_input_sel, data);
2302         logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_input_sel, data);
23562303   }
23572304}
23582305
23592306static ADDRESS_MAP_START( funkyfig_portmap, AS_IO, 8, dynax_state )
23602307   ADDRESS_MAP_GLOBAL_MASK(0xff)
23612308   AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("oki", okim6295_device, read, write)   // Sound
2362   AM_RANGE(0x01, 0x01) AM_WRITE_LEGACY(mmpanic_leds_w)      // Leds
2363   AM_RANGE(0x02, 0x02) AM_WRITE_LEGACY(mmpanic_soundlatch_w)   //
2364   AM_RANGE(0x04, 0x04) AM_READ_LEGACY(funkyfig_busy_r)
2365   AM_RANGE(0x1c, 0x1c) AM_READ_LEGACY(funkyfig_dsw_r)
2366   AM_RANGE(0x1e, 0x1e) AM_WRITE_LEGACY(funkyfig_rombank_w)
2367   AM_RANGE(0x20, 0x21) AM_WRITE_LEGACY(funkyfig_blitter_w)
2368   AM_RANGE(0x23, 0x23) AM_READ_LEGACY(rongrong_gfxrom_r)      // Video Chip
2309   AM_RANGE(0x01, 0x01) AM_WRITE(mmpanic_leds_w)      // Leds
2310   AM_RANGE(0x02, 0x02) AM_WRITE(mmpanic_soundlatch_w)   //
2311   AM_RANGE(0x04, 0x04) AM_READ(funkyfig_busy_r)
2312   AM_RANGE(0x1c, 0x1c) AM_READ(funkyfig_dsw_r)
2313   AM_RANGE(0x1e, 0x1e) AM_WRITE(funkyfig_rombank_w)
2314   AM_RANGE(0x20, 0x21) AM_WRITE(funkyfig_blitter_w)
2315   AM_RANGE(0x23, 0x23) AM_READ(rongrong_gfxrom_r)      // Video Chip
23692316   AM_RANGE(0x40, 0x4f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
23702317
23712318   // Layers 0-3:
2372   AM_RANGE(0x60, 0x63) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
2373   AM_RANGE(0x64, 0x67) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
2374   AM_RANGE(0x68, 0x6b) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
2375   AM_RANGE(0x6c, 0x6f) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
2376   AM_RANGE(0x74, 0x74) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
2377   AM_RANGE(0x75, 0x75) AM_WRITE_LEGACY(ddenlovr_priority_w)
2378   AM_RANGE(0x76, 0x76) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
2379   AM_RANGE(0x78, 0x78) AM_READ_LEGACY(unk_r)               // ? must be 78 on startup
2319   AM_RANGE(0x60, 0x63) AM_WRITE(ddenlovr_palette_base_w)
2320   AM_RANGE(0x64, 0x67) AM_WRITE(ddenlovr_palette_mask_w)
2321   AM_RANGE(0x68, 0x6b) AM_WRITE(ddenlovr_transparency_pen_w)
2322   AM_RANGE(0x6c, 0x6f) AM_WRITE(ddenlovr_transparency_mask_w)
2323   AM_RANGE(0x74, 0x74) AM_WRITE(ddenlovr_bgcolor_w)
2324   AM_RANGE(0x75, 0x75) AM_WRITE(ddenlovr_priority_w)
2325   AM_RANGE(0x76, 0x76) AM_WRITE(ddenlovr_layer_enable_w)
2326   AM_RANGE(0x78, 0x78) AM_READ(unk_r)               // ? must be 78 on startup
23802327
2381   AM_RANGE(0x80, 0x80) AM_WRITE_LEGACY(ddenlovr_select2_w)
2382   AM_RANGE(0x81, 0x81) AM_WRITE_LEGACY(funkyfig_lockout_w)
2383   AM_RANGE(0x82, 0x82) AM_READ_LEGACY(funkyfig_coin_r)
2384   AM_RANGE(0x83, 0x83) AM_READ_LEGACY(funkyfig_key_r)
2328   AM_RANGE(0x80, 0x80) AM_WRITE(ddenlovr_select2_w)
2329   AM_RANGE(0x81, 0x81) AM_WRITE(funkyfig_lockout_w)
2330   AM_RANGE(0x82, 0x82) AM_READ(funkyfig_coin_r)
2331   AM_RANGE(0x83, 0x83) AM_READ(funkyfig_key_r)
23852332
2386   AM_RANGE(0xa2, 0xa2) AM_WRITE_LEGACY(mmpanic_leds2_w)
2333   AM_RANGE(0xa2, 0xa2) AM_WRITE(mmpanic_leds2_w)
23872334ADDRESS_MAP_END
23882335
23892336
r14883r14884
24032350
24042351***************************************************************************/
24052352
2406static WRITE8_HANDLER( hanakanz_rombank_w )
2353WRITE8_MEMBER(dynax_state::hanakanz_rombank_w)
24072354{
2408   memory_set_bank(space->machine(), "bank1", data & 0x0f);
2409   memory_set_bank(space->machine(), "bank2", ((data & 0xf0) >> 4));
2355   memory_set_bank(machine(), "bank1", data & 0x0f);
2356   memory_set_bank(machine(), "bank2", ((data & 0xf0) >> 4));
24102357}
24112358
24122359static ADDRESS_MAP_START( hanakanz_map, AS_PROGRAM, 8, dynax_state )
r14883r14884
24172364ADDRESS_MAP_END
24182365
24192366
2420static WRITE8_HANDLER( hanakanz_keyb_w )
2367WRITE8_MEMBER(dynax_state::hanakanz_keyb_w)
24212368{
2422   dynax_state *state = space->machine().driver_data<dynax_state>();
2423   state->m_keyb = data;
2369   m_keyb = data;
24242370}
24252371
2426static WRITE8_HANDLER( hanakanz_dsw_w )
2372WRITE8_MEMBER(dynax_state::hanakanz_dsw_w)
24272373{
2428   dynax_state *state = space->machine().driver_data<dynax_state>();
2429   state->m_dsw_sel = data;
2374   m_dsw_sel = data;
24302375}
24312376
2432static READ8_HANDLER( hanakanz_keyb_r )
2377READ8_MEMBER(dynax_state::hanakanz_keyb_r)
24332378{
2434   dynax_state *state = space->machine().driver_data<dynax_state>();
24352379
24362380   UINT8 val = 0xff;
24372381
2438   if      (!BIT(state->m_keyb, 0))   val = input_port_read(space->machine(), offset ? "KEY5" : "KEY0");
2439   else if (!BIT(state->m_keyb, 1))   val = input_port_read(space->machine(), offset ? "KEY6" : "KEY1");
2440   else if (!BIT(state->m_keyb, 2))   val = input_port_read(space->machine(), offset ? "KEY7" : "KEY2");
2441   else if (!BIT(state->m_keyb, 3))   val = input_port_read(space->machine(), offset ? "KEY8" : "KEY3");
2442   else if (!BIT(state->m_keyb, 4))   val = input_port_read(space->machine(), offset ? "KEY9" : "KEY4");
2382   if      (!BIT(m_keyb, 0))   val = input_port_read(machine(), offset ? "KEY5" : "KEY0");
2383   else if (!BIT(m_keyb, 1))   val = input_port_read(machine(), offset ? "KEY6" : "KEY1");
2384   else if (!BIT(m_keyb, 2))   val = input_port_read(machine(), offset ? "KEY7" : "KEY2");
2385   else if (!BIT(m_keyb, 3))   val = input_port_read(machine(), offset ? "KEY8" : "KEY3");
2386   else if (!BIT(m_keyb, 4))   val = input_port_read(machine(), offset ? "KEY9" : "KEY4");
24432387
2444   val |= input_port_read(space->machine(), offset ? "HOPPER" : "BET");
2388   val |= input_port_read(machine(), offset ? "HOPPER" : "BET");
24452389   return val;
24462390}
24472391
2448static READ8_HANDLER( hanakanz_dsw_r )
2392READ8_MEMBER(dynax_state::hanakanz_dsw_r)
24492393{
2450   dynax_state *state = space->machine().driver_data<dynax_state>();
24512394
2452   if (!BIT(state->m_dsw_sel, 0))   return input_port_read(space->machine(), "DSW1");
2453   if (!BIT(state->m_dsw_sel, 1))   return input_port_read(space->machine(), "DSW2");
2454   if (!BIT(state->m_dsw_sel, 2))   return input_port_read(space->machine(), "DSW3");
2455   if (!BIT(state->m_dsw_sel, 3))   return input_port_read(space->machine(), "DSW4");
2456   if (!BIT(state->m_dsw_sel, 4))   return input_port_read(space->machine(), "DSW5");
2395   if (!BIT(m_dsw_sel, 0))   return input_port_read(machine(), "DSW1");
2396   if (!BIT(m_dsw_sel, 1))   return input_port_read(machine(), "DSW2");
2397   if (!BIT(m_dsw_sel, 2))   return input_port_read(machine(), "DSW3");
2398   if (!BIT(m_dsw_sel, 3))   return input_port_read(machine(), "DSW4");
2399   if (!BIT(m_dsw_sel, 4))   return input_port_read(machine(), "DSW5");
24572400   return 0xff;
24582401}
24592402
2460static READ8_HANDLER( hanakanz_busy_r )
2403READ8_MEMBER(dynax_state::hanakanz_busy_r)
24612404{
24622405   return 0x80;   // bit 7 == 0 -> blitter busy
24632406}
24642407
2465static READ8_HANDLER( hanakanz_gfxrom_r )
2408READ8_MEMBER(dynax_state::hanakanz_gfxrom_r)
24662409{
2467   dynax_state *state = space->machine().driver_data<dynax_state>();
2468   UINT8 *rom  = space->machine().region("blitter")->base();
2469   size_t size = space->machine().region("blitter")->bytes();
2470   int address = (state->m_ddenlovr_blit_address & 0xffffff) * 2;
2410   UINT8 *rom  = machine().region("blitter")->base();
2411   size_t size = machine().region("blitter")->bytes();
2412   int address = (m_ddenlovr_blit_address & 0xffffff) * 2;
24712413
24722414   if (address >= size)
24732415   {
2474      logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", cpu_get_pc(&space->device()), address);
2416      logerror("CPU#0 PC %06X: Error, Blitter address %06X out of range\n", cpu_get_pc(&space.device()), address);
24752417      address %= size;
24762418   }
24772419
24782420   if (offset == 0)
24792421   {
2480      state->m_romdata[0] = rom[address + 0];
2481      state->m_romdata[1] = rom[address + 1];
2422      m_romdata[0] = rom[address + 0];
2423      m_romdata[1] = rom[address + 1];
24822424
2483      state->m_ddenlovr_blit_address = (state->m_ddenlovr_blit_address + 1) & 0xffffff;
2425      m_ddenlovr_blit_address = (m_ddenlovr_blit_address + 1) & 0xffffff;
24842426
2485      return state->m_romdata[0];
2427      return m_romdata[0];
24862428   }
24872429   else
24882430   {
2489      return state->m_romdata[1];
2431      return m_romdata[1];
24902432   }
24912433}
24922434
24932435
2494static WRITE8_HANDLER( hanakanz_coincounter_w )
2436WRITE8_MEMBER(dynax_state::hanakanz_coincounter_w)
24952437{
24962438   // bit 0 = coin counter
24972439   // bit 1 = out counter
24982440   // bit 2 = 1 if bet on
24992441   // bit 3 = 1 if bet off
25002442
2501   coin_counter_w(space->machine(), 0, data & 1);
2443   coin_counter_w(machine(), 0, data & 1);
25022444
25032445   if (data & 0xf0)
2504      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space->device()), data);
2446      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data);
25052447
25062448#ifdef MAME_DEBUG
25072449//      popmessage("93 = %02x", data);
25082450#endif
25092451}
25102452
2511static WRITE8_HANDLER( hanakanz_palette_w )
2453WRITE8_MEMBER(dynax_state::hanakanz_palette_w)
25122454{
2513   dynax_state *state = space->machine().driver_data<dynax_state>();
25142455
2515   if (state->m_ddenlovr_blit_latch & 0x80)
2456   if (m_ddenlovr_blit_latch & 0x80)
25162457   {
2517      state->m_palette_index = data | ((state->m_ddenlovr_blit_latch & 1) << 8);
2458      m_palette_index = data | ((m_ddenlovr_blit_latch & 1) << 8);
25182459   }
25192460   else
25202461   {
25212462      // 0bbggggg bbbrrrrr
25222463      // 04343210 21043210
25232464
2524      int g = state->m_ddenlovr_blit_latch & 0x1f;
2465      int g = m_ddenlovr_blit_latch & 0x1f;
25252466      int r = data & 0x1f;
2526      int b = ((data & 0xe0) >> 5) | ((state->m_ddenlovr_blit_latch & 0x60) >> 2);
2527      palette_set_color_rgb(space->machine(), (state->m_palette_index++) & 0x1ff, pal5bit(r), pal5bit(g), pal5bit(b));
2467      int b = ((data & 0xe0) >> 5) | ((m_ddenlovr_blit_latch & 0x60) >> 2);
2468      palette_set_color_rgb(machine(), (m_palette_index++) & 0x1ff, pal5bit(r), pal5bit(g), pal5bit(b));
25282469   }
25292470}
25302471
r14883r14884
25342475   oki->set_bank_base((data & 0x40) ? 0x40000 : 0);
25352476}
25362477
2537static READ8_HANDLER( hanakanz_rand_r )
2478READ8_MEMBER(dynax_state::hanakanz_rand_r)
25382479{
2539   return space->machine().rand();
2480   return machine().rand();
25402481}
25412482
25422483static ADDRESS_MAP_START( hanakanz_portmap, AS_IO, 8, dynax_state )
25432484   ADDRESS_MAP_GLOBAL_MASK(0xff)
2544   AM_RANGE(0x2c, 0x2c) AM_READ_LEGACY(hanakanz_busy_r) AM_DEVWRITE_LEGACY("oki", hanakanz_oki_bank_w)
2545   AM_RANGE(0x2e, 0x2e) AM_WRITE_LEGACY(hanakanz_blitter_reg_w)
2546   AM_RANGE(0x30, 0x30) AM_WRITE_LEGACY(hanakanz_rombank_w)
2547   AM_RANGE(0x31, 0x31) AM_WRITE_LEGACY(hanakanz_dsw_w)
2548   AM_RANGE(0x32, 0x32) AM_READ_LEGACY(hanakanz_dsw_r)
2549   AM_RANGE(0x80, 0x80) AM_WRITE_LEGACY(hanakanz_blitter_data_w)
2550   AM_RANGE(0x81, 0x81) AM_WRITE_LEGACY(hanakanz_palette_w)
2551   AM_RANGE(0x83, 0x84) AM_READ_LEGACY(hanakanz_gfxrom_r)
2485   AM_RANGE(0x2c, 0x2c) AM_READ(hanakanz_busy_r) AM_DEVWRITE_LEGACY("oki", hanakanz_oki_bank_w)
2486   AM_RANGE(0x2e, 0x2e) AM_WRITE(hanakanz_blitter_reg_w)
2487   AM_RANGE(0x30, 0x30) AM_WRITE(hanakanz_rombank_w)
2488   AM_RANGE(0x31, 0x31) AM_WRITE(hanakanz_dsw_w)
2489   AM_RANGE(0x32, 0x32) AM_READ(hanakanz_dsw_r)
2490   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
2491   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
2492   AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r)
25522493   AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM")
2553   AM_RANGE(0x91, 0x92) AM_READ_LEGACY(hanakanz_keyb_r)
2554   AM_RANGE(0x93, 0x93) AM_WRITE_LEGACY(hanakanz_coincounter_w)
2555   AM_RANGE(0x94, 0x94) AM_WRITE_LEGACY(hanakanz_keyb_w)
2556   AM_RANGE(0x96, 0x96) AM_READ_LEGACY(hanakanz_rand_r)
2494   AM_RANGE(0x91, 0x92) AM_READ(hanakanz_keyb_r)
2495   AM_RANGE(0x93, 0x93) AM_WRITE(hanakanz_coincounter_w)
2496   AM_RANGE(0x94, 0x94) AM_WRITE(hanakanz_keyb_w)
2497   AM_RANGE(0x96, 0x96) AM_READ(hanakanz_rand_r)
25572498   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
25582499   AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
25592500   AM_RANGE(0xe0, 0xef) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
r14883r14884
25622503
25632504static ADDRESS_MAP_START( hkagerou_portmap, AS_IO, 8, dynax_state )
25642505   ADDRESS_MAP_GLOBAL_MASK(0xff)
2565   AM_RANGE(0x2c, 0x2c) AM_READ_LEGACY(hanakanz_busy_r) AM_DEVWRITE_LEGACY("oki", hanakanz_oki_bank_w)
2566   AM_RANGE(0x2e, 0x2e) AM_WRITE_LEGACY(hanakanz_blitter_reg_w)
2567   AM_RANGE(0x30, 0x30) AM_WRITE_LEGACY(hanakanz_rombank_w)
2568   AM_RANGE(0x31, 0x31) AM_WRITE_LEGACY(hanakanz_dsw_w)
2569   AM_RANGE(0x32, 0x32) AM_READ_LEGACY(hanakanz_dsw_r)
2570   AM_RANGE(0x80, 0x80) AM_WRITE_LEGACY(hanakanz_blitter_data_w)
2571   AM_RANGE(0x81, 0x81) AM_WRITE_LEGACY(hanakanz_palette_w)
2572   AM_RANGE(0x83, 0x84) AM_READ_LEGACY(hanakanz_gfxrom_r)
2506   AM_RANGE(0x2c, 0x2c) AM_READ(hanakanz_busy_r) AM_DEVWRITE_LEGACY("oki", hanakanz_oki_bank_w)
2507   AM_RANGE(0x2e, 0x2e) AM_WRITE(hanakanz_blitter_reg_w)
2508   AM_RANGE(0x30, 0x30) AM_WRITE(hanakanz_rombank_w)
2509   AM_RANGE(0x31, 0x31) AM_WRITE(hanakanz_dsw_w)
2510   AM_RANGE(0x32, 0x32) AM_READ(hanakanz_dsw_r)
2511   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
2512   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
2513   AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r)
25732514   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
25742515   AM_RANGE(0xb0, 0xb0) AM_READ_PORT("SYSTEM")
2575   AM_RANGE(0xb1, 0xb2) AM_READ_LEGACY(hanakanz_keyb_r)
2576   AM_RANGE(0xb3, 0xb3) AM_WRITE_LEGACY(hanakanz_coincounter_w)
2577   AM_RANGE(0xb4, 0xb4) AM_WRITE_LEGACY(hanakanz_keyb_w)
2578   AM_RANGE(0xb6, 0xb6) AM_READ_LEGACY(hanakanz_rand_r)
2516   AM_RANGE(0xb1, 0xb2) AM_READ(hanakanz_keyb_r)
2517   AM_RANGE(0xb3, 0xb3) AM_WRITE(hanakanz_coincounter_w)
2518   AM_RANGE(0xb4, 0xb4) AM_WRITE(hanakanz_keyb_w)
2519   AM_RANGE(0xb6, 0xb6) AM_READ(hanakanz_rand_r)
25792520   AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
25802521   AM_RANGE(0xe0, 0xef) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
25812522ADDRESS_MAP_END
25822523
25832524
2584static WRITE8_HANDLER( mjreach1_protection_w )
2525WRITE8_MEMBER(dynax_state::mjreach1_protection_w)
25852526{
2586   dynax_state *state = space->machine().driver_data<dynax_state>();
2587   state->m_prot_val = data;
2527   m_prot_val = data;
25882528}
25892529
2590static READ8_HANDLER( mjreach1_protection_r )
2530READ8_MEMBER(dynax_state::mjreach1_protection_r)
25912531{
2592   dynax_state *state = space->machine().driver_data<dynax_state>();
2593   return state->m_prot_val;
2532   return m_prot_val;
25942533}
25952534
25962535static ADDRESS_MAP_START( mjreach1_portmap, AS_IO, 8, dynax_state )
25972536   ADDRESS_MAP_GLOBAL_MASK(0xff)
2598   AM_RANGE(0x2c, 0x2c) AM_READ_LEGACY(hanakanz_busy_r) AM_DEVWRITE_LEGACY("oki", hanakanz_oki_bank_w)
2599   AM_RANGE(0x2e, 0x2e) AM_WRITE_LEGACY(hanakanz_blitter_reg_w)
2600   AM_RANGE(0x30, 0x30) AM_WRITE_LEGACY(hanakanz_rombank_w)
2601   AM_RANGE(0x31, 0x31) AM_WRITE_LEGACY(hanakanz_dsw_w)
2602   AM_RANGE(0x32, 0x32) AM_READ_LEGACY(hanakanz_dsw_r)
2603   AM_RANGE(0x80, 0x80) AM_WRITE_LEGACY(hanakanz_blitter_data_w)
2604   AM_RANGE(0x81, 0x81) AM_WRITE_LEGACY(hanakanz_palette_w)
2605   AM_RANGE(0x83, 0x84) AM_READ_LEGACY(hanakanz_gfxrom_r)
2606   AM_RANGE(0x90, 0x90) AM_WRITE_LEGACY(hanakanz_keyb_w)
2607   AM_RANGE(0x92, 0x92) AM_READ_LEGACY(hanakanz_rand_r)
2608   AM_RANGE(0x93, 0x93) AM_READWRITE_LEGACY(mjreach1_protection_r, mjreach1_protection_w)
2537   AM_RANGE(0x2c, 0x2c) AM_READ(hanakanz_busy_r) AM_DEVWRITE_LEGACY("oki", hanakanz_oki_bank_w)
2538   AM_RANGE(0x2e, 0x2e) AM_WRITE(hanakanz_blitter_reg_w)
2539   AM_RANGE(0x30, 0x30) AM_WRITE(hanakanz_rombank_w)
2540   AM_RANGE(0x31, 0x31) AM_WRITE(hanakanz_dsw_w)
2541   AM_RANGE(0x32, 0x32) AM_READ(hanakanz_dsw_r)
2542   AM_RANGE(0x80, 0x80) AM_WRITE(hanakanz_blitter_data_w)
2543   AM_RANGE(0x81, 0x81) AM_WRITE(hanakanz_palette_w)
2544   AM_RANGE(0x83, 0x84) AM_READ(hanakanz_gfxrom_r)
2545   AM_RANGE(0x90, 0x90) AM_WRITE(hanakanz_keyb_w)
2546   AM_RANGE(0x92, 0x92) AM_READ(hanakanz_rand_r)
2547   AM_RANGE(0x93, 0x93) AM_READWRITE(mjreach1_protection_r, mjreach1_protection_w)
26092548   AM_RANGE(0x94, 0x94) AM_READ_PORT("SYSTEM")
2610   AM_RANGE(0x95, 0x96) AM_READ_LEGACY(hanakanz_keyb_r)
2611   AM_RANGE(0x97, 0x97) AM_WRITE_LEGACY(hanakanz_coincounter_w)
2549   AM_RANGE(0x95, 0x96) AM_READ(hanakanz_keyb_r)
2550   AM_RANGE(0x97, 0x97) AM_WRITE(hanakanz_coincounter_w)
26122551   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
26132552   AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
26142553   AM_RANGE(0xe0, 0xef) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
r14883r14884
26192558     Mahjong Chuukanejyo
26202559***************************************************************************/
26212560
2622static READ8_HANDLER( mjchuuka_keyb_r )
2561READ8_MEMBER(dynax_state::mjchuuka_keyb_r)
26232562{
2624   dynax_state *state = space->machine().driver_data<dynax_state>();
26252563   UINT8 val = 0xff;
26262564
2627   if      (!BIT(state->m_keyb, 0))   val = input_port_read(space->machine(), offset ? "KEY5" : "KEY0");
2628   else if (!BIT(state->m_keyb, 1))   val = input_port_read(space->machine(), offset ? "KEY6" : "KEY1");
2629   else if (!BIT(state->m_keyb, 2))   val = input_port_read(space->machine(), offset ? "KEY7" : "KEY2");
2630   else if (!BIT(state->m_keyb, 3))   val = input_port_read(space->machine(), offset ? "KEY8" : "KEY3");
2631   else if (!BIT(state->m_keyb, 4))   val = input_port_read(space->machine(), offset ? "KEY9" : "KEY4");
2565   if      (!BIT(m_keyb, 0))   val = input_port_read(machine(), offset ? "KEY5" : "KEY0");
2566   else if (!BIT(m_keyb, 1))   val = input_port_read(machine(), offset ? "KEY6" : "KEY1");
2567   else if (!BIT(m_keyb, 2))   val = input_port_read(machine(), offset ? "KEY7" : "KEY2");
2568   else if (!BIT(m_keyb, 3))   val = input_port_read(machine(), offset ? "KEY8" : "KEY3");
2569   else if (!BIT(m_keyb, 4))   val = input_port_read(machine(), offset ? "KEY9" : "KEY4");
26322570
2633   val |= input_port_read(space->machine(), offset ? "HOPPER" : "BET");
2571   val |= input_port_read(machine(), offset ? "HOPPER" : "BET");
26342572
26352573   if (offset)
26362574      val |= 0x80;   // blitter busy
r14883r14884
26382576   return val;
26392577}
26402578
2641static WRITE8_HANDLER( mjchuuka_blitter_w )
2579WRITE8_MEMBER(dynax_state::mjchuuka_blitter_w)
26422580{
26432581   hanakanz_blitter_reg_w(space, 0, offset >> 8);
26442582   hanakanz_blitter_data_w(space, 0, data);
r14883r14884
26612599   state->m_romdata[1] = rom[address + 1];
26622600}
26632601
2664static READ8_HANDLER( mjchuuka_gfxrom_0_r )
2602READ8_MEMBER(dynax_state::mjchuuka_gfxrom_0_r)
26652603{
2666   dynax_state *state = space->machine().driver_data<dynax_state>();
2667   mjchuuka_get_romdata(space->machine());
2668   state->m_ddenlovr_blit_address++;
2669   return state->m_romdata[0];
2604   mjchuuka_get_romdata(machine());
2605   m_ddenlovr_blit_address++;
2606   return m_romdata[0];
26702607}
26712608
2672static READ8_HANDLER( mjchuuka_gfxrom_1_r )
2609READ8_MEMBER(dynax_state::mjchuuka_gfxrom_1_r)
26732610{
2674   dynax_state *state = space->machine().driver_data<dynax_state>();
2675   return state->m_romdata[1];
2611   return m_romdata[1];
26762612}
26772613
2678static WRITE8_HANDLER( mjchuuka_palette_w )
2614WRITE8_MEMBER(dynax_state::mjchuuka_palette_w)
26792615{
2680   dynax_state *state = space->machine().driver_data<dynax_state>();
26812616   UINT16 rgb = (offset & 0xff00) | data;
26822617
26832618   if (rgb & 0x8000)
26842619   {
2685      state->m_palette_index = rgb & 0x1ff;
2620      m_palette_index = rgb & 0x1ff;
26862621   }
26872622   else
26882623   {
r14883r14884
26922627      int r = (rgb >> 0) & 0x1f;
26932628      int g = (rgb >> 8) & 0x1f;
26942629      int b = ((rgb >> 5) & 0x07) | ((rgb & 0x6000) >> 10);
2695      palette_set_color_rgb(space->machine(), (state->m_palette_index++) & 0x1ff, pal5bit(r), pal5bit(g), pal5bit(b));
2630      palette_set_color_rgb(machine(), (m_palette_index++) & 0x1ff, pal5bit(r), pal5bit(g), pal5bit(b));
26962631   }
26972632}
26982633
2699static WRITE8_HANDLER( mjchuuka_coincounter_w )
2634WRITE8_MEMBER(dynax_state::mjchuuka_coincounter_w)
27002635{
27012636   // bit 0 = in counter
27022637   // bit 1 = out counter
27032638   // bit 3 = lockout
27042639   // bit 8?
27052640
2706   coin_counter_w(space->machine(), 0,  data   & 0x01);
2707   coin_lockout_w(space->machine(), 0, (~data) & 0x08);
2641   coin_counter_w(machine(), 0,  data   & 0x01);
2642   coin_lockout_w(machine(), 0, (~data) & 0x08);
27082643
27092644   if (data & 0x74)
2710      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space->device()), data);
2645      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data);
27112646
27122647#ifdef MAME_DEBUG
27132648//    popmessage("40 = %02x",data);
r14883r14884
27262661}
27272662
27282663static ADDRESS_MAP_START( mjchuuka_portmap, AS_IO, 8, dynax_state )    // 16 bit I/O
2729   AM_RANGE(0x13, 0x13) AM_MIRROR(0xff00) AM_READ_LEGACY(hanakanz_rand_r)
2730   AM_RANGE(0x1c, 0x1c) AM_MIRROR(0xff00) AM_WRITE_LEGACY(hanakanz_rombank_w)
2664   AM_RANGE(0x13, 0x13) AM_MIRROR(0xff00) AM_READ(hanakanz_rand_r)
2665   AM_RANGE(0x1c, 0x1c) AM_MIRROR(0xff00) AM_WRITE(hanakanz_rombank_w)
27312666   AM_RANGE(0x1e, 0x1e) AM_MIRROR(0xff00) AM_DEVWRITE_LEGACY("oki", mjchuuka_oki_bank_w   )
2732   AM_RANGE(0x20, 0x20) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_WRITE_LEGACY(mjchuuka_blitter_w)
2733   AM_RANGE(0x21, 0x21) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_WRITE_LEGACY(mjchuuka_palette_w)
2734   AM_RANGE(0x23, 0x23) AM_MIRROR(0xff00) AM_READ_LEGACY(mjchuuka_gfxrom_0_r)
2735   AM_RANGE(0x40, 0x40) AM_MIRROR(0xff00) AM_WRITE_LEGACY(mjchuuka_coincounter_w)
2736   AM_RANGE(0x41, 0x41) AM_MIRROR(0xff00) AM_WRITE_LEGACY(hanakanz_keyb_w)
2667   AM_RANGE(0x20, 0x20) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_WRITE(mjchuuka_blitter_w)
2668   AM_RANGE(0x21, 0x21) AM_MIRROR(0xff00) AM_MASK(0xff00) AM_WRITE(mjchuuka_palette_w)
2669   AM_RANGE(0x23, 0x23) AM_MIRROR(0xff00) AM_READ(mjchuuka_gfxrom_0_r)
2670   AM_RANGE(0x40, 0x40) AM_MIRROR(0xff00) AM_WRITE(mjchuuka_coincounter_w)
2671   AM_RANGE(0x41, 0x41) AM_MIRROR(0xff00) AM_WRITE(hanakanz_keyb_w)
27372672   AM_RANGE(0x42, 0x42) AM_MIRROR(0xff00) AM_READ_PORT("SYSTEM")
2738   AM_RANGE(0x43, 0x44) AM_MIRROR(0xff00) AM_READ_LEGACY(mjchuuka_keyb_r)
2739   AM_RANGE(0x45, 0x45) AM_MIRROR(0xff00) AM_READ_LEGACY(mjchuuka_gfxrom_1_r)
2673   AM_RANGE(0x43, 0x44) AM_MIRROR(0xff00) AM_READ(mjchuuka_keyb_r)
2674   AM_RANGE(0x45, 0x45) AM_MIRROR(0xff00) AM_READ(mjchuuka_gfxrom_1_r)
27402675   AM_RANGE(0x60, 0x60) AM_MIRROR(0xff00) AM_READ_PORT("DSW1")
27412676   AM_RANGE(0x61, 0x61) AM_MIRROR(0xff00) AM_READ_PORT("DSW2")
27422677   AM_RANGE(0x62, 0x62) AM_MIRROR(0xff00) AM_READ_PORT("DSW3")
r14883r14884
27582693   AM_RANGE(0x6000, 0x6fff) AM_RAM            // RAM
27592694   AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank2")      // RAM (Banked)
27602695   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1")      // ROM/RAM (Banked)
2761   AM_RANGE(0xf000, 0xf1ff) AM_WRITE_LEGACY(rongrong_palette_w)   // RAM enabled by bit 4 of rombank
2696   AM_RANGE(0xf000, 0xf1ff) AM_WRITE(rongrong_palette_w)   // RAM enabled by bit 4 of rombank
27622697   AM_RANGE(0xf200, 0xffff) AM_WRITENOP      // ""
27632698ADDRESS_MAP_END
27642699
2765static WRITE8_HANDLER( mjmyster_rambank_w )
2700WRITE8_MEMBER(dynax_state::mjmyster_rambank_w)
27662701{
2767   memory_set_bank(space->machine(), "bank2", data & 0x07);
2768   //logerror("%04x: rambank = %02x\n", cpu_get_pc(&space->device()), data);
2702   memory_set_bank(machine(), "bank2", data & 0x07);
2703   //logerror("%04x: rambank = %02x\n", cpu_get_pc(&space.device()), data);
27692704}
27702705
2771static WRITE8_HANDLER( mjmyster_select2_w )
2706WRITE8_MEMBER(dynax_state::mjmyster_select2_w)
27722707{
2773   dynax_state *state = space->machine().driver_data<dynax_state>();
2774   state->m_input_sel = data;
2708   m_input_sel = data;
27752709
27762710   if (data & 0x80)
2777      state->m_keyb = 1;
2711      m_keyb = 1;
27782712}
27792713
2780static READ8_HANDLER( mjmyster_coins_r )
2714READ8_MEMBER(dynax_state::mjmyster_coins_r)
27812715{
2782   dynax_state *state = space->machine().driver_data<dynax_state>();
27832716
2784   switch (state->m_input_sel)
2717   switch (m_input_sel)
27852718   {
2786      case 0x00:   return input_port_read(space->machine(), "SYSTEM");
2719      case 0x00:   return input_port_read(machine(), "SYSTEM");
27872720      case 0x01:   return 0xff;
27882721      case 0x02:   return 0xff;   // bit 7 = 0 -> blitter busy, + hopper switch
27892722      case 0x03:   return 0xff;
27902723   }
27912724
2792   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space->device()), state->m_input_sel);
2725   logerror("%06x: warning, unknown bits read, ddenlovr_select2 = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
27932726
27942727   return 0xff;
27952728}
27962729
2797static READ8_HANDLER( mjmyster_keyb_r )
2730READ8_MEMBER(dynax_state::mjmyster_keyb_r)
27982731{
2799   dynax_state *state = space->machine().driver_data<dynax_state>();
28002732   UINT8 ret = 0xff;
28012733
2802   if      (BIT(state->m_keyb, 0))   ret = input_port_read(space->machine(), "KEY0");
2803   else if (BIT(state->m_keyb, 1))   ret = input_port_read(space->machine(), "KEY1");
2804   else if (BIT(state->m_keyb, 2))   ret = input_port_read(space->machine(), "KEY2");
2805   else if (BIT(state->m_keyb, 3))   ret = input_port_read(space->machine(), "KEY3");
2806   else if (BIT(state->m_keyb, 4))   ret = input_port_read(space->machine(), "KEY4");
2807   else   logerror("%06x: warning, unknown bits read, keyb = %02x\n", cpu_get_pc(&space->device()), state->m_keyb);
2734   if      (BIT(m_keyb, 0))   ret = input_port_read(machine(), "KEY0");
2735   else if (BIT(m_keyb, 1))   ret = input_port_read(machine(), "KEY1");
2736   else if (BIT(m_keyb, 2))   ret = input_port_read(machine(), "KEY2");
2737   else if (BIT(m_keyb, 3))   ret = input_port_read(machine(), "KEY3");
2738   else if (BIT(m_keyb, 4))   ret = input_port_read(machine(), "KEY4");
2739   else   logerror("%06x: warning, unknown bits read, keyb = %02x\n", cpu_get_pc(&space.device()), m_keyb);
28082740
2809   state->m_keyb <<= 1;
2741   m_keyb <<= 1;
28102742
28112743   return ret;
28122744}
28132745
2814static READ8_HANDLER( mjmyster_dsw_r )
2746READ8_MEMBER(dynax_state::mjmyster_dsw_r)
28152747{
2816   dynax_state *state = space->machine().driver_data<dynax_state>();
28172748
2818   if (!BIT(state->m_dsw_sel, 0))   return input_port_read(space->machine(), "DSW4");
2819   if (!BIT(state->m_dsw_sel, 1))   return input_port_read(space->machine(), "DSW3");
2820   if (!BIT(state->m_dsw_sel, 2))   return input_port_read(space->machine(), "DSW2");
2821   if (!BIT(state->m_dsw_sel, 3))   return input_port_read(space->machine(), "DSW1");
2822   if (!BIT(state->m_dsw_sel, 4))   return input_port_read(space->machine(), "DSW5");
2823   logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", cpu_get_pc(&space->device()), state->m_dsw_sel);
2749   if (!BIT(m_dsw_sel, 0))   return input_port_read(machine(), "DSW4");
2750   if (!BIT(m_dsw_sel, 1))   return input_port_read(machine(), "DSW3");
2751   if (!BIT(m_dsw_sel, 2))   return input_port_read(machine(), "DSW2");
2752   if (!BIT(m_dsw_sel, 3))   return input_port_read(machine(), "DSW1");
2753   if (!BIT(m_dsw_sel, 4))   return input_port_read(machine(), "DSW5");
2754   logerror("%06x: warning, unknown bits read, ddenlovr_select = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel);
28242755   return 0xff;
28252756}
28262757
2827static WRITE8_HANDLER( mjmyster_coincounter_w )
2758WRITE8_MEMBER(dynax_state::mjmyster_coincounter_w)
28282759{
2829   dynax_state *state = space->machine().driver_data<dynax_state>();
28302760
2831   switch (state->m_input_sel)
2761   switch (m_input_sel)
28322762   {
28332763      case 0x0c:
2834         coin_counter_w(space->machine(), 0, (~data) & 0x01);   // coin in
2835         coin_counter_w(space->machine(), 0, (~data) & 0x02);   // coin out actually
2764         coin_counter_w(machine(), 0, (~data) & 0x01);   // coin in
2765         coin_counter_w(machine(), 0, (~data) & 0x02);   // coin out actually
28362766         #ifdef MAME_DEBUG
28372767//              popmessage("cc: %02x",data);
28382768         #endif
r14883r14884
28402770         break;
28412771
28422772      default:
2843         logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", cpu_get_pc(&space->device()), state->m_input_sel, data);
2773         logerror("%06x: warning, unknown bits written, ddenlovr_select2 = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_input_sel, data);
28442774   }
28452775}
28462776
2847static WRITE8_HANDLER( mjmyster_blitter_w )
2777WRITE8_MEMBER(dynax_state::mjmyster_blitter_w)
28482778{
2849   blitter_w(space, 0, offset, data, 0xfc);
2779   blitter_w(&space, 0, offset, data, 0xfc);
28502780}
28512781
28522782static ADDRESS_MAP_START( mjmyster_portmap, AS_IO, 8, dynax_state )
28532783   ADDRESS_MAP_GLOBAL_MASK(0xff)
2854   AM_RANGE(0x00, 0x01) AM_WRITE_LEGACY(mjmyster_blitter_w)
2855   AM_RANGE(0x03, 0x03) AM_READ_LEGACY(rongrong_gfxrom_r)
2856   AM_RANGE(0x1c, 0x1c) AM_WRITE_LEGACY(mjmyster_rambank_w)
2857   AM_RANGE(0x1e, 0x1e) AM_WRITE_LEGACY(mmpanic_rombank_w)
2858   AM_RANGE(0x20, 0x20) AM_WRITE_LEGACY(mjmyster_select2_w)
2859   AM_RANGE(0x21, 0x21) AM_WRITE_LEGACY(mjmyster_coincounter_w)
2860   AM_RANGE(0x22, 0x22) AM_READ_LEGACY(mjmyster_coins_r)
2861   AM_RANGE(0x23, 0x23) AM_READ_LEGACY(mjmyster_keyb_r)
2784   AM_RANGE(0x00, 0x01) AM_WRITE(mjmyster_blitter_w)
2785   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
2786   AM_RANGE(0x1c, 0x1c) AM_WRITE(mjmyster_rambank_w)
2787   AM_RANGE(0x1e, 0x1e) AM_WRITE(mmpanic_rombank_w)
2788   AM_RANGE(0x20, 0x20) AM_WRITE(mjmyster_select2_w)
2789   AM_RANGE(0x21, 0x21) AM_WRITE(mjmyster_coincounter_w)
2790   AM_RANGE(0x22, 0x22) AM_READ(mjmyster_coins_r)
2791   AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r)
28622792   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
28632793   AM_RANGE(0x42, 0x43) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
28642794   AM_RANGE(0x44, 0x44) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
28652795   AM_RANGE(0x46, 0x46) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
28662796   AM_RANGE(0x48, 0x48) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
28672797   AM_RANGE(0x60, 0x6f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
2868   AM_RANGE(0x80, 0x83) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
2869   AM_RANGE(0x84, 0x87) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
2870   AM_RANGE(0x88, 0x8b) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
2871   AM_RANGE(0x8c, 0x8f) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
2872   AM_RANGE(0x94, 0x94) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
2873   AM_RANGE(0x95, 0x95) AM_WRITE_LEGACY(ddenlovr_priority_w)
2874   AM_RANGE(0x96, 0x96) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
2875   AM_RANGE(0x98, 0x98) AM_READ_LEGACY(unk_r)                     // ? must be 78 on startup
2876   AM_RANGE(0xc2, 0xc2) AM_READ_LEGACY(hanakanz_rand_r)
2877   AM_RANGE(0xc3, 0xc3) AM_READ_LEGACY(mjmyster_dsw_r)
2798   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
2799   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
2800   AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w)
2801   AM_RANGE(0x8c, 0x8f) AM_WRITE(ddenlovr_transparency_mask_w)
2802   AM_RANGE(0x94, 0x94) AM_WRITE(ddenlovr_bgcolor_w)
2803   AM_RANGE(0x95, 0x95) AM_WRITE(ddenlovr_priority_w)
2804   AM_RANGE(0x96, 0x96) AM_WRITE(ddenlovr_layer_enable_w)
2805   AM_RANGE(0x98, 0x98) AM_READ(unk_r)                     // ? must be 78 on startup
2806   AM_RANGE(0xc2, 0xc2) AM_READ(hanakanz_rand_r)
2807   AM_RANGE(0xc3, 0xc3) AM_READ(mjmyster_dsw_r)
28782808ADDRESS_MAP_END
28792809
28802810/***************************************************************************
28812811                            Hanafuda Hana Ginga
28822812***************************************************************************/
28832813
2884static WRITE8_HANDLER( hginga_rombank_w )
2814WRITE8_MEMBER(dynax_state::hginga_rombank_w)
28852815{
2886   dynax_state *state = space->machine().driver_data<dynax_state>();
2887   memory_set_bank(space->machine(), "bank1", data & 0x7);
2888   state->m_hginga_rombank = data;
2816   memory_set_bank(machine(), "bank1", data & 0x7);
2817   m_hginga_rombank = data;
28892818}
28902819
28912820// similar to rongrong
2892static READ8_HANDLER( hginga_protection_r )
2821READ8_MEMBER(dynax_state::hginga_protection_r)
28932822{
2894   dynax_state *state = space->machine().driver_data<dynax_state>();
2895   UINT8 *rom = space->machine().region("maincpu")->base();
2823   UINT8 *rom = machine().region("maincpu")->base();
28962824
2897   if (state->m_hginga_rombank & 0x10)
2825   if (m_hginga_rombank & 0x10)
28982826      return hanakanz_rand_r(space, 0);
2899   return rom[0x10000 + 0x8000 * (state->m_hginga_rombank & 0x7) + 0xf601 - 0x8000];
2827   return rom[0x10000 + 0x8000 * (m_hginga_rombank & 0x7) + 0xf601 - 0x8000];
29002828}
29012829
29022830static ADDRESS_MAP_START( hginga_map, AS_PROGRAM, 8, dynax_state )
29032831   AM_RANGE(0x0000, 0x5fff) AM_ROM                        // ROM
29042832   AM_RANGE(0x6000, 0x6fff) AM_RAM                        // RAM
29052833   AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank2")                  // RAM (Banked)
2906   AM_RANGE(0xf601, 0xf601) AM_READ_LEGACY(hginga_protection_r)
2834   AM_RANGE(0xf601, 0xf601) AM_READ(hginga_protection_r)
29072835   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1")                  // ROM/RAM (Banked)
2908   AM_RANGE(0xf000, 0xf1ff) AM_WRITE_LEGACY(rongrong_palette_w)   // RAM enabled by bit 4 of rombank
2836   AM_RANGE(0xf000, 0xf1ff) AM_WRITE(rongrong_palette_w)   // RAM enabled by bit 4 of rombank
29092837   AM_RANGE(0xf700, 0xf706) AM_WRITENOP
29102838ADDRESS_MAP_END
29112839
r14883r14884
29232851   return 0xff;
29242852}
29252853
2926static WRITE8_HANDLER( hginga_input_w )
2854WRITE8_MEMBER(dynax_state::hginga_input_w)
29272855{
2928   dynax_state *state = space->machine().driver_data<dynax_state>();
2929   state->m_input_sel = data;
2930   state->m_keyb = 0;
2856   m_input_sel = data;
2857   m_keyb = 0;
29312858}
29322859
2933static READ8_HANDLER( hginga_coins_r )
2860READ8_MEMBER(dynax_state::hginga_coins_r)
29342861{
2935   dynax_state *state = space->machine().driver_data<dynax_state>();
29362862
2937   switch (state->m_input_sel)
2863   switch (m_input_sel)
29382864   {
2939      case 0x20:   return input_port_read(space->machine(), "SYSTEM");
2940      case 0x21:   return input_port_read(space->machine(), "BET");
2865      case 0x20:   return input_port_read(machine(), "SYSTEM");
2866      case 0x21:   return input_port_read(machine(), "BET");
29412867      case 0x22:   return 0x7f;   // bit 7 = blitter busy, bit 6 = hopper
2942      case 0x23:   return state->m_coins;
2868      case 0x23:   return m_coins;
29432869   }
2944   logerror("%04x: coins_r with select = %02x\n", cpu_get_pc(&space->device()), state->m_input_sel);
2870   logerror("%04x: coins_r with select = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
29452871   return 0xff;
29462872}
29472873
2948static WRITE8_HANDLER( hginga_80_w )
2874WRITE8_MEMBER(dynax_state::hginga_80_w)
29492875{
29502876//  popmessage("port 80 = %02x", data);
29512877}
29522878
2953static WRITE8_HANDLER( hginga_coins_w )
2879WRITE8_MEMBER(dynax_state::hginga_coins_w)
29542880{
2955   dynax_state *state = space->machine().driver_data<dynax_state>();
29562881
2957   switch (state->m_input_sel)
2882   switch (m_input_sel)
29582883   {
29592884      case 0x2d:
29602885         break;
r14883r14884
29642889         // bit 2 = 1 if bet on
29652890         // bit 3 = 1 if bet on
29662891         // bit 7?
2967         coin_counter_w(space->machine(), 0, data & 1);
2892         coin_counter_w(machine(), 0, data & 1);
29682893#ifdef MAME_DEBUG
29692894//          popmessage("COINS %02x", data);
29702895#endif
2971         state->m_coins = data;
2896         m_coins = data;
29722897         break;
29732898      default:
2974         logerror("%04x: coins_w with select = %02x, data = %02x\n", cpu_get_pc(&space->device()), state->m_input_sel, data);
2899         logerror("%04x: coins_w with select = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_input_sel, data);
29752900   }
29762901}
29772902
2978static READ8_HANDLER( hginga_input_r )
2903READ8_MEMBER(dynax_state::hginga_input_r)
29792904{
2980   dynax_state *state = space->machine().driver_data<dynax_state>();
29812905   static const char *const keynames0[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
29822906   static const char *const keynames1[] = { "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
29832907
2984   switch (state->m_input_sel)
2908   switch (m_input_sel)
29852909   {
29862910      case 0x2d:
29872911         return 0xff;
29882912
29892913      // player 1
29902914      case 0xa1:
2991         return input_port_read(space->machine(), keynames0[state->m_keyb++]);
2915         return input_port_read(machine(), keynames0[m_keyb++]);
29922916
29932917      // player 2
29942918      case 0xa2:
2995         return input_port_read(space->machine(), keynames1[state->m_keyb++]);
2919         return input_port_read(machine(), keynames1[m_keyb++]);
29962920   }
2997   logerror("%04x: input_r with select = %02x\n", cpu_get_pc(&space->device()), state->m_input_sel);
2921   logerror("%04x: input_r with select = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
29982922   return 0xff;
29992923}
30002924
3001static WRITE8_HANDLER( hginga_blitter_w )
2925WRITE8_MEMBER(dynax_state::hginga_blitter_w)
30022926{
3003   dynax_state *state = space->machine().driver_data<dynax_state>();
30042927   if (offset == 0)
30052928   {
3006      state->m_ddenlovr_blit_latch = data;
2929      m_ddenlovr_blit_latch = data;
30072930   }
30082931   else
30092932   {
3010      switch (state->m_ddenlovr_blit_latch & 0x3f)
2933      switch (m_ddenlovr_blit_latch & 0x3f)
30112934      {
30122935         case 0x00:
30132936            switch (data & 0xf)
r14883r14884
30262949            break;
30272950      }
30282951   }
3029   blitter_w(space, 0, offset, data, 0xfc);
2952   blitter_w(&space, 0, offset, data, 0xfc);
30302953}
30312954
30322955static ADDRESS_MAP_START( hginga_portmap, AS_IO, 8, dynax_state )
30332956   ADDRESS_MAP_GLOBAL_MASK(0xff)
3034   AM_RANGE(0x00, 0x01) AM_WRITE_LEGACY(hginga_blitter_w)
3035   AM_RANGE(0x03, 0x03) AM_READ_LEGACY(rongrong_gfxrom_r)
3036   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE_LEGACY(mjmyster_rambank_w)
3037   AM_RANGE(0x1e, 0x1e) AM_WRITE_LEGACY(hginga_rombank_w)
2957   AM_RANGE(0x00, 0x01) AM_WRITE(hginga_blitter_w)
2958   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
2959   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(mjmyster_rambank_w)
2960   AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w)
30382961   AM_RANGE(0x22, 0x23) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
30392962   AM_RANGE(0x24, 0x24) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
30402963   AM_RANGE(0x26, 0x26) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
30412964   AM_RANGE(0x28, 0x28) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
3042   AM_RANGE(0x40, 0x40) AM_WRITE_LEGACY(hginga_input_w)
3043   AM_RANGE(0x41, 0x41) AM_WRITE_LEGACY(hginga_coins_w)
3044   AM_RANGE(0x42, 0x42) AM_READ_LEGACY(hginga_coins_r)
3045   AM_RANGE(0x43, 0x43) AM_READ_LEGACY(hginga_input_r)
2965   AM_RANGE(0x40, 0x40) AM_WRITE(hginga_input_w)
2966   AM_RANGE(0x41, 0x41) AM_WRITE(hginga_coins_w)
2967   AM_RANGE(0x42, 0x42) AM_READ(hginga_coins_r)
2968   AM_RANGE(0x43, 0x43) AM_READ(hginga_input_r)
30462969   AM_RANGE(0x60, 0x6f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
3047   AM_RANGE(0x80, 0x80) AM_WRITE_LEGACY(hginga_80_w)
3048   AM_RANGE(0xa0, 0xa3) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
3049   AM_RANGE(0xa4, 0xa7) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
3050   AM_RANGE(0xa8, 0xab) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
3051   AM_RANGE(0xac, 0xaf) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
3052   AM_RANGE(0xb4, 0xb4) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
3053   AM_RANGE(0xb5, 0xb5) AM_WRITE_LEGACY(ddenlovr_priority_w)
3054   AM_RANGE(0xb6, 0xb6) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
3055   AM_RANGE(0xb8, 0xb8) AM_READ_LEGACY(unk_r)   // ? must be 78 on startup
2970   AM_RANGE(0x80, 0x80) AM_WRITE(hginga_80_w)
2971   AM_RANGE(0xa0, 0xa3) AM_WRITE(ddenlovr_palette_base_w)
2972   AM_RANGE(0xa4, 0xa7) AM_WRITE(ddenlovr_palette_mask_w)
2973   AM_RANGE(0xa8, 0xab) AM_WRITE(ddenlovr_transparency_pen_w)
2974   AM_RANGE(0xac, 0xaf) AM_WRITE(ddenlovr_transparency_mask_w)
2975   AM_RANGE(0xb4, 0xb4) AM_WRITE(ddenlovr_bgcolor_w)
2976   AM_RANGE(0xb5, 0xb5) AM_WRITE(ddenlovr_priority_w)
2977   AM_RANGE(0xb6, 0xb6) AM_WRITE(ddenlovr_layer_enable_w)
2978   AM_RANGE(0xb8, 0xb8) AM_READ(unk_r)   // ? must be 78 on startup
30562979ADDRESS_MAP_END
30572980
30582981
r14883r14884
30742997   return 0x7f;   // bit 7 = blitter busy, bit 6 = hopper
30752998}
30762999
3077static WRITE8_HANDLER( hgokou_dsw_sel_w )
3000WRITE8_MEMBER(dynax_state::hgokou_dsw_sel_w)
30783001{
3079   dynax_state *state = space->machine().driver_data<dynax_state>();
3080   state->m_dsw_sel = data;
3002   m_dsw_sel = data;
30813003}
30823004
3083static READ8_HANDLER( hgokou_input_r )
3005READ8_MEMBER(dynax_state::hgokou_input_r)
30843006{
3085   dynax_state *state = space->machine().driver_data<dynax_state>();
30863007
3087   switch (state->m_dsw_sel)
3008   switch (m_dsw_sel)
30883009   {
3089      case 0x20:   return input_port_read(space->machine(), "SYSTEM");
3090      case 0x21:   return hgokou_player_r(space, 1);
3091      case 0x22:   return hgokou_player_r(space, 0);
3092      case 0x23:   return state->m_coins;
3010      case 0x20:   return input_port_read(machine(), "SYSTEM");
3011      case 0x21:   return hgokou_player_r(&space, 1);
3012      case 0x22:   return hgokou_player_r(&space, 0);
3013      case 0x23:   return m_coins;
30933014   }
3094   logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", cpu_get_pc(&space->device()), state->m_dsw_sel);
3015   logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel);
30953016   return 0xff;
30963017}
30973018
3098static WRITE8_HANDLER( hgokou_input_w )
3019WRITE8_MEMBER(dynax_state::hgokou_input_w)
30993020{
3100   dynax_state *state = space->machine().driver_data<dynax_state>();
31013021
3102   switch (state->m_dsw_sel)
3022   switch (m_dsw_sel)
31033023   {
31043024      case 0x2c:
31053025         // bit 0 = coin counter
31063026         // bit 1 = out counter
31073027         // bit 2 = hopper
31083028         // bit 7 = ?
3109         coin_counter_w(space->machine(), 0, data & 1);
3110         state->m_hopper = data & 0x04;
3029         coin_counter_w(machine(), 0, data & 1);
3030         m_hopper = data & 0x04;
31113031#ifdef MAME_DEBUG
31123032//          popmessage("COINS %02x",data);
31133033#endif
3114         state->m_coins = data;
3034         m_coins = data;
31153035         break;
31163036
3117      case 0x2d:   state->m_input_sel = data;   break;
3037      case 0x2d:   m_input_sel = data;   break;
31183038
31193039      case 0x2f:   break;   // ? written with 2f (hgokou)
31203040
31213041      default:
3122         logerror("%04x: input_w with select = %02x, data = %02x\n", cpu_get_pc(&space->device()), state->m_dsw_sel, data);
3042         logerror("%04x: input_w with select = %02x, data = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel, data);
31233043   }
31243044}
31253045
31263046// similar to rongrong
3127static READ8_HANDLER( hgokou_protection_r )
3047READ8_MEMBER(dynax_state::hgokou_protection_r)
31283048{
3129   dynax_state *state = space->machine().driver_data<dynax_state>();
3130   UINT8 *rom = space->machine().region("maincpu")->base();
3049   UINT8 *rom = machine().region("maincpu")->base();
31313050
3132   if (state->m_hginga_rombank == 0)
3051   if (m_hginga_rombank == 0)
31333052      return hanakanz_rand_r(space, 0);
3134   return rom[0x10000 + 0x8000 * (state->m_hginga_rombank & 0x7) + 0xe601 - 0x8000];
3053   return rom[0x10000 + 0x8000 * (m_hginga_rombank & 0x7) + 0xe601 - 0x8000];
31353054}
31363055
31373056static ADDRESS_MAP_START( hgokou_map, AS_PROGRAM, 8, dynax_state )
31383057   AM_RANGE(0x0000, 0x5fff) AM_ROM                        // ROM
31393058   AM_RANGE(0x6000, 0x6fff) AM_RAM                        // RAM
31403059   AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank2")                  // RAM (Banked)
3141   AM_RANGE(0xe601, 0xe601) AM_READ_LEGACY(hgokou_protection_r)
3060   AM_RANGE(0xe601, 0xe601) AM_READ(hgokou_protection_r)
31423061   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1")                  // ROM (Banked)
3143   AM_RANGE(0xe000, 0xe1ff) AM_WRITE_LEGACY(rongrong_palette_w)
3062   AM_RANGE(0xe000, 0xe1ff) AM_WRITE(rongrong_palette_w)
31443063   AM_RANGE(0xe700, 0xe706) AM_WRITENOP
31453064ADDRESS_MAP_END
31463065
31473066
31483067static ADDRESS_MAP_START( hgokou_portmap, AS_IO, 8, dynax_state )
31493068   ADDRESS_MAP_GLOBAL_MASK(0xff)
3150   AM_RANGE(0x00, 0x01) AM_WRITE_LEGACY(hginga_blitter_w)
3151   AM_RANGE(0x03, 0x03) AM_READ_LEGACY(rongrong_gfxrom_r)
3152   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE_LEGACY(mjmyster_rambank_w)      // ? ack on RTC int
3153   AM_RANGE(0x1e, 0x1e) AM_WRITE_LEGACY(hginga_rombank_w)
3069   AM_RANGE(0x00, 0x01) AM_WRITE(hginga_blitter_w)
3070   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
3071   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(mjmyster_rambank_w)      // ? ack on RTC int
3072   AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w)
31543073   AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
3155   AM_RANGE(0x40, 0x43) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
3156   AM_RANGE(0x44, 0x47) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
3157   AM_RANGE(0x48, 0x4b) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
3158   AM_RANGE(0x4c, 0x4f) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
3159   AM_RANGE(0x54, 0x54) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
3160   AM_RANGE(0x55, 0x55) AM_WRITE_LEGACY(ddenlovr_priority_w)
3161   AM_RANGE(0x56, 0x56) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
3162   AM_RANGE(0x58, 0x58) AM_READ_LEGACY(unk_r)                           // ? must be 78 on startup
3163   AM_RANGE(0x60, 0x60) AM_WRITE_LEGACY(hgokou_dsw_sel_w)
3164   AM_RANGE(0x61, 0x61) AM_WRITE_LEGACY(hgokou_input_w)
3165   AM_RANGE(0x62, 0x62) AM_READ_LEGACY(hgokou_input_r)
3074   AM_RANGE(0x40, 0x43) AM_WRITE(ddenlovr_palette_base_w)
3075   AM_RANGE(0x44, 0x47) AM_WRITE(ddenlovr_palette_mask_w)
3076   AM_RANGE(0x48, 0x4b) AM_WRITE(ddenlovr_transparency_pen_w)
3077   AM_RANGE(0x4c, 0x4f) AM_WRITE(ddenlovr_transparency_mask_w)
3078   AM_RANGE(0x54, 0x54) AM_WRITE(ddenlovr_bgcolor_w)
3079   AM_RANGE(0x55, 0x55) AM_WRITE(ddenlovr_priority_w)
3080   AM_RANGE(0x56, 0x56) AM_WRITE(ddenlovr_layer_enable_w)
3081   AM_RANGE(0x58, 0x58) AM_READ(unk_r)                           // ? must be 78 on startup
3082   AM_RANGE(0x60, 0x60) AM_WRITE(hgokou_dsw_sel_w)
3083   AM_RANGE(0x61, 0x61) AM_WRITE(hgokou_input_w)
3084   AM_RANGE(0x62, 0x62) AM_READ(hgokou_input_r)
31663085   AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki", okim6295_device, read, write)
31673086   AM_RANGE(0x82, 0x83) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
31683087   AM_RANGE(0x84, 0x84) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
31693088   AM_RANGE(0x86, 0x86) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
31703089   AM_RANGE(0x88, 0x88) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
3171   AM_RANGE(0xb0, 0xb0) AM_READ_LEGACY(hanakanz_rand_r)
3090   AM_RANGE(0xb0, 0xb0) AM_READ(hanakanz_rand_r)
31723091ADDRESS_MAP_END
31733092
31743093
r14883r14884
31763095                        Hanafuda Hana Gokou Bangaihen
31773096***************************************************************************/
31783097
3179static READ8_HANDLER( hgokbang_input_r )
3098READ8_MEMBER(dynax_state::hgokbang_input_r)
31803099{
3181   dynax_state *state = space->machine().driver_data<dynax_state>();
31823100
31833101   UINT8 ret;
3184   switch (state->m_dsw_sel)
3102   switch (m_dsw_sel)
31853103   {
31863104      case 0x2d:
3187         if (state->m_input_sel == 0xff)   // reset auto-incrementing input_sel
3188            state->m_input_sel = 0xfe;
3105         if (m_input_sel == 0xff)   // reset auto-incrementing input_sel
3106            m_input_sel = 0xfe;
31893107         return 0;   // discarded
31903108      case 0xa1:
3191         ret = hgokou_player_r(space, 1);
3192         state->m_input_sel <<= 1;      // auto-increment input_sel
3193         state->m_input_sel |= 1;
3109         ret = hgokou_player_r(&space, 1);
3110         m_input_sel <<= 1;      // auto-increment input_sel
3111         m_input_sel |= 1;
31943112         return ret;
31953113      case 0xa2:
3196         ret = hgokou_player_r(space, 0);
3197         state->m_input_sel <<= 1;      // auto-increment input_sel
3198         state->m_input_sel |= 1;
3114         ret = hgokou_player_r(&space, 0);
3115         m_input_sel <<= 1;      // auto-increment input_sel
3116         m_input_sel |= 1;
31993117         return ret;
32003118   }
3201   logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", cpu_get_pc(&space->device()), state->m_dsw_sel);
3119   logerror("%06x: warning, unknown bits read, dsw_sel = %02x\n", cpu_get_pc(&space.device()), m_dsw_sel);
32023120   return 0xff;
32033121}
32043122
32053123static ADDRESS_MAP_START( hgokbang_portmap, AS_IO, 8, dynax_state )
32063124   ADDRESS_MAP_GLOBAL_MASK(0xff)
3207   AM_RANGE(0x00, 0x01) AM_WRITE_LEGACY(hginga_blitter_w)
3208   AM_RANGE(0x03, 0x03) AM_READ_LEGACY(rongrong_gfxrom_r)
3209   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE_LEGACY(mjmyster_rambank_w)      // ? ack on RTC int
3210   AM_RANGE(0x1e, 0x1e) AM_WRITE_LEGACY(hginga_rombank_w)
3125   AM_RANGE(0x00, 0x01) AM_WRITE(hginga_blitter_w)
3126   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
3127   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(mjmyster_rambank_w)      // ? ack on RTC int
3128   AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w)
32113129   AM_RANGE(0x20, 0x20) AM_DEVREADWRITE("oki", okim6295_device, read, write)
32123130   AM_RANGE(0x22, 0x23) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
32133131   AM_RANGE(0x24, 0x24) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
32143132   AM_RANGE(0x26, 0x26) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
32153133   AM_RANGE(0x28, 0x28) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
3216   AM_RANGE(0x40, 0x40) AM_WRITE_LEGACY(hgokou_dsw_sel_w)
3217   AM_RANGE(0x41, 0x41) AM_WRITE_LEGACY(hgokou_input_w)
3218   AM_RANGE(0x42, 0x42) AM_READ_LEGACY(hgokou_input_r)
3219   AM_RANGE(0x43, 0x43) AM_READ_LEGACY(hgokbang_input_r)
3134   AM_RANGE(0x40, 0x40) AM_WRITE(hgokou_dsw_sel_w)
3135   AM_RANGE(0x41, 0x41) AM_WRITE(hgokou_input_w)
3136   AM_RANGE(0x42, 0x42) AM_READ(hgokou_input_r)
3137   AM_RANGE(0x43, 0x43) AM_READ(hgokbang_input_r)
32203138   AM_RANGE(0x60, 0x6f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
3221   AM_RANGE(0xa0, 0xa3) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
3222   AM_RANGE(0xa4, 0xa7) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
3223   AM_RANGE(0xa8, 0xab) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
3224   AM_RANGE(0xac, 0xaf) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
3225   AM_RANGE(0xb4, 0xb4) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
3226   AM_RANGE(0xb5, 0xb5) AM_WRITE_LEGACY(ddenlovr_priority_w)
3227   AM_RANGE(0xb6, 0xb6) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
3228   AM_RANGE(0xb8, 0xb8) AM_READ_LEGACY(unk_r)                           // ? must be 78 on startup
3229   AM_RANGE(0xe0, 0xe0) AM_READ_LEGACY(hanakanz_rand_r)
3139   AM_RANGE(0xa0, 0xa3) AM_WRITE(ddenlovr_palette_base_w)
3140   AM_RANGE(0xa4, 0xa7) AM_WRITE(ddenlovr_palette_mask_w)
3141   AM_RANGE(0xa8, 0xab) AM_WRITE(ddenlovr_transparency_pen_w)
3142   AM_RANGE(0xac, 0xaf) AM_WRITE(ddenlovr_transparency_mask_w)
3143   AM_RANGE(0xb4, 0xb4) AM_WRITE(ddenlovr_bgcolor_w)
3144   AM_RANGE(0xb5, 0xb5) AM_WRITE(ddenlovr_priority_w)
3145   AM_RANGE(0xb6, 0xb6) AM_WRITE(ddenlovr_layer_enable_w)
3146   AM_RANGE(0xb8, 0xb8) AM_READ(unk_r)                           // ? must be 78 on startup
3147   AM_RANGE(0xe0, 0xe0) AM_READ(hanakanz_rand_r)
32303148ADDRESS_MAP_END
32313149
32323150
r14883r14884
32343152                            Super Hana Paradise
32353153***************************************************************************/
32363154
3237static WRITE8_HANDLER( hparadis_select_w )
3155WRITE8_MEMBER(dynax_state::hparadis_select_w)
32383156{
3239   dynax_state *state = space->machine().driver_data<dynax_state>();
32403157
3241   state->m_dsw_sel = data;
3242   state->m_keyb = 0;
3158   m_dsw_sel = data;
3159   m_keyb = 0;
32433160
3244   memory_set_bank(space->machine(), "bank1", data & 0x07);
3245   memory_set_bank(space->machine(), "bank2", ((data & 0xe0) >> 5));
3161   memory_set_bank(machine(), "bank1", data & 0x07);
3162   memory_set_bank(machine(), "bank2", ((data & 0xe0) >> 5));
32463163}
32473164
32483165
3249static READ8_HANDLER( hparadis_input_r )
3166READ8_MEMBER(dynax_state::hparadis_input_r)
32503167{
3251   dynax_state *state = space->machine().driver_data<dynax_state>();
32523168   static const char *const keynames0[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
32533169   static const char *const keynames1[] = { "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
32543170
3255   switch (state->m_input_sel)
3171   switch (m_input_sel)
32563172   {
3257      case 0x00:   return input_port_read(space->machine(), "P1");
3258      case 0x01:   return input_port_read(space->machine(), "P2");
3259      case 0x02:   return input_port_read(space->machine(), "SYSTEM");
3173      case 0x00:   return input_port_read(machine(), "P1");
3174      case 0x01:   return input_port_read(machine(), "P2");
3175      case 0x02:   return input_port_read(machine(), "SYSTEM");
32603176      case 0x0d:   return 0x00;
3261      case 0x80:   return input_port_read(space->machine(), keynames0[state->m_keyb++]);   // P1 (Keys)
3262      case 0x81:   return input_port_read(space->machine(), keynames1[state->m_keyb++]);   // P2 (Keys)
3177      case 0x80:   return input_port_read(machine(), keynames0[m_keyb++]);   // P1 (Keys)
3178      case 0x81:   return input_port_read(machine(), keynames1[m_keyb++]);   // P2 (Keys)
32633179   }
3264   logerror("%06x: warning, unknown bits read, input_sel = %02x\n", cpu_get_pc(&space->device()), state->m_input_sel);
3180   logerror("%06x: warning, unknown bits read, input_sel = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
32653181   return 0xff;
32663182}
32673183
3268static READ8_HANDLER( hparadis_dsw_r )
3184READ8_MEMBER(dynax_state::hparadis_dsw_r)
32693185{
3270   dynax_state *state = space->machine().driver_data<dynax_state>();
32713186
3272   if (!BIT(state->m_dsw_sel, 0))   return input_port_read(space->machine(), "DSW1");
3273   if (!BIT(state->m_dsw_sel, 1))   return input_port_read(space->machine(), "DSW2");
3274   if (!BIT(state->m_dsw_sel, 2))   return 0xff;
3275   if (!BIT(state->m_dsw_sel, 3))   return 0xff;
3276   if (!BIT(state->m_dsw_sel, 4))   return input_port_read(space->machine(), "DSW3");
3187   if (!BIT(m_dsw_sel, 0))   return input_port_read(machine(), "DSW1");
3188   if (!BIT(m_dsw_sel, 1))   return input_port_read(machine(), "DSW2");
3189   if (!BIT(m_dsw_sel, 2))   return 0xff;
3190   if (!BIT(m_dsw_sel, 3))   return 0xff;
3191   if (!BIT(m_dsw_sel, 4))   return input_port_read(machine(), "DSW3");
32773192   return 0xff;
32783193}
32793194
3280static WRITE8_HANDLER( hparadis_coin_w )
3195WRITE8_MEMBER(dynax_state::hparadis_coin_w)
32813196{
3282   dynax_state *state = space->machine().driver_data<dynax_state>();
32833197
3284   switch (state->m_input_sel)
3198   switch (m_input_sel)
32853199   {
3286      case 0x0c:   coin_counter_w(space->machine(), 0, data & 1);   break;
3200      case 0x0c:   coin_counter_w(machine(), 0, data & 1);   break;
32873201      case 0x0d:   break;
32883202      default:
3289         logerror("%04x: coins_w with select = %02x, data = %02x\n",cpu_get_pc(&space->device()), state->m_input_sel, data);
3203         logerror("%04x: coins_w with select = %02x, data = %02x\n",cpu_get_pc(&space.device()), m_input_sel, data);
32903204   }
32913205}
32923206
r14883r14884
32953209   AM_RANGE(0x6000, 0x6fff) AM_RAM                        // RAM
32963210   AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank2")                  // RAM (Banked)
32973211   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1")                  // ROM (Banked)
3298   AM_RANGE(0xc000, 0xc1ff) AM_WRITE_LEGACY(rongrong_palette_w)
3212   AM_RANGE(0xc000, 0xc1ff) AM_WRITE(rongrong_palette_w)
32993213ADDRESS_MAP_END
33003214
33013215// the RTC seems unused
33023216static ADDRESS_MAP_START( hparadis_portmap, AS_IO, 8, dynax_state )
33033217   ADDRESS_MAP_GLOBAL_MASK(0xff)
3304   AM_RANGE(0x00, 0x01) AM_WRITE_LEGACY(rongrong_blitter_w)
3305   AM_RANGE(0x03, 0x03) AM_READ_LEGACY(rongrong_gfxrom_r)
3306   AM_RANGE(0x1b, 0x1b) AM_READWRITE_LEGACY(rongrong_blitter_busy_r, rongrong_blitter_busy_w)
3307   AM_RANGE(0x1c, 0x1c) AM_READ_LEGACY(hparadis_dsw_r)
3308   AM_RANGE(0x1e, 0x1e) AM_WRITE_LEGACY(hparadis_select_w)
3218   AM_RANGE(0x00, 0x01) AM_WRITE(rongrong_blitter_w)
3219   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
3220   AM_RANGE(0x1b, 0x1b) AM_READWRITE(rongrong_blitter_busy_r, rongrong_blitter_busy_w)
3221   AM_RANGE(0x1c, 0x1c) AM_READ(hparadis_dsw_r)
3222   AM_RANGE(0x1e, 0x1e) AM_WRITE(hparadis_select_w)
33093223   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
33103224   AM_RANGE(0x60, 0x61) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
3311   AM_RANGE(0x80, 0x83) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
3312   AM_RANGE(0x84, 0x87) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
3313   AM_RANGE(0x88, 0x8b) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
3314   AM_RANGE(0x8c, 0x8f) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
3315   AM_RANGE(0x94, 0x94) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
3316   AM_RANGE(0x95, 0x95) AM_WRITE_LEGACY(ddenlovr_priority_w)
3317   AM_RANGE(0x96, 0x96) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
3318   AM_RANGE(0x98, 0x98) AM_READ_LEGACY(unk_r)   // ? must be 78 on startup
3319   AM_RANGE(0xa0, 0xa0) AM_WRITE_LEGACY(hginga_input_w)
3320   AM_RANGE(0xa1, 0xa1) AM_WRITE_LEGACY(hparadis_coin_w)
3321   AM_RANGE(0xa2, 0xa3) AM_READ_LEGACY(hparadis_input_r)
3225   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
3226   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
3227   AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w)
3228   AM_RANGE(0x8c, 0x8f) AM_WRITE(ddenlovr_transparency_mask_w)
3229   AM_RANGE(0x94, 0x94) AM_WRITE(ddenlovr_bgcolor_w)
3230   AM_RANGE(0x95, 0x95) AM_WRITE(ddenlovr_priority_w)
3231   AM_RANGE(0x96, 0x96) AM_WRITE(ddenlovr_layer_enable_w)
3232   AM_RANGE(0x98, 0x98) AM_READ(unk_r)   // ? must be 78 on startup
3233   AM_RANGE(0xa0, 0xa0) AM_WRITE(hginga_input_w)
3234   AM_RANGE(0xa1, 0xa1) AM_WRITE(hparadis_coin_w)
3235   AM_RANGE(0xa2, 0xa3) AM_READ(hparadis_input_r)
33223236   AM_RANGE(0xc2, 0xc2) AM_WRITENOP   // enables palette RAM at c000
33233237ADDRESS_MAP_END
33243238
r14883r14884
33273241                          Mahjong Mysterious World
33283242***************************************************************************/
33293243
3330static READ8_HANDLER( mjmywrld_coins_r )
3244READ8_MEMBER(dynax_state::mjmywrld_coins_r)
33313245{
3332   dynax_state *state = space->machine().driver_data<dynax_state>();
33333246
3334   switch (state->m_input_sel)
3247   switch (m_input_sel)
33353248   {
3336      case 0x80:   return input_port_read(space->machine(), "SYSTEM");
3249      case 0x80:   return input_port_read(machine(), "SYSTEM");
33373250      case 0x81:   return 0x00;
33383251      case 0x82:   return 0xff;   // bit 7 = 0 -> blitter busy, + hopper switch
33393252      case 0x83:   return 0x00;
33403253   }
33413254
3342   logerror("%06x: warning, unknown bits read, input_sel = %02x\n", cpu_get_pc(&space->device()), state->m_input_sel);
3255   logerror("%06x: warning, unknown bits read, input_sel = %02x\n", cpu_get_pc(&space.device()), m_input_sel);
33433256
33443257   return 0xff;
33453258}
33463259
33473260static ADDRESS_MAP_START( mjmywrld_portmap, AS_IO, 8, dynax_state )
33483261   ADDRESS_MAP_GLOBAL_MASK(0xff)
3349   AM_RANGE(0x00, 0x01) AM_WRITE_LEGACY(mjmyster_blitter_w)
3350   AM_RANGE(0x03, 0x03) AM_READ_LEGACY(rongrong_gfxrom_r)
3351   AM_RANGE(0x1c, 0x1c) AM_WRITE_LEGACY(mjmyster_rambank_w)
3352   AM_RANGE(0x1e, 0x1e) AM_WRITE_LEGACY(hginga_rombank_w)
3353   AM_RANGE(0x20, 0x20) AM_WRITE_LEGACY(mjmyster_select2_w)
3354   AM_RANGE(0x21, 0x21) AM_WRITE_LEGACY(mjmyster_coincounter_w)
3355   AM_RANGE(0x22, 0x22) AM_READ_LEGACY(mjmywrld_coins_r)
3356   AM_RANGE(0x23, 0x23) AM_READ_LEGACY(mjmyster_keyb_r)
3262   AM_RANGE(0x00, 0x01) AM_WRITE(mjmyster_blitter_w)
3263   AM_RANGE(0x03, 0x03) AM_READ(rongrong_gfxrom_r)
3264   AM_RANGE(0x1c, 0x1c) AM_WRITE(mjmyster_rambank_w)
3265   AM_RANGE(0x1e, 0x1e) AM_WRITE(hginga_rombank_w)
3266   AM_RANGE(0x20, 0x20) AM_WRITE(mjmyster_select2_w)
3267   AM_RANGE(0x21, 0x21) AM_WRITE(mjmyster_coincounter_w)
3268   AM_RANGE(0x22, 0x22) AM_READ(mjmywrld_coins_r)
3269   AM_RANGE(0x23, 0x23) AM_READ(mjmyster_keyb_r)
33573270   AM_RANGE(0x40, 0x40) AM_DEVREADWRITE("oki", okim6295_device, read, write)
33583271   AM_RANGE(0x42, 0x43) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
33593272   AM_RANGE(0x44, 0x44) AM_DEVREAD_LEGACY("aysnd", ay8910_r)
33603273   AM_RANGE(0x46, 0x46) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)
33613274   AM_RANGE(0x48, 0x48) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_w)
33623275   AM_RANGE(0x60, 0x6f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
3363   AM_RANGE(0x80, 0x83) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
3364   AM_RANGE(0x84, 0x87) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
3365   AM_RANGE(0x88, 0x8b) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
3366   AM_RANGE(0x8c, 0x8f) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
3367   AM_RANGE(0x94, 0x94) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
3368   AM_RANGE(0x95, 0x95) AM_WRITE_LEGACY(ddenlovr_priority_w)
3369   AM_RANGE(0x96, 0x96) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
3370   AM_RANGE(0x98, 0x98) AM_READ_LEGACY(unk_r)   // ? must be 78 on startup
3371   AM_RANGE(0xc0, 0xc0) AM_READ_LEGACY(hanakanz_rand_r)
3372   AM_RANGE(0xe0, 0xe0) AM_READ_LEGACY(mjmyster_dsw_r)
3276   AM_RANGE(0x80, 0x83) AM_WRITE(ddenlovr_palette_base_w)
3277   AM_RANGE(0x84, 0x87) AM_WRITE(ddenlovr_palette_mask_w)
3278   AM_RANGE(0x88, 0x8b) AM_WRITE(ddenlovr_transparency_pen_w)
3279   AM_RANGE(0x8c, 0x8f) AM_WRITE(ddenlovr_transparency_mask_w)
3280   AM_RANGE(0x94, 0x94) AM_WRITE(ddenlovr_bgcolor_w)
3281   AM_RANGE(0x95, 0x95) AM_WRITE(ddenlovr_priority_w)
3282   AM_RANGE(0x96, 0x96) AM_WRITE(ddenlovr_layer_enable_w)
3283   AM_RANGE(0x98, 0x98) AM_READ(unk_r)   // ? must be 78 on startup
3284   AM_RANGE(0xc0, 0xc0) AM_READ(hanakanz_rand_r)
3285   AM_RANGE(0xe0, 0xe0) AM_READ(mjmyster_dsw_r)
33733286ADDRESS_MAP_END
33743287
33753288
r14883r14884
33773290                  Panel & Variety Akamaru Q Jousyou Dont-R
33783291***************************************************************************/
33793292
3380static READ16_HANDLER( akamaru_protection1_r )
3293READ16_MEMBER(dynax_state::akamaru_protection1_r)
33813294{
3382   dynax_state *state = space->machine().driver_data<dynax_state>();
3383   return (state->m_prot_16 & 0x0008) ? 0x0001 : 0x0000;
3295   return (m_prot_16 & 0x0008) ? 0x0001 : 0x0000;
33843296}
33853297
3386static WRITE16_HANDLER( akamaru_protection1_w )
3298WRITE16_MEMBER(dynax_state::akamaru_protection1_w)
33873299{
3388   dynax_state *state = space->machine().driver_data<dynax_state>();
33893300   int bank;
33903301
3391   COMBINE_DATA(&state->m_prot_16);
3302   COMBINE_DATA(&m_prot_16);
33923303   // BCD number?
3393   bank = (((state->m_prot_16 >> 4) & 0x0f) % 10) * 10 + ((state->m_prot_16 & 0x0f) % 10);
3394   state->m_oki->set_bank_base(bank * 0x40000);
3304   bank = (((m_prot_16 >> 4) & 0x0f) % 10) * 10 + ((m_prot_16 & 0x0f) % 10);
3305   m_oki->set_bank_base(bank * 0x40000);
33953306
3396//  popmessage("bank $%0x (%d)", state->m_prot_16, bank);
3307//  popmessage("bank $%0x (%d)", m_prot_16, bank);
33973308}
33983309
3399static READ16_HANDLER( akamaru_protection2_r )
3310READ16_MEMBER(dynax_state::akamaru_protection2_r)
34003311{
34013312   return 0x55;
34023313}
34033314
3404static READ16_HANDLER( akamaru_dsw_r )
3315READ16_MEMBER(dynax_state::akamaru_dsw_r)
34053316{
3406   dynax_state *state = space->machine().driver_data<dynax_state>();
34073317   UINT16 dsw = 0;
34083318
3409   if (state->m_dsw_sel16[1] == 0xff)   dsw |= input_port_read(space->machine(), "DSW1");
3410   if (state->m_dsw_sel16[0] == 0xff)   dsw |= input_port_read(space->machine(), "DSW2");
3319   if (m_dsw_sel16[1] == 0xff)   dsw |= input_port_read(machine(), "DSW1");
3320   if (m_dsw_sel16[0] == 0xff)   dsw |= input_port_read(machine(), "DSW2");
34113321   return dsw;
34123322}
34133323
3414static READ16_HANDLER( akamaru_blitter_r )
3324READ16_MEMBER(dynax_state::akamaru_blitter_r)
34153325{
3416   dynax_state *state = space->machine().driver_data<dynax_state>();
3417   return state->m_ddenlovr_blitter_irq_flag << 6;   // bit 7 = 1 -> blitter busy
3326   return m_ddenlovr_blitter_irq_flag << 6;   // bit 7 = 1 -> blitter busy
34183327}
34193328
3420static READ16_HANDLER( akamaru_e0010d_r )
3329READ16_MEMBER(dynax_state::akamaru_e0010d_r)
34213330{
34223331   return 0xffff;   // read but not used, it seems
34233332}
r14883r14884
34253334static ADDRESS_MAP_START( akamaru_map, AS_PROGRAM, 16, dynax_state )
34263335   AM_RANGE(0x000000, 0x1fffff) AM_ROM                                          // ROM
34273336
3428   AM_RANGE(0x213570, 0x213571) AM_WRITE_LEGACY(akamaru_protection1_w)                     // OKI bank
3429   AM_RANGE(0x624680, 0x624681) AM_READ_LEGACY(akamaru_protection1_r)
3337   AM_RANGE(0x213570, 0x213571) AM_WRITE(akamaru_protection1_w)                     // OKI bank
3338   AM_RANGE(0x624680, 0x624681) AM_READ(akamaru_protection1_r)
34303339
3431   AM_RANGE(0xd00000, 0xd003ff) AM_WRITE_LEGACY(ddenlovr_palette_w)                        // Palette
3340   AM_RANGE(0xd00000, 0xd003ff) AM_WRITE(ddenlovr_palette_w)                        // Palette
34323341//  AM_RANGE(0xd01000, 0xd017ff) AM_WRITEONLY                                          // 0
34333342
3434   AM_RANGE(0xe00040, 0xe00047) AM_WRITE_LEGACY(ddenlovr16_palette_base_w)
3435   AM_RANGE(0xe00048, 0xe0004f) AM_WRITE_LEGACY(ddenlovr16_palette_mask_w)
3436   AM_RANGE(0xe00050, 0xe00057) AM_WRITE_LEGACY(ddenlovr16_transparency_pen_w)
3437   AM_RANGE(0xe00058, 0xe0005f) AM_WRITE_LEGACY(ddenlovr16_transparency_mask_w)
3438   AM_RANGE(0xe00068, 0xe00069) AM_WRITE_LEGACY(ddenlovr16_bgcolor_w)
3439   AM_RANGE(0xe0006a, 0xe0006b) AM_WRITE_LEGACY(ddenlovr16_priority_w)
3440   AM_RANGE(0xe0006c, 0xe0006d) AM_WRITE_LEGACY(ddenlovr16_layer_enable_w)
3441   AM_RANGE(0xe00070, 0xe00071) AM_READ_LEGACY(unk16_r)                                 // ? must be 78 on startup (not necessary in ddlover)
3442   AM_RANGE(0xe00080, 0xe00083) AM_WRITE_LEGACY(ddenlovr_blitter_w)
3443   AM_RANGE(0xe00086, 0xe00087) AM_READ_LEGACY(ddenlovr_gfxrom_r)                           // Video Chip
3343   AM_RANGE(0xe00040, 0xe00047) AM_WRITE(ddenlovr16_palette_base_w)
3344   AM_RANGE(0xe00048, 0xe0004f) AM_WRITE(ddenlovr16_palette_mask_w)
3345   AM_RANGE(0xe00050, 0xe00057) AM_WRITE(ddenlovr16_transparency_pen_w)
3346   AM_RANGE(0xe00058, 0xe0005f) AM_WRITE(ddenlovr16_transparency_mask_w)
3347   AM_RANGE(0xe00068, 0xe00069) AM_WRITE(ddenlovr16_bgcolor_w)
3348   AM_RANGE(0xe0006a, 0xe0006b) AM_WRITE(ddenlovr16_priority_w)
3349   AM_RANGE(0xe0006c, 0xe0006d) AM_WRITE(ddenlovr16_layer_enable_w)
3350   AM_RANGE(0xe00070, 0xe00071) AM_READ(unk16_r)                                 // ? must be 78 on startup (not necessary in ddlover)
3351   AM_RANGE(0xe00080, 0xe00083) AM_WRITE(ddenlovr_blitter_w)
3352   AM_RANGE(0xe00086, 0xe00087) AM_READ(ddenlovr_gfxrom_r)                           // Video Chip
34443353
34453354   AM_RANGE(0xe00100, 0xe00101) AM_READ_PORT("P1")
34463355   AM_RANGE(0xe00102, 0xe00103) AM_READ_PORT("P2")
34473356   AM_RANGE(0xe00104, 0xe00105) AM_READ_PORT("SYSTEM")
34483357
3449   AM_RANGE(0xe00106, 0xe00107) AM_READ_LEGACY(akamaru_protection2_r)
3358   AM_RANGE(0xe00106, 0xe00107) AM_READ(akamaru_protection2_r)
34503359   AM_RANGE(0xe00108, 0xe0010b) AM_WRITEONLY AM_BASE(m_protection2)
34513360
3452   AM_RANGE(0xe0010c, 0xe0010d) AM_READ_LEGACY(akamaru_e0010d_r)
3453   AM_RANGE(0xe00200, 0xe00201) AM_READ_LEGACY(akamaru_dsw_r)                              // DSW
3361   AM_RANGE(0xe0010c, 0xe0010d) AM_READ(akamaru_e0010d_r)
3362   AM_RANGE(0xe00200, 0xe00201) AM_READ(akamaru_dsw_r)                              // DSW
34543363
3455   AM_RANGE(0xe00204, 0xe00205) AM_READ_LEGACY(akamaru_blitter_r)                           // Blitter Busy & IRQ
3456   AM_RANGE(0xe00302, 0xe00303) AM_WRITE_LEGACY(ddenlovr_blitter_irq_ack_w)                  // Blitter irq acknowledge
3364   AM_RANGE(0xe00204, 0xe00205) AM_READ(akamaru_blitter_r)                           // Blitter Busy & IRQ
3365   AM_RANGE(0xe00302, 0xe00303) AM_WRITE(ddenlovr_blitter_irq_ack_w)                  // Blitter irq acknowledge
34573366
34583367   AM_RANGE(0xe00304, 0xe00307) AM_WRITEONLY AM_BASE(m_dsw_sel16)            // DSW select
3459   AM_RANGE(0xe00308, 0xe00309) AM_WRITE_LEGACY(ddenlovr_coincounter_0_w)                     // Coin Counters
3460   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE_LEGACY(ddenlovr_coincounter_1_w)                     //
3368   AM_RANGE(0xe00308, 0xe00309) AM_WRITE(ddenlovr_coincounter_0_w)                     // Coin Counters
3369   AM_RANGE(0xe0030c, 0xe0030d) AM_WRITE(ddenlovr_coincounter_1_w)                     //
34613370
34623371   AM_RANGE(0xe00400, 0xe00403) AM_DEVWRITE8_LEGACY("ymsnd", ym2413_w, 0x00ff)
34633372   AM_RANGE(0xe00500, 0xe0051f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff)
r14883r14884
34723381                          Mahjong Fantasic Love
34733382***************************************************************************/
34743383
3475static WRITE8_HANDLER( mjflove_rombank_w )
3384WRITE8_MEMBER(dynax_state::mjflove_rombank_w)
34763385{
3477   memory_set_bank(space->machine(), "bank1", data & 0xf);
3386   memory_set_bank(machine(), "bank1", data & 0xf);
34783387}
34793388
34803389static WRITE8_DEVICE_HANDLER( mjflove_okibank_w )
r14883r14884
34843393   //popmessage("SOUND = %02x", data);
34853394}
34863395
3487static READ8_HANDLER( mjflove_protection_r )
3396READ8_MEMBER(dynax_state::mjflove_protection_r)
34883397{
34893398   return 0x27;
34903399}
34913400
3492static READ8_HANDLER( mjflove_keyb_r )
3401READ8_MEMBER(dynax_state::mjflove_keyb_r)
34933402{
3494   dynax_state *state = space->machine().driver_data<dynax_state>();
34953403   UINT8 val = 0xff;
34963404
3497   if      (!BIT(state->m_keyb, 0))   val = input_port_read(space->machine(), offset ? "KEY5" : "KEY0");
3498   else if (!BIT(state->m_keyb, 1))   val = input_port_read(space->machine(), offset ? "KEY6" : "KEY1");
3499   else if (!BIT(state->m_keyb, 2))   val = input_port_read(space->machine(), offset ? "KEY7" : "KEY2");
3500   else if (!BIT(state->m_keyb, 3))   val = input_port_read(space->machine(), offset ? "KEY8" : "KEY3");
3501   else if (!BIT(state->m_keyb, 4))   val = input_port_read(space->machine(), offset ? "KEY9" : "KEY4");
3405   if      (!BIT(m_keyb, 0))   val = input_port_read(machine(), offset ? "KEY5" : "KEY0");
3406   else if (!BIT(m_keyb, 1))   val = input_port_read(machine(), offset ? "KEY6" : "KEY1");
3407   else if (!BIT(m_keyb, 2))   val = input_port_read(machine(), offset ? "KEY7" : "KEY2");
3408   else if (!BIT(m_keyb, 3))   val = input_port_read(machine(), offset ? "KEY8" : "KEY3");
3409   else if (!BIT(m_keyb, 4))   val = input_port_read(machine(), offset ? "KEY9" : "KEY4");
35023410
35033411   return val;
35043412}
35053413
3506static CUSTOM_INPUT( mjflove_blitter_r )
3414CUSTOM_INPUT_MEMBER(dynax_state::mjflove_blitter_r)
35073415{
3508   dynax_state *state = field.machine().driver_data<dynax_state>();
35093416
35103417   // bit 7 = 1 -> blitter busy
35113418   // bit 6 = 0 -> VBLANK?
35123419   // bit 5 = 0 -> RTC?
3513   return state->m_mjflove_irq_cause;
3420   return m_mjflove_irq_cause;
35143421}
35153422
3516static WRITE8_HANDLER( mjflove_blitter_w )
3423WRITE8_MEMBER(dynax_state::mjflove_blitter_w)
35173424{
3518   blitter_w(space, 0, offset, data, 0);
3425   blitter_w(&space, 0, offset, data, 0);
35193426}
35203427
3521static WRITE8_HANDLER( mjflove_coincounter_w )
3428WRITE8_MEMBER(dynax_state::mjflove_coincounter_w)
35223429{
35233430   // bit 0 = in counter
3524   coin_counter_w(space->machine(), 0, data & 0x01);
3431   coin_counter_w(machine(), 0, data & 0x01);
35253432
35263433   if (data & 0xfe)
35273434   {
3528      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space->device()), data);
3435      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data);
35293436//      popmessage("COIN = %02x", data);
35303437   }
35313438}
35323439
35333440static ADDRESS_MAP_START( mjflove_portmap, AS_IO, 8, dynax_state )   // 16 bit I/O
3534   AM_RANGE(0x0010, 0x0010) AM_READ_LEGACY(hanakanz_rand_r) AM_MIRROR(0xff00)
3441   AM_RANGE(0x0010, 0x0010) AM_READ(hanakanz_rand_r) AM_MIRROR(0xff00)
35353442   AM_RANGE(0x001c, 0x001c) AM_READ_PORT("DSW2") AM_MIRROR(0xff00)
3536   AM_RANGE(0x001e, 0x001e) AM_WRITE_LEGACY(hanakanz_keyb_w) AM_MIRROR(0xff00)
3537   AM_RANGE(0x0020, 0x0023) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
3538   AM_RANGE(0x0024, 0x0027) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
3539   AM_RANGE(0x0028, 0x002b) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
3540   AM_RANGE(0x002c, 0x002f) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
3541   AM_RANGE(0x0034, 0x0034) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
3542   AM_RANGE(0x0035, 0x0035) AM_WRITE_LEGACY(ddenlovr_priority_w)
3543   AM_RANGE(0x0036, 0x0036) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
3443   AM_RANGE(0x001e, 0x001e) AM_WRITE(hanakanz_keyb_w) AM_MIRROR(0xff00)
3444   AM_RANGE(0x0020, 0x0023) AM_WRITE(ddenlovr_palette_base_w)
3445   AM_RANGE(0x0024, 0x0027) AM_WRITE(ddenlovr_palette_mask_w)
3446   AM_RANGE(0x0028, 0x002b) AM_WRITE(ddenlovr_transparency_pen_w)
3447   AM_RANGE(0x002c, 0x002f) AM_WRITE(ddenlovr_transparency_mask_w)
3448   AM_RANGE(0x0034, 0x0034) AM_WRITE(ddenlovr_bgcolor_w)
3449   AM_RANGE(0x0035, 0x0035) AM_WRITE(ddenlovr_priority_w)
3450   AM_RANGE(0x0036, 0x0036) AM_WRITE(ddenlovr_layer_enable_w)
35443451   AM_RANGE(0x0038, 0x0038) AM_READNOP         // ? ack or watchdog
3545   AM_RANGE(0x0040, 0x0041) AM_WRITE_LEGACY(mjflove_blitter_w) AM_MIRROR(0xff00)
3546   AM_RANGE(0x0043, 0x0043) AM_READ_LEGACY(rongrong_gfxrom_r)
3547   AM_RANGE(0x0080, 0x0081) AM_READ_LEGACY(mjflove_keyb_r)
3452   AM_RANGE(0x0040, 0x0041) AM_WRITE(mjflove_blitter_w) AM_MIRROR(0xff00)
3453   AM_RANGE(0x0043, 0x0043) AM_READ(rongrong_gfxrom_r)
3454   AM_RANGE(0x0080, 0x0081) AM_READ(mjflove_keyb_r)
35483455   AM_RANGE(0x0082, 0x0082) AM_READ_PORT("SYSTEM")
3549   AM_RANGE(0x00da, 0x00da) AM_READ_LEGACY(mjflove_protection_r) AM_MIRROR(0xff00)
3550   AM_RANGE(0x00f2, 0x00f2) AM_WRITE_LEGACY(mjmyster_rambank_w) AM_MIRROR(0xff00)
3551   AM_RANGE(0x00f8, 0x00f8) AM_WRITE_LEGACY(mjflove_rombank_w) AM_MIRROR(0xff00)
3456   AM_RANGE(0x00da, 0x00da) AM_READ(mjflove_protection_r) AM_MIRROR(0xff00)
3457   AM_RANGE(0x00f2, 0x00f2) AM_WRITE(mjmyster_rambank_w) AM_MIRROR(0xff00)
3458   AM_RANGE(0x00f8, 0x00f8) AM_WRITE(mjflove_rombank_w) AM_MIRROR(0xff00)
35523459   AM_RANGE(0x00fa, 0x00fa) AM_DEVWRITE_LEGACY("oki", mjflove_okibank_w)
35533460   AM_RANGE(0x0100, 0x0100) AM_READ_PORT("DSW1")
35543461   AM_RANGE(0x0181, 0x0181) AM_WRITENOP                  // ? int. enable
3555   AM_RANGE(0x0184, 0x0184) AM_WRITE_LEGACY(mjflove_coincounter_w)
3462   AM_RANGE(0x0184, 0x0184) AM_WRITE(mjflove_coincounter_w)
35563463   AM_RANGE(0x0200, 0x0201) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
35573464   AM_RANGE(0x0280, 0x028f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
35583465   AM_RANGE(0x0300, 0x0301) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
r14883r14884
35703477   oki->set_bank_base(((data >> 4) & 0x07) * 0x40000);
35713478}
35723479
3573static WRITE8_HANDLER( jongtei_dsw_keyb_w )
3480WRITE8_MEMBER(dynax_state::jongtei_dsw_keyb_w)
35743481{
3575   dynax_state *state = space->machine().driver_data<dynax_state>();
3576   state->m_dsw_sel = data;
3577   state->m_keyb = data;
3482   m_dsw_sel = data;
3483   m_keyb = data;
35783484}
35793485
3580static READ8_HANDLER( jongtei_busy_r )
3486READ8_MEMBER(dynax_state::jongtei_busy_r)
35813487{
35823488   return 0x04;   // !bit 2 = blitter busy
35833489}
35843490
35853491static ADDRESS_MAP_START( jongtei_portmap, AS_IO, 8, dynax_state )
35863492   ADDRESS_MAP_GLOBAL_MASK(0xff)
3587   AM_RANGE(0x2c, 0x2c) AM_READ_LEGACY(jongtei_busy_r) AM_DEVWRITE_LEGACY("oki", jongtei_okibank_w)
3588   AM_RANGE(0x2e, 0x2e) AM_WRITE_LEGACY(hanakanz_blitter_reg_w)
3589   AM_RANGE(0x30, 0x30) AM_WRITE_LEGACY(hanakanz_rombank_w)
3590   AM_RANGE(0x31, 0x31) AM_WRITE_LEGACY(jongtei_dsw_keyb_w)
3591   AM_RANGE(0x32, 0x32) AM_READ_LEGACY(hanakanz_dsw_r)
3493   AM_RANGE(0x2c, 0x2c) AM_READ(jongtei_busy_r) AM_DEVWRITE_LEGACY("oki", jongtei_okibank_w)
3494   AM_RANGE(0x2e, 0x2e) AM_WRITE(hanakanz_blitter_reg_w)
3495   AM_RANGE(0x30, 0x30) AM_WRITE(hanakanz_rombank_w)
3496   AM_RANGE(0x31, 0x31) AM_WRITE(jongtei_dsw_keyb_w)
3497   AM_RANGE(0x32, 0x32) AM_READ(hanakanz_dsw_r)
35923498   AM_RANGE(0x40, 0x40) AM_READ_PORT("SYSTEM")
3593   AM_RANGE(0x41, 0x42) AM_READ_LEGACY(hanakanz_keyb_r)
3594   AM_RANGE(0x43, 0x43) AM_WRITE_LEGACY(hanakanz_coincounter_w)
3595   AM_RANGE(0x46, 0x46) AM_READ_LEGACY(hanakanz_rand_r)
3596   AM_RANGE(0x60, 0x60) AM_WRITE_LEGACY(hanakanz_blitter_data_w)
3597   AM_RANGE(0x61, 0x61) AM_WRITE_LEGACY(hanakanz_palette_w)
3598   AM_RANGE(0x63, 0x64) AM_READ_LEGACY(hanakanz_gfxrom_r)
3499   AM_RANGE(0x41, 0x42) AM_READ(hanakanz_keyb_r)
3500   AM_RANGE(0x43, 0x43) AM_WRITE(hanakanz_coincounter_w)
3501   AM_RANGE(0x46, 0x46) AM_READ(hanakanz_rand_r)
3502   AM_RANGE(0x60, 0x60) AM_WRITE(hanakanz_blitter_data_w)
3503   AM_RANGE(0x61, 0x61) AM_WRITE(hanakanz_palette_w)
3504   AM_RANGE(0x63, 0x64) AM_READ(hanakanz_gfxrom_r)
35993505   AM_RANGE(0x80, 0x81) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
36003506   AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("oki", okim6295_device, read, write)
36013507   AM_RANGE(0xc0, 0xcf) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
r14883r14884
36113517   AM_RANGE(0x6000, 0x6fff) AM_RAM                        // RAM
36123518   AM_RANGE(0x7000, 0x7fff) AM_RAMBANK("bank2")                  // RAM (Banked)
36133519   AM_RANGE(0x8000, 0xffff) AM_ROMBANK("bank1")                  // ROM (Banked)
3614   AM_RANGE(0xe000, 0xe1ff) AM_WRITE_LEGACY(rongrong_palette_w)
3520   AM_RANGE(0xe000, 0xe1ff) AM_WRITE(rongrong_palette_w)
36153521ADDRESS_MAP_END
36163522
3617static READ8_HANDLER( sryudens_keyb_r )
3523READ8_MEMBER(dynax_state::sryudens_keyb_r)
36183524{
3619   dynax_state *state = space->machine().driver_data<dynax_state>();
36203525   UINT8 val = 0x3f;
36213526
3622   if      (!BIT(state->m_keyb, 0))   val = input_port_read(space->machine(), offset ? "KEY5" : "KEY0");
3623   else if (!BIT(state->m_keyb, 1))   val = input_port_read(space->machine(), offset ? "KEY6" : "KEY1");
3624   else if (!BIT(state->m_keyb, 2))   val = input_port_read(space->machine(), offset ? "KEY7" : "KEY2");
3625   else if (!BIT(state->m_keyb, 3))   val = input_port_read(space->machine(), offset ? "KEY8" : "KEY3");
3626   else if (!BIT(state->m_keyb, 4))   val = input_port_read(space->machine(), offset ? "KEY9" : "KEY4");
3527   if      (!BIT(m_keyb, 0))   val = input_port_read(machine(), offset ? "KEY5" : "KEY0");
3528   else if (!BIT(m_keyb, 1))   val = input_port_read(machine(), offset ? "KEY6" : "KEY1");
3529   else if (!BIT(m_keyb, 2))   val = input_port_read(machine(), offset ? "KEY7" : "KEY2");
3530   else if (!BIT(m_keyb, 3))   val = input_port_read(machine(), offset ? "KEY8" : "KEY3");
3531   else if (!BIT(m_keyb, 4))   val = input_port_read(machine(), offset ? "KEY9" : "KEY4");
36273532
3628   val |= input_port_read(space->machine(), offset ? "HOPPER" : "BET");
3533   val |= input_port_read(machine(), offset ? "HOPPER" : "BET");
36293534   if (offset)
36303535      val &= 0x7f;   // bit 7 = blitter busy
36313536   return val;
36323537}
36333538
3634static WRITE8_HANDLER( sryudens_coincounter_w )
3539WRITE8_MEMBER(dynax_state::sryudens_coincounter_w)
36353540{
36363541   // bit 0 = coin counter
36373542   // bit 1 = out counter
r14883r14884
36393544   // bit 4
36403545   // bit 7 = ? mostly on
36413546
3642   coin_counter_w(space->machine(), 0, data & 1);
3547   coin_counter_w(machine(), 0, data & 1);
36433548
36443549   if (data & 0x68)
3645      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space->device()), data);
3550      logerror("%04x: warning, coin counter = %02x\n", cpu_get_pc(&space.device()), data);
36463551
36473552#ifdef MAME_DEBUG
36483553//  popmessage("COIN = %02x", data);
36493554#endif
36503555}
36513556
3652static WRITE8_HANDLER( sryudens_rambank_w )
3557WRITE8_MEMBER(dynax_state::sryudens_rambank_w)
36533558{
3654   memory_set_bank(space->machine(), "bank2", data & 0x0f);
3655   //logerror("%04x: rambank = %02x\n", cpu_get_pc(&space->device()), data);
3559   memory_set_bank(machine(), "bank2", data & 0x0f);
3560   //logerror("%04x: rambank = %02x\n", cpu_get_pc(&space.device()), data);
36563561}
36573562
36583563static ADDRESS_MAP_START( sryudens_portmap, AS_IO, 8, dynax_state )
r14883r14884
36603565   AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("oki", okim6295_device, read, write)
36613566   AM_RANGE(0x02, 0x03) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
36623567   AM_RANGE(0x04, 0x05) AM_DEVWRITE_LEGACY("aysnd", ay8910_address_data_w)
3663   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE_LEGACY(sryudens_rambank_w)   // ? ack on RTC int
3664   AM_RANGE(0x1e, 0x1e) AM_WRITE_LEGACY(mjflove_rombank_w)
3665   AM_RANGE(0x20, 0x23) AM_WRITE_LEGACY(ddenlovr_palette_base_w)
3666   AM_RANGE(0x24, 0x27) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
3667   AM_RANGE(0x28, 0x2b) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
3668   AM_RANGE(0x2c, 0x2f) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
3669   AM_RANGE(0x34, 0x34) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
3670   AM_RANGE(0x35, 0x35) AM_WRITE_LEGACY(ddenlovr_priority_w)
3671   AM_RANGE(0x36, 0x36) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
3568   AM_RANGE(0x1c, 0x1c) AM_READNOP AM_WRITE(sryudens_rambank_w)   // ? ack on RTC int
3569   AM_RANGE(0x1e, 0x1e) AM_WRITE(mjflove_rombank_w)
3570   AM_RANGE(0x20, 0x23) AM_WRITE(ddenlovr_palette_base_w)
3571   AM_RANGE(0x24, 0x27) AM_WRITE(ddenlovr_palette_mask_w)
3572   AM_RANGE(0x28, 0x2b) AM_WRITE(ddenlovr_transparency_pen_w)
3573   AM_RANGE(0x2c, 0x2f) AM_WRITE(ddenlovr_transparency_mask_w)
3574   AM_RANGE(0x34, 0x34) AM_WRITE(ddenlovr_bgcolor_w)
3575   AM_RANGE(0x35, 0x35) AM_WRITE(ddenlovr_priority_w)
3576   AM_RANGE(0x36, 0x36) AM_WRITE(ddenlovr_layer_enable_w)
36723577   AM_RANGE(0x38, 0x38) AM_READNOP         // ? ack or watchdog
3673   AM_RANGE(0x40, 0x41) AM_WRITE_LEGACY(mjflove_blitter_w)
3674   AM_RANGE(0x43, 0x43) AM_READ_LEGACY(rongrong_gfxrom_r)
3675   AM_RANGE(0x50, 0x50) AM_READ_LEGACY(hanakanz_rand_r)
3578   AM_RANGE(0x40, 0x41) AM_WRITE(mjflove_blitter_w)
3579   AM_RANGE(0x43, 0x43) AM_READ(rongrong_gfxrom_r)
3580   AM_RANGE(0x50, 0x50) AM_READ(hanakanz_rand_r)
36763581   AM_RANGE(0x70, 0x70) AM_DEVWRITE_LEGACY("oki", quizchq_oki_bank_w)
36773582   AM_RANGE(0x80, 0x8f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
36783583   AM_RANGE(0x90, 0x90) AM_READ_PORT("DSW1")
r14883r14884
36803585   AM_RANGE(0x92, 0x92) AM_READ_PORT("DSW4")
36813586   AM_RANGE(0x93, 0x93) AM_READ_PORT("DSW3")
36823587   AM_RANGE(0x94, 0x94) AM_READ_PORT("DSWTOP")
3683   AM_RANGE(0x98, 0x98) AM_WRITE_LEGACY(sryudens_coincounter_w)
3684   AM_RANGE(0x99, 0x99) AM_WRITE_LEGACY(hanakanz_keyb_w)
3588   AM_RANGE(0x98, 0x98) AM_WRITE(sryudens_coincounter_w)
3589   AM_RANGE(0x99, 0x99) AM_WRITE(hanakanz_keyb_w)
36853590   AM_RANGE(0x9a, 0x9a) AM_READ_PORT("SYSTEM")
3686   AM_RANGE(0x9b, 0x9c) AM_READ_LEGACY(sryudens_keyb_r)
3591   AM_RANGE(0x9b, 0x9c) AM_READ(sryudens_keyb_r)
36873592ADDRESS_MAP_END
36883593
36893594
r14883r14884
36913596                            Mahjong Daimyojin
36923597***************************************************************************/
36933598
3694static READ8_HANDLER( daimyojn_keyb1_r )
3599READ8_MEMBER(dynax_state::daimyojn_keyb1_r)
36953600{
3696   dynax_state *state = space->machine().driver_data<dynax_state>();
36973601   UINT8 val = 0x3f;
36983602
3699   if      (!BIT(state->m_keyb, 0))  val = input_port_read(space->machine(), "KEY0");
3700   else if (!BIT(state->m_keyb, 1))  val = input_port_read(space->machine(), "KEY1");
3701   else if (!BIT(state->m_keyb, 2))  val = input_port_read(space->machine(), "KEY2");
3702   else if (!BIT(state->m_keyb, 3))  val = input_port_read(space->machine(), "KEY3");
3703   else if (!BIT(state->m_keyb, 4))  val = input_port_read(space->machine(), "KEY4");
3603   if      (!BIT(m_keyb, 0))  val = input_port_read(machine(), "KEY0");
3604   else if (!BIT(m_keyb, 1))  val = input_port_read(machine(), "KEY1");
3605   else if (!BIT(m_keyb, 2))  val = input_port_read(machine(), "KEY2");
3606   else if (!BIT(m_keyb, 3))  val = input_port_read(machine(), "KEY3");
3607   else if (!BIT(m_keyb, 4))  val = input_port_read(machine(), "KEY4");
37043608
3705   val |= input_port_read(space->machine(), "BET");
3609   val |= input_port_read(machine(), "BET");
37063610   return val;
37073611}
37083612
3709static READ8_HANDLER( daimyojn_keyb2_r )
3613READ8_MEMBER(dynax_state::daimyojn_keyb2_r)
37103614{
3711   dynax_state *state = space->machine().driver_data<dynax_state>();
37123615   UINT8 val = 0x3f;
37133616
3714   if      (!BIT(state->m_keyb, 0))  val = input_port_read(space->machine(), "KEY5");
3715   else if (!BIT(state->m_keyb, 1))  val = input_port_read(space->machine(), "KEY6");
3716   else if (!BIT(state->m_keyb, 2))  val = input_port_read(space->machine(), "KEY7");
3717   else if (!BIT(state->m_keyb, 3))  val = input_port_read(space->machine(), "KEY8");
3718   else if (!BIT(state->m_keyb, 4))  val = input_port_read(space->machine(), "KEY9");
3617   if      (!BIT(m_keyb, 0))  val = input_port_read(machine(), "KEY5");
3618   else if (!BIT(m_keyb, 1))  val = input_port_read(machine(), "KEY6");
3619   else if (!BIT(m_keyb, 2))  val = input_port_read(machine(), "KEY7");
3620   else if (!BIT(m_keyb, 3))  val = input_port_read(machine(), "KEY8");
3621   else if (!BIT(m_keyb, 4))  val = input_port_read(machine(), "KEY9");
37193622
3720   val |= input_port_read(space->machine(), "HOPPER");
3623   val |= input_port_read(machine(), "HOPPER");
37213624   return val;
37223625}
37233626
37243627// 1B18: D4 ED 76 C9 CB
37253628// 1B1D: 96 AF 34 8B 89
37263629
3727static WRITE8_HANDLER( daimyojn_protection_w )
3630WRITE8_MEMBER(dynax_state::daimyojn_protection_w)
37283631{
3729   dynax_state *state = space->machine().driver_data<dynax_state>();
3730   state->m_prot_val = data;
3632   m_prot_val = data;
37313633}
37323634
3733static READ8_HANDLER( daimyojn_protection_r )
3635READ8_MEMBER(dynax_state::daimyojn_protection_r)
37343636{
3735   dynax_state *state = space->machine().driver_data<dynax_state>();
3736   switch (state->m_prot_val)
3637   switch (m_prot_val)
37373638   {
37383639      case 0xd4:   return 0x96;
37393640      case 0xed:   return 0xaf;
r14883r14884
37473648// 1ADD: D4 ED 76 C9 CB
37483649// 1AE2: D9 E0 7B C4 C6
37493650
3750static READ8_HANDLER( momotaro_protection_r )
3651READ8_MEMBER(dynax_state::momotaro_protection_r)
37513652{
3752   dynax_state *state = space->machine().driver_data<dynax_state>();
37533653
3754   switch (state->m_prot_val)
3654   switch (m_prot_val)
37553655   {
37563656      case 0xd4: return 0xd9;
37573657      case 0xed: return 0xe0;
r14883r14884
37693669   oki->set_bank_base(((data >> 4) & 0x01) * 0x40000);
37703670}
37713671
3772static WRITE8_HANDLER( daimyojn_palette_sel_w )
3672WRITE8_MEMBER(dynax_state::daimyojn_palette_sel_w)
37733673{
3774   dynax_state *state = space->machine().driver_data<dynax_state>();
3775   state->m_daimyojn_palette_sel = data;
3674   m_daimyojn_palette_sel = data;
37763675}
37773676
3778static WRITE8_HANDLER( daimyojn_blitter_data_palette_w )
3677WRITE8_MEMBER(dynax_state::daimyojn_blitter_data_palette_w)
37793678{
3780   dynax_state *state = space->machine().driver_data<dynax_state>();
37813679
3782   if (state->m_daimyojn_palette_sel & 0x01)
3680   if (m_daimyojn_palette_sel & 0x01)
37833681      hanakanz_palette_w(space, offset, data);
37843682   else
37853683      hanakanz_blitter_data_w(space, offset, data);
37863684}
37873685
3788static READ8_HANDLER( daimyojn_year_hack_r )
3686READ8_MEMBER(dynax_state::daimyojn_year_hack_r)
37893687{
37903688   // See code at C8D7, 633f holds reg B of the RTC
37913689   return offset ? 1 : 0;   // year = 0x10 (BCD)
r14883r14884
37933691
37943692static ADDRESS_MAP_START( daimyojn_portmap, AS_IO, 8, dynax_state )
37953693   ADDRESS_MAP_GLOBAL_MASK(0xff)
3796   AM_RANGE(0x2c, 0x2c) AM_READ_LEGACY(jongtei_busy_r) AM_DEVWRITE_LEGACY("oki", daimyojn_okibank_w)
3797   AM_RANGE(0x2e, 0x2e) AM_WRITE_LEGACY(daimyojn_palette_sel_w)
3798   AM_RANGE(0x30, 0x30) AM_WRITE_LEGACY(hanakanz_blitter_reg_w)
3799   AM_RANGE(0x31, 0x31) AM_WRITE_LEGACY(jongtei_dsw_keyb_w)
3800   AM_RANGE(0x32, 0x32) AM_READ_LEGACY(hanakanz_dsw_r)
3801   AM_RANGE(0x40, 0x40) AM_WRITE_LEGACY(daimyojn_blitter_data_palette_w)
3802   AM_RANGE(0x42, 0x44) AM_READ_LEGACY(hanakanz_gfxrom_r)
3803   AM_RANGE(0x8a, 0x8b) AM_READ_LEGACY(daimyojn_year_hack_r)   // ?
3694   AM_RANGE(0x2c, 0x2c) AM_READ(jongtei_busy_r) AM_DEVWRITE_LEGACY("oki", daimyojn_okibank_w)
3695   AM_RANGE(0x2e, 0x2e) AM_WRITE(daimyojn_palette_sel_w)
3696   AM_RANGE(0x30, 0x30) AM_WRITE(hanakanz_blitter_reg_w)
3697   AM_RANGE(0x31, 0x31) AM_WRITE(jongtei_dsw_keyb_w)
3698   AM_RANGE(0x32, 0x32) AM_READ(hanakanz_dsw_r)
3699   AM_RANGE(0x40, 0x40) AM_WRITE(daimyojn_blitter_data_palette_w)
3700   AM_RANGE(0x42, 0x44) AM_READ(hanakanz_gfxrom_r)
3701   AM_RANGE(0x8a, 0x8b) AM_READ(daimyojn_year_hack_r)   // ?
38043702   AM_RANGE(0x80, 0x8f) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
38053703   AM_RANGE(0xa0, 0xa1) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)
38063704   AM_RANGE(0xa2, 0xa2) AM_DEVREADWRITE("oki", okim6295_device, read, write)
38073705   AM_RANGE(0xa8, 0xa8) AM_READ_PORT("SYSTEM")
3808   AM_RANGE(0xaa, 0xaa) AM_READ_LEGACY(daimyojn_keyb1_r)
3809   AM_RANGE(0xac, 0xac) AM_READ_LEGACY(daimyojn_keyb2_r)
3810   AM_RANGE(0xae, 0xae) AM_WRITE_LEGACY(hanakanz_coincounter_w)
3811   AM_RANGE(0xb0, 0xb0) AM_WRITE_LEGACY(mjmyster_rambank_w)
3812   AM_RANGE(0xc0, 0xc0) AM_WRITE_LEGACY(mjflove_rombank_w)
3813   AM_RANGE(0xd0, 0xd0) AM_READ_LEGACY(hanakanz_rand_r)
3814   AM_RANGE(0xe0, 0xe0) AM_READWRITE_LEGACY(daimyojn_protection_r, daimyojn_protection_w)
3706   AM_RANGE(0xaa, 0xaa) AM_READ(daimyojn_keyb1_r)
3707   AM_RANGE(0xac, 0xac) AM_READ(daimyojn_keyb2_r)
3708   AM_RANGE(0xae, 0xae) AM_WRITE(hanakanz_coincounter_w)
3709   AM_RANGE(0xb0, 0xb0) AM_WRITE(mjmyster_rambank_w)
3710   AM_RANGE(0xc0, 0xc0) AM_WRITE(mjflove_rombank_w)
3711   AM_RANGE(0xd0, 0xd0) AM_READ(hanakanz_rand_r)
3712   AM_RANGE(0xe0, 0xe0) AM_READWRITE(daimyojn_protection_r, daimyojn_protection_w)
38153713ADDRESS_MAP_END
38163714
38173715
r14883r14884
38433741   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
38443742   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
38453743   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL )   // blitter busy flag
3846   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ddenlovj_blitter_r, NULL)   // blitter irq flag? (bit 5) & RTC (bit 6)
3744   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dynax_state,ddenlovj_blitter_r, NULL)   // blitter irq flag? (bit 5) & RTC (bit 6)
38473745   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )
38483746
38493747   PORT_START("DSW1")
r14883r14884
39493847   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
39503848   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
39513849   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL )   // ? quiz365
3952   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ddenlovr_special_r, NULL)   // blitter irq flag
3850   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dynax_state,ddenlovr_special_r, NULL)   // blitter irq flag
39533851   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   // blitter busy flag
39543852
39553853   PORT_START("DSW")
r14883r14884
40043902   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
40053903   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
40063904   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL )   // blitter busy flag
4007   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(nettoqc_special_r, NULL)   // ? (bit 5) & blitter irq flag (bit 6)
3905   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dynax_state,nettoqc_special_r, NULL)   // ? (bit 5) & blitter irq flag (bit 6)
40083906   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )
40093907
40103908   PORT_START("DSW1")
r14883r14884
41024000   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   /* Test */
41034001   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
41044002   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL )   // ? quiz365
4105   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ddenlovr_special_r, NULL)   // blitter irq flag
4003   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dynax_state,ddenlovr_special_r, NULL)   // blitter irq flag
41064004   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   // blitter busy flag
41074005
41084006   PORT_START("DSW1")
r14883r14884
68566754   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
68576755   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F1)   PORT_TOGGLE
68586756   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
6859   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mjflove_blitter_r, NULL)   // RTC (bit 5) & blitter irq flag (bit 6)
6757   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dynax_state,mjflove_blitter_r, NULL)   // RTC (bit 5) & blitter irq flag (bit 6)
68606758   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   // blitter busy flag
68616759
68626760   PORT_START("KEY0")
r14883r14884
1049110389
1049210390static DRIVER_INIT( momotaro )
1049310391{
10494   machine.device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0xe0, 0xe0, FUNC(momotaro_protection_r) );
10392   dynax_state *state = machine.driver_data<dynax_state>();
10393   machine.device("maincpu")->memory().space(AS_IO)->install_read_handler(0xe0, 0xe0, read8_delegate(FUNC(dynax_state::momotaro_protection_r),state));
1049510394}
1049610395
1049710396GAME( 1992, mmpanic,   0,        mmpanic,   mmpanic,  0,        ROT0, "Nakanihon / East Technology (Taito license)", "Monkey Mole Panic (USA)",                                         GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
src/mame/drivers/ms32.c
r14883r14884
176176
177177/********** READ INPUTS **********/
178178
179static CUSTOM_INPUT( mahjong_ctrl_r )
179CUSTOM_INPUT_MEMBER(ms32_state::mahjong_ctrl_r)
180180{
181   ms32_state *state = field.machine().driver_data<ms32_state>();
182181   UINT32 mj_input;
183182
184   switch (state->m_mahjong_input_select[0])
183   switch (m_mahjong_input_select[0])
185184   {
186185      case 0x01:
187         mj_input = input_port_read(field.machine(), "MJ0");
186         mj_input = input_port_read(machine(), "MJ0");
188187         break;
189188      case 0x02:
190         mj_input = input_port_read(field.machine(), "MJ1");
189         mj_input = input_port_read(machine(), "MJ1");
191190         break;
192191      case 0x04:
193         mj_input = input_port_read(field.machine(), "MJ2");
192         mj_input = input_port_read(machine(), "MJ2");
194193         break;
195194      case 0x08:
196         mj_input = input_port_read(field.machine(), "MJ3");
195         mj_input = input_port_read(machine(), "MJ3");
197196         break;
198197      case 0x10:
199         mj_input = input_port_read(field.machine(), "MJ4");
198         mj_input = input_port_read(machine(), "MJ4");
200199         break;
201200      default:
202201         mj_input = 0;
r14883r14884
624623   PORT_INCLUDE( ms32 )
625624
626625   PORT_MODIFY("INPUTS")
627   PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mahjong_ctrl_r, NULL)   // here we read mahjong keys
626   PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ms32_state,mahjong_ctrl_r, NULL)   // here we read mahjong keys
628627   PORT_BIT( 0x0000ff00, IP_ACTIVE_LOW, IPT_UNUSED )
629628   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_COIN1 )
630629   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_COIN2 )
src/mame/drivers/stadhero.c
r14883r14884
139139   PORT_DIPUNUSED( 0x8000, IP_ACTIVE_LOW )
140140
141141   PORT_START("COIN")   /* 0x30c002 & 0x30c003 */
142   PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE")
143   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE")
142   PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE")
143   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE")
144144
145145   PORT_START("FAKE")
146146   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )            /* related to music/sound */
src/mame/drivers/wwfsstar.c
r14883r14884
271271   }
272272}
273273
274static CUSTOM_INPUT( wwfsstar_vblank_r )
274CUSTOM_INPUT_MEMBER(wwfsstar_state::wwfsstar_vblank_r)
275275{
276   wwfsstar_state *state = field.machine().driver_data<wwfsstar_state>();
277276
278   return state->m_vblank;
277   return m_vblank;
279278}
280279
281280/*******************************************************************************
r14883r14884
308307   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("Button B (1P VS 2P - Buy-in)")
309308
310309   PORT_START("SYSTEM")
311   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(wwfsstar_vblank_r, NULL)   /* VBlank */
310   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, wwfsstar_state,wwfsstar_vblank_r, NULL)   /* VBlank */
312311   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN1 )
313312   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN2 )
314313   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE1 )
src/mame/drivers/mw8080bw.c
r14883r14884
313313}
314314
315315
316static CUSTOM_INPUT( seawolf_erase_input_r )
316CUSTOM_INPUT_MEMBER(mw8080bw_state::seawolf_erase_input_r)
317317{
318   return input_port_read(field.machine(), SEAWOLF_ERASE_SW_PORT_TAG) &
319         input_port_read(field.machine(), SEAWOLF_ERASE_DIP_PORT_TAG);
318   return input_port_read(machine(), SEAWOLF_ERASE_SW_PORT_TAG) &
319         input_port_read(machine(), SEAWOLF_ERASE_DIP_PORT_TAG);
320320}
321321
322322
r14883r14884
371371   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
372372   PORT_DIPSETTING(    0x0c, DEF_STR( 2C_3C ) )
373373   PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
374   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(seawolf_erase_input_r, NULL)
374   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,seawolf_erase_input_r, NULL)
375375   PORT_DIPNAME( 0xe0, 0x60, "Extended Time At" ) PORT_DIPLOCATION("G4:6,7,8")
376376   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
377377   PORT_DIPSETTING(    0x20, "2000" )
r14883r14884
552552}
553553
554554
555static CUSTOM_INPUT( tornbase_hit_left_input_r )
555CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_hit_left_input_r)
556556{
557   return input_port_read(field.machine(), TORNBASE_L_HIT_PORT_TAG);
557   return input_port_read(machine(), TORNBASE_L_HIT_PORT_TAG);
558558}
559559
560560
561static CUSTOM_INPUT( tornbase_hit_right_input_r )
561CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_hit_right_input_r)
562562{
563563   UINT32 ret;
564564
565   switch (tornbase_get_cabinet_type(field.machine()))
565   switch (tornbase_get_cabinet_type(machine()))
566566   {
567567   case TORNBASE_CAB_TYPE_UPRIGHT_OLD:
568      ret = input_port_read(field.machine(), TORNBASE_L_HIT_PORT_TAG);
568      ret = input_port_read(machine(), TORNBASE_L_HIT_PORT_TAG);
569569      break;
570570
571571   case TORNBASE_CAB_TYPE_UPRIGHT_NEW:
572572   case TORNBASE_CAB_TYPE_COCKTAIL:
573573   default:
574      ret = input_port_read(field.machine(), TORNBASE_R_HIT_PORT_TAG);
574      ret = input_port_read(machine(), TORNBASE_R_HIT_PORT_TAG);
575575      break;
576576   }
577577
r14883r14884
579579}
580580
581581
582static CUSTOM_INPUT( tornbase_pitch_left_input_r )
582CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_pitch_left_input_r)
583583{
584584   UINT32 ret;
585585
586   switch (tornbase_get_cabinet_type(field.machine()))
586   switch (tornbase_get_cabinet_type(machine()))
587587   {
588588   case TORNBASE_CAB_TYPE_UPRIGHT_OLD:
589589   case TORNBASE_CAB_TYPE_UPRIGHT_NEW:
590      ret = input_port_read(field.machine(), TORNBASE_L_PITCH_PORT_TAG);
590      ret = input_port_read(machine(), TORNBASE_L_PITCH_PORT_TAG);
591591      break;
592592
593593   case TORNBASE_CAB_TYPE_COCKTAIL:
594594   default:
595      ret = input_port_read(field.machine(), TORNBASE_R_PITCH_PORT_TAG);
595      ret = input_port_read(machine(), TORNBASE_R_PITCH_PORT_TAG);
596596      break;
597597   }
598598
r14883r14884
600600}
601601
602602
603static CUSTOM_INPUT( tornbase_pitch_right_input_r )
603CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_pitch_right_input_r)
604604{
605   return input_port_read(field.machine(), TORNBASE_L_PITCH_PORT_TAG);
605   return input_port_read(machine(), TORNBASE_L_PITCH_PORT_TAG);
606606}
607607
608608
609static CUSTOM_INPUT( tornbase_score_input_r )
609CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_score_input_r)
610610{
611   return input_port_read(field.machine(), TORNBASE_SCORE_SW_PORT_TAG) &
612         input_port_read(field.machine(), TORNBASE_SCORE_DIP_PORT_TAG);
611   return input_port_read(machine(), TORNBASE_SCORE_SW_PORT_TAG) &
612         input_port_read(machine(), TORNBASE_SCORE_DIP_PORT_TAG);
613613}
614614
615615
r14883r14884
641641
642642static INPUT_PORTS_START( tornbase )
643643   PORT_START("IN0")
644   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(tornbase_hit_left_input_r, NULL)
645   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(tornbase_pitch_left_input_r, NULL)
644   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,tornbase_hit_left_input_r, NULL)
645   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,tornbase_pitch_left_input_r, NULL)
646646   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) ) PORT_CONDITION("IN2", 0x80, PORTCOND_EQUALS, 0x00) PORT_DIPLOCATION("B1:7")
647647   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
648648   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
649649
650650   PORT_START("IN1")
651   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(tornbase_hit_right_input_r, NULL)
652   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(tornbase_pitch_right_input_r, NULL)
651   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,tornbase_hit_right_input_r, NULL)
652   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,tornbase_pitch_right_input_r, NULL)
653653   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED)  /* not connected */
654654
655655   PORT_START("IN2")
656656   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
657657   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )  /* schematics shows it as "START", but not used by the software */
658   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(tornbase_score_input_r, NULL)
658   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,tornbase_score_input_r, NULL)
659659   PORT_DIPNAME( 0x78, 0x40, DEF_STR( Coinage ) ) PORT_CONDITION("IN2", 0x80, PORTCOND_EQUALS, 0x00) PORT_DIPLOCATION("B1:2,3,4,5")
660660   PORT_DIPSETTING(    0x18, "4 Coins/1 Inning" )
661661   PORT_DIPSETTING(    0x10, "3 Coins/1 Inning" )
r14883r14884
11851185}
11861186
11871187
1188static CUSTOM_INPUT( desertgu_gun_input_r )
1188CUSTOM_INPUT_MEMBER(mw8080bw_state::desertgu_gun_input_r)
11891189{
1190   mw8080bw_state *state = field.machine().driver_data<mw8080bw_state>();
11911190   UINT32 ret;
11921191
1193   if (state->m_desertgun_controller_select)
1194      ret = input_port_read(field.machine(), DESERTGU_GUN_X_PORT_TAG);
1192   if (m_desertgun_controller_select)
1193      ret = input_port_read(machine(), DESERTGU_GUN_X_PORT_TAG);
11951194   else
1196      ret = input_port_read(field.machine(), DESERTGU_GUN_Y_PORT_TAG);
1195      ret = input_port_read(machine(), DESERTGU_GUN_Y_PORT_TAG);
11971196
11981197   return ret;
11991198}
12001199
12011200
1202static CUSTOM_INPUT( desertgu_dip_sw_0_1_r )
1201CUSTOM_INPUT_MEMBER(mw8080bw_state::desertgu_dip_sw_0_1_r)
12031202{
1204   mw8080bw_state *state = field.machine().driver_data<mw8080bw_state>();
12051203   UINT32 ret;
12061204
1207   if (state->m_desertgun_controller_select)
1208      ret = input_port_read(field.machine(), DESERTGU_DIP_SW_0_1_SET_2_TAG);
1205   if (m_desertgun_controller_select)
1206      ret = input_port_read(machine(), DESERTGU_DIP_SW_0_1_SET_2_TAG);
12091207   else
1210      ret = input_port_read(field.machine(), DESERTGU_DIP_SW_0_1_SET_1_TAG);
1208      ret = input_port_read(machine(), DESERTGU_DIP_SW_0_1_SET_1_TAG);
12111209
12121210   return ret;
12131211}
r14883r14884
12321230
12331231static INPUT_PORTS_START( desertgu )
12341232   PORT_START("IN0")
1235   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(desertgu_gun_input_r, NULL)
1233   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,desertgu_gun_input_r, NULL)
12361234
12371235   PORT_START("IN1")
1238   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(desertgu_dip_sw_0_1_r, NULL)
1236   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,desertgu_dip_sw_0_1_r, NULL)
12391237   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Language ) ) PORT_CONDITION("IN1", 0x30, PORTCOND_NOTEQUALS, 0x30) PORT_DIPLOCATION("C2:5,6")
12401238   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
12411239   PORT_DIPSETTING(    0x04, DEF_STR( German ) )
r14883r14884
13161314#define DPLAY_CAB_TYPE_COCKTAIL      (1)
13171315
13181316
1319static CUSTOM_INPUT( dplay_pitch_left_input_r )
1317CUSTOM_INPUT_MEMBER(mw8080bw_state::dplay_pitch_left_input_r)
13201318{
13211319   UINT32 ret;
13221320
1323   if (input_port_read(field.machine(), DPLAY_CAB_TYPE_PORT_TAG) == DPLAY_CAB_TYPE_UPRIGHT)
1324      ret = input_port_read(field.machine(), DPLAY_L_PITCH_PORT_TAG);
1321   if (input_port_read(machine(), DPLAY_CAB_TYPE_PORT_TAG) == DPLAY_CAB_TYPE_UPRIGHT)
1322      ret = input_port_read(machine(), DPLAY_L_PITCH_PORT_TAG);
13251323   else
1326      ret = input_port_read(field.machine(), DPLAY_R_PITCH_PORT_TAG);
1324      ret = input_port_read(machine(), DPLAY_R_PITCH_PORT_TAG);
13271325
13281326   return ret;
13291327}
13301328
13311329
1332static CUSTOM_INPUT( dplay_pitch_right_input_r )
1330CUSTOM_INPUT_MEMBER(mw8080bw_state::dplay_pitch_right_input_r)
13331331{
1334   return input_port_read(field.machine(), DPLAY_L_PITCH_PORT_TAG);
1332   return input_port_read(machine(), DPLAY_L_PITCH_PORT_TAG);
13351333}
13361334
13371335
r14883r14884
13541352static INPUT_PORTS_START( dplay )
13551353   PORT_START("IN0")
13561354   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Hit") PORT_PLAYER(1)
1357   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dplay_pitch_left_input_r, NULL)
1355   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,dplay_pitch_left_input_r, NULL)
13581356   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
13591357
13601358   PORT_START("IN1")
13611359   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Hit") PORT_PLAYER(2)
1362   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dplay_pitch_right_input_r, NULL)
1360   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,dplay_pitch_right_input_r, NULL)
13631361   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
13641362
13651363   PORT_START("IN2")
r14883r14884
14181416static INPUT_PORTS_START( einning )
14191417   PORT_START("IN0")
14201418   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Hit") PORT_PLAYER(1)
1421   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dplay_pitch_left_input_r, NULL)
1419   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,dplay_pitch_left_input_r, NULL)
14221420   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
14231421
14241422   PORT_START("IN1")
14251423   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Hit") PORT_PLAYER(2)
1426   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dplay_pitch_right_input_r, NULL)
1424   PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,dplay_pitch_right_input_r, NULL)
14271425   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
14281426
14291427   PORT_START("IN2")
r14883r14884
17071705}
17081706
17091707
1710static CUSTOM_INPUT( clowns_controller_r )
1708CUSTOM_INPUT_MEMBER(mw8080bw_state::clowns_controller_r)
17111709{
1712   mw8080bw_state *state = field.machine().driver_data<mw8080bw_state>();
17131710   UINT32 ret;
17141711
1715   if (state->m_clowns_controller_select)
1712   if (m_clowns_controller_select)
17161713   {
1717      ret = input_port_read(field.machine(), CLOWNS_CONTROLLER_P2_TAG);
1714      ret = input_port_read(machine(), CLOWNS_CONTROLLER_P2_TAG);
17181715   }
17191716   else
17201717   {
1721      ret = input_port_read(field.machine(), CLOWNS_CONTROLLER_P1_TAG);
1718      ret = input_port_read(machine(), CLOWNS_CONTROLLER_P1_TAG);
17221719   }
17231720
17241721   return ret;
r14883r14884
17441741
17451742static INPUT_PORTS_START( clowns )
17461743   PORT_START("IN0")
1747   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clowns_controller_r, NULL)
1744   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,clowns_controller_r, NULL)
17481745
17491746   PORT_START("IN1")
17501747   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )  /* not connected */
r14883r14884
17931790
17941791static INPUT_PORTS_START( clowns1 )
17951792   PORT_START("IN0")
1796   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clowns_controller_r, NULL)
1793   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,clowns_controller_r, NULL)
17971794
17981795   PORT_START("IN1")
17991796   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14883r14884
18811878
18821879static INPUT_PORTS_START( spacwalk )
18831880   PORT_START("IN0")
1884   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clowns_controller_r, NULL)
1881   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,clowns_controller_r, NULL)
18851882
18861883   PORT_START("IN1")
18871884   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
25352532
25362533
25372534
2538static CUSTOM_INPUT( invaders_coin_input_r )
2535CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_coin_input_r)
25392536{
2540   UINT32 ret = input_port_read(field.machine(), INVADERS_COIN_INPUT_PORT_TAG);
2537   UINT32 ret = input_port_read(machine(), INVADERS_COIN_INPUT_PORT_TAG);
25412538
2542   coin_counter_w(field.machine(), 0, !ret);
2539   coin_counter_w(machine(), 0, !ret);
25432540
25442541   return ret;
25452542}
25462543
25472544
2548static CUSTOM_INPUT( invaders_sw6_sw7_r )
2545CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_sw6_sw7_r)
25492546{
25502547   UINT32 ret;
25512548
25522549   /* upright PCB : switches visible
25532550       cocktail PCB: HI */
25542551
2555   if (invaders_is_cabinet_cocktail(field.machine()))
2552   if (invaders_is_cabinet_cocktail(machine()))
25562553      ret = 0x03;
25572554   else
2558      ret = input_port_read(field.machine(), INVADERS_SW6_SW7_PORT_TAG);
2555      ret = input_port_read(machine(), INVADERS_SW6_SW7_PORT_TAG);
25592556
25602557   return ret;
25612558}
25622559
25632560
2564static CUSTOM_INPUT( invaders_sw5_r )
2561CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_sw5_r)
25652562{
25662563   UINT32 ret;
25672564
25682565   /* upright PCB : switch visible
25692566       cocktail PCB: HI */
25702567
2571   if (invaders_is_cabinet_cocktail(field.machine()))
2568   if (invaders_is_cabinet_cocktail(machine()))
25722569      ret = 0x01;
25732570   else
2574      ret = input_port_read(field.machine(), INVADERS_SW5_PORT_TAG);
2571      ret = input_port_read(machine(), INVADERS_SW5_PORT_TAG);
25752572
25762573   return ret;
25772574}
25782575
25792576
2580static CUSTOM_INPUT( invaders_in0_control_r )
2577CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in0_control_r)
25812578{
25822579   UINT32 ret;
25832580
25842581   /* upright PCB : P1 controls
25852582       cocktail PCB: HI */
25862583
2587   if (invaders_is_cabinet_cocktail(field.machine()))
2584   if (invaders_is_cabinet_cocktail(machine()))
25882585      ret = 0x07;
25892586   else
2590      ret = input_port_read(field.machine(), INVADERS_P1_CONTROL_PORT_TAG);
2587      ret = input_port_read(machine(), INVADERS_P1_CONTROL_PORT_TAG);
25912588
25922589   return ret;
25932590}
25942591
25952592
2596CUSTOM_INPUT( invaders_in1_control_r )
2593CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in1_control_r)
25972594{
2598   return input_port_read(field.machine(), INVADERS_P1_CONTROL_PORT_TAG);
2595   return input_port_read(machine(), INVADERS_P1_CONTROL_PORT_TAG);
25992596}
26002597
26012598
2602CUSTOM_INPUT( invaders_in2_control_r )
2599CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in2_control_r)
26032600{
26042601   UINT32 ret;
26052602
26062603   /* upright PCB : P1 controls
26072604       cocktail PCB: P2 controls */
26082605
2609   if (invaders_is_cabinet_cocktail(field.machine()))
2610      ret = input_port_read(field.machine(), INVADERS_P2_CONTROL_PORT_TAG);
2606   if (invaders_is_cabinet_cocktail(machine()))
2607      ret = input_port_read(machine(), INVADERS_P2_CONTROL_PORT_TAG);
26112608   else
2612      ret = input_port_read(field.machine(), INVADERS_P1_CONTROL_PORT_TAG);
2609      ret = input_port_read(machine(), INVADERS_P1_CONTROL_PORT_TAG);
26132610
26142611   return ret;
26152612}
r14883r14884
26412638   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW:8")
26422639   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
26432640   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
2644   PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_sw6_sw7_r, NULL)
2641   PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_sw6_sw7_r, NULL)
26452642   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNUSED )
2646   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in0_control_r, NULL)
2647   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_sw5_r, NULL)
2643   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in0_control_r, NULL)
2644   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_sw5_r, NULL)
26482645
26492646   PORT_START("IN1")
2650   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_coin_input_r, NULL)
2647   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_coin_input_r, NULL)
26512648   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
26522649   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
26532650   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNUSED )
2654   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in1_control_r, NULL)
2651   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in1_control_r, NULL)
26552652   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
26562653
26572654   PORT_START("IN2")
r14883r14884
26642661   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW:2")
26652662   PORT_DIPSETTING(    0x08, "1000" )
26662663   PORT_DIPSETTING(    0x00, "1500" )
2667   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in2_control_r, NULL)
2664   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in2_control_r, NULL)
26682665   PORT_DIPNAME( 0x80, 0x00, "Display Coinage" ) PORT_DIPLOCATION("SW:1")
26692666   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
26702667   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r14883r14884
27422739#define BLUESHRK_COIN_INPUT_PORT_TAG   ("COIN")
27432740
27442741
2745static CUSTOM_INPUT( blueshrk_coin_input_r )
2742CUSTOM_INPUT_MEMBER(mw8080bw_state::blueshrk_coin_input_r)
27462743{
2747   UINT32 ret = input_port_read(field.machine(), BLUESHRK_COIN_INPUT_PORT_TAG);
2744   UINT32 ret = input_port_read(machine(), BLUESHRK_COIN_INPUT_PORT_TAG);
27482745
2749   coin_counter_w(field.machine(), 0, !ret);
2746   coin_counter_w(machine(), 0, !ret);
27502747
27512748   return ret;
27522749}
r14883r14884
27722769
27732770   PORT_START("IN1")
27742771   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
2775   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(blueshrk_coin_input_r, NULL)
2772   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,blueshrk_coin_input_r, NULL)
27762773   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_CONDITION("IN1", 0x80, PORTCOND_EQUALS, 0x80) PORT_DIPLOCATION("SW:3")
27772774   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
27782775   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r14883r14884
28612858   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
28622859
28632860   PORT_START("IN1")
2864   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_coin_input_r, NULL)
2861   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_coin_input_r, NULL)
28652862   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
28662863   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
28672864   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
src/mame/drivers/nova2001.c
r14883r14884
132132 *************************************/
133133
134134
135static CUSTOM_INPUT( ninjakun_io_A002_ctrl_r )
135CUSTOM_INPUT_MEMBER(nova2001_state::ninjakun_io_A002_ctrl_r)
136136{
137   nova2001_state *state = field.machine().driver_data<nova2001_state>();
138   return state->m_ninjakun_io_a002_ctrl;
137   return m_ninjakun_io_a002_ctrl;
139138}
140139
141140WRITE8_MEMBER(nova2001_state::ninjakun_cpu1_io_A002_w)
r14883r14884
383382
384383   PORT_START("IN2")   /* 0xa002 */
385384   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
386   PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ninjakun_io_A002_ctrl_r, NULL)
385   PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, nova2001_state,ninjakun_io_A002_ctrl_r, NULL)
387386
388387   PORT_START("DSW1") // printed "SW 2"
389388   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )  PORT_DIPLOCATION("SW2:1")
src/mame/drivers/gaelco3d.c
r14883r14884
414414 *
415415 *************************************/
416416
417static CUSTOM_INPUT( analog_bit_r )
417CUSTOM_INPUT_MEMBER(gaelco3d_state::analog_bit_r)
418418{
419   gaelco3d_state *state = field.machine().driver_data<gaelco3d_state>();
420419   int which = (FPTR)param;
421   return (state->m_analog_ports[which] >> 7) & 0x01;
420   return (m_analog_ports[which] >> 7) & 0x01;
422421}
423422
424423
r14883r14884
877876   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)   // checked after reading analog from port 1
878877   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)   // checked after reading analog from port 2
879878   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)   // checked after reading analog from port 3
880   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)0)
881   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)1)
882   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)2)
883   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)3)
879   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)0)
880   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)1)
881   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)2)
882   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)3)
884883
885884   PORT_START("IN3")
886885   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN2 )      // verified
r14883r14884
916915   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
917916   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_SERVICE1 )
918917   PORT_SERVICE_NO_TOGGLE( 0x0800, IP_ACTIVE_LOW )
919   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)0)
920   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)1)
921   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)2)
922   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)3)
918   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)0)
919   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)1)
920   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)2)
921   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)3)
923922
924923   PORT_START("IN3")
925924   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14883r14884
953952   PORT_BIT( 0x02000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
954953   PORT_BIT( 0x04000000, IP_ACTIVE_LOW, IPT_SERVICE1 )
955954   PORT_SERVICE_NO_TOGGLE( 0x08000000, IP_ACTIVE_LOW )
956   PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)0)
957   PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)1)
958   PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)2)
959   PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(analog_bit_r, (void *)3)
955   PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)0)
956   PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)1)
957   PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)2)
958   PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco3d_state,analog_bit_r, (void *)3)
960959
961960   PORT_START("IN3")
962961   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_UNKNOWN )
src/mame/drivers/snk.c
r14883r14884
329329   return soundlatch_r(space, 0);
330330}
331331
332static CUSTOM_INPUT( marvins_sound_busy )
332CUSTOM_INPUT_MEMBER(snk_state::marvins_sound_busy)
333333{
334   snk_state *state = field.machine().driver_data<snk_state>();
335334
336   return state->m_marvins_sound_busy_flag;
335   return m_marvins_sound_busy_flag;
337336}
338337
339338READ8_MEMBER(snk_state::marvins_sound_nmi_ack_r)
r14883r14884
496495   machine().scheduler().synchronize(FUNC(sndirq_update_callback), CMDIRQ_BUSY_ASSERT);
497496}
498497
499static CUSTOM_INPUT( snk_sound_busy )
498CUSTOM_INPUT_MEMBER(snk_state::snk_sound_busy)
500499{
501   snk_state *state = field.machine().driver_data<snk_state>();
502500
503   return (state->m_sound_status & 4) ? 1 : 0;
501   return (m_sound_status & 4) ? 1 : 0;
504502}
505503
506504
r14883r14884
739737
740738*****************************************************************************/
741739
742static CUSTOM_INPUT( gwar_rotary )
740CUSTOM_INPUT_MEMBER(snk_state::gwar_rotary)
743741{
744   snk_state *state = field.machine().driver_data<snk_state>();
745742   static const char *const ports[] = { "P1ROT", "P2ROT" };
746743   int which = (int)(FPTR)param;
747   int value = input_port_read(field.machine(), ports[which]);
744   int value = input_port_read(machine(), ports[which]);
748745
749   if ((state->m_last_value[which] == 0x5 && value == 0x6) || (state->m_last_value[which] == 0x6 && value == 0x5))
746   if ((m_last_value[which] == 0x5 && value == 0x6) || (m_last_value[which] == 0x6 && value == 0x5))
750747   {
751      if (!state->m_cp_count[which])
748      if (!m_cp_count[which])
752749         value = 0xf;
753      state->m_cp_count[which] = (state->m_cp_count[which] + 1) & 0x07;
750      m_cp_count[which] = (m_cp_count[which] + 1) & 0x07;
754751   }
755   state->m_last_value[which] = value;
752   m_last_value[which] = value;
756753
757754   return value;
758755}
759756
760static CUSTOM_INPUT( gwarb_rotary )
757CUSTOM_INPUT_MEMBER(snk_state::gwarb_rotary)
761758{
762   if (input_port_read(field.machine(), "JOYSTICK_MODE") == 1)
759   if (input_port_read(machine(), "JOYSTICK_MODE") == 1)
763760   {
764      return gwar_rotary(device, field, param);
761      return gwar_rotary(field, param);
765762   }
766763   else
767764   {
r14883r14884
805802   m_countryc_trackball = data & 1;
806803}
807804
808static CUSTOM_INPUT( countryc_trackball_x )
805CUSTOM_INPUT_MEMBER(snk_state::countryc_trackball_x)
809806{
810   snk_state *state = field.machine().driver_data<snk_state>();
811807
812   return input_port_read(field.machine(), state->m_countryc_trackball ? "TRACKBALLX2" : "TRACKBALLX1");
808   return input_port_read(machine(), m_countryc_trackball ? "TRACKBALLX2" : "TRACKBALLX1");
813809}
814810
815static CUSTOM_INPUT( countryc_trackball_y )
811CUSTOM_INPUT_MEMBER(snk_state::countryc_trackball_y)
816812{
817   snk_state *state = field.machine().driver_data<snk_state>();
818813
819   return input_port_read(field.machine(), state->m_countryc_trackball ? "TRACKBALLY2" : "TRACKBALLY1");
814   return input_port_read(machine(), m_countryc_trackball ? "TRACKBALLY2" : "TRACKBALLY1");
820815}
821816
822817
823818/************************************************************************/
824819
825static CUSTOM_INPUT( snk_bonus_r )
820CUSTOM_INPUT_MEMBER(snk_state::snk_bonus_r)
826821{
827822   int bit_mask = (FPTR)param;
828823
829824   switch (bit_mask)
830825   {
831826      case 0x01:  /* older games : "Occurrence" Dip Switch (DSW2:1) */
832         return ((input_port_read(field.machine(), "BONUS") & bit_mask) >> 0);
827         return ((input_port_read(machine(), "BONUS") & bit_mask) >> 0);
833828      case 0xc0:  /* older games : "Bonus Life" Dip Switches (DSW1:7,8) */
834         return ((input_port_read(field.machine(), "BONUS") & bit_mask) >> 6);
829         return ((input_port_read(machine(), "BONUS") & bit_mask) >> 6);
835830
836831      case 0x04:  /* later games : "Occurrence" Dip Switch (DSW1:3) */
837         return ((input_port_read(field.machine(), "BONUS") & bit_mask) >> 2);
832         return ((input_port_read(machine(), "BONUS") & bit_mask) >> 2);
838833      case 0x30:  /* later games : "Bonus Life" Dip Switches (DSW2:5,6) */
839         return ((input_port_read(field.machine(), "BONUS") & bit_mask) >> 4);
834         return ((input_port_read(machine(), "BONUS") & bit_mask) >> 4);
840835
841836      default:
842837         logerror("snk_bonus_r : invalid %02X bit_mask\n",bit_mask);
r14883r14884
15181513   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
15191514   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
15201515   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN )
1521   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(marvins_sound_busy, NULL) /* sound CPU status */
1516   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,marvins_sound_busy, NULL) /* sound CPU status */
15221517   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )   // service switch according to schematics, see code at 0x0453. Goes to garbage.
15231518
15241519   PORT_START("IN1")
r14883r14884
16001595   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
16011596   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
16021597   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
1603   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(marvins_sound_busy, NULL) /* sound CPU status */
1598   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,marvins_sound_busy, NULL) /* sound CPU status */
16041599   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
16051600   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
16061601
r14883r14884
16841679   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )
16851680   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
16861681   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
1687   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(marvins_sound_busy, NULL) /* sound CPU status */
1688   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(marvins_sound_busy, NULL) /* sound CPU status */
1682   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,marvins_sound_busy, NULL) /* sound CPU status */
1683   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,marvins_sound_busy, NULL) /* sound CPU status */
16891684   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_SERVICE )
16901685
16911686   PORT_START("IN1")
r14883r14884
17621757   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
17631758   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
17641759   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
1765   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
1760   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
17661761   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
17671762   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
17681763
r14883r14884
18051800   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
18061801//  PORT_DIPSETTING(    0x10, "INVALID !" )                 /* settings table at 0x0378 is only 5 bytes wide */
18071802//  PORT_DIPSETTING(    0x08, "INVALID !" )                 /* settings table at 0x0378 is only 5 bytes wide */
1808   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0xc0)
1803   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0xc0)
18091804
18101805   PORT_START("DSW2")
1811   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x01)
1806   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x01)
18121807   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("DSW2:2,3")
18131808   PORT_DIPSETTING(    0x06, DEF_STR( Easy ) )
18141809   PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )
r14883r14884
18471842   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )
18481843   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
18491844   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
1850   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
1845   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
18511846   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
18521847   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_SERVICE )            /* code at 0x054e */
18531848
r14883r14884
18881883   PORT_DIPSETTING(    0x30, DEF_STR( 1C_2C ) )
18891884   PORT_DIPSETTING(    0x28, DEF_STR( 1C_3C ) )
18901885   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
1891   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0xc0)
1886   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0xc0)
18921887
18931888   PORT_START("DSW2")
1894   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x01)
1889   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x01)
18951890   PORT_DIPNAME( 0x02, 0x02, "Time" )                      PORT_DIPLOCATION("DSW2:2")
18961891   PORT_DIPSETTING(    0x02, "More" )                      /* Hazard race 2:30 / Chariot race 3:30 */
18971892   PORT_DIPSETTING(    0x00, "Less" )                      /* Hazard race 2:00 / Chariot race 3:00 */
r14883r14884
19311926   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )
19321927   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
19331928   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
1934   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
1929   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
19351930   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
19361931   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
19371932
r14883r14884
19721967   PORT_DIPSETTING(    0x30, DEF_STR( 1C_2C ) )
19731968   PORT_DIPSETTING(    0x28, DEF_STR( 1C_3C ) )
19741969   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
1975   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0xc0)
1970   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0xc0)
19761971
19771972   PORT_START("DSW2")
1978   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x01)
1973   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x01)
19791974   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("DSW2:2,3")
19801975   PORT_DIPSETTING(    0x06, DEF_STR( Easy ) )
19811976   PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )
r14883r14884
20142009   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )           /* uses "Coinage" settings - code at 0x2e04 */
20152010   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
20162011   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
2017   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2012   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
20182013   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
20192014   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
20202015
r14883r14884
20572052   PORT_DIPSETTING(    0x10, DEF_STR( 1C_3C ) )
20582053   PORT_DIPSETTING(    0x08, DEF_STR( 1C_4C ) )
20592054   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
2060   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0xc0)
2055   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0xc0)
20612056
20622057   PORT_START("DSW2")
2063   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x01)
2058   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x01)
20642059   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("DSW2:2,3")
20652060   PORT_DIPSETTING(    0x06, DEF_STR( Easy ) )
20662061   PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )
r14883r14884
21002095   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )           /* uses "Coin A" settings - code at 0x2e17 */
21012096   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
21022097   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
2103   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2098   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
21042099   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
21052100   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
21062101
r14883r14884
21472142   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "DSW1:8" )
21482143
21492144   PORT_START("DSW2")
2150   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x01)
2145   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x01)
21512146   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("DSW2:2,3")
21522147   PORT_DIPSETTING(    0x06, DEF_STR( Easy ) )
21532148   PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )
r14883r14884
21822177   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )
21832178   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
21842179   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
2185   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2180   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
21862181   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
21872182   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
21882183
r14883r14884
22292224   PORT_DIPSETTING(    0x30, DEF_STR( 1C_2C ) )
22302225   PORT_DIPSETTING(    0x28, DEF_STR( 1C_3C ) )
22312226   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
2232   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0xc0)
2227   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0xc0)
22332228
22342229   PORT_START("DSW2")
2235   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x01)
2230   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x01)
22362231   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("DSW2:2,3")
22372232   PORT_DIPSETTING(    0x06, DEF_STR( Easy ) )
22382233   PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )
r14883r14884
22662261
22672262static INPUT_PORTS_START( athena )
22682263   PORT_START("IN0")
2269   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2264   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
22702265   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_SERVICE1 )           /* uses "Coin A" settings - code at 0x09d4 */
22712266   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
22722267   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r14883r14884
23032298   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )          PORT_DIPLOCATION("DSW1:2")
23042299   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )          /* Single Controls */
23052300   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
2306   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x04)
2301   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x04)
23072302   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) )            PORT_DIPLOCATION("DSW1:4")
23082303   PORT_DIPSETTING(    0x08, "3" )
23092304   PORT_DIPSETTING(    0x00, "5" )
r14883r14884
23302325   PORT_DIPNAME( 0x08, 0x08, "Freeze" )                    PORT_DIPLOCATION("DSW2:4")
23312326   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
23322327   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2333   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x30)
2328   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x30)
23342329   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "DSW2:7" )
23352330   PORT_DIPNAME( 0x80, 0x80, "Energy" )                    PORT_DIPLOCATION("DSW2:8")
23362331   PORT_DIPSETTING(    0x80, "12" )
r14883r14884
23512346
23522347static INPUT_PORTS_START( fitegolf )
23532348   PORT_START("IN0")
2354   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2349   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
23552350   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_SERVICE1 )          /* uses "Coin A" settings - code at 0x045b */
23562351   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )              /* reset */
23572352   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SERVICE )           /* same as the dip switch */
r14883r14884
24362431
24372432static INPUT_PORTS_START( countryc )
24382433   PORT_START("IN0")
2439   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2434   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
24402435   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_SERVICE1 )          /* uses "Coin A" settings - code at 0x0450 */
24412436   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )              /* reset */
24422437   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SERVICE )           /* same as the dip switch */
r14883r14884
24462441   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_START1 )
24472442
24482443   PORT_START("IN1")
2449   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(countryc_trackball_x, 0)
2444   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,countryc_trackball_x, 0)
24502445
24512446   PORT_START("IN2")
2452   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(countryc_trackball_y, 0)
2447   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,countryc_trackball_y, 0)
24532448
24542449   PORT_START("IN3")
24552450   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
25182513
25192514static INPUT_PORTS_START( ikari )
25202515   PORT_START("IN0")
2521   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2516   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
25222517   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_SERVICE1 )          /* adds 1 credit - code at 0x0a15 */
25232518   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
25242519   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r14883r14884
25582553   PORT_DIPNAME( 0x02, 0x02, "P1 & P2 Fire Buttons" )      PORT_DIPLOCATION("DSW1:2")
25592554   PORT_DIPSETTING(    0x02, "Separate" )
25602555   PORT_DIPSETTING(    0x00, "Common" )
2561   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x04)
2556   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x04)
25622557   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) )            PORT_DIPLOCATION("DSW1:4")
25632558   PORT_DIPSETTING(    0x08, "3" )
25642559   PORT_DIPSETTING(    0x00, "5" )
r14883r14884
25842579   PORT_DIPSETTING(    0x08, "Demo Sounds On" )
25852580   PORT_DIPSETTING(    0x04, "Freeze" )
25862581   PORT_DIPSETTING(    0x00, "Infinite Lives (Cheat)")
2587   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x30)
2582   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x30)
25882583   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "DSW2:7" )           /* read at 0x07c4, but strange test at 0x07cc */
25892584   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Allow_Continue ) )   PORT_DIPLOCATION("DSW2:8")
25902585   PORT_DIPSETTING(    0x80, DEF_STR( No ) )
r14883r14884
26132608   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )          /* adds 1 credit - code at 0x0a00 */
26142609   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_START1 )
26152610   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_START2 )
2616   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2611   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
26172612   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
26182613   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_TILT )              /* reset */
26192614INPUT_PORTS_END
r14883r14884
26502645
26512646static INPUT_PORTS_START( victroad )
26522647   PORT_START("IN0")
2653   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2648   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
26542649   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_SERVICE1 )          /* adds 1 credit - code at 0x0a19 */
26552650   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )              /* reset */
26562651   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r14883r14884
26902685   PORT_DIPNAME( 0x02, 0x02, "P1 & P2 Fire Buttons" )      PORT_DIPLOCATION("DSW1:2")
26912686   PORT_DIPSETTING(    0x02, "Separate" )
26922687   PORT_DIPSETTING(    0x00, "Common" )
2693   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x04)
2688   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x04)
26942689   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) )            PORT_DIPLOCATION("DSW1:4")
26952690   PORT_DIPSETTING(    0x08, "3" )
26962691   PORT_DIPSETTING(    0x00, "5" )
r14883r14884
27162711   PORT_DIPSETTING(    0x08, "Demo Sounds On" )
27172712   PORT_DIPSETTING(    0x00, "Freeze" )
27182713   PORT_DIPSETTING(    0x04, "Infinite Lives (Cheat)")
2719   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x30)
2714   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x30)
27202715   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) )   PORT_DIPLOCATION("DSW2:7")
27212716   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
27222717   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
r14883r14884
27542749
27552750static INPUT_PORTS_START( bermudat )
27562751   PORT_START("IN0")
2757   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2752   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
27582753   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_SERVICE1 )          /* uses "Coin A" settings - code at 0x0a0a */
27592754   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )              /* reset */
27602755   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r14883r14884
27922787   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )      PORT_DIPLOCATION("DSW1:2")
27932788   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
27942789   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2795   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x04)
2790   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x04)
27962791   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) )            PORT_DIPLOCATION("DSW1:4")
27972792   PORT_DIPSETTING(    0x08, "3" )
27982793   PORT_DIPSETTING(    0x00, "5" )
r14883r14884
28182813   PORT_DIPSETTING(    0x08, "Demo Sounds On" )
28192814   PORT_DIPSETTING(    0x00, "Freeze" )
28202815   PORT_DIPSETTING(    0x04, "Infinite Lives (Cheat)")
2821   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x30)
2816   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x30)
28222817   PORT_DIPNAME( 0xc0, 0x80, "Game Style" )                PORT_DIPLOCATION("DSW2:7,8")
28232818   PORT_DIPSETTING(    0xc0, "Normal without continue" )
28242819   PORT_DIPSETTING(    0x80, "Normal with continue" )
r14883r14884
28832878
28842879static INPUT_PORTS_START( psychos )
28852880   PORT_START("IN0")
2886   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2881   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
28872882   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
28882883   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )              /* reset */
28892884   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r14883r14884
29202915   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )      PORT_DIPLOCATION("DSW1:2")
29212916   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
29222917   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2923   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x04)
2918   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x04)
29242919   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) )            PORT_DIPLOCATION("DSW1:4")
29252920   PORT_DIPSETTING(    0x08, "3" )
29262921   PORT_DIPSETTING(    0x00, "5" )
r14883r14884
29472942   PORT_DIPNAME( 0x08, 0x08, "Freeze" )                    PORT_DIPLOCATION("DSW2:4")
29482943   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
29492944   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2950   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x30)
2945   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x30)
29512946   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) )   PORT_DIPLOCATION("DSW2:7")
29522947   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
29532948   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
r14883r14884
29682963
29692964static INPUT_PORTS_START( gwar )
29702965   PORT_START("IN0")
2971   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
2966   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
29722967   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_SERVICE1 )          /* uses "Coin A" settings - code at 0x08c8 */
29732968   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )              /* reset */
29742969   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SERVICE )
r14883r14884
29822977   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(1)
29832978   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_PLAYER(1)
29842979   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
2985   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gwar_rotary, (void*)0)
2980   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,gwar_rotary, (void*)0)
29862981
29872982   PORT_START("P1ROT")
29882983   PORT_BIT( 0x0f, 0x00, IPT_POSITIONAL ) PORT_POSITIONS(12) PORT_WRAPS PORT_SENSITIVITY(15) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_REVERSE PORT_FULL_TURN_COUNT(12)
r14883r14884
29922987   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(2)
29932988   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_PLAYER(2)
29942989   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
2995   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gwar_rotary, (void*)1)
2990   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,gwar_rotary, (void*)1)
29962991
29972992   PORT_START("P2ROT")
29982993   PORT_BIT( 0x0f, 0x00, IPT_POSITIONAL ) PORT_POSITIONS(12) PORT_WRAPS PORT_SENSITIVITY(15) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2) PORT_REVERSE PORT_FULL_TURN_COUNT(12)
r14883r14884
30143009   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )      PORT_DIPLOCATION("DSW1:2")
30153010   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
30163011   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3017   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x04)
3012   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x04)
30183013   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) )            PORT_DIPLOCATION("DSW1:4")
30193014   PORT_DIPSETTING(    0x08, "3" )
30203015   PORT_DIPSETTING(    0x00, "5" )
r14883r14884
30403035   PORT_DIPSETTING(    0x08, "Demo Sounds On" )
30413036   PORT_DIPSETTING(    0x00, "Freeze" )
30423037   PORT_DIPSETTING(    0x04, "Infinite Lives (Cheat)")
3043   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x30)
3038   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x30)
30443039   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "DSW2:7" )
30453040   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "DSW2:8" )
30463041
r14883r14884
30633058   // connected. If rotary is not connected, player fires in the direction he's facing.
30643059
30653060   PORT_MODIFY("IN1")
3066   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gwarb_rotary, (void*)0)
3061   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,gwarb_rotary, (void*)0)
30673062
30683063   PORT_MODIFY("IN2")
3069   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gwarb_rotary, (void*)1)
3064   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,gwarb_rotary, (void*)1)
30703065
30713066   PORT_START("JOYSTICK_MODE")
30723067   PORT_CONFNAME( 0x01, 0x00, "Joystick mode" )
r14883r14884
30773072
30783073static INPUT_PORTS_START( chopper )
30793074   PORT_START("IN0")
3080   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
3075   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
30813076   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_SERVICE1 )          /* uses "Coin A" settings - code at 0x0849 */
30823077   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )              /* reset */
30833078   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SERVICE )
r14883r14884
31163111   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Cabinet ) )          PORT_DIPLOCATION("DSW1:2")
31173112   PORT_DIPSETTING(    0x02, DEF_STR( Upright ) )          /* Single Controls */
31183113   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
3119   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x04)
3114   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x04)
31203115   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) )            PORT_DIPLOCATION("DSW1:4")
31213116   PORT_DIPSETTING(    0x08, "3" )
31223117   PORT_DIPSETTING(    0x00, "5" )
r14883r14884
31423137   PORT_DIPSETTING(    0x0c, "Demo Sounds On" )
31433138   PORT_DIPSETTING(    0x00, "Freeze" )
31443139   PORT_DIPSETTING(    0x04, "Infinite Lives (Cheat)")
3145   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_bonus_r, (void *)0x30)
3140   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_bonus_r, (void *)0x30)
31463141   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )   PORT_DIPLOCATION("DSW2:7")
31473142   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
31483143   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
r14883r14884
31983193   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
31993194   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_SERVICE )           /* also reset - code at 0x074a */
32003195   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )          /* adds 1 credit - code at 0x1065 */
3201   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
3196   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
32023197   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_COIN1 )
32033198   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_COIN2 )
32043199   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_START1 ) PORT_NAME("Start Game A")
r14883r14884
33393334   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
33403335   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_SERVICE )           /* same as the dip switch / also reset - code at 0x00cc */
33413336   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_SERVICE1 )          /* uses "Coin A" settings - code at 0x677f */
3342   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk_sound_busy, 0)
3337   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk_state,snk_sound_busy, 0)
33433338   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_COIN1 )
33443339   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_COIN2 )
33453340   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_START1 ) PORT_NAME("Start Game A")
src/mame/drivers/model2.c
r14883r14884
458458   return (space->machine().primary_screen->frame_number() & 1) << 2;
459459}
460460
461static CUSTOM_INPUT( _1c00000_r )
461CUSTOM_INPUT_MEMBER(model2_state::_1c00000_r)
462462{
463   model2_state *state = field.machine().driver_data<model2_state>();
464   UINT32 ret = input_port_read(field.machine(), "IN0");
463   UINT32 ret = input_port_read(machine(), "IN0");
465464
466   if(state->m_ctrlmode == 0)
465   if(m_ctrlmode == 0)
467466   {
468467      return ret;
469468   }
470469   else
471470   {
472471      ret &= ~0x0030;
473      return ret | 0x00d0 | (field.machine().device<eeprom_device>("eeprom")->read_bit() << 5);
472      return ret | 0x00d0 | (machine().device<eeprom_device>("eeprom")->read_bit() << 5);
474473   }
475474}
476475
477static CUSTOM_INPUT( _1c0001c_r )
476CUSTOM_INPUT_MEMBER(model2_state::_1c0001c_r)
478477{
479   model2_state *state = field.machine().driver_data<model2_state>();
480478   UINT32 iptval = 0x00ff;
481   if(state->m_analog_channel < 4)
479   if(m_analog_channel < 4)
482480   {
483481      static const char *const ports[] = { "ANA0", "ANA1", "ANA2", "ANA3" };
484      iptval = input_port_read_safe(field.machine(), ports[state->m_analog_channel], 0);
485      ++state->m_analog_channel;
482      iptval = input_port_read_safe(machine(), ports[m_analog_channel], 0);
483      ++m_analog_channel;
486484   }
487485   return iptval;
488486}
r14883r14884
558556*/
559557
560558
561static CUSTOM_INPUT( rchase2_devices_r )
559CUSTOM_INPUT_MEMBER(model2_state::rchase2_devices_r)
562560{
563561   return 0xffff;
564562}
r14883r14884
15331531static INPUT_PORTS_START( model2 )
15341532   PORT_START("1c00000")
15351533   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1536   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_1c00000_r, NULL)
1534   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, model2_state,_1c00000_r, NULL)
15371535
15381536   PORT_START("1c00004")
1539   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
1540   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN2")
1537   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
1538   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN2")
15411539
15421540   PORT_START("1c00010")
1543   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN0")
1544   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
1541   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN0")
1542   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
15451543
15461544   PORT_START("1c00014")
1547   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN2")
1545   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN2")
15481546   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
15491547
15501548   PORT_START("1c0001c")
15511549   PORT_BIT( 0x0000001a, IP_ACTIVE_HIGH, IPT_SPECIAL )   // these must be high
15521550   PORT_BIT( 0x0000ffe5, IP_ACTIVE_LOW, IPT_UNKNOWN )
1553   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_1c0001c_r, NULL)
1551   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, model2_state,_1c0001c_r, NULL)
15541552
15551553   PORT_START("IN0")
15561554   PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
15741572
15751573static INPUT_PORTS_START( desert )
15761574   PORT_START("1c00000")
1577   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "STEER")
1578   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "ACCEL")
1575   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "STEER")
1576   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "ACCEL")
15791577
15801578   PORT_START("1c00004")
1581   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "BRAKE")
1579   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "BRAKE")
15821580   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
15831581
15841582   PORT_START("1c00010")
1585   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN0")
1586   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
1583   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN0")
1584   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
15871585
15881586   PORT_START("1c00014")
1589   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN2")
1587   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN2")
15901588   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
15911589
15921590   PORT_START("IN0")
r14883r14884
16211619
16221620static INPUT_PORTS_START( daytona )
16231621   PORT_START("1c00000")
1624   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "STEER")
1625   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "ACCEL")
1622   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "STEER")
1623   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "ACCEL")
16261624
16271625   PORT_START("1c00004")
1628   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "BRAKE")
1626   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "BRAKE")
16291627   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
16301628
16311629   PORT_START("1c00010")
1632   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN0")
1633   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
1630   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN0")
1631   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
16341632
16351633   PORT_START("1c00014")
1636   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN2")
1634   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN2")
16371635   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
16381636
16391637   PORT_START("IN0")
r14883r14884
16701668static INPUT_PORTS_START( srallyc )
16711669   PORT_START("1c00000")
16721670   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1673   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_1c00000_r, NULL)
1671   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, model2_state,_1c00000_r, NULL)
16741672
16751673   PORT_START("1c00004")
1676   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
1677   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN2")
1674   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
1675   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN2")
16781676
16791677   PORT_START("1c00010")
1680   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN0")
1681   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
1678   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN0")
1679   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
16821680
16831681   PORT_START("1c00014")
1684   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN2")
1682   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN2")
16851683   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
16861684
16871685   PORT_START("1c0001c")
16881686   PORT_BIT( 0x0000001a, IP_ACTIVE_HIGH, IPT_SPECIAL )   // these must be high
16891687   PORT_BIT( 0x0000ffe5, IP_ACTIVE_LOW, IPT_UNKNOWN )
1690   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_1c0001c_r, NULL)
1688   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, model2_state,_1c0001c_r, NULL)
16911689
16921690   PORT_START("IN0")
16931691   PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
17211719static INPUT_PORTS_START( bel )
17221720   PORT_START("1c00000")
17231721   PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1724   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_1c00000_r, NULL)
1722   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, model2_state,_1c00000_r, NULL)
17251723
17261724   PORT_START("1c00004")
1727   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
1728   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN2")
1725   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
1726   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN2")
17291727
17301728   PORT_START("1c00010")
1731   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN0")
1732   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
1729   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN0")
1730   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
17331731
17341732   PORT_START("1c00014")
1735   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN2")
1733   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN2")
17361734   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
17371735
17381736   PORT_START("1c0001c")
17391737   PORT_BIT( 0x0000001a, IP_ACTIVE_HIGH, IPT_SPECIAL )   // these must be high
17401738   PORT_BIT( 0x0000ffe5, IP_ACTIVE_LOW, IPT_UNKNOWN )
1741   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_1c0001c_r, NULL)
1739   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, model2_state,_1c0001c_r, NULL)
17421740
17431741   PORT_START("IN0")
17441742   PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
17691767   PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNKNOWN )
17701768
17711769   PORT_MODIFY("IN2")
1772   PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(rchase2_devices_r, NULL)
1770   PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, model2_state,rchase2_devices_r, NULL)
17731771
17741772   /* FIXME: don't know yet if min max values are really correct, we'll see ... */
17751773   PORT_START("ANA0")
src/mame/drivers/majorpkr.c
r14883r14884
469469
470470   tilemap_t    *m_bg_tilemap,   *m_fg_tilemap;
471471
472   UINT8 *m_videoram;
472   UINT8 m_videoram[0x1000];
473473
474474   required_device<okim6295_device> oki;
475475
r14883r14884
594594
595595WRITE8_MEMBER(majorpkr_state::vram_bank_w)
596596{
597   m_vram_bank = data;
597   m_vram_bank = data & 1;
598598}
599599
600600READ8_MEMBER(majorpkr_state::vram_r)
src/mame/drivers/gstream.c
r14883r14884
170170   DECLARE_WRITE32_MEMBER(gstream_oki_banking_w);
171171   DECLARE_WRITE32_MEMBER(gstream_oki_4040_w);
172172   DECLARE_READ32_MEMBER(gstream_speedup_r);
173   DECLARE_CUSTOM_INPUT_MEMBER(gstream_mirror_service_r);
174   DECLARE_CUSTOM_INPUT_MEMBER(gstream_mirror_r);
173175};
174176
175177
176178
177static CUSTOM_INPUT( gstream_mirror_service_r )
179CUSTOM_INPUT_MEMBER(gstream_state::gstream_mirror_service_r)
178180{
179181   int result;
180182
181183   /* PORT_SERVICE_NO_TOGGLE */
182   result = (input_port_read(field.machine(), "IN0") & 0x8000) >> 15;
184   result = (input_port_read(machine(), "IN0") & 0x8000) >> 15;
183185
184186   return ~result;
185187}
186188
187static CUSTOM_INPUT( gstream_mirror_r )
189CUSTOM_INPUT_MEMBER(gstream_state::gstream_mirror_r)
188190{
189191   int result;
190192
191193   /* IPT_COIN1 */
192   result  = ((input_port_read(field.machine(), "IN0") & 0x200) >>  9) << 0;
194   result  = ((input_port_read(machine(), "IN0") & 0x200) >>  9) << 0;
193195   /* IPT_COIN2 */
194   result |= ((input_port_read(field.machine(), "IN1") & 0x200) >>  9) << 1;
196   result |= ((input_port_read(machine(), "IN1") & 0x200) >>  9) << 1;
195197   /* IPT_START1 */
196   result |= ((input_port_read(field.machine(), "IN0") & 0x400) >> 10) << 2;
198   result |= ((input_port_read(machine(), "IN0") & 0x400) >> 10) << 2;
197199   /* IPT_START2 */
198   result |= ((input_port_read(field.machine(), "IN1") & 0x400) >> 10) << 3;
200   result |= ((input_port_read(machine(), "IN1") & 0x400) >> 10) << 3;
199201   /* PORT_SERVICE_NO_TOGGLE */
200   result |= ((input_port_read(field.machine(), "IN0") & 0x8000) >> 15) << 6;
202   result |= ((input_port_read(machine(), "IN0") & 0x8000) >> 15) << 6;
201203
202204   return ~result;
203205}
r14883r14884
394396   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START2 )
395397   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_SERVICE2 )
396398   PORT_BIT( 0x7000, IP_ACTIVE_LOW, IPT_UNUSED )
397   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )   PORT_CUSTOM(gstream_mirror_service_r, NULL)
399   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )   PORT_CUSTOM_MEMBER(DEVICE_SELF, gstream_state,gstream_mirror_service_r, NULL)
398400
399401   PORT_START("IN2")
400   PORT_BIT( 0x004f, IP_ACTIVE_LOW, IPT_SPECIAL )   PORT_CUSTOM(gstream_mirror_r, NULL)
402   PORT_BIT( 0x004f, IP_ACTIVE_LOW, IPT_SPECIAL )   PORT_CUSTOM_MEMBER(DEVICE_SELF, gstream_state,gstream_mirror_r, NULL)
401403   PORT_BIT( 0xffb0, IP_ACTIVE_LOW, IPT_UNUSED )
402404INPUT_PORTS_END
403405
src/mame/drivers/scramble.c
r14883r14884
472472
473473
474474/* ckongs coinage DIPs are spread across two input ports */
475static CUSTOM_INPUT( ckongs_coinage_r )
475CUSTOM_INPUT_MEMBER(scramble_state::ckongs_coinage_r)
476476{
477477   int bit_mask = (FPTR)param;
478   return (input_port_read(field.machine(), "FAKE") & bit_mask) ? 0x01 : 0x00;
478   return (input_port_read(machine(), "FAKE") & bit_mask) ? 0x01 : 0x00;
479479}
480480
481481
r14883r14884
491491   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
492492
493493   PORT_START("IN1")
494   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ckongs_coinage_r, (void *)0x01)
495   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ckongs_coinage_r, (void *)0x02)
494   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, scramble_state,ckongs_coinage_r, (void *)0x01)
495   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, scramble_state,ckongs_coinage_r, (void *)0x02)
496496   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
497497   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
498498   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
r14883r14884
508508   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) )
509509   PORT_DIPSETTING(    0x04, "3" )
510510   PORT_DIPSETTING(    0x00, "4" )
511   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ckongs_coinage_r, (void *)0x04)
511   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, scramble_state,ckongs_coinage_r, (void *)0x04)
512512   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
513513   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
514514   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
src/mame/drivers/ssingles.c
r14883r14884
170170   DECLARE_WRITE8_MEMBER(c001_w);
171171   DECLARE_READ8_MEMBER(atamanot_prot_r);
172172   DECLARE_WRITE8_MEMBER(atamanot_prot_w);
173   DECLARE_CUSTOM_INPUT_MEMBER(controls_r);
173174};
174175
175176//fake palette
r14883r14884
338339   m_prot_data^=data^0x11;
339340}
340341
341static CUSTOM_INPUT(controls_r)
342CUSTOM_INPUT_MEMBER(ssingles_state::controls_r)
342343{
343344   int data = 7;
344   switch(input_port_read(field.machine(), "EXTRA"))      //multiplexed
345   switch(input_port_read(machine(), "EXTRA"))      //multiplexed
345346   {
346347      case 0x01: data = 1; break;
347348      case 0x02: data = 2; break;
r14883r14884
441442   PORT_START("INPUTS")
442443   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
443444   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) //must be LOW
444   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(controls_r, NULL)
445   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ssingles_state,controls_r, NULL)
445446   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4 )
446447   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 )
447448   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 )
src/mame/drivers/battlex.c
r14883r14884
5555   device_set_input_line(device, 0, ASSERT_LINE);
5656}
5757
58static CUSTOM_INPUT( battlex_in0_b4_r )
58CUSTOM_INPUT_MEMBER(battlex_state::battlex_in0_b4_r)
5959{
60   battlex_state *state = field.machine().driver_data<battlex_state>();
61   UINT32 ret = state->m_in0_b4;
62   if (state->m_in0_b4)
60   UINT32 ret = m_in0_b4;
61   if (m_in0_b4)
6362   {
64      cputag_set_input_line(field.machine(), "maincpu", 0, CLEAR_LINE);
65      state->m_in0_b4 = 0;
63      cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
64      m_in0_b4 = 0;
6665   }
6766
6867   return ret;
r14883r14884
119118   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
120119   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
121120   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
122   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(battlex_in0_b4_r, NULL)
121   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, battlex_state,battlex_in0_b4_r, NULL)
123122   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Cabinet ) )
124123   PORT_DIPSETTING(    0x20, DEF_STR( Upright ) )
125124   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
src/mame/drivers/toaplan2.c
r14883r14884
646646}
647647
648648
649static CUSTOM_INPUT( c2map_r )
649CUSTOM_INPUT_MEMBER(toaplan2_state::c2map_r)
650650{
651   toaplan2_state *state = field.machine().driver_data<toaplan2_state>();
652651
653652   // For Teki Paki hardware
654653   // bit 4 high signifies secondary CPU is ready
655654   // bit 5 is tested low before V-Blank bit ???
656   state->m_mcu_data = 0xff;
655   m_mcu_data = 0xff;
657656
658   return (state->m_mcu_data == 0xff) ? 0x01 : 0x00;
657   return (m_mcu_data == 0xff) ? 0x01 : 0x00;
659658}
660659
661660
r14883r14884
16731672//  PORT_DIPSETTING(        0x000d, DEF_STR( Japan ) )
16741673//  PORT_DIPSETTING(        0x000e, DEF_STR( Japan ) )
16751674   PORT_DIPSETTING(      0x000f, "Japan (Distributed by Tecmo)" )
1676   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(c2map_r, NULL)
1675   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, toaplan2_state,c2map_r, NULL)
16771676INPUT_PORTS_END
16781677
16791678
r14883r14884
20192018   PORT_INCLUDE( pipibibs )
20202019
20212020   PORT_MODIFY("JMPR")
2022   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(c2map_r, NULL)   // bit 0x10 sound ready
2021   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, toaplan2_state,c2map_r, NULL)   // bit 0x10 sound ready
20232022INPUT_PORTS_END
20242023
20252024
src/mame/drivers/crbaloon.c
r14883r14884
6767}
6868
6969
70static CUSTOM_INPUT( pc3092_r )
70CUSTOM_INPUT_MEMBER(crbaloon_state::pc3092_r)
7171{
72   crbaloon_state *state = field.machine().driver_data<crbaloon_state>();
7372   UINT32 ret;
7473
7574   /* enable coin & start input? Wild guess!!! */
76   if (state->m_pc3092_data[1] & 0x02)
77      ret = input_port_read(field.machine(), "PC3092");
75   if (m_pc3092_data[1] & 0x02)
76      ret = input_port_read(machine(), "PC3092");
7877   else
7978      ret = 0x00;
8079
81   if (LOG_PC3092) logerror("%s:  read  PC3092 = 0x%02x\n", field.machine().describe_context(), ret);
80   if (LOG_PC3092) logerror("%s:  read  PC3092 = 0x%02x\n", machine().describe_context(), ret);
8281
8382   return ret;
8483}
r14883r14884
296295   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Name Reset")
297296   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
298297   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT )
299   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(pc3092_r, NULL)
298   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, crbaloon_state,pc3092_r, NULL)
300299
301300   PORT_START("PC3092")
302301   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
src/mame/drivers/vicdual.c
r14883r14884
8181}
8282
8383
84static CUSTOM_INPUT( vicdual_read_coin_status )
84CUSTOM_INPUT_MEMBER(vicdual_state::vicdual_read_coin_status)
8585{
86   vicdual_state *state = field.machine().driver_data<vicdual_state>();
87   return state->m_coin_status;
86   return m_coin_status;
8887}
8988
9089
r14883r14884
135134}
136135
137136
138static CUSTOM_INPUT( vicdual_get_64v )
137CUSTOM_INPUT_MEMBER(vicdual_state::vicdual_get_64v)
139138{
140   return (get_vcounter(field.machine()) >> 6) & 0x01;
139   return (get_vcounter(machine()) >> 6) & 0x01;
141140}
142141
143142
144static CUSTOM_INPUT( vicdual_get_vblank_comp )
143CUSTOM_INPUT_MEMBER(vicdual_state::vicdual_get_vblank_comp)
145144{
146   return (get_vcounter(field.machine()) < VICDUAL_VBSTART);
145   return (get_vcounter(machine()) < VICDUAL_VBSTART);
147146}
148147
149148
150static CUSTOM_INPUT( vicdual_get_composite_blank_comp )
149CUSTOM_INPUT_MEMBER(vicdual_state::vicdual_get_composite_blank_comp)
151150{
152   return (vicdual_get_vblank_comp(device, field, 0) && !field.machine().primary_screen->hblank());
151   return (vicdual_get_vblank_comp(field, 0) && !machine().primary_screen->hblank());
153152}
154153
155154
156static CUSTOM_INPUT( vicdual_get_timer_value )
155CUSTOM_INPUT_MEMBER(vicdual_state::vicdual_get_timer_value)
157156{
158157   /* return the state of the timer (old code claims "4MHz square wave", but it was toggled once every 2msec, or 500Hz) */
159   return field.machine().time().as_ticks(500) & 1;
158   return machine().time().as_ticks(500) & 1;
160159}
161160
162161
r14883r14884
279278   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
280279
281280   PORT_START("IN1")
282   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_64v, NULL)
281   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_64v, NULL)
283282   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED )
284   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
283   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
285284
286285   PORT_COIN
287286INPUT_PORTS_END
r14883r14884
361360   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
362361
363362   PORT_START("IN1")
364   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_64v, NULL)
363   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_64v, NULL)
365364   PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
366365   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coinage ) )
367366   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
r14883r14884
369368   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
370369   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
371370   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
372   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
371   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
373372
374373   PORT_COIN
375374INPUT_PORTS_END
r14883r14884
451450   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
452451
453452   PORT_START("IN1")
454   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_64v, NULL)
453   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_64v, NULL)
455454   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
456   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
455   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
457456
458457   PORT_COIN
459458
r14883r14884
579578   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
580579
581580   PORT_START("IN1")
582   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_64v, NULL)
581   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_64v, NULL)
583582   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
584   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
583   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
585584
586585   PORT_CABINET_COLOR_OR_BW
587586
r14883r14884
609608   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
610609
611610   PORT_START("IN1")
612   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
611   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
613612    PORT_DIPNAME( 0x04, 0x04, "Rom Test" )
614613    PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
615614    PORT_DIPSETTING(    0x00, DEF_STR( On ) )
616615    PORT_BIT( 0x7a, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
617   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
616   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
618617
619618   PORT_CABINET_COLOR_OR_BW
620619
r14883r14884
656655   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
657656
658657   PORT_START("IN2")
659   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
658   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
660659   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED )
661   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
660   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
662661
663662   PORT_CABINET_COLOR_OR_BW
664663
r14883r14884
803802   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
804803
805804   PORT_START("IN2")
806   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
805   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
807806   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
808807   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
809808   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
810809   PORT_BIT( 0x7c, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
811   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
810   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
812811
813812   PORT_COIN
814813INPUT_PORTS_END
r14883r14884
836835   PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
837836
838837   PORT_START("IN2")
839   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
838   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
840839   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
841840   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
842841   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
843842   PORT_BIT( 0x7c, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
844   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
843   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
845844
846845   PORT_COIN
847846INPUT_PORTS_END
r14883r14884
878877   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
879878
880879   PORT_START("IN2")
881   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
880   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
882881   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
883   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
882   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
884883
885884   PORT_COIN
886885INPUT_PORTS_END
r14883r14884
12031202   PORT_DIPNAME( 0x04, 0x00, "Head On Lives (2/2)" )
12041203   PORT_DIPSETTING(    0x04, "+0" )
12051204   PORT_DIPSETTING(    0x00, "+1" )
1206   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
1205   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
12071206   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
12081207   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
12091208   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
12141213   PORT_DIPNAME( 0x04, 0x00, "Invinco Lives" )
12151214   PORT_DIPSETTING(    0x00, "5" )
12161215   PORT_DIPSETTING(    0x04, "6" )
1217   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
1216   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
12181217   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
12191218   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
12201219   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )   /* probably unused */
r14883r14884
12281227   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
12291228   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
12301229   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1231   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1230   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
12321231   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Game Select") PORT_TOGGLE
12331232   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
12341233   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
12571256   PORT_DIPNAME( 0x04, 0x00, "Invinco Lives (2/2)" )
12581257   PORT_DIPSETTING(    0x00, "+0" )
12591258   PORT_DIPSETTING(    0x04, "+2" )
1260   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
1259   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
12611260   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
12621261   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
12631262   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
12681267   PORT_DIPNAME( 0x04, 0x00, "Deep Scan Lives (1/2)" )
12691268   PORT_DIPSETTING(    0x00, "+0" )
12701269   PORT_DIPSETTING(    0x04, "+1" )
1271   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
1270   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
12721271   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
12731272   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
12741273   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
12801279   PORT_DIPNAME( 0x04, 0x00, "Deep Scan Lives (2/2)" )
12811280   PORT_DIPSETTING(    0x04, "+0" )
12821281   PORT_DIPSETTING(    0x00, "+2" )
1283   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1282   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
12841283   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Game Select") PORT_TOGGLE
12851284   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
12861285   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
13091308   PORT_DIPNAME( 0x04, 0x00, "S.A. Lives (2/2)" )
13101309   PORT_DIPSETTING(    0x00, "+0" )
13111310   PORT_DIPSETTING(    0x04, "+2" )
1312   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
1311   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
13131312   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
13141313   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
13151314   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
13201319   PORT_DIPNAME( 0x04, 0x00, "S.A. Bonus Life" )
13211320   PORT_DIPSETTING(    0x00, "10000" )
13221321   PORT_DIPSETTING(    0x04, "15000" )
1323   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
1322   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
13241323   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
13251324   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
13261325   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
13311330   PORT_DIPNAME( 0x04, 0x00, "S.A. Bonus Life For Final UFO" )
13321331   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
13331332   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1334   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1333   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
13351334   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Game Select") PORT_TOGGLE
13361335   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
13371336   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
13601359   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
13611360   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
13621361   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1363   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_vblank_comp, NULL)
1362   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_vblank_comp, NULL)
13641363   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
13651364   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
13661365   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
13711370   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
13721371   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
13731372   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1374   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
1373   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
13751374   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
13761375   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
13771376   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
13821381   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
13831382   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
13841383   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1385   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1384   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
13861385   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
13871386   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
13881387   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
14111410   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) /* unknown, but used */
14121411   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
14131412   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1414   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
1413   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
14151414   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
14161415   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
14171416   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
14221421   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
14231422   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
14241423   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1425   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
1424   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
14261425   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
14271426   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
14281427   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
14331432   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
14341433   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
14351434   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1436   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1435   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
14371436   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )
14381437   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
14391438   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
14621461   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) /* unknown, but used */
14631462   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
14641463   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1465   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
1464   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
14661465   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
14671466   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
14681467   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
14731472   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
14741473   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
14751474   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1476   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
1475   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
14771476   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
14781477   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
14791478   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
14841483   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
14851484   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
14861485   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1487   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1486   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
14881487   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )
14891488   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
14901489   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
15151514   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
15161515   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
15171516   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1518   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
1517   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
15191518   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
15201519   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
15211520   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
15261525   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
15271526   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
15281527   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1529   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
1528   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
15301529   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
15311530   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
15321531   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
15371536   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
15381537   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
15391538   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1540   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1539   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
15411540   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
15421541   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
15431542   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
15631562   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
15641563
15651564   PORT_START("IN1")
1566   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_64v, NULL)
1565   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_64v, NULL)
15671566   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
1568   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1567   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
15691568
15701569   PORT_CABINET_COLOR_OR_BW
15711570
r14883r14884
15951594   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
15961595   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
15971596   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1598   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
1597   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
15991598   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
16001599   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
16011600   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
16061605   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
16071606   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
16081607   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1609   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
1608   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
16101609   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
16111610   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
16121611   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
16171616   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
16181617   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
16191618   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1620   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1619   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
16211620   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
16221621   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
16231622   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
16261625INPUT_PORTS_END
16271626
16281627/* brdrline lives DIPs are spread across two input ports */
1629static CUSTOM_INPUT( brdrline_lives )
1628CUSTOM_INPUT_MEMBER(vicdual_state::brdrline_lives)
16301629{
16311630   int bit_mask = (FPTR)param;
1632   return (input_port_read(field.machine(), "FAKE_LIVES") & bit_mask) ? 0x00 : 0x01;
1631   return (input_port_read(machine(), "FAKE_LIVES") & bit_mask) ? 0x00 : 0x01;
16331632}
16341633
16351634static INPUT_PORTS_START( brdrline )
r14883r14884
16541653   PORT_START("IN1")
16551654   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
16561655   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
1657   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(brdrline_lives, (void *)0x01)
1658   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_vblank_comp, NULL)
1656   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,brdrline_lives, (void *)0x01)
1657   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_vblank_comp, NULL)
16591658   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
16601659   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
16611660   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
16631662   PORT_START("IN2")
16641663   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
16651664   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
1666   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(brdrline_lives, (void *)0x02)
1667   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_64v, NULL)   /* yes, this is different */
1665   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,brdrline_lives, (void *)0x02)
1666   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_64v, NULL)   /* yes, this is different */
16681667   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
16691668   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
16701669   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
16751674   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
16761675   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
16771676   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1678   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1677   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
16791678   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
16801679   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
16811680   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
17111710   PORT_START("IN1")
17121711   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
17131712   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
1714   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(brdrline_lives, (void *)0x01)
1715   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_vblank_comp, NULL)
1713   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,brdrline_lives, (void *)0x01)
1714   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_vblank_comp, NULL)
17161715   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
17171716   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
17181717   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
17201719   PORT_START("IN2")
17211720   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
17221721   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
1723   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(brdrline_lives, (void *)0x02)
1724   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_64v, NULL)   /* yes, this is different */
1722   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,brdrline_lives, (void *)0x02)
1723   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_64v, NULL)   /* yes, this is different */
17251724   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
17261725   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
17271726   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
17321731   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
17331732   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
17341733   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1735   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1734   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
17361735   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
17371736   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
17381737   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
17661765   PORT_DIPNAME( 0x04, 0x04, "Lives (2/2)" )
17671766   PORT_DIPSETTING(    0x04, "+0" )
17681767   PORT_DIPSETTING(    0x00, "+1" )
1769   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
1768   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
17701769   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
17711770   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
17721771   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
17771776   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
17781777   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
17791778   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1780   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
1779   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
17811780   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
17821781   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
17831782   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
17881787   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
17891788   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
17901789   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1791   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1790   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
17921791   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
17931792   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
17941793   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
18171816   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) /* bonus life? */
18181817   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
18191818   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1820   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
1819   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
18211820   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
18221821   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
18231822   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
18281827   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) /* bonus life? */
18291828   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
18301829   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1831   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
1830   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
18321831   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
18331832   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* has to be 0, protection? */
18341833   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )   /* probably unused */
r14883r14884
18391838   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Lives ) )
18401839   PORT_DIPSETTING(    0x00, "3" )
18411840   PORT_DIPSETTING(    0x04, "5" )
1842   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1841   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
18431842   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
18441843   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
18451844   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
18681867   PORT_DIPNAME( 0x04, 0x00, "Alpha Fighter Lives (2/2)" )
18691868   PORT_DIPSETTING(    0x00, "+0" )
18701869   PORT_DIPSETTING(    0x04, "+2" )
1871   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
1870   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
18721871   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
18731872   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
18741873   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
r14883r14884
18771876   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
18781877   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
18791878   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
1880   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
1879   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
18811880   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
18821881   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
18831882   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
r14883r14884
18881887   PORT_DIPNAME( 0x04, 0x00, "Alpha Fighter Unknown" )   // related to soccer frequency (code at 0x4950)
18891888   PORT_DIPSETTING(    0x00, DEF_STR ( Off ) )
18901889   PORT_DIPSETTING(    0x04, DEF_STR ( On ) )
1891   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
1890   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
18921891   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Game Select") PORT_TOGGLE
18931892   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
18941893   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
r14883r14884
20472046}
20482047
20492048
2050static CUSTOM_INPUT( samurai_protection_r )
2049CUSTOM_INPUT_MEMBER(vicdual_state::samurai_protection_r)
20512050{
2052   vicdual_state *state = field.machine().driver_data<vicdual_state>();
20532051   int offset = (FPTR)param;
20542052   UINT32 answer = 0;
20552053
2056   if (state->m_samurai_protection_data == 0xab)
2054   if (m_samurai_protection_data == 0xab)
20572055      answer = 0x02;
2058   else if (state->m_samurai_protection_data == 0x1d)
2056   else if (m_samurai_protection_data == 0x1d)
20592057      answer = 0x0c;
20602058
20612059   return (answer >> offset) & 0x01;
r14883r14884
21092107
21102108   PORT_START("IN1")
21112109   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
2112   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(samurai_protection_r, (void *)1)
2110   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,samurai_protection_r, (void *)1)
21132111   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) /* unknown, but used */
21142112   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
21152113   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2116   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
2114   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
21172115   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
21182116   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
21192117   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
21202118
21212119   PORT_START("IN2")
21222120   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
2123   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(samurai_protection_r, (void *)2)
2121   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,samurai_protection_r, (void *)2)
21242122   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
21252123   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
21262124   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2127   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_timer_value, NULL)
2125   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_timer_value, NULL)
21282126   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
21292127   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
21302128   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
21312129
21322130   PORT_START("IN3")
21332131   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
2134   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(samurai_protection_r, (void *)3)
2132   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,samurai_protection_r, (void *)3)
21352133   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
21362134   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
21372135   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2138   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
2136   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
21392137   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
21402138   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
21412139   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
22142212   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
22152213
22162214   PORT_START("IN1")
2217   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
2215   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
22182216   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
22192217   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
22202218   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r14883r14884
22332231   PORT_DIPNAME(0x40,  0x40, DEF_STR( Unknown ) )
22342232   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
22352233   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2236   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
2234   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
22372235
22382236   PORT_COIN
22392237INPUT_PORTS_END
r14883r14884
23302328   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
23312329
23322330   PORT_START("IN2")
2333   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_get_composite_blank_comp, NULL)
2331   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_get_composite_blank_comp, NULL)
23342332   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
2335   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vicdual_read_coin_status, NULL)
2333   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vicdual_state,vicdual_read_coin_status, NULL)
23362334
23372335   PORT_COIN
23382336INPUT_PORTS_END
src/mame/drivers/welltris.c
r14883r14884
339339   }
340340}
341341
342static CUSTOM_INPUT( pending_sound_r )
342CUSTOM_INPUT_MEMBER(welltris_state::pending_sound_r)
343343{
344   welltris_state *state = field.machine().driver_data<welltris_state>();
345   return state->m_pending_command ? 1 : 0;
344   return m_pending_command ? 1 : 0;
346345}
347346
348347WRITE8_MEMBER(welltris_state::pending_command_clear_w)
r14883r14884
399398   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 )   /* Test (used to go through tests in service mode) */
400399   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT )      /* Tested at start of irq 1 */
401400   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )   /* Service (adds a coin) */
402   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(pending_sound_r, NULL)   /* pending sound command */
401   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, welltris_state,pending_sound_r, NULL)   /* pending sound command */
403402
404403   PORT_START("P1")
405404   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
src/mame/drivers/metro.c
r14883r14884
381381   return (m_busy_sndcpu ? 0x00 : 0x01);
382382}
383383
384static CUSTOM_INPUT( custom_soundstatus_r )
384CUSTOM_INPUT_MEMBER(metro_state::custom_soundstatus_r)
385385{
386   metro_state *state = field.machine().driver_data<metro_state>();
387   return (state->m_busy_sndcpu ? 0x01 : 0x00);
386   return (m_busy_sndcpu ? 0x01 : 0x00);
388387}
389388
390389WRITE16_MEMBER(metro_state::metro_soundstatus_w)
r14883r14884
19511950   PORT_BIT(  0x0010, IP_ACTIVE_LOW,  IPT_START1   ) \
19521951   PORT_BIT(  0x0020, IP_ACTIVE_LOW,  IPT_START2   ) \
19531952   PORT_BIT(  0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN  ) \
1954   PORT_BIT(  0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL  ) PORT_CUSTOM(custom_soundstatus_r, NULL)   /* From Sound CPU */
1953   PORT_BIT(  0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL  ) PORT_CUSTOM_MEMBER(DEVICE_SELF, metro_state,custom_soundstatus_r, NULL)   /* From Sound CPU */
19551954
19561955
19571956#define COINAGE_SERVICE_LOC(DIPBANK) \
src/mame/drivers/gal3.c
r14883r14884
162162
163163static VIDEO_START(gal3)
164164{
165   gal3_state *state = machine.driver_data<gal3_state>();
166   state->m_generic_paletteram_16.allocate(0x10000);
167 
165168   namco_obj_init(machine,
166169      0,      /* gfx bank */
167170      0xf,   /* reverse palette mapping */
r14883r14884
389392/// AM_RANGE(0xf1480000, 0xf14807ff) AM_READWRITE_LEGACY(namcos21_depthcue_r,namcos21_depthcue_w)
390393   AM_RANGE(0xf1700000, 0xf170ffff) AM_READWRITE_LEGACY(namco_obj32_r,namco_obj32_w)
391394   AM_RANGE(0xf1720000, 0xf1720007) AM_READWRITE_LEGACY(namco_spritepos32_r,namco_spritepos32_w)
392   AM_RANGE(0xf1740000, 0xf175ffff) AM_READWRITE(paletteram32_r,paletteram32_w) AM_SHARE("paletteram")
395   AM_RANGE(0xf1740000, 0xf175ffff) AM_READWRITE(paletteram32_r,paletteram32_w)
393396   AM_RANGE(0xf1760000, 0xf1760003) AM_READWRITE(namcos21_video_enable_r,namcos21_video_enable_w)
394397
395398   AM_RANGE(0xf2200000, 0xf220ffff) AM_RAM
src/mame/drivers/rgum.c
r14883r14884
2828   UINT8 *m_vram;
2929   UINT8 *m_cram;
3030   UINT8 m_hbeat;
31   DECLARE_CUSTOM_INPUT_MEMBER(rgum_heartbeat_r);
3132};
3233
3334
r14883r14884
7980ADDRESS_MAP_END
8081
8182
82static CUSTOM_INPUT( rgum_heartbeat_r )
83CUSTOM_INPUT_MEMBER(rgum_state::rgum_heartbeat_r)
8384{
84   rgum_state *state = field.machine().driver_data<rgum_state>();
8585
86   state->m_hbeat ^= 1;
86   m_hbeat ^= 1;
8787
88   return state->m_hbeat;
88   return m_hbeat;
8989}
9090
9191
r14883r14884
106106   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
107107   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
108108   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
109   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(rgum_heartbeat_r, NULL)
109   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, rgum_state,rgum_heartbeat_r, NULL)
110110   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
111111   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
112112   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
src/mame/drivers/zaccaria.c
r14883r14884
338338ADDRESS_MAP_END
339339
340340
341static CUSTOM_INPUT( acs_r )
341CUSTOM_INPUT_MEMBER(zaccaria_state::acs_r)
342342{
343   zaccaria_state *state = field.machine().driver_data<zaccaria_state>();
344   return (state->m_acs & 0x08) ? 1 : 0;
343   return (m_acs & 0x08) ? 1 : 0;
345344}
346345
347346static INPUT_PORTS_START( monymony )
r14883r14884
449448   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
450449   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
451450   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
452   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(acs_r, NULL)   /* "ACS" - from pin 13 of a PIA on the sound board */
451   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaccaria_state,acs_r, NULL)   /* "ACS" - from pin 13 of a PIA on the sound board */
453452   /* other bits come from a protection device */
454453INPUT_PORTS_END
455454
src/mame/drivers/littlerb.c
r14883r14884
106106   DECLARE_WRITE16_MEMBER(littlerb_vdp_w);
107107   DECLARE_WRITE16_MEMBER(littlerb_l_sound_w);
108108   DECLARE_WRITE16_MEMBER(littlerb_r_sound_w);
109   DECLARE_CUSTOM_INPUT_MEMBER(littlerb_frame_step_r);
109110};
110111
111112
r14883r14884
130131   AM_RANGE(0x00800002 ,0x00800003) AM_DEVWRITE8("^ramdac", ramdac_device, pal_w,   0x00ff)
131132   AM_RANGE(0x00800004 ,0x00800005) AM_DEVWRITE8("^ramdac", ramdac_device, mask_w,  0x00ff)
132133
133   AM_RANGE(0x1ff80804, 0x1ff80805) AM_READ(buffer_status_r)
134   AM_RANGE(0x1ff80804, 0x1ff80805) AM_DEVREAD("^", littlerb_state, buffer_status_r)
134135   // most gfx end up here including the sprite list
135   AM_RANGE(0x1ff80000, 0x1fffffff) AM_RAM_WRITE(region4_w)  AM_BASE(m_region4)
136   AM_RANGE(0x1ff80000, 0x1fffffff) AM_RAM AM_DEVWRITE("^", littlerb_state, region4_w)  AM_BASE(m_region4)
136137ADDRESS_MAP_END
137138
138139static ADDRESS_MAP_START( ramdac_map, AS_0, 8, littlerb_state )
r14883r14884
349350ADDRESS_MAP_END
350351
351352/* guess according to DASM code and checking the gameplay speed, could be different */
352static CUSTOM_INPUT( littlerb_frame_step_r )
353CUSTOM_INPUT_MEMBER(littlerb_state::littlerb_frame_step_r)
353354{
354   UINT32 ret = field.machine().primary_screen->frame_number();
355   UINT32 ret = machine().primary_screen->frame_number();
355356
356357   return (ret) & 7;
357358}
r14883r14884
422423   PORT_DIPNAME( 0x1000, 0x1000, "???"  )
423424   PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
424425   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
425   PORT_BIT( 0xe000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(littlerb_frame_step_r, NULL)
426   PORT_BIT( 0xe000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, littlerb_state,littlerb_frame_step_r, NULL)
426427
427428   PORT_START("P2")   /* 16bit */
428429   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
src/mame/drivers/eolith.c
r14883r14884
167167   PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
168168   PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_COIN1 )
169169   PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNUSED )
170   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(eolith_speedup_getvblank, NULL)
170   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, eolith_state, eolith_speedup_getvblank, NULL)
171171   PORT_BIT( 0x00003f80, IP_ACTIVE_LOW, IPT_UNUSED )
172172   PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_SERVICE1 )
173173   PORT_SERVICE_NO_TOGGLE( 0x00008000, IP_ACTIVE_LOW )
r14883r14884
205205   PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
206206   PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_COIN1 )
207207   PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNUSED )
208   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(eolith_speedup_getvblank, NULL)
208   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, eolith_state, eolith_speedup_getvblank, NULL)
209209   PORT_BIT( 0x00003f80, IP_ACTIVE_LOW, IPT_UNUSED )
210210   PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_UNUSED )
211211   PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
388388   PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
389389   PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_COIN1 )
390390   PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNUSED )
391   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(stealsee_speedup_getvblank, NULL)
391   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, eolith_state, stealsee_speedup_getvblank, NULL)
392392   PORT_BIT( 0x00003f80, IP_ACTIVE_LOW, IPT_UNUSED )
393393   PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_SERVICE1 )
394394   PORT_SERVICE_NO_TOGGLE( 0x00008000, IP_ACTIVE_LOW )
src/mame/drivers/jaguar.c
r14883r14884
13671367   PORT_BIT( 0xfe000000, IP_ACTIVE_LOW, IPT_UNUSED )
13681368
13691369   PORT_START("SYSTEM")
1370   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE0")
1371   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE0")
1370   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0")
1371   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0")
13721372
13731373   PORT_START("FAKE0")
13741374   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
14251425   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
14261426
14271427   PORT_START("SYSTEM")
1428   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE0")
1429   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE0")
1428   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0")
1429   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0")
14301430
14311431   PORT_START("FAKE0")
14321432   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
14691469   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
14701470
14711471   PORT_START("SYSTEM")
1472   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE0")
1473   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE0")
1472   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0")
1473   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0")
14741474
14751475   PORT_START("FAKE0")
14761476   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
15191519   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
15201520
15211521   PORT_START("SYSTEM")
1522   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE0")
1523   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE0")
1522   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0")
1523   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0")
15241524
15251525   PORT_START("FAKE0")
15261526   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
src/mame/drivers/asteroid.c
r14883r14884
306306 *
307307 *************************************/
308308
309static CUSTOM_INPUT( clock_r )
309CUSTOM_INPUT_MEMBER(asteroid_state::clock_r)
310310{
311   return (field.machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
311   return (machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
312312}
313313
314314static INPUT_PORTS_START( asteroid )
315315   PORT_START("IN0")
316316   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
317317   /* Bit 2 is the 3 KHz source and Bit 3 the VG_HALT bit    */
318   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
318   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, NULL)
319319   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)
320320   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3)      /* hyperspace */
321321   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1)   /* fire */
r14883r14884
397397   /* Bit 0 is VG_HALT and Bit 2 is the 3 KHz source */
398398   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)
399399   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
400   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
400   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, NULL)
401401   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3)      /* hyperspace */
402402   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1)      /* fire */
403403   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
r14883r14884
437437   PORT_START("IN0")
438438   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* According to schematics */
439439   /* Bit 2 is the 3 KHz source and Bit 3 the VG_HALT bit    */
440   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
440   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, NULL)
441441   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)
442442   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_CODE(KEYCODE_SPACE) PORT_CODE(JOYCODE_BUTTON3)      /* hyperspace */
443443   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(JOYCODE_BUTTON1)   /* fire */
r14883r14884
525525   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
526526   /* Of the rest, Bit 6 is the 3KHz source. 3,4 and 5 are unknown */
527527   PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNKNOWN )
528   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
528   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, asteroid_state,clock_r, NULL)
529529   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
530530
531531   PORT_START("IN1")
src/mame/drivers/vamphalf.c
r14883r14884
116116   DECLARE_READ16_MEMBER(dtfamily_speedup_r);
117117   DECLARE_READ16_MEMBER(toyland_speedup_r);
118118   DECLARE_READ16_MEMBER(boonggab_speedup_r);
119   DECLARE_CUSTOM_INPUT_MEMBER(boonggab_photo_sensors_r);
119120};
120121
121122static READ16_DEVICE_HANDLER( eeprom_r )
r14883r14884
641642   return 0;
642643}
643644
644static CUSTOM_INPUT( boonggab_photo_sensors_r )
645CUSTOM_INPUT_MEMBER(vamphalf_state::boonggab_photo_sensors_r)
645646{
646647   static const UINT16 photo_sensors_table[8] = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 };
647   UINT8 res = input_port_read(field.machine(), "PHOTO_SENSORS");
648   UINT8 res = input_port_read(machine(), "PHOTO_SENSORS");
648649
649650   switch(res)
650651   {
r14883r14884
790791   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_SPECIAL ) // sensor 1
791792   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL ) // sensor 2
792793   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_SPECIAL ) // sensor 3
793   PORT_BIT( 0x3800, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(boonggab_photo_sensors_r, NULL) // photo sensors 1, 2 and 3
794   PORT_BIT( 0x3800, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vamphalf_state,boonggab_photo_sensors_r, NULL) // photo sensors 1, 2 and 3
794795   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
795796   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
796797
src/mame/drivers/vegaeo.c
r14883r14884
1515#include "emu.h"
1616#include "cpu/e132xs/e132xs.h"
1717#include "machine/at28c16.h"
18#include "includes/eolith.h"
1819#include "includes/eolithsp.h"
1920
2021
21class vegaeo_state : public driver_device
22class vegaeo_state : public eolith_state
2223{
2324public:
2425   vegaeo_state(const machine_config &mconfig, device_type type, const char *tag)
25      : driver_device(mconfig, type, tag) { }
26      : eolith_state(mconfig, type, tag) { }
2627
2728   UINT32 *m_vega_vram;
2829   UINT8 m_vega_vbuffer;
r14883r14884
117118   PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_START2 )
118119   PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_SERVICE1 )
119120   PORT_SERVICE_NO_TOGGLE( 0x00000020, IP_ACTIVE_LOW )
120   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(eolith_speedup_getvblank, NULL)
121   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vegaeo_state, eolith_speedup_getvblank, NULL)
121122   PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNUSED )
122123   PORT_BIT( 0xffffff00, IP_ACTIVE_LOW, IPT_UNUSED )
123124
src/mame/drivers/fromanc2.c
r14883r14884
7070   return ret;
7171}
7272
73static CUSTOM_INPUT( subcpu_int_r )
73CUSTOM_INPUT_MEMBER(fromanc2_state::subcpu_int_r)
7474{
75   fromanc2_state *state = field.machine().driver_data<fromanc2_state>();
76   return state->m_subcpu_int_flag & 0x01;
75   return m_subcpu_int_flag & 0x01;
7776}
7877
79static CUSTOM_INPUT( sndcpu_nmi_r )
78CUSTOM_INPUT_MEMBER(fromanc2_state::sndcpu_nmi_r)
8079{
81   fromanc2_state *state = field.machine().driver_data<fromanc2_state>();
82   return state->m_sndcpu_nmi_flag & 0x01;
80   return m_sndcpu_nmi_flag & 0x01;
8381}
8482
85static CUSTOM_INPUT( subcpu_nmi_r )
83CUSTOM_INPUT_MEMBER(fromanc2_state::subcpu_nmi_r)
8684{
87   fromanc2_state *state = field.machine().driver_data<fromanc2_state>();
88   return state->m_subcpu_nmi_flag & 0x01;
85   return m_subcpu_nmi_flag & 0x01;
8986}
9087
9188WRITE16_MEMBER(fromanc2_state::fromanc2_eeprom_w)
r14883r14884
314311   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
315312   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 )
316313   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN4 )
317   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(subcpu_int_r, NULL)      // SUBCPU INT FLAG
318   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(sndcpu_nmi_r, NULL)      // SNDCPU NMI FLAG
319   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(subcpu_nmi_r, NULL)      // SUBCPU NMI FLAG
314   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, fromanc2_state,subcpu_int_r, NULL)      // SUBCPU INT FLAG
315   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, fromanc2_state,sndcpu_nmi_r, NULL)      // SNDCPU NMI FLAG
316   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, fromanc2_state,subcpu_nmi_r, NULL)      // SUBCPU NMI FLAG
320317   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
321318   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME( "Service Mode (1P)" ) PORT_CODE(KEYCODE_F2)   // TEST (1P)
322319   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME( "Service Mode (2P)" ) PORT_CODE(KEYCODE_F2)   // TEST (2P)
r14883r14884
425422   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN2 )
426423   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN3 )
427424   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_COIN4 )
428   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(sndcpu_nmi_r, NULL)      // SNDCPU NMI FLAG
425   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, fromanc2_state,sndcpu_nmi_r, NULL)      // SNDCPU NMI FLAG
429426   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
430427   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
431428   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED )
src/mame/drivers/arcadia.c
r14883r14884
6464
6565   UINT8 coin_counter[2];
6666   DECLARE_WRITE16_MEMBER(arcadia_multibios_change_game);
67   DECLARE_CUSTOM_INPUT_MEMBER(coin_counter_r);
6768};
6869
6970
r14883r14884
156157 *
157158 *************************************/
158159
159static CUSTOM_INPUT( coin_counter_r )
160CUSTOM_INPUT_MEMBER(arcadia_amiga_state::coin_counter_r)
160161{
161162   int coin = (FPTR)param;
162   UINT8 *coin_counter = field.machine().driver_data<arcadia_amiga_state>()->coin_counter;
163163
164164   /* return coin counter values */
165165   return coin_counter[coin] & 3;
r14883r14884
229229   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
230230   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
231231   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
232   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_counter_r, 0)
233   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_counter_r, 1)
232   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,coin_counter_r, 0)
233   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,coin_counter_r, 1)
234234
235235   PORT_START("JOY0DAT")
236   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P1JOY")
236   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,amiga_joystick_convert, "P1JOY")
237237   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED )
238238
239239   PORT_START("JOY1DAT")
240   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P2JOY")
240   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arcadia_amiga_state,amiga_joystick_convert, "P2JOY")
241241   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED )
242242
243243   PORT_START("POTGO")
src/mame/drivers/xain.c
r14883r14884
271271      cputag_set_input_line(machine(), "mcu", 0, ASSERT_LINE);
272272}
273273
274static CUSTOM_INPUT( xain_vblank_r )
274CUSTOM_INPUT_MEMBER(xain_state::xain_vblank_r)
275275{
276   xain_state *state = field.machine().driver_data<xain_state>();
277   return state->m_vblank;
276   return m_vblank;
278277}
279278
280279
r14883r14884
354353   m_ddr_c = data;
355354}
356355
357static CUSTOM_INPUT( mcu_status_r )
356CUSTOM_INPUT_MEMBER(xain_state::mcu_status_r)
358357{
359   xain_state *state = field.machine().driver_data<xain_state>();
360358   UINT8 res = 0;
361359
362   if (field.machine().device("mcu") != NULL)
360   if (machine().device("mcu") != NULL)
363361   {
364      if (state->m_mcu_ready == 1)
362      if (m_mcu_ready == 1)
365363         res |= 0x01;
366      if (state->m_mcu_accept == 1)
364      if (m_mcu_accept == 1)
367365         res |= 0x02;
368366   }
369367   else
r14883r14884
516514   PORT_START("VBLANK")
517515   PORT_BIT( 0x03, IP_ACTIVE_LOW,  IPT_UNUSED )
518516   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_COIN3 )
519   PORT_BIT( 0x18, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(mcu_status_r, NULL)
520   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(xain_vblank_r, NULL)   /* VBLANK */
517   PORT_BIT( 0x18, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, xain_state,mcu_status_r, NULL)
518   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xain_state,xain_vblank_r, NULL)   /* VBLANK */
521519   PORT_BIT( 0xc0, IP_ACTIVE_LOW,  IPT_UNUSED )
522520INPUT_PORTS_END
523521
src/mame/drivers/galdrvr.c
r14883r14884
350350   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
351351   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
352352   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
353   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(azurian_port_r, (void *)0) /* "linked" with bit 2 of IN2 */
353   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxian_state, azurian_port_r, (void *)0) /* "linked" with bit 2 of IN2 */
354354   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Lives ) )
355355   PORT_DIPSETTING(    0x00, "3" )
356356   PORT_DIPSETTING(    0x80, "5" )
r14883r14884
362362   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Bonus_Life ) )
363363   PORT_DIPSETTING(    0x00, "5000" )
364364   PORT_DIPSETTING(    0x02, "7000" )
365   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(azurian_port_r, (void *)1) /* "linked" with bit 6 of IN1 */
365   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxian_state, azurian_port_r, (void *)1) /* "linked" with bit 6 of IN1 */
366366   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )
367367   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
368368   PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
r14883r14884
889889
890890static INPUT_PORTS_START( gmgalax )
891891   PORT_START("IN0")
892   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(gmgalax_port_r, "GMIN0\0GLIN0")
892   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxian_state, gmgalax_port_r, "GMIN0\0GLIN0")
893893
894894   PORT_START("IN1")
895   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(gmgalax_port_r, "GMIN1\0GLIN1")
895   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxian_state, gmgalax_port_r, "GMIN1\0GLIN1")
896896
897897   PORT_START("IN2")
898   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(gmgalax_port_r, "GMIN2\0GLIN2")
898   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxian_state, gmgalax_port_r, "GMIN2\0GLIN2")
899899
900900   PORT_START("GMIN0")      /* Ghost Muncher - IN0 */
901901   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )                                    PORT_CONDITION("GAMESEL",0x01,PORTCOND_NOTEQUALS,0x01)
r14883r14884
16191619   PORT_INCLUDE(galaxian)
16201620
16211621   PORT_MODIFY("IN0")
1622   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(kingball_muxbit_r, NULL)
1622   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxian_state, kingball_muxbit_r, NULL)
16231623   /* Relating to above port:Hack? - possibly multiplexed via writes to $b003 */
16241624   //PORT_DIPNAME( 0x40, 0x40, "Speech" )
16251625   //PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
16261626   //PORT_DIPSETTING(    0x40, DEF_STR( On ) )
16271627
16281628   PORT_MODIFY("IN1")
1629   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(kingball_noise_r, NULL)   /* NOISE line */
1629   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxian_state, kingball_noise_r, NULL)   /* NOISE line */
16301630   PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Coinage ) )
16311631   PORT_DIPSETTING(    0xc0, DEF_STR( 2C_1C ) )
16321632   PORT_DIPSETTING(    0x40, DEF_STR( 1C_1C ) )
r14883r14884
20552055   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
20562056   PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
20572057   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
2058   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(scramble_protection_alt_r, (void *)0)   /* protection bit */
2058   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxian_state, scramble_protection_alt_r, (void *)0)   /* protection bit */
20592059   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
2060   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(scramble_protection_alt_r, (void *)1)   /* protection bit */
2060   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxian_state, scramble_protection_alt_r, (void *)1)   /* protection bit */
20612061
20622062   PORT_START("IN3")   /* need for some PPI accesses */
20632063   PORT_BIT( 0xff, 0x00, IPT_UNUSED )
r14883r14884
24812481INPUT_PORTS_END
24822482
24832483
2484static CUSTOM_INPUT( moonwar_dial_r )
2484CUSTOM_INPUT_MEMBER(galaxian_state::moonwar_dial_r)
24852485{
2486   galaxian_state *state = field.machine().driver_data<galaxian_state>();
24872486   static const char *const dialname[2] = { "P1_DIAL", "P2_DIAL" };
2488   int p = (~state->m_moonwar_port_select >> 4) & 1;
2487   int p = (~m_moonwar_port_select >> 4) & 1;
24892488
24902489   // see http://www.cityofberwyn.com/schematics/stern/MoonWar_opto.tiff for schematic
24912490   // I.e. a 74ls161 counts from 0 to 15 which is the absolute number of bars passed on the quadrature
24922491
2493   signed char dialread = input_port_read(field.machine(), dialname[p]);
2492   signed char dialread = input_port_read(machine(), dialname[p]);
24942493
24952494   UINT8 ret;
24962495
2497   if (dialread < 0) state->m_direction[p] = 0x00;
2498   else if (dialread > 0) state->m_direction[p] = 0x10;
2496   if (dialread < 0) m_direction[p] = 0x00;
2497   else if (dialread > 0) m_direction[p] = 0x10;
24992498
2500   state->m_counter_74ls161[p] += abs(dialread);
2501   state->m_counter_74ls161[p] &= 0xf;
2499   m_counter_74ls161[p] += abs(dialread);
2500   m_counter_74ls161[p] &= 0xf;
25022501
2503   ret = state->m_counter_74ls161[p] | state->m_direction[p];
2504   //fprintf(stderr, "dialread1: %02x, counter_74ls161: %02x, spinner ret is %02x\n", dialread, state->m_counter_74ls161[p], ret);
2502   ret = m_counter_74ls161[p] | m_direction[p];
2503   //fprintf(stderr, "dialread1: %02x, counter_74ls161: %02x, spinner ret is %02x\n", dialread, m_counter_74ls161[p], ret);
25052504
25062505   return ret;
25072506}
r14883r14884
25092508/* verified from Z80 code */
25102509static INPUT_PORTS_START( moonwar )
25112510   PORT_START("IN0")
2512   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(moonwar_dial_r, (void *)0)
2511   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxian_state, moonwar_dial_r, (void *)0)
25132512   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL // cocktail: p2 shield
25142513   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
25152514   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
src/mame/drivers/firefox.c
r14883r14884
8686   DECLARE_WRITE8_MEMBER(self_reset_w);
8787   DECLARE_WRITE8_MEMBER(led_w);
8888   DECLARE_WRITE8_MEMBER(firefox_coin_counter_w);
89   DECLARE_CUSTOM_INPUT_MEMBER(mainflag_r);
90   DECLARE_CUSTOM_INPUT_MEMBER(soundflag_r);
8991};
9092
9193
r14883r14884
282284 *
283285 *************************************/
284286
285static CUSTOM_INPUT( mainflag_r )
287CUSTOM_INPUT_MEMBER(firefox_state::mainflag_r)
286288{
287   firefox_state *state = field.machine().driver_data<firefox_state>();
288   return state->m_main_to_sound_flag;
289   return m_main_to_sound_flag;
289290}
290291
291static CUSTOM_INPUT( soundflag_r )
292CUSTOM_INPUT_MEMBER(firefox_state::soundflag_r)
292293{
293   firefox_state *state = field.machine().driver_data<firefox_state>();
294   return state->m_sound_to_main_flag;
294   return m_sound_to_main_flag;
295295}
296296
297297READ8_MEMBER(firefox_state::sound_to_main_r)
r14883r14884
573573   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
574574
575575   PORT_START("rdin1")
576   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mainflag_r, NULL)
577   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(soundflag_r, NULL)
576   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firefox_state,mainflag_r, NULL)
577   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firefox_state,soundflag_r, NULL)
578578   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_VBLANK )
579579   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE )
580580   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
src/mame/drivers/renegade.c
r14883r14884
593593   }
594594}
595595
596static CUSTOM_INPUT( mcu_status_r )
596CUSTOM_INPUT_MEMBER(renegade_state::mcu_status_r)
597597{
598   renegade_state *state = field.machine().driver_data<renegade_state>();
599598   UINT8 res = 0;
600599
601   if (state->m_mcu_sim == TRUE)
600   if (m_mcu_sim == TRUE)
602601   {
603602      res = 1;
604603   }
605604   else
606605   {
607      if (!state->m_main_sent)
606      if (!m_main_sent)
608607         res |= 0x01;
609      if (!state->m_mcu_sent)
608      if (!m_mcu_sent)
610609         res |= 0x02;
611610   }
612611
r14883r14884
717716
718717   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)   /* attack right */
719718   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)   /* attack right */
720   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(mcu_status_r, NULL)
719   PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, renegade_state,mcu_status_r, NULL)
721720   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_VBLANK )
722721   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
723722
src/mame/drivers/junofrst.c
r14883r14884
266266WRITE8_MEMBER(junofrst_state::flip_screen_w)
267267{
268268
269   tutankhm_flip_screen_x_w(*&space, 0, data);
270   tutankhm_flip_screen_y_w(*&space, 0, data);
269   tutankhm_flip_screen_x_w(space, 0, data);
270   tutankhm_flip_screen_y_w(space, 0, data);
271271}
272272
273273
src/mame/drivers/missile.c
r14883r14884
369369   UINT16 m_madsel_lastpc;
370370   DECLARE_WRITE8_MEMBER(missile_w);
371371   DECLARE_READ8_MEMBER(missile_r);
372   DECLARE_CUSTOM_INPUT_MEMBER(get_vblank);
372373};
373374
374375
r14883r14884
450451}
451452
452453
453static CUSTOM_INPUT( get_vblank )
454CUSTOM_INPUT_MEMBER(missile_state::get_vblank)
454455{
455   missile_state *state = field.machine().driver_data<missile_state>();
456   int v = scanline_to_v(state, field.machine().primary_screen->vpos());
456   missile_state *state = machine().driver_data<missile_state>();
457   int v = scanline_to_v(state, machine().primary_screen->vpos());
457458   return v < 24;
458459}
459460
r14883r14884
857858   PORT_BIT( 0x18, IP_ACTIVE_HIGH, IPT_SPECIAL )
858859   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT )
859860   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
860   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_vblank, NULL)
861   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, missile_state,get_vblank, NULL)
861862
862863   PORT_START("R10")   /* IN2 */
863864   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("R10:1,2")
r14883r14884
939940   PORT_BIT( 0x18, IP_ACTIVE_HIGH, IPT_SPECIAL )
940941   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT )
941942   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
942   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_vblank, NULL)
943   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, missile_state,get_vblank, NULL)
943944
944945   PORT_START("R10")   /* IN2 */
945946   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("R10:1,2")
src/mame/drivers/jack.c
r14883r14884
7878   m_joinem_snd_bit = data & 1;
7979}
8080
81static CUSTOM_INPUT( sound_check_r )
81CUSTOM_INPUT_MEMBER(jack_state::sound_check_r)
8282{
83   jack_state *state = field.machine().driver_data<jack_state>();
8483   UINT8 ret = 0;
8584
86   if ((input_port_read(field.machine(), "IN2") & 0x80) && !state->m_joinem_snd_bit)
85   if ((input_port_read(machine(), "IN2") & 0x80) && !m_joinem_snd_bit)
8786      ret = 1;
8887
8988   return ret;
r14883r14884
574573   PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x00, "SW2:!3" )
575574   PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x00, "SW2:!4" )
576575   PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x00, "SW2:!5" )
577   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(sound_check_r, NULL) // sound check
576   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, jack_state,sound_check_r, NULL) // sound check
578577   PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x00, "SW2:!7" )
579578   PORT_DIPNAME( 0x80, 0x00, "Infinite Lives" )      PORT_DIPLOCATION("SW2:!8")
580579   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
src/mame/drivers/taitosj.c
r14883r14884
190190   state->m_input_port_4_f0 = data >> 4;
191191}
192192
193static CUSTOM_INPUT( input_port_4_f0_r )
193CUSTOM_INPUT_MEMBER(taitosj_state::input_port_4_f0_r)
194194{
195   taitosj_state *state = field.machine().driver_data<taitosj_state>();
196   return state->m_input_port_4_f0;
195   return m_input_port_4_f0;
197196}
198197
199198
r14883r14884
279278
280279/* seems the most logical way to do the gears */
281280
282static CUSTOM_INPUT( kikstart_gear_r )
281CUSTOM_INPUT_MEMBER(taitosj_state::kikstart_gear_r)
283282{
284   taitosj_state *state = field.machine().driver_data<taitosj_state>();
285283   const char *port_tag;
286284
287285   int player = (int)(FPTR)param;
r14883r14884
292290      port_tag = "GEARP2";
293291
294292   /* gear MUST be 1, 2 or 3 */
295   if (input_port_read(field.machine(), port_tag) & 0x01) state->m_kikstart_gears[player] = 0x02;
296   if (input_port_read(field.machine(), port_tag) & 0x02) state->m_kikstart_gears[player] = 0x03;
297   if (input_port_read(field.machine(), port_tag) & 0x04) state->m_kikstart_gears[player] = 0x01;
293   if (input_port_read(machine(), port_tag) & 0x01) m_kikstart_gears[player] = 0x02;
294   if (input_port_read(machine(), port_tag) & 0x02) m_kikstart_gears[player] = 0x03;
295   if (input_port_read(machine(), port_tag) & 0x04) m_kikstart_gears[player] = 0x01;
298296
299   return state->m_kikstart_gears[player];
297   return m_kikstart_gears[player];
300298}
301299
302300
r14883r14884
491489
492490   PORT_START("IN4")
493491   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
494   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
492   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
495493
496494   PORT_START("DSW1")
497495   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
r14883r14884
573571
574572   PORT_START("IN4")
575573   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
576   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
574   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
577575
578576   PORT_START("DSW1")
579577   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
r14883r14884
657655
658656   PORT_START("IN4")
659657   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
660   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
658   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
661659
662660   PORT_START("DSW1")
663661   PORT_DIPNAME( 0x03, 0x03, "Finish Bonus" )
r14883r14884
779777
780778   PORT_START("IN4")
781779   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
782   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
780   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
783781
784782   PORT_START("DSW1")
785783   PORT_DIPNAME( 0x03, 0x03, "Jump Bonus" )
r14883r14884
864862
865863   PORT_START("IN4")
866864   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
867   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
865   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
868866
869867   PORT_START("DSW1")
870868   PORT_DIPNAME( 0x03, 0x03, "Jump Bonus" )
r14883r14884
942940
943941   PORT_START("IN4")
944942   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
945   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
943   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
946944
947945   PORT_START("DSW1")
948946   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
r14883r14884
11421140
11431141   PORT_START("IN4")
11441142   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
1145   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
1143   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
11461144
11471145   PORT_START("DSW1")
11481146   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
r14883r14884
12251223   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_8WAY PORT_COCKTAIL
12261224   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_8WAY PORT_COCKTAIL
12271225   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_8WAY PORT_COCKTAIL
1228   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
1226   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
12291227
12301228   PORT_START("DSW1")
12311229   PORT_DIPNAME( 0x03, 0x03, "Bonus Life?" )
r14883r14884
13081306
13091307   PORT_START("IN4")
13101308   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
1311   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
1309   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
13121310
13131311   PORT_START("DSW1")
13141312   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
r14883r14884
13971395
13981396   PORT_START("IN4")
13991397   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
1400   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
1398   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
14011399
14021400   PORT_START("DSW1")      /* d50a */
14031401   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
r14883r14884
14641462
14651463   PORT_START("IN4")
14661464   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
1467   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
1465   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
14681466
14691467   PORT_START("DSW1")
14701468   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
r14883r14884
15321530
15331531   PORT_START("IN4")
15341532   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
1535   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(input_port_4_f0_r, NULL)   // from sound CPU
1533   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,input_port_4_f0_r, NULL)   // from sound CPU
15361534
15371535   PORT_START("DSW1")
15381536   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
r14883r14884
16091607   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
16101608
16111609   PORT_START("IN3")      /* Service */
1612   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(kikstart_gear_r, (void *)0)
1610   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,kikstart_gear_r, (void *)0)
16131611   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
16141612   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* needs to be 0, otherwise cannot shift */
16151613   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SERVICE1 )
r14883r14884
16181616   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
16191617
16201618   PORT_START("IN4")
1621   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(kikstart_gear_r, (void *)1)
1619   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitosj_state,kikstart_gear_r, (void *)1)
16221620   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
16231621   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* needs to be 0, otherwise cannot shift */
16241622   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/snk6502.c
r14883r14884
319319 *
320320 *************************************/
321321
322static CUSTOM_INPUT( snk6502_music0_r )
322CUSTOM_INPUT_MEMBER(snk6502_state::snk6502_music0_r)
323323{
324   return (snk6502_music0_playing(field.machine()) ? 0x01 : 0x00);
324   return (snk6502_music0_playing(machine()) ? 0x01 : 0x00);
325325}
326326
327static CUSTOM_INPUT( sasuke_count_r )
327CUSTOM_INPUT_MEMBER(snk6502_state::sasuke_count_r)
328328{
329   snk6502_state *state = field.machine().driver_data<snk6502_state>();
330329
331   return (state->m_sasuke_counter >> 4);
330   return (m_sasuke_counter >> 4);
332331}
333332
334333
r14883r14884
518517   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
519518   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
520519   PORT_BIT( 0x7c, IP_ACTIVE_HIGH, IPT_UNKNOWN )
521   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk6502_music0_r, NULL)     /* music0 playing */
520   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk6502_state,snk6502_music0_r, NULL)     /* music0 playing */
522521
523522   PORT_START("IN2")
524523   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) PORT_CHANGED(coin_inserted, 0)
525524   PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNKNOWN )                                         /* NC */
526   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(sasuke_count_r, NULL)       /* connected to a binary counter */
525   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk6502_state,sasuke_count_r, NULL)       /* connected to a binary counter */
527526
528527   PORT_START("DSW")
529528   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:!1")
r14883r14884
583582   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL  /* fire left */
584583
585584   PORT_MODIFY("IN2")
586   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snk6502_music0_r, NULL)     /* music0 playing */
585   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk6502_state,snk6502_music0_r, NULL)     /* music0 playing */
587586INPUT_PORTS_END
588587
589588static INPUT_PORTS_START( fantasy )
src/mame/drivers/exidy440.c
r14883r14884
267267 *
268268 *************************************/
269269
270static CUSTOM_INPUT( firq_beam_r )
270CUSTOM_INPUT_MEMBER(exidy440_state::firq_beam_r)
271271{
272   exidy440_state *state = field.machine().driver_data<exidy440_state>();
273   return state->m_firq_beam;
272   return m_firq_beam;
274273}
275274
276275
277static CUSTOM_INPUT( firq_vblank_r )
276CUSTOM_INPUT_MEMBER(exidy440_state::firq_vblank_r)
278277{
279   exidy440_state *state = field.machine().driver_data<exidy440_state>();
280   return state->m_firq_vblank;
278   return m_firq_vblank;
281279}
282280
283281
284static CUSTOM_INPUT( hitnmiss_button1_r )
282CUSTOM_INPUT_MEMBER(exidy440_state::hitnmiss_button1_r)
285283{
286284   /* button 1 shows up in two bits */
287   UINT32 button1 = input_port_read(field.machine(), "HITNMISS_BUTTON1");
285   UINT32 button1 = input_port_read(machine(), "HITNMISS_BUTTON1");
288286   return (button1 << 1) | button1;
289287}
290288
r14883r14884
532530   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
533531   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
534532   PORT_DIPSETTING(    0x10, DEF_STR( Hardest ) )
535   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, NULL)
536   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
533   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_beam_r, NULL)
534   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
537535
538536   PORT_START("IN1")      /* audio board dips */
539537   COINAGE
r14883r14884
573571   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
574572   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
575573   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
576   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, NULL)
577   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
574   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_beam_r, NULL)
575   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
578576
579577   PORT_START("IN1")      /* audio board dips */
580578   COINAGE
r14883r14884
614612   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
615613   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
616614   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
617   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, NULL)
618   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
615   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_beam_r, NULL)
616   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
619617
620618   PORT_START("IN1")      /* audio board dips */
621619   COINAGE
r14883r14884
655653   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
656654   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
657655   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
658   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, NULL)
659   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
656   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_beam_r, NULL)
657   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
660658
661659   PORT_START("IN1")      /* audio board dips */
662660   COINAGE
r14883r14884
698696   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
699697   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
700698   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
701   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, NULL)
702   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
699   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_beam_r, NULL)
700   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
703701
704702   PORT_START("IN1")      /* audio board dips */
705703   COINAGE
r14883r14884
736734   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
737735   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
738736   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
739   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, NULL)
740   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
737   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_beam_r, NULL)
738   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
741739
742740   PORT_START("IN1")      /* audio board dips */
743741   COINAGE
r14883r14884
778776   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
779777   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
780778   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
781   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, NULL)
782   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
779   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_beam_r, NULL)
780   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
783781
784782   PORT_START("IN1")      /* audio board dips */
785783   COINAGE
r14883r14884
817815   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
818816   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
819817   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
820   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, NULL)
821   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
818   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_beam_r, NULL)
819   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
822820
823821   PORT_START("IN1")      /* audio board dips */
824822   COINAGE
r14883r14884
854852
855853static INPUT_PORTS_START( hitnmiss )
856854   PORT_START("IN0")      /* player inputs and logic board dips */
857   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(hitnmiss_button1_r, NULL)
855   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,hitnmiss_button1_r, NULL)
858856   PORT_DIPNAME( 0x0c, 0x00, "Seconds" )
859857   PORT_DIPSETTING(    0x04, "20" )
860858   PORT_DIPSETTING(    0x00, "30" )
r14883r14884
865863   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
866864   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
867865   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
868   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, NULL)
869   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
866   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_beam_r, NULL)
867   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
870868
871869   PORT_START("IN1")      /* audio board dips */
872870   COINAGE
r14883r14884
898896
899897static INPUT_PORTS_START( whodunit )
900898   PORT_START("IN0")      /* player inputs and logic board dips */
901   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
899   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
902900   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
903901   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
904902   PORT_DIPSETTING(    0x04, "2" )
r14883r14884
910908   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
911909   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
912910   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
913   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, NULL)
914   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
911   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_beam_r, NULL)
912   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
915913
916914   PORT_START("IN1")      /* audio board dips */
917915   COINAGE
r14883r14884
949947   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
950948   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
951949   PORT_DIPSETTING(    0x20, DEF_STR( Hardest ) )
952   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_beam_r, NULL)
953   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(firq_vblank_r, NULL)
950   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_beam_r, NULL)
951   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy440_state,firq_vblank_r, NULL)
954952
955953   PORT_START("IN1")      /* audio board dips */
956954   COINAGE
src/mame/drivers/r2dtank.c
r14883r14884
6565   DECLARE_WRITE8_MEMBER(audio_command_w);
6666   DECLARE_READ8_MEMBER(audio_answer_r);
6767   DECLARE_WRITE8_MEMBER(audio_answer_w);
68   DECLARE_CUSTOM_INPUT_MEMBER(get_ttl74123_output);
6869};
6970
7071
r14883r14884
230231}
231232
232233
233static CUSTOM_INPUT( get_ttl74123_output )
234CUSTOM_INPUT_MEMBER(r2dtank_state::get_ttl74123_output)
234235{
235   r2dtank_state *state = field.machine().driver_data<r2dtank_state>();
236   return state->m_ttl74123_output;
236   return m_ttl74123_output;
237237}
238238
239239
r14883r14884
453453   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
454454   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
455455   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
456   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_ttl74123_output, NULL)
456   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, r2dtank_state,get_ttl74123_output, NULL)
457457
458458   PORT_START("IN1")
459459   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
src/mame/drivers/fantland.c
r14883r14884
718718                           Wheels Runner
719719***************************************************************************/
720720
721static CUSTOM_INPUT( wheelrun_wheel_r )
721CUSTOM_INPUT_MEMBER(fantland_state::wheelrun_wheel_r)
722722{
723723   int player = (FPTR)param;
724   int delta = input_port_read(field.machine(), player ? "WHEEL1" : "WHEEL0");
724   int delta = input_port_read(machine(), player ? "WHEEL1" : "WHEEL0");
725725   delta = (delta & 0x7f) - (delta & 0x80) + 4;
726726
727727   if      (delta > 7)   delta = 7;
r14883r14884
737737   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(1)
738738   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
739739   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
740   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(wheelrun_wheel_r, (void *)0)
740   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, fantland_state,wheelrun_wheel_r, (void *)0)
741741   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
742742
743743   PORT_START("53001")      /* 53001 */
r14883r14884
745745   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(2)
746746   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
747747   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_UNKNOWN )
748   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(wheelrun_wheel_r, (void *)1)
748   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, fantland_state,wheelrun_wheel_r, (void *)1)
749749   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
750750
751751   PORT_START("53002")      /* 53002 */
src/mame/drivers/galaxi.c
r14883r14884
7979   DECLARE_WRITE16_MEMBER(galaxi_500000_w);
8080   DECLARE_WRITE16_MEMBER(galaxi_500002_w);
8181   DECLARE_WRITE16_MEMBER(galaxi_500004_w);
82   DECLARE_CUSTOM_INPUT_MEMBER(ticket_r);
83   DECLARE_CUSTOM_INPUT_MEMBER(hopper_r);
8284};
8385
8486
r14883r14884
259261   show_out(machine());
260262}
261263
262static CUSTOM_INPUT( ticket_r )
264CUSTOM_INPUT_MEMBER(galaxi_state::ticket_r)
263265{
264   galaxi_state *state = field.machine().driver_data<galaxi_state>();
265   return state->m_ticket && !(field.machine().primary_screen->frame_number() % 10);
266   return m_ticket && !(machine().primary_screen->frame_number() % 10);
266267}
267268
268static CUSTOM_INPUT( hopper_r )
269CUSTOM_INPUT_MEMBER(galaxi_state::hopper_r)
269270{
270   galaxi_state *state = field.machine().driver_data<galaxi_state>();
271   return state->m_hopper && !(field.machine().primary_screen->frame_number() % 10);
271   return m_hopper && !(machine().primary_screen->frame_number() % 10);
272272}
273273
274274
r14883r14884
308308   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_POKER_HOLD5 )
309309   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_START1 )
310310   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT )
311   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM( hopper_r, (void *)0 )   // hopper sensor
311   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxi_state,hopper_r, (void *)0 )   // hopper sensor
312312   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(5)   // coin a
313313   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(5)   // coin b (token)
314314   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_COIN3 )   // pin 25LC
315   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( ticket_r, (void *)0 )   // ticket sensor
315   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxi_state,ticket_r, (void *)0 )   // ticket sensor
316316   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_SPECIAL )   // hopper out (pin 14LS)
317317   PORT_SERVICE_NO_TOGGLE( 0x2000, IP_ACTIVE_HIGH )   // test
318318   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_SPECIAL )   // (pin 26LC)
r14883r14884
328328   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_POKER_HOLD5 )
329329   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_START1 )
330330   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT )
331   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( hopper_r, (void *)0 )   // hopper sensor
331   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL )PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxi_state,hopper_r, (void *)0 )   // hopper sensor
332332   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(5)   // coin a
333333   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(5)   // coin b (token)
334334   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Hopper Refill") PORT_CODE(KEYCODE_H)
335   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( ticket_r, (void *)0 )   // ticket sensor
335   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxi_state,ticket_r, (void *)0 )   // ticket sensor
336336   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_SPECIAL )   // hopper out (pin 14LS)
337337   PORT_SERVICE_NO_TOGGLE( 0x2000, IP_ACTIVE_HIGH )   // test
338338   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_GAMBLE_KEYOUT )   // (pin 26LC)
src/mame/drivers/cd32.c
r14883r14884
229229   return potgor;
230230}
231231
232static CUSTOM_INPUT(cubo_input)
232CUSTOM_INPUT_MEMBER(cd32_state::cubo_input)
233233{
234   cd32_state *state = field.machine().driver_data<cd32_state>();
235   return handle_joystick_potgor(field.machine(), state->m_potgo_value) >> 10;
234   return handle_joystick_potgor(machine(), m_potgo_value) >> 10;
236235}
237236
238237static INPUT_PORTS_START( cd32 )
r14883r14884
243242   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
244243
245244   PORT_START("JOY0DAT")
246   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P2JOY")
245   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state,amiga_joystick_convert, "P2JOY")
247246   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED )
248247
249248   PORT_START("JOY1DAT")
250   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P1JOY")
249   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state,amiga_joystick_convert, "P1JOY")
251250   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED )
252251
253252   PORT_START("POTGO")
254   PORT_BIT( 0x4400, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(cubo_input, 0)
253   PORT_BIT( 0x4400, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cd32_state,cubo_input, 0)
255254   PORT_BIT( 0xbbff, IP_ACTIVE_HIGH, IPT_UNUSED )
256255
257256   PORT_START("P1JOY")
src/mame/drivers/micro3d.c
r14883r14884
132132   PORT_INCLUDE( micro3d )
133133
134134   PORT_MODIFY("INPUTS_A_B")
135   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(botssa_hwchk_r, NULL)
135   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, micro3d_state,botssa_hwchk_r, NULL)
136136   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
137137   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 )   PORT_NAME("Shield")
138138   PORT_SERVICE( 0x0400, IP_ACTIVE_LOW )
src/mame/drivers/ultratnk.c
r14883r14884
1818
1919
2020
21static CUSTOM_INPUT( get_collision )
21CUSTOM_INPUT_MEMBER(ultratnk_state::get_collision)
2222{
23   ultratnk_state *state = field.machine().driver_data<ultratnk_state>();
24   return state->m_collision[(FPTR) param];
23   return m_collision[(FPTR) param];
2524}
2625
2726
28static CUSTOM_INPUT( get_joystick )
27CUSTOM_INPUT_MEMBER(ultratnk_state::get_joystick)
2928{
30   ultratnk_state *state = field.machine().driver_data<ultratnk_state>();
31   UINT8 joy = input_port_read(field.machine(), (const char *)param) & 3;
29   UINT8 joy = input_port_read(machine(), (const char *)param) & 3;
3230
3331   if (joy == 1)
3432   {
35      return (state->m_da_latch < 8) ? 1 : 0;
33      return (m_da_latch < 8) ? 1 : 0;
3634   }
3735   if (joy == 2)
3836   {
r14883r14884
190188
191189   PORT_START("COLLISION")
192190   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
193   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)0 )
191   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultratnk_state, get_collision, (void *)0 )
194192   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
195   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)1 )
193   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultratnk_state, get_collision, (void *)1 )
196194   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) /* VCC */
197   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)2 )
195   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultratnk_state, get_collision, (void *)2 )
198196   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT )   /* SLAM */
199   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)3 )
197   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultratnk_state, get_collision, (void *)3 )
200198
201199   PORT_START("COIN")
202200   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
229227
230228   PORT_START("ANALOG")
231229   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_START1 )
232   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_joystick, "JOY-W" )
230   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultratnk_state, get_joystick, "JOY-W" )
233231   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_START2 )
234   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_joystick, "JOY-Y" )
232   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultratnk_state, get_joystick, "JOY-Y" )
235233   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(1)
236   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_joystick, "JOY-X" )
234   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultratnk_state, get_joystick, "JOY-X" )
237235   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(2)
238   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_joystick, "JOY-Z" )
236   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultratnk_state, get_joystick, "JOY-Z" )
239237
240238   PORT_START("JOY-W")
241239   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_PLAYER(1)
src/mame/drivers/phoenix.c
r14883r14884
7979   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
8080   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
8181   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
82   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(player_input_r, NULL)
82   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, phoenix_state,player_input_r, NULL)
8383
8484   PORT_START("DSW0")
8585   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )            PORT_DIPLOCATION( "SW1:1,2" )
r14883r14884
162162   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
163163   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START2 )
164164   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 )
165   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(player_input_r, NULL)
165   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, phoenix_state,player_input_r, NULL)
166166
167167   PORT_START("DSW0")
168168   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )            PORT_DIPLOCATION( "SW1:1,2" )
r14883r14884
292292   PORT_INCLUDE( phoenix )
293293
294294   PORT_MODIFY("IN0")
295   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(pleiads_protection_r, NULL)     /* Protection. See 0x0552 */
295   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, phoenix_state,pleiads_protection_r, NULL)     /* Protection. See 0x0552 */
296296
297297   PORT_MODIFY("DSW0")
298298   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) )      PORT_DIPLOCATION( "SW1:7" )
r14883r14884
315315   PORT_INCLUDE( phoenix )
316316
317317   PORT_MODIFY("IN0")
318   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(pleiads_protection_r, NULL)     /* Protection. See 0x0552 */
318   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, phoenix_state,pleiads_protection_r, NULL)     /* Protection. See 0x0552 */
319319
320320   PORT_MODIFY("DSW0")
321321   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) )      PORT_DIPLOCATION( "SW1:7" )
src/mame/drivers/neodrvr.c
r14883r14884
90059005   PORT_DIPNAME( 0x0080, 0x0080, "Freeze" ) PORT_DIPLOCATION("SW:8")
90069006   PORT_DIPSETTING(     0x0080, DEF_STR( Off ) )
90079007   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
9008   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mahjong_controller_r, NULL)
9008   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,mahjong_controller_r, NULL)
90099009
90109010   STANDARD_IN1
90119011
r14883r14884
90649064static INPUT_PORTS_START( irrmaze )
90659065   PORT_START("IN0")
90669066   STANDARD_DIPS
9067   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(multiplexed_controller_r, (void *)0)
9067   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,multiplexed_controller_r, (void *)0)
90689068
90699069   PORT_START("IN1")
90709070   PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
90799079   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED )
90809080   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START2 )
90819081   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED )
9082   PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_memcard_status, NULL)
9082   PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,get_memcard_status, NULL)
90839083   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
90849084
90859085   STANDARD_IN3
r14883r14884
91069106static INPUT_PORTS_START( popbounc )
91079107   PORT_START("IN0")
91089108   STANDARD_DIPS
9109   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(multiplexed_controller_r, (void *)0)
9109   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,multiplexed_controller_r, (void *)0)
91109110
91119111   PORT_START("IN1")
91129112   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
9113   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(multiplexed_controller_r, (void *)1)
9113   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,multiplexed_controller_r, (void *)1)
91149114
91159115   STANDARD_IN2
91169116
r14883r14884
91669166   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* this bit is used.. */
91679167   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED )
91689168   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* this bit is used.. */
9169   PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_memcard_status, NULL)
9169   PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,get_memcard_status, NULL)
91709170   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
91719171
91729172   PORT_START("IN3")
91739173   PORT_BIT( 0x003f, IP_ACTIVE_LOW, IPT_UNUSED )
9174   PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_calendar_status, NULL)
9175   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_audio_result, NULL)
9174   PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,get_calendar_status, NULL)
9175   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,get_audio_result, NULL)
91769176
91779177   STANDARD_IN4
91789178
r14883r14884
92059205   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Next Game") PORT_CODE(KEYCODE_7)
92069206   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* game freezes with this bit enabled */
92079207   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Previous Game") PORT_CODE(KEYCODE_8)
9208   PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_memcard_status, NULL)
9208   PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,get_memcard_status, NULL)
92099209   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
92109210
92119211   STANDARD_IN3
src/mame/drivers/eolithsp.c
r14883r14884
9898   }
9999}
100100
101CUSTOM_INPUT( eolith_speedup_getvblank )
101CUSTOM_INPUT_MEMBER(eolith_state::eolith_speedup_getvblank)
102102{
103103
104//  printf("%s:eolith speedup_read data %02x\n",field.machine().describe_context(), eolith_vblank);
104//  printf("%s:eolith speedup_read data %02x\n",machine().describe_context(), eolith_vblank);
105105
106106
107   return (field.machine().primary_screen->vpos() >= 240);
107   return (machine().primary_screen->vpos() >= 240);
108108}
109109
110110// StealSee doesn't use interrupts, just the vblank
111CUSTOM_INPUT( stealsee_speedup_getvblank )
111CUSTOM_INPUT_MEMBER(eolith_state::stealsee_speedup_getvblank)
112112{
113   eolith_state *state = field.machine().driver_data<eolith_state>();
113   int pc = cpu_get_pc(m_maincpu);
114114
115   int pc = cpu_get_pc(state->m_maincpu);
116
117115   if (pc==0x400081ec)
118116      if(!eolith_vblank)
119         device_eat_cycles(state->m_maincpu, 500);
117         device_eat_cycles(m_maincpu, 500);
120118
121   return (field.machine().primary_screen->vpos() >= 240);
119   return (machine().primary_screen->vpos() >= 240);
122120}
src/mame/drivers/neogeo.c
r14883r14884
377377}
378378
379379
380static CUSTOM_INPUT( multiplexed_controller_r )
380CUSTOM_INPUT_MEMBER(neogeo_state::multiplexed_controller_r)
381381{
382   neogeo_state *state = field.machine().driver_data<neogeo_state>();
383382   int port = (FPTR)param;
384383
385384   static const char *const cntrl[2][2] =
r14883r14884
387386         { "IN0-0", "IN0-1" }, { "IN1-0", "IN1-1" }
388387      };
389388
390   return input_port_read_safe(field.machine(), cntrl[port][state->m_controller_select & 0x01], 0x00);
389   return input_port_read_safe(machine(), cntrl[port][m_controller_select & 0x01], 0x00);
391390}
392391
393392#if 1 // this needs to be added dynamically somehow
394static CUSTOM_INPUT( mahjong_controller_r )
393CUSTOM_INPUT_MEMBER(neogeo_state::mahjong_controller_r)
395394{
396   neogeo_state *state = field.machine().driver_data<neogeo_state>();
397395   UINT32 ret;
398396
399397/*
r14883r14884
403401cpu #0 (PC=00C18D6C): unmapped memory word write to 00380000 = 0009 & 00FF
404402cpu #0 (PC=00C18C40): unmapped memory word write to 00380000 = 0000 & 00FF
405403*/
406   switch (state->m_controller_select)
404   switch (m_controller_select)
407405   {
408406   default:
409407   case 0x00: ret = 0x0000; break; /* nothing? */
410   case 0x09: ret = input_port_read(field.machine(), "MAHJONG1"); break;
411   case 0x12: ret = input_port_read(field.machine(), "MAHJONG2"); break;
412   case 0x1b: ret = input_port_read(field.machine(), "MAHJONG3"); break; /* player 1 normal inputs? */
413   case 0x24: ret = input_port_read(field.machine(), "MAHJONG4"); break;
408   case 0x09: ret = input_port_read(machine(), "MAHJONG1"); break;
409   case 0x12: ret = input_port_read(machine(), "MAHJONG2"); break;
410   case 0x1b: ret = input_port_read(machine(), "MAHJONG3"); break; /* player 1 normal inputs? */
411   case 0x24: ret = input_port_read(machine(), "MAHJONG4"); break;
414412   }
415413
416414   return ret;
r14883r14884
472470 *
473471 *************************************/
474472
475static CUSTOM_INPUT( get_calendar_status )
473CUSTOM_INPUT_MEMBER(neogeo_state::get_calendar_status)
476474{
477   neogeo_state *state = field.machine().driver_data<neogeo_state>();
478   return (upd4990a_databit_r(state->m_upd4990a, 0) << 1) | upd4990a_testbit_r(state->m_upd4990a, 0);
475   return (upd4990a_databit_r(m_upd4990a, 0) << 1) | upd4990a_testbit_r(m_upd4990a, 0);
479476}
480477
481478
r14883r14884
511508#define MEMCARD_SIZE   0x0800
512509
513510
514static CUSTOM_INPUT( get_memcard_status )
511CUSTOM_INPUT_MEMBER(neogeo_state::get_memcard_status)
515512{
516513   /* D0 and D1 are memcard presence indicators, D2 indicates memcard
517514       write protect status (we are always write enabled) */
518   return (memcard_present(field.machine()) == -1) ? 0x07 : 0x00;
515   return (memcard_present(machine()) == -1) ? 0x07 : 0x00;
519516}
520517
521518
r14883r14884
608605}
609606
610607
611static CUSTOM_INPUT( get_audio_result )
608CUSTOM_INPUT_MEMBER(neogeo_state::get_audio_result)
612609{
613   neogeo_state *state = field.machine().driver_data<neogeo_state>();
614   UINT32 ret = state->m_audio_result;
610   UINT32 ret = m_audio_result;
615611
616//  if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(field.machine().device("maincpu")), ret);
612//  if (LOG_CPU_COMM) logerror("MAIN CPU PC %06x: audio_result_r %02x\n", cpu_get_pc(machine().device("maincpu")), ret);
617613
618614   return ret;
619615}
r14883r14884
12271223   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Next Game") PORT_CODE(KEYCODE_7)      \
12281224   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START2 )                                       \
12291225   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Previous Game") PORT_CODE(KEYCODE_8)   \
1230   PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_memcard_status, NULL)         \
1226   PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,get_memcard_status, NULL)         \
12311227   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* In AES 'mode' nitd, kof2000, sengoku3, matrim and mslug5 check if this is ACTIVE_HIGH */
12321228
12331229
r14883r14884
12391235   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* having this ACTIVE_HIGH causes you to start with 2 credits using USA bios roms; if ACTIVE_HIGH + IN4 bit 6 ACTIVE_HIGH = AES 'mode' */   \
12401236   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* having this ACTIVE_HIGH causes you to start with 2 credits using USA bios roms; if ACTIVE_HIGH + IN4 bit 6 ACTIVE_HIGH = AES 'mode' */   \
12411237   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SPECIAL ) /* what is this? When ACTIVE_HIGH + IN4 bit 6 ACTIVE_LOW MVS-4 slot is detected */   \
1242   PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_calendar_status, NULL)         \
1243   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_audio_result, NULL)
1238   PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,get_calendar_status, NULL)         \
1239   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state,get_audio_result, NULL)
12441240
12451241
12461242#define STANDARD_IN4                                                         \
src/mame/drivers/statriv2.c
r14883r14884
9494   DECLARE_READ8_MEMBER(question_data_r);
9595   DECLARE_READ8_MEMBER(laserdisc_io_r);
9696   DECLARE_WRITE8_MEMBER(laserdisc_io_w);
97   DECLARE_CUSTOM_INPUT_MEMBER(latched_coin_r);
9798};
9899
99100
r14883r14884
244245 *
245246 *************************************/
246247
247static CUSTOM_INPUT( latched_coin_r )
248CUSTOM_INPUT_MEMBER(statriv2_state::latched_coin_r)
248249{
249   statriv2_state *state = field.machine().driver_data<statriv2_state>();
250   return state->m_latched_coin;
250   return m_latched_coin;
251251}
252252
253253
r14883r14884
337337   PORT_START("IN1")
338338   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
339339   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
340   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(latched_coin_r, "COIN")
340   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, statriv2_state,latched_coin_r, "COIN")
341341   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
342342   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coinage ) )
343343   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
r14883r14884
370370   PORT_START("IN1")
371371   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Stand")         PORT_CODE(KEYCODE_4)
372372   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Select Game")   PORT_CODE(KEYCODE_S)
373   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(latched_coin_r, "COIN")
373   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, statriv2_state,latched_coin_r, "COIN")
374374   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
375375   PORT_DIPNAME( 0x10, 0x10, "DIP switch? 10" )
376376   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
r14883r14884
445445   PORT_START("IN1")
446446   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Play 1000")
447447   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
448   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(latched_coin_r, "COIN")
448   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, statriv2_state,latched_coin_r, "COIN")
449449   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
450450   PORT_SERVICE( 0x10, IP_ACTIVE_HIGH )
451451   PORT_DIPNAME( 0x20, 0x20, "Show Correct Answer" )
src/mame/drivers/ladybug.c
r14883r14884
203203#define LADYBUG_P1_CONTROL_PORT_TAG   ("CONTP1")
204204#define LADYBUG_P2_CONTROL_PORT_TAG   ("CONTP2")
205205
206static CUSTOM_INPUT( ladybug_p1_control_r )
206CUSTOM_INPUT_MEMBER(ladybug_state::ladybug_p1_control_r)
207207{
208   return input_port_read(field.machine(), LADYBUG_P1_CONTROL_PORT_TAG);
208   return input_port_read(machine(), LADYBUG_P1_CONTROL_PORT_TAG);
209209}
210210
211static CUSTOM_INPUT( ladybug_p2_control_r )
211CUSTOM_INPUT_MEMBER(ladybug_state::ladybug_p2_control_r)
212212{
213213   UINT32 ret;
214214
215215   /* upright cabinet only uses a single set of controls */
216   if (input_port_read(field.machine(), "DSW0") & 0x20)
217      ret = input_port_read(field.machine(), LADYBUG_P2_CONTROL_PORT_TAG);
216   if (input_port_read(machine(), "DSW0") & 0x20)
217      ret = input_port_read(machine(), LADYBUG_P2_CONTROL_PORT_TAG);
218218   else
219      ret = input_port_read(field.machine(), LADYBUG_P1_CONTROL_PORT_TAG);
219      ret = input_port_read(machine(), LADYBUG_P1_CONTROL_PORT_TAG);
220220
221221   return ret;
222222}
r14883r14884
224224
225225static INPUT_PORTS_START( ladybug )
226226   PORT_START("IN0")
227   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ladybug_p1_control_r, NULL)
227   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ladybug_state,ladybug_p1_control_r, NULL)
228228   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
229229   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
230230   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_TILT )
231231
232232   PORT_START("IN1")
233   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ladybug_p2_control_r, NULL)
233   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ladybug_state,ladybug_p2_control_r, NULL)
234234   /* This should be connected to the 4V clock. I don't think the game uses it. */
235235   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
236236   /* Note that there are TWO VBlank inputs, one is active low, the other active */
src/mame/drivers/starshp1.c
r14883r14884
6464}
6565
6666
67static CUSTOM_INPUT( starshp1_analog_r )
67CUSTOM_INPUT_MEMBER(starshp1_state::starshp1_analog_r)
6868{
69   starshp1_state *state = field.machine().driver_data<starshp1_state>();
7069   int val = 0;
7170
72   switch (state->m_analog_in_select)
71   switch (m_analog_in_select)
7372   {
7473   case 0:
75      val = input_port_read(field.machine(), "STICKY");
74      val = input_port_read(machine(), "STICKY");
7675      break;
7776   case 1:
78      val = input_port_read(field.machine(), "STICKX");
77      val = input_port_read(machine(), "STICKX");
7978      break;
8079   case 2:
8180      val = 0x20; /* DAC feedback, not used */
8281      break;
8382   case 3:
84      val = input_port_read(field.machine(), "PLAYTIME");
83      val = input_port_read(machine(), "PLAYTIME");
8584      break;
8685   }
8786
r14883r14884
8988}
9089
9190
92static CUSTOM_INPUT( collision_latch_r )
91CUSTOM_INPUT_MEMBER(starshp1_state::collision_latch_r)
9392{
94   starshp1_state *state = field.machine().driver_data<starshp1_state>();
95   return state->m_collision_latch & 0x0f;
93   return m_collision_latch & 0x0f;
9694}
9795
9896
r14883r14884
202200   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
203201
204202   PORT_START("VBLANK")
205   PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(starshp1_analog_r, NULL)   /* analog in */
203   PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, starshp1_state,starshp1_analog_r, NULL)   /* analog in */
206204   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
207205   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
208206
209207   PORT_START("COINAGE")
210   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(collision_latch_r, NULL)   /* collision latch */
208   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, starshp1_state,collision_latch_r, NULL)   /* collision latch */
211209   PORT_DIPNAME( 0x70, 0x20, DEF_STR( Coinage ) )
212210   PORT_DIPSETTING(   0x10, DEF_STR( 2C_1C ) )
213211   PORT_DIPSETTING(   0x20, DEF_STR( 1C_1C ) )
src/mame/drivers/gottlieb.c
r14883r14884
290290 *
291291 *************************************/
292292
293static CUSTOM_INPUT( analog_delta_r )
293CUSTOM_INPUT_MEMBER(gottlieb_state::analog_delta_r)
294294{
295   gottlieb_state *state = field.machine().driver_data<gottlieb_state>();
296295   const char *string = (const char *)param;
297296   int which = string[0] - '0';
298297
299   return input_port_read(field.machine(), &string[1]) - state->m_track[which];
298   return input_port_read(machine(), &string[1]) - m_track[which];
300299}
301300
302301
r14883r14884
308307}
309308
310309
311static CUSTOM_INPUT( stooges_joystick_r )
310CUSTOM_INPUT_MEMBER(gottlieb_state::stooges_joystick_r)
312311{
313   gottlieb_state *state = field.machine().driver_data<gottlieb_state>();
314312   static const char *const joyport[] = { "P2JOY", "P3JOY", "P1JOY", NULL };
315   return (joyport[state->m_joystick_select & 3] != NULL) ? input_port_read(field.machine(), joyport[state->m_joystick_select & 3]) : 0xff;
313   return (joyport[m_joystick_select & 3] != NULL) ? input_port_read(machine(), joyport[m_joystick_select & 3]) : 0xff;
316314}
317315
318316
r14883r14884
778776   PORT_BIT ( 0xfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )
779777
780778   PORT_START("IN2")   /* trackball H */
781   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM(analog_delta_r, "0TRACKX")
779   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, gottlieb_state,analog_delta_r, "0TRACKX")
782780
783781   PORT_START("IN3")   /* trackball V */
784   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM(analog_delta_r, "1TRACKY")
782   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, gottlieb_state,analog_delta_r, "1TRACKY")
785783
786784   PORT_START("IN4")
787785   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
r14883r14884
989987   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
990988
991989   PORT_START("IN2")   /* trackball H */
992   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM(analog_delta_r, "0TRACKX")
990   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, gottlieb_state,analog_delta_r, "0TRACKX")
993991
994992   PORT_START("IN3")   /* trackball V */
995   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM(analog_delta_r, "1TRACKY")
993   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, gottlieb_state,analog_delta_r, "1TRACKY")
996994
997995/* NOTE: Buttons are shared for both players; are mirrored to each side of the controller */
998996   PORT_START("IN4")
r14883r14884
10461044   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
10471045
10481046   PORT_START("IN3")   /* trackball V (dial) */
1049   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM(analog_delta_r, "1TRACKY")
1047   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, gottlieb_state,analog_delta_r, "1TRACKY")
10501048
10511049   PORT_START("IN4")
10521050   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
r14883r14884
15251523   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
15261524
15271525   PORT_START("IN4")   /* joystick inputs */
1528   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stooges_joystick_r, NULL)
1526   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, gottlieb_state,stooges_joystick_r, NULL)
15291527   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
15301528   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
15311529   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3)
r14883r14884
16371635   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
16381636
16391637   PORT_START("IN3")   /* trackball V is a dial input */
1640   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM(analog_delta_r, "1TRACKY")
1638   PORT_BIT( 0xff, 0, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, gottlieb_state,analog_delta_r, "1TRACKY")
16411639
16421640   PORT_START("IN4")   /* ? */
16431641   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
src/mame/drivers/ddragon.c
r14883r14884
355355 *
356356 *************************************/
357357
358static CUSTOM_INPUT( sub_cpu_busy )
358CUSTOM_INPUT_MEMBER(ddragon_state::sub_cpu_busy)
359359{
360   ddragon_state *state = field.machine().driver_data<ddragon_state>();
361   return state->m_dd_sub_cpu_busy;
360   return m_dd_sub_cpu_busy;
362361}
363362
364363
r14883r14884
707706   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 )
708707   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
709708   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_VBLANK )
710   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(sub_cpu_busy, NULL)
709   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ddragon_state,sub_cpu_busy, NULL)
711710   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
712711   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
713712   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/xxmissio.c
r14883r14884
1919   memory_set_bank(machine(), "bank1", data & 7);
2020}
2121
22static CUSTOM_INPUT( xxmissio_status_r )
22CUSTOM_INPUT_MEMBER(xxmissio_state::xxmissio_status_r)
2323{
24   xxmissio_state *state = field.machine().driver_data<xxmissio_state>();
2524   int bit_mask = (FPTR)param;
26   return (state->m_status & bit_mask) ? 1 : 0;
25   return (m_status & bit_mask) ? 1 : 0;
2726}
2827
2928WRITE8_MEMBER(xxmissio_state::xxmissio_status_m_w)
r14883r14884
199198   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:8" ) /* Shown as "Unused" in the manual */
200199
201200   PORT_START("STATUS")
202   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(xxmissio_status_r, (void *)0x01)
201   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x01)
203202   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
204   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(xxmissio_status_r, (void *)0x04)
205   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(xxmissio_status_r, (void *)0x08)
206   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(xxmissio_status_r, (void *)0x10)
207   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(xxmissio_status_r, (void *)0x20)
208   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(xxmissio_status_r, (void *)0x40)
209   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(xxmissio_status_r, (void *)0x80)
203   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x04)
204   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x08)
205   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x10)
206   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x20)
207   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x40)
208   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xxmissio_state,xxmissio_status_r, (void *)0x80)
210209INPUT_PORTS_END
211210
212211/****************************************************************************/
src/mame/drivers/ecoinfr.c
r14883r14884
8080   DECLARE_WRITE8_MEMBER(ec_port16_out_w);
8181   DECLARE_WRITE8_MEMBER(ec_port17_out_w);
8282   DECLARE_WRITE8_MEMBER(ec_port18_out_w);
83   DECLARE_CUSTOM_INPUT_MEMBER(ecoinfr_reel1_opto_r);
84   DECLARE_CUSTOM_INPUT_MEMBER(ecoinfr_reel2_opto_r);
85   DECLARE_CUSTOM_INPUT_MEMBER(ecoinfr_reel3_opto_r);
8386};
8487
8588
r14883r14884
389392   AM_RANGE(0x18, 0x18) AM_WRITE(ec_port18_out_w) // 24 (Watchdog)
390393ADDRESS_MAP_END
391394
392static CUSTOM_INPUT( ecoinfr_reel1_opto_r )
395CUSTOM_INPUT_MEMBER(ecoinfr_state::ecoinfr_reel1_opto_r)
393396{
394397   return 0;
395398}
396399
397static CUSTOM_INPUT( ecoinfr_reel2_opto_r )
400CUSTOM_INPUT_MEMBER(ecoinfr_state::ecoinfr_reel2_opto_r)
398401{
399402   return 0;
400403}
401404
402static CUSTOM_INPUT( ecoinfr_reel3_opto_r )
405CUSTOM_INPUT_MEMBER(ecoinfr_state::ecoinfr_reel3_opto_r)
403406{
404407   return 0;
405408}
r14883r14884
432435   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
433436
434437   PORT_START("IN1")
435   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ecoinfr_reel1_opto_r, NULL)
438   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ecoinfr_state,ecoinfr_reel1_opto_r, NULL)
436439   PORT_DIPNAME( 0x02, 0x02, "IN1:02" )
437440   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
438441   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
439   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ecoinfr_reel3_opto_r, NULL)
440   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ecoinfr_reel2_opto_r, NULL)
442   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ecoinfr_state,ecoinfr_reel3_opto_r, NULL)
443   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ecoinfr_state,ecoinfr_reel2_opto_r, NULL)
441444   PORT_DIPNAME( 0x10, 0x10, "IN1:10" )
442445   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
443446   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
src/mame/drivers/eolith16.c
r14883r14884
1212#include "emu.h"
1313#include "cpu/e132xs/e132xs.h"
1414#include "machine/eeprom.h"
15
1516#include "sound/okim6295.h"
17#include "includes/eolith.h"
1618#include "includes/eolithsp.h"
1719
1820
19class eolith16_state : public driver_device
21class eolith16_state : public eolith_state
2022{
2123public:
2224   eolith16_state(const machine_config &mconfig, device_type type, const char *tag)
23      : driver_device(mconfig, type, tag) { }
25      : eolith_state(mconfig, type, tag) { }
2426
2527   UINT16 *m_vram;
2628   int m_vbuffer;
r14883r14884
8991static INPUT_PORTS_START( eolith16 )
9092   PORT_START("SPECIAL")
9193   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
92   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(eolith_speedup_getvblank, NULL)
94   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, eolith16_state, eolith_speedup_getvblank, NULL)
9395   PORT_BIT( 0xff6f, IP_ACTIVE_LOW, IPT_UNUSED )
9496
9597   PORT_START("SYSTEM")
src/mame/drivers/groundfx.c
r14883r14884
124124            GAME INPUTS
125125**********************************************************/
126126
127static CUSTOM_INPUT( frame_counter_r )
127CUSTOM_INPUT_MEMBER(groundfx_state::frame_counter_r)
128128{
129   groundfx_state *state = field.machine().driver_data<groundfx_state>();
130   return state->m_frame_counter;
129   return m_frame_counter;
131130}
132131
133static CUSTOM_INPUT( coin_word_r )
132CUSTOM_INPUT_MEMBER(groundfx_state::coin_word_r)
134133{
135   groundfx_state *state = field.machine().driver_data<groundfx_state>();
136   return state->m_coin_word;
134   return m_coin_word;
137135}
138136
139137WRITE32_MEMBER(groundfx_state::groundfx_input_w)
r14883r14884
240238
241239static INPUT_PORTS_START( groundfx )
242240   PORT_START("BUTTONS")
243   PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(frame_counter_r, NULL)
241   PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, groundfx_state,frame_counter_r, NULL)
244242   PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_UNUSED )
245243   PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_UNUSED )
246244   PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
272270   PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNUSED )
273271   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNUSED )
274272   PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNUSED )
275   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_word_r, NULL)
273   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, groundfx_state,coin_word_r, NULL)
276274
277275   PORT_START("AN0")   /* IN 2, steering wheel */
278276   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_REVERSE PORT_PLAYER(1)
src/mame/drivers/m92.c
r14883r14884
287287   }
288288}
289289
290static CUSTOM_INPUT( m92_sprite_busy_r )
290CUSTOM_INPUT_MEMBER(m92_state::m92_sprite_busy_r)
291291{
292   m92_state *state = field.machine().driver_data<m92_state>();
293   return state->m_sprite_buffer_busy;
292   return m_sprite_buffer_busy;
294293}
295294
296295/*****************************************************************************/
r14883r14884
420419   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
421420   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE )
422421   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
423   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(m92_sprite_busy_r, NULL)
422   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, m92_state,m92_sprite_busy_r, NULL)
424423   /* DIP switch bank 3 */
425424   PORT_DIPUNKNOWN_DIPLOC( 0x0100, 0x0100, "SW3:1" )
426425   PORT_DIPUNKNOWN_DIPLOC( 0x0200, 0x0200, "SW3:2" )
src/mame/drivers/wwfwfest.c
r14883r14884
174174*******************************************************************************/
175175
176176/* DIPs are spread across the other input ports */
177static CUSTOM_INPUT( dsw_3f_r )
177CUSTOM_INPUT_MEMBER(wwfwfest_state::dsw_3f_r)
178178{
179179   const char *tag = (const char *)param;
180   return input_port_read(field.machine(), tag) & 0x3f;
180   return input_port_read(machine(), tag) & 0x3f;
181181}
182182
183static CUSTOM_INPUT( dsw_c0_r )
183CUSTOM_INPUT_MEMBER(wwfwfest_state::dsw_c0_r)
184184{
185185   const char *tag = (const char *)param;
186   return (input_port_read(field.machine(), tag) & 0xc0) >> 6;
186   return (input_port_read(machine(), tag) & 0xc0) >> 6;
187187}
188188
189189
r14883r14884
201201   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SERVICE1 )
202202   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
203203   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
204   PORT_BIT( 0x3000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dsw_c0_r, "DSW2")
204   PORT_BIT( 0x3000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, wwfwfest_state,dsw_c0_r, "DSW2")
205205   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
206206   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
207207
r14883r14884
214214   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
215215   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
216216   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 )
217   PORT_BIT( 0x3f00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dsw_3f_r, "DSW2")
217   PORT_BIT( 0x3f00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, wwfwfest_state,dsw_3f_r, "DSW2")
218218
219219   PORT_START("P3")
220220   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)
r14883r14884
225225   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
226226   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
227227   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START3 )
228   PORT_BIT( 0x3f00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dsw_3f_r, "DSW1")
228   PORT_BIT( 0x3f00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, wwfwfest_state,dsw_3f_r, "DSW1")
229229
230230   PORT_START("P4")
231231   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
r14883r14884
236236   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
237237   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
238238   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START4 )
239   PORT_BIT( 0x0300, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dsw_c0_r, "DSW1")
239   PORT_BIT( 0x0300, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, wwfwfest_state,dsw_c0_r, "DSW1")
240240   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_VBLANK )
241241   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
242242   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/multigam.c
r14883r14884
112112   int m_vrom4k;
113113   UINT8 m_supergm3_prg_bank;
114114   UINT8 m_supergm3_chr_bank;
115   DECLARE_CUSTOM_INPUT_MEMBER(multigam_inputs_r);
115116};
116117
117118
r14883r14884
261262   return ((state->m_in_1 >> state->m_in_1_shift++) & 0x01) | 0x40;
262263}
263264
264static CUSTOM_INPUT( multigam_inputs_r )
265CUSTOM_INPUT_MEMBER(multigam_state::multigam_inputs_r)
265266{
266   multigam_state *state = field.machine().driver_data<multigam_state>();
267267   /* bit 0: serial input (dsw)
268268       bit 1: coin */
269   return (state->m_in_dsw >> state->m_in_dsw_shift++) & 0x01;
269   return (m_in_dsw >> m_in_dsw_shift++) & 0x01;
270270}
271271
272272
r14883r14884
978978   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
979979
980980   PORT_START("IN0")
981   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(multigam_inputs_r, NULL)
981   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, multigam_state,multigam_inputs_r, NULL)
982982   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 )
983983INPUT_PORTS_END
984984
src/mame/drivers/dcheese.c
r14883r14884
117117 *
118118 *************************************/
119119
120static CUSTOM_INPUT( sound_latch_state_r )
120CUSTOM_INPUT_MEMBER(dcheese_state::sound_latch_state_r)
121121{
122   dcheese_state *state = field.machine().driver_data<dcheese_state>();
123   return state->m_soundlatch_full;
122   return m_soundlatch_full;
124123}
125124
126125
r14883r14884
273272   PORT_BIT( 0x001f, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* low 5 bits read as a unit */
274273   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
275274   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL )      /* sound->main buffer status (0=empty) */
276   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(sound_latch_state_r, NULL)
275   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dcheese_state,sound_latch_state_r, NULL)
277276   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED )
278277   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_VOLUME_DOWN )
279278   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
322321   PORT_BIT( 0x001f, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* low 5 bits read as a unit */
323322   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
324323   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL )      /* sound->main buffer status (0=empty) */
325   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(sound_latch_state_r, NULL)
324   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dcheese_state,sound_latch_state_r, NULL)
326325   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED )
327326   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_VOLUME_DOWN )
328327   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
369368   PORT_BIT( 0x001f, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* low 5 bits read as a unit */
370369   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
371370   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL )      /* sound->main buffer status (0=empty) */
372   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(sound_latch_state_r, NULL)
371   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dcheese_state,sound_latch_state_r, NULL)
373372   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED )
374373   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_VOLUME_DOWN )
375374   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED )
src/mame/drivers/cloud9.c
r14883r14884
140140}
141141
142142
143static CUSTOM_INPUT( get_vblank )
143CUSTOM_INPUT_MEMBER(cloud9_state::get_vblank)
144144{
145   cloud9_state *state = field.machine().driver_data<cloud9_state>();
146   int scanline = field.machine().primary_screen->vpos();
147   return (~state->m_syncprom[scanline & 0xff] >> 1) & 1;
145   int scanline = machine().primary_screen->vpos();
146   return (~m_syncprom[scanline & 0xff] >> 1) & 1;
148147}
149148
150149
r14883r14884
302301   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
303302   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
304303   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
305   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(get_vblank, NULL)
304   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cloud9_state,get_vblank, NULL)
306305
307306   PORT_START("IN1")
308307   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14883r14884
343342   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
344343   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
345344   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
346   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(get_vblank, NULL)
345   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cloud9_state,get_vblank, NULL)
347346
348347   PORT_START("IN1")
349348   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/rpunch.c
r14883r14884
144144 *
145145 *************************************/
146146
147static CUSTOM_INPUT( hi_bits_r )
147CUSTOM_INPUT_MEMBER(rpunch_state::hi_bits_r)
148148{
149   return input_port_read(field.machine(), "SERVICE");
149   return input_port_read(machine(), "SERVICE");
150150}
151151
152152
r14883r14884
275275   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
276276   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
277277   PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_UNUSED )
278   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(hi_bits_r, NULL)
278   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, rpunch_state,hi_bits_r, NULL)
279279
280280   PORT_START("P2")   /* c001a lower 8 bits */
281281   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r14883r14884
285285   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
286286   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
287287   PORT_BIT( 0x00c0, IP_ACTIVE_HIGH, IPT_UNUSED )
288   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(hi_bits_r, NULL)
288   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, rpunch_state,hi_bits_r, NULL)
289289
290290   PORT_START("SERVICE")   /* c0018/c001a upper 8 bits */
291291   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE1 )
src/mame/drivers/starwars.c
r14883r14884
232232   /* Bit 6 is VG_HALT */
233233   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)
234234   /* Bit 7 is MATH_RUN - see machine/starwars.c */
235   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(matrix_flag_r, NULL)
235   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, starwars_state,matrix_flag_r, NULL)
236236
237237   PORT_START("DSW0")
238238   PORT_DIPNAME( 0x03, 0x02, "Starting Shields" )  PORT_DIPLOCATION("10D:1,2")
src/mame/drivers/exerion.c
r14883r14884
130130 *************************************/
131131
132132/* Players inputs are muxed at 0xa000 */
133static CUSTOM_INPUT( exerion_controls_r )
133CUSTOM_INPUT_MEMBER(exerion_state::exerion_controls_r)
134134{
135135   static const char *const inname[2] = { "P1", "P2" };
136   exerion_state *state = field.machine().driver_data<exerion_state>();
137   return input_port_read(field.machine(), inname[state->m_cocktail_flip]) & 0x3f;
136   return input_port_read(machine(), inname[m_cocktail_flip]) & 0x3f;
138137}
139138
140139
r14883r14884
234233/* verified from Z80 code */
235234static INPUT_PORTS_START( exerion )
236235   PORT_START("IN0")
237   PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(exerion_controls_r, (void *)0)
236   PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exerion_state,exerion_controls_r, (void *)0)
238237   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
239238   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
240239
src/mame/drivers/tempest.c
r14883r14884
292292   DECLARE_WRITE8_MEMBER(wdclr_w);
293293   DECLARE_WRITE8_MEMBER(tempest_led_w);
294294   DECLARE_WRITE8_MEMBER(tempest_coin_w);
295   DECLARE_CUSTOM_INPUT_MEMBER(tempest_knob_r);
296   DECLARE_CUSTOM_INPUT_MEMBER(tempest_buttons_r);
297   DECLARE_CUSTOM_INPUT_MEMBER(clock_r);
295298};
296299
297300
r14883r14884
329332 *
330333 *************************************/
331334
332static CUSTOM_INPUT( tempest_knob_r )
335CUSTOM_INPUT_MEMBER(tempest_state::tempest_knob_r)
333336{
334   tempest_state *state = field.machine().driver_data<tempest_state>();
335   return input_port_read(field.machine(), (state->m_player_select == 0) ?
337   return input_port_read(machine(), (m_player_select == 0) ?
336338                              TEMPEST_KNOB_P1_TAG : TEMPEST_KNOB_P2_TAG);
337339}
338340
339static CUSTOM_INPUT( tempest_buttons_r )
341CUSTOM_INPUT_MEMBER(tempest_state::tempest_buttons_r)
340342{
341   tempest_state *state = field.machine().driver_data<tempest_state>();
342   return input_port_read(field.machine(), (state->m_player_select == 0) ?
343   return input_port_read(machine(), (m_player_select == 0) ?
343344                              TEMPEST_BUTTONS_P1_TAG : TEMPEST_BUTTONS_P2_TAG);
344345}
345346
346347
347static CUSTOM_INPUT( clock_r )
348CUSTOM_INPUT_MEMBER(tempest_state::clock_r)
348349{
349350   /* Emulate the 3kHz source on bit 7 (divide 1.5MHz by 512) */
350   return (field.machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
351   return (machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
351352}
352353
353354
r14883r14884
440441   /* per default (busy vector processor). */
441442   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)
442443   /* bit 7 is tied to a 3kHz (?) clock */
443   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
444   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, tempest_state,clock_r, NULL)
444445
445446   PORT_START("IN1/DSW0")
446   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(tempest_knob_r, NULL)
447   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, tempest_state,tempest_knob_r, NULL)
447448   /* The next one is reponsible for cocktail mode.
448449     * According to the documentation, this is not a switch, although
449450     * it may have been planned to put it on the Math Box PCB, D/E2 )
r14883r14884
464465   PORT_DIPNAME(  0x04, 0x04, "Rating" ) PORT_DIPLOCATION("DE2:2")
465466   PORT_DIPSETTING(     0x04, "1, 3, 5, 7, 9" )
466467   PORT_DIPSETTING(     0x00, "tied to high score" )
467   PORT_BIT(0x18, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(tempest_buttons_r, NULL)
468   PORT_BIT(0x18, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, tempest_state,tempest_buttons_r, NULL)
468469   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START1 )
469470   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_START2 )
470471   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/famibox.c
r14883r14884
9999   DECLARE_READ8_MEMBER(famibox_IN1_r);
100100   DECLARE_READ8_MEMBER(famibox_system_r);
101101   DECLARE_WRITE8_MEMBER(famibox_system_w);
102   DECLARE_CUSTOM_INPUT_MEMBER(famibox_coin_r);
102103};
103104
104105/******************************************************
r14883r14884
424425   }
425426}
426427
427static CUSTOM_INPUT( famibox_coin_r )
428CUSTOM_INPUT_MEMBER(famibox_state::famibox_coin_r)
428429{
429   famibox_state *state = field.machine().driver_data<famibox_state>();
430   return state->m_coins > 0;
430   return m_coins > 0;
431431}
432432
433433static INPUT_PORTS_START( famibox )
r14883r14884
484484   PORT_DIPSETTING(    0x08, "Key position 4" )
485485   PORT_DIPSETTING(    0x10, "Key position 5" )
486486   PORT_DIPSETTING(    0x20, "Key position 6" )
487   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(famibox_coin_r, NULL)
487   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, famibox_state,famibox_coin_r, NULL)
488488
489489   PORT_START("COIN")
490490   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
src/mame/drivers/ultrsprt.c
r14883r14884
3131   DECLARE_WRITE32_MEMBER(int_ack_w);
3232   DECLARE_READ16_MEMBER(K056800_68k_r);
3333   DECLARE_WRITE16_MEMBER(K056800_68k_w);
34   DECLARE_CUSTOM_INPUT_MEMBER(analog_ctrl_r);
3435};
3536
3637
r14883r14884
8687      input_port_write(machine(), "EEPROMOUT", data, 0xffffffff);
8788}
8889
89static CUSTOM_INPUT( analog_ctrl_r )
90CUSTOM_INPUT_MEMBER(ultrsprt_state::analog_ctrl_r)
9091{
9192   const char *tag = (const char *)param;
92   return input_port_read(field.machine(), tag) & 0xfff;
93   return input_port_read(machine(), tag) & 0xfff;
9394}
9495
9596WRITE32_MEMBER(ultrsprt_state::int_ack_w)
r14883r14884
164165
165166static INPUT_PORTS_START( ultrsprt )
166167   PORT_START("P1")
167   PORT_BIT( 0x00000fff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(analog_ctrl_r, "STICKY1")
168   PORT_BIT( 0x0fff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(analog_ctrl_r, "STICKX1")
168   PORT_BIT( 0x00000fff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultrsprt_state,analog_ctrl_r, "STICKY1")
169   PORT_BIT( 0x0fff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultrsprt_state,analog_ctrl_r, "STICKX1")
169170   PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_COIN1 )
170171   PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
171172   PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_START1 )
172173
173174   PORT_START("P2")
174   PORT_BIT( 0x00000fff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(analog_ctrl_r, "STICKY2")
175   PORT_BIT( 0x0fff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(analog_ctrl_r, "STICKX2")
175   PORT_BIT( 0x00000fff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultrsprt_state,analog_ctrl_r, "STICKY2")
176   PORT_BIT( 0x0fff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultrsprt_state,analog_ctrl_r, "STICKX2")
176177   PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_SERVICE1 )
177178   PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
178179   PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_START2 )
src/mame/drivers/midyunit.c
r14883r14884
150150 *
151151 *************************************/
152152
153static CUSTOM_INPUT( narc_talkback_strobe_r )
153CUSTOM_INPUT_MEMBER(midyunit_state::narc_talkback_strobe_r)
154154{
155   return (williams_narc_talkback_r(field.machine()) >> 8) & 1;
155   return (williams_narc_talkback_r(machine()) >> 8) & 1;
156156}
157157
158158
159static CUSTOM_INPUT( narc_talkback_data_r )
159CUSTOM_INPUT_MEMBER(midyunit_state::narc_talkback_data_r)
160160{
161   return williams_narc_talkback_r(field.machine()) & 0xff;
161   return williams_narc_talkback_r(machine()) & 0xff;
162162}
163163
164164
165static CUSTOM_INPUT( adpcm_irq_state_r )
165CUSTOM_INPUT_MEMBER(midyunit_state::adpcm_irq_state_r)
166166{
167   return williams_adpcm_sound_irq_r(field.machine()) & 1;
167   return williams_adpcm_sound_irq_r(machine()) & 1;
168168}
169169
170170
r14883r14884
237237   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN4 )
238238   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
239239   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 )
240   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(narc_talkback_strobe_r, NULL)
240   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, midyunit_state,narc_talkback_strobe_r, NULL)
241241   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED ) /* memory protect interlock */
242242   PORT_BIT( 0x3000, IP_ACTIVE_LOW, IPT_UNUSED )
243243   PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
253253*/
254254
255255   PORT_START("IN2")
256   PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(narc_talkback_data_r, NULL)
256   PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, midyunit_state,narc_talkback_data_r, NULL)
257257   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
258258
259259   PORT_START("DSW")
r14883r14884
591591   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Block 2") PORT_PLAYER(2)
592592   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Low Punch") PORT_PLAYER(1)
593593   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Low Kick") PORT_PLAYER(1)
594   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(adpcm_irq_state_r, NULL)
594   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, midyunit_state,adpcm_irq_state_r, NULL)
595595   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Block 2") PORT_PLAYER(1)
596596
597597   PORT_START("IN2")
r14883r14884
683683   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Block 2") PORT_PLAYER(2)
684684   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Low Punch") PORT_PLAYER(1)
685685   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Low Kick") PORT_PLAYER(1)
686   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(adpcm_irq_state_r, NULL)
686   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, midyunit_state,adpcm_irq_state_r, NULL)
687687   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Block 2") PORT_PLAYER(1)
688688
689689   PORT_START("IN2")
r14883r14884
769769   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED )
770770   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED )
771771   PORT_BIT( 0x3000, IP_ACTIVE_LOW, IPT_UNUSED )
772   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(adpcm_irq_state_r, NULL)
772   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, midyunit_state,adpcm_irq_state_r, NULL)
773773   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
774774
775775   PORT_START("DSW")
r14883r14884
874874   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) /* video freeze */
875875   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN3 )
876876   PORT_BIT( 0x3c00, IP_ACTIVE_LOW, IPT_UNUSED )
877   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(adpcm_irq_state_r, NULL)
877   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, midyunit_state,adpcm_irq_state_r, NULL)
878878   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
879879
880880   PORT_START("IN2")
src/mame/drivers/bzone.c
r14883r14884
256256 *
257257 *************************************/
258258
259static CUSTOM_INPUT( clock_r )
259CUSTOM_INPUT_MEMBER(bzone_state::clock_r)
260260{
261   return (field.machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
261   return (machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
262262}
263263
264264
r14883r14884
359359   /* per default (busy vector processor). */\
360360   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)\
361361   /* bit 7 is tied to a 3kHz clock */\
362   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
362   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, bzone_state,clock_r, NULL)
363363
364364
365365#define BZONEDSW0\
src/mame/drivers/mhavoc.c
r14883r14884
317317 *
318318 *************************************/
319319
320static CUSTOM_INPUT( clock_r )
320CUSTOM_INPUT_MEMBER(mhavoc_state::clock_r)
321321{
322322   /* 2.4kHz (divide 2.5MHz by 1024) */
323   return (field.machine().device<cpu_device>("alpha")->total_cycles() & 0x400) ? 0 : 1;
323   return (machine().device<cpu_device>("alpha")->total_cycles() & 0x400) ? 0 : 1;
324324}
325325
326326
r14883r14884
337337   /* Bit 1 = 2.4kHz (divide 2.5MHz by 1024) */
338338   /* Bit 0 = Vector generator halt flag */
339339   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)
340   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
341   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gamma_xmtd_r, NULL)
342   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gamma_rcvd_r, NULL)
340   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mhavoc_state,clock_r, NULL)
341   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mhavoc_state,gamma_xmtd_r, NULL)
342   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mhavoc_state,gamma_rcvd_r, NULL)
343343   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
344344   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Diag Step/Coin C") PORT_CODE(KEYCODE_F1)
345   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mhavoc_bit67_r, "COIN\0SERVICE")
345   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mhavoc_state,mhavoc_bit67_r, "COIN\0SERVICE")
346346
347347   PORT_START("IN1")   /* gamma */
348348   /* Bits 7-2 = input switches */
349349   /* Bit 1 = Alpha rcvd flag */
350350   /* Bit 0 = Alpha xmtd flag */
351   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(alpha_xmtd_r, NULL)
352   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(alpha_rcvd_r, NULL)
351   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mhavoc_state,alpha_xmtd_r, NULL)
352   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mhavoc_state,alpha_rcvd_r, NULL)
353353   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNKNOWN )
354354   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
355355   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
r14883r14884
418418   PORT_INCLUDE( mhavoc )
419419
420420   PORT_MODIFY("IN1")
421   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(tms5220_r, NULL)
421   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mhavoc_state,tms5220_r, NULL)
422422   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
423423INPUT_PORTS_END
424424
r14883r14884
436436static INPUT_PORTS_START( alphaone )
437437   PORT_START("IN0")   /* alpha (player_1 = 0) */
438438   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)
439   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
439   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mhavoc_state,clock_r, NULL)
440440   PORT_BIT( 0x7c, IP_ACTIVE_LOW, IPT_UNKNOWN )
441441   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
442442
src/mame/drivers/artmagic.c
r14883r14884
383383}
384384
385385
386static CUSTOM_INPUT( prot_r )
386CUSTOM_INPUT_MEMBER(artmagic_state::prot_r)
387387{
388   artmagic_state *state = field.machine().driver_data<artmagic_state>();
389   return state->m_prot_output_bit;
388   return m_prot_output_bit;
390389}
391390
392391
r14883r14884
629628   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
630629
631630   PORT_START("30000a")
632   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(prot_r, NULL)   /* protection data */
631   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, artmagic_state,prot_r, NULL)   /* protection data */
633632   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_SPECIAL )      /* protection ready */
634633   PORT_BIT( 0x00fc, IP_ACTIVE_LOW, IPT_UNKNOWN )
635634   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
821820   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
822821
823822   PORT_START("3c000a")
824   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(prot_r, NULL)   /* protection data */
823   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, artmagic_state,prot_r, NULL)   /* protection data */
825824   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_SPECIAL )      /* protection ready */
826825   PORT_BIT( 0x00fc, IP_ACTIVE_LOW, IPT_UNKNOWN )
827826   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
src/mame/drivers/multfish.c
r14883r14884
211211   DECLARE_WRITE8_MEMBER(multfish_counters_w);
212212   DECLARE_WRITE8_MEMBER(multfish_f3_w);
213213   DECLARE_WRITE8_MEMBER(multfish_dispenable_w);
214   DECLARE_CUSTOM_INPUT_MEMBER(multfish_hopper_r);
214215};
215216
216217static TILE_GET_INFO( get_multfish_tile_info )
r14883r14884
386387   return machine().primary_screen->vpos();
387388}
388389
389static CUSTOM_INPUT( multfish_hopper_r )
390CUSTOM_INPUT_MEMBER(multfish_state::multfish_hopper_r)
390391{
391   multfish_state *state = field.machine().driver_data<multfish_state>();
392392
393   if ( state->m_hopper_motor != 0 )
393   if ( m_hopper_motor != 0 )
394394   {
395         state->m_hopper++;
396         return state->m_hopper>>4;
395         m_hopper++;
396         return m_hopper>>4;
397397   }
398398   else
399399   {
r14883r14884
704704   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED ) // unused?
705705
706706   PORT_START("IN1")
707   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM ( multfish_hopper_r, NULL )// Hopper SW (22 B)
707   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, multfish_state,multfish_hopper_r, NULL )// Hopper SW (22 B)
708708   PORT_DIPNAME(     0x02, 0x02, "BK Door (17 A)"  )
709709   PORT_DIPSETTING(  0x02, DEF_STR( Off ) )
710710   PORT_DIPSETTING(  0x00, DEF_STR( On ) )
r14883r14884
797797   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
798798
799799   PORT_START("IN1")
800   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM ( multfish_hopper_r, NULL )// Hopper SW (22 B)
800   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, multfish_state,multfish_hopper_r, NULL )// Hopper SW (22 B)
801801   PORT_DIPNAME(     0x02, 0x02, "BK Door (17 A)"  )
802802   PORT_DIPSETTING(  0x02, DEF_STR( Off ) )
803803   PORT_DIPSETTING(  0x00, DEF_STR( On ) )
src/mame/drivers/seibuspi.c
r14883r14884
936936   return 0xffffffff;
937937}
938938
939static CUSTOM_INPUT( ejsakura_keyboard_r )
939CUSTOM_INPUT_MEMBER(seibuspi_state::ejsakura_keyboard_r)
940940{
941   seibuspi_state *state = field.machine().driver_data<seibuspi_state>();
942   switch(state->m_ejsakura_input_port)
941   switch(m_ejsakura_input_port)
943942   {
944943      case 0x01:
945         return input_port_read(field.machine(), "INPUT01");
944         return input_port_read(machine(), "INPUT01");
946945      case 0x02:
947         return input_port_read(field.machine(), "INPUT02");
946         return input_port_read(machine(), "INPUT02");
948947      case 0x04:
949         return input_port_read(field.machine(), "INPUT04");
948         return input_port_read(machine(), "INPUT04");
950949      case 0x08:
951         return input_port_read(field.machine(), "INPUT08");
950         return input_port_read(machine(), "INPUT08");
952951      case 0x10:
953         return input_port_read(field.machine(), "INPUT10");
952         return input_port_read(machine(), "INPUT10");
954953      default:
955         return input_port_read(field.machine(), "SYSTEM");
954         return input_port_read(machine(), "SYSTEM");
956955   }
957956   return 0xffffffff;
958957}
r14883r14884
12951294   Start - 000111 port 0
12961295*/
12971296
1298static CUSTOM_INPUT( ejanhs_encode )
1297CUSTOM_INPUT_MEMBER(seibuspi_state::ejanhs_encode)
12991298{
13001299   static const UINT8 encoding[] = { 0x02, 0x10, 0x03, 0x18, 0x04, 0x20, 0x05, 0x28, 0x06, 0x30, 0x07 };
1301   input_port_value state = input_port_read(field.machine(), (const char *)param);
1300   input_port_value state = input_port_read(machine(), (const char *)param);
13021301   int bit;
13031302
13041303   for (bit = 0; bit < ARRAY_LENGTH(encoding); bit++)
r14883r14884
13091308
13101309static INPUT_PORTS_START( spi_ejanhs )
13111310   PORT_START("INPUTS")
1312   PORT_BIT( 0x0000003f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(ejanhs_encode, "IN0BITS")
1313   PORT_BIT( 0x00003f00, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(ejanhs_encode, "IN1BITS")
1311   PORT_BIT( 0x0000003f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, seibuspi_state,ejanhs_encode, "IN0BITS")
1312   PORT_BIT( 0x00003f00, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, seibuspi_state,ejanhs_encode, "IN1BITS")
13141313   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNUSED )
13151314
13161315   PORT_START("SYSTEM")
r14883r14884
13581357
13591358static INPUT_PORTS_START( spi_ejsakura )
13601359   PORT_START("INPUTS")
1361   PORT_BIT( 0xffffffff, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(ejsakura_keyboard_r, NULL)
1360   PORT_BIT( 0xffffffff, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, seibuspi_state,ejsakura_keyboard_r, NULL)
13621361
13631362   PORT_START("INPUT01")
13641363   PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/system1.c
r14883r14884
439439 *
440440 *************************************/
441441
442static CUSTOM_INPUT( dakkochn_mux_data_r )
442CUSTOM_INPUT_MEMBER(system1_state::dakkochn_mux_data_r)
443443{
444   system1_state *state = field.machine().driver_data<system1_state>();
445444   static const char *const ports[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6" };
446   return input_port_read(field.machine(), ports[state->m_dakkochn_mux_data]);
445   return input_port_read(machine(), ports[m_dakkochn_mux_data]);
447446}
448447
449448
450static CUSTOM_INPUT( dakkochn_mux_status_r )
449CUSTOM_INPUT_MEMBER(system1_state::dakkochn_mux_status_r)
451450{
452   system1_state *state = field.machine().driver_data<system1_state>();
453451   /* reads from here indicate which mux port is selected */
454   return 1 << (state->m_dakkochn_mux_data);
452   return 1 << (m_dakkochn_mux_data);
455453}
456454
457455
r14883r14884
19551953   PORT_INCLUDE( choplift )
19561954
19571955   PORT_MODIFY("P1")
1958   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dakkochn_mux_data_r, NULL)
1956   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, system1_state,dakkochn_mux_data_r, NULL)
19591957
19601958   PORT_MODIFY("P2")
1961   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(dakkochn_mux_status_r, NULL)
1959   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, system1_state,dakkochn_mux_status_r, NULL)
19621960
19631961   PORT_MODIFY("SYSTEM")
19641962   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )    /* start 1 & 2 not connected. */
src/mame/drivers/niyanpai.c
r14883r14884
314314   return (portdata);
315315}
316316
317static CUSTOM_INPUT( musobana_outcoin_flag_r )
317CUSTOM_INPUT_MEMBER(niyanpai_state::musobana_outcoin_flag_r)
318318{
319   niyanpai_state *state = field.machine().driver_data<niyanpai_state>();
320   address_space *space = field.machine().device("maincpu")->memory().space(AS_PROGRAM);
319   address_space *space = machine().device("maincpu")->memory().space(AS_PROGRAM);
321320   // tmp68301_parallel_interface[0x05]
322321   //  bit 0   coin counter
323322   //  bit 2   motor on
324323   //  bit 3   coin lock
325324
326   if (tmp68301_parallel_interface_r(space, 0x0005, 0x00ff) & 0x0004) state->m_musobana_outcoin_flag ^= 1;
327   else state->m_musobana_outcoin_flag = 1;
325   if (tmp68301_parallel_interface_r(space, 0x0005, 0x00ff) & 0x0004) m_musobana_outcoin_flag ^= 1;
326   else m_musobana_outcoin_flag = 1;
328327
329   return state->m_musobana_outcoin_flag & 0x01;
328   return m_musobana_outcoin_flag & 0x01;
330329}
331330
332331WRITE16_MEMBER(niyanpai_state::musobana_inputport_w)
r14883r14884
690689   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START3 )         // CREDIT CLEAR
691690   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_SERVICE3 )         // MEMORY RESET
692691   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_SERVICE2 )         // ANALYZER
693   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(musobana_outcoin_flag_r, NULL)   // OUT COIN
692   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, niyanpai_state,musobana_outcoin_flag_r, NULL)   // OUT COIN
694693   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
695694   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )               // TEST
696695
r14883r14884
756755   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START3 )         // CREDIT CLEAR
757756   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_SERVICE3 )         // MEMORY RESET
758757   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_SERVICE2 )         // ANALYZER
759   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(musobana_outcoin_flag_r, NULL)   // OUT COIN
758   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, niyanpai_state,musobana_outcoin_flag_r, NULL)   // OUT COIN
760759   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
761760   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )               // TEST
762761
r14883r14884
822821   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_START3 )         // CREDIT CLEAR
823822   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_SERVICE3 )         // MEMORY RESET
824823   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_SERVICE2 )         // ANALYZER
825   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(musobana_outcoin_flag_r, NULL)   // OUT COIN
824   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, niyanpai_state,musobana_outcoin_flag_r, NULL)   // OUT COIN
826825   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
827826   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )               // TEST
828827
src/mame/drivers/suprnova.c
r14883r14884
455455
456456**********************************************************************************/
457457
458static CUSTOM_INPUT( paddle_r )
458CUSTOM_INPUT_MEMBER(skns_state::paddle_r)
459459{
460460   const char *tag = (const char *)param;
461   return input_port_read(field.machine(), tag);
461   return input_port_read(machine(), tag);
462462}
463463
464464static INPUT_PORTS_START( skns )      /* 3 buttons, 2 players */
r14883r14884
513513   PORT_DIPNAME( 0x00000080, 0x00000080, "Freeze" )
514514   PORT_DIPSETTING(          0x00000000, "Freezes the game")
515515   PORT_DIPSETTING(          0x00000080, "Right value")
516   PORT_BIT( 0x0000ff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(paddle_r, "Paddle C")
517   PORT_BIT( 0x00ff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(paddle_r, "Paddle B")
518   PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(paddle_r, "Paddle A")
516   PORT_BIT( 0x0000ff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, skns_state,paddle_r, "Paddle C")
517   PORT_BIT( 0x00ff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, skns_state,paddle_r, "Paddle B")
518   PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, skns_state,paddle_r, "Paddle A")
519519
520520   PORT_START("40000c")
521   PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(paddle_r, "Paddle D")
521   PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, skns_state,paddle_r, "Paddle D")
522522   PORT_BIT( 0xffffff00, IP_ACTIVE_LOW, IPT_UNUSED )
523523
524524   PORT_START("Paddle A")
src/mame/drivers/dynax.c
r14883r14884
12051205   logerror("%04x: unmapped romregion=%02X\n", cpu_get_pc(&space.device()), data);
12061206}
12071207
1208READ8_MEMBER(dynax_state::unk_r)
1209{
1210   return 0x78;
1211}
1212
12131208static ADDRESS_MAP_START( htengoku_io_map, AS_IO, 8, dynax_state )
12141209   ADDRESS_MAP_GLOBAL_MASK(0xff)
12151210   AM_RANGE( 0x01, 0x07 ) AM_WRITE(dynax_blitter_rev2_w)      // Blitter
r14883r14884
12221217   AM_RANGE( 0x44, 0x44 ) AM_DEVWRITE_LEGACY("aysnd", ay8910_data_w)   //
12231218   AM_RANGE( 0x46, 0x47 ) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w)      //
12241219   AM_RANGE( 0x80, 0x8f ) AM_DEVREADWRITE("rtc", msm6242_device, read, write)
1225   AM_RANGE( 0xa0, 0xa3 ) AM_WRITE_LEGACY(ddenlovr_palette_base_w)   // ddenlovr mixer chip
1226   AM_RANGE( 0xa4, 0xa7 ) AM_WRITE_LEGACY(ddenlovr_palette_mask_w)
1227   AM_RANGE( 0xa8, 0xab ) AM_WRITE_LEGACY(ddenlovr_transparency_pen_w)
1228   AM_RANGE( 0xac, 0xaf ) AM_WRITE_LEGACY(ddenlovr_transparency_mask_w)
1220   AM_RANGE( 0xa0, 0xa3 ) AM_WRITE(ddenlovr_palette_base_w)   // ddenlovr mixer chip
1221   AM_RANGE( 0xa4, 0xa7 ) AM_WRITE(ddenlovr_palette_mask_w)
1222   AM_RANGE( 0xa8, 0xab ) AM_WRITE(ddenlovr_transparency_pen_w)
1223   AM_RANGE( 0xac, 0xaf ) AM_WRITE(ddenlovr_transparency_mask_w)
12291224   // b0-b3 ?
1230   AM_RANGE( 0xb4, 0xb4 ) AM_WRITE_LEGACY(ddenlovr_bgcolor_w)
1231   AM_RANGE( 0xb5, 0xb5 ) AM_WRITE_LEGACY(ddenlovr_priority_w)
1232   AM_RANGE( 0xb6, 0xb6 ) AM_WRITE_LEGACY(ddenlovr_layer_enable_w)
1225   AM_RANGE( 0xb4, 0xb4 ) AM_WRITE(ddenlovr_bgcolor_w)
1226   AM_RANGE( 0xb5, 0xb5 ) AM_WRITE(ddenlovr_priority_w)
1227   AM_RANGE( 0xb6, 0xb6 ) AM_WRITE(ddenlovr_layer_enable_w)
12331228   AM_RANGE( 0xb8, 0xb8 ) AM_READ(unk_r)            // ? must be 78 on startup
12341229   AM_RANGE( 0xc2, 0xc2 ) AM_WRITE(htengoku_rombank_w)      // BANK ROM Select
12351230   AM_RANGE( 0xc0, 0xc0 ) AM_WRITE(dynax_extra_scrollx_w)   // screen scroll X
src/mame/drivers/itech32.c
r14883r14884
464464 *************************************/
465465
466466
467static CUSTOM_INPUT( special_port_r )
467CUSTOM_INPUT_MEMBER(itech32_state::special_port_r)
468468{
469   itech32_state *state = field.machine().driver_data<itech32_state>();
470   if (state->m_sound_int_state)
471      state->m_special_result ^= 1;
469   if (m_sound_int_state)
470      m_special_result ^= 1;
472471
473   return state->m_special_result;
472   return m_special_result;
474473}
475474
476475READ16_MEMBER(itech32_state::trackball_r)
r14883r14884
11171116   PORT_SERVICE_NO_TOGGLE( 0x0001, IP_ACTIVE_LOW )
11181117   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE1 )
11191118   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_VBLANK )
1120   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_port_r, NULL)
1119   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech32_state,special_port_r, NULL)
11211120   PORT_DIPNAME( 0x0010, 0x0000, "Video Sync" )    PORT_DIPLOCATION("SW1:1")
11221121   PORT_DIPSETTING(      0x0000, "-" )
11231122   PORT_DIPSETTING(      0x0010, "+" )
r14883r14884
11621161   PORT_SERVICE_NO_TOGGLE( 0x0001, IP_ACTIVE_LOW )
11631162   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE1 )
11641163   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_VBLANK )
1165   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_port_r, NULL)
1164   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech32_state,special_port_r, NULL)
11661165   PORT_DIPNAME( 0x0010, 0x0000, "Video Sync" )    PORT_DIPLOCATION("SW1:4")
11671166   PORT_DIPSETTING(      0x0000, "-" )
11681167   PORT_DIPSETTING(      0x0010, "+" )
r14883r14884
13651364   PORT_SERVICE_NO_TOGGLE( 0x00010000, IP_ACTIVE_LOW )
13661365   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_SERVICE1 )
13671366   PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_VBLANK )
1368   PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(special_port_r, NULL)
1367   PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech32_state,special_port_r, NULL)
13691368   PORT_DIPNAME( 0x00100000, 0x00000000, "Video Sync" )    PORT_DIPLOCATION("SW1:4")
13701369   PORT_DIPSETTING(          0x00000000, "-" )
13711370   PORT_DIPSETTING(          0x00100000, "+" )
src/mame/drivers/undrfire.c
r14883r14884
251251            GAME INPUTS
252252**********************************************************/
253253
254static CUSTOM_INPUT(frame_counter_r)
254CUSTOM_INPUT_MEMBER(undrfire_state::frame_counter_r)
255255{
256   undrfire_state *state = field.machine().driver_data<undrfire_state>();
257   return state->m_frame_counter;
256   return m_frame_counter;
258257}
259258
260259READ32_MEMBER(undrfire_state::undrfire_input_r)
r14883r14884
527526
528527static INPUT_PORTS_START( undrfire )
529528   PORT_START("INPUTS")
530   PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(frame_counter_r, NULL)   /* Frame counter */
529   PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, undrfire_state,frame_counter_r, NULL)   /* Frame counter */
531530   PORT_BIT( 0x00000002, IP_ACTIVE_LOW,  IPT_UNKNOWN )
532531   PORT_BIT( 0x00000004, IP_ACTIVE_LOW,  IPT_UNKNOWN )
533532   PORT_BIT( 0x00000008, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r14883r14884
595594
596595static INPUT_PORTS_START( cbombers )
597596   PORT_START("INPUTS")
598   PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(frame_counter_r, NULL)   /* Frame counter */
597   PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, undrfire_state,frame_counter_r, NULL)   /* Frame counter */
599598   PORT_BIT( 0x00000002, IP_ACTIVE_LOW,  IPT_UNKNOWN )
600599   PORT_BIT( 0x00000004, IP_ACTIVE_LOW,  IPT_UNKNOWN )
601600   PORT_BIT( 0x00000008, IP_ACTIVE_LOW,  IPT_UNKNOWN )
src/mame/drivers/quizshow.c
r14883r14884
5454   DECLARE_READ8_MEMBER(quizshow_timing_r);
5555   DECLARE_READ8_MEMBER(quizshow_tape_signal_r);
5656   DECLARE_WRITE8_MEMBER(quizshow_main_ram_w);
57   DECLARE_CUSTOM_INPUT_MEMBER(quizshow_tape_headpos_r);
5758};
5859
5960
r14883r14884
234235
235236***************************************************************************/
236237
237static CUSTOM_INPUT(quizshow_tape_headpos_r)
238CUSTOM_INPUT_MEMBER(quizshow_state::quizshow_tape_headpos_r)
238239{
239   quizshow_state *state = field.machine().driver_data<quizshow_state>();
240   return 1 << state->m_tape_head_pos;
240   return 1 << m_tape_head_pos;
241241}
242242
243243static INPUT_CHANGED(quizshow_category_select)
r14883r14884
252252
253253static INPUT_PORTS_START( quizshow )
254254   PORT_START("IN0") // ADR strobe 0
255   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(quizshow_tape_headpos_r, NULL)
255   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, quizshow_state,quizshow_tape_headpos_r, NULL)
256256   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
257257   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 )
258258   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
src/mame/drivers/astrof.c
r14883r14884
120120}
121121
122122
123static CUSTOM_INPUT( astrof_p1_controls_r )
123CUSTOM_INPUT_MEMBER(astrof_state::astrof_p1_controls_r)
124124{
125   return input_port_read(field.machine(), "P1");
125   return input_port_read(machine(), "P1");
126126}
127127
128128
129static CUSTOM_INPUT( astrof_p2_controls_r )
129CUSTOM_INPUT_MEMBER(astrof_state::astrof_p2_controls_r)
130130{
131131   UINT32 ret;
132132
133133   /* on an upright cabinet, a single set of controls
134134       is connected to both sets of pins on the edge
135135       connector */
136   if (input_port_read(field.machine(), "CAB"))
137      ret = input_port_read(field.machine(), "P2");
136   if (input_port_read(machine(), "CAB"))
137      ret = input_port_read(machine(), "P2");
138138   else
139      ret = input_port_read(field.machine(), "P1");
139      ret = input_port_read(machine(), "P1");
140140
141141   return ret;
142142}
143143
144144
145static CUSTOM_INPUT( tomahawk_controls_r )
145CUSTOM_INPUT_MEMBER(astrof_state::tomahawk_controls_r)
146146{
147147   UINT32 ret;
148   astrof_state *state = field.machine().driver_data<astrof_state>();
149148
150149   /* on a cocktail cabinet, two sets of controls are
151150       multiplexed on a single set of inputs
152151         (not verified on pcb) */
153152
154   if (state->m_flipscreen)
155      ret = input_port_read(field.machine(), "P2");
153   if (m_flipscreen)
154      ret = input_port_read(machine(), "P2");
156155   else
157      ret = input_port_read(field.machine(), "P1");
156      ret = input_port_read(machine(), "P1");
158157
159158   return ret;
160159}
r14883r14884
659658   PORT_START("IN")
660659   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
661660   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
662   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(astrof_p1_controls_r, NULL)
663   PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(astrof_p2_controls_r, NULL)
661   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrof_state,astrof_p1_controls_r, NULL)
662   PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrof_state,astrof_p2_controls_r, NULL)
664663
665664   PORT_START("P1")
666665   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
r14883r14884
714713   PORT_START("IN")
715714   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
716715   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
717   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(astrof_p1_controls_r, NULL)
718   PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(astrof_p2_controls_r, NULL)
716   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrof_state,astrof_p1_controls_r, NULL)
717   PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrof_state,astrof_p2_controls_r, NULL)
719718
720719   PORT_START("P1")
721720   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY
r14883r14884
769768   PORT_START("IN")
770769   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
771770   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
772   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(astrof_p1_controls_r, NULL)
773   PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(astrof_p2_controls_r, NULL)
771   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrof_state,astrof_p1_controls_r, NULL)
772   PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrof_state,astrof_p2_controls_r, NULL)
774773
775774   PORT_START("P1")
776775   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
r14883r14884
820819   PORT_START("IN")
821820   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
822821   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
823   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(astrof_p1_controls_r, NULL)
824   PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(astrof_p2_controls_r, NULL)
822   PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrof_state,astrof_p1_controls_r, NULL)
823   PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrof_state,astrof_p2_controls_r, NULL)
825824
826825   PORT_START("P1")
827826   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
r14883r14884
874873   PORT_INCLUDE( astrof_common )
875874
876875   PORT_START("IN")
877   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(tomahawk_controls_r, NULL)
876   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrof_state,tomahawk_controls_r, NULL)
878877   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
879878   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
880879   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
src/mame/drivers/peyper.c
r14883r14884
1818   DECLARE_WRITE8_MEMBER(lamp_w);
1919   DECLARE_WRITE8_MEMBER(lamp7_w);
2020   DECLARE_WRITE8_MEMBER(sol_w);
21   DECLARE_CUSTOM_INPUT_MEMBER(wolfman_replay_hs_r);
2122};
2223
2324
r14883r14884
166167}
167168
168169
169static CUSTOM_INPUT( wolfman_replay_hs_r )
170CUSTOM_INPUT_MEMBER(peyper_state::wolfman_replay_hs_r)
170171{
171172   int bit_mask = (FPTR)param;
172173
173174   switch (bit_mask)
174175   {
175176      case 0x03:
176         return ((input_port_read(field.machine(), "REPLAY") & bit_mask) >> 0);
177         return ((input_port_read(machine(), "REPLAY") & bit_mask) >> 0);
177178      case 0x40:
178         return ((input_port_read(field.machine(), "REPLAY") & bit_mask) >> 6);
179         return ((input_port_read(machine(), "REPLAY") & bit_mask) >> 6);
179180      default:
180181         logerror("wolfman_replay_hs_r : invalid %02X bit_mask\n",bit_mask);
181182         return 0;
r14883r14884
450451   PORT_DIPSETTING(    0x20, "01" )
451452//  PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coinage ) )          // Partidas/Moneda - code at 0x0a69 - tables at 0x0b30 (4 * 3) - credits BCD stored at 0x6151
452453//  PORT_DIPNAME( 0x04, 0x00, "Balls" )                     // Bolas/Partida - code at 0x0a5c - stored at 0x60bd
453   PORT_BIT( 0x03, 0x00, IPT_SPECIAL) PORT_CUSTOM(wolfman_replay_hs_r, (void *)0x03)
454   PORT_BIT( 0x03, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, peyper_state,wolfman_replay_hs_r, (void *)0x03)
454455
455456   /* DSW1 : port 0x24 - DSW1-1 is bit 7 ... DSW1-8 is bit 0 */
456457   PORT_START("DSW1")
457458   PORT_DIPNAME( 0x80, 0x00, "Adjust Replay" )             // Premios por Puntuacion - code at 0x0aa3 - stored at 0x60c4 and 0x60cc (0x00 NO / 0x05 YES)
458459   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
459460   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
460   PORT_BIT( 0x40, 0x00, IPT_SPECIAL) PORT_CUSTOM(wolfman_replay_hs_r, (void *)0x40)
461   PORT_BIT( 0x40, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, peyper_state,wolfman_replay_hs_r, (void *)0x40)
461462   PORT_DIPNAME( 0x20, 0x00, "Clear RAM on Reset" )        // Borrador RAM - code at 0x0ace - range 0x6141..0x616f - 0x616d = 0x5a and 0x616e = 0xa5
462463   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
463464   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
src/mame/drivers/enigma2.c
r14883r14884
8181   DECLARE_READ8_MEMBER(dip_switch_r);
8282   DECLARE_WRITE8_MEMBER(sound_data_w);
8383   DECLARE_WRITE8_MEMBER(enigma2_flip_screen_w);
84   DECLARE_CUSTOM_INPUT_MEMBER(p1_controls_r);
85   DECLARE_CUSTOM_INPUT_MEMBER(p2_controls_r);
8486};
8587
8688
r14883r14884
414416}
415417
416418
417static CUSTOM_INPUT( p1_controls_r )
419CUSTOM_INPUT_MEMBER(enigma2_state::p1_controls_r)
418420{
419   return input_port_read(field.machine(), "P1CONTROLS");
421   return input_port_read(machine(), "P1CONTROLS");
420422}
421423
422424
423static CUSTOM_INPUT( p2_controls_r )
425CUSTOM_INPUT_MEMBER(enigma2_state::p2_controls_r)
424426{
425   enigma2_state *state = field.machine().driver_data<enigma2_state>();
426   if (state->m_flip_screen)
427      return input_port_read(field.machine(), "P2CONTROLS");
427   if (m_flip_screen)
428      return input_port_read(machine(), "P2CONTROLS");
428429   else
429      return input_port_read(field.machine(), "P1CONTROLS");
430      return input_port_read(machine(), "P1CONTROLS");
430431}
431432
432433
r14883r14884
497498   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
498499   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
499500   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
500   PORT_BIT( 0x78, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(p1_controls_r, NULL)
501   PORT_BIT( 0x78, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, enigma2_state,p1_controls_r, NULL)
501502   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
502503
503504   PORT_START("IN1")
504505   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
505506   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
506507   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
507   PORT_BIT( 0x78, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(p2_controls_r, NULL)
508   PORT_BIT( 0x78, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, enigma2_state,p2_controls_r, NULL)
508509   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
509510
510511   PORT_START("DSW")
r14883r14884
552553   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
553554   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
554555   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
555   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(p1_controls_r, NULL)
556   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, enigma2_state,p1_controls_r, NULL)
556557   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
557558
558559   PORT_START("IN1")
r14883r14884
560561   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
561562   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
562563   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
563   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(p2_controls_r, NULL)
564   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, enigma2_state,p2_controls_r, NULL)
564565   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
565566
566567   PORT_START("DSW")
src/mame/drivers/igspoker.c
r14883r14884
102102   DECLARE_WRITE8_MEMBER(custom_io_w);
103103   DECLARE_READ8_MEMBER(exp_rom_r);
104104   void show_out();
105   DECLARE_CUSTOM_INPUT_MEMBER(hopper_r);
105106};
106107
107108
r14883r14884
332333   }
333334}
334335
335static CUSTOM_INPUT( hopper_r )
336CUSTOM_INPUT_MEMBER(igspoker_state::hopper_r)
336337{
337   igspoker_state *state = field.machine().driver_data<igspoker_state>();
338   if (state->m_hopper) return !(field.machine().primary_screen->frame_number()%10);
339   return field.machine().input().code_pressed(KEYCODE_H);
338   if (m_hopper) return !(machine().primary_screen->frame_number()%10);
339   return machine().input().code_pressed(KEYCODE_H);
340340}
341341
342342READ8_MEMBER(igspoker_state::exp_rom_r)
r14883r14884
481481   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
482482
483483   PORT_START("SERVICE")
484   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
484   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM_MEMBER(DEVICE_SELF,igspoker_state,hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
485485   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
486486   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
487487   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Statistics")
r14883r14884
615615   PORT_START("SERVICE")
616616   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
617617   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Attendent")
618   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
618   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM_MEMBER(DEVICE_SELF,igspoker_state,hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
619619   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
620620   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
621621   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14883r14884
780780   PORT_START("SERVICE")
781781   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
782782   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
783   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
783   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF,igspoker_state,hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
784784   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
785785   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
786786   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
r14883r14884
925925   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
926926
927927   PORT_START("SERVICE")
928   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
928   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF,igspoker_state,hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
929929   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
930930   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
931931   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Statistics")
r14883r14884
10771077   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
10781078
10791079   PORT_START("SERVICE")
1080   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
1080   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM_MEMBER(DEVICE_SELF,igspoker_state,hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
10811081   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
10821082   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
10831083   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Statistics")
r14883r14884
13971397   PORT_DIPSETTING(    0x00, "100:1" )
13981398
13991399   PORT_START("SERVICE")
1400   PORT_BIT( 0x8f, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
1400   PORT_BIT( 0x8f, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM_MEMBER(DEVICE_SELF,igspoker_state,hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
14011401   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
14021402   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
14031403   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Statistics")
r14883r14884
15321532   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
15331533
15341534   PORT_START("SERVICE")
1535   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
1535   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM_MEMBER(DEVICE_SELF,igspoker_state,hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
15361536   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
15371537   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
15381538   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Statistics")
r14883r14884
16711671
16721672   PORT_START("SERVICE")
16731673   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9)
1674   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
1674   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM_MEMBER(DEVICE_SELF,igspoker_state,hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
16751675   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
16761676   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
16771677   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Statistics")
src/mame/drivers/acefruit.c
r14883r14884
3030   DECLARE_WRITE8_MEMBER(acefruit_sound_w);
3131   DECLARE_WRITE8_MEMBER(acefruit_lamp_w);
3232   DECLARE_WRITE8_MEMBER(acefruit_solenoid_w);
33   DECLARE_CUSTOM_INPUT_MEMBER(sidewndr_payout_r);
34   DECLARE_CUSTOM_INPUT_MEMBER(starspnr_coinage_r);
35   DECLARE_CUSTOM_INPUT_MEMBER(starspnr_payout_r);
3336};
3437
3538
r14883r14884
166169   return 0;
167170}
168171
169static CUSTOM_INPUT( sidewndr_payout_r )
172CUSTOM_INPUT_MEMBER(acefruit_state::sidewndr_payout_r)
170173{
171174   int bit_mask = (FPTR)param;
172175
173176   switch (bit_mask)
174177   {
175178      case 0x01:
176         return ((input_port_read(field.machine(), "PAYOUT") & bit_mask) >> 0);
179         return ((input_port_read(machine(), "PAYOUT") & bit_mask) >> 0);
177180      case 0x02:
178         return ((input_port_read(field.machine(), "PAYOUT") & bit_mask) >> 1);
181         return ((input_port_read(machine(), "PAYOUT") & bit_mask) >> 1);
179182      default:
180183         logerror("sidewndr_payout_r : invalid %02X bit_mask\n",bit_mask);
181184         return 0;
182185   }
183186}
184187
185static CUSTOM_INPUT( starspnr_coinage_r )
188CUSTOM_INPUT_MEMBER(acefruit_state::starspnr_coinage_r)
186189{
187190   int bit_mask = (FPTR)param;
188191
189192   switch (bit_mask)
190193   {
191194      case 0x01:
192         return ((input_port_read(field.machine(), "COINAGE") & bit_mask) >> 0);
195         return ((input_port_read(machine(), "COINAGE") & bit_mask) >> 0);
193196      case 0x02:
194         return ((input_port_read(field.machine(), "COINAGE") & bit_mask) >> 1);
197         return ((input_port_read(machine(), "COINAGE") & bit_mask) >> 1);
195198      case 0x04:
196         return ((input_port_read(field.machine(), "COINAGE") & bit_mask) >> 2);
199         return ((input_port_read(machine(), "COINAGE") & bit_mask) >> 2);
197200      case 0x08:
198         return ((input_port_read(field.machine(), "COINAGE") & bit_mask) >> 3);
201         return ((input_port_read(machine(), "COINAGE") & bit_mask) >> 3);
199202      default:
200203         logerror("starspnr_coinage_r : invalid %02X bit_mask\n",bit_mask);
201204         return 0;
202205   }
203206}
204207
205static CUSTOM_INPUT( starspnr_payout_r )
208CUSTOM_INPUT_MEMBER(acefruit_state::starspnr_payout_r)
206209{
207210   int bit_mask = (FPTR)param;
208211
209212   switch (bit_mask)
210213   {
211214      case 0x01:
212         return ((input_port_read(field.machine(), "PAYOUT") & bit_mask) >> 0);
215         return ((input_port_read(machine(), "PAYOUT") & bit_mask) >> 0);
213216      case 0x02:
214         return ((input_port_read(field.machine(), "PAYOUT") & bit_mask) >> 1);
217         return ((input_port_read(machine(), "PAYOUT") & bit_mask) >> 1);
215218      case 0x04:
216         return ((input_port_read(field.machine(), "PAYOUT") & bit_mask) >> 2);
219         return ((input_port_read(machine(), "PAYOUT") & bit_mask) >> 2);
217220      default:
218221         logerror("starspnr_payout_r : invalid %02X bit_mask\n",bit_mask);
219222         return 0;
r14883r14884
326329   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME( "Cancel/Clear" )
327330   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME( "Refill" ) PORT_TOGGLE
328331   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )              /* "Token in" - also "Refill" when "Refill" mode ON */
329   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM(sidewndr_payout_r, (void *)0x01)
332   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, acefruit_state,sidewndr_payout_r, (void *)0x01)
330333   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
331334
332335   PORT_START("IN3")   // 3
333336   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME( "Hold/Nudge 1" )
334337   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME( "Accountancy System" ) PORT_TOGGLE
335338   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN4 )              /* "50P in" */
336   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM(sidewndr_payout_r, (void *)0x02)
339   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, acefruit_state,sidewndr_payout_r, (void *)0x02)
337340   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
338341
339342   PORT_START("IN4")   // 4
r14883r14884
440443   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Collect/Cancel" )
441444   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
442445   /* tested at 0xeed7 with IN1 bit 3 - before coins are tested - table at 0xef55 (4 * 3 bytes) */
443   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM(starspnr_coinage_r, (void *)0x08) /* to be confirmed */
446   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, acefruit_state,starspnr_coinage_r, (void *)0x08) /* to be confirmed */
444447
445448   PORT_START("IN2")   // 2
446449   /* tested at 0xe83c */
r14883r14884
450453   /* tested at 0xef82 after IN5 bit 1 and after IN1 bit 3 - after coins are tested - table at 0xefa8 (3 bytes) */
451454   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
452455   /* tested at 0xeeba with IN3 bit 3 - before coins are tested - table at 0xef55 (4 * 3 bytes) */
453   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM(starspnr_coinage_r, (void *)0x02) /* to be confirmed */
456   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, acefruit_state,starspnr_coinage_r, (void *)0x02) /* to be confirmed */
454457   /* tested at 0x1b0f */
455458   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
456459
r14883r14884
459462   /* tested at 0xe8ea and 0xecbe */
460463   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
461464   /* tested at 0xeeba with IN2 bit 3 - before coins are tested - table at 0xef55 (4 * 3 bytes) */
462   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM(starspnr_coinage_r, (void *)0x01) /* to be confirmed */
465   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, acefruit_state,starspnr_coinage_r, (void *)0x01) /* to be confirmed */
463466   /* tested at 0x0178 */
464467   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
465468
r14883r14884
470473   /* tested at 0xed86 */
471474   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
472475   /* tested at 0xeed7 with IN1 bit 3 - before coins are tested - table at 0xef55 (4 * 3 bytes) */
473   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM(starspnr_coinage_r, (void *)0x04) /* to be confirmed */
476   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, acefruit_state,starspnr_coinage_r, (void *)0x04) /* to be confirmed */
474477
475478   PORT_START("IN5")   // 5
476479   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME( "Hold 3" )
r14883r14884
479482   /* tested at 0xec6f */
480483   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
481484   /* tested at 0x1d60 with IN6 bit 3 and IN7 bit 3 - table at 0x1d90 (8 * 3 bytes) */
482   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM(starspnr_payout_r, (void *)0x01) /* to be confirmed */
485   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, acefruit_state,starspnr_payout_r, (void *)0x01) /* to be confirmed */
483486   /* tested at 0xe312 and 0xe377 */
484487   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
485488
r14883r14884
488491   /* tested at 0xee42, 0xee5e and 0xeff5 before IN1 bit 0 - invalid code after 0xf000 */
489492   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
490493   /* tested at 0x1d60 with IN5 bit 3 and IN7 bit 3 - table at 0x1d90 (8 * 3 bytes) */
491   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM(starspnr_payout_r, (void *)0x02) /* to be confirmed */
494   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, acefruit_state,starspnr_payout_r, (void *)0x02) /* to be confirmed */
492495   /* tested at 0xe8dd and 0xec1c */
493496   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
494497
r14883r14884
500503   /* tested at 0xedcb */
501504   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
502505   /* tested at 0x1d60 with IN5 bit 3 and IN6 bit 3 - table at 0x1d90 (8 * 3 bytes) */
503   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM(starspnr_payout_r, (void *)0x04) /* to be confirmed */
506   PORT_BIT( 0x08, 0x00, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, acefruit_state,starspnr_payout_r, (void *)0x04) /* to be confirmed */
504507   /* tested at 0xec2a */
505508   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
506509
src/mame/drivers/sprint4.c
r14883r14884
1717#define PIXEL_CLOCK    (MASTER_CLOCK / 2)
1818
1919
20static CUSTOM_INPUT( get_lever )
20CUSTOM_INPUT_MEMBER(sprint4_state::get_lever)
2121{
22   sprint4_state *state = field.machine().driver_data<sprint4_state>();
2322   int n = (FPTR) param;
2423
25   return 4 * state->m_gear[n] > state->m_da_latch;
24   return 4 * m_gear[n] > m_da_latch;
2625}
2726
2827
29static CUSTOM_INPUT( get_wheel )
28CUSTOM_INPUT_MEMBER(sprint4_state::get_wheel)
3029{
31   sprint4_state *state = field.machine().driver_data<sprint4_state>();
3230   int n = (FPTR) param;
3331
34   return 8 * state->m_steer_FF1[n] + 8 * state->m_steer_FF2[n] > state->m_da_latch;
32   return 8 * m_steer_FF1[n] + 8 * m_steer_FF2[n] > m_da_latch;
3533}
3634
3735
38static CUSTOM_INPUT( get_collision )
36CUSTOM_INPUT_MEMBER(sprint4_state::get_collision)
3937{
40   sprint4_state *state = field.machine().driver_data<sprint4_state>();
4138   int n = (FPTR) param;
4239
43   return state->m_collision[n];
40   return m_collision[n];
4441}
4542
4643
r14883r14884
269266
270267   PORT_START("COLLISION")
271268   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 1 Gas") PORT_PLAYER(1)
272   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)0 )
269   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_collision, (void *)0 )
273270   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 2 Gas") PORT_PLAYER(2)
274   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)1 )
271   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_collision, (void *)1 )
275272   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 3 Gas") PORT_PLAYER(3)
276   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)2 )
273   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_collision, (void *)2 )
277274   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 4 Gas") PORT_PLAYER(4)
278   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_collision, (void *)3 )
275   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_collision, (void *)3 )
279276
280277   PORT_START("COIN")
281278   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
306303   PORT_DIPSETTING(    0xe0, "150 seconds" )
307304
308305   PORT_START("ANALOG")
309   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_wheel, (void *)0)
310   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_lever, (void *)0)
311   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_wheel, (void *)1)
312   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_lever, (void *)1)
313   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_wheel, (void *)2)
314   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_lever, (void *)2)
315   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_wheel, (void *)3)
316   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( get_lever, (void *)3)
306   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_wheel, (void *)0)
307   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_lever, (void *)0)
308   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_wheel, (void *)1)
309   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_lever, (void *)1)
310   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_wheel, (void *)2)
311   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_lever, (void *)2)
312   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_wheel, (void *)3)
313   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, sprint4_state, get_lever, (void *)3)
317314
318315   PORT_START("WHEEL1")
319316   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) PORT_PLAYER(1)
src/mame/drivers/dbz.c
r14883r14884
214214   PORT_DIPSETTING(      0x8000, DEF_STR( On ) )
215215
216216   PORT_START("DSW2")
217   PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE")
218   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE")
217   PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE")
218   PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE")
219219
220220   PORT_START("FAKE")
221221   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
src/mame/drivers/limenko.c
r14883r14884
6666   DECLARE_READ32_MEMBER(legendoh_speedup_r);
6767   DECLARE_READ32_MEMBER(sb2003_speedup_r);
6868   DECLARE_READ32_MEMBER(spotty_speedup_r);
69   DECLARE_CUSTOM_INPUT_MEMBER(spriteram_bit_r);
6970};
7071
7172
r14883r14884
121122   soundlatch_w(space, 0, (data >> 16) & 0xff);
122123}
123124
124static CUSTOM_INPUT( spriteram_bit_r )
125CUSTOM_INPUT_MEMBER(limenko_state::spriteram_bit_r)
125126{
126   limenko_state *state = field.machine().driver_data<limenko_state>();
127   return state->m_spriteram_bit;
127   return m_spriteram_bit;
128128}
129129
130130WRITE32_MEMBER(limenko_state::spriteram_buffer_w)
r14883r14884
545545   PORT_DIPNAME( 0x20000000, 0x00000000, "Sound Enable" )
546546   PORT_DIPSETTING(          0x20000000, DEF_STR( Off ) )
547547   PORT_DIPSETTING(          0x00000000, DEF_STR( On ) )
548   PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(spriteram_bit_r, NULL) //changes spriteram location
548   PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, limenko_state,spriteram_bit_r, NULL) //changes spriteram location
549549   PORT_BIT( 0x4000ffff, IP_ACTIVE_LOW, IPT_UNUSED )
550550
551551   PORT_START( "EEPROMOUT" )
r14883r14884
589589   PORT_DIPNAME( 0x20000000, 0x00000000, "Sound Enable" )
590590   PORT_DIPSETTING(          0x20000000, DEF_STR( Off ) )
591591   PORT_DIPSETTING(          0x00000000, DEF_STR( On ) )
592   PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(spriteram_bit_r, NULL) //changes spriteram location
592   PORT_BIT( 0x80000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, limenko_state,spriteram_bit_r, NULL) //changes spriteram location
593593   PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_SERVICE1 ) // checked in dynabomb I/O test, but doesn't work in game
594594   PORT_BIT( 0x5f00ffff, IP_ACTIVE_LOW, IPT_UNUSED )
595595
r14883r14884
627627   PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_START1 )
628628   PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_UNUSED )
629629   PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_COIN1 )
630   PORT_BIT( 0x00080000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(spriteram_bit_r, NULL) //changes spriteram location
630   PORT_BIT( 0x00080000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, limenko_state,spriteram_bit_r, NULL) //changes spriteram location
631631   PORT_SERVICE_NO_TOGGLE( 0x00200000, IP_ACTIVE_LOW )
632632   PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_SPECIAL ) //security bit
633633   PORT_BIT( 0x00800000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
src/mame/drivers/jankenmn.c
r14883r14884
151151   jankenmn_state(const machine_config &mconfig, device_type type, const char *tag)
152152      : driver_device(mconfig, type, tag) { }
153153
154   DECLARE_CUSTOM_INPUT_MEMBER(jankenmn_hopper_status_r);
154155};
155156
156157
r14883r14884
214215   // d0, d6, d7: N/C?
215216}
216217
217static CUSTOM_INPUT( jankenmn_hopper_status_r )
218CUSTOM_INPUT_MEMBER(jankenmn_state::jankenmn_hopper_status_r)
218219{
219220   // temp workaround, needs hopper
220   return field.machine().rand();
221   return machine().rand();
221222}
222223
223224
r14883r14884
251252   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C) PORT_NAME("Paa (Paper)")
252253   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
253254   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN3 ) // 100 yen coin
254   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(jankenmn_hopper_status_r, NULL)
255   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, jankenmn_state,jankenmn_hopper_status_r, NULL)
255256   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 ) // 10 yen coin
256257   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) // 10 yen coin
257258
src/mame/drivers/polepos.c
r14883r14884
340340}
341341
342342
343static CUSTOM_INPUT( high_port_r ) { return input_port_read(field.machine(), (const char *)param) >> 4; }
344static CUSTOM_INPUT( low_port_r ) { return input_port_read(field.machine(), (const char *)param) & 0x0f; }
345static CUSTOM_INPUT( auto_start_r )
343CUSTOM_INPUT_MEMBER(polepos_state::high_port_r){ return input_port_read(field.machine(), (const char *)param) >> 4; }
344CUSTOM_INPUT_MEMBER(polepos_state::low_port_r){ return input_port_read(field.machine(), (const char *)param) & 0x0f; }
345CUSTOM_INPUT_MEMBER(polepos_state::auto_start_r)
346346{
347   polepos_state *state = field.machine().driver_data<polepos_state>();
348   return state->m_auto_start_mask;
347   return m_auto_start_mask;
349348}
350349
351350static WRITE8_DEVICE_HANDLER( out_0 )
r14883r14884
533532   PORT_START("IN0L")
534533   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
535534   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Gear Change") PORT_CODE(KEYCODE_SPACE) POLEPOS_TOGGLE /* Gear */
536   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(auto_start_r, NULL)   // start 1, program controlled
535   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,auto_start_r, NULL)   // start 1, program controlled
537536   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
538537
539538   PORT_START("IN0H")
r14883r14884
567566   PORT_DIPSETTING(   0x00, "4" )
568567
569568   PORT_START("DSWA_HI")
570   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWA")
569   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWA")
571570
572571   PORT_START("DSWB")
573572   PORT_DIPNAME( 0x07, 0x07, "Extended Rank" )
r14883r14884
596595   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
597596
598597   PORT_START("DSWB_HI")
599   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWB")
598   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWB")
600599
601600   PORT_START("BRAKE")
602601   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0,0x90) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
r14883r14884
675674   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
676675
677676   PORT_START("IN0L")
678   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(low_port_r, "IN0")
677   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,low_port_r, "IN0")
679678
680679   PORT_START("IN0H")
681   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "IN0")
680   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "IN0")
682681
683682   PORT_START("DSWA")
684683   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
r14883r14884
705704   PORT_DIPSETTING(   0x00, "4" )
706705
707706   PORT_START("DSWA_HI")
708   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWA")
707   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWA")
709708
710709   /* FIXME: these dips don't work and may not even exist on this bootleg */
711710   PORT_START("DSWB")
r14883r14884
735734   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
736735
737736   PORT_START("DSWB_HI")
738   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(high_port_r, "DSWB")
737   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, polepos_state,high_port_r, "DSWB")
739738
740739   PORT_START("BRAKE")
741740   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0,0x90) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
src/mame/drivers/qdrmfgp.c
r14883r14884
3737 *
3838 *************************************/
3939
40static CUSTOM_INPUT( inputs_r )
40CUSTOM_INPUT_MEMBER(qdrmfgp_state::inputs_r)
4141{
42   qdrmfgp_state *state = field.machine().driver_data<qdrmfgp_state>();
4342   const char *tag1 = (const char *)param;
4443   const char *tag2 = tag1 + strlen(tag1) + 1;
45   return input_port_read(field.machine(), (state->m_control & 0x0080) ? tag1 : tag2);
44   return input_port_read(machine(), (m_control & 0x0080) ? tag1 : tag2);
4645}
4746
48static CUSTOM_INPUT( battery_sensor_r )
47CUSTOM_INPUT_MEMBER(qdrmfgp_state::battery_sensor_r)
4948{
5049   /* bit 0-1  battery power sensor: 3=good, 2=low, other=bad */
5150   return 0x0003;
r14883r14884
385384
386385static INPUT_PORTS_START( qdrmfgp )
387386   PORT_START("340000")
388   PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(inputs_r, "INPUTS\0DSW")
387   PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, qdrmfgp_state,inputs_r, "INPUTS\0DSW")
389388
390389   PORT_START("INPUTS")
391390   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
r14883r14884
460459   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Hard ) )
461460
462461   PORT_START("SENSOR")
463   PORT_BIT( 0x0003, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(battery_sensor_r, NULL)   /* battery power sensor */
462   PORT_BIT( 0x0003, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, qdrmfgp_state,battery_sensor_r, NULL)   /* battery power sensor */
464463   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE2 )
465464   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE3 )
466465   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
468467
469468static INPUT_PORTS_START( qdrmfgp2 )
470469   PORT_START("340000")
471   PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(inputs_r, "INPUTS\0DSW")
470   PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, qdrmfgp_state,inputs_r, "INPUTS\0DSW")
472471
473472   PORT_START("INPUTS")
474473   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
r14883r14884
543542   PORT_DIPSETTING(      0x0000, DEF_STR( Very_Hard ) )
544543
545544   PORT_START("SENSOR")
546   PORT_BIT( 0x0003, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(battery_sensor_r, NULL)   /* battery power sensor */
545   PORT_BIT( 0x0003, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, qdrmfgp_state,battery_sensor_r, NULL)   /* battery power sensor */
547546   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE2 )
548547   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE3 )
549548   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNUSED )
src/mame/drivers/scobra.c
r14883r14884
4949   UINT8 *m_soundram;
5050   DECLARE_READ8_MEMBER(scobra_soundram_r);
5151   DECLARE_WRITE8_MEMBER(scobra_soundram_w);
52   DECLARE_CUSTOM_INPUT_MEMBER(stratgyx_coinage_r);
5253};
5354
5455
r14883r14884
263264ADDRESS_MAP_END
264265
265266/* stratgyx coinage DIPs are spread across two input ports */
266static CUSTOM_INPUT( stratgyx_coinage_r )
267CUSTOM_INPUT_MEMBER(scobra_state::stratgyx_coinage_r)
267268{
268269   int bit_mask = (FPTR)param;
269   return (input_port_read(field.machine(), "IN4") & bit_mask) ? 0x01 : 0x00;
270   return (input_port_read(machine(), "IN4") & bit_mask) ? 0x01 : 0x00;
270271}
271272
272273
r14883r14884
296297
297298   PORT_START("IN2")
298299   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
299   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stratgyx_coinage_r, (void *)0x01) /* lower 2 coinage DIPs */
300   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stratgyx_coinage_r, (void *)0x02) /* lower 2 coinage DIPs */
300   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, scobra_state,stratgyx_coinage_r, (void *)0x01) /* lower 2 coinage DIPs */
301   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, scobra_state,stratgyx_coinage_r, (void *)0x02) /* lower 2 coinage DIPs */
301302   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )
302303   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
303304   PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
r14883r14884
307308   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
308309
309310   PORT_START("IN3")
310   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stratgyx_coinage_r, (void *)0x04) /* upper 2 coinage DIPs */
311   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stratgyx_coinage_r, (void *)0x08) /* upper 2 coinage DIPs */
311   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, scobra_state,stratgyx_coinage_r, (void *)0x04) /* upper 2 coinage DIPs */
312   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, scobra_state,stratgyx_coinage_r, (void *)0x08) /* upper 2 coinage DIPs */
312313   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )   /* none of these appear to be used */
313314   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
314315   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r14883r14884
367368   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Lives ) )
368369   PORT_DIPSETTING(    0x00, "3" )
369370   PORT_DIPSETTING(    0x02, "5" )
370   PORT_BIT( 0xfc, 0x00, IPT_SPECIAL ) PORT_CUSTOM(darkplnt_custom_r, "DIAL")   /* scrambled dial */
371   PORT_BIT( 0xfc, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF,scobra_state, darkplnt_custom_r, "DIAL")   /* scrambled dial */
371372
372373   PORT_START("IN2")
373374   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/stactics.c
r14883r14884
5353 *
5454 *************************************/
5555
56static CUSTOM_INPUT( get_motor_not_ready )
56CUSTOM_INPUT_MEMBER(stactics_state::get_motor_not_ready)
5757{
58   stactics_state *state = field.machine().driver_data<stactics_state>();
5958
6059   /* if the motor is self-centering, but not centered yet */
61    return ((*state->m_motor_on & 0x01) == 0) &&
62          ((state->m_horiz_pos != 0) || (state->m_vert_pos != 0));
60    return ((*m_motor_on & 0x01) == 0) &&
61          ((m_horiz_pos != 0) || (m_vert_pos != 0));
6362}
6463
6564
r14883r14884
125124 *
126125 *************************************/
127126
128static CUSTOM_INPUT( get_rng )
127CUSTOM_INPUT_MEMBER(stactics_state::get_rng)
129128{
130129   /* this is a 555 timer, but cannot read one of the resistor values */
131   return field.machine().rand() & 0x07;
130   return machine().rand() & 0x07;
132131}
133132
134133
r14883r14884
216215    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
217216    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
218217    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
219    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_motor_not_ready, NULL)
218    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state,get_motor_not_ready, NULL)
220219
221220    PORT_START("IN1")   /* IN1 */
222221    PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_B ) )
r14883r14884
245244    PORT_DIPSETTING(    0x00, DEF_STR( On ) )
246245
247246    PORT_START("IN2")   /* IN2 */
248    PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_rng, NULL)
249    PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_frame_count_d3, NULL)
247    PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state,get_rng, NULL)
248    PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state,stactics_get_frame_count_d3, NULL)
250249    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
251250    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
252251    PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
r14883r14884
256255
257256    PORT_START("IN3")   /* IN3 */
258257    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
259    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_shot_standby, NULL)
258    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state,stactics_get_shot_standby, NULL)
260259    PORT_DIPNAME( 0x04, 0x04, "Number of Barriers" )
261260    PORT_DIPSETTING(    0x04, "4" )
262261    PORT_DIPSETTING(    0x00, "6" )
r14883r14884
268267    PORT_DIPSETTING(    0x00, DEF_STR( On ) )
269268    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
270269    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
271    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_not_shot_arrive, NULL)
270    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state,stactics_get_not_shot_arrive, NULL)
272271
273272   PORT_START("FAKE")   /* FAKE */
274273    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
src/mame/drivers/lethalj.c
r14883r14884
159159 *
160160 *************************************/
161161
162static CUSTOM_INPUT( cclownz_paddle )
162CUSTOM_INPUT_MEMBER(lethalj_state::cclownz_paddle)
163163{
164   int value = input_port_read(field.machine(), "PADDLE");
164   int value = input_port_read(machine(), "PADDLE");
165165   return ((value << 4) & 0xf00) | (value & 0x00f);
166166}
167167
r14883r14884
541541   PORT_DIPSETTING(      0x0000, "3000" )
542542
543543   PORT_START("IN1")
544   PORT_BIT( 0x0f0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(cclownz_paddle, NULL)
544   PORT_BIT( 0x0f0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, lethalj_state,cclownz_paddle, NULL)
545545   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)
546546   PORT_BIT( 0x0060, IP_ACTIVE_LOW, IPT_UNUSED )
547547   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
src/mame/drivers/itech8.c
r14883r14884
726726 *
727727 *************************************/
728728
729static CUSTOM_INPUT( special_r )
729CUSTOM_INPUT_MEMBER(itech8_state::special_r)
730730{
731   itech8_state *state = field.machine().driver_data<itech8_state>();
732   return state->m_pia_portb_data & 0x01;
731   return m_pia_portb_data & 0x01;
733732}
734733
735734
r14883r14884
993992
994993static INPUT_PORTS_START( wfortune )
995994   PORT_START("40")
996   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
995   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
997996   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
998997   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ) )
999998   PORT_DIPSETTING(    0x08, DEF_STR( Upright ) )
r14883r14884
10221021
10231022static INPUT_PORTS_START( grmatch )
10241023   PORT_START("40")
1025   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1024   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
10261025   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
10271026   PORT_DIPNAME( 0x08, 0x08, "Adjustments Lockout" )
10281027   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
r14883r14884
10601059
10611060static INPUT_PORTS_START( stratab )
10621061   PORT_START("40")
1063   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1062   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
10641063   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
10651064   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ) )
10661065   PORT_DIPSETTING(    0x08, DEF_STR( Upright ) )
r14883r14884
10951094INPUT_PORTS_END
10961095
10971096
1098static CUSTOM_INPUT( gtg_mux )
1097CUSTOM_INPUT_MEMBER(itech8_state::gtg_mux)
10991098{
11001099   const char *tag1 = (const char *)param;
11011100   const char *tag2 = tag1 + strlen(tag1) + 1;
1102   return input_port_read(field.machine(), tag1) & input_port_read(field.machine(), tag2);
1101   return input_port_read(machine(), tag1) & input_port_read(machine(), tag2);
11031102}
11041103
11051104static INPUT_PORTS_START( gtg )
11061105   PORT_START("40")
1107   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1106   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
11081107   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
11091108   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ) )
11101109   PORT_DIPSETTING(    0x08, DEF_STR( Upright ) )
r14883r14884
11151114   PORT_START("60")
11161115   /* it is still unknown how the second player inputs are muxed in */
11171116   /* currently we map both sets of controls to the same inputs */
1118   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gtg_mux, "P1\0P2")
1117   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,gtg_mux, "P1\0P2")
11191118   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
11201119   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
11211120   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
11411140
11421141static INPUT_PORTS_START( gtgt )
11431142   PORT_START("40")
1144   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1143   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
11451144   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
11461145   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
11471146
r14883r14884
11681167
11691168static INPUT_PORTS_START( gtg2t )
11701169   PORT_START("40")
1171   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1170   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
11721171   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
11731172   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ) )
11741173   PORT_DIPSETTING(    0x08, DEF_STR( Upright ) )
r14883r14884
12051204
12061205static INPUT_PORTS_START( slikshot )
12071206   PORT_START("40")
1208   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1207   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
12091208   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
12101209   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
12111210
r14883r14884
12321231
12331232static INPUT_PORTS_START( dynobop )
12341233   PORT_START("40")
1235   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1234   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
12361235   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
12371236   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
12381237
r14883r14884
12591258
12601259static INPUT_PORTS_START( sstrike )
12611260   PORT_START("40")
1262   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1261   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
12631262   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNKNOWN )
12641263   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
12651264
r14883r14884
12861285
12871286static INPUT_PORTS_START( pokrdice )
12881287   PORT_START("40")
1289   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1288   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
12901289   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Lower Right") PORT_CODE(KEYCODE_3_PAD)
12911290   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
12921291   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ) )
r14883r14884
13151314
13161315static INPUT_PORTS_START( hstennis )
13171316   PORT_START("40")
1318   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1317   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
13191318   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
13201319   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ) )
13211320   PORT_DIPSETTING(    0x08, DEF_STR( Upright ) )
r14883r14884
13501349
13511350static INPUT_PORTS_START( arlingtn )
13521351   PORT_START("40")
1353   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1352   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
13541353   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
13551354   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )   /* see code at e23c */
13561355   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
r14883r14884
13811380
13821381static INPUT_PORTS_START( peggle )
13831382   PORT_START("40")
1384   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1383   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
13851384   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED )
13861385   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
13871386
r14883r14884
14031402
14041403static INPUT_PORTS_START( pegglet )
14051404   PORT_START("40")
1406   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1405   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
14071406   PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED )
14081407   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
14091408
r14883r14884
14251424
14261425static INPUT_PORTS_START( neckneck )
14271426   PORT_START("40")
1428   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1427   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
14291428   PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNUSED )
14301429   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )   /* see code at e23c */
14311430   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
r14883r14884
14661465   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )
14671466   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN4 )
14681467   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1469   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(special_r, NULL)   /* input from sound board */
1468   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, itech8_state,special_r, NULL)   /* input from sound board */
14701469
14711470   PORT_START("80")
14721471   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/galaxian.c
r14883r14884
726726}
727727
728728
729static CUSTOM_INPUT( scramble_protection_alt_r )
729CUSTOM_INPUT_MEMBER(galaxian_state::scramble_protection_alt_r)
730730{
731   galaxian_state *state = field.machine().driver_data<galaxian_state>();
732731   /*
733732        There are two additional bits that are derived from bit 7 of
734733        the protection result. This is just a guess but works well enough
735734        to boot scrambls.
736735    */
737   return (state->m_protection_result >> 7) & 1;
736   return (m_protection_result >> 7) & 1;
738737}
739738
740739
r14883r14884
11021101}
11031102
11041103
1105static CUSTOM_INPUT( gmgalax_port_r )
1104CUSTOM_INPUT_MEMBER(galaxian_state::gmgalax_port_r)
11061105{
1107   galaxian_state *state = field.machine().driver_data<galaxian_state>();
11081106   const char *portname = (const char *)param;
1109   if (state->m_gmgalax_selected_game != 0)
1107   if (m_gmgalax_selected_game != 0)
11101108      portname += strlen(portname) + 1;
1111   return input_port_read(field.machine(), portname);
1109   return input_port_read(machine(), portname);
11121110}
11131111
11141112
r14883r14884
11581156 *
11591157 *************************************/
11601158
1161static CUSTOM_INPUT( azurian_port_r )
1159CUSTOM_INPUT_MEMBER(galaxian_state::azurian_port_r)
11621160{
1163   return (input_port_read(field.machine(), "FAKE") >> (FPTR)param) & 1;
1161   return (input_port_read(machine(), "FAKE") >> (FPTR)param) & 1;
11641162}
11651163
11661164
r14883r14884
11711169 *
11721170 *************************************/
11731171
1174static CUSTOM_INPUT( kingball_muxbit_r )
1172CUSTOM_INPUT_MEMBER(galaxian_state::kingball_muxbit_r)
11751173{
1176   galaxian_state *state = field.machine().driver_data<galaxian_state>();
11771174   /* multiplex the service mode switch with a speech DIP switch */
1178   return (input_port_read(field.machine(), "FAKE") >> state->m_kingball_speech_dip) & 1;
1175   return (input_port_read(machine(), "FAKE") >> m_kingball_speech_dip) & 1;
11791176}
11801177
11811178
1182static CUSTOM_INPUT( kingball_noise_r )
1179CUSTOM_INPUT_MEMBER(galaxian_state::kingball_noise_r)
11831180{
11841181   /* bit 5 is the NOISE line from the sound circuit.  The code just verifies
11851182       that it's working, doesn't actually use return value, so we can just use
11861183       rand() */
1187   return field.machine().rand() & 1;
1184   return machine().rand() & 1;
11881185}
11891186
11901187
src/mame/drivers/flstory.c
r14883r14884
117117   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE(m_workram) /* work RAM */
118118ADDRESS_MAP_END
119119
120static CUSTOM_INPUT( victnine_mcu_status_bit01_r )
120CUSTOM_INPUT_MEMBER(flstory_state::victnine_mcu_status_bit01_r)
121121{
122   flstory_state *state = field.machine().driver_data<flstory_state>();
123   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
122   address_space *space = m_maincpu->memory().space(AS_PROGRAM);
124123
125   return (state->victnine_mcu_status_r(*space, 0) & 3);
124   return (victnine_mcu_status_r(*space, 0) & 3);
126125}
127126
128127static ADDRESS_MAP_START( victnine_map, AS_PROGRAM, 8, flstory_state )
r14883r14884
785784   /* bits 0,1 are MCU related:
786785        - bit 0: mcu is ready to receive data from main cpu
787786        - bit 1: mcu has sent data to the main cpu       */
788   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(victnine_mcu_status_bit01_r, NULL)
787   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, flstory_state,victnine_mcu_status_bit01_r, NULL)
789788   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
790789   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 )
791790   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 )
r14883r14884
928927   /* bits 0,1 are MCU related:
929928        - bit 0: mcu is ready to receive data from main cpu
930929        - bit 1: mcu has sent data to the main cpu       */
931   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(victnine_mcu_status_bit01_r, NULL)
930   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, flstory_state,victnine_mcu_status_bit01_r, NULL)
932931   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
933932   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
934933   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/taitojc.c
r14883r14884
11631163
11641164/* Mascon must always be in a defined state, Densha de Go 2 in particular returns black screen if the Mascon input is undefined
11651165   We convert the 6 lever "shifter" into a fake analog port for now. */
1166static CUSTOM_INPUT( mascon_state_r )
1166CUSTOM_INPUT_MEMBER(taitojc_state::mascon_state_r)
11671167{
11681168   static const UINT8 mascon_table[6] = { 0x01, 0x10, 0x02, 0x20, 0x04, 0x40 };
1169   UINT8 res = input_port_read(field.machine(), "MASCON");
1169   UINT8 res = input_port_read(machine(), "MASCON");
11701170   int i;
11711171
11721172   //popmessage("%02x",res);
r14883r14884
12051205   PORT_START("BUTTONS")
12061206   /* TODO: fix this */
12071207   PORT_BIT( 0x88, IP_ACTIVE_LOW, IPT_UNUSED )
1208   PORT_BIT( 0x77, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(mascon_state_r,NULL)
1208   PORT_BIT( 0x77, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taitojc_state,mascon_state_r,NULL)
12091209//  PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Mascon 5")      // Mascon 5
12101210//  PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Mascon 3")      // Mascon 3
12111211//  PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Mascon 1")      // Mascon 1
src/mame/drivers/suprridr.c
r14883r14884
224224#define SUPRRIDR_P1_CONTROL_PORT_TAG   ("CONTP1")
225225#define SUPRRIDR_P2_CONTROL_PORT_TAG   ("CONTP2")
226226
227static CUSTOM_INPUT( suprridr_control_r )
227CUSTOM_INPUT_MEMBER(suprridr_state::suprridr_control_r)
228228{
229229   UINT32 ret;
230230
231231   /* screen flip multiplexes controls */
232   if (suprridr_is_screen_flipped(field.machine()))
233      ret = input_port_read(field.machine(), SUPRRIDR_P2_CONTROL_PORT_TAG);
232   if (suprridr_is_screen_flipped(machine()))
233      ret = input_port_read(machine(), SUPRRIDR_P2_CONTROL_PORT_TAG);
234234   else
235      ret = input_port_read(field.machine(), SUPRRIDR_P1_CONTROL_PORT_TAG);
235      ret = input_port_read(machine(), SUPRRIDR_P1_CONTROL_PORT_TAG);
236236
237237   return ret;
238238}
r14883r14884
240240
241241static INPUT_PORTS_START( suprridr )
242242   PORT_START("INPUTS")
243   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(suprridr_control_r, NULL)
243   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, suprridr_state,suprridr_control_r, NULL)
244244
245245   PORT_START("SYSTEM")
246246   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
src/mame/drivers/igs009.c
r14883r14884
6060   DECLARE_WRITE8_MEMBER(jingbell_magic_w);
6161   DECLARE_READ8_MEMBER(jingbell_magic_r);
6262   void show_out();
63   DECLARE_CUSTOM_INPUT_MEMBER(hopper_r);
6364};
6465
6566
r14883r14884
343344***************************************************************************/
344345
345346
346static CUSTOM_INPUT( hopper_r )
347CUSTOM_INPUT_MEMBER(igs009_state::hopper_r)
347348{
348   igs009_state *state = field.machine().driver_data<igs009_state>();
349   return state->m_hopper && !(field.machine().primary_screen->frame_number()%10);
349   return m_hopper && !(machine().primary_screen->frame_number()%10);
350350}
351351
352352
r14883r14884
549549   PORT_START("SERVICE")
550550   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
551551   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Memory Clear")   // stats, memory
552   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM( hopper_r, (void *)0 )   // hopper sensor
552   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF,igs009_state,hopper_r, (void *)0 )   // hopper sensor
553553   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
554554   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) PORT_NAME("Pay Out")
555555   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )   // test (press during boot)
src/mame/drivers/psikyo.c
r14883r14884
7777
7878***************************************************************************/
7979
80static CUSTOM_INPUT( z80_nmi_r )
80CUSTOM_INPUT_MEMBER(psikyo_state::z80_nmi_r)
8181{
82   psikyo_state *state = field.machine().driver_data<psikyo_state>();
8382   int ret = 0x00;
8483
85   if (state->m_z80_nmi)
84   if (m_z80_nmi)
8685   {
8786      ret = 0x01;
8887
8988      /* main CPU might be waiting for sound CPU to finish NMI,
9089           so set a timer to give sound CPU a chance to run */
91      field.machine().scheduler().synchronize();
90      machine().scheduler().synchronize();
9291//      logerror("%s - Read coin port during Z80 NMI\n", machine.describe_context());
9392   }
9493
9594   return ret;
9695}
9796
98static CUSTOM_INPUT( mcu_status_r )
97CUSTOM_INPUT_MEMBER(psikyo_state::mcu_status_r)
9998{
100   psikyo_state *state = field.machine().driver_data<psikyo_state>();
10199   int ret = 0x00;
102100
103101   /* Don't know exactly what this bit is, but s1945 and tengai
r14883r14884
114112
115113        Interestingly, s1945jn has the code that spins on this bit,
116114        but said code is never reached.  Prototype? */
117   if (state->m_mcu_status)
115   if (m_mcu_status)
118116      ret = 0x01;
119117
120   state->m_mcu_status = !state->m_mcu_status;   /* hack */
118   m_mcu_status = !m_mcu_status;   /* hack */
121119
122120   return ret;
123121}
r14883r14884
582580   PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_SERVICE1 )
583581   PORT_SERVICE_NO_TOGGLE( 0x00200000, IP_ACTIVE_LOW )
584582   PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_TILT )
585   PORT_BIT( 0x00800000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(z80_nmi_r, NULL)   // From Sound CPU
583   PORT_BIT( 0x00800000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo_state,z80_nmi_r, NULL)   // From Sound CPU
586584   PORT_BIT( 0xff000000, IP_ACTIVE_LOW, IPT_UNKNOWN )   // unused?
587585
588586   PORT_MODIFY("DSW")      /* c00004 -> c00007 */
r14883r14884
652650   PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_SERVICE1 )
653651   PORT_SERVICE_NO_TOGGLE( 0x00000020, IP_ACTIVE_LOW )
654652   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_TILT )
655   PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(z80_nmi_r, NULL)   // From Sound CPU
653   PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo_state,z80_nmi_r, NULL)   // From Sound CPU
656654   PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_UNKNOWN )
657655   PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
658656   PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
r14883r14884
739737   PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_SERVICE1 )
740738   PORT_SERVICE_NO_TOGGLE( 0x00000020, IP_ACTIVE_LOW )
741739   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_TILT )
742   PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(z80_nmi_r, NULL)   // From Sound CPU
740   PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo_state,z80_nmi_r, NULL)   // From Sound CPU
743741   PORT_BIT( 0x0000ff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
744742
745743   PORT_MODIFY("DSW")      /* c00004 -> c00007 */
r14883r14884
803801   PORT_MODIFY("P1_P2")         /* c00000 -> c00003 */
804802   PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_COIN1 )
805803   PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_COIN2 )
806   PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mcu_status_r, NULL)
804   PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo_state,mcu_status_r, NULL)
807805   PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_UNKNOWN )
808806   PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_SERVICE1 )
809807   PORT_SERVICE_NO_TOGGLE( 0x00000020, IP_ACTIVE_LOW )
810808   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_TILT )
811   PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(z80_nmi_r, NULL)   // From Sound CPU
809   PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo_state,z80_nmi_r, NULL)   // From Sound CPU
812810   PORT_BIT( 0x0000ff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
813811
814812   PORT_MODIFY("DSW")      /* c00004 -> c00007 */
r14883r14884
927925   PORT_MODIFY("P1_P2")         /* c00000 -> c00003 */
928926   PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_COIN1 )
929927   PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_COIN2 )
930   PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mcu_status_r, NULL)
928   PORT_BIT( 0x00000004, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo_state,mcu_status_r, NULL)
931929   PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_UNKNOWN )
932930   PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_SERVICE1 )
933931   PORT_SERVICE_NO_TOGGLE( 0x00000020, IP_ACTIVE_LOW )
934932   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_TILT )
935   PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(z80_nmi_r, NULL)   // From Sound CPU
933   PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo_state,z80_nmi_r, NULL)   // From Sound CPU
936934   PORT_BIT( 0x0000ff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
937935
938936   PORT_MODIFY("DSW")      /* c00004 -> c00007 */
src/mame/drivers/dacholer.c
r14883r14884
8181   DECLARE_WRITE8_MEMBER(snd_ack_w);
8282   DECLARE_WRITE8_MEMBER(snd_irq_w);
8383   DECLARE_WRITE8_MEMBER(music_irq_w);
84   DECLARE_CUSTOM_INPUT_MEMBER(snd_ack_r);
8485};
8586
8687static TILE_GET_INFO( get_bg_tile_info )
r14883r14884
266267   m_snd_ack = data;
267268}
268269
269static CUSTOM_INPUT( snd_ack_r )
270CUSTOM_INPUT_MEMBER(dacholer_state::snd_ack_r)
270271{
271   dacholer_state *state = field.machine().driver_data<dacholer_state>();
272   return state->m_snd_ack;      //guess ...
272   return m_snd_ack;      //guess ...
273273}
274274
275275WRITE8_MEMBER(dacholer_state::snd_irq_w)
r14883r14884
345345   PORT_DIPSETTING(    0x04, DEF_STR( 5C_1C ) )
346346   PORT_DIPSETTING(    0x08, DEF_STR( 4C_1C ) )
347347   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
348   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(snd_ack_r, NULL)
348   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dacholer_state,snd_ack_r, NULL)
349349
350350   PORT_START("DSWB")
351351   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )            /* table at 0x0a9c */
src/mame/drivers/pastelg.c
r14883r14884
212212INPUT_PORTS_END
213213
214214// stops the game hanging..
215static CUSTOM_INPUT( nb1413m3_hackbusyflag_r )
215CUSTOM_INPUT_MEMBER(pastelg_state::nb1413m3_hackbusyflag_r)
216216{
217   return field.machine().rand() & 3;
217   return machine().rand() & 3;
218218}
219219
220220static INPUT_PORTS_START( threeds )
r14883r14884
369369   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
370370
371371   PORT_START("SYSTEM")
372   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(nb1413m3_hackbusyflag_r, NULL)   // DRAW BUSY
372   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, pastelg_state,nb1413m3_hackbusyflag_r, NULL)   // DRAW BUSY
373373   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE3 )      // MEMORY RESET
374374   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2 )      // ANALYZER
375375   PORT_SERVICE( 0x10, IP_ACTIVE_LOW )               // TEST
src/mame/drivers/galastrm.c
r14883r14884
8787}
8888
8989
90static CUSTOM_INPUT( frame_counter_r )
90CUSTOM_INPUT_MEMBER(galastrm_state::frame_counter_r)
9191{
92   galastrm_state *state = field.machine().driver_data<galastrm_state>();
93   return state->m_frame_counter;
92   return m_frame_counter;
9493}
9594
96static CUSTOM_INPUT( coin_word_r )
95CUSTOM_INPUT_MEMBER(galastrm_state::coin_word_r)
9796{
98   galastrm_state *state = field.machine().driver_data<galastrm_state>();
99   return state->m_coin_word;
97   return m_coin_word;
10098}
10199
102100WRITE32_MEMBER(galastrm_state::galastrm_input_w)
r14883r14884
202200   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
203201   PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
204202   PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_START1 )
205   PORT_BIT( 0x00000200, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(frame_counter_r, NULL)
203   PORT_BIT( 0x00000200, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galastrm_state,frame_counter_r, NULL)
206204   PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_UNKNOWN )
207205   PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_UNKNOWN )
208206   PORT_BIT( 0x00001000, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14883r14884
228226   PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_UNKNOWN )
229227   PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_UNKNOWN )
230228   PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNKNOWN )
231   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_word_r, NULL)
229   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galastrm_state,coin_word_r, NULL)
232230
233231   PORT_START("STICKX")
234232   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(60) PORT_KEYDELTA(15) PORT_PLAYER(1)
src/mame/drivers/tetrisp2.c
r14883r14884
252252      m_rocknms_main2sub = (data ^ 0xffff);
253253}
254254
255static CUSTOM_INPUT( rocknms_main2sub_status_r )
255CUSTOM_INPUT_MEMBER(tetrisp2_state::rocknms_main2sub_status_r)
256256{
257   tetrisp2_state *state = field.machine().driver_data<tetrisp2_state>();
258   return  state->m_rocknms_sub2main & 0x0003;
257   return  m_rocknms_sub2main & 0x0003;
259258}
260259
261260WRITE16_MEMBER(tetrisp2_state::rocknms_sub2main_w)
r14883r14884
858857
859858static INPUT_PORTS_START( rocknms )
860859   PORT_START("PLAYERS")   // IN0 - $be0002.w
861   PORT_BIT( 0x0003, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(rocknms_main2sub_status_r, NULL)   // MAIN -> SUB Communication
860   PORT_BIT( 0x0003, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, tetrisp2_state,rocknms_main2sub_status_r, NULL)   // MAIN -> SUB Communication
862861   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
863862   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
864863   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
src/mame/drivers/namcos22.c
r14883r14884
47624762
47634763/*******************************************************************/
47644764
4765static CUSTOM_INPUT( alpine_motor_read )
4765CUSTOM_INPUT_MEMBER(namcos22_state::alpine_motor_read)
47664766{
4767   namcos22_state *state = field.machine().driver_data<namcos22_state>();
4768   return state->m_motor_status >> (FPTR)param & 1;
4767   return m_motor_status >> (FPTR)param & 1;
47694768}
47704769
47714770static INPUT_PORTS_START( alpiner )
r14883r14884
48034802   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START ) // Decision / View Change
48044803   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_16WAY // L Selection
48054804   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_16WAY // R Selection
4806   PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_CUSTOM(alpine_motor_read, (void *)0) // steps are free
4805   PORT_BIT( 0x80, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, namcos22_state,alpine_motor_read, (void *)0) // steps are free
48074806
48084807   PORT_START("SWING")
48094808   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_NAME("Steps Swing")
r14883r14884
48124811   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_NAME("Steps Edge")
48134812
48144813   PORT_START("MCUP5B")
4815   PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_CUSTOM(alpine_motor_read, (void *)1) // steps are locked
4814   PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, namcos22_state,alpine_motor_read, (void *)1) // steps are locked
48164815   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
48174816INPUT_PORTS_END /* Alpine Racer */
48184817
src/mame/drivers/galaxold.c
r14883r14884
916916
917917
918918/* Lives Dips are spread across two input ports */
919static CUSTOM_INPUT( vpool_lives_r )
919CUSTOM_INPUT_MEMBER(galaxold_state::vpool_lives_r)
920920{
921921   int bit_mask = (FPTR)param;
922922
923923   switch (bit_mask)
924924   {
925925      case 0x40:  /* vpool : IN1 (0xa800) bit 6 */
926         return ((input_port_read(field.machine(), "LIVES") & bit_mask) >> 6);
926         return ((input_port_read(machine(), "LIVES") & bit_mask) >> 6);
927927      case 0x01:  /* vpool : DSW (0xb000) bit 0 */
928         return ((input_port_read(field.machine(), "LIVES") & bit_mask) >> 0);
928         return ((input_port_read(machine(), "LIVES") & bit_mask) >> 0);
929929
930930      default:
931931         logerror("vpool_lives_r : invalid %02X bit_mask\n",bit_mask);
r14883r14884
952952   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL
953953   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
954954   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
955   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vpool_lives_r, (void *)0x40)
955   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,vpool_lives_r, (void *)0x40)
956956   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
957957
958958   PORT_START("DSW0")
959   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(vpool_lives_r, (void *)0x01)
959   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,vpool_lives_r, (void *)0x01)
960960   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Cabinet ) )
961961   PORT_DIPSETTING(    0x02, DEF_STR( Upright ) )
962962   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
r14883r14884
10631063
10641064
10651065/* Coinage Dips are spread across two input ports */
1066static CUSTOM_INPUT( ckongg_coinage_r )
1066CUSTOM_INPUT_MEMBER(galaxold_state::ckongg_coinage_r)
10671067{
10681068   int bit_mask = (FPTR)param;
10691069
10701070   switch (bit_mask)
10711071   {
10721072      case 0x0c:  /* ckongg  : DSW (0xc800) bits 2 and 3 */
1073         return ((input_port_read(field.machine(), "COINAGE") & bit_mask) >> 2);
1073         return ((input_port_read(machine(), "COINAGE") & bit_mask) >> 2);
10741074      case 0x40:  /* ckongg  : IN1 (0xc400) bit 6 */
1075         return ((input_port_read(field.machine(), "COINAGE") & bit_mask) >> 6);
1075         return ((input_port_read(machine(), "COINAGE") & bit_mask) >> 6);
10761076
10771077      case 0xc0:  /* ckongmc : IN1 (0xa800) bits 6 and 7 */
1078         return ((input_port_read(field.machine(), "COINAGE") & bit_mask) >> 6);
1078         return ((input_port_read(machine(), "COINAGE") & bit_mask) >> 6);
10791079      case 0x01:  /* ckongmc : DSW (0xb000) bit 0 */
1080         return ((input_port_read(field.machine(), "COINAGE") & bit_mask) >> 0);
1080         return ((input_port_read(machine(), "COINAGE") & bit_mask) >> 0);
10811081
10821082      default:
10831083         logerror("ckongg_coinage_r : invalid %02X bit_mask\n",bit_mask);
r14883r14884
11041104   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
11051105   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )    PORT_4WAY PORT_COCKTAIL
11061106   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )  PORT_4WAY PORT_COCKTAIL
1107   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ckongg_coinage_r, (void *)0x40)
1107   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,ckongg_coinage_r, (void *)0x40)
11081108   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
11091109   PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
11101110   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
r14883r14884
11151115   PORT_DIPSETTING(    0x01, "4" )
11161116   PORT_DIPSETTING(    0x02, "5" )
11171117   PORT_DIPSETTING(    0x03, "6" )
1118   PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ckongg_coinage_r, (void *)0x0c)
1118   PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,ckongg_coinage_r, (void *)0x0c)
11191119   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
11201120
11211121   PORT_START("COINAGE")
r14883r14884
11491149   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
11501150   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )    PORT_4WAY PORT_COCKTAIL
11511151   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
1152   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ckongg_coinage_r, (void *)0xc0)
1152   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,ckongg_coinage_r, (void *)0xc0)
11531153
11541154   PORT_START("DSW")
1155   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ckongg_coinage_r, (void *)0x01)
1155   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,ckongg_coinage_r, (void *)0x01)
11561156   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Lives ) )
11571157   PORT_DIPSETTING(    0x00, "3" )
11581158   PORT_DIPSETTING(    0x02, "4" )
r14883r14884
12761276   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
12771277   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
12781278   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
1279   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_4in1_fake_port_r, (void *)0x40)   // See fake ports
1280   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_4in1_fake_port_r, (void *)0x80)   // See fake ports
1279   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,_4in1_fake_port_r, (void *)0x40)   // See fake ports
1280   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,_4in1_fake_port_r, (void *)0x80)   // See fake ports
12811281
12821282   PORT_START("DSW0")
1283   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_4in1_fake_port_r, (void *)0x01)   // See fake ports
1284   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_4in1_fake_port_r, (void *)0x02)   // See fake ports
1283   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,_4in1_fake_port_r, (void *)0x01)   // See fake ports
1284   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,_4in1_fake_port_r, (void *)0x02)   // See fake ports
12851285   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Lives ) )
12861286   PORT_DIPSETTING(    0x00, "3" )         // 2 when continue (Scramble PT2)
12871287   PORT_DIPSETTING(    0x04, "5" )         // 2 when continue (Scramble PT2)
1288   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_4in1_fake_port_r, (void *)0x08)   // See fake ports
1289   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_4in1_fake_port_r, (void *)0x10)   // See fake ports
1290   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(_4in1_fake_port_r, (void *)0x20)   // See fake ports
1288   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,_4in1_fake_port_r, (void *)0x08)   // See fake ports
1289   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,_4in1_fake_port_r, (void *)0x10)   // See fake ports
1290   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,_4in1_fake_port_r, (void *)0x20)   // See fake ports
12911291   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
12921292
12931293   PORT_START("FAKE1")      /* The Ghost Muncher PT3 - FAKE DSW0 (bits 0 to 5) and IN1 (bits 6 and 7) */
r14883r14884
14311431
14321432
14331433/* Coinage Dips are spread across two input ports */
1434static CUSTOM_INPUT( dkongjrm_coinage_r )
1434CUSTOM_INPUT_MEMBER(galaxold_state::dkongjrm_coinage_r)
14351435{
14361436   int bit_mask = (FPTR)param;
14371437
14381438   switch (bit_mask)
14391439   {
14401440      case 0xc0:  /* dkongjrm : IN1 (0xa8??) bits 6 and 7 */
1441         return ((input_port_read(field.machine(), "COINAGE") & bit_mask) >> 6);
1441         return ((input_port_read(machine(), "COINAGE") & bit_mask) >> 6);
14421442      case 0x01:  /* dkongjrm : DSW (0xb0??) bit 0 */
1443         return ((input_port_read(field.machine(), "COINAGE") & bit_mask) >> 0);
1443         return ((input_port_read(machine(), "COINAGE") & bit_mask) >> 0);
14441444
14451445      default:
14461446         logerror("dkongjrm_coinage_r : invalid %02X bit_mask\n",bit_mask);
r14883r14884
14671467   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
14681468   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )    PORT_4WAY PORT_COCKTAIL
14691469   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
1470   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dkongjrm_coinage_r, (void *)0xc0)
1470   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,dkongjrm_coinage_r, (void *)0xc0)
14711471
14721472   PORT_START("DSW")
1473   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dkongjrm_coinage_r, (void *)0x01)
1473   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxold_state,dkongjrm_coinage_r, (void *)0x01)
14741474   PORT_DIPNAME( 0x06, 0x00, DEF_STR( Lives ) )
14751475   PORT_DIPSETTING(   0x00, "3" )
14761476   PORT_DIPSETTING(   0x02, "4" )
src/mame/drivers/cop01.c
r14883r14884
9595}
9696
9797
98static CUSTOM_INPUT( mightguy_area_r )
98CUSTOM_INPUT_MEMBER(cop01_state::mightguy_area_r)
9999{
100100   int bit_mask = (FPTR)param;
101   return (input_port_read(field.machine(), "FAKE") & bit_mask) ? 0x01 : 0x00;
101   return (input_port_read(machine(), "FAKE") & bit_mask) ? 0x01 : 0x00;
102102}
103103
104104WRITE8_MEMBER(cop01_state::cop01_irq_ack_w)
r14883r14884
326326   PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
327327   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
328328   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
329   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mightguy_area_r, (void *)0x04)   // "Start Area" - see fake Dip Switch
329   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cop01_state,mightguy_area_r, (void *)0x04)   // "Start Area" - see fake Dip Switch
330330
331331   PORT_START("DSW2")
332332   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
r14883r14884
344344   PORT_DIPSETTING(   0x20, DEF_STR( Normal ) )
345345   PORT_DIPSETTING(   0x10, DEF_STR( Hard ) )
346346   PORT_DIPSETTING(   0x00, "Invincibility")
347   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mightguy_area_r, (void *)0x01)   // "Start Area" - see fake Dip Switch
348   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mightguy_area_r, (void *)0x02)   // "Start Area" - see fake Dip Switch
347   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cop01_state,mightguy_area_r, (void *)0x01)   // "Start Area" - see fake Dip Switch
348   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cop01_state,mightguy_area_r, (void *)0x02)   // "Start Area" - see fake Dip Switch
349349
350350   PORT_START("FAKE")   /* FAKE Dip Switch */
351351   PORT_DIPNAME( 0x07, 0x07, "Starting Area" )
src/mame/drivers/midvunit.c
r14883r14884
541541
542542static INPUT_PORTS_START( crusnusa )
543543   PORT_START("991030")
544   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
545   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
544   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
545   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
546546
547547   PORT_START("992000")
548   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW")
549   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW")
548   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW")
549   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW")
550550
551551   PORT_START("IN0")
552552   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
673673
674674static INPUT_PORTS_START( crusnwld )
675675   PORT_START("991030")
676   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
677   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
676   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
677   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
678678
679679   PORT_START("992000")
680   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW")
681   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW")
680   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW")
681   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW")
682682
683683   PORT_START("IN0")
684684   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
802802
803803static INPUT_PORTS_START( offroadc )
804804   PORT_START("991030")
805   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
806   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "IN1")
805   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
806   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1")
807807
808808   PORT_START("992000")
809   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW")
810   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW")
809   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW")
810   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW")
811811
812812   PORT_START("IN0")
813813   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
src/mame/drivers/inufuku.c
r14883r14884
111111
112112******************************************************************************/
113113
114static CUSTOM_INPUT( soundflag_r )
114CUSTOM_INPUT_MEMBER(inufuku_state::soundflag_r)
115115{
116   inufuku_state *state = field.machine().driver_data<inufuku_state>();
117   UINT16 soundflag = state->m_pending_command ? 0 : 1;
116   UINT16 soundflag = m_pending_command ? 0 : 1;
118117
119118   return soundflag;
120119}
r14883r14884
232231   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
233232   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
234233   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
235   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(soundflag_r, NULL)   // pending sound command
234   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, inufuku_state,soundflag_r, NULL)   // pending sound command
236235
237236   PORT_START( "EEPROMOUT" )
238237   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_device, write_bit)
src/mame/drivers/jackie.c
r14883r14884
9696   void jackie_unk_reg_lo_w( int offset, UINT8 data, int reg );
9797   void jackie_unk_reg_hi_w( int offset, UINT8 data, int reg );
9898   void show_out();
99   DECLARE_CUSTOM_INPUT_MEMBER(hopper_r);
99100};
100101
101102
r14883r14884
384385   AM_RANGE(0x8000, 0xffff) AM_READ(expram_r)
385386ADDRESS_MAP_END
386387
387static CUSTOM_INPUT( hopper_r )
388CUSTOM_INPUT_MEMBER(jackie_state::hopper_r)
388389{
389   jackie_state *state = field.machine().driver_data<jackie_state>();
390   if (state->m_hopper) return !(field.machine().primary_screen->frame_number()%10);
391   return field.machine().input().code_pressed(KEYCODE_H);
390   if (m_hopper) return !(machine().primary_screen->frame_number()%10);
391   return machine().input().code_pressed(KEYCODE_H);
392392}
393393
394394static INPUT_PORTS_START( jackie )
r14883r14884
464464
465465   PORT_START("SERVICE")
466466   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_9) PORT_NAME("Attendent")
467   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
467   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF,jackie_state,hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
468468   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
469469   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )   // test (press during boot)
470470   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Statistics")
src/mame/drivers/alg.c
r14883r14884
4242   emu_timer *m_serial_timer;
4343   UINT8 m_serial_timer_active;
4444   UINT16 m_input_select;
45   DECLARE_CUSTOM_INPUT_MEMBER(lightgun_pos_r);
46   DECLARE_CUSTOM_INPUT_MEMBER(lightgun_trigger_r);
47   DECLARE_CUSTOM_INPUT_MEMBER(lightgun_holster_r);
4548};
4649
4750static TIMER_CALLBACK( response_timer );
r14883r14884
184187}
185188
186189
187static CUSTOM_INPUT( lightgun_pos_r )
190CUSTOM_INPUT_MEMBER(alg_state::lightgun_pos_r)
188191{
189   alg_state *state = field.machine().driver_data<alg_state>();
190192   int x = 0, y = 0;
191193
192194   /* get the position based on the input select */
193   get_lightgun_pos(*field.machine().primary_screen, state->m_input_select, &x, &y);
195   get_lightgun_pos(*machine().primary_screen, m_input_select, &x, &y);
194196   return (y << 8) | (x >> 2);
195197}
196198
197199
198static CUSTOM_INPUT( lightgun_trigger_r )
200CUSTOM_INPUT_MEMBER(alg_state::lightgun_trigger_r)
199201{
200   alg_state *state = field.machine().driver_data<alg_state>();
201202
202203   /* read the trigger control based on the input select */
203   return (input_port_read(field.machine(), "TRIGGERS") >> state->m_input_select) & 1;
204   return (input_port_read(machine(), "TRIGGERS") >> m_input_select) & 1;
204205}
205206
206207
207static CUSTOM_INPUT( lightgun_holster_r )
208CUSTOM_INPUT_MEMBER(alg_state::lightgun_holster_r)
208209{
209   alg_state *state = field.machine().driver_data<alg_state>();
210210
211211   /* read the holster control based on the input select */
212   return (input_port_read(field.machine(), "TRIGGERS") >> (2 + state->m_input_select)) & 1;
212   return (input_port_read(machine(), "TRIGGERS") >> (2 + m_input_select)) & 1;
213213}
214214
215215
r14883r14884
326326
327327static INPUT_PORTS_START( alg )
328328   PORT_START("JOY0DAT")   /* read by Amiga core */
329   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P1JOY")
329   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, alg_state,amiga_joystick_convert, "P1JOY")
330330   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )
331331
332332   PORT_START("JOY1DAT")   /* read by Amiga core */
333   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P2JOY")
333   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, alg_state,amiga_joystick_convert, "P2JOY")
334334   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )
335335
336336   PORT_START("POTGO")      /* read by Amiga core */
r14883r14884
341341   PORT_BIT( 0xaaff, IP_ACTIVE_HIGH, IPT_UNUSED )
342342
343343   PORT_START("HVPOS")      /* read by Amiga core */
344   PORT_BIT( 0x1ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(lightgun_pos_r, NULL)
344   PORT_BIT( 0x1ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, alg_state,lightgun_pos_r, NULL)
345345
346346   PORT_START("FIRE")
347347   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r14883r14884
372372
373373   PORT_MODIFY("POTGO")
374374   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START2 )
375   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(lightgun_trigger_r, NULL)
375   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, alg_state,lightgun_trigger_r, NULL)
376376
377377   PORT_MODIFY("FIRE")
378378   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
379379
380380   PORT_MODIFY("P2JOY")
381   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(lightgun_holster_r, NULL)
381   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, alg_state,lightgun_holster_r, NULL)
382382
383383   PORT_START("GUN2X")      /* referenced by lightgun_pos_r */
384384   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
src/mame/drivers/segag80v.c
r14883r14884
287287 *
288288 *************************************/
289289
290static CUSTOM_INPUT( elim4_joint_coin_r )
290CUSTOM_INPUT_MEMBER(segag80v_state::elim4_joint_coin_r)
291291{
292   return (input_port_read(field.machine(), "COINS") & 0xf) != 0xf;
292   return (input_port_read(machine(), "COINS") & 0xf) != 0xf;
293293}
294294
295295
r14883r14884
555555   PORT_INCLUDE( g80v_generic )
556556
557557   PORT_MODIFY("D7D6")
558   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(elim4_joint_coin_r, NULL)   /* combination of all four coin inputs */
558   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, segag80v_state,elim4_joint_coin_r, NULL)   /* combination of all four coin inputs */
559559   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
560560   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
561561
src/mame/drivers/dreamwld.c
r14883r14884
502502   PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_PLAYER(1)
503503
504504   PORT_START("c00004")
505   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW")
506   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW")
505   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW")
506   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW")
507507
508508   PORT_START("DSW")
509509   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) )        PORT_DIPLOCATION("SW2:1,2")
src/mame/drivers/astrocde.c
r14883r14884
253253 *
254254 *************************************/
255255
256static CUSTOM_INPUT( ebases_trackball_r )
256CUSTOM_INPUT_MEMBER(astrocde_state::ebases_trackball_r)
257257{
258   astrocde_state *state = field.machine().driver_data<astrocde_state>();
259258   static const char *const names[] = { "TRACKX2", "TRACKY2", "TRACKX1", "TRACKY1" };
260   return input_port_read(field.machine(), names[state->m_input_select]);
259   return input_port_read(machine(), names[m_input_select]);
261260}
262261
263262
r14883r14884
480479}
481480
482481
483static CUSTOM_INPUT( demndragn_joystick_r )
482CUSTOM_INPUT_MEMBER(astrocde_state::demndragn_joystick_r)
484483{
485   astrocde_state *state = field.machine().driver_data<astrocde_state>();
486484   static const char *const names[] = { "MOVEX", "MOVEY" };
487   return input_port_read(field.machine(), names[state->m_input_select]);
485   return input_port_read(machine(), names[m_input_select]);
488486}
489487
490488
r14883r14884
818816   PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "S1:8" )
819817
820818   PORT_START("P4HANDLE")
821   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ebases_trackball_r, NULL)
819   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrocde_state,ebases_trackball_r, NULL)
822820
823821   PORT_START("TRACKX1")
824822   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_RESET
r14883r14884
11441142   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
11451143
11461144   PORT_START("P2HANDLE")
1147   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(demndragn_joystick_r, NULL)
1145   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrocde_state,demndragn_joystick_r, NULL)
11481146
11491147   PORT_START("P3HANDLE")
11501148   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
src/mame/drivers/galaga.c
r14883r14884
777777   }
778778}
779779
780static CUSTOM_INPUT( shifted_port_r ) { return input_port_read(field.machine(), (const char *)param) >> 4; }
780CUSTOM_INPUT_MEMBER(galaga_state::shifted_port_r){ return input_port_read(machine(), (const char *)param) >> 4; }
781781
782782static WRITE8_DEVICE_HANDLER( out_0 )
783783{
r14883r14884
14161416   PORT_DIPSETTING(    0xc0, "5" )
14171417
14181418   PORT_START("DSWA_HI")
1419   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(shifted_port_r, "DSWA")
1419   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, bosco_state,shifted_port_r, "DSWA")
14201420
14211421   PORT_START("DSWB") // reverse order against SWA
14221422   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_A ) )           PORT_DIPLOCATION("SWB:1,2")
r14883r14884
14431443   PORT_DIPSETTING(    0x03, DEF_STR( Hardest ) )
14441444
14451445   PORT_START("DSWB_HI")
1446   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM(shifted_port_r, "DSWB")
1446   PORT_BIT( 0x0f, 0x00, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, bosco_state,shifted_port_r, "DSWB")
14471447INPUT_PORTS_END
14481448
14491449/*
src/mame/drivers/8080bw.c
r14883r14884
226226   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
227227   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
228228   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
229   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in1_control_r, NULL)
229   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in1_control_r, NULL)
230230   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
231231
232232   PORT_START("IN2")
r14883r14884
241241   PORT_DIPSETTING(    0x00, "1500" )
242242   /* SW1:5,6,7: In OFF, PL2 can have no control of joystick, going auto left/right and other problems like no laser gun.
243243    Be sure these are always ON */
244   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in2_control_r, NULL) PORT_DIPLOCATION("SW1:5,6,7") /* Labeled as "FACTORY" */
244   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in2_control_r, NULL) PORT_DIPLOCATION("SW1:5,6,7") /* Labeled as "FACTORY" */
245245   PORT_DIPNAME( 0x80, 0x00, "Coin Info" )            PORT_DIPLOCATION("SW1:8")
246246   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
247247   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r14883r14884
11531153/*                                                     */
11541154/*******************************************************/
11551155
1156static CUSTOM_INPUT( sflush_80_r )
1156CUSTOM_INPUT_MEMBER(_8080bw_state::sflush_80_r)
11571157{
1158   return (field.machine().primary_screen->vpos() & 0x80) ? 1 : 0;
1158   return (machine().primary_screen->vpos() & 0x80) ? 1 : 0;
11591159}
11601160
11611161static ADDRESS_MAP_START( sflush_map, AS_PROGRAM, 8, _8080bw_state )
r14883r14884
11971197   PORT_DIPNAME( 0x40, 0x00, "Coinage Display" )
11981198   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
11991199   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1200   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(sflush_80_r, NULL) // 128V?
1200   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, _8080bw_state,sflush_80_r, NULL) // 128V?
12011201
12021202   PORT_START("PADDLE")
12031203   PORT_BIT( 0xff, 0x6a, IPT_PADDLE ) PORT_MINMAX(0x16,0xbf) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_CENTERDELTA(0)
r14883r14884
16231623   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
16241624   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
16251625   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
1626   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in1_control_r, NULL)
1626   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in1_control_r, NULL)
16271627   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
16281628
16291629   PORT_START("IN1")
r14883r14884
16381638   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
16391639   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
16401640   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1641   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in2_control_r, NULL)
1641   PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in2_control_r, NULL)
16421642   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
16431643
16441644   /* Dummy controls port, P1 */
src/mame/drivers/psikyo4.c
r14883r14884
195195   device_set_input_line(device, 4, HOLD_LINE);
196196}
197197
198static CUSTOM_INPUT( system_port_r )
198CUSTOM_INPUT_MEMBER(psikyo4_state::system_port_r)
199199{
200   return input_port_read(field.machine(), "SYSTEM");
200   return input_port_read(machine(), "SYSTEM");
201201}
202202
203static CUSTOM_INPUT( mahjong_ctrl_r ) /* used by hotgmck/hgkairak */
203CUSTOM_INPUT_MEMBER(psikyo4_state::mahjong_ctrl_r)/* used by hotgmck/hgkairak */
204204{
205   psikyo4_state *state = field.machine().driver_data<psikyo4_state>();
206205   int player = (FPTR)param;
207   int sel = (state->m_io_select[0] & 0x0000ff00) >> 8;
206   int sel = (m_io_select[0] & 0x0000ff00) >> 8;
208207   int ret = 0xff;
209208
210   if (sel & 1) ret &= input_port_read(field.machine(), player ? "KEY4" : "KEY0" );
211   if (sel & 2) ret &= input_port_read(field.machine(), player ? "KEY5" : "KEY1" );
212   if (sel & 4) ret &= input_port_read(field.machine(), player ? "KEY6" : "KEY2" );
213   if (sel & 8) ret &= input_port_read(field.machine(), player ? "KEY7" : "KEY3" );
209   if (sel & 1) ret &= input_port_read(machine(), player ? "KEY4" : "KEY0" );
210   if (sel & 2) ret &= input_port_read(machine(), player ? "KEY5" : "KEY1" );
211   if (sel & 4) ret &= input_port_read(machine(), player ? "KEY6" : "KEY2" );
212   if (sel & 8) ret &= input_port_read(machine(), player ? "KEY7" : "KEY3" );
214213
215214   return ret;
216215}
r14883r14884
379378
380379static INPUT_PORTS_START( hotgmck )
381380   PORT_START("P1_P2")
382   PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM(system_port_r, NULL)
381   PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo4_state,system_port_r, NULL)
383382   PORT_BIT( 0x00ffff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
384   PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM(mahjong_ctrl_r, (void *)0)
383   PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo4_state,mahjong_ctrl_r, (void *)0)
385384
386385   PORT_START("P3_P4")
387   PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM(system_port_r, NULL)
386   PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo4_state,system_port_r, NULL)
388387   PORT_BIT( 0x00ffff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
389   PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM(mahjong_ctrl_r, (void *)1)
388   PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo4_state,mahjong_ctrl_r, (void *)1)
390389
391390   PORT_START("JP4")/* jumper pads 'JP4' on the PCB */
392391   /* EEPROM is read here */
src/mame/drivers/thayers.c
r14883r14884
7878   DECLARE_WRITE8_MEMBER(den2_w);
7979   DECLARE_WRITE8_MEMBER(ssi263_register_w);
8080   DECLARE_READ8_MEMBER(ssi263_register_r);
81   DECLARE_CUSTOM_INPUT_MEMBER(laserdisc_enter_r);
82   DECLARE_CUSTOM_INPUT_MEMBER(laserdisc_ready_r);
8183};
8284
8385
r14883r14884
618620
619621/* Input Ports */
620622
621static CUSTOM_INPUT( laserdisc_enter_r )
623CUSTOM_INPUT_MEMBER(thayers_state::laserdisc_enter_r)
622624{
623   thayers_state *state = field.machine().driver_data<thayers_state>();
624   if (state->m_pr7820 != NULL) return state->m_pr7820_enter;
625   if (state->m_ldv1000 != NULL) return (state->m_ldv1000->status_strobe_r() == ASSERT_LINE) ? 0 : 1;
625   if (m_pr7820 != NULL) return m_pr7820_enter;
626   if (m_ldv1000 != NULL) return (m_ldv1000->status_strobe_r() == ASSERT_LINE) ? 0 : 1;
626627   return 0;
627628}
628629
629static CUSTOM_INPUT( laserdisc_ready_r )
630CUSTOM_INPUT_MEMBER(thayers_state::laserdisc_ready_r)
630631{
631   thayers_state *state = field.machine().driver_data<thayers_state>();
632   if (state->m_pr7820 != NULL) return (state->m_pr7820->ready_r() == ASSERT_LINE) ? 0 : 1;
633   if (state->m_ldv1000 != NULL) return (state->m_ldv1000->command_strobe_r() == ASSERT_LINE) ? 0 : 1;
632   if (m_pr7820 != NULL) return (m_pr7820->ready_r() == ASSERT_LINE) ? 0 : 1;
633   if (m_ldv1000 != NULL) return (m_ldv1000->command_strobe_r() == ASSERT_LINE) ? 0 : 1;
634634   return 0;
635635}
636636
r14883r14884
671671   PORT_START("COIN")
672672   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
673673   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
674   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(laserdisc_enter_r, NULL)
675   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(laserdisc_ready_r, NULL)
674   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, thayers_state,laserdisc_enter_r, NULL)
675   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, thayers_state,laserdisc_ready_r, NULL)
676676
677677   PORT_START("R0")
678678   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME( "2" ) PORT_CODE( KEYCODE_F2 )
src/mame/drivers/merit.c
r14883r14884
7777   DECLARE_READ8_MEMBER(palette_r);
7878   DECLARE_WRITE8_MEMBER(palette_w);
7979   DECLARE_WRITE8_MEMBER(casino5_bank_w);
80   DECLARE_CUSTOM_INPUT_MEMBER(rndbit_r);
8081};
8182
8283
r14883r14884
345346   }
346347}
347348
348static CUSTOM_INPUT(rndbit_r)
349CUSTOM_INPUT_MEMBER(merit_state::rndbit_r)
349350{
350   return field.machine().rand();
351   return machine().rand();
351352}
352353
353354static ADDRESS_MAP_START( pitboss_map, AS_PROGRAM, 8, merit_state )
r14883r14884
10241025   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
10251026   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
10261027   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1027   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(rndbit_r, NULL)
1028   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, merit_state,rndbit_r, NULL)
10281029
10291030   PORT_START("DSW")
10301031   PORT_DIPNAME( 0x01, 0x01, "Draw Poker enabled" )
src/mame/drivers/spoker.c
r14883r14884
4848   DECLARE_WRITE8_MEMBER(spoker_leds_w);
4949   DECLARE_WRITE8_MEMBER(spoker_magic_w);
5050   DECLARE_READ8_MEMBER(spoker_magic_r);
51   DECLARE_CUSTOM_INPUT_MEMBER(hopper_r);
5152};
5253
5354WRITE8_MEMBER(spoker_state::bg_tile_w)
r14883r14884
108109                                Memory Maps
109110***************************************************************************/
110111
111static CUSTOM_INPUT( hopper_r )
112CUSTOM_INPUT_MEMBER(spoker_state::hopper_r)
112113{
113   running_machine &machine = field.machine();
114   spoker_state *state = machine.driver_data<spoker_state>();
115
116   if (state->m_hopper) return !(machine.primary_screen->frame_number()%10);
117   return machine.input().code_pressed(KEYCODE_H);
114   if (m_hopper) return !(machine().primary_screen->frame_number()%10);
115   return machine().input().code_pressed(KEYCODE_H);
118116}
119117
120118static void show_out(UINT8 *out)
r14883r14884
331329   PORT_START("SERVICE")
332330   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN  )
333331   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Memory Clear")   // stats, memory
334   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
332   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM_MEMBER(DEVICE_SELF,spoker_state,hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
335333   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN  )
336334   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
337335   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
r14883r14884
400398
401399   PORT_START("IN0")
402400   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN  )
403   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
401   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM_MEMBER(DEVICE_SELF,spoker_state,hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
404402   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
405403   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Statistics")
406404   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1   )
src/mame/drivers/zr107.c
r14883r14884
816816
817817   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
818818
819   MCFG_SOUND_ADD("konami1", K054539, 48000)
820   MCFG_SOUND_CONFIG(k054539_config)
819   MCFG_K054539_ADD("konami1", 48000, k054539_config)
821820   MCFG_SOUND_ROUTE(0, "lspeaker", 0.75)
822821   MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
823822
824   MCFG_SOUND_ADD("konami2", K054539, 48000)
823   MCFG_K054539_ADD("konami2", 48000, k054539_config)
825824   MCFG_SOUND_CONFIG(k054539_config)
826825   MCFG_SOUND_ROUTE(0, "lspeaker", 0.75)
827826   MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
src/mame/drivers/ksys573.c
r14883r14884
465465   int m_tank_shutter_position;
466466   int m_cable_holder_release;
467467   double m_pad_position[ 6 ];
468   DECLARE_CUSTOM_INPUT_MEMBER(gn845pwbb_read);
469   DECLARE_CUSTOM_INPUT_MEMBER(gunmania_tank_shutter_sensor);
470   DECLARE_CUSTOM_INPUT_MEMBER(gunmania_cable_holder_sensor);
468471};
469472
470473INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... )
r14883r14884
16681671      state->m_stage[ offset ].state, state->m_stage[ offset ].DO, state->m_stage[ offset ].shift, state->m_stage[ offset ].bit, state->m_stage_mask );
16691672}
16701673
1671static CUSTOM_INPUT( gn845pwbb_read )
1674CUSTOM_INPUT_MEMBER(ksys573_state::gn845pwbb_read)
16721675{
1673   ksys573_state *state = field.machine().driver_data<ksys573_state>();
16741676
1675   return input_port_read(field.machine(), "STAGE") & state->m_stage_mask;
1677   return input_port_read(machine(), "STAGE") & m_stage_mask;
16761678}
16771679
16781680static void gn845pwbb_output_callback( running_machine &machine, int offset, int data )
r14883r14884
28962898   verboselog( space->machine(), 2, "gunmania_w %08x %08x %08x\n", offset, mem_mask, data );
28972899}
28982900
2899static CUSTOM_INPUT( gunmania_tank_shutter_sensor )
2901CUSTOM_INPUT_MEMBER(ksys573_state::gunmania_tank_shutter_sensor)
29002902{
2901   ksys573_state *state = field.machine().driver_data<ksys573_state>();
29022903
2903   if( state->m_tank_shutter_position == 0 )
2904   if( m_tank_shutter_position == 0 )
29042905   {
29052906      return 1;
29062907   }
r14883r14884
29082909   return 0;
29092910}
29102911
2911static CUSTOM_INPUT( gunmania_cable_holder_sensor )
2912CUSTOM_INPUT_MEMBER(ksys573_state::gunmania_cable_holder_sensor)
29122913{
2913   ksys573_state *state = field.machine().driver_data<ksys573_state>();
29142914
2915   return state->m_cable_holder_release;
2915   return m_cable_holder_release;
29162916}
29172917
29182918static READ32_HANDLER( gunmania_r )
r14883r14884
33573357   PORT_INCLUDE( konami573 )
33583358
33593359   PORT_MODIFY("IN2")
3360   PORT_BIT( 0x00000f0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gn845pwbb_read, NULL)
3360   PORT_BIT( 0x00000f0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ksys573_state,gn845pwbb_read, NULL)
33613361
33623362   PORT_START( "STAGE" )
33633363   PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_16WAY PORT_PLAYER(1)
r14883r14884
35033503   PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(1) PORT_NAME( "Bullet Tube-1 Sensor" )
35043504   PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) PORT_NAME( "Bullet Tube-2 Sensor" )
35053505   PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) PORT_NAME( "Safety Sensor Under" )
3506   PORT_BIT( 0x00000100, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( gunmania_tank_shutter_sensor, NULL )
3506   PORT_BIT( 0x00000100, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF,ksys573_state,gunmania_tank_shutter_sensor, NULL )
35073507
35083508   PORT_MODIFY("IN3")
35093509   PORT_BIT( 0x0d000b00, IP_ACTIVE_LOW, IPT_UNUSED )
3510   PORT_BIT( 0x02000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM( gunmania_cable_holder_sensor, NULL )
3510   PORT_BIT( 0x02000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF,ksys573_state,gunmania_cable_holder_sensor, NULL )
35113511
35123512   PORT_START("GUNX")
35133513   PORT_BIT( 0x7f, 0x2f, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0x00,0x5f) PORT_SENSITIVITY(100) PORT_KEYDELTA(15) PORT_PLAYER(1)
src/mame/drivers/bwidow.c
r14883r14884
234234   DECLARE_READ8_MEMBER(spacduel_IN3_r);
235235   DECLARE_WRITE8_MEMBER(bwidow_misc_w);
236236   DECLARE_WRITE8_MEMBER(irq_ack_w);
237   DECLARE_CUSTOM_INPUT_MEMBER(clock_r);
237238};
238239
239240
r14883r14884
317318   return res;
318319}
319320
320static CUSTOM_INPUT( clock_r )
321CUSTOM_INPUT_MEMBER(bwidow_state::clock_r)
321322{
322   return (field.machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
323   return (machine().device<cpu_device>("maincpu")->total_cycles() & 0x100) ? 1 : 0;
323324}
324325
325326
r14883r14884
424425   /* per default (busy vector processor). */
425426   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)
426427   /* bit 7 is tied to a 3kHz clock */
427   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
428   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, bwidow_state,clock_r, NULL)
428429
429430   PORT_START("DSW0")
430431   PORT_DIPNAME(0x03, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("D4:!7,!8")
r14883r14884
503504   /* per default (busy vector processor). */
504505   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)
505506   /* bit 7 is tied to a 3kHz clock */
506   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
507   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, bwidow_state,clock_r, NULL)
507508
508509   PORT_START("DSW0")
509510   PORT_DIPUNUSED_DIPLOC( 0x03, IP_ACTIVE_HIGH, "D4:!7,!8" )
r14883r14884
577578   /* per default (busy vector processor). */
578579   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)
579580   /* bit 7 is tied to a 3kHz clock */
580   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
581   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, bwidow_state,clock_r, NULL)
581582
582583   PORT_START("DSW0")   /* DSW0 - Not read */
583584   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
r14883r14884
611612   /* per default (busy vector processor). */
612613   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL)
613614   /* bit 7 is tied to a 3kHz clock */
614   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(clock_r, NULL)
615   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, bwidow_state,clock_r, NULL)
615616
616617   PORT_START("DSW0")
617618   PORT_DIPNAME(0x03, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("D4:!7,!8")
src/mame/drivers/xmen.c
r14883r14884
254254   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_device, set_cs_line)
255255INPUT_PORTS_END
256256
257static CUSTOM_INPUT( xmen_frame_r )
257CUSTOM_INPUT_MEMBER(xmen_state::xmen_frame_r)
258258{
259   //xmen_state *state = field.machine().driver_data<xmen_state>();
260   return field.machine().primary_screen->frame_number() & 1;
259   return machine().primary_screen->frame_number() & 1;
261260}
262261
263262static INPUT_PORTS_START( xmen6p )
r14883r14884
284283   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START5 ) /* not verified */
285284   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_START6 ) /* not verified */
286285   PORT_SERVICE_NO_TOGGLE( 0x4000, IP_ACTIVE_LOW )
287   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(xmen_frame_r, NULL)   /* screen indicator? */
286   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, xmen_state,xmen_frame_r, NULL)   /* screen indicator? */
288287
289288   PORT_START( "EEPROMOUT" )
290289   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_device, write_bit)
src/mame/drivers/gunbustr.c
r14883r14884
7878   palette_set_color_rgb(machine(),offset*2+1,pal5bit(a >> 10),pal5bit(a >> 5),pal5bit(a >> 0));
7979}
8080
81static CUSTOM_INPUT( coin_word_r )
81CUSTOM_INPUT_MEMBER(gunbustr_state::coin_word_r)
8282{
83   gunbustr_state *state = field.machine().driver_data<gunbustr_state>();
84   return state->m_coin_word;
83   return m_coin_word;
8584}
8685
8786WRITE32_MEMBER(gunbustr_state::gunbustr_input_w)
r14883r14884
263262   PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_UNKNOWN )
264263   PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_UNKNOWN )
265264   PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNKNOWN )
266   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_word_r, NULL)
265   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, gunbustr_state,coin_word_r, NULL)
267266
268267   /* Light gun inputs */
269268
src/mame/drivers/playch10.c
r14883r14884
410410    PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Channel Select") PORT_CODE(KEYCODE_0)
411411    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Enter") PORT_CODE(KEYCODE_MINUS)
412412    PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Reset") PORT_CODE(KEYCODE_EQUALS)
413    PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(pc10_int_detect_r, NULL)   // INT Detect
413    PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, playch10_state,pc10_int_detect_r, NULL)   // INT Detect
414414    PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
415415    PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
416416    PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SERVICE1 )
src/mame/drivers/pzletime.c
r14883r14884
4444   DECLARE_WRITE16_MEMBER(txt_videoram_w);
4545   DECLARE_WRITE16_MEMBER(ticket_w);
4646   DECLARE_WRITE16_MEMBER(video_regs_w);
47   DECLARE_CUSTOM_INPUT_MEMBER(ticket_status_r);
4748};
4849
4950
r14883r14884
201202   downcast<okim6295_device *>(device)->set_bank_base(0x40000 * (data & 0x3));
202203}
203204
204static CUSTOM_INPUT( ticket_status_r )
205CUSTOM_INPUT_MEMBER(pzletime_state::ticket_status_r)
205206{
206   pzletime_state *state = field.machine().driver_data<pzletime_state>();
207   return (state->m_ticket && !(field.machine().primary_screen->frame_number() % 128));
207   return (m_ticket && !(machine().primary_screen->frame_number() % 128));
208208}
209209
210210static ADDRESS_MAP_START( pzletime_map, AS_PROGRAM, 16, pzletime_state )
r14883r14884
233233   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
234234   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
235235   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit) /* eeprom */
236   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ticket_status_r, NULL) /* ticket dispenser */
236   PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, pzletime_state,ticket_status_r, NULL) /* ticket dispenser */
237237   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
238238
239239   PORT_START("INPUT")
src/mame/drivers/equites.c
r14883r14884
652652#endif
653653
654654
655static CUSTOM_INPUT( gekisou_unknown_status )
655CUSTOM_INPUT_MEMBER(equites_state::gekisou_unknown_status)
656656{
657   equites_state *state = field.machine().driver_data<equites_state>();
658   return state->m_unknown_bit;
657   return m_unknown_bit;
659658}
660659
661660WRITE16_MEMBER(equites_state::gekisou_unknown_0_w)
r14883r14884
850849   PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
851850   PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
852851   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
853   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gekisou_unknown_status, NULL)
852   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, equites_state,gekisou_unknown_status, NULL)
854853
855854   /* this is actually a variable resistor */
856855   PORT_START(FRQ_ADJUSTER_TAG)
src/mame/drivers/dlair.c
r14883r14884
105105   DECLARE_WRITE8_MEMBER(led_den2_w);
106106   DECLARE_READ8_MEMBER(laserdisc_r);
107107   DECLARE_WRITE8_MEMBER(laserdisc_w);
108   DECLARE_CUSTOM_INPUT_MEMBER(laserdisc_status_r);
109   DECLARE_CUSTOM_INPUT_MEMBER(laserdisc_command_r);
108110};
109111
110112
r14883r14884
360362 *
361363 *************************************/
362364
363static CUSTOM_INPUT( laserdisc_status_r )
365CUSTOM_INPUT_MEMBER(dlair_state::laserdisc_status_r)
364366{
365   dlair_state *state = field.machine().driver_data<dlair_state>();
366   return state->laserdisc_status_r();
367   return laserdisc_status_r();
367368}
368369
369370
370static CUSTOM_INPUT( laserdisc_command_r )
371CUSTOM_INPUT_MEMBER(dlair_state::laserdisc_command_r)
371372{
372   dlair_state *state = field.machine().driver_data<dlair_state>();
373   return (state->laserdisc_ready_r() == ASSERT_LINE) ? 0 : 1;
373   return (laserdisc_ready_r() == ASSERT_LINE) ? 0 : 1;
374374}
375375
376376
r14883r14884
579579   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
580580   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
581581   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
582   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(laserdisc_status_r, NULL)    /* status strobe */
583   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(laserdisc_command_r, NULL)   /* command strobe */
582   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dlair_state,laserdisc_status_r, NULL)    /* status strobe */
583   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dlair_state,laserdisc_command_r, NULL)   /* command strobe */
584584INPUT_PORTS_END
585585
586586
r14883r14884
611611   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
612612   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
613613   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* probably unused */
614   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(laserdisc_status_r, NULL)    /* status strobe */
615   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(laserdisc_command_r, NULL)   /* command strobe */
614   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dlair_state,laserdisc_status_r, NULL)    /* status strobe */
615   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dlair_state,laserdisc_command_r, NULL)   /* command strobe */
616616
617617   PORT_START("DSW1")
618618   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("A:2,1")
src/mame/drivers/firetrk.c
r14883r14884
195195}
196196
197197
198static CUSTOM_INPUT( steer_dir_r )
198CUSTOM_INPUT_MEMBER(firetrk_state::steer_dir_r)
199199{
200   firetrk_state *state = field.machine().driver_data<firetrk_state>();
201   return state->m_steer_dir[(FPTR)param];
200   return m_steer_dir[(FPTR)param];
202201}
203202
204203
205static CUSTOM_INPUT( steer_flag_r )
204CUSTOM_INPUT_MEMBER(firetrk_state::steer_flag_r)
206205{
207   firetrk_state *state = field.machine().driver_data<firetrk_state>();
208   return state->m_steer_flag[(FPTR)param];
206   return m_steer_flag[(FPTR)param];
209207}
210208
211209
212static CUSTOM_INPUT( skid_r )
210CUSTOM_INPUT_MEMBER(firetrk_state::skid_r)
213211{
214   firetrk_state *state = field.machine().driver_data<firetrk_state>();
215212   UINT32 ret;
216213   int which = (FPTR)param;
217214
218215   if (which != 2)
219      ret = state->m_skid[which];
216      ret = m_skid[which];
220217   else
221      ret = state->m_skid[0] | state->m_skid[1];
218      ret = m_skid[0] | m_skid[1];
222219
223220   return ret;
224221}
225222
226223
227static CUSTOM_INPUT( crash_r )
224CUSTOM_INPUT_MEMBER(firetrk_state::crash_r)
228225{
229   firetrk_state *state = field.machine().driver_data<firetrk_state>();
230226   UINT32 ret;
231227   int which = (FPTR)param;
232228
233229   if (which != 2)
234      ret = state->m_crash[which];
230      ret = m_crash[which];
235231   else
236      ret = state->m_crash[0] | state->m_crash[1];
232      ret = m_crash[0] | m_crash[1];
237233
238234   return ret;
239235}
240236
241237
242static CUSTOM_INPUT( gear_r )
238CUSTOM_INPUT_MEMBER(firetrk_state::gear_r)
243239{
244   firetrk_state *state = field.machine().driver_data<firetrk_state>();
245   return (state->m_gear == (FPTR)param) ? 1 : 0;
240   return (m_gear == (FPTR)param) ? 1 : 0;
246241}
247242
248243
r14883r14884
438433   PORT_START("BIT_0")
439434   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
440435   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas") PORT_PLAYER(1)
441   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)0)
442   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)1)
436   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,steer_dir_r, (void *)0)
437   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,steer_dir_r, (void *)1)
443438   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Bell") PORT_PLAYER(2)
444439   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_TILT )
445   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)2)
440   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,skid_r, (void *)2)
446441   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Service_Mode ) ) PORT_CODE(KEYCODE_F2) PORT_TOGGLE PORT_CHANGED(service_mode_switch_changed, 0)
447442   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
448443   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
r14883r14884
462457   PORT_START("BIT_7")
463458   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
464459   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
465   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)0)
466   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)1)
460   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,steer_flag_r, (void *)0)
461   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,steer_flag_r, (void *)1)
467462   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 )
468463   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
469   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(crash_r, (void *)2)
464   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,crash_r, (void *)2)
470465   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Step") PORT_CODE(KEYCODE_F1)
471466
472467   PORT_START("HORN")
r14883r14884
508503   PORT_DIPSETTING(    0xc0, DEF_STR( German ) )
509504
510505   PORT_START("BIT_0")
511   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)1)
506   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,gear_r, (void *)1)
512507   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas")
513   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)0)
508   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,steer_dir_r, (void *)0)
514509   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Hiscore Reset") PORT_CODE(KEYCODE_H)
515510   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
516511   PORT_SERVICE( 0x20, IP_ACTIVE_HIGH )
517   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)0)
512   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,skid_r, (void *)0)
518513   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_TILT )
519514
520515   PORT_START("BIT_7")
521   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)2)
522   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)0)
523   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)0)
516   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,gear_r, (void *)2)
517   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,gear_r, (void *)0)
518   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,steer_flag_r, (void *)0)
524519   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
525520   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN2 )
526521   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
527   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(crash_r, (void *)0)
522   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,crash_r, (void *)0)
528523   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE)
529524
530525   PORT_START("GEAR")
r14883r14884
580575   PORT_DIPSETTING(    0x00, DEF_STR( German ) )
581576
582577   PORT_START("BIT_6")
583   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)0)
584   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)1)
585   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)2)
578   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,gear_r, (void *)0)
579   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,gear_r, (void *)1)
580   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,gear_r, (void *)2)
586581   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE)
587582   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas")
588583   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_VBLANK )
589   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)0)
590   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)1)
584   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,steer_dir_r, (void *)0)
585   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,skid_r, (void *)1)
591586
592587   PORT_START("BIT_7")
593588   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
r14883r14884
596591   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
597592   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN2 )
598593   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )
599   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)0)
600   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)0)
594   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,steer_flag_r, (void *)0)
595   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, firetrk_state,skid_r, (void *)0)
601596
602597   PORT_START("GEAR")
603598   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Gear 1") PORT_CODE(KEYCODE_Z) PORT_CHANGED(gear_changed, (void *)0)
src/mame/drivers/peplus.c
r14883r14884
232232   DECLARE_READ8_MEMBER(peplus_bgcolor_r);
233233   DECLARE_READ8_MEMBER(peplus_dropdoor_r);
234234   DECLARE_READ8_MEMBER(peplus_watchdog_r);
235   DECLARE_CUSTOM_INPUT_MEMBER(peplus_input_r);
235236};
236237
237238
r14883r14884
804805*      Input ports       *
805806*************************/
806807
807static CUSTOM_INPUT( peplus_input_r )
808CUSTOM_INPUT_MEMBER(peplus_state::peplus_input_r)
808809{
809810   UINT8 inp_ret = 0x00;
810   UINT8 inp_read = input_port_read(field.machine(), (const char *)param);
811   UINT8 inp_read = input_port_read(machine(), (const char *)param);
811812
812813   if (inp_read & 0x01) inp_ret = 0x01;
813814   if (inp_read & 0x02) inp_ret = 0x02;
r14883r14884
863864   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
864865
865866   PORT_START("IN0")
866   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1")
867   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, peplus_state,peplus_input_r, "IN_BANK1")
867868   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
868   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2")
869   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, peplus_state,peplus_input_r, "IN_BANK2")
869870   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
870871INPUT_PORTS_END
871872
r14883r14884
891892   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U)
892893
893894   PORT_START("IN0")
894   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1")
895   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, peplus_state,peplus_input_r, "IN_BANK1")
895896   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
896   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2")
897   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, peplus_state,peplus_input_r, "IN_BANK2")
897898   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
898899INPUT_PORTS_END
899900
r14883r14884
919920   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U)
920921
921922   PORT_START("IN0")
922   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1")
923   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, peplus_state,peplus_input_r, "IN_BANK1")
923924   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
924   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2")
925   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, peplus_state,peplus_input_r, "IN_BANK2")
925926   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
926927INPUT_PORTS_END
927928
r14883r14884
952953   PORT_BIT( 0xffff, 0x200, IPT_LIGHTGUN_Y ) PORT_MINMAX(0x00, 1024) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(13)
953954
954955   PORT_START("IN0")
955   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1")
956   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, peplus_state,peplus_input_r, "IN_BANK1")
956957   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Light Pen") PORT_CODE(KEYCODE_A)
957   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2")
958   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, peplus_state,peplus_input_r, "IN_BANK2")
958959   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
959960INPUT_PORTS_END
960961
r14883r14884
980981   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U)
981982
982983   PORT_START("IN0")
983   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK1")
984   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, peplus_state,peplus_input_r, "IN_BANK1")
984985   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
985   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(peplus_input_r, "IN_BANK2")
986   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, peplus_state,peplus_input_r, "IN_BANK2")
986987   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
987988INPUT_PORTS_END
988989
src/mame/drivers/ddayjlc.c
r14883r14884
9494   DECLARE_WRITE8_MEMBER(sound_w);
9595   DECLARE_WRITE8_MEMBER(i8257_CH0_w);
9696   DECLARE_WRITE8_MEMBER(i8257_LMSR_w);
97   DECLARE_CUSTOM_INPUT_MEMBER(prot_r);
9798};
9899
99100
r14883r14884
140141   0x03, 0x01, 0x00, 0x03
141142};
142143
143static CUSTOM_INPUT( prot_r )
144CUSTOM_INPUT_MEMBER(ddayjlc_state::prot_r)
144145{
145   ddayjlc_state *state = field.machine().driver_data<ddayjlc_state>();
146   return prot_data[state->m_prot_addr];
146   return prot_data[m_prot_addr];
147147}
148148
149149WRITE8_MEMBER(ddayjlc_state::prot_w)
r14883r14884
293293   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 )
294294   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 )
295295   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SERVICE1 )
296   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(prot_r, NULL)
296   PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ddayjlc_state,prot_r, NULL)
297297   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
298298
299299   PORT_START("DSW1")
src/mame/drivers/konamigx.c
r14883r14884
440440/**********************************************************************************/
441441/* EEPROM handlers */
442442
443static CUSTOM_INPUT( gx_rdport1_3_r )
443CUSTOM_INPUT_MEMBER(konamigx_state::gx_rdport1_3_r)
444444{
445445   return (gx_rdport1_3 >> 1);
446446}
r14883r14884
13691369
13701370   // note: racin' force expects bit 1 of the eeprom port to toggle
13711371   PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
1372   PORT_BIT( 0x000000fe, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gx_rdport1_3_r, NULL)
1372   PORT_BIT( 0x000000fe, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, konamigx_state,gx_rdport1_3_r, NULL)
13731373   PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_COIN1 )
13741374   PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_COIN2 )
13751375   PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/dorachan.c
r14883r14884
3131   /* devices */
3232   device_t *m_main_cpu;
3333   DECLARE_WRITE8_MEMBER(dorachan_ctrl_w);
34   DECLARE_CUSTOM_INPUT_MEMBER(dorachan_protection_r);
35   DECLARE_CUSTOM_INPUT_MEMBER(dorachan_v128_r);
3436};
3537
3638
r14883r14884
4042 *
4143 *************************************/
4244
43static CUSTOM_INPUT( dorachan_protection_r )
45CUSTOM_INPUT_MEMBER(dorachan_state::dorachan_protection_r)
4446{
45   dorachan_state *state = field.machine().driver_data<dorachan_state>();
4647   UINT8 ret = 0;
4748
48   switch (cpu_get_previouspc(state->m_main_cpu))
49   switch (cpu_get_previouspc(m_main_cpu))
4950   {
5051   case 0x70ce: ret = 0xf2; break;
5152   case 0x72a2: ret = 0xd5; break;
5253   case 0x72b5: ret = 0xcb; break;
5354
5455   default:
55      mame_printf_debug("unhandled $2400 read @ %x\n", cpu_get_previouspc(state->m_main_cpu));
56      mame_printf_debug("unhandled $2400 read @ %x\n", cpu_get_previouspc(m_main_cpu));
5657      break;
5758   }
5859
r14883r14884
127128}
128129
129130
130static CUSTOM_INPUT( dorachan_v128_r )
131CUSTOM_INPUT_MEMBER(dorachan_state::dorachan_v128_r)
131132{
132   dorachan_state *state = field.machine().driver_data<dorachan_state>();
133133
134134   /* to avoid resetting (when player 2 starts) bit 0 need to be inverted when screen is flipped */
135   return ((field.machine().primary_screen->vpos() >> 7) & 0x01) ^ state->m_flip_screen;
135   return ((machine().primary_screen->vpos() >> 7) & 0x01) ^ m_flip_screen;
136136}
137137
138138
r14883r14884
180180
181181static INPUT_PORTS_START( dorachan )
182182   PORT_START("PROT")
183   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dorachan_protection_r, NULL)
183   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dorachan_state,dorachan_protection_r, NULL)
184184
185185   PORT_START("SYSTEM")
186186   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
r14883r14884
209209   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
210210
211211   PORT_START("V128")
212   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(dorachan_v128_r, NULL)
212   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, dorachan_state,dorachan_v128_r, NULL)
213213   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
214214INPUT_PORTS_END
215215
src/mame/drivers/sandscrp.c
r14883r14884
222222{
223223
224224   m_latch2_full = 0;
225   return soundlatch2_r(*&space,0);
225   return soundlatch2_r(space,0);
226226}
227227
228228WRITE16_MEMBER(sandscrp_state::sandscrp_soundlatch_word_w)
r14883r14884
231231   if (ACCESSING_BITS_0_7)
232232   {
233233      m_latch1_full = 1;
234      soundlatch_w(*&space, 0, data & 0xff);
234      soundlatch_w(space, 0, data & 0xff);
235235      cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
236236      device_spin_until_time(&space.device(), attotime::from_usec(100));   // Allow the other cpu to reply
237237   }
r14883r14884
291291{
292292
293293   m_latch1_full = 0;
294   return soundlatch_r(*&space,0);
294   return soundlatch_r(space,0);
295295}
296296
297297WRITE8_MEMBER(sandscrp_state::sandscrp_soundlatch_w)
298298{
299299
300300   m_latch2_full = 1;
301   soundlatch2_w(*&space,0,data);
301   soundlatch2_w(space,0,data);
302302}
303303
304304static ADDRESS_MAP_START( sandscrp_soundmem, AS_PROGRAM, 8, sandscrp_state )
src/mame/drivers/exidy.c
r14883r14884
155155 *
156156 *************************************/
157157
158static CUSTOM_INPUT( teetert_input_r )
158CUSTOM_INPUT_MEMBER(exidy_state::teetert_input_r)
159159{
160   exidy_state *state = field.machine().driver_data<exidy_state>();
161   UINT8 dial = input_port_read(field.machine(), "DIAL");
160   UINT8 dial = input_port_read(machine(), "DIAL");
162161   int result = 0;
163162
164   result = (dial != state->m_last_dial) << 4;
163   result = (dial != m_last_dial) << 4;
165164   if (result != 0)
166165   {
167      if (((dial - state->m_last_dial) & 0xff) < 0x80)
166      if (((dial - m_last_dial) & 0xff) < 0x80)
168167      {
169168         result |= 1;
170         state->m_last_dial++;
169         m_last_dial++;
171170      }
172171      else
173         state->m_last_dial--;
172         m_last_dial--;
174173   }
175174
176175   return result;
r14883r14884
603602   PORT_START("IN0")
604603   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
605604   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
606   PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(teetert_input_r, NULL)
605   PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exidy_state,teetert_input_r, NULL)
607606   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
608607   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
609608   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/mw18w.c
r14883r14884
3030   DECLARE_WRITE8_MEMBER(mw18w_lamps_w);
3131   DECLARE_WRITE8_MEMBER(mw18w_led_display_w);
3232   DECLARE_WRITE8_MEMBER(mw18w_irq0_clear_w);
33   DECLARE_CUSTOM_INPUT_MEMBER(mw18w_sensors_r);
3334};
3435
3536
r14883r14884
6667   cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
6768}
6869
69static CUSTOM_INPUT( mw18w_sensors_r )
70CUSTOM_INPUT_MEMBER(mw18w_state::mw18w_sensors_r)
7071{
7172   // d7: off road
7273   // d6: in dock area
r14883r14884
114115   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )   // left/right sw.
115116   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
116117   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
117   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(mw18w_sensors_r, NULL)
118   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw18w_state,mw18w_sensors_r, NULL)
118119
119120   PORT_START("IN1")
120121   PORT_BIT( 0x1f, 0x00, IPT_PEDAL ) PORT_REMAP_TABLE(mw18w_controller_table + 0x20) PORT_SENSITIVITY(100) PORT_KEYDELTA(1)   // accelerate
src/mame/drivers/cidelsa.c
r14883r14884
270270
271271/* Input Ports */
272272
273static CUSTOM_INPUT( cdp1869_pcb_r )
273CUSTOM_INPUT_MEMBER(cidelsa_state::cdp1869_pcb_r)
274274{
275   cidelsa_state *state = field.machine().driver_data<cidelsa_state>();
276275
277   return state->m_cdp1869_pcb;
276   return m_cdp1869_pcb;
278277}
279278
280279static INPUT_CHANGED( ef_w )
r14883r14884
291290   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) // LF
292291   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // FR
293292   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
294   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(cdp1869_pcb_r, NULL)
293   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cidelsa_state,cdp1869_pcb_r, NULL)
295294
296295   PORT_START("IN1")
297296   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) )
r14883r14884
331330   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) // LF
332331   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // FR
333332   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
334   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(cdp1869_pcb_r, NULL)
333   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cidelsa_state,cdp1869_pcb_r, NULL)
335334
336335   PORT_START("IN1")
337336   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) )
r14883r14884
381380   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
382381   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
383382   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
384   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(cdp1869_pcb_r, NULL)
383   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cidelsa_state,cdp1869_pcb_r, NULL)
385384
386385   PORT_START("IN1")
387386   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) )
src/mame/drivers/taito_f3.c
r14883r14884
4141
4242/******************************************************************************/
4343
44static CUSTOM_INPUT( f3_analog_r )
44CUSTOM_INPUT_MEMBER(taito_f3_state::f3_analog_r)
4545{
4646   const char *tag = (const char *)param;
4747   UINT32 ipt = 0;
4848
49   ipt = ((input_port_read(field.machine(), tag) & 0xf)<<12) | ((input_port_read(field.machine(), tag) & 0xff0)>>4);
49   ipt = ((input_port_read(machine(), tag) & 0xf)<<12) | ((input_port_read(machine(), tag) & 0xff0)>>4);
5050
5151   return ipt;
5252}
5353
54static CUSTOM_INPUT( f3_coin_r )
54CUSTOM_INPUT_MEMBER(taito_f3_state::f3_coin_r)
5555{
56   taito_f3_state *state = field.machine().driver_data<taito_f3_state>();
5756   int num = (FPTR)param;
58   return state->m_coin_word[num];
57   return m_coin_word[num];
5958}
6059
6160READ32_MEMBER(taito_f3_state::f3_control_r)
r14883r14884
230229   PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_START2 )
231230   PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_START3 )
232231   PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_START4 )
233   PORT_BIT( 0x00ff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "EEPROMIN")
234   PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "EEPROMIN")
232   PORT_BIT( 0x00ff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "EEPROMIN")
233   PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "EEPROMIN")
235234
236235   /* MSW: Coin counters/lockouts are readable, LSW: Joysticks (Player 1 & 2) */
237236   PORT_START("IN1")
r14883r14884
244243   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
245244   PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
246245   PORT_BIT( 0x0000ff00, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* These must be high */
247   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(f3_coin_r, (void *)0)
246   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taito_f3_state,f3_coin_r, (void *)0)
248247
249248   /* Player 3 & 4 fire buttons (Player 2 top fire buttons in Kaiser Knuckle) */
250249   PORT_START("IN2")
r14883r14884
270269   PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
271270   PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
272271   PORT_BIT( 0x0000ff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
273   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(f3_coin_r, (void *)1)
272   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taito_f3_state,f3_coin_r, (void *)1)
274273
275274   /* Analog control 1 */
276275   PORT_START("AN0")
277   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(f3_analog_r, "DIAL1")
276   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taito_f3_state,f3_analog_r, "DIAL1")
278277   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
279278
280279   /* Analog control 2 */
281280   PORT_START("AN1")
282   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(f3_analog_r, "DIAL2")
281   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, taito_f3_state,f3_analog_r, "DIAL2")
283282   PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNKNOWN )
284283
285284   /* These are not read directly, but through PORT_CUSTOMs above */
src/mame/drivers/gaelco2.c
r14883r14884
11151115   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
11161116   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Acc.")
11171117   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Gear") PORT_TOGGLE
1118   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(wrally2_analog_bit_r, (void *)0)   /* ADC_1 serial input */
1118   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco2_state,wrally2_analog_bit_r, (void *)0)   /* ADC_1 serial input */
11191119   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
11201120   PORT_SERVICE_DIPLOC(  0x0100, IP_ACTIVE_LOW, "SW2:1" )
11211121   PORT_DIPNAME( 0x0200, 0x0000, "Coin mechanism" ) PORT_DIPLOCATION("SW2:2")
r14883r14884
11731173   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
11741174   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Acc.")
11751175   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Gear") PORT_TOGGLE
1176   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM(wrally2_analog_bit_r, (void *)1)   /* ADC_2 serial input */
1176   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco2_state,wrally2_analog_bit_r, (void *)1)   /* ADC_2 serial input */
11771177   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 )
11781178   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
11791179   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN2 )
src/mame/drivers/homerun.c
r14883r14884
6262   AM_RANGE(0xc000, 0xdfff) AM_RAM
6363ADDRESS_MAP_END
6464
65static CUSTOM_INPUT( homerun_40_r )
65CUSTOM_INPUT_MEMBER(homerun_state::homerun_40_r)
6666{
67   UINT8 ret = (field.machine().primary_screen->vpos() > 116) ? 1 : 0;
67   UINT8 ret = (machine().primary_screen->vpos() > 116) ? 1 : 0;
6868
6969   return ret;
7070}
r14883r14884
9797static INPUT_PORTS_START( homerun )
9898   PORT_START("IN0")
9999   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
100   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(homerun_40_r, NULL)
100   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, homerun_state,homerun_40_r, NULL)
101101   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
102102   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
103103   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
r14883r14884
127127static INPUT_PORTS_START( dynashot )
128128   PORT_START("IN0")
129129   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
130   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(homerun_40_r, NULL)
130   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, homerun_state,homerun_40_r, NULL)
131131   PORT_BIT( 0xb7, IP_ACTIVE_HIGH, IPT_UNUSED )
132132
133133   PORT_START("IN1")
src/mame/drivers/champbas.c
r14883r14884
120120   m_watchdog_count = 0;
121121}
122122
123static CUSTOM_INPUT( champbas_watchdog_bit2 )
123CUSTOM_INPUT_MEMBER(champbas_state::champbas_watchdog_bit2)
124124{
125   champbas_state *state = field.machine().driver_data<champbas_state>();
126   return BIT(state->m_watchdog_count, 2);
125   return BIT(m_watchdog_count, 2);
127126}
128127
129128
r14883r14884
402401   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
403402   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
404403   PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
405   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(champbas_watchdog_bit2, NULL)   // bit 2 of the watchdog counter
404   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, champbas_state,champbas_watchdog_bit2, NULL)   // bit 2 of the watchdog counter
406405
407406   PORT_START("SYSTEM")
408407   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
r14883r14884
449448   PORT_DIPSETTING(    0x20, DEF_STR( Easy ) )
450449   PORT_DIPSETTING(    0x00, DEF_STR( Hard ))
451450   PORT_DIPUNKNOWN( 0x40, 0x00 )
452   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(champbas_watchdog_bit2, NULL)   // bit 2 of the watchdog counter
451   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, champbas_state,champbas_watchdog_bit2, NULL)   // bit 2 of the watchdog counter
453452INPUT_PORTS_END
454453
455454static INPUT_PORTS_START( exctsccr )
r14883r14884
475474   PORT_DIPSETTING(    0x00, "2 Min." )
476475   PORT_DIPSETTING(    0x60, "3 Min." )
477476   PORT_DIPSETTING(    0x40, "4 Min." )
478   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(champbas_watchdog_bit2, NULL)   // bit 2 of the watchdog counter
477   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, champbas_state,champbas_watchdog_bit2, NULL)   // bit 2 of the watchdog counter
479478INPUT_PORTS_END
480479
481480
src/mame/drivers/arkanoid.c
r14883r14884
639639   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT )
640640   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 )
641641   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
642   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(arkanoid_68705_input_r, NULL)   /* Inputs from the 68705 */
642   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arkanoid_state,arkanoid_68705_input_r, NULL)   /* Inputs from the 68705 */
643643
644644   PORT_START("BUTTONS")
645645   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
r14883r14884
648648   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNKNOWN )
649649
650650   PORT_START("MUX")
651   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(arkanoid_input_mux, "P1\0P2")
651   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, arkanoid_state,arkanoid_input_mux, "P1\0P2")
652652
653653   PORT_START("DSW")
654654   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Allow_Continue ) )   PORT_DIPLOCATION("SW1:8")
src/mame/drivers/crshrace.c
r14883r14884
170170   }
171171}
172172
173static CUSTOM_INPUT( country_sndpending_r )
173CUSTOM_INPUT_MEMBER(crshrace_state::country_sndpending_r)
174174{
175   crshrace_state *state = field.machine().driver_data<crshrace_state>();
176   return state->m_pending_command;
175   return m_pending_command;
177176}
178177
179178WRITE8_MEMBER(crshrace_state::pending_command_clear_w)
r14883r14884
364363    PORT_DIPSETTING(      0x0e00, "5" )
365364    PORT_DIPSETTING(      0x0f00, "5" )
366365*/
367   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(country_sndpending_r, NULL)   /* pending sound command */
366   PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, crshrace_state,country_sndpending_r, NULL)   /* pending sound command */
368367INPUT_PORTS_END
369368
370369/* Same as 'crshrace', but additional "unknown" Dip Switch (see notes) */
src/mame/drivers/igs011.c
r14883r14884
173173   DECLARE_WRITE16_MEMBER(vbowl_link_2_w);
174174   DECLARE_WRITE16_MEMBER(vbowl_link_3_w);
175175   UINT16 igs_dips_r(int NUM);
176   DECLARE_CUSTOM_INPUT_MEMBER(igs_hopper_r);
176177};
177178
178179
r14883r14884
520521// Inputs
521522
522523
523static CUSTOM_INPUT( igs_hopper_r )
524CUSTOM_INPUT_MEMBER(igs011_state::igs_hopper_r)
524525{
525   igs011_state *state = field.machine().driver_data<igs011_state>();
526   return (state->m_igs_hopper && ((field.machine().primary_screen->frame_number()/5)&1)) ? 0x0000 : 0x0001;
526   return (m_igs_hopper && ((machine().primary_screen->frame_number()/5)&1)) ? 0x0000 : 0x0001;
527527}
528528
529529WRITE16_MEMBER(igs011_state::igs_dips_w)
r14883r14884
28572857   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1    )
28582858   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )   // data clear
28592859   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
2860   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(igs_hopper_r, (void *)0)   // hopper switch
2860   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, igs011_state,igs_hopper_r, (void *)0)   // hopper switch
28612861   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 )   // stats
28622862   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER    ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O)   // clear coin
28632863   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN  )
r14883r14884
29862986   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_SERVICE2  )   // shown in test mode
29872987   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN   )
29882988   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_OTHER     ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O)   // clear coin
2989   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL   ) PORT_CUSTOM(igs_hopper_r, (void *)0)   // hopper switch
2989   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL   ) PORT_CUSTOM_MEMBER(DEVICE_SELF, igs011_state,igs_hopper_r, (void *)0)   // hopper switch
29902990
29912991   PORT_START("IN0")
29922992   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
r14883r14884
31153115   PORT_DIPUNKNOWN( 0x80, 0x80 )
31163116
31173117   PORT_START("COIN")
3118   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(igs_hopper_r, (void *)0)   // hopper switch
3118   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, igs011_state,igs_hopper_r, (void *)0)   // hopper switch
31193119   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE2 )   // system reset
31203120   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
31213121   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )   // stats
r14883r14884
34423442   PORT_DIPUNKNOWN( 0x80, 0x80 )
34433443
34443444   PORT_START("COIN")
3445   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(igs_hopper_r, (void *)0)   // hopper switch
3445   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, igs011_state,igs_hopper_r, (void *)0)   // hopper switch
34463446   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
34473447   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
34483448   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )   // stats
src/mame/drivers/cave.c
r14883r14884
696696   }
697697}
698698
699static CUSTOM_INPUT( korokoro_hopper_r )
699CUSTOM_INPUT_MEMBER(cave_state::korokoro_hopper_r)
700700{
701   cave_state *state = field.machine().driver_data<cave_state>();
702   return state->m_hopper ? 1 : 0;
701   return m_hopper ? 1 : 0;
703702}
704703
705704
r14883r14884
933932//  popmessage("led %04X", data);
934933}
935934
936static CUSTOM_INPUT( tjumpman_hopper_r )
935CUSTOM_INPUT_MEMBER(cave_state::tjumpman_hopper_r)
937936{
938   cave_state *state = field.machine().driver_data<cave_state>();
939   return (state->m_hopper && !(field.machine().primary_screen->frame_number() % 10)) ? 0 : 1;
937   return (m_hopper && !(machine().primary_screen->frame_number() % 10)) ? 0 : 1;
940938}
941939
942940static ADDRESS_MAP_START( tjumpman_map, AS_PROGRAM, 16, cave_state )
r14883r14884
14771475   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_SERVICE2 )   // service medal out?
14781476   PORT_SERVICE( 0x2000, IP_ACTIVE_LOW )
14791477   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_SERVICE1 )   // service coin
1480   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )   PORT_CUSTOM(korokoro_hopper_r, NULL) // motor / hopper status ???
1478   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_SPECIAL )   PORT_CUSTOM_MEMBER(DEVICE_SELF, cave_state,korokoro_hopper_r, NULL) // motor / hopper status ???
14811479
14821480   PORT_START("IN1")
14831481   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14883r14884
15081506   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_OTHER ) PORT_NAME( DEF_STR( Yes ) ) PORT_CODE(KEYCODE_Y)   // suru ("do")
15091507   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_GAMBLE_PAYOUT )
15101508   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_NAME( "1 Bet" )
1511   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_SPECIAL ) PORT_CUSTOM(tjumpman_hopper_r, NULL)
1509   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cave_state,tjumpman_hopper_r, NULL)
15121510
15131511   PORT_START("IN1")
15141512   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14883r14884
15331531   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_OTHER ) PORT_NAME( "Pac-Man" ) PORT_CODE(KEYCODE_Y)
15341532   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_GAMBLE_PAYOUT )
15351533   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_NAME( "Bet" )
1536   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_SPECIAL ) PORT_CUSTOM(tjumpman_hopper_r, NULL)
1534   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cave_state,tjumpman_hopper_r, NULL)
15371535
15381536   PORT_START("IN1")
15391537   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/williams.c
r14883r14884
922922
923923static INPUT_PORTS_START( joust )
924924   PORT_START("IN0")
925   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(williams_mux_r, "INP2\0INP1")
925   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, williams_state,williams_mux_r, "INP2\0INP1")
926926   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START2 )
927927   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
928928   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
r14883r14884
983983   PORT_START("IN0")
984984   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
985985   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 )
986   PORT_BIT( 0xcf, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(williams_mux_r, "INP2\0INP1")
986   PORT_BIT( 0xcf, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, williams_state,williams_mux_r, "INP2\0INP1")
987987
988988   PORT_START("IN1")
989   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(williams_mux_r, "INP2A\0INP1A")
989   PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, williams_state,williams_mux_r, "INP2A\0INP1A")
990990   PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )
991991
992992   PORT_START("IN2")
r14883r14884
12001200   PORT_START("IN0")
12011201   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
12021202   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 )
1203   PORT_BIT( 0xcf, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(williams_mux_r, "INP2\0INP1")
1203   PORT_BIT( 0xcf, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, williams_state,williams_mux_r, "INP2\0INP1")
12041204
12051205   PORT_START("IN1")
12061206   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
r14883r14884
12901290
12911291static INPUT_PORTS_START( tshoot )
12921292   PORT_START("IN0")
1293   PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(williams_mux_r, "INP1X\0INP1Y")
1293   PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, williams_state,williams_mux_r, "INP1X\0INP1Y")
12941294   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
12951295   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_BUTTON1 )
12961296
r14883r14884
13211321
13221322static INPUT_PORTS_START( inferno )
13231323   PORT_START("IN0")
1324   PORT_BIT( 0xFF, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(williams_mux_r, "INP1\0INP2")
1324   PORT_BIT( 0xFF, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, williams_state,williams_mux_r, "INP1\0INP2")
13251325
13261326   PORT_START("IN1")
13271327   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
r14883r14884
13641364
13651365static INPUT_PORTS_START( joust2 )
13661366   PORT_START("IN0")
1367   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(williams_mux_r, "INP1\0INP2")
1367   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, williams_state,williams_mux_r, "INP1\0INP2")
13681368   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
13691369   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
13701370   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
src/mame/drivers/fuukifg3.c
r14883r14884
314314
315315static INPUT_PORTS_START( asurabld )
316316   PORT_START("800000")
317   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "SYSTEM")
318   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "SYSTEM")
317   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "SYSTEM")
318   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "SYSTEM")
319319
320320   PORT_START("810000")
321   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "INPUTS")
322   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "INPUTS")
321   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "INPUTS")
322   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "INPUTS")
323323
324324   PORT_START("880000")
325   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW1")
326   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW1")
325   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW1")
326   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW1")
327327
328328   PORT_START("890000")
329   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW2")
330   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "DSW2")
329   PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW2")
330   PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW2")
331331
332332   PORT_START("SYSTEM")
333333   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
src/mame/drivers/wolfpack.c
r14883r14884
3030}
3131
3232
33static CUSTOM_INPUT( wolfpack_dial_r )
33CUSTOM_INPUT_MEMBER(wolfpack_state::wolfpack_dial_r)
3434{
3535   int bit = (FPTR)param;
36   return ((input_port_read(field.machine(), "DIAL") + bit) / 2) & 0x01;
36   return ((input_port_read(machine(), "DIAL") + bit) / 2) & 0x01;
3737}
3838
3939
r14883r14884
149149
150150static INPUT_PORTS_START( wolfpack )
151151   PORT_START("INPUTS")
152   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(wolfpack_dial_r, (void *)0)   /* dial connects here */
153   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(wolfpack_dial_r, (void *)1)   /* dial connects here */
152   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, wolfpack_state,wolfpack_dial_r, (void *)0)   /* dial connects here */
153   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, wolfpack_state,wolfpack_dial_r, (void *)1)   /* dial connects here */
154154   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
155155   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
156156   PORT_SERVICE( 0x10, IP_ACTIVE_HIGH )
src/mame/drivers/pirates.c
r14883r14884
126126//  logerror("%06x: out_w %04x\n",cpu_get_pc(&space.device()),data);
127127}
128128
129static CUSTOM_INPUT( prot_r )
129CUSTOM_INPUT_MEMBER(pirates_state::prot_r)
130130{
131131//  static int prot = 0xa3;
132132//  offs_t pc;
133133   int bit;
134134
135//  logerror("%s: IN1_r\n",field.machine().describe_context());
135//  logerror("%s: IN1_r\n",machine().describe_context());
136136
137137#if 0
138138   /* Pirates protection workaround. It more complicated than this... see code at
139139       602e and 62a6 */
140140   /* For Genix, see 6576 for setting values and 67c2,d3b4 and dbc2 for tests. */
141141
142   pc = cpu_get_pc(field.machine().device("main"));
142   pc = cpu_get_pc(machine().device("main"));
143143   if (pc == 0x6134)
144144   {
145145      bit = prot & 1;
r14883r14884
212212   PORT_BIT( 0x0010, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)   // EEPROM data
213213   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN )      // seems checked in "test mode"
214214   PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN )      // seems checked in "test mode"
215   PORT_BIT( 0x0080, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_CUSTOM(prot_r, NULL)      // protection
215   PORT_BIT( 0x0080, IP_ACTIVE_HIGH,IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, pirates_state,prot_r, NULL)      // protection
216216   /* What do these bits do ? */
217217   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNKNOWN )
218218   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_UNKNOWN )
src/mame/drivers/mquake.c
r14883r14884
164164   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)         /* JS1SW */
165165
166166   PORT_START("JOY0DAT")
167   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P1JOY")
167   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state,amiga_joystick_convert, "P1JOY")
168168   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )
169169
170170   PORT_START("JOY1DAT")
171   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P2JOY")
171   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state,amiga_joystick_convert, "P2JOY")
172172   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )
173173
174174   PORT_START("P1JOY")
src/emu/machine/generic.c
r14883r14884
706706    repeated both in the upper and lower half
707707-------------------------------------------------*/
708708
709CUSTOM_INPUT( custom_port_read )
709CUSTOM_INPUT_MEMBER( driver_device::custom_port_read )
710710{
711711   const char *tag = (const char *)param;
712   return input_port_read(field.machine(), tag);
712   return input_port_read(machine(), tag);
713713}
src/emu/machine/generic.h
r14883r14884
148148INTERRUPT_GEN( irq7_line_pulse );
149149INTERRUPT_GEN( irq7_line_assert );
150150
151
152
153/* ----- generic input port helpers ----- */
154
155/* custom handler */
156CUSTOM_INPUT( custom_port_read );
157
158151#endif   /* __MACHINE_GENERIC_H__ */
src/emu/driver.h
r14883r14884
186186   // 8-8-8 RGB palette write handlers
187187   DECLARE_WRITE16_MEMBER( paletteram16_xrgb_word_be_w );
188188   DECLARE_WRITE16_MEMBER( paletteram16_xbgr_word_be_w );
189   
190   // generic input port helpers
191   // custom handler
192   DECLARE_CUSTOM_INPUT_MEMBER( custom_port_read );
189193
190194protected:
191195   // helpers called at startup
src/mess/drivers/amiga.c
r14883r14884
205205   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
206206
207207   PORT_START("JOY0DAT")
208   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P1JOY")
208   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state,amiga_joystick_convert, "P1JOY")
209209   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED )
210210
211211   PORT_START("JOY1DAT")
212   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P2JOY")
212   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state,amiga_joystick_convert, "P2JOY")
213213   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED )
214214
215215   PORT_START("POTGO")
src/mess/drivers/ami1200.c
r14883r14884
196196   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
197197
198198   PORT_START("JOY0DAT")
199   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P1JOY")
199   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ami1200_state,amiga_joystick_convert, "P1JOY")
200200   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED )
201201
202202   PORT_START("JOY1DAT")
203   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(amiga_joystick_convert, "P2JOY")
203   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ami1200_state,amiga_joystick_convert, "P2JOY")
204204   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED )
205205
206206   PORT_START("POTGO")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team