diff --git a/src/emu/driver.cpp b/src/emu/driver.cpp index 53a4280b493..57d68c929ef 100644 --- a/src/emu/driver.cpp +++ b/src/emu/driver.cpp @@ -391,21 +391,3 @@ void driver_device::flip_screen_y_set(u32 on) updateflip(); } } - - -/*************************************************************************** -PORT READING HELPERS -***************************************************************************/ - -/*------------------------------------------------- -custom_port_read - act like input_port_read -but it is a custom port, it is useful for -e.g. input ports which expect the same port -repeated both in the upper and lower half --------------------------------------------------*/ - -CUSTOM_INPUT_MEMBER(driver_device::custom_port_read) -{ - const char *tag = (const char *)param; - return ioport(tag)->read(); -} diff --git a/src/emu/driver.h b/src/emu/driver.h index 5711012188e..4f6576aa737 100644 --- a/src/emu/driver.h +++ b/src/emu/driver.h @@ -157,10 +157,6 @@ public: void irq7_line_hold(device_t &device); void irq7_line_assert(device_t &device); - - // generic input port helpers - DECLARE_CUSTOM_INPUT_MEMBER( custom_port_read ); - virtual void driver_init(); protected: diff --git a/src/mame/drivers/cyclemb.cpp b/src/mame/drivers/cyclemb.cpp index 6b6bcf6c84c..95721e1cab7 100644 --- a/src/mame/drivers/cyclemb.cpp +++ b/src/mame/drivers/cyclemb.cpp @@ -95,7 +95,8 @@ public: m_cram(*this, "cram"), m_obj1_ram(*this, "obj1_ram"), m_obj2_ram(*this, "obj2_ram"), - m_obj3_ram(*this, "obj3_ram") + m_obj3_ram(*this, "obj3_ram"), + m_pad(*this, "PAD_P%u", 1U) { } required_device m_maincpu; @@ -110,6 +111,8 @@ public: required_shared_ptr m_obj2_ram; required_shared_ptr m_obj3_ram; + optional_ioport_array<2> m_pad; + struct { uint8_t rxd; @@ -131,6 +134,8 @@ public: DECLARE_WRITE8_MEMBER(skydest_i8741_1_w); // DECLARE_WRITE_LINE_MEMBER(ym_irq); + template DECLARE_CUSTOM_INPUT_MEMBER(pad_r); + void init_skydest(); void init_cyclemb(); virtual void machine_start() override; @@ -662,6 +667,12 @@ void cyclemb_state::machine_reset() skydest_i8741_reset(); } +template +CUSTOM_INPUT_MEMBER(cyclemb_state::pad_r) +{ + return m_pad[P]->read(); +} + static INPUT_PORTS_START( cyclemb ) PORT_START("SYSTEM") @@ -696,7 +707,7 @@ static INPUT_PORTS_START( cyclemb ) PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("P1_1") - PORT_BIT( 0x9f, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "PAD_P1") + PORT_BIT( 0x9f, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cyclemb_state, pad_r<0>, nullptr) PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("PAD_P1") @@ -719,7 +730,7 @@ static INPUT_PORTS_START( cyclemb ) PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("P2_1") - PORT_BIT( 0x9f, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "PAD_P2") + PORT_BIT( 0x9f, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, cyclemb_state, pad_r<1>, nullptr) PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("PAD_P2") diff --git a/src/mame/drivers/dbz.cpp b/src/mame/drivers/dbz.cpp index 4a0dd10023f..fdfce43cc09 100644 --- a/src/mame/drivers/dbz.cpp +++ b/src/mame/drivers/dbz.cpp @@ -125,7 +125,7 @@ void dbz_state::dbz_map(address_map &map) map(0x4d4000, 0x4d401f).w(m_k053936_2, FUNC(k053936_device::ctrl_w)); map(0x4e0000, 0x4e0001).portr("P1_P2"); map(0x4e0002, 0x4e0003).portr("SYSTEM_DSW1"); - map(0x4e4000, 0x4e4001).portr("DSW2"); + map(0x4e4000, 0x4e4001).lr8("4e4000", [this]() { return uint8_t(m_dsw2->read()); }); map(0x4e8000, 0x4e8001).nopw(); map(0x4ec000, 0x4ec001).w(FUNC(dbz_state::dbzcontrol_w)); map(0x4f0000, 0x4f0001).w(FUNC(dbz_state::dbz_sound_command_w)); @@ -213,10 +213,6 @@ static INPUT_PORTS_START( dbz ) PORT_DIPSETTING( 0x8000, DEF_STR( On ) ) PORT_START("DSW2") - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE") - PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE") - - PORT_START("FAKE") PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3,4") PORT_DIPSETTING( 0x02, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) ) diff --git a/src/mame/drivers/dreamwld.cpp b/src/mame/drivers/dreamwld.cpp index b3ad315f009..2ef556a2e32 100644 --- a/src/mame/drivers/dreamwld.cpp +++ b/src/mame/drivers/dreamwld.cpp @@ -118,6 +118,7 @@ public: , m_prot(*this, "prot") , m_spritelut(*this, "spritelut") , m_okibank(*this, "oki%ubank", 1) + , m_dsw(*this, "DSW") , m_maincpu(*this, "maincpu") , m_gfxdecode(*this, "gfxdecode") , m_palette(*this, "palette") @@ -138,6 +139,7 @@ private: optional_memory_region m_prot; required_memory_region m_spritelut; optional_memory_bank_array<2> m_okibank; + required_ioport m_dsw; std::unique_ptr m_lineram16; @@ -154,6 +156,11 @@ private: /* misc */ int m_protindex; + + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + template DECLARE_WRITE32_MEMBER(vram_w); DECLARE_READ32_MEMBER(protdata_r); template DECLARE_WRITE32_MEMBER(okibank_w); @@ -164,9 +171,6 @@ private: uint32_t screen_update_dreamwld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank_dreamwld); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; void baryon_map(address_map &map); void dreamwld_map(address_map &map); void oki1_map(address_map &map); @@ -428,7 +432,7 @@ void dreamwld_state::baryon_map(address_map &map) map(0x804400, 0x805fff).ram().share("vregs"); map(0xc00000, 0xc00003).portr("INPUTS"); - map(0xc00004, 0xc00007).portr("c00004"); + map(0xc00004, 0xc00007).lr16("c00004", [this]() { return uint16_t(m_dsw->read()); }); map(0xc0000c, 0xc0000f).w(FUNC(dreamwld_state::okibank_w<0>)); // sfx map(0xc00018, 0xc00018).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // sfx @@ -469,10 +473,6 @@ static INPUT_PORTS_START( dreamwld ) PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) - PORT_START("c00004") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_START("DSW") PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x0002, "2" ) @@ -539,10 +539,6 @@ static INPUT_PORTS_START( rolcrush ) PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) - PORT_START("c00004") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_START("DSW") PORT_DIPUNUSED_DIPLOC( 0x0001, IP_ACTIVE_LOW, "SW2:1" ) /* As listed in service mode, but tested */ PORT_DIPUNUSED_DIPLOC( 0x0002, IP_ACTIVE_LOW, "SW2:2" ) /* These might have some use, requires investigation of code */ @@ -601,10 +597,6 @@ static INPUT_PORTS_START( cutefght ) PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) - PORT_START("c00004") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_START("DSW") PORT_DIPUNUSED_DIPLOC( 0x0001, IP_ACTIVE_LOW, "SW2:1" ) /* As listed in service mode, but tested */ PORT_DIPUNUSED_DIPLOC( 0x0002, IP_ACTIVE_LOW, "SW2:2" ) /* These might have some use, requires investigation of code */ @@ -666,10 +658,6 @@ static INPUT_PORTS_START( gaialast ) PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) - PORT_START("c00004") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_START("DSW") PORT_DIPNAME( 0x0003, 0x0001, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x0002, "1" ) diff --git a/src/mame/drivers/fuukifg3.cpp b/src/mame/drivers/fuukifg3.cpp index 3100b376249..839113656fe 100644 --- a/src/mame/drivers/fuukifg3.cpp +++ b/src/mame/drivers/fuukifg3.cpp @@ -221,10 +221,10 @@ void fuuki32_state::fuuki32_map(address_map &map) map(0x600000, 0x601fff).ram().rw(m_fuukivid, FUNC(fuukivid_device::fuuki_sprram_r), FUNC(fuukivid_device::fuuki_sprram_w)); // Sprites map(0x700000, 0x703fff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette"); // Palette - map(0x800000, 0x800003).portr("800000").nopw(); // Coin - map(0x810000, 0x810003).portr("810000").nopw(); // Player Inputs - map(0x880000, 0x880003).portr("880000"); // Service + DIPS - map(0x890000, 0x890003).portr("890000"); // More DIPS + map(0x800000, 0x800003).lr16("800000", [this]() { return uint16_t(m_system->read()); }).nopw(); // Coin + map(0x810000, 0x810003).lr16("810000", [this]() { return uint16_t(m_inputs->read()); }).nopw(); // Player Inputs + map(0x880000, 0x880003).lr16("880000", [this]() { return uint16_t(m_dsw1->read()); }); // Service + DIPS + map(0x890000, 0x890003).lr16("890000", [this]() { return uint16_t(m_dsw2->read()); }); // More DIPS map(0x8c0000, 0x8c001f).ram().w(FUNC(fuuki32_state::vregs_w)).share("vregs"); // Video Registers map(0x8d0000, 0x8d0003).ram(); // Flipscreen Related @@ -270,22 +270,6 @@ void fuuki32_state::fuuki32_sound_io_map(address_map &map) ***************************************************************************/ static INPUT_PORTS_START( asurabld ) - PORT_START("800000") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "SYSTEM") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "SYSTEM") - - PORT_START("810000") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "INPUTS") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "INPUTS") - - PORT_START("880000") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW1") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW1") - - PORT_START("890000") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW2") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW2") - PORT_START("SYSTEM") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) diff --git a/src/mame/drivers/jaguar.cpp b/src/mame/drivers/jaguar.cpp index d85a7e570f6..4d8dc94383e 100644 --- a/src/mame/drivers/jaguar.cpp +++ b/src/mame/drivers/jaguar.cpp @@ -1349,7 +1349,7 @@ void jaguar_state::r3000_map(address_map &map) map(0x04f03000, 0x04f03fff).mirror(0x00008000).ram().share("gpuram"); map(0x04f10000, 0x04f103ff).rw(FUNC(jaguar_state::jerry_regs_r), FUNC(jaguar_state::jerry_regs_w)); map(0x04f16000, 0x04f1600b).r(FUNC(jaguar_state::cojag_gun_input_r)); // GPI02 - map(0x04f17000, 0x04f17003).portr("SYSTEM"); // GPI03 + map(0x04f17000, 0x04f17003).lr16("4f17000", [this]() { return uint16_t(m_system->read()); }); // GPI03 map(0x04f17800, 0x04f17803).w(FUNC(jaguar_state::latch_w)); // GPI04 map(0x04f17c00, 0x04f17c03).portr("P1_P2"); // GPI05 map(0x04f1a100, 0x04f1a13f).rw(FUNC(jaguar_state::dspctrl_r), FUNC(jaguar_state::dspctrl_w)); @@ -1539,7 +1539,7 @@ void jaguar_state::jagcd_dsp_map(address_map &map) * *************************************/ -/* "FAKE0" is read at 0x04f17000 +/* "SYSTEM" is read at 0x04f17000 D23-20 = /SER-4-1 D19-16 = COINR4-1 D7 = /VSYNCNEQ @@ -1559,10 +1559,6 @@ static INPUT_PORTS_START( area51 ) PORT_BIT( 0xfe000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("SYSTEM") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0") - - PORT_START("FAKE0") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) @@ -1617,10 +1613,6 @@ static INPUT_PORTS_START( freezeat ) PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_START("SYSTEM") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0") - - PORT_START("FAKE0") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) @@ -1661,10 +1653,6 @@ static INPUT_PORTS_START( fishfren ) PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_START("SYSTEM") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0") - - PORT_START("FAKE0") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) @@ -1711,10 +1699,6 @@ static INPUT_PORTS_START( vcircle ) PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_START("SYSTEM") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE0") - - PORT_START("FAKE0") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 ) diff --git a/src/mame/drivers/midvunit.cpp b/src/mame/drivers/midvunit.cpp index 7a019dc7b9f..22610c0c6a4 100644 --- a/src/mame/drivers/midvunit.cpp +++ b/src/mame/drivers/midvunit.cpp @@ -280,8 +280,8 @@ WRITE32_MEMBER(midvunit_state::tms32031_control_w) READ32_MEMBER(midvunit_state::crusnwld_serial_status_r) { - int status = m_midway_serial_pic->status_r(space,0); - return (ioport("991030")->read() & 0x7fff7fff) | (status << 31) | (status << 15); + uint16_t in1 = (m_in1->read() & 0x7fff) | (m_midway_serial_pic->status_r(space,0) << 15); + return in1 | in1 << 16; } @@ -342,8 +342,8 @@ WRITE32_MEMBER(midvunit_state::bit_reset_w) READ32_MEMBER(midvunit_state::offroadc_serial_status_r) { - int status = m_midway_serial_pic2->status_r(space,0); - return (ioport("991030")->read() & 0x7fff7fff) | (status << 31) | (status << 15); + uint16_t in1 = (m_in1->read() & 0x7fff) | (m_midway_serial_pic2->status_r(space,0) << 15); + return in1 | in1 << 16; } @@ -599,10 +599,10 @@ void midvunit_state::midvunit_map(address_map &map) map(0x980080, 0x980080).noprw(); map(0x980082, 0x980083).r(FUNC(midvunit_state::midvunit_dma_trigger_r)); map(0x990000, 0x990000).nopr(); // link PAL (low 4 bits must == 4) - map(0x991030, 0x991030).portr("991030"); + map(0x991030, 0x991030).lr16("991030", [this]() { return uint16_t(m_in1->read()); }); // AM_RANGE(0x991050, 0x991050) AM_READONLY // seems to be another port map(0x991060, 0x991060).r(FUNC(midvunit_state::port0_r)); - map(0x992000, 0x992000).portr("992000"); + map(0x992000, 0x992000).lr16("992000", [this]() { return uint16_t(m_dsw->read()); }); map(0x993000, 0x993000).rw(FUNC(midvunit_state::adc_r), FUNC(midvunit_state::adc_w)); map(0x994000, 0x994000).w(FUNC(midvunit_state::midvunit_control_w)); map(0x995000, 0x995000).rw(FUNC(midvunit_state::midvunit_wheel_board_r), FUNC(midvunit_state::midvunit_wheel_board_w)); @@ -649,14 +649,6 @@ void midvunit_state::midvplus_map(address_map &map) *************************************/ static INPUT_PORTS_START( midvunit ) - PORT_START("991030") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "IN1") - - PORT_START("992000") - PORT_BIT( 0x0000ffff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "DSW") - PORT_START("IN0") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) diff --git a/src/mame/drivers/psikyo4.cpp b/src/mame/drivers/psikyo4.cpp index 95b83cbbd28..9a9173b194d 100644 --- a/src/mame/drivers/psikyo4.cpp +++ b/src/mame/drivers/psikyo4.cpp @@ -298,16 +298,21 @@ void psikyo4_state::ps4_ymf_map(address_map &map) } +CUSTOM_INPUT_MEMBER(psikyo4_state::system_r) +{ + return m_system->read(); +} + static INPUT_PORTS_START( hotgmck ) PORT_START("P1_P2") - PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "SYSTEM") + PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo4_state, system_r, nullptr) PORT_BIT( 0x00ffff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo4_state,mahjong_ctrl_r, (void *)0) + PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo4_state, mahjong_ctrl_r, (void *)0) PORT_START("P3_P4") - PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "SYSTEM") + PORT_BIT( 0x000000ff, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo4_state, system_r, nullptr) PORT_BIT( 0x00ffff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo4_state,mahjong_ctrl_r, (void *)4) + PORT_BIT( 0xff000000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_CUSTOM_MEMBER(DEVICE_SELF, psikyo4_state, mahjong_ctrl_r, (void *)4) PORT_START("JP4")/* jumper pads 'JP4' on the PCB */ /* EEPROM is read here */ diff --git a/src/mame/drivers/stadhero.cpp b/src/mame/drivers/stadhero.cpp index f89861bbfb1..7810bb18e8a 100644 --- a/src/mame/drivers/stadhero.cpp +++ b/src/mame/drivers/stadhero.cpp @@ -54,7 +54,7 @@ void stadhero_state::main_map(address_map &map) map(0x240010, 0x240017).w(m_tilegen, FUNC(deco_bac06_device::pf_control_1_w)); map(0x260000, 0x261fff).rw(m_tilegen, FUNC(deco_bac06_device::pf_data_r), FUNC(deco_bac06_device::pf_data_w)); map(0x30c000, 0x30c001).portr("INPUTS"); - map(0x30c002, 0x30c003).portr("COIN"); + map(0x30c002, 0x30c003).lr8("30c002", [this]() { return uint8_t(m_coin->read()); }); map(0x30c004, 0x30c005).portr("DSW").w(FUNC(stadhero_state::int_ack_w)); map(0x30c007, 0x30c007).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0x310000, 0x3107ff).ram().w("palette", FUNC(palette_device::write16)).share("palette"); @@ -133,10 +133,6 @@ static INPUT_PORTS_START( stadhero ) PORT_DIPUNUSED( 0x8000, IP_ACTIVE_LOW ) PORT_START("COIN") /* 0x30c002 & 0x30c003 */ - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE") - PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE") - - PORT_START("FAKE") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */ diff --git a/src/mame/includes/dbz.h b/src/mame/includes/dbz.h index 36fa5b921dd..464639852c1 100644 --- a/src/mame/includes/dbz.h +++ b/src/mame/includes/dbz.h @@ -35,7 +35,8 @@ public: m_k053936_1(*this, "k053936_1"), m_k053936_2(*this, "k053936_2"), m_gfxdecode(*this, "gfxdecode"), - m_soundlatch(*this, "soundlatch") + m_soundlatch(*this, "soundlatch"), + m_dsw2(*this, "DSW2") { } void dbz(machine_config &config); @@ -71,6 +72,8 @@ private: required_device m_gfxdecode; required_device m_soundlatch; + required_ioport m_dsw2; + DECLARE_WRITE16_MEMBER(dbzcontrol_w); DECLARE_WRITE16_MEMBER(dbz_sound_command_w); DECLARE_WRITE16_MEMBER(dbz_sound_cause_nmi); diff --git a/src/mame/includes/fuukifg3.h b/src/mame/includes/fuukifg3.h index 9a1518a6a93..9f0293fc7de 100644 --- a/src/mame/includes/fuukifg3.h +++ b/src/mame/includes/fuukifg3.h @@ -34,6 +34,10 @@ public: , m_tilebank(*this, "tilebank") , m_shared_ram(*this, "shared_ram") , m_soundbank(*this, "soundbank") + , m_system(*this, "SYSTEM") + , m_inputs(*this, "INPUTS") + , m_dsw1(*this, "DSW1") + , m_dsw2(*this, "DSW2") { } void fuuki32(machine_config &config); @@ -64,6 +68,11 @@ private: required_memory_bank m_soundbank; + required_ioport m_system; + required_ioport m_inputs; + required_ioport m_dsw1; + required_ioport m_dsw2; + /* video-related */ tilemap_t *m_tilemap[4]; uint32_t m_spr_buffered_tilebank[2]; diff --git a/src/mame/includes/jaguar.h b/src/mame/includes/jaguar.h index 36845ff4625..2effde1bd00 100644 --- a/src/mame/includes/jaguar.h +++ b/src/mame/includes/jaguar.h @@ -54,6 +54,7 @@ public: , m_config_io(*this, "CONFIG") , m_joy(*this, "JOY%u", 0U) , m_buttons(*this, "BUTTONS%u", 0U) + , m_system(*this, "SYSTEM") , m_is_r3000(false) , m_is_cojag(false) , m_hacks_enabled(false) @@ -128,6 +129,7 @@ private: optional_ioport m_config_io; optional_ioport_array<8> m_joy; optional_ioport_array<8> m_buttons; + optional_ioport m_system; // configuration bool m_is_r3000; diff --git a/src/mame/includes/midvunit.h b/src/mame/includes/midvunit.h index 1b340276749..8ae14464192 100644 --- a/src/mame/includes/midvunit.h +++ b/src/mame/includes/midvunit.h @@ -69,6 +69,8 @@ public: m_dcs(*this, "dcs"), m_generic_paletteram_32(*this, "paletteram"), m_optional_drivers(*this, "lamp%u", 0U), + m_in1(*this, "IN1"), + m_dsw(*this, "DSW"), m_motion(*this, "MOTION") { } void midvcommon(machine_config &config); @@ -185,6 +187,8 @@ private: required_device m_dcs; required_shared_ptr m_generic_paletteram_32; output_finder<8> m_optional_drivers; + optional_ioport m_in1; + optional_ioport m_dsw; optional_ioport m_motion; void postload(); diff --git a/src/mame/includes/psikyo4.h b/src/mame/includes/psikyo4.h index 67954dc2ecf..a9540ac5946 100644 --- a/src/mame/includes/psikyo4.h +++ b/src/mame/includes/psikyo4.h @@ -29,12 +29,14 @@ public: m_palette(*this, {"lpalette", "rpalette"}), m_lscreen(*this, "lscreen"), m_rscreen(*this, "rscreen"), + m_system(*this, "SYSTEM"), m_keys(*this, "KEY.%u", 0) { } void ps4big(machine_config &config); void ps4small(machine_config &config); + DECLARE_CUSTOM_INPUT_MEMBER(system_r); DECLARE_CUSTOM_INPUT_MEMBER(mahjong_ctrl_r); private: @@ -61,6 +63,7 @@ private: required_device_array m_palette; required_device m_lscreen; required_device m_rscreen; + optional_ioport m_system; optional_ioport_array<8> m_keys; DECLARE_WRITE32_MEMBER(paletteram_w); diff --git a/src/mame/includes/stadhero.h b/src/mame/includes/stadhero.h index 64d5128ab2e..20d6844771f 100644 --- a/src/mame/includes/stadhero.h +++ b/src/mame/includes/stadhero.h @@ -17,7 +17,10 @@ public: m_gfxdecode(*this, "gfxdecode"), m_soundlatch(*this, "soundlatch"), m_spriteram(*this, "spriteram"), - m_pf1_data(*this, "pf1_data") { } + m_pf1_data(*this, "pf1_data"), + m_coin(*this, "COIN") + { + } void stadhero(machine_config &config); @@ -32,6 +35,8 @@ private: required_shared_ptr m_spriteram; required_shared_ptr m_pf1_data; + required_ioport m_coin; + tilemap_t *m_pf1_tilemap; DECLARE_WRITE16_MEMBER(int_ack_w);