From c101058be68ba143c37d1bfb241b7aef4e665759 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 22 Feb 2018 20:20:27 +1100 Subject: more cleanup and encapsulation (nw) --- src/mame/drivers/a2600.cpp | 6 +-- src/mame/drivers/appoooh.cpp | 2 - src/mame/drivers/aussiebyte.cpp | 8 ++- src/mame/drivers/bagman.cpp | 99 ++++++++++++------------------------- src/mame/drivers/batman.cpp | 2 - src/mame/drivers/bzone.cpp | 31 ++++++------ src/mame/drivers/ladybug.cpp | 6 +-- src/mame/drivers/p2000t.cpp | 17 +++---- src/mame/includes/a2600.h | 15 +++--- src/mame/includes/appoooh.h | 76 +++++++++++++++------------- src/mame/includes/aussiebyte.h | 11 +++-- src/mame/includes/bagman.h | 106 ++++++++++++++++++++++++---------------- src/mame/includes/batman.h | 1 - src/mame/includes/bzone.h | 65 +++++++++++++++++------- src/mame/includes/jedi.h | 2 +- src/mame/includes/ladybug.h | 89 ++++++++++++++++----------------- src/mame/includes/opwolf.h | 103 +++++++++++++++++++------------------- src/mame/includes/p2000t.h | 55 +++++++++++++++------ src/mame/includes/redclash.h | 25 +++++++++- src/mame/video/appoooh.cpp | 2 +- src/mame/video/batman.cpp | 4 -- src/mame/video/jedi.cpp | 4 +- src/mame/video/ladybug.cpp | 2 +- src/mame/video/p2000t.cpp | 4 +- 24 files changed, 394 insertions(+), 341 deletions(-) diff --git a/src/mame/drivers/a2600.cpp b/src/mame/drivers/a2600.cpp index 10e5269f637..8a8bfd9885f 100644 --- a/src/mame/drivers/a2600.cpp +++ b/src/mame/drivers/a2600.cpp @@ -284,7 +284,7 @@ WRITE8_MEMBER(a2600_state::cart_over_tia_w) m_tia->write(space, offset, data); } -MACHINE_START_MEMBER(a2600_state,a2600) +void a2600_state::machine_start() { m_current_screen_height = m_screen->height(); memset(m_riot_ram, 0x00, 0x80); @@ -499,8 +499,6 @@ MACHINE_CONFIG_START(a2600_state::a2600) MCFG_M6502_DISABLE_DIRECT() MCFG_CPU_PROGRAM_MAP(a2600_mem) - MCFG_MACHINE_START_OVERRIDE(a2600_state,a2600) - /* video hardware */ MCFG_DEVICE_ADD("tia_video", TIA_NTSC_VIDEO, 0) MCFG_TIA_READ_INPUT_PORT_CB(READ16(a2600_state, a2600_read_input_port)) @@ -548,8 +546,6 @@ MACHINE_CONFIG_START(a2600_state::a2600p) MCFG_CPU_PROGRAM_MAP(a2600_mem) MCFG_M6502_DISABLE_DIRECT() - MCFG_MACHINE_START_OVERRIDE(a2600_state,a2600) - /* video hardware */ MCFG_DEVICE_ADD("tia_video", TIA_PAL_VIDEO, 0) MCFG_TIA_READ_INPUT_PORT_CB(READ16(a2600_state, a2600_read_input_port)) diff --git a/src/mame/drivers/appoooh.cpp b/src/mame/drivers/appoooh.cpp index 3769c5baac0..4bca537a70c 100644 --- a/src/mame/drivers/appoooh.cpp +++ b/src/mame/drivers/appoooh.cpp @@ -460,7 +460,6 @@ MACHINE_CONFIG_START(appoooh_state::appoooh) MCFG_PALETTE_ADD("palette", 32*8+32*8) MCFG_PALETTE_INIT_OWNER(appoooh_state,appoooh) - MCFG_VIDEO_START_OVERRIDE(appoooh_state,appoooh) MACHINE_CONFIG_END @@ -483,7 +482,6 @@ MACHINE_CONFIG_START(appoooh_state::robowres) MCFG_PALETTE_ADD("palette", 32*8+32*8) MCFG_PALETTE_INIT_OWNER(appoooh_state,robowres) - MCFG_VIDEO_START_OVERRIDE(appoooh_state,appoooh) MACHINE_CONFIG_END MACHINE_CONFIG_START(appoooh_state::robowrese) diff --git a/src/mame/drivers/aussiebyte.cpp b/src/mame/drivers/aussiebyte.cpp index e89421bfbca..84db0050557 100644 --- a/src/mame/drivers/aussiebyte.cpp +++ b/src/mame/drivers/aussiebyte.cpp @@ -426,7 +426,7 @@ SLOT_INTERFACE_END Machine Driver ************************************************************/ -MACHINE_RESET_MEMBER( aussiebyte_state, aussiebyte ) +void aussiebyte_state::machine_reset() { m_port15 = false; m_port17 = 0; @@ -448,8 +448,6 @@ MACHINE_CONFIG_START(aussiebyte_state::aussiebyte) MCFG_CPU_IO_MAP(aussiebyte_io) MCFG_Z80_DAISY_CHAIN(daisy_chain_intf) - MCFG_MACHINE_RESET_OVERRIDE(aussiebyte_state, aussiebyte ) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(50) @@ -543,7 +541,7 @@ MACHINE_CONFIG_START(aussiebyte_state::aussiebyte) MACHINE_CONFIG_END -DRIVER_INIT_MEMBER( aussiebyte_state, aussiebyte ) +void aussiebyte_state::machine_start() { // Main ram is divided into 16k blocks (0-15). The boot rom is block number 16. // For convenience, bank 0 is permanently assigned to C000-FFFF @@ -578,4 +576,4 @@ ROM_START(aussieby) ROM_END // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1984, aussieby, 0, 0, aussiebyte, aussiebyte, aussiebyte_state, aussiebyte, "SME Systems", "Aussie Byte II" , MACHINE_IMPERFECT_GRAPHICS ) +COMP( 1984, aussieby, 0, 0, aussiebyte, aussiebyte, aussiebyte_state, 0, "SME Systems", "Aussie Byte II" , MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/bagman.cpp b/src/mame/drivers/bagman.cpp index 8bcb430479b..5e5d499e0f3 100644 --- a/src/mame/drivers/bagman.cpp +++ b/src/mame/drivers/bagman.cpp @@ -80,13 +80,12 @@ void bagman_state::machine_start() save_item(NAME(m_video_enable)); } -MACHINE_START_MEMBER(bagman_state, squaitsa) +void squaitsa_state::machine_start() { bagman_state::machine_start(); - save_item(NAME(m_p1_res)); - save_item(NAME(m_p1_old_val)); - save_item(NAME(m_p2_res)); - save_item(NAME(m_p2_old_val)); + + save_item(NAME(m_res)); + save_item(NAME(m_old_val)); } @@ -315,8 +314,7 @@ static INPUT_PORTS_START( squaitsa ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) // special handling for the p1 dial - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // ^ + PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, squaitsa_state, dial_input_r<0>, nullptr) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_START("P2") @@ -325,8 +323,7 @@ static INPUT_PORTS_START( squaitsa ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) // special handling for the p2 dial - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) // ^ + PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, squaitsa_state, dial_input_r<1>, nullptr) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_START("DSW") @@ -400,44 +397,22 @@ GFXDECODE_END /* squaitsa doesn't map the dial directly, instead it polls the results of the dial through an external circuitry. I don't know if the following is correct, there can possibly be multiple solutions for the same problem. */ -READ8_MEMBER(bagman_state::dial_input_p1_r) +template CUSTOM_INPUT_MEMBER(squaitsa_state::dial_input_r) { - uint8_t dial_val; - - dial_val = ioport("DIAL_P1")->read(); - - if(m_p1_res != 0x60) - m_p1_res = 0x60; - else if(dial_val > m_p1_old_val) - m_p1_res = 0x40; - else if(dial_val < m_p1_old_val) - m_p1_res = 0x20; + uint8_t const dial_val = m_dial[N]->read(); + + if(m_res[N] != 0x03) + m_res[N] = 0x03; + else if(dial_val > m_old_val[N]) + m_res[N] = 0x02; + else if(dial_val < m_old_val[N]) + m_res[N] = 0x01; else - m_p1_res = 0x60; + m_res[N] = 0x03; - m_p1_old_val = dial_val; + m_old_val[N] = dial_val; - return (ioport("P1")->read() & 0x9f) | (m_p1_res); -} - -READ8_MEMBER(bagman_state::dial_input_p2_r) -{ - uint8_t dial_val; - - dial_val = ioport("DIAL_P2")->read(); - - if(m_p2_res != 0x60) - m_p2_res = 0x60; - else if(dial_val > m_p2_old_val) - m_p2_res = 0x40; - else if(dial_val < m_p2_old_val) - m_p2_res = 0x20; - else - m_p2_res = 0x60; - - m_p2_old_val = dial_val; - - return (ioport("P2")->read() & 0x9f) | (m_p2_res); + return m_res[N]; } INTERRUPT_GEN_MEMBER(bagman_state::vblank_irq) @@ -627,16 +602,6 @@ MACHINE_CONFIG_START(bagman_state::botanic) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) MACHINE_CONFIG_END -MACHINE_CONFIG_START(bagman_state::squaitsa) - botanic(config); - MCFG_MACHINE_START_OVERRIDE(bagman_state, squaitsa) - - MCFG_SOUND_MODIFY("aysnd") - MCFG_AY8910_PORT_A_READ_CB(READ8(bagman_state, dial_input_p1_r)) - MCFG_AY8910_PORT_B_READ_CB(READ8(bagman_state, dial_input_p2_r)) - -MACHINE_CONFIG_END - /*************************************************************************** @@ -1093,21 +1058,21 @@ ROM_START( squaitsa ) ROM_END -GAME( 1982, bagman, 0, bagman, bagman, bagman_state, 0, ROT270, "Valadon Automation", "Bagman", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagnard, bagman, bagman, bagman, bagman_state, 0, ROT270, "Valadon Automation", "Le Bagnard (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagnarda, bagman, bagman, bagman, bagman_state, 0, ROT270, "Valadon Automation", "Le Bagnard (set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagnardi, bagman, bagman, bagman, bagman_state, 0, ROT90, "Valadon Automation (Itisa license)", "Le Bagnard (Itisa, Spain)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagmans, bagman, bagman, bagmans, bagman_state, 0, ROT270, "Valadon Automation (Stern Electronics license)", "Bagman (Stern Electronics, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagmans2, bagman, bagman, bagman, bagman_state, 0, ROT270, "Valadon Automation (Stern Electronics license)", "Bagman (Stern Electronics, set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bagmanj, bagman, bagman, bagman, bagman_state, 0, ROT270, "Valadon Automation (Taito license)", "Bagman (Taito)", MACHINE_SUPPORTS_SAVE ) // title screen actually doesn't mention Valadon, only Stern and Taito +GAME( 1982, bagman, 0, bagman, bagman, bagman_state, 0, ROT270, "Valadon Automation", "Bagman", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagnard, bagman, bagman, bagman, bagman_state, 0, ROT270, "Valadon Automation", "Le Bagnard (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagnarda, bagman, bagman, bagman, bagman_state, 0, ROT270, "Valadon Automation", "Le Bagnard (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagnardi, bagman, bagman, bagman, bagman_state, 0, ROT90, "Valadon Automation (Itisa license)", "Le Bagnard (Itisa, Spain)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagmans, bagman, bagman, bagmans, bagman_state, 0, ROT270, "Valadon Automation (Stern Electronics license)", "Bagman (Stern Electronics, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagmans2, bagman, bagman, bagman, bagman_state, 0, ROT270, "Valadon Automation (Stern Electronics license)", "Bagman (Stern Electronics, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bagmanj, bagman, bagman, bagman, bagman_state, 0, ROT270, "Valadon Automation (Taito license)", "Bagman (Taito)", MACHINE_SUPPORTS_SAVE ) // title screen actually doesn't mention Valadon, only Stern and Taito -GAME( 1984, sbagman, 0, sbagman, sbagman, bagman_state, 0, ROT270, "Valadon Automation", "Super Bagman", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, sbagmani, sbagman, sbagmani, sbagman, bagman_state, 0, ROT90, "Valadon Automation (Itisa license)", "Super Bagman (Itisa, Spain)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // different color PROMs, needs correct decoding -GAME( 1984, sbagmans, sbagman, sbagman, sbagman, bagman_state, 0, ROT270, "Valadon Automation (Stern Electronics license)", "Super Bagman (Stern Electronics)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, sbagman, 0, sbagman, sbagman, bagman_state, 0, ROT270, "Valadon Automation", "Super Bagman", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, sbagmani, sbagman, sbagmani, sbagman, bagman_state, 0, ROT90, "Valadon Automation (Itisa license)", "Super Bagman (Itisa, Spain)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // different color PROMs, needs correct decoding +GAME( 1984, sbagmans, sbagman, sbagman, sbagman, bagman_state, 0, ROT270, "Valadon Automation (Stern Electronics license)", "Super Bagman (Stern Electronics)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, pickin, 0, pickin, pickin, bagman_state, 0, ROT270, "Valadon Automation", "Pickin'", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, pickin, 0, pickin, pickin, bagman_state, 0, ROT270, "Valadon Automation", "Pickin'", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, botanic, 0, botanic, botanici, bagman_state, 0, ROT90, "Itisa", "Botanic (English / Spanish)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, botanicf, botanic, botanic, botanicf, bagman_state, 0, ROT270, "Itisa (Valadon Automation license)", "Botanic (French)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, botanic, 0, botanic, botanici, bagman_state, 0, ROT90, "Itisa", "Botanic (English / Spanish)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, botanicf, botanic, botanic, botanicf, bagman_state, 0, ROT270, "Itisa (Valadon Automation license)", "Botanic (French)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, squaitsa, 0, squaitsa, squaitsa, bagman_state, 0, ROT0, "Itisa", "Squash (Itisa)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, squaitsa, 0, botanic, squaitsa, squaitsa_state, 0, ROT0, "Itisa", "Squash (Itisa)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/batman.cpp b/src/mame/drivers/batman.cpp index 698253cf746..c402ec51f38 100644 --- a/src/mame/drivers/batman.cpp +++ b/src/mame/drivers/batman.cpp @@ -221,8 +221,6 @@ MACHINE_CONFIG_START(batman_state::batman) MCFG_SCREEN_UPDATE_DRIVER(batman_state, screen_update_batman) MCFG_SCREEN_PALETTE("palette") - MCFG_VIDEO_START_OVERRIDE(batman_state,batman) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/bzone.cpp b/src/mame/drivers/bzone.cpp index 0cb26c75efd..f8370939367 100644 --- a/src/mame/drivers/bzone.cpp +++ b/src/mame/drivers/bzone.cpp @@ -234,9 +234,9 @@ void bzone_state::machine_start() } -MACHINE_START_MEMBER(bzone_state,redbaron) +void redbaron_state::machine_start() { - save_item(NAME(m_analog_data)); + bzone_state::machine_start(); save_item(NAME(m_rb_input_select)); } @@ -281,12 +281,12 @@ WRITE8_MEMBER(bzone_state::bzone_coin_counter_w) * *************************************/ -READ8_MEMBER(bzone_state::redbaron_joy_r) +READ8_MEMBER(redbaron_state::redbaron_joy_r) { - return ioport(m_rb_input_select ? "FAKE1" : "FAKE2")->read(); + return m_fake_ports[m_rb_input_select ? 0 : 1]->read(); } -WRITE8_MEMBER(bzone_state::redbaron_joysound_w) +WRITE8_MEMBER(redbaron_state::redbaron_joysound_w) { m_rb_input_select = data & 1; m_redbaronsound->sounds_w(space, offset, data); @@ -320,7 +320,7 @@ ADDRESS_MAP_START(bzone_state::bzone_map) AM_RANGE(0x3000, 0x7fff) AM_ROM ADDRESS_MAP_END -ADDRESS_MAP_START(bzone_state::redbaron_map) +ADDRESS_MAP_START(redbaron_state::redbaron_map) ADDRESS_MAP_GLOBAL_MASK(0x7fff) AM_RANGE(0x0000, 0x03ff) AM_RAM AM_RANGE(0x0800, 0x0800) AM_READ_PORT("IN0") @@ -570,15 +570,13 @@ MACHINE_CONFIG_END -MACHINE_CONFIG_START(bzone_state::redbaron) +MACHINE_CONFIG_START(redbaron_state::redbaron) bzone_base(config); /* basic machine hardware */ MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(redbaron_map) - MCFG_MACHINE_START_OVERRIDE(bzone_state,redbaron) - MCFG_ATARIVGEAROM_ADD("earom") /* video hardware */ @@ -586,12 +584,11 @@ MACHINE_CONFIG_START(bzone_state::redbaron) MCFG_SCREEN_REFRESH_RATE(BZONE_CLOCK_3KHZ / 12 / 4) MCFG_SCREEN_VISIBLE_AREA(0, 520, 0, 400) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("pokey", POKEY, 1500000) - MCFG_POKEY_ALLPOT_R_CB(READ8(bzone_state, redbaron_joy_r)) + MCFG_POKEY_ALLPOT_R_CB(READ8(redbaron_state, redbaron_joy_r)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MCFG_SOUND_ADD("custom", REDBARON, 0) @@ -883,9 +880,9 @@ DRIVER_INIT_MEMBER(bzone_state,bradley) * *************************************/ -GAMEL(1980, bzone, 0, bzone, bzone, bzone_state, 0, ROT0, "Atari", "Battle Zone (rev 2)", MACHINE_SUPPORTS_SAVE, layout_bzone ) -GAMEL(1980, bzonea, bzone, bzone, bzone, bzone_state, 0, ROT0, "Atari", "Battle Zone (rev 1)", MACHINE_SUPPORTS_SAVE, layout_bzone ) -GAMEL(1980, bzonec, bzone, bzone, bzone, bzone_state, 0, ROT0, "Atari", "Battle Zone (cocktail)", MACHINE_SUPPORTS_SAVE|MACHINE_NO_COCKTAIL, layout_bzone ) -GAME( 1980, bradley, 0, bzone, bradley, bzone_state, bradley, ROT0, "Atari", "Bradley Trainer", MACHINE_SUPPORTS_SAVE ) -GAMEL(1980, redbaron, 0, redbaron, redbaron, bzone_state, 0, ROT0, "Atari", "Red Baron (Revised Hardware)", MACHINE_SUPPORTS_SAVE, layout_redbaron ) -GAMEL(1980, redbarona, redbaron, redbaron, redbaron, bzone_state, 0, ROT0, "Atari", "Red Baron", MACHINE_SUPPORTS_SAVE, layout_redbaron ) +GAMEL(1980, bzone, 0, bzone, bzone, bzone_state, 0, ROT0, "Atari", "Battle Zone (rev 2)", MACHINE_SUPPORTS_SAVE, layout_bzone ) +GAMEL(1980, bzonea, bzone, bzone, bzone, bzone_state, 0, ROT0, "Atari", "Battle Zone (rev 1)", MACHINE_SUPPORTS_SAVE, layout_bzone ) +GAMEL(1980, bzonec, bzone, bzone, bzone, bzone_state, 0, ROT0, "Atari", "Battle Zone (cocktail)", MACHINE_SUPPORTS_SAVE|MACHINE_NO_COCKTAIL, layout_bzone ) +GAME( 1980, bradley, 0, bzone, bradley, bzone_state, bradley, ROT0, "Atari", "Bradley Trainer", MACHINE_SUPPORTS_SAVE ) +GAMEL(1980, redbaron, 0, redbaron, redbaron, redbaron_state, 0, ROT0, "Atari", "Red Baron (Revised Hardware)", MACHINE_SUPPORTS_SAVE, layout_redbaron ) +GAMEL(1980, redbarona, redbaron, redbaron, redbaron, redbaron_state, 0, ROT0, "Atari", "Red Baron", MACHINE_SUPPORTS_SAVE, layout_redbaron ) diff --git a/src/mame/drivers/ladybug.cpp b/src/mame/drivers/ladybug.cpp index e513e301372..9722ff59d45 100644 --- a/src/mame/drivers/ladybug.cpp +++ b/src/mame/drivers/ladybug.cpp @@ -510,7 +510,7 @@ static GFXDECODE_START( ladybug ) GFXDECODE_ENTRY( "gfx2", 0, spritelayout2, 4*8, 16 ) GFXDECODE_END -MACHINE_START_MEMBER(ladybug_state,ladybug) +void ladybug_state::machine_start() { } @@ -520,8 +520,6 @@ MACHINE_CONFIG_START(ladybug_state::ladybug) MCFG_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz */ MCFG_CPU_PROGRAM_MAP(ladybug_map) - MCFG_MACHINE_START_OVERRIDE(ladybug_state,ladybug) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -539,8 +537,6 @@ MACHINE_CONFIG_START(ladybug_state::ladybug) MCFG_DEVICE_ADD("videolatch", LS259, 0) // L5 on video board or H3 on single board MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(ladybug_state, flipscreen_w)) // no other outputs used - MCFG_VIDEO_START_OVERRIDE(ladybug_state,ladybug) - /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mame/drivers/p2000t.cpp b/src/mame/drivers/p2000t.cpp index ffba4321bf6..acd56d1b7cb 100644 --- a/src/mame/drivers/p2000t.cpp +++ b/src/mame/drivers/p2000t.cpp @@ -58,7 +58,7 @@ ADDRESS_MAP_START(p2000t_state::p2000t_mem) AM_RANGE(0xa000, 0xffff) AM_NOP ADDRESS_MAP_END -ADDRESS_MAP_START(p2000t_state::p2000m_mem) +ADDRESS_MAP_START(p2000m_state::p2000m_mem) AM_RANGE(0x0000, 0x0fff) AM_ROM AM_RANGE(0x1000, 0x4fff) AM_ROM AM_RANGE(0x5000, 0x5fff) AM_RAM AM_SHARE("videoram") @@ -80,7 +80,7 @@ static const gfx_layout p2000m_charlayout = 8 * 10 }; -PALETTE_INIT_MEMBER(p2000t_state,p2000m) +PALETTE_INIT_MEMBER(p2000m_state,p2000m) { palette.set_pen_color(0,rgb_t::white()); /* white */ palette.set_pen_color(1,rgb_t::black()); /* black */ @@ -246,12 +246,12 @@ MACHINE_CONFIG_END /* Machine definition */ -MACHINE_CONFIG_START(p2000t_state::p2000m) +MACHINE_CONFIG_START(p2000m_state::p2000m) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, 2500000) MCFG_CPU_PROGRAM_MAP(p2000m_mem) MCFG_CPU_IO_MAP(p2000t_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", p2000t_state, p2000_interrupt) + MCFG_CPU_VBLANK_INT_DRIVER("screen", p2000m_state, p2000_interrupt) MCFG_QUANTUM_TIME(attotime::from_hz(60)) /* video hardware */ @@ -260,13 +260,12 @@ MACHINE_CONFIG_START(p2000t_state::p2000m) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(80 * 12, 24 * 20) MCFG_SCREEN_VISIBLE_AREA(0, 80 * 12 - 1, 0, 24 * 20 - 1) - MCFG_VIDEO_START_OVERRIDE(p2000t_state,p2000m) - MCFG_SCREEN_UPDATE_DRIVER(p2000t_state, screen_update_p2000m) + MCFG_SCREEN_UPDATE_DRIVER(p2000m_state, screen_update_p2000m) MCFG_SCREEN_PALETTE("palette") - MCFG_GFXDECODE_ADD("gfxdecode", "palette", p2000m ) + MCFG_GFXDECODE_ADD("gfxdecode", "palette", p2000m) MCFG_PALETTE_ADD("palette", 4) - MCFG_PALETTE_INIT_OWNER(p2000t_state,p2000m) + MCFG_PALETTE_INIT_OWNER(p2000m_state,p2000m) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -292,4 +291,4 @@ ROM_END // YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS COMP ( 1980, p2000t, 0, 0, p2000t, p2000t, p2000t_state, 0, "Philips", "Philips P2000T", 0 ) -COMP ( 1980, p2000m, p2000t, 0, p2000m, p2000t, p2000t_state, 0, "Philips", "Philips P2000M", 0 ) +COMP ( 1980, p2000m, p2000t, 0, p2000m, p2000t, p2000m_state, 0, "Philips", "Philips P2000M", 0 ) diff --git a/src/mame/includes/a2600.h b/src/mame/includes/a2600.h index 338c95f89da..60e933f8d2f 100644 --- a/src/mame/includes/a2600.h +++ b/src/mame/includes/a2600.h @@ -52,10 +52,11 @@ public: m_riot(*this, "riot") { } - required_shared_ptr m_riot_ram; - uint16_t m_current_screen_height; + void a2600(machine_config &config); + void a2600p(machine_config &config); - DECLARE_MACHINE_START(a2600); +protected: + virtual void machine_start() override; DECLARE_WRITE8_MEMBER(switch_A_w); DECLARE_READ8_MEMBER(switch_A_r); DECLARE_WRITE8_MEMBER(switch_B_w); @@ -72,11 +73,13 @@ public: DECLARE_READ8_MEMBER(cart_over_all_r); DECLARE_WRITE8_MEMBER(cart_over_all_w); - void a2600p(machine_config &config); - void a2600(machine_config &config); void a2600_cartslot(machine_config &config); void a2600_mem(address_map &map); -protected: + +private: + required_shared_ptr m_riot_ram; + uint16_t m_current_screen_height; + required_device m_joy1; required_device m_joy2; optional_device m_cart; diff --git a/src/mame/includes/appoooh.h b/src/mame/includes/appoooh.h index d93fdbea760..2bbf52e6895 100644 --- a/src/mame/includes/appoooh.h +++ b/src/mame/includes/appoooh.h @@ -1,12 +1,17 @@ // license:BSD-3-Clause // copyright-holders:Tatsuyuki Satoh +#ifndef MAME_INCLUDES_APPOOOH_H +#define MAME_INCLUDES_APPOOOH_H + +#pragma once + #include "sound/msm5205.h" class appoooh_state : public driver_device { public: - appoooh_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + appoooh_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_spriteram(*this, "spriteram"), m_fg_videoram(*this, "fg_videoram"), m_fg_colorram(*this, "fg_colorram"), @@ -17,8 +22,42 @@ public: m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), - m_msm(*this, "msm") { } + m_msm(*this, "msm") + { } + + DECLARE_DRIVER_INIT(robowresb); + void appoooh(machine_config &config); + void robowres(machine_config &config); + void robowrese(machine_config &config); + +protected: + DECLARE_WRITE8_MEMBER(adpcm_w); + DECLARE_WRITE8_MEMBER(scroll_w); + DECLARE_WRITE8_MEMBER(fg_videoram_w); + DECLARE_WRITE8_MEMBER(fg_colorram_w); + DECLARE_WRITE8_MEMBER(bg_videoram_w); + DECLARE_WRITE8_MEMBER(bg_colorram_w); + DECLARE_WRITE8_MEMBER(out_w); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + DECLARE_PALETTE_INIT(appoooh); + DECLARE_PALETTE_INIT(robowres); + uint32_t screen_update_appoooh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_robowres(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(vblank_irq); + void appoooh_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, uint8_t *sprite ); + void robowres_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, uint8_t *sprite ); + DECLARE_WRITE_LINE_MEMBER(adpcm_int); + void appoooh_common(machine_config &config); + void decrypted_opcodes_map(address_map &map); + void main_map(address_map &map); + void main_portmap(address_map &map); + +private: /* memory pointers */ required_shared_ptr m_spriteram; required_shared_ptr m_fg_videoram; @@ -45,35 +84,6 @@ public: required_device m_msm; uint8_t m_nmi_mask; - DECLARE_WRITE8_MEMBER(adpcm_w); - DECLARE_WRITE8_MEMBER(scroll_w); - DECLARE_WRITE8_MEMBER(fg_videoram_w); - DECLARE_WRITE8_MEMBER(fg_colorram_w); - DECLARE_WRITE8_MEMBER(bg_videoram_w); - DECLARE_WRITE8_MEMBER(bg_colorram_w); - DECLARE_WRITE8_MEMBER(out_w); - DECLARE_DRIVER_INIT(robowresb); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - DECLARE_VIDEO_START(appoooh); - DECLARE_PALETTE_INIT(appoooh); - DECLARE_PALETTE_INIT(robowres); - uint32_t screen_update_appoooh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_robowres(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vblank_irq); - void appoooh_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, uint8_t *sprite ); - void robowres_draw_sprites( bitmap_ind16 &dest_bmp, const rectangle &cliprect, gfx_element *gfx, uint8_t *sprite ); - DECLARE_WRITE_LINE_MEMBER(adpcm_int); - void robowrese(machine_config &config); - void robowres(machine_config &config); - void appoooh(machine_config &config); - void appoooh_common(machine_config &config); - void decrypted_opcodes_map(address_map &map); - void main_map(address_map &map); - void main_portmap(address_map &map); }; -#define CHR1_OFST 0x00 /* palette page of char set #1 */ -#define CHR2_OFST 0x10 /* palette page of char set #2 */ +#endif // MAME_INCLUDES_APPOOOH_H diff --git a/src/mame/includes/aussiebyte.h b/src/mame/includes/aussiebyte.h index 3feb32aabc1..9eb9790fcf5 100644 --- a/src/mame/includes/aussiebyte.h +++ b/src/mame/includes/aussiebyte.h @@ -58,8 +58,11 @@ public: , m_speaker(*this, "speaker") , m_votrax(*this, "votrax") , m_rtc(*this, "rtc") - {} + { } + void aussiebyte(machine_config &config); + +protected: DECLARE_READ8_MEMBER(memory_read_byte); DECLARE_WRITE8_MEMBER(memory_write_byte); DECLARE_READ8_MEMBER(io_read_byte); @@ -90,17 +93,17 @@ public: DECLARE_WRITE_LINE_MEMBER(sio1_rdyb_w); DECLARE_WRITE_LINE_MEMBER(sio2_rdya_w); DECLARE_WRITE_LINE_MEMBER(sio2_rdyb_w); - DECLARE_MACHINE_RESET(aussiebyte); - DECLARE_DRIVER_INIT(aussiebyte); DECLARE_WRITE_LINE_MEMBER(ctc_z2_w); DECLARE_WRITE8_MEMBER(address_w); DECLARE_WRITE8_MEMBER(register_w); MC6845_UPDATE_ROW(crtc_update_row); MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr); - void aussiebyte(machine_config &config); + virtual void machine_start() override; + virtual void machine_reset() override; void aussiebyte_io(address_map &map); void aussiebyte_map(address_map &map); + private: uint8_t crt8002(uint8_t ac_ra, uint8_t ac_chr, uint8_t ac_attr, uint16_t ac_cnt, bool ac_curs); bool m_port15; // rom switched in (0), out (1) diff --git a/src/mame/includes/bagman.h b/src/mame/includes/bagman.h index 24d09ea525b..680c758d922 100644 --- a/src/mame/includes/bagman.h +++ b/src/mame/includes/bagman.h @@ -1,5 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria +#ifndef MAME_INCLUDES_BAGMAN_H +#define MAME_INCLUDES_BAGMAN_H + +#pragma once + #include "machine/74259.h" #include "sound/tms5110.h" @@ -7,8 +12,8 @@ class bagman_state : public driver_device { public: - bagman_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + bagman_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), @@ -16,36 +21,16 @@ public: m_tmslatch(*this, "tmslatch"), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), - m_spriteram(*this, "spriteram") { } - - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - optional_device m_tmsprom; - optional_device m_tmslatch; - - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_shared_ptr m_spriteram; - - bool m_irq_mask; - bool m_video_enable; - uint8_t m_p1_res; - uint8_t m_p1_old_val; - uint8_t m_p2_res; - uint8_t m_p2_old_val; - - /*table holds outputs of all ANDs (after AND map)*/ - uint8_t m_andmap[64]; + m_spriteram(*this, "spriteram") + { } - /*table holds inputs (ie. not x, x, not q, q) to the AND map*/ - uint8_t m_columnvalue[32]; - - /*8 output pins (actually 6 output and 2 input/output)*/ - uint8_t m_outvalue[8]; - - tilemap_t *m_bg_tilemap; + void botanic(machine_config &config); + void sbagman(machine_config &config); + void bagman(machine_config &config); + void pickin(machine_config &config); + void sbagmani(machine_config &config); +protected: // common DECLARE_WRITE_LINE_MEMBER(coin_counter_w); DECLARE_WRITE_LINE_MEMBER(irq_mask_w); @@ -63,14 +48,9 @@ public: DECLARE_WRITE8_MEMBER(pal16r6_w); DECLARE_READ8_MEMBER(pal16r6_r); - // squaitsa - DECLARE_READ8_MEMBER(dial_input_p1_r); - DECLARE_READ8_MEMBER(dial_input_p2_r); - TILE_GET_INFO_MEMBER(get_bg_tile_info); virtual void machine_start() override; - DECLARE_MACHINE_START(squaitsa); virtual void machine_reset() override; virtual void video_start() override; DECLARE_PALETTE_INIT(bagman); @@ -80,17 +60,59 @@ public: uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); void update_pal(); - void botanic(machine_config &config); - void squaitsa(machine_config &config); - void sbagman(machine_config &config); - void bagman(machine_config &config); - void pickin(machine_config &config); - void sbagmani(machine_config &config); void main_map(address_map &map); void main_portmap(address_map &map); void pickin_map(address_map &map); + +private: + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + optional_device m_tmsprom; + optional_device m_tmslatch; + + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_shared_ptr m_spriteram; + + bool m_irq_mask; + bool m_video_enable; + + /*table holds outputs of all ANDs (after AND map)*/ + uint8_t m_andmap[64]; + + /*table holds inputs (ie. not x, x, not q, q) to the AND map*/ + uint8_t m_columnvalue[32]; + + /*8 output pins (actually 6 output and 2 input/output)*/ + uint8_t m_outvalue[8]; + + tilemap_t *m_bg_tilemap; }; + +class squaitsa_state : public bagman_state +{ +public: + squaitsa_state(const machine_config &mconfig, device_type type, const char *tag) : + bagman_state(mconfig, type, tag), + m_dial(*this, "DIAL_P%u", 1), + m_res{ 0, 0 }, + m_old_val{ 0, 0 } + { } + + template DECLARE_CUSTOM_INPUT_MEMBER(dial_input_r); + +protected: + virtual void machine_start() override; + +private: + required_ioport_array<2> m_dial; + uint8_t m_res[2]; + uint8_t m_old_val[2]; +}; + + /*----------- timings -----------*/ #define BAGMAN_MAIN_CLOCK XTAL(18'432'000) @@ -110,3 +132,5 @@ public: */ #define VBEND (0x10) #define VBSTART (0xf0) + +#endif // MAME_INCLUDES_BAGMAN_H diff --git a/src/mame/includes/batman.h b/src/mame/includes/batman.h index 1b8094ea01e..4118e09ef6c 100644 --- a/src/mame/includes/batman.h +++ b/src/mame/includes/batman.h @@ -32,7 +32,6 @@ protected: TILE_GET_INFO_MEMBER(get_alpha_tile_info); TILE_GET_INFO_MEMBER(get_playfield_tile_info); TILE_GET_INFO_MEMBER(get_playfield2_tile_info); - DECLARE_VIDEO_START(batman); uint32_t screen_update_batman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); virtual void update_interrupts() override; diff --git a/src/mame/includes/bzone.h b/src/mame/includes/bzone.h index 1d5aecea14d..b4b71c84988 100644 --- a/src/mame/includes/bzone.h +++ b/src/mame/includes/bzone.h @@ -5,6 +5,10 @@ Atari Battle Zone hardware *************************************************************************/ +#ifndef MAME_INCLUDES_BZONE_H +#define MAME_INCLUDES_BZONE_H + +#pragma once #include "audio/redbaron.h" #include "machine/mathbox.h" @@ -16,36 +20,61 @@ class bzone_state : public driver_device { public: - bzone_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + bzone_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_mathbox(*this, "mathbox"), - m_discrete(*this, "discrete"), - m_redbaronsound(*this, "custom") - { } + m_discrete(*this, "discrete") + { } - required_device m_maincpu; - required_device m_mathbox; - optional_device m_discrete; - optional_device m_redbaronsound; + DECLARE_CUSTOM_INPUT_MEMBER(clock_r); + DECLARE_DRIVER_INIT(bradley); + void bzone(machine_config &config); - uint8_t m_analog_data; - uint8_t m_rb_input_select; +protected: DECLARE_WRITE8_MEMBER(bzone_coin_counter_w); DECLARE_READ8_MEMBER(analog_data_r); DECLARE_WRITE8_MEMBER(analog_select_w); - DECLARE_CUSTOM_INPUT_MEMBER(clock_r); - DECLARE_READ8_MEMBER(redbaron_joy_r); - DECLARE_WRITE8_MEMBER(redbaron_joysound_w); - DECLARE_DRIVER_INIT(bradley); virtual void machine_start() override; - DECLARE_MACHINE_START(redbaron); INTERRUPT_GEN_MEMBER(bzone_interrupt); DECLARE_WRITE8_MEMBER(bzone_sounds_w); + void bzone_base(machine_config &config); - void redbaron(machine_config &config); - void bzone(machine_config &config); void bzone_audio(machine_config &config); void bzone_map(address_map &map); + +private: + required_device m_maincpu; + required_device m_mathbox; + optional_device m_discrete; + + uint8_t m_analog_data; +}; + + +class redbaron_state : public bzone_state +{ +public: + redbaron_state(const machine_config &mconfig, device_type type, const char *tag) : + bzone_state(mconfig, type, tag), + m_redbaronsound(*this, "custom"), + m_fake_ports(*this, "FAKE%u", 1U) + { } + + void redbaron(machine_config &config); + +protected: + DECLARE_READ8_MEMBER(redbaron_joy_r); + DECLARE_WRITE8_MEMBER(redbaron_joysound_w); + + virtual void machine_start() override; + void redbaron_map(address_map &map); + +private: + required_device m_redbaronsound; + required_ioport_array<2> m_fake_ports; + uint8_t m_rb_input_select; }; + +#endif // MAME_INCLUDES_BZONE_H diff --git a/src/mame/includes/jedi.h b/src/mame/includes/jedi.h index ba12b49e08e..e6b0ce9b6ba 100644 --- a/src/mame/includes/jedi.h +++ b/src/mame/includes/jedi.h @@ -67,7 +67,7 @@ protected: virtual void machine_reset() override; virtual void sound_start() override; virtual void sound_reset() override; - DECLARE_VIDEO_START(jedi); + virtual void video_start() override; DECLARE_WRITE_LINE_MEMBER(foreground_bank_w); DECLARE_WRITE_LINE_MEMBER(video_off_w); uint32_t screen_update_jedi(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); diff --git a/src/mame/includes/ladybug.h b/src/mame/includes/ladybug.h index 274e8c860ab..8f8328a7a31 100644 --- a/src/mame/includes/ladybug.h +++ b/src/mame/includes/ladybug.h @@ -5,75 +5,72 @@ Universal 8106-A2 + 8106-B PCB set *************************************************************************/ +#ifndef MAME_INCLUDES_LADYBUG_H +#define MAME_INCLUDES_LADYBUG_H + +#pragma once class ladybug_state : public driver_device { public: - ladybug_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ladybug_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), m_spriteram(*this, "spriteram"), - m_grid_data(*this, "grid_data"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), + m_colorram(*this, "colorram"), + m_decrypted_opcodes(*this, "decrypted_opcodes"), m_port_dsw0(*this, "DSW0"), m_p1_control(*this, "CONTP1"), - m_p2_control(*this, "CONTP2"), - m_decrypted_opcodes(*this, "decrypted_opcodes") { } - - /* memory pointers */ - required_shared_ptr m_videoram; - optional_shared_ptr m_colorram; - required_shared_ptr m_spriteram; - optional_shared_ptr m_grid_data; - - /* video-related */ - tilemap_t *m_bg_tilemap; - tilemap_t *m_grid_tilemap; // ladybug - uint8_t m_grid_color; - int m_star_speed; - uint8_t m_stars_enable; - uint8_t m_stars_speed; - uint32_t m_stars_state; - uint16_t m_stars_offset; - uint8_t m_stars_count; - - /* misc */ - uint8_t m_sound_low; - uint8_t m_sound_high; - uint8_t m_weird_value[8]; + m_p2_control(*this, "CONTP2") + { } - /* devices */ - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - optional_ioport m_port_dsw0; - optional_ioport m_p1_control; - optional_ioport m_p2_control; - optional_shared_ptr m_decrypted_opcodes; - - DECLARE_WRITE8_MEMBER(ladybug_videoram_w); - DECLARE_WRITE8_MEMBER(ladybug_colorram_w); - DECLARE_WRITE_LINE_MEMBER(flipscreen_w); DECLARE_CUSTOM_INPUT_MEMBER(ladybug_p1_control_r); DECLARE_CUSTOM_INPUT_MEMBER(ladybug_p2_control_r); DECLARE_INPUT_CHANGED_MEMBER(coin1_inserted); DECLARE_INPUT_CHANGED_MEMBER(coin2_inserted); DECLARE_DRIVER_INIT(dorodon); + void dorodon(machine_config &config); + void ladybug(machine_config &config); + +protected: + DECLARE_WRITE8_MEMBER(ladybug_videoram_w); + DECLARE_WRITE8_MEMBER(ladybug_colorram_w); + DECLARE_WRITE_LINE_MEMBER(flipscreen_w); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_grid_tile_info); - DECLARE_MACHINE_START(ladybug); - DECLARE_VIDEO_START(ladybug); + virtual void machine_start() override; + virtual void video_start() override; DECLARE_PALETTE_INIT(ladybug); uint32_t screen_update_ladybug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); void palette_init_common( palette_device &palette, const uint8_t *color_prom, int r_bit0, int r_bit1, int g_bit0, int g_bit1, int b_bit0, int b_bit1 ); - void dorodon(machine_config &config); - void ladybug(machine_config &config); - void decrypted_opcodes_map(address_map &map); - void ladybug_map(address_map &map); + void decrypted_opcodes_map(address_map &map); + void ladybug_map(address_map &map); + + /* memory pointers */ + required_shared_ptr m_videoram; + required_shared_ptr m_spriteram; + + /* devices */ + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + + /* video-related */ + tilemap_t *m_bg_tilemap; + +private: + optional_shared_ptr m_colorram; + optional_shared_ptr m_decrypted_opcodes; + + optional_ioport m_port_dsw0; + optional_ioport m_p1_control; + optional_ioport m_p2_control; }; + +#endif // MAME_INCLUDES_LADYBUG_H diff --git a/src/mame/includes/opwolf.h b/src/mame/includes/opwolf.h index c974e611cdd..a878b0f930f 100644 --- a/src/mame/includes/opwolf.h +++ b/src/mame/includes/opwolf.h @@ -27,8 +27,8 @@ public: TIMER_CCHIP }; - opwolf_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + opwolf_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_cchip_ram(*this, "cchip_ram"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), @@ -36,8 +36,57 @@ public: m_pc080sn(*this, "pc080sn"), m_pc090oj(*this, "pc090oj"), m_msm1(*this, "msm1"), - m_msm2(*this, "msm2") { } + m_msm2(*this, "msm2") + { } + DECLARE_CUSTOM_INPUT_MEMBER(opwolf_gun_x_r); + DECLARE_CUSTOM_INPUT_MEMBER(opwolf_gun_y_r); + DECLARE_DRIVER_INIT(opwolf); + DECLARE_DRIVER_INIT(opwolfb); + DECLARE_DRIVER_INIT(opwolfp); + void opwolf(machine_config &config); + void opwolfb(machine_config &config); + void opwolfp(machine_config &config); + +protected: + DECLARE_READ16_MEMBER(cchip_r); + DECLARE_WRITE16_MEMBER(cchip_w); + DECLARE_READ16_MEMBER(opwolf_in_r); + DECLARE_READ16_MEMBER(opwolf_dsw_r); + DECLARE_READ16_MEMBER(opwolf_lightgun_r); + DECLARE_READ8_MEMBER(z80_input1_r); + DECLARE_READ8_MEMBER(z80_input2_r); + DECLARE_WRITE8_MEMBER(opwolf_adpcm_d_w); + DECLARE_WRITE8_MEMBER(opwolf_adpcm_e_w); + DECLARE_WRITE16_MEMBER(opwolf_cchip_status_w); + DECLARE_WRITE16_MEMBER(opwolf_cchip_bank_w); + DECLARE_WRITE16_MEMBER(opwolf_cchip_data_w); + DECLARE_READ16_MEMBER(opwolf_cchip_status_r); + DECLARE_READ16_MEMBER(opwolf_cchip_data_r); + DECLARE_WRITE16_MEMBER(opwolf_spritectrl_w); + DECLARE_WRITE8_MEMBER(sound_bankswitch_w); + DECLARE_WRITE8_MEMBER(opwolf_adpcm_b_w); + DECLARE_WRITE8_MEMBER(opwolf_adpcm_c_w); + + virtual void machine_start() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + DECLARE_MACHINE_RESET(opwolf); + uint32_t screen_update_opwolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(opwolf_timer_callback); + TIMER_CALLBACK_MEMBER(cchip_timer); + void updateDifficulty(int mode); + void opwolf_cchip_init(); + void opwolf_msm5205_vck(msm5205_device *device, int chip); + DECLARE_WRITE_LINE_MEMBER(opwolf_msm5205_vck_1); + DECLARE_WRITE_LINE_MEMBER(opwolf_msm5205_vck_2); + + void opwolf_map(address_map &map); + void opwolf_sound_z80_map(address_map &map); + void opwolfb_map(address_map &map); + void opwolfb_sub_z80_map(address_map &map); + void opwolfp_map(address_map &map); + +private: /* memory pointers */ optional_shared_ptr m_cchip_ram; @@ -93,54 +142,6 @@ public: required_device m_pc090oj; required_device m_msm1; required_device m_msm2; - DECLARE_READ16_MEMBER(cchip_r); - DECLARE_WRITE16_MEMBER(cchip_w); - DECLARE_READ16_MEMBER(opwolf_in_r); - DECLARE_READ16_MEMBER(opwolf_dsw_r); - DECLARE_READ16_MEMBER(opwolf_lightgun_r); - DECLARE_READ8_MEMBER(z80_input1_r); - DECLARE_READ8_MEMBER(z80_input2_r); - DECLARE_WRITE8_MEMBER(opwolf_adpcm_d_w); - DECLARE_WRITE8_MEMBER(opwolf_adpcm_e_w); - DECLARE_WRITE16_MEMBER(opwolf_cchip_status_w); - DECLARE_WRITE16_MEMBER(opwolf_cchip_bank_w); - DECLARE_WRITE16_MEMBER(opwolf_cchip_data_w); - DECLARE_READ16_MEMBER(opwolf_cchip_status_r); - DECLARE_READ16_MEMBER(opwolf_cchip_data_r); - DECLARE_WRITE16_MEMBER(opwolf_spritectrl_w); - DECLARE_WRITE8_MEMBER(sound_bankswitch_w); - DECLARE_WRITE8_MEMBER(opwolf_adpcm_b_w); - DECLARE_WRITE8_MEMBER(opwolf_adpcm_c_w); - DECLARE_DRIVER_INIT(opwolf); - DECLARE_DRIVER_INIT(opwolfb); - DECLARE_DRIVER_INIT(opwolfp); - - - DECLARE_CUSTOM_INPUT_MEMBER(opwolf_gun_x_r); - DECLARE_CUSTOM_INPUT_MEMBER(opwolf_gun_y_r); - - - virtual void machine_start() override; - DECLARE_MACHINE_RESET(opwolf); - uint32_t screen_update_opwolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(opwolf_timer_callback); - TIMER_CALLBACK_MEMBER(cchip_timer); - void updateDifficulty( int mode ); - void opwolf_cchip_init( ); - void opwolf_msm5205_vck(msm5205_device *device, int chip); - DECLARE_WRITE_LINE_MEMBER(opwolf_msm5205_vck_1); - DECLARE_WRITE_LINE_MEMBER(opwolf_msm5205_vck_2); - - void opwolfb(machine_config &config); - void opwolfp(machine_config &config); - void opwolf(machine_config &config); - void opwolf_map(address_map &map); - void opwolf_sound_z80_map(address_map &map); - void opwolfb_map(address_map &map); - void opwolfb_sub_z80_map(address_map &map); - void opwolfp_map(address_map &map); -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; }; diff --git a/src/mame/includes/p2000t.h b/src/mame/includes/p2000t.h index db4fe48fa3f..d5ea04bacd9 100644 --- a/src/mame/includes/p2000t.h +++ b/src/mame/includes/p2000t.h @@ -21,21 +21,16 @@ class p2000t_state : public driver_device public: p2000t_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) + , m_videoram(*this, "videoram") , m_maincpu(*this, "maincpu") , m_speaker(*this, "speaker") - , m_gfxdecode(*this, "gfxdecode") - , m_palette(*this, "palette") - , m_videoram(*this, "videoram") , m_keyboard(*this, "KEY.%u", 0) { } - required_device m_maincpu; - required_device m_speaker; - optional_device m_gfxdecode; - optional_device m_palette; - required_shared_ptr m_videoram; - required_ioport_array<10> m_keyboard; + void p2000t(machine_config &config); + +protected: DECLARE_READ8_MEMBER(p2000t_port_000f_r); DECLARE_READ8_MEMBER(p2000t_port_202f_r); DECLARE_WRITE8_MEMBER(p2000t_port_101f_w); @@ -46,20 +41,48 @@ public: DECLARE_WRITE8_MEMBER(p2000t_port_8c90_w); DECLARE_WRITE8_MEMBER(p2000t_port_9494_w); DECLARE_READ8_MEMBER(videoram_r); + + INTERRUPT_GEN_MEMBER(p2000_interrupt); + + void p2000t_mem(address_map &map); + void p2000t_io(address_map &map); + + required_shared_ptr m_videoram; + +private: + required_device m_maincpu; + required_device m_speaker; + required_ioport_array<10> m_keyboard; uint8_t m_port_101f; uint8_t m_port_202f; uint8_t m_port_303f; uint8_t m_port_707f; - int8_t m_frame_count; - DECLARE_VIDEO_START(p2000m); +}; + +class p2000m_state : public p2000t_state +{ +public: + p2000m_state(const machine_config &mconfig, device_type type, const char *tag) + : p2000t_state(mconfig, type, tag) + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + { + } + + void p2000m(machine_config &config); + +protected: + virtual void video_start() override; DECLARE_PALETTE_INIT(p2000m); uint32_t screen_update_p2000m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(p2000_interrupt); - void p2000t(machine_config &config); - void p2000m(machine_config &config); + void p2000m_mem(address_map &map); - void p2000t_io(address_map &map); - void p2000t_mem(address_map &map); + +private: + required_device m_gfxdecode; + required_device m_palette; + + int8_t m_frame_count; }; #endif // MAME_INCLUDES_P2000T_H diff --git a/src/mame/includes/redclash.h b/src/mame/includes/redclash.h index 4d8a6af472a..ba894bef8ce 100644 --- a/src/mame/includes/redclash.h +++ b/src/mame/includes/redclash.h @@ -5,6 +5,10 @@ Zero Hour / Red Clash *************************************************************************/ +#ifndef MAME_INCLUDES_REDCLASH_H +#define MAME_INCLUDES_REDCLASH_H + +#pragma once #include "includes/ladybug.h" @@ -12,13 +16,30 @@ class redclash_state : public ladybug_state { public: redclash_state(const machine_config &mconfig, device_type type, const char *tag) - : ladybug_state(mconfig, type, tag), m_sub(*this, "sub") { } + : ladybug_state(mconfig, type, tag) + , m_grid_data(*this, "grid_data") + , m_sub(*this, "sub") + { } + + uint8_t m_grid_color; + int m_star_speed; + uint8_t m_stars_enable; + uint8_t m_stars_speed; + uint32_t m_stars_state; + uint16_t m_stars_offset; + uint8_t m_stars_count; + tilemap_t *m_grid_tilemap; // ladybug + + optional_shared_ptr m_grid_data; optional_device m_sub; tilemap_t *m_fg_tilemap; // redclash int m_gfxbank; // redclash only /* misc */ + uint8_t m_sound_low; + uint8_t m_sound_high; + uint8_t m_weird_value[8]; uint8_t m_sraider_0x30; uint8_t m_sraider_0x38; @@ -71,3 +92,5 @@ public: void sraider_cpu2_map(address_map &map); void zerohour_map(address_map &map); }; + +#endif // MAME_INCLUDES_REDCLASH_H diff --git a/src/mame/video/appoooh.cpp b/src/mame/video/appoooh.cpp index c56ec379ecd..534c840e9c4 100644 --- a/src/mame/video/appoooh.cpp +++ b/src/mame/video/appoooh.cpp @@ -130,7 +130,7 @@ TILE_GET_INFO_MEMBER(appoooh_state::get_bg_tile_info) ***************************************************************************/ -VIDEO_START_MEMBER(appoooh_state,appoooh) +void appoooh_state::video_start() { m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(appoooh_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(appoooh_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); diff --git a/src/mame/video/batman.cpp b/src/mame/video/batman.cpp index 3d652be2551..e9ee2caa8e9 100644 --- a/src/mame/video/batman.cpp +++ b/src/mame/video/batman.cpp @@ -90,10 +90,6 @@ const atari_motion_objects_config batman_state::s_mob_config = 0, /* resulting value to indicate "special" */ }; -VIDEO_START_MEMBER(batman_state,batman) -{ -} - /************************************* diff --git a/src/mame/video/jedi.cpp b/src/mame/video/jedi.cpp index ee65d9bb36a..d3ce309fa28 100644 --- a/src/mame/video/jedi.cpp +++ b/src/mame/video/jedi.cpp @@ -30,7 +30,7 @@ * *************************************/ -VIDEO_START_MEMBER(jedi_state,jedi) +void jedi_state::video_start() { /* register for saving */ save_item(NAME(m_vscroll)); @@ -367,6 +367,4 @@ MACHINE_CONFIG_START(jedi_state::jedi_video) MCFG_SCREEN_SIZE(64*8, 262) /* verify vert size */ MCFG_SCREEN_VISIBLE_AREA(0*8, 37*8-1, 0*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(jedi_state, screen_update_jedi) - - MCFG_VIDEO_START_OVERRIDE(jedi_state,jedi) MACHINE_CONFIG_END diff --git a/src/mame/video/ladybug.cpp b/src/mame/video/ladybug.cpp index 0c7268f6460..7228eb78b32 100644 --- a/src/mame/video/ladybug.cpp +++ b/src/mame/video/ladybug.cpp @@ -139,7 +139,7 @@ TILE_GET_INFO_MEMBER(ladybug_state::get_grid_tile_info) } } -VIDEO_START_MEMBER(ladybug_state,ladybug) +void ladybug_state::video_start() { m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(ladybug_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); m_bg_tilemap->set_scroll_rows(32); diff --git a/src/mame/video/p2000t.cpp b/src/mame/video/p2000t.cpp index 5adbd6c9f71..ad34ae63073 100644 --- a/src/mame/video/p2000t.cpp +++ b/src/mame/video/p2000t.cpp @@ -14,13 +14,13 @@ -VIDEO_START_MEMBER(p2000t_state,p2000m) +void p2000m_state::video_start() { m_frame_count = 0; } -uint32_t p2000t_state::screen_update_p2000m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t p2000m_state::screen_update_p2000m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { uint8_t *videoram = m_videoram; int offs, sx, sy, code, loop; -- cgit v1.2.3