diff options
author | 2022-09-13 13:16:24 +0200 | |
---|---|---|
committer | 2022-09-13 13:16:24 +0200 | |
commit | da7bdd575c9028a9eba26574e4af9d6474a63f94 (patch) | |
tree | 9d6d0f778b6c6a092afacd6450af3b5e6d2550f4 /src | |
parent | 511e01c1161ea9f14d0468c2a13b0e0fb630bdb4 (diff) |
embargo: remove input tag lookups
Diffstat (limited to 'src')
-rw-r--r-- | src/mame/cinematronics/dlair.cpp | 2 | ||||
-rw-r--r-- | src/mame/cinematronics/embargo.cpp | 74 | ||||
-rwxr-xr-x | src/mame/misc/amuzy.cpp | 2 | ||||
-rw-r--r-- | src/tools/srcclean.cpp | 2 | ||||
-rw-r--r-- | src/tools/unidasm.cpp | 4 | ||||
-rw-r--r-- | src/zexall/zexall.cpp | 7 |
6 files changed, 48 insertions, 43 deletions
diff --git a/src/mame/cinematronics/dlair.cpp b/src/mame/cinematronics/dlair.cpp index 4753cf6092b..7f2490d1a20 100644 --- a/src/mame/cinematronics/dlair.cpp +++ b/src/mame/cinematronics/dlair.cpp @@ -168,8 +168,6 @@ private: * *************************************/ - - static const uint8_t led_map[16] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x77,0x7c,0x39,0x5e,0x79,0x00 }; diff --git a/src/mame/cinematronics/embargo.cpp b/src/mame/cinematronics/embargo.cpp index 04ec77f3c18..a157629901a 100644 --- a/src/mame/cinematronics/embargo.cpp +++ b/src/mame/cinematronics/embargo.cpp @@ -10,37 +10,45 @@ #include "cpu/s2650/s2650.h" #include "screen.h" +namespace { class embargo_state : public driver_device { public: - embargo_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + embargo_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), m_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu") { } + m_inputs(*this, "IN%u", 0), + m_dial(*this, "DIAL%u", 0) + { } void embargo(machine_config &config); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + private: - /* memory pointers */ + required_device<cpu_device> m_maincpu; required_shared_ptr<uint8_t> m_videoram; + required_ioport_array<3> m_inputs; + required_ioport_array<4> m_dial; - /* misc */ - uint8_t m_dial_enable_1 = 0; - uint8_t m_dial_enable_2 = 0; - uint8_t m_input_select = 0; uint8_t input_port_bit_r(); uint8_t dial_r(); void port_1_w(uint8_t data); void port_2_w(uint8_t data); void input_select_w(uint8_t data); - virtual void machine_start() override; - virtual void machine_reset() override; uint32_t screen_update_embargo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - required_device<cpu_device> m_maincpu; + void main_data_map(address_map &map); void main_io_map(address_map &map); void main_map(address_map &map); + + uint8_t m_dial_enable_1 = 0; + uint8_t m_dial_enable_2 = 0; + uint8_t m_input_select = 0; }; @@ -81,7 +89,7 @@ uint32_t embargo_state::screen_update_embargo(screen_device &screen, bitmap_rgb3 uint8_t embargo_state::input_port_bit_r() { - return (ioport("IN1")->read() << (7 - m_input_select)) & 0x80; + return BIT(m_inputs[1]->read(), m_input_select) << 7; } @@ -93,10 +101,7 @@ uint8_t embargo_state::dial_r() uint8_t mapped_lo = 0; uint8_t mapped_hi = 0; - int i; - - /* game reads 4 bits per dial and maps them onto clock directions */ - + // game reads 4 bits per dial and maps them onto clock directions static const uint8_t map[] = { 0x00, 0x0b, 0x01, 0x02, 0x04, 0x04, 0x02, 0x03, @@ -105,20 +110,20 @@ uint8_t embargo_state::dial_r() if (m_dial_enable_1 && !m_dial_enable_2) { - lo = ioport("DIAL0")->read(); - hi = ioport("DIAL1")->read(); + lo = m_dial[0]->read(); + hi = m_dial[1]->read(); } if (m_dial_enable_2 && !m_dial_enable_1) { - lo = ioport("DIAL2")->read(); - hi = ioport("DIAL3")->read(); + lo = m_dial[2]->read(); + hi = m_dial[3]->read(); } lo = 12 * lo / 256; hi = 12 * hi / 256; - for (i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) { if (map[i] == lo) { @@ -137,13 +142,13 @@ uint8_t embargo_state::dial_r() void embargo_state::port_1_w(uint8_t data) { - m_dial_enable_1 = data & 0x01; /* other bits unknown */ + m_dial_enable_1 = data & 0x01; // other bits unknown } void embargo_state::port_2_w(uint8_t data) { - m_dial_enable_2 = data & 0x01; /* other bits unknown */ + m_dial_enable_2 = data & 0x01; // other bits unknown } @@ -179,7 +184,7 @@ void embargo_state::main_io_map(address_map &map) { map(0x01, 0x01).portr("IN0").w(FUNC(embargo_state::port_1_w)); map(0x02, 0x02).rw(FUNC(embargo_state::dial_r), FUNC(embargo_state::port_2_w)); - map(0x03, 0x03).nopw(); /* always 0xFE */ + map(0x03, 0x03).nopw(); // always 0xFE } void embargo_state::main_data_map(address_map &map) @@ -197,15 +202,14 @@ void embargo_state::main_data_map(address_map &map) *************************************/ static INPUT_PORTS_START( embargo ) - - PORT_START("IN0") /* port 0x01 */ + PORT_START("IN0") // port 0x01 PORT_DIPNAME( 0x03, 0x00, "Rounds" ) PORT_DIPSETTING( 0x00, "3" ) PORT_DIPSETTING( 0x01, "4" ) PORT_DIPSETTING( 0x02, "5" ) PORT_DIPSETTING( 0x03, "6" ) - PORT_START("IN1") /* S2650_CONTROL_PORT */ + PORT_START("IN1") // S2650_CONTROL_PORT PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 ) @@ -215,7 +219,7 @@ static INPUT_PORTS_START( embargo ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) - PORT_START("IN2") /* S2650_DATA_PORT */ + PORT_START("IN2") // S2650_DATA_PORT PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_START("DIAL0") @@ -229,7 +233,6 @@ static INPUT_PORTS_START( embargo ) PORT_START("DIAL3") PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(8) PORT_PLAYER(4) - INPUT_PORTS_END @@ -242,7 +245,7 @@ INPUT_PORTS_END void embargo_state::machine_start() { - /* register for state saving */ + // register for state saving save_item(NAME(m_dial_enable_1)); save_item(NAME(m_dial_enable_2)); save_item(NAME(m_input_select)); @@ -256,6 +259,8 @@ void embargo_state::machine_reset() m_input_select = 0; } + + /************************************* * * Machine driver @@ -264,13 +269,13 @@ void embargo_state::machine_reset() void embargo_state::embargo(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware S2650(config, m_maincpu, 625000); m_maincpu->set_addrmap(AS_PROGRAM, &embargo_state::main_map); m_maincpu->set_addrmap(AS_IO, &embargo_state::main_io_map); m_maincpu->set_addrmap(AS_DATA, &embargo_state::main_data_map); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_size(256, 256); screen.set_visarea(0, 255, 0, 239); @@ -298,6 +303,8 @@ ROM_START( embargo ) ROM_LOAD( "emb8", 0x0e00, 0x0200, CRC(f0b00634) SHA1(317aacc9022596a2af0f3b399fe119fe9c8c1679) ) ROM_END +} // anonymous namespace + /************************************* @@ -306,4 +313,5 @@ ROM_END * *************************************/ -GAME( 1977, embargo, 0, embargo, embargo, embargo_state, empty_init, ROT0, "Cinematronics", "Embargo", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) +// YEAR NAME PARENT MACHINE INPUT CLASS INIT SCREEN COMPANY FULLNAME FLAGS +GAME( 1977, embargo, 0, embargo, embargo, embargo_state, empty_init, ROT0, "Cinematronics", "Embargo", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/misc/amuzy.cpp b/src/mame/misc/amuzy.cpp index 70b3157312b..a75ac42d368 100755 --- a/src/mame/misc/amuzy.cpp +++ b/src/mame/misc/amuzy.cpp @@ -167,4 +167,4 @@ ROM_END } // anonymous namespace -GAME( 1994, mmhammer, 0, amuzy, amuzy, amuzy_state, empty_init, ROT0, "Amuzy", "Mogu Mogu Hammer", MACHINE_NOT_WORKING ) +GAME( 2008, mmhammer, 0, amuzy, amuzy, amuzy_state, empty_init, ROT0, "Amuzy", "Mogu Mogu Hammer", MACHINE_NOT_WORKING ) diff --git a/src/tools/srcclean.cpp b/src/tools/srcclean.cpp index 19f550d6f17..2b408040199 100644 --- a/src/tools/srcclean.cpp +++ b/src/tools/srcclean.cpp @@ -4,7 +4,7 @@ srcclean.cpp - Basic source code cleanear. + Basic source code cleaner. ****************************************************************************/ diff --git a/src/tools/unidasm.cpp b/src/tools/unidasm.cpp index 19168392d3d..cd5d04d6db6 100644 --- a/src/tools/unidasm.cpp +++ b/src/tools/unidasm.cpp @@ -2,9 +2,7 @@ // copyright-holders:Aaron Giles /*************************************************************************** - mamedasm.c - - Generic MAME disassembler. + Universal disassembler. ****************************************************************************/ diff --git a/src/zexall/zexall.cpp b/src/zexall/zexall.cpp index 6bc3544a4d0..9be82b8c745 100644 --- a/src/zexall/zexall.cpp +++ b/src/zexall/zexall.cpp @@ -4,7 +4,7 @@ This is a simplified version of the zexall driver, merely as an example for a standalone emulator build. Video terminal and user interface is removed. For full notes and proper - emulation driver, see src/drivers/zexall.cpp. + emulation driver, see src/mame/homebrew/zexall.cpp. ******************************************************************************/ @@ -16,8 +16,8 @@ class zexall_state : public driver_device { public: - zexall_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + zexall_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_main_ram(*this, "main_ram") { @@ -32,6 +32,7 @@ public: void z80_mem(address_map &map); void zexall(machine_config &config); + private: required_device<cpu_device> m_maincpu; required_shared_ptr<uint8_t> m_main_ram; |