summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/n8080.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-09-02 17:22:34 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-09-02 17:22:34 -0400
commit1c202190b48a57a3596b6832dd7030a5e02b55f3 (patch)
tree6a85e1d577c0ff745dc5b43623f4020113a99d34 /src/mame/drivers/n8080.cpp
parentf3ce368aafe6be885f5d35e267c235791c1e4dff (diff)
n8080.cpp: Split up state class; simplify read/write handlers (nw)
Diffstat (limited to 'src/mame/drivers/n8080.cpp')
-rw-r--r--src/mame/drivers/n8080.cpp137
1 files changed, 63 insertions, 74 deletions
diff --git a/src/mame/drivers/n8080.cpp b/src/mame/drivers/n8080.cpp
index 68dffb80894..f7d22494178 100644
--- a/src/mame/drivers/n8080.cpp
+++ b/src/mame/drivers/n8080.cpp
@@ -18,17 +18,18 @@
#define MASTER_CLOCK XTAL(20'160'000)
-WRITE8_MEMBER(n8080_state::n8080_shift_bits_w)
+void n8080_state::n8080_shift_bits_w(uint8_t data)
{
m_shift_bits = data & 7;
}
-WRITE8_MEMBER(n8080_state::n8080_shift_data_w)
+
+void n8080_state::n8080_shift_data_w(uint8_t data)
{
m_shift_data = (m_shift_data >> 8) | (data << 8);
}
-READ8_MEMBER(n8080_state::n8080_shift_r)
+uint8_t n8080_state::n8080_shift_r()
{
return m_shift_data >> (8 - m_shift_bits);
}
@@ -41,7 +42,7 @@ void n8080_state::main_cpu_map(address_map &map)
}
-void n8080_state::helifire_main_cpu_map(address_map &map)
+void helifire_state::main_cpu_map(address_map &map)
{
map(0x0000, 0x3fff).rom();
map(0x4000, 0x7fff).ram().share("videoram");
@@ -453,7 +454,7 @@ WRITE_LINE_MEMBER(n8080_state::n8080_inte_callback)
m_inte = state;
}
-WRITE8_MEMBER(n8080_state::n8080_status_callback)
+void n8080_state::n8080_status_callback(uint8_t data)
{
if (data & i8080_cpu_device::STATUS_INTA)
{
@@ -469,138 +470,126 @@ void n8080_state::machine_start()
save_item(NAME(m_inte));
}
-MACHINE_RESET_MEMBER(n8080_state,n8080)
+void n8080_state::machine_reset()
{
m_shift_data = 0;
m_shift_bits = 0;
m_inte = 0;
}
-MACHINE_RESET_MEMBER(n8080_state,spacefev)
+void spacefev_state::machine_reset()
{
- MACHINE_RESET_CALL_MEMBER(n8080);
+ n8080_state::machine_reset();
- m_spacefev_red_screen = 0;
- m_spacefev_red_cannon = 0;
+ m_red_screen = 0;
+ m_red_cannon = 0;
}
-MACHINE_RESET_MEMBER(n8080_state,sheriff)
+void sheriff_state::machine_reset()
{
- MACHINE_RESET_CALL_MEMBER(n8080);
+ n8080_state::machine_reset();
m_sheriff_color_mode = 0;
m_sheriff_color_data = 0;
}
-MACHINE_RESET_MEMBER(n8080_state,helifire)
+void helifire_state::machine_reset()
{
- MACHINE_RESET_CALL_MEMBER(n8080);
+ n8080_state::machine_reset();
- m_helifire_mv = 0;
- m_helifire_sc = 0;
- m_helifire_flash = 0;
+ m_mv = 0;
+ m_sc = 0;
+ m_flash = 0;
}
-void n8080_state::spacefev(machine_config &config)
+void spacefev_state::spacefev(machine_config &config)
{
/* basic machine hardware */
I8080(config, m_maincpu, MASTER_CLOCK / 10);
- m_maincpu->out_status_func().set(FUNC(n8080_state::n8080_status_callback));
- m_maincpu->out_inte_func().set(FUNC(n8080_state::n8080_inte_callback));
- m_maincpu->set_addrmap(AS_PROGRAM, &n8080_state::main_cpu_map);
- m_maincpu->set_addrmap(AS_IO, &n8080_state::main_io_map);
-
- MCFG_MACHINE_RESET_OVERRIDE(n8080_state,spacefev)
+ m_maincpu->out_status_func().set(FUNC(spacefev_state::n8080_status_callback));
+ m_maincpu->out_inte_func().set(FUNC(spacefev_state::n8080_inte_callback));
+ m_maincpu->set_addrmap(AS_PROGRAM, &spacefev_state::main_cpu_map);
+ m_maincpu->set_addrmap(AS_IO, &spacefev_state::main_io_map);
/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
m_screen->set_size(256, 256);
m_screen->set_visarea(0, 255, 16, 239);
- m_screen->set_screen_update(FUNC(n8080_state::screen_update_spacefev));
+ m_screen->set_screen_update(FUNC(spacefev_state::screen_update));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, FUNC(n8080_state::n8080_palette), 8);
+ PALETTE(config, m_palette, FUNC(spacefev_state::n8080_palette), 8);
- MCFG_VIDEO_START_OVERRIDE(n8080_state,spacefev)
-
- TIMER(config, "rst1").configure_scanline(FUNC(n8080_state::rst1_tick), "screen", 128, 256);
- TIMER(config, "rst2").configure_scanline(FUNC(n8080_state::rst2_tick), "screen", 240, 256);
+ TIMER(config, "rst1").configure_scanline(FUNC(spacefev_state::rst1_tick), "screen", 128, 256);
+ TIMER(config, "rst2").configure_scanline(FUNC(spacefev_state::rst2_tick), "screen", 240, 256);
/* sound hardware */
spacefev_sound(config);
}
-void n8080_state::sheriff(machine_config &config)
+void sheriff_state::sheriff(machine_config &config)
{
/* basic machine hardware */
I8080(config, m_maincpu, MASTER_CLOCK / 10);
- m_maincpu->out_status_func().set(FUNC(n8080_state::n8080_status_callback));
- m_maincpu->out_inte_func().set(FUNC(n8080_state::n8080_inte_callback));
- m_maincpu->set_addrmap(AS_PROGRAM, &n8080_state::main_cpu_map);
- m_maincpu->set_addrmap(AS_IO, &n8080_state::main_io_map);
-
- MCFG_MACHINE_RESET_OVERRIDE(n8080_state,sheriff)
+ m_maincpu->out_status_func().set(FUNC(sheriff_state::n8080_status_callback));
+ m_maincpu->out_inte_func().set(FUNC(sheriff_state::n8080_inte_callback));
+ m_maincpu->set_addrmap(AS_PROGRAM, &sheriff_state::main_cpu_map);
+ m_maincpu->set_addrmap(AS_IO, &sheriff_state::main_io_map);
/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
m_screen->set_size(256, 256);
m_screen->set_visarea(0, 255, 16, 239);
- m_screen->set_screen_update(FUNC(n8080_state::screen_update_sheriff));
+ m_screen->set_screen_update(FUNC(sheriff_state::screen_update));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, FUNC(n8080_state::n8080_palette), 8);
+ PALETTE(config, m_palette, FUNC(sheriff_state::n8080_palette), 8);
- MCFG_VIDEO_START_OVERRIDE(n8080_state,sheriff)
-
- TIMER(config, "rst1").configure_scanline(FUNC(n8080_state::rst1_tick), "screen", 128, 256);
- TIMER(config, "rst2").configure_scanline(FUNC(n8080_state::rst2_tick), "screen", 240, 256);
+ TIMER(config, "rst1").configure_scanline(FUNC(sheriff_state::rst1_tick), "screen", 128, 256);
+ TIMER(config, "rst2").configure_scanline(FUNC(sheriff_state::rst2_tick), "screen", 240, 256);
/* sound hardware */
sheriff_sound(config);
}
-void n8080_state::westgun2(machine_config &config)
+void sheriff_state::westgun2(machine_config &config)
{
sheriff(config);
/* basic machine hardware */
I8080(config.replace(), m_maincpu, XTAL(19'968'000) / 10);
- m_maincpu->out_status_func().set(FUNC(n8080_state::n8080_status_callback));
- m_maincpu->out_inte_func().set(FUNC(n8080_state::n8080_inte_callback));
- m_maincpu->set_addrmap(AS_PROGRAM, &n8080_state::main_cpu_map);
- m_maincpu->set_addrmap(AS_IO, &n8080_state::main_io_map);
+ m_maincpu->out_status_func().set(FUNC(sheriff_state::n8080_status_callback));
+ m_maincpu->out_inte_func().set(FUNC(sheriff_state::n8080_inte_callback));
+ m_maincpu->set_addrmap(AS_PROGRAM, &sheriff_state::main_cpu_map);
+ m_maincpu->set_addrmap(AS_IO, &sheriff_state::main_io_map);
}
-void n8080_state::helifire(machine_config &config)
+void helifire_state::helifire(machine_config &config)
{
/* basic machine hardware */
I8080(config, m_maincpu, MASTER_CLOCK / 10);
- m_maincpu->out_status_func().set(FUNC(n8080_state::n8080_status_callback));
- m_maincpu->out_inte_func().set(FUNC(n8080_state::n8080_inte_callback));
- m_maincpu->set_addrmap(AS_PROGRAM, &n8080_state::helifire_main_cpu_map);
- m_maincpu->set_addrmap(AS_IO, &n8080_state::main_io_map);
-
- MCFG_MACHINE_RESET_OVERRIDE(n8080_state,helifire)
+ m_maincpu->out_status_func().set(FUNC(helifire_state::n8080_status_callback));
+ m_maincpu->out_inte_func().set(FUNC(helifire_state::n8080_inte_callback));
+ m_maincpu->set_addrmap(AS_PROGRAM, &helifire_state::main_cpu_map);
+ m_maincpu->set_addrmap(AS_IO, &helifire_state::main_io_map);
/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
m_screen->set_size(256, 256);
m_screen->set_visarea(0, 255, 16, 239);
- m_screen->set_screen_update(FUNC(n8080_state::screen_update_helifire));
- m_screen->screen_vblank().set(FUNC(n8080_state::screen_vblank_helifire));
+ m_screen->set_screen_update(FUNC(helifire_state::screen_update));
+ m_screen->screen_vblank().set(FUNC(helifire_state::screen_vblank));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, FUNC(n8080_state::helifire_palette), 8 + 0x400);
-
- MCFG_VIDEO_START_OVERRIDE(n8080_state,helifire)
+ PALETTE(config, m_palette, FUNC(helifire_state::helifire_palette), 8 + 0x400);
- TIMER(config, "rst1").configure_scanline(FUNC(n8080_state::rst1_tick), "screen", 128, 256);
- TIMER(config, "rst2").configure_scanline(FUNC(n8080_state::rst2_tick), "screen", 240, 256);
+ TIMER(config, "rst1").configure_scanline(FUNC(helifire_state::rst1_tick), "screen", 128, 256);
+ TIMER(config, "rst2").configure_scanline(FUNC(helifire_state::rst2_tick), "screen", 240, 256);
/* sound hardware */
helifire_sound(config);
@@ -933,15 +922,15 @@ ROM_START( helifirea )
ROM_END
-GAME( 1979, spacefev, 0, spacefev, spacefev, n8080_state, empty_init, ROT270, "Nintendo", "Space Fever (New Ver.)", MACHINE_SUPPORTS_SAVE )
-GAME( 1979, spacefevo, spacefev, spacefev, spacefev, n8080_state, empty_init, ROT270, "Nintendo", "Space Fever (Old Ver.)", MACHINE_SUPPORTS_SAVE )
-GAME( 1979, spacefevo2, spacefev, spacefev, spacefev, n8080_state, empty_init, ROT270, "Nintendo", "Space Fever (Older Ver.)", MACHINE_SUPPORTS_SAVE )
-GAME( 1979, highsplt, 0, spacefev, highsplt, n8080_state, empty_init, ROT270, "Nintendo", "Space Fever High Splitter (set 1)", MACHINE_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer
-GAME( 1979, highsplta, highsplt, spacefev, highsplt, n8080_state, empty_init, ROT270, "Nintendo", "Space Fever High Splitter (set 2)", MACHINE_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer
-GAME( 1979, highspltb, highsplt, spacefev, highsplt, n8080_state, empty_init, ROT270, "Nintendo", "Space Fever High Splitter (alt Sound)", MACHINE_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer
-GAME( 1979, spacelnc, 0, spacefev, spacelnc, n8080_state, empty_init, ROT270, "Nintendo", "Space Launcher", MACHINE_SUPPORTS_SAVE )
-GAME( 1979, sheriff, 0, sheriff, sheriff, n8080_state, empty_init, ROT270, "Nintendo", "Sheriff", MACHINE_SUPPORTS_SAVE )
-GAME( 1980, bandido, sheriff, sheriff, bandido, n8080_state, empty_init, ROT270, "Nintendo (Exidy license)", "Bandido", MACHINE_SUPPORTS_SAVE )
-GAME( 1980, westgun2, sheriff, westgun2, westgun2, n8080_state, empty_init, ROT270, "Nintendo (Taito Corporation license)", "Western Gun Part II", MACHINE_SUPPORTS_SAVE ) // official Taito PCBs, but title/copyright not shown
-GAME( 1980, helifire, 0, helifire, helifire, n8080_state, empty_init, ROT270, "Nintendo", "HeliFire (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
-GAME( 1980, helifirea, helifire, helifire, helifire, n8080_state, empty_init, ROT270, "Nintendo", "HeliFire (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
+GAME( 1979, spacefev, 0, spacefev, spacefev, spacefev_state, empty_init, ROT270, "Nintendo", "Space Fever (New Ver.)", MACHINE_SUPPORTS_SAVE )
+GAME( 1979, spacefevo, spacefev, spacefev, spacefev, spacefev_state, empty_init, ROT270, "Nintendo", "Space Fever (Old Ver.)", MACHINE_SUPPORTS_SAVE )
+GAME( 1979, spacefevo2, spacefev, spacefev, spacefev, spacefev_state, empty_init, ROT270, "Nintendo", "Space Fever (Older Ver.)", MACHINE_SUPPORTS_SAVE )
+GAME( 1979, highsplt, 0, spacefev, highsplt, spacefev_state, empty_init, ROT270, "Nintendo", "Space Fever High Splitter (set 1)", MACHINE_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer
+GAME( 1979, highsplta, highsplt, spacefev, highsplt, spacefev_state, empty_init, ROT270, "Nintendo", "Space Fever High Splitter (set 2)", MACHINE_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer
+GAME( 1979, highspltb, highsplt, spacefev, highsplt, spacefev_state, empty_init, ROT270, "Nintendo", "Space Fever High Splitter (alt Sound)", MACHINE_SUPPORTS_SAVE ) // known as "SF-Hisplitter" on its flyer
+GAME( 1979, spacelnc, 0, spacefev, spacelnc, spacefev_state, empty_init, ROT270, "Nintendo", "Space Launcher", MACHINE_SUPPORTS_SAVE )
+GAME( 1979, sheriff, 0, sheriff, sheriff, sheriff_state, empty_init, ROT270, "Nintendo", "Sheriff", MACHINE_SUPPORTS_SAVE )
+GAME( 1980, bandido, sheriff, sheriff, bandido, sheriff_state, empty_init, ROT270, "Nintendo (Exidy license)", "Bandido", MACHINE_SUPPORTS_SAVE )
+GAME( 1980, westgun2, sheriff, westgun2, westgun2, sheriff_state, empty_init, ROT270, "Nintendo (Taito Corporation license)", "Western Gun Part II", MACHINE_SUPPORTS_SAVE ) // official Taito PCBs, but title/copyright not shown
+GAME( 1980, helifire, 0, helifire, helifire, helifire_state, empty_init, ROT270, "Nintendo", "HeliFire (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
+GAME( 1980, helifirea, helifire, helifire, helifire, helifire_state, empty_init, ROT270, "Nintendo", "HeliFire (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )