From a3e08a9ffee96061180b0833e232a49a0943f3f0 Mon Sep 17 00:00:00 2001 From: cam900 Date: Wed, 24 Apr 2024 00:23:29 +0900 Subject: midway/midyunit.cpp: Moved different sound systems to separate driver state classes. (#12297) Also simplified machine configurations and added missing data members to save states. --- src/mame/midway/midyunit.cpp | 305 +++++++++++++++++++++++------------------ src/mame/midway/midyunit.h | 186 +++++++++++++++++-------- src/mame/midway/midyunit_m.cpp | 225 ++++++++++++++++-------------- src/mame/midway/midyunit_v.cpp | 59 ++++---- 4 files changed, 447 insertions(+), 328 deletions(-) diff --git a/src/mame/midway/midyunit.cpp b/src/mame/midway/midyunit.cpp index 5622720e336..1aec0219ca2 100644 --- a/src/mame/midway/midyunit.cpp +++ b/src/mame/midway/midyunit.cpp @@ -135,7 +135,7 @@ Notes: void mkyawdim_state::yawdim_oki_bank_w(uint8_t data) { - if (data & 4) + if (BIT(data, 2)) m_oki->set_rom_bank(data & 3); } @@ -144,7 +144,7 @@ void mkyawdim_state::yawdim2_oki_bank_w(uint8_t data) int const bnk = (data >> 1 & 4) + (data & 3); m_oki->set_rom_bank(bnk); - if (!(data & 4)) + if (BIT(~data, 2)) m_oki->reset(); } @@ -156,19 +156,19 @@ void mkyawdim_state::yawdim2_oki_bank_w(uint8_t data) * *************************************/ -int midyunit_state::narc_talkback_strobe_r() +int midzunit_state::narc_talkback_strobe_r() { - return (m_narc_sound->read() >> 8) & 1; + return BIT(m_narc_sound->read(), 8); } -CUSTOM_INPUT_MEMBER(midyunit_state::narc_talkback_data_r) +CUSTOM_INPUT_MEMBER(midzunit_state::narc_talkback_data_r) { return m_narc_sound->read() & 0xff; } -int midyunit_state::adpcm_irq_state_r() +int midyunit_adpcm_state::adpcm_irq_state_r() { return m_adpcm_sound->irq_read() & 1; } @@ -181,30 +181,54 @@ int midyunit_state::adpcm_irq_state_r() * *************************************/ -void midyunit_state::main_map(address_map &map) +void midyunit_base_state::main_map(address_map &map) { - map(0x00000000, 0x001fffff).rw(FUNC(midyunit_state::midyunit_vram_r), FUNC(midyunit_state::midyunit_vram_w)); + map(0x00000000, 0x001fffff).rw(FUNC(midyunit_base_state::vram_r), FUNC(midyunit_base_state::vram_w)); map(0x01000000, 0x010fffff).ram().share(m_mainram); - map(0x01400000, 0x0140ffff).rw(FUNC(midyunit_state::midyunit_cmos_r), FUNC(midyunit_state::midyunit_cmos_w)); - map(0x01800000, 0x0181ffff).ram().w(FUNC(midyunit_state::midyunit_paletteram_w)).share("paletteram"); - map(0x01a00000, 0x01a0009f).mirror(0x00080000).rw(FUNC(midyunit_state::midyunit_dma_r), FUNC(midyunit_state::midyunit_dma_w)); - map(0x01c00000, 0x01c0005f).r(FUNC(midyunit_state::midyunit_input_r)); - map(0x01c00060, 0x01c0007f).rw(FUNC(midyunit_state::midyunit_protection_r), FUNC(midyunit_state::midyunit_cmos_enable_w)); - map(0x01e00000, 0x01e0001f).w(FUNC(midyunit_state::midyunit_sound_w)); - map(0x01f00000, 0x01f0001f).w(FUNC(midyunit_state::midyunit_control_w)); - map(0x02000000, 0x05ffffff).r(FUNC(midyunit_state::midyunit_gfxrom_r)); + map(0x01400000, 0x0140ffff).rw(FUNC(midyunit_base_state::cmos_r), FUNC(midyunit_base_state::cmos_w)); + map(0x01800000, 0x0181ffff).ram().w(FUNC(midyunit_base_state::paletteram_w)).share("paletteram"); + map(0x01a00000, 0x01a0009f).mirror(0x00080000).rw(FUNC(midyunit_base_state::dma_r), FUNC(midyunit_base_state::dma_w)); + map(0x01c00000, 0x01c0005f).r(FUNC(midyunit_base_state::input_r)); + map(0x01c00060, 0x01c0007f).rw(FUNC(midyunit_base_state::protection_r), FUNC(midyunit_base_state::cmos_enable_w)); + map(0x01f00000, 0x01f0001f).w(FUNC(midyunit_base_state::control_w)); + map(0x02000000, 0x05ffffff).r(FUNC(midyunit_base_state::gfxrom_r)); map(0xff800000, 0xffffffff).rom().region("maindata", 0); } +void midzunit_state::zunit_main_map(address_map &map) +{ + main_map(map); + map(0x01e00000, 0x01e0001f).w(FUNC(midzunit_state::narc_sound_w)); +} + +void midyunit_cvsd_state::cvsd_main_map(address_map &map) +{ + main_map(map); + map(0x01e00000, 0x01e0001f).w(FUNC(midyunit_cvsd_state::cvsd_sound_w)); +} + +void midyunit_adpcm_state::adpcm_main_map(address_map &map) +{ + main_map(map); + map(0x01e00000, 0x01e0001f).w(FUNC(midyunit_adpcm_state::adpcm_sound_w)); +} + +void term2_state::term2_main_map(address_map &map) +{ + main_map(map); + map(0x01c00000, 0x01c0005f).r(FUNC(term2_state::term2_input_r)); + map(0x01e00000, 0x01e0001f).w(FUNC(term2_state::term2_sound_w)); +} + void mkyawdim_state::yawdim_main_map(address_map &map) { - midyunit_state::main_map(map); + main_map(map); map(0x01e00000, 0x01e0000f).w(FUNC(mkyawdim_state::yawdim_sound_w)); } void mkyawdim_state::yawdim2_main_map(address_map &map) { - midyunit_state::main_map(map); + main_map(map); map(0x01e00000, 0x01e0000f).w(FUNC(mkyawdim_state::yawdim2_sound_w)); } @@ -262,7 +286,7 @@ static INPUT_PORTS_START( narc ) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN4 ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(midyunit_state, narc_talkback_strobe_r) + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(midzunit_state, narc_talkback_strobe_r) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED ) // memory protect interlock PORT_BIT( 0x3000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0xc000, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -278,7 +302,7 @@ static INPUT_PORTS_START( narc ) */ PORT_START("IN2") - PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(midyunit_state, narc_talkback_data_r) + PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(midzunit_state, narc_talkback_data_r) PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("DSW") @@ -758,7 +782,7 @@ static INPUT_PORTS_START( mkla4 ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Block 2") PORT_PLAYER(2) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Low Punch") PORT_PLAYER(1) PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Low Kick") PORT_PLAYER(1) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(midyunit_state, adpcm_irq_state_r) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(midyunit_adpcm_state, adpcm_irq_state_r) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Block 2") PORT_PLAYER(1) PORT_START("IN2") @@ -868,7 +892,7 @@ static INPUT_PORTS_START( term2 ) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x3000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(midyunit_state, adpcm_irq_state_r) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(midyunit_adpcm_state, adpcm_irq_state_r) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("DSW") @@ -970,7 +994,7 @@ static INPUT_PORTS_START( totcarn ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED ) // video freeze PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_BIT( 0x3c00, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(midyunit_state, adpcm_irq_state_r) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(midyunit_adpcm_state, adpcm_irq_state_r) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN2") @@ -1058,22 +1082,21 @@ static constexpr XTAL SLOW_MASTER_CLOCK = XTAL(40'000'000); // "slow" == static constexpr XTAL FAST_MASTER_CLOCK = XTAL(48'000'000); // "fast" == narc, mk, totcarn, strkforc static constexpr XTAL FASTER_MASTER_CLOCK = XTAL(50'000'000); // "faster" == term2 -// pixel clocks are 48MHz (narc) or 24MHz (all others) regardless -static constexpr XTAL MEDRES_PIXEL_CLOCK = (XTAL(48'000'000) / 6); - -void midyunit_state::zunit(machine_config &config) +void midzunit_state::zunit(machine_config &config) { + // pixel clocks are 48MHz (narc) or 24MHz (all others) regardless + constexpr XTAL MEDRES_PIXEL_CLOCK = (XTAL(48'000'000) / 6); + // basic machine hardware TMS34010(config, m_maincpu, FAST_MASTER_CLOCK); - m_maincpu->set_addrmap(AS_PROGRAM, &midyunit_state::main_map); + m_maincpu->set_addrmap(AS_PROGRAM, &midzunit_state::zunit_main_map); m_maincpu->set_halt_on_reset(false); m_maincpu->set_pixel_clock(MEDRES_PIXEL_CLOCK); m_maincpu->set_pixels_per_clock(2); - m_maincpu->set_scanline_ind16_callback(FUNC(midyunit_state::scanline_update)); - m_maincpu->set_shiftreg_in_callback(FUNC(midyunit_state::to_shiftreg)); - m_maincpu->set_shiftreg_out_callback(FUNC(midyunit_state::from_shiftreg)); + m_maincpu->set_scanline_ind16_callback(FUNC(midzunit_state::scanline_update)); + m_maincpu->set_shiftreg_in_callback(FUNC(midzunit_state::to_shiftreg)); + m_maincpu->set_shiftreg_out_callback(FUNC(midzunit_state::from_shiftreg)); - MCFG_MACHINE_RESET_OVERRIDE(midyunit_state,midyunit) NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // video hardware @@ -1086,8 +1109,6 @@ void midyunit_state::zunit(machine_config &config) screen.set_screen_update("maincpu", FUNC(tms34010_device::tms340x0_ind16)); screen.set_palette(m_palette); - MCFG_VIDEO_START_OVERRIDE(midyunit_state,midzunit) - // sound hardware SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -1104,21 +1125,19 @@ void midyunit_state::zunit(machine_config &config) * *************************************/ -static constexpr XTAL STDRES_PIXEL_CLOCK = (XTAL(24'000'000) / 6); - -void midyunit_state::yunit_core(machine_config &config) +void midyunit_base_state::yunit_core(machine_config &config) { + constexpr XTAL STDRES_PIXEL_CLOCK = (XTAL(24'000'000) / 6); + // basic machine hardware TMS34010(config, m_maincpu, SLOW_MASTER_CLOCK); - m_maincpu->set_addrmap(AS_PROGRAM, &midyunit_state::main_map); m_maincpu->set_halt_on_reset(false); m_maincpu->set_pixel_clock(STDRES_PIXEL_CLOCK); m_maincpu->set_pixels_per_clock(2); - m_maincpu->set_scanline_ind16_callback(FUNC(midyunit_state::scanline_update)); - m_maincpu->set_shiftreg_in_callback(FUNC(midyunit_state::to_shiftreg)); - m_maincpu->set_shiftreg_out_callback(FUNC(midyunit_state::from_shiftreg)); + m_maincpu->set_scanline_ind16_callback(FUNC(midyunit_base_state::scanline_update)); + m_maincpu->set_shiftreg_in_callback(FUNC(midyunit_base_state::to_shiftreg)); + m_maincpu->set_shiftreg_out_callback(FUNC(midyunit_base_state::from_shiftreg)); - MCFG_MACHINE_RESET_OVERRIDE(midyunit_state,midyunit) NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // video hardware @@ -1137,80 +1156,92 @@ void midyunit_state::yunit_core(machine_config &config) } -void midyunit_state::yunit_cvsd_4bit_slow(machine_config &config) +void midyunit_base_state::yunit_4bpp(machine_config &config) { yunit_core(config); - // basic machine hardware - WILLIAMS_CVSD_SOUND(config, m_cvsd_sound).add_route(ALL_OUTPUTS, "speaker", 1.0); - // video hardware m_palette->set_entries(256); - MCFG_VIDEO_START_OVERRIDE(midyunit_state,midyunit_4bit) + MCFG_VIDEO_START_OVERRIDE(midyunit_cvsd_state,midyunit_4bit) } -void midyunit_state::yunit_cvsd_4bit_fast(machine_config &config) +void midyunit_base_state::yunit_6bpp(machine_config &config) { yunit_core(config); + // video hardware + m_palette->set_entries(4096); + MCFG_VIDEO_START_OVERRIDE(midyunit_cvsd_state,midyunit_6bit) +} + + +void midyunit_cvsd_state::yunit_cvsd_core(machine_config &config) +{ // basic machine hardware - m_maincpu->set_clock(FAST_MASTER_CLOCK); + m_maincpu->set_addrmap(AS_PROGRAM, &midyunit_cvsd_state::cvsd_main_map); WILLIAMS_CVSD_SOUND(config, m_cvsd_sound).add_route(ALL_OUTPUTS, "speaker", 1.0); +} - // video hardware - m_palette->set_entries(256); - MCFG_VIDEO_START_OVERRIDE(midyunit_state,midyunit_4bit) + +void midyunit_cvsd_state::yunit_cvsd_4bit_slow(machine_config &config) +{ + yunit_4bpp(config); + yunit_cvsd_core(config); } -void midyunit_state::yunit_cvsd_6bit_slow(machine_config &config) +void midyunit_cvsd_state::yunit_cvsd_4bit_fast(machine_config &config) { - yunit_core(config); + yunit_4bpp(config); + yunit_cvsd_core(config); // basic machine hardware - WILLIAMS_CVSD_SOUND(config, m_cvsd_sound).add_route(ALL_OUTPUTS, "speaker", 1.0); - - // video hardware - m_palette->set_entries(4096); - MCFG_VIDEO_START_OVERRIDE(midyunit_state,midyunit_6bit) + m_maincpu->set_clock(FAST_MASTER_CLOCK); } -void midyunit_state::yunit_adpcm_6bit_fast(machine_config &config) +void midyunit_cvsd_state::yunit_cvsd_6bit_slow(machine_config &config) { - yunit_core(config); + yunit_6bpp(config); + yunit_cvsd_core(config); +} + +void midyunit_adpcm_state::yunit_adpcm_core(machine_config &config) +{ // basic machine hardware - m_maincpu->set_clock(FAST_MASTER_CLOCK); + m_maincpu->set_addrmap(AS_PROGRAM, &midyunit_adpcm_state::adpcm_main_map); WILLIAMS_ADPCM_SOUND(config, m_adpcm_sound).add_route(ALL_OUTPUTS, "speaker", 1.0); - - // video hardware - m_palette->set_entries(4096); - MCFG_VIDEO_START_OVERRIDE(midyunit_state,midyunit_6bit) } -void midyunit_state::yunit_adpcm_6bit_faster(machine_config &config) +void midyunit_adpcm_state::yunit_adpcm_6bit_fast(machine_config &config) { - yunit_core(config); + yunit_6bpp(config); + yunit_adpcm_core(config); // basic machine hardware - m_maincpu->set_clock(FASTER_MASTER_CLOCK); + m_maincpu->set_clock(FAST_MASTER_CLOCK); +} - WILLIAMS_ADPCM_SOUND(config, m_adpcm_sound).add_route(ALL_OUTPUTS, "speaker", 1.0); - // video hardware - m_palette->set_entries(4096); - MCFG_VIDEO_START_OVERRIDE(midyunit_state,midyunit_6bit) +void midyunit_adpcm_state::yunit_adpcm_6bit_faster(machine_config &config) +{ + yunit_6bpp(config); + yunit_adpcm_core(config); + + // basic machine hardware + m_maincpu->set_clock(FASTER_MASTER_CLOCK); } void term2_state::term2(machine_config &config) { yunit_adpcm_6bit_faster(config); + m_maincpu->set_addrmap(AS_PROGRAM, &term2_state::term2_main_map); ADC0844(config, m_adc); // U2 on Coil Lamp Driver Board (A-14915) m_adc->ch1_callback().set_ioport("STICK0_X"); @@ -3555,67 +3586,67 @@ ROM_END * *************************************/ -GAME( 1988, narc, 0, zunit, narc, midyunit_state, init_narc, ROT0, "Williams", "Narc (rev 7.00)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, narc6, narc, zunit, narc, midyunit_state, init_narc, ROT0, "Williams", "Narc (rev 6.00)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, narc4, narc, zunit, narc, midyunit_state, init_narc, ROT0, "Williams", "Narc (rev 4.00)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, narc3, narc, zunit, narc, midyunit_state, init_narc, ROT0, "Williams", "Narc (rev 3.20)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, narc2, narc, zunit, narc, midyunit_state, init_narc, ROT0, "Williams", "Narc (rev 2.00)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, narc1, narc, zunit, narc, midyunit_state, init_narc, ROT0, "Williams", "Narc (rev 1.80)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1990, trog, 0, yunit_cvsd_4bit_slow, trog, midyunit_state, init_trog, ROT0, "Midway", "Trog (rev LA5 3/29/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, trog4, trog, yunit_cvsd_4bit_slow, trog, midyunit_state, init_trog, ROT0, "Midway", "Trog (rev LA4 3/11/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, trog3, trog, yunit_cvsd_4bit_slow, trog, midyunit_state, init_trog, ROT0, "Midway", "Trog (rev LA3 2/14/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, trog3a, trog, yunit_cvsd_4bit_slow, trog, midyunit_state, init_trog, ROT0, "Midway", "Trog (rev LA3 2/10/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, trogpa6, trog, yunit_cvsd_4bit_slow, trog, midyunit_state, init_trog, ROT0, "Midway", "Trog (prototype, rev PA6-PAC 9/09/90)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, trogpa5, trog, yunit_cvsd_4bit_slow, trog, midyunit_state, init_trog, ROT0, "Midway", "Trog (prototype, rev PA5-PAC 8/28/90)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, trogpa4, trog, yunit_cvsd_4bit_slow, trogpa4, midyunit_state, init_trog, ROT0, "Midway", "Trog (prototype, rev 4.00 7/27/90)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, mazebl, trog, yunit_cvsd_4bit_slow, trog, midyunit_state, init_trog, ROT0, "bootleg", "Maze (Trog rev LA4 3/11/91 bootleg)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1990, smashtv, 0, yunit_cvsd_6bit_slow, smashtv, midyunit_state, init_smashtv, ROT0, "Williams", "Smash T.V. (rev 8.00)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, smashtv6, smashtv, yunit_cvsd_6bit_slow, smashtv, midyunit_state, init_smashtv, ROT0, "Williams", "Smash T.V. (rev 6.00)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, smashtv5, smashtv, yunit_cvsd_6bit_slow, smashtv, midyunit_state, init_smashtv, ROT0, "Williams", "Smash T.V. (rev 5.00)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, smashtv4, smashtv, yunit_cvsd_6bit_slow, smashtv, midyunit_state, init_smashtv, ROT0, "Williams", "Smash T.V. (rev 4.00)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, smashtv3, smashtv, yunit_cvsd_6bit_slow, smashtv, midyunit_state, init_smashtv, ROT0, "Williams", "Smash T.V. (rev 3.01)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1990, hiimpact, 0, yunit_cvsd_6bit_slow, hiimpact, midyunit_state, init_hiimpact, ROT0, "Williams", "High Impact Football (rev LA5 02/15/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, hiimpact4, hiimpact, yunit_cvsd_6bit_slow, hiimpact, midyunit_state, init_hiimpact, ROT0, "Williams", "High Impact Football (rev LA4 02/04/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, hiimpact3, hiimpact, yunit_cvsd_6bit_slow, hiimpact, midyunit_state, init_hiimpact, ROT0, "Williams", "High Impact Football (rev LA3 12/27/90)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, hiimpact2, hiimpact, yunit_cvsd_6bit_slow, hiimpact, midyunit_state, init_hiimpact, ROT0, "Williams", "High Impact Football (rev LA2 12/26/90)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, hiimpact1, hiimpact, yunit_cvsd_6bit_slow, hiimpact, midyunit_state, init_hiimpact, ROT0, "Williams", "High Impact Football (rev LA1 12/16/90)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, hiimpactp, hiimpact, yunit_cvsd_6bit_slow, hiimpact, midyunit_state, init_hiimpact, ROT0, "Williams", "High Impact Football (prototype, revision0 proto 8.6 12/09/90)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1991, shimpact, 0, yunit_cvsd_6bit_slow, shimpact, midyunit_state, init_shimpact, ROT0, "Midway", "Super High Impact (rev LA1 09/30/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, shimpactp6, shimpact, yunit_cvsd_6bit_slow, shimpact, midyunit_state, init_shimpact, ROT0, "Midway", "Super High Impact (prototype, proto 6.0 09/23/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, shimpactp5, shimpact, yunit_cvsd_6bit_slow, shimpact, midyunit_state, init_shimpact, ROT0, "Midway", "Super High Impact (prototype, proto 5.0 09/15/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, shimpactp4, shimpact, yunit_cvsd_6bit_slow, shimpact, midyunit_state, init_shimpact, ROT0, "Midway", "Super High Impact (prototype, proto 4.0 09/10/91)", MACHINE_SUPPORTS_SAVE ) // See notes about factory restore above - -GAME( 1991, strkforc, 0, yunit_cvsd_4bit_fast, strkforc, midyunit_state, init_strkforc, ROT0, "Midway", "Strike Force (rev 1 02/25/91)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1991, term2, 0, term2, term2, term2_state, init_term2, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (rev LA4 08/03/92)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, term2la3, term2, term2, term2, term2_state, init_term2la3, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (rev LA3 03/27/92)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, term2la2, term2, term2, term2, term2_state, init_term2la2, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (rev LA2 12/09/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, term2la1, term2, term2, term2, term2_state, init_term2la1, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (rev LA1 11/01/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, term2pa2, term2, term2, term2, term2_state, init_term2la1, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (prototype, rev PA2 10/18/91)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, term2lg1, term2, term2, term2, term2_state, init_term2la1, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (German, rev LG1 11/04/91)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1992, mkla4, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (rev 4.0 09/28/92)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mkla3, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (rev 3.0 08/31/92)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mkla2, mk, yunit_adpcm_6bit_fast, mkla2, midyunit_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (rev 2.0 08/18/92)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mkla1, mk, yunit_adpcm_6bit_fast, mkla2, midyunit_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (rev 1.0 08/09/92)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mkprot9, mk, yunit_adpcm_6bit_faster, mkla2, midyunit_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (prototype, rev 9.0 07/28/92)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mkprot8, mk, yunit_adpcm_6bit_faster, mkla2, midyunit_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (prototype, rev 8.0 07/21/92)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mkprot4, mk, yunit_adpcm_6bit_faster, mkla2, midyunit_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (prototype, rev 4.0 07/14/92)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mkyturbo, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_state, init_mkyturbo, ROT0, "hack", "Mortal Kombat (Turbo 3.1 09/09/93, hack)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mkyturboe, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_state, init_mkyturbo, ROT0, "hack", "Mortal Kombat (Turbo 3.0 08/31/92, hack)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mknifty, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_state, init_mkyturbo, ROT0, "hack", "Mortal Kombat (Nifty Kombo, hack)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mknifty666, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_state, init_mkyturbo, ROT0, "hack", "Mortal Kombat (Nifty Kombo 666, hack)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mkrep, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_state, init_mkyturbo, ROT0, "hack", "Mortal Kombat (Reptile Man hack)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) -GAME( 1992, mkyawdim, mk, mkyawdim, mkyawdim, mkyawdim_state, init_mkyawdim, ROT0, "bootleg (Yawdim)", "Mortal Kombat (Yawdim bootleg, set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, mkyawdim2, mk, mkyawdim2, mkyawdim, mkyawdim_state, init_mkyawdim, ROT0, "bootleg (Yawdim)", "Mortal Kombat (Yawdim bootleg, set 2)", MACHINE_SUPPORTS_SAVE ) // some sound effects are missing on real pcb -GAME( 1992, mkyawdim3, mk, mkyawdim, mkyawdim, mkyawdim_state, init_mkyawdim, ROT0, "bootleg (Yawdim)", "Mortal Kombat (Yawdim bootleg, set 3)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND) // are some sound effects missing/wrong? -GAME( 1992, mkyawdim4, mk, mkyawdim, mkyawdim, mkyawdim_state, init_mkyawdim, ROT0, "bootleg (Yawdim)", "Mortal Kombat (Yawdim bootleg, set 4)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND) // are some sound effects missing/wrong? -GAME( 1992, mkla3bl, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_state, init_mkla3bl, ROT0, "bootleg (Victor)", "Mortal Kombat (Victor bootleg of rev 3.0 08/31/92)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1992, totcarn, 0, yunit_adpcm_6bit_fast, totcarn, midyunit_state, init_totcarn, ROT0, "Midway", "Total Carnage (rev LA1 03/10/92)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, totcarnp2, totcarn, yunit_adpcm_6bit_fast, totcarn, midyunit_state, init_totcarn, ROT0, "Midway", "Total Carnage (prototype, proto v 2.0 02/10/92)", MACHINE_SUPPORTS_SAVE ) -GAME( 1992, totcarnp1, totcarn, yunit_adpcm_6bit_fast, totcarn, midyunit_state, init_totcarn, ROT0, "Midway", "Total Carnage (prototype, proto v 1.0 01/25/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, narc, 0, zunit, narc, midzunit_state, init_narc, ROT0, "Williams", "Narc (rev 7.00)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, narc6, narc, zunit, narc, midzunit_state, init_narc, ROT0, "Williams", "Narc (rev 6.00)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, narc4, narc, zunit, narc, midzunit_state, init_narc, ROT0, "Williams", "Narc (rev 4.00)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, narc3, narc, zunit, narc, midzunit_state, init_narc, ROT0, "Williams", "Narc (rev 3.20)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, narc2, narc, zunit, narc, midzunit_state, init_narc, ROT0, "Williams", "Narc (rev 2.00)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, narc1, narc, zunit, narc, midzunit_state, init_narc, ROT0, "Williams", "Narc (rev 1.80)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1990, trog, 0, yunit_cvsd_4bit_slow, trog, midyunit_cvsd_state, init_trog, ROT0, "Midway", "Trog (rev LA5 3/29/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, trog4, trog, yunit_cvsd_4bit_slow, trog, midyunit_cvsd_state, init_trog, ROT0, "Midway", "Trog (rev LA4 3/11/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, trog3, trog, yunit_cvsd_4bit_slow, trog, midyunit_cvsd_state, init_trog, ROT0, "Midway", "Trog (rev LA3 2/14/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, trog3a, trog, yunit_cvsd_4bit_slow, trog, midyunit_cvsd_state, init_trog, ROT0, "Midway", "Trog (rev LA3 2/10/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, trogpa6, trog, yunit_cvsd_4bit_slow, trog, midyunit_cvsd_state, init_trog, ROT0, "Midway", "Trog (prototype, rev PA6-PAC 9/09/90)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, trogpa5, trog, yunit_cvsd_4bit_slow, trog, midyunit_cvsd_state, init_trog, ROT0, "Midway", "Trog (prototype, rev PA5-PAC 8/28/90)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, trogpa4, trog, yunit_cvsd_4bit_slow, trogpa4, midyunit_cvsd_state, init_trog, ROT0, "Midway", "Trog (prototype, rev 4.00 7/27/90)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, mazebl, trog, yunit_cvsd_4bit_slow, trog, midyunit_cvsd_state, init_trog, ROT0, "bootleg", "Maze (Trog rev LA4 3/11/91 bootleg)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1990, smashtv, 0, yunit_cvsd_6bit_slow, smashtv, midyunit_cvsd_state, init_smashtv, ROT0, "Williams", "Smash T.V. (rev 8.00)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, smashtv6, smashtv, yunit_cvsd_6bit_slow, smashtv, midyunit_cvsd_state, init_smashtv, ROT0, "Williams", "Smash T.V. (rev 6.00)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, smashtv5, smashtv, yunit_cvsd_6bit_slow, smashtv, midyunit_cvsd_state, init_smashtv, ROT0, "Williams", "Smash T.V. (rev 5.00)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, smashtv4, smashtv, yunit_cvsd_6bit_slow, smashtv, midyunit_cvsd_state, init_smashtv, ROT0, "Williams", "Smash T.V. (rev 4.00)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, smashtv3, smashtv, yunit_cvsd_6bit_slow, smashtv, midyunit_cvsd_state, init_smashtv, ROT0, "Williams", "Smash T.V. (rev 3.01)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1990, hiimpact, 0, yunit_cvsd_6bit_slow, hiimpact, midyunit_cvsd_state, init_hiimpact, ROT0, "Williams", "High Impact Football (rev LA5 02/15/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, hiimpact4, hiimpact, yunit_cvsd_6bit_slow, hiimpact, midyunit_cvsd_state, init_hiimpact, ROT0, "Williams", "High Impact Football (rev LA4 02/04/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, hiimpact3, hiimpact, yunit_cvsd_6bit_slow, hiimpact, midyunit_cvsd_state, init_hiimpact, ROT0, "Williams", "High Impact Football (rev LA3 12/27/90)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, hiimpact2, hiimpact, yunit_cvsd_6bit_slow, hiimpact, midyunit_cvsd_state, init_hiimpact, ROT0, "Williams", "High Impact Football (rev LA2 12/26/90)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, hiimpact1, hiimpact, yunit_cvsd_6bit_slow, hiimpact, midyunit_cvsd_state, init_hiimpact, ROT0, "Williams", "High Impact Football (rev LA1 12/16/90)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, hiimpactp, hiimpact, yunit_cvsd_6bit_slow, hiimpact, midyunit_cvsd_state, init_hiimpact, ROT0, "Williams", "High Impact Football (prototype, revision0 proto 8.6 12/09/90)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1991, shimpact, 0, yunit_cvsd_6bit_slow, shimpact, midyunit_cvsd_state, init_shimpact, ROT0, "Midway", "Super High Impact (rev LA1 09/30/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, shimpactp6, shimpact, yunit_cvsd_6bit_slow, shimpact, midyunit_cvsd_state, init_shimpact, ROT0, "Midway", "Super High Impact (prototype, proto 6.0 09/23/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, shimpactp5, shimpact, yunit_cvsd_6bit_slow, shimpact, midyunit_cvsd_state, init_shimpact, ROT0, "Midway", "Super High Impact (prototype, proto 5.0 09/15/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, shimpactp4, shimpact, yunit_cvsd_6bit_slow, shimpact, midyunit_cvsd_state, init_shimpact, ROT0, "Midway", "Super High Impact (prototype, proto 4.0 09/10/91)", MACHINE_SUPPORTS_SAVE ) // See notes about factory restore above + +GAME( 1991, strkforc, 0, yunit_cvsd_4bit_fast, strkforc, midyunit_cvsd_state, init_strkforc, ROT0, "Midway", "Strike Force (rev 1 02/25/91)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1991, term2, 0, term2, term2, term2_state, init_term2, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (rev LA4 08/03/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, term2la3, term2, term2, term2, term2_state, init_term2la3, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (rev LA3 03/27/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, term2la2, term2, term2, term2, term2_state, init_term2la2, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (rev LA2 12/09/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, term2la1, term2, term2, term2, term2_state, init_term2la1, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (rev LA1 11/01/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, term2pa2, term2, term2, term2, term2_state, init_term2la1, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (prototype, rev PA2 10/18/91)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, term2lg1, term2, term2, term2, term2_state, init_term2la1, ORIENTATION_FLIP_X, "Midway", "Terminator 2 - Judgment Day (German, rev LG1 11/04/91)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1992, mkla4, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_adpcm_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (rev 4.0 09/28/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mkla3, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_adpcm_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (rev 3.0 08/31/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mkla2, mk, yunit_adpcm_6bit_fast, mkla2, midyunit_adpcm_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (rev 2.0 08/18/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mkla1, mk, yunit_adpcm_6bit_fast, mkla2, midyunit_adpcm_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (rev 1.0 08/09/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mkprot9, mk, yunit_adpcm_6bit_faster, mkla2, midyunit_adpcm_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (prototype, rev 9.0 07/28/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mkprot8, mk, yunit_adpcm_6bit_faster, mkla2, midyunit_adpcm_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (prototype, rev 8.0 07/21/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mkprot4, mk, yunit_adpcm_6bit_faster, mkla2, midyunit_adpcm_state, init_mkyunit, ROT0, "Midway", "Mortal Kombat (prototype, rev 4.0 07/14/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mkyturbo, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_adpcm_state, init_mkyturbo, ROT0, "hack", "Mortal Kombat (Turbo 3.1 09/09/93, hack)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mkyturboe, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_adpcm_state, init_mkyturbo, ROT0, "hack", "Mortal Kombat (Turbo 3.0 08/31/92, hack)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mknifty, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_adpcm_state, init_mkyturbo, ROT0, "hack", "Mortal Kombat (Nifty Kombo, hack)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mknifty666, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_adpcm_state, init_mkyturbo, ROT0, "hack", "Mortal Kombat (Nifty Kombo 666, hack)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mkrep, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_adpcm_state, init_mkyturbo, ROT0, "hack", "Mortal Kombat (Reptile Man hack)", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) +GAME( 1992, mkyawdim, mk, mkyawdim, mkyawdim, mkyawdim_state, init_mkyawdim, ROT0, "bootleg (Yawdim)", "Mortal Kombat (Yawdim bootleg, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, mkyawdim2, mk, mkyawdim2, mkyawdim, mkyawdim_state, init_mkyawdim, ROT0, "bootleg (Yawdim)", "Mortal Kombat (Yawdim bootleg, set 2)", MACHINE_SUPPORTS_SAVE ) // some sound effects are missing on real pcb +GAME( 1992, mkyawdim3, mk, mkyawdim, mkyawdim, mkyawdim_state, init_mkyawdim, ROT0, "bootleg (Yawdim)", "Mortal Kombat (Yawdim bootleg, set 3)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND) // are some sound effects missing/wrong? +GAME( 1992, mkyawdim4, mk, mkyawdim, mkyawdim, mkyawdim_state, init_mkyawdim, ROT0, "bootleg (Yawdim)", "Mortal Kombat (Yawdim bootleg, set 4)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND) // are some sound effects missing/wrong? +GAME( 1992, mkla3bl, mk, yunit_adpcm_6bit_fast, mkla4, midyunit_adpcm_state, init_mkla3bl, ROT0, "bootleg (Victor)", "Mortal Kombat (Victor bootleg of rev 3.0 08/31/92)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1992, totcarn, 0, yunit_adpcm_6bit_fast, totcarn, midyunit_adpcm_state, init_totcarn, ROT0, "Midway", "Total Carnage (rev LA1 03/10/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, totcarnp2, totcarn, yunit_adpcm_6bit_fast, totcarn, midyunit_adpcm_state, init_totcarn, ROT0, "Midway", "Total Carnage (prototype, proto v 2.0 02/10/92)", MACHINE_SUPPORTS_SAVE ) +GAME( 1992, totcarnp1, totcarn, yunit_adpcm_6bit_fast, totcarn, midyunit_adpcm_state, init_totcarn, ROT0, "Midway", "Total Carnage (prototype, proto v 1.0 01/25/92)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/midway/midyunit.h b/src/mame/midway/midyunit.h index 20765b98636..43db0d5d5d2 100644 --- a/src/mame/midway/midyunit.h +++ b/src/mame/midway/midyunit.h @@ -21,16 +21,13 @@ #include "emupal.h" -class midyunit_state : public driver_device +class midyunit_base_state : public driver_device { -public: - midyunit_state(const machine_config &mconfig, device_type type, const char *tag) +protected: + midyunit_base_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_palette(*this, "palette") - , m_narc_sound(*this, "narcsnd") - , m_cvsd_sound(*this, "cvsd") - , m_adpcm_sound(*this, "adpcm") , m_nvram(*this, "nvram") , m_paletteram(*this, "paletteram") , m_gfx_rom(*this, "gfx_rom", 0x800000, ENDIANNESS_BIG) @@ -39,30 +36,9 @@ public: { } - void yunit_adpcm_6bit_fast(machine_config &config); - void yunit_adpcm_6bit_faster(machine_config &config); - void yunit_core(machine_config &config); - void yunit_cvsd_4bit_fast(machine_config &config); - void yunit_cvsd_4bit_slow(machine_config &config); - void yunit_cvsd_6bit_slow(machine_config &config); - void zunit(machine_config &config); - - void init_hiimpact(); - void init_mkla3bl(); - void init_mkyturbo(); - void init_mkyunit(); - void init_narc(); - void init_shimpact(); - void init_smashtv(); - void init_strkforc(); - void init_totcarn(); - void init_trog(); - - int narc_talkback_strobe_r(); - DECLARE_CUSTOM_INPUT_MEMBER(narc_talkback_data_r); - int adpcm_irq_state_r(); + virtual void machine_start() override; + virtual void video_start() override; -protected: // protection data types struct protection_data { @@ -84,9 +60,6 @@ protected: required_device m_maincpu; required_device m_palette; - optional_device m_narc_sound; - optional_device m_cvsd_sound; - optional_device m_adpcm_sound; required_device m_nvram; required_shared_ptr m_paletteram; @@ -102,7 +75,6 @@ protected: uint8_t m_prot_index = 0; const struct protection_data *m_prot_data = nullptr; uint8_t m_cmos_w_enable = 0; - uint8_t m_chip_type = 0; uint8_t *m_cvsd_protection_base = nullptr; uint8_t m_autoerase_enable = 0; uint32_t m_palette_mask = 0; @@ -115,44 +87,140 @@ protected: emu_timer *m_dma_timer = nullptr; emu_timer *m_autoerase_line_timer = nullptr; - void midyunit_cmos_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - uint16_t midyunit_cmos_r(offs_t offset); - void midyunit_cmos_enable_w(address_space &space, uint16_t data); - uint16_t midyunit_protection_r(); - uint16_t midyunit_input_r(offs_t offset); - void midyunit_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void cvsd_protection_w(offs_t offset, uint8_t data); - uint16_t mkturbo_prot_r(); - uint16_t midyunit_gfxrom_r(offs_t offset); - void midyunit_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - uint16_t midyunit_vram_r(offs_t offset); - void midyunit_control_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void midyunit_paletteram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - uint16_t midyunit_dma_r(offs_t offset); - void midyunit_dma_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void cmos_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + uint16_t cmos_r(offs_t offset); + void cmos_enable_w(address_space &space, uint16_t data); + uint16_t protection_r(); + uint16_t input_r(offs_t offset); + uint16_t gfxrom_r(offs_t offset); + void vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + uint16_t vram_r(offs_t offset); + void control_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void paletteram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + uint16_t dma_r(offs_t offset); + void dma_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); TMS340X0_TO_SHIFTREG_CB_MEMBER(to_shiftreg); TMS340X0_FROM_SHIFTREG_CB_MEMBER(from_shiftreg); TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_update); - DECLARE_MACHINE_RESET(midyunit); - DECLARE_VIDEO_START(midzunit); DECLARE_VIDEO_START(midyunit_4bit); DECLARE_VIDEO_START(midyunit_6bit); - DECLARE_VIDEO_START(common); TIMER_CALLBACK_MEMBER(dma_callback); TIMER_CALLBACK_MEMBER(autoerase_line); + void dma_draw(uint16_t command); + void init_gfxrom(int bpp); + void install_hidden_ram(mc6809e_device &cpu, int prot_start, int prot_end); + void main_map(address_map &map); - void dma_draw(uint16_t command); + void yunit_core(machine_config &config); + void yunit_4bpp(machine_config &config); + void yunit_6bpp(machine_config &config); +}; + +class midzunit_state : public midyunit_base_state +{ +public: + midzunit_state(const machine_config &mconfig, device_type type, const char *tag) + : midyunit_base_state(mconfig, type, tag) + , m_narc_sound(*this, "narcsnd") + { + } + + void zunit(machine_config &config); + + void init_narc(); + + int narc_talkback_strobe_r(); + DECLARE_CUSTOM_INPUT_MEMBER(narc_talkback_data_r); + +protected: + virtual void machine_reset() override; + virtual void video_start() override; + +private: + required_device m_narc_sound; + + void narc_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + + void zunit_main_map(address_map &map); +}; + +class midyunit_cvsd_state : public midyunit_base_state +{ +public: + midyunit_cvsd_state(const machine_config &mconfig, device_type type, const char *tag) + : midyunit_base_state(mconfig, type, tag) + , m_cvsd_sound(*this, "cvsd") + { + } + + void yunit_cvsd_4bit_fast(machine_config &config); + void yunit_cvsd_4bit_slow(machine_config &config); + void yunit_cvsd_6bit_slow(machine_config &config); + + void init_hiimpact(); + void init_shimpact(); + void init_smashtv(); + void init_strkforc(); + void init_trog(); + +protected: + virtual void machine_reset() override; + + required_device m_cvsd_sound; + + uint8_t *m_cvsd_protection_base = nullptr; + + void cvsd_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void cvsd_protection_w(offs_t offset, uint8_t data); + void init_generic(int bpp, int sound, int prot_start, int prot_end); - void install_hidden_ram(mc6809e_device &cpu, int prot_start, int prot_end); + + void cvsd_main_map(address_map &map); + + void yunit_cvsd_core(machine_config &config); +}; + +class midyunit_adpcm_state : public midyunit_base_state +{ +public: + midyunit_adpcm_state(const machine_config &mconfig, device_type type, const char *tag) + : midyunit_base_state(mconfig, type, tag) + , m_adpcm_sound(*this, "adpcm") + { + } + + void yunit_adpcm_6bit_fast(machine_config &config); + void yunit_adpcm_6bit_faster(machine_config &config); + + void init_mkla3bl(); + void init_mkyturbo(); + void init_mkyunit(); + void init_totcarn(); + + int adpcm_irq_state_r(); + +protected: + virtual void machine_reset() override; + + required_device m_adpcm_sound; + + void adpcm_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + uint16_t mkturbo_prot_r(); + + void init_generic(int bpp, int prot_start, int prot_end); + + void adpcm_main_map(address_map &map); + + void yunit_adpcm_core(machine_config &config); }; -class term2_state : public midyunit_state +class term2_state : public midyunit_adpcm_state { public: term2_state(const machine_config &mconfig, device_type type, const char *tag) - : midyunit_state(mconfig, type, tag) + : midyunit_adpcm_state(mconfig, type, tag) , m_adc(*this, "adc") , m_left_flash(*this, "Left_Flash_%u", 1U) , m_right_flash(*this, "Right_Flash_%u", 1U) @@ -196,13 +264,15 @@ private: void term2la2_hack_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void term2la1_hack_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void term2_init_common(write16s_delegate hack_w); + + void term2_main_map(address_map &map); }; -class mkyawdim_state : public midyunit_state +class mkyawdim_state : public midyunit_base_state { public: mkyawdim_state(const machine_config &mconfig, device_type type, const char *tag) - : midyunit_state(mconfig, type, tag) + : midyunit_base_state(mconfig, type, tag) , m_audiocpu(*this, "audiocpu") , m_soundlatch(*this, "soundlatch") , m_oki(*this, "oki") @@ -219,7 +289,7 @@ protected: private: required_device m_audiocpu; - optional_device m_soundlatch; + required_device m_soundlatch; required_device m_oki; void yawdim_oki_bank_w(uint8_t data); diff --git a/src/mame/midway/midyunit_m.cpp b/src/mame/midway/midyunit_m.cpp index 785dae37048..801ef771eb3 100644 --- a/src/mame/midway/midyunit_m.cpp +++ b/src/mame/midway/midyunit_m.cpp @@ -25,41 +25,24 @@ // constant definitions enum { - SOUND_NARC = 1, - SOUND_CVSD_SMALL, - SOUND_CVSD, - SOUND_ADPCM, - SOUND_YAWDIM + SOUND_CVSD_SMALL = 0, + SOUND_CVSD }; -void term2_state::machine_start() -{ - midyunit_state::machine_start(); - - m_left_flash.resolve(); - m_right_flash.resolve(); - m_left_gun_recoil.resolve(); - m_right_gun_recoil.resolve(); - m_left_gun_green_led.resolve(); - m_left_gun_red_led.resolve(); - m_right_gun_green_led.resolve(); - m_right_gun_red_led.resolve(); -} - /************************************* * * CMOS reads/writes * *************************************/ -void midyunit_state::midyunit_cmos_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void midyunit_base_state::cmos_w(offs_t offset, uint16_t data, uint16_t mem_mask) { LOGCMOS("%08x:CMOS Write @ %05X\n", m_maincpu->pc(), offset); COMBINE_DATA(&m_cmos_ram[offset + m_cmos_page]); } -uint16_t midyunit_state::midyunit_cmos_r(offs_t offset) +uint16_t midyunit_base_state::cmos_r(offs_t offset) { return m_cmos_ram[offset + m_cmos_page]; } @@ -72,9 +55,9 @@ uint16_t midyunit_state::midyunit_cmos_r(offs_t offset) * *************************************/ -void midyunit_state::midyunit_cmos_enable_w(address_space &space, uint16_t data) +void midyunit_base_state::cmos_enable_w(address_space &space, uint16_t data) { - m_cmos_w_enable = (~data >> 9) & 1; + m_cmos_w_enable = BIT(~data, 9); LOGPROT("%08x:Protection write = %04X\n", m_maincpu->pc(), data); @@ -122,7 +105,7 @@ void midyunit_state::midyunit_cmos_enable_w(address_space &space, uint16_t data) } -uint16_t midyunit_state::midyunit_protection_r() +uint16_t midyunit_base_state::protection_r() { // return the most recently clocked value if (!machine().side_effects_disabled()) @@ -138,7 +121,7 @@ uint16_t midyunit_state::midyunit_protection_r() * *************************************/ -uint16_t midyunit_state::midyunit_input_r(offs_t offset) +uint16_t midyunit_base_state::input_r(offs_t offset) { return m_ports[offset]->read(); } @@ -244,7 +227,7 @@ void term2_state::term2la1_hack_w(offs_t offset, uint16_t data, uint16_t mem_mas * *************************************/ -void midyunit_state::cvsd_protection_w(offs_t offset, uint8_t data) +void midyunit_cvsd_state::cvsd_protection_w(offs_t offset, uint8_t data) { // because the entire CVSD ROM is banked, we have to make sure that writes // go to the proper location (i.e., bank 0); currently bank 0 always lives @@ -253,7 +236,7 @@ void midyunit_state::cvsd_protection_w(offs_t offset, uint8_t data) m_cvsd_protection_base[offset] = data; } -void midyunit_state::install_hidden_ram(mc6809e_device &cpu, int prot_start, int prot_end) +void midyunit_base_state::install_hidden_ram(mc6809e_device &cpu, int prot_start, int prot_end) { size_t size = 1 + prot_end - prot_start; m_hidden_ram = std::make_unique(size); @@ -261,7 +244,7 @@ void midyunit_state::install_hidden_ram(mc6809e_device &cpu, int prot_start, int cpu.space(AS_PROGRAM).install_ram(prot_start, prot_end, m_hidden_ram.get()); } -void midyunit_state::init_generic(int bpp, int sound, int prot_start, int prot_end) +void midyunit_base_state::init_gfxrom(int bpp) { offs_t const gfx_chunk = m_gfx_rom.bytes() / 4; uint8_t d1, d2, d3, d4, d5, d6; @@ -308,33 +291,32 @@ void midyunit_state::init_generic(int bpp, int sound, int prot_start, int prot_e } break; } +} + +void midyunit_cvsd_state::init_generic(int bpp, int sound, int prot_start, int prot_end) +{ + init_gfxrom(bpp); // load sound ROMs and set up sound handlers - m_chip_type = sound; switch (sound) { case SOUND_CVSD_SMALL: - m_cvsd_sound->get_cpu()->space(AS_PROGRAM).install_write_handler(prot_start, prot_end, write8sm_delegate(*this, FUNC(midyunit_state::cvsd_protection_w))); + m_cvsd_sound->get_cpu()->space(AS_PROGRAM).install_write_handler(prot_start, prot_end, write8sm_delegate(*this, FUNC(midyunit_cvsd_state::cvsd_protection_w))); m_cvsd_protection_base = memregion("cvsd:cpu")->base() + 0x10000 + (prot_start - 0x8000); break; case SOUND_CVSD: install_hidden_ram(*m_cvsd_sound->get_cpu(), prot_start, prot_end); break; - - case SOUND_ADPCM: - install_hidden_ram(*m_adpcm_sound->get_cpu(), prot_start, prot_end); - break; - - case SOUND_NARC: - install_hidden_ram(*m_narc_sound->get_cpu(), prot_start, prot_end); - break; - - case SOUND_YAWDIM: - break; } } +void midyunit_adpcm_state::init_generic(int bpp, int prot_start, int prot_end) +{ + init_gfxrom(bpp); + + install_hidden_ram(*m_adpcm_sound->get_cpu(), prot_start, prot_end); +} /************************************* @@ -346,10 +328,11 @@ void midyunit_state::init_generic(int bpp, int sound, int prot_start, int prot_e * *************************************/ -void midyunit_state::init_narc() +void midzunit_state::init_narc() { // common init - init_generic(8, SOUND_NARC, 0xcdff, 0xce29); + init_gfxrom(8); + install_hidden_ram(*m_narc_sound->get_cpu(), 0xcdff, 0xce29); } @@ -365,7 +348,7 @@ void midyunit_state::init_narc() /********************** Trog **************************/ -void midyunit_state::init_trog() +void midyunit_cvsd_state::init_trog() { // protection static const struct protection_data trog_protection_data = @@ -385,7 +368,7 @@ void midyunit_state::init_trog() /********************** Smash TV **********************/ -void midyunit_state::init_smashtv() +void midyunit_cvsd_state::init_smashtv() { // common init init_generic(6, SOUND_CVSD_SMALL, 0x9cf6, 0x9d21); @@ -396,7 +379,7 @@ void midyunit_state::init_smashtv() /********************** High Impact Football **********************/ -void midyunit_state::init_hiimpact() +void midyunit_cvsd_state::init_hiimpact() { // protection static const struct protection_data hiimpact_protection_data = @@ -414,7 +397,7 @@ void midyunit_state::init_hiimpact() /********************** Super High Impact Football **********************/ -void midyunit_state::init_shimpact() +void midyunit_cvsd_state::init_shimpact() { // protection static const struct protection_data shimpact_protection_data = @@ -432,7 +415,7 @@ void midyunit_state::init_shimpact() /********************** Strike Force **********************/ -void midyunit_state::init_strkforc() +void midyunit_cvsd_state::init_strkforc() { // protection static const struct protection_data strkforc_protection_data = @@ -458,7 +441,7 @@ void midyunit_state::init_strkforc() /********************** Mortal Kombat **********************/ -void midyunit_state::init_mkyunit() +void midyunit_adpcm_state::init_mkyunit() { // protection static const struct protection_data mk_protection_data = @@ -471,13 +454,13 @@ void midyunit_state::init_mkyunit() m_prot_data = &mk_protection_data; // common init - init_generic(6, SOUND_ADPCM, 0xfb9c, 0xfbc6); + init_generic(6, 0xfb9c, 0xfbc6); } void mkyawdim_state::init_mkyawdim() { // common init - init_generic(6, SOUND_YAWDIM, 0, 0); + init_gfxrom(6); } @@ -487,22 +470,22 @@ void mkyawdim_state::init_mkyawdim() * *************************************/ -uint16_t midyunit_state::mkturbo_prot_r() +uint16_t midyunit_adpcm_state::mkturbo_prot_r() { /* the security GAL overlays a counter of some sort at 0xfffff400 in ROM space. * A startup protection check expects to read back two different values in succession */ return machine().rand(); } -void midyunit_state::init_mkyturbo() +void midyunit_adpcm_state::init_mkyturbo() { // protection - m_maincpu->space(AS_PROGRAM).install_read_handler(0xfffff400, 0xfffff40f, read16smo_delegate(*this, FUNC(midyunit_state::mkturbo_prot_r))); + m_maincpu->space(AS_PROGRAM).install_read_handler(0xfffff400, 0xfffff40f, read16smo_delegate(*this, FUNC(midyunit_adpcm_state::mkturbo_prot_r))); init_mkyunit(); } -void midyunit_state::init_mkla3bl() +void midyunit_adpcm_state::init_mkla3bl() { // rearrange GFX so the driver can deal with them uint8_t *gfxrom = memregion("gfx")->base(); @@ -539,11 +522,7 @@ void term2_state::term2_init_common(write16s_delegate hack_w) m_prot_data = &term2_protection_data; // common init - init_generic(6, SOUND_ADPCM, 0xfa8d, 0xfa9c); - - // special inputs - m_maincpu->space(AS_PROGRAM).install_read_handler(0x01c00000, 0x01c0005f, read16sm_delegate(*this, FUNC(term2_state::term2_input_r))); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x01e00000, 0x01e0001f, write16sm_delegate(*this, FUNC(term2_state::term2_sound_w))); + init_generic(6, 0xfa8d, 0xfa9c); // HACK: this prevents the freeze on the movies // until we figure what's causing it, this is better than nothing @@ -560,7 +539,7 @@ void term2_state::init_term2la1() { term2_init_common(write16s_delegate(*this, F /********************** Total Carnage **********************/ -void midyunit_state::init_totcarn() +void midyunit_adpcm_state::init_totcarn() { // protection static const struct protection_data totcarn_protection_data = @@ -572,7 +551,7 @@ void midyunit_state::init_totcarn() m_prot_data = &totcarn_protection_data; // common init - init_generic(6, SOUND_ADPCM, 0xfc04, 0xfc2e); + init_generic(6, 0xfc04, 0xfc2e); } @@ -583,32 +562,60 @@ void midyunit_state::init_totcarn() * *************************************/ -MACHINE_RESET_MEMBER(midyunit_state,midyunit) +void midyunit_base_state::machine_start() { - // reset sound - switch (m_chip_type) - { - case SOUND_NARC: - m_narc_sound->reset_write(1); - m_narc_sound->reset_write(0); - break; + // allocate memory + m_cmos_ram = std::make_unique((0x2000 * 4)/2); + m_nvram->set_base(m_cmos_ram.get(), 0x2000 * 4); - case SOUND_CVSD: - case SOUND_CVSD_SMALL: - m_cvsd_sound->reset_write(1); - m_cvsd_sound->reset_write(0); - break; + // reset all the globals + m_cmos_page = 0; - case SOUND_ADPCM: - m_adpcm_sound->reset_write(1); - m_adpcm_sound->reset_write(0); - break; + save_item(NAME(m_cmos_page)); + save_item(NAME(m_prot_result)); + save_item(NAME(m_prot_sequence)); + save_item(NAME(m_prot_index)); + save_item(NAME(m_cmos_w_enable)); + save_pointer(NAME(m_cmos_ram), (0x2000 * 4)/2); +} - case SOUND_YAWDIM: - break; - } +void term2_state::machine_start() +{ + midyunit_adpcm_state::machine_start(); + + m_left_flash.resolve(); + m_right_flash.resolve(); + m_left_gun_recoil.resolve(); + m_right_gun_recoil.resolve(); + m_left_gun_green_led.resolve(); + m_left_gun_red_led.resolve(); + m_right_gun_green_led.resolve(); + m_right_gun_red_led.resolve(); +} + +void midzunit_state::machine_reset() +{ + midyunit_base_state::machine_reset(); + + m_narc_sound->reset_write(1); + m_narc_sound->reset_write(0); } +void midyunit_cvsd_state::machine_reset() +{ + midyunit_base_state::machine_reset(); + + m_cvsd_sound->reset_write(1); + m_cvsd_sound->reset_write(0); +} + +void midyunit_adpcm_state::machine_reset() +{ + midyunit_base_state::machine_reset(); + + m_adpcm_sound->reset_write(1); + m_adpcm_sound->reset_write(0); +} /************************************* @@ -617,7 +624,7 @@ MACHINE_RESET_MEMBER(midyunit_state,midyunit) * *************************************/ -void midyunit_state::midyunit_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void midzunit_state::narc_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask) { // check for out-of-bounds accesses if (offset) @@ -628,23 +635,41 @@ void midyunit_state::midyunit_sound_w(offs_t offset, uint16_t data, uint16_t mem // call through based on the sound type if (ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15) - switch (m_chip_type) - { - case SOUND_NARC: - m_narc_sound->write(data); - break; - - case SOUND_CVSD_SMALL: - case SOUND_CVSD: - m_cvsd_sound->reset_write((~data & 0x100) >> 8); - m_cvsd_sound->write((data & 0xff) | ((data & 0x200) >> 1)); - break; - - case SOUND_ADPCM: - m_adpcm_sound->reset_write((~data & 0x100) >> 8); - m_adpcm_sound->write(data); - break; - } + m_narc_sound->write(data); +} + +void midyunit_cvsd_state::cvsd_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + // check for out-of-bounds accesses + if (offset) + { + logerror("%08X:Unexpected write to sound (hi) = %04X\n", m_maincpu->pc(), data); + return; + } + + // call through based on the sound type + if (ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15) + { + m_cvsd_sound->reset_write(BIT(~data, 8)); + m_cvsd_sound->write((data & 0xff) | ((data & 0x200) >> 1)); + } +} + +void midyunit_adpcm_state::adpcm_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + // check for out-of-bounds accesses + if (offset) + { + logerror("%08X:Unexpected write to sound (hi) = %04X\n", m_maincpu->pc(), data); + return; + } + + // call through based on the sound type + if (ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15) + { + m_adpcm_sound->reset_write(BIT(~data, 8)); + m_adpcm_sound->write(data); + } } void mkyawdim_state::yawdim_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask) diff --git a/src/mame/midway/midyunit_v.cpp b/src/mame/midway/midyunit_v.cpp index b31237b3514..c59fcf58b58 100644 --- a/src/mame/midway/midyunit_v.cpp +++ b/src/mame/midway/midyunit_v.cpp @@ -39,20 +39,16 @@ enum * *************************************/ -VIDEO_START_MEMBER(midyunit_state,common) +void midyunit_base_state::video_start() { // allocate memory - m_cmos_ram = std::make_unique((0x2000 * 4)/2); m_local_videoram = make_unique_clear(0x80000/2); m_pen_map = std::make_unique(65536); - m_nvram->set_base(m_cmos_ram.get(), 0x2000 * 4); - - m_dma_timer = timer_alloc(FUNC(midyunit_state::dma_callback), this); - m_autoerase_line_timer = timer_alloc(FUNC(midyunit_state::autoerase_line), this); + m_dma_timer = timer_alloc(FUNC(midyunit_base_state::dma_callback), this); + m_autoerase_line_timer = timer_alloc(FUNC(midyunit_base_state::autoerase_line), this); // reset all the globals - m_cmos_page = 0; m_autoerase_enable = 0; m_yawdim_dma = 0; @@ -63,15 +59,14 @@ VIDEO_START_MEMBER(midyunit_state,common) // register for state saving save_item(NAME(m_autoerase_enable)); save_pointer(NAME(m_local_videoram), 0x80000/2); - save_pointer(NAME(m_cmos_ram), (0x2000 * 4)/2); save_item(NAME(m_videobank_select)); save_item(NAME(m_dma_register)); } -VIDEO_START_MEMBER(midyunit_state,midyunit_4bit) +VIDEO_START_MEMBER(midyunit_base_state,midyunit_4bit) { - VIDEO_START_CALL_MEMBER(common); + midyunit_base_state::video_start(); // init for 4-bit for (int i = 0; i < 65536; i++) @@ -80,9 +75,9 @@ VIDEO_START_MEMBER(midyunit_state,midyunit_4bit) } -VIDEO_START_MEMBER(midyunit_state,midyunit_6bit) +VIDEO_START_MEMBER(midyunit_base_state,midyunit_6bit) { - VIDEO_START_CALL_MEMBER(common); + midyunit_base_state::video_start(); // init for 6-bit for (int i = 0; i < 65536; i++) @@ -98,9 +93,9 @@ void mkyawdim_state::video_start() } -VIDEO_START_MEMBER(midyunit_state,midzunit) +void midzunit_state::video_start() { - VIDEO_START_CALL_MEMBER(common); + midyunit_base_state::video_start(); // init for 8-bit for (int i = 0; i < 65536; i++) @@ -116,7 +111,7 @@ VIDEO_START_MEMBER(midyunit_state,midzunit) * *************************************/ -uint16_t midyunit_state::midyunit_gfxrom_r(offs_t offset) +uint16_t midyunit_base_state::gfxrom_r(offs_t offset) { offset *= 2; if (m_palette_mask == 0x00ff) @@ -134,7 +129,7 @@ uint16_t midyunit_state::midyunit_gfxrom_r(offs_t offset) * *************************************/ -void midyunit_state::midyunit_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void midyunit_base_state::vram_w(offs_t offset, uint16_t data, uint16_t mem_mask) { offset *= 2; if (m_videobank_select) @@ -154,7 +149,7 @@ void midyunit_state::midyunit_vram_w(offs_t offset, uint16_t data, uint16_t mem_ } -uint16_t midyunit_state::midyunit_vram_r(offs_t offset) +uint16_t midyunit_base_state::vram_r(offs_t offset) { offset *= 2; if (m_videobank_select) @@ -171,13 +166,13 @@ uint16_t midyunit_state::midyunit_vram_r(offs_t offset) * *************************************/ -TMS340X0_TO_SHIFTREG_CB_MEMBER(midyunit_state::to_shiftreg) +TMS340X0_TO_SHIFTREG_CB_MEMBER(midyunit_base_state::to_shiftreg) { memcpy(shiftreg, &m_local_videoram[address >> 3], 2 * 512 * sizeof(uint16_t)); } -TMS340X0_FROM_SHIFTREG_CB_MEMBER(midyunit_state::from_shiftreg) +TMS340X0_FROM_SHIFTREG_CB_MEMBER(midyunit_base_state::from_shiftreg) { memcpy(&m_local_videoram[address >> 3], shiftreg, 2 * 512 * sizeof(uint16_t)); } @@ -190,7 +185,7 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(midyunit_state::from_shiftreg) * *************************************/ -void midyunit_state::midyunit_control_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void midyunit_base_state::control_w(offs_t offset, uint16_t data, uint16_t mem_mask) { /* * Narc 'Z-unit' system register, accessed via '/SEL.MISC' being asserted @@ -229,13 +224,13 @@ void midyunit_state::midyunit_control_w(offs_t offset, uint16_t data, uint16_t m if (ACCESSING_BITS_0_7) { // CMOS page is bits 6-7 - m_cmos_page = ((data >> 6) & 3) * 0x1000; + m_cmos_page = BIT(data, 6, 2) * 0x1000; // video bank select is bit 5 - m_videobank_select = (data >> 5) & 1; + m_videobank_select = BIT(data, 5); // handle autoerase disable (bit 4) - m_autoerase_enable = ((data & 0x10) == 0); + m_autoerase_enable = BIT(~data, 4); } } @@ -247,12 +242,10 @@ void midyunit_state::midyunit_control_w(offs_t offset, uint16_t data, uint16_t m * *************************************/ -void midyunit_state::midyunit_paletteram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void midyunit_base_state::paletteram_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - int newword; - COMBINE_DATA(&m_paletteram[offset]); - newword = m_paletteram[offset]; + uint16_t const newword = m_paletteram[offset]; m_palette->set_pen_color(offset & m_palette_mask, pal5bit(newword >> 10), pal5bit(newword >> 5), pal5bit(newword >> 0)); } @@ -264,7 +257,7 @@ void midyunit_state::midyunit_paletteram_w(offs_t offset, uint16_t data, uint16_ * *************************************/ -void midyunit_state::dma_draw(uint16_t command) +void midyunit_base_state::dma_draw(uint16_t command) { int const dx = (command & 0x10) ? -1 : 1; int const height = m_dma_state.height; @@ -372,7 +365,7 @@ void midyunit_state::dma_draw(uint16_t command) * *************************************/ -TIMER_CALLBACK_MEMBER(midyunit_state::dma_callback) +TIMER_CALLBACK_MEMBER(midyunit_base_state::dma_callback) { m_dma_register[DMA_COMMAND] &= ~0x8000; // tell the cpu we're done m_maincpu->set_input_line(0, ASSERT_LINE); @@ -386,7 +379,7 @@ TIMER_CALLBACK_MEMBER(midyunit_state::dma_callback) * *************************************/ -uint16_t midyunit_state::midyunit_dma_r(offs_t offset) +uint16_t midyunit_base_state::dma_r(offs_t offset) { return m_dma_register[offset]; } @@ -424,7 +417,7 @@ uint16_t midyunit_state::midyunit_dma_r(offs_t offset) * 9 | xxxxxxxxxxxxxxxx | color */ -void midyunit_state::midyunit_dma_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void midyunit_base_state::dma_w(offs_t offset, uint16_t data, uint16_t mem_mask) { // blend with the current register contents COMBINE_DATA(&m_dma_register[offset]); @@ -536,7 +529,7 @@ void midyunit_state::midyunit_dma_w(offs_t offset, uint16_t data, uint16_t mem_m * *************************************/ -TIMER_CALLBACK_MEMBER(midyunit_state::autoerase_line) +TIMER_CALLBACK_MEMBER(midyunit_base_state::autoerase_line) { int scanline = param; @@ -545,7 +538,7 @@ TIMER_CALLBACK_MEMBER(midyunit_state::autoerase_line) } -TMS340X0_SCANLINE_IND16_CB_MEMBER(midyunit_state::scanline_update) +TMS340X0_SCANLINE_IND16_CB_MEMBER(midyunit_base_state::scanline_update) { uint16_t const *const src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; uint16_t *const dest = &bitmap.pix(scanline); -- cgit v1.2.3