From e9972826d58059c9e681850c8c7a1d47cef68819 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 11 Aug 2023 22:38:22 +0200 Subject: [PATCH] darius, ninjaw, spdheat: merge driver files --- src/mame/taito/darius.cpp | 282 +++++++++++++++++++++++--- src/mame/taito/darius.h | 128 ------------ src/mame/taito/darius_v.cpp | 108 ---------- src/mame/taito/ninjaw.cpp | 393 +++++++++++++++++++++++++++--------- src/mame/taito/ninjaw.h | 86 -------- src/mame/taito/ninjaw_v.cpp | 126 ------------ src/mame/taito/spdheat.cpp | 109 +++++++++- src/mame/taito/spdheat.h | 103 ---------- 8 files changed, 644 insertions(+), 691 deletions(-) delete mode 100644 src/mame/taito/darius.h delete mode 100644 src/mame/taito/darius_v.cpp delete mode 100644 src/mame/taito/ninjaw.h delete mode 100644 src/mame/taito/ninjaw_v.cpp delete mode 100644 src/mame/taito/spdheat.h diff --git a/src/mame/taito/darius.cpp b/src/mame/taito/darius.cpp index aa166d2e457..6b6647e8f40 100644 --- a/src/mame/taito/darius.cpp +++ b/src/mame/taito/darius.cpp @@ -1,7 +1,7 @@ // license:GPL-2.0+ // copyright-holders:David Graves, Jarek Burczynski // thanks-to:Richard Bush -/*************************************************************************** +/******************************************************************************* Darius (c) Taito 1986 ====== @@ -127,24 +127,240 @@ TODO When you add a coin there is temporary volume distortion of other sounds. -***************************************************************************/ +*******************************************************************************/ #include "emu.h" -#include "darius.h" #include "taitosnd.h" +#include "pc080sn.h" + #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "machine/watchdog.h" #include "sound/flt_vol.h" #include "sound/msm5205.h" #include "sound/ymopn.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" #include "darius.lh" +namespace { + +#define VOL_MAX (3 * 2 + 2) +#define PAN_MAX (2 + 2 + 1) /* FM 2port + PSG 2port + DA 1port */ + +class darius_state : public driver_device +{ +public: + darius_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_spriteram(*this, "spriteram"), + m_fg_ram(*this, "fg_ram"), + m_audiobank(*this, "audiobank"), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_msm(*this, "msm"), + m_cpub(*this, "cpub"), + m_adpcm(*this, "adpcm"), + m_pc080sn(*this, "pc080sn"), + m_filter_l{{*this, "filter0.%ul", 0U}, {*this, "filter1.%ul", 0U}}, + m_filter_r{{*this, "filter0.%ur", 0U}, {*this, "filter1.%ur", 0U}}, + m_msm5205_l(*this, "msm5205.l"), + m_msm5205_r(*this, "msm5205.r"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette") + { } + + void darius(machine_config &config); + +protected: + virtual void device_post_load() override; + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + /* memory pointers */ + required_shared_ptr m_spriteram; + required_shared_ptr m_fg_ram; + required_memory_bank m_audiobank; + + /* video-related */ + tilemap_t *m_fg_tilemap = nullptr; + + /* misc */ + u16 m_cpua_ctrl = 0; + u16 m_coin_word = 0; + u8 m_adpcm_command = 0; + u8 m_nmi_enable = 0; + u32 m_def_vol[0x10]{}; + u8 m_vol[VOL_MAX]{}; + u8 m_pan[PAN_MAX]{}; + + /* devices */ + required_device m_maincpu; + required_device m_audiocpu; + required_device m_msm; + required_device m_cpub; + required_device m_adpcm; + required_device m_pc080sn; + + required_device_array m_filter_l[2]; + required_device_array m_filter_r[2]; + required_device m_msm5205_l; + required_device m_msm5205_r; + required_device m_gfxdecode; + required_device m_palette; + + void cpua_ctrl_w(u16 data); + u16 coin_r(); + void coin_w(u16 data); + void sound_bankswitch_w(u8 data); + void adpcm_command_w(u8 data); + void fm0_pan_w(u8 data); + void fm1_pan_w(u8 data); + void psg0_pan_w(u8 data); + void psg1_pan_w(u8 data); + void da_pan_w(u8 data); + u8 adpcm_command_r(); + u8 readport2(); + u8 readport3(); + void adpcm_nmi_disable(u8 data); + void adpcm_nmi_enable(u8 data); + void fg_layer_w(offs_t offset, u16 data, u16 mem_mask = ~0); + void write_portA0(u8 data); + void write_portA1(u8 data); + void write_portB0(u8 data); + void write_portB1(u8 data); + void adpcm_data_w(u8 data); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + u32 screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return update_screen(screen, bitmap, cliprect, 36 * 8 * 0); } + u32 screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return update_screen(screen, bitmap, cliprect, 36 * 8 * 1); } + u32 screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return update_screen(screen, bitmap, cliprect, 36 * 8 * 2); } + void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs); + u32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs); + void parse_control(); // assumes Z80 sandwiched between 68Ks + void update_fm0(); + void update_fm1(); + void update_psg0(int port); + void update_psg1(int port); + void update_da(); + void adpcm_int(int state); + void darius_cpub_map(address_map &map); + void darius_map(address_map &map); + void darius_sound2_io_map(address_map &map); + void darius_sound2_map(address_map &map); + void darius_sound_map(address_map &map); +}; + + +/******************************************************************************* + VIDEO HARDWARE +*******************************************************************************/ + +TILE_GET_INFO_MEMBER(darius_state::get_fg_tile_info) +{ + u16 code = (m_fg_ram[tile_index + 0x2000] & 0x7ff); + u16 attr = m_fg_ram[tile_index]; + + tileinfo.set(2, + code, + (attr & 0x7f), + TILE_FLIPYX((attr & 0xc000) >> 14)); +} + +void darius_state::video_start() +{ + m_gfxdecode->gfx(2)->set_granularity(16); + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(darius_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 128, 64); + + m_fg_tilemap->set_transparent_pen(0); +} + +void darius_state::fg_layer_w(offs_t offset, u16 data, u16 mem_mask) +{ + COMBINE_DATA(&m_fg_ram[offset]); + if (offset < 0x4000) + m_fg_tilemap->mark_tile_dirty((offset & 0x1fff)); +} + +/***************************************************************************/ + +void darius_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs) +{ + static const u32 primask[2] = + { + GFX_PMASK_2, // draw sprites with priority 0 which are under the mid layer + 0 // draw sprites with priority 1 which are over the mid layer + }; + + for (int offs = 0; offs < m_spriteram.bytes() / 2; offs += 4) + { + const u32 code = m_spriteram[offs + 2] & 0x1fff; + + if (code) + { + u16 data = m_spriteram[offs]; + const int sy = (256 - data) & 0x1ff; + + data = m_spriteram[offs + 1]; + const int sx = data & 0x3ff; + + data = m_spriteram[offs + 2]; + const bool flipx = ((data & 0x4000) >> 14); + const bool flipy = ((data & 0x8000) >> 15); + + data = m_spriteram[offs + 3]; + const int priority = (data & 0x80) >> 7; // 0 = low + const u32 color = (data & 0x7f); + + int curx = sx - x_offs; + int cury = sy + y_offs; + + if (curx > 900) curx -= 1024; + if (cury > 400) cury -= 512; + + m_gfxdecode->gfx(0)->prio_transpen(bitmap,cliprect, + code, color, + flipx, flipy, + curx, cury, + screen.priority(), primask[priority], 0); + } + } +} + + +u32 darius_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs) +{ + screen.priority().fill(0, cliprect); + m_pc080sn->tilemap_update(); + + // draw bottom layer(always active) + m_pc080sn->tilemap_draw_offset(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 1, -xoffs, 0); + + // draw middle layer + m_pc080sn->tilemap_draw_offset(screen, bitmap, cliprect, 1, 0, 2, -xoffs, 0); + + /* Sprites can be under/over the layer below text layer */ + draw_sprites(screen, bitmap, cliprect, xoffs, -8); + + /* top(text) layer is in fixed position */ + m_fg_tilemap->set_scrollx(0, 0 + xoffs); + m_fg_tilemap->set_scrolly(0, -8); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + + +/******************************************************************************* + MISC. CONTROL +*******************************************************************************/ + void darius_state::parse_control() /* assumes Z80 sandwiched between 68Ks */ { /* bit 0 enables cpu B */ @@ -166,9 +382,9 @@ void darius_state::cpua_ctrl_w(u16 data) } -/********************************************************** - GAME INPUTS -**********************************************************/ +/******************************************************************************* + GAME INPUTS +*******************************************************************************/ u16 darius_state::coin_r() { @@ -188,9 +404,9 @@ void darius_state::coin_w(u16 data) } -/*********************************************************** - MEMORY STRUCTURES -***********************************************************/ +/******************************************************************************* + MEMORY STRUCTURES +*******************************************************************************/ void darius_state::darius_map(address_map &map) { @@ -231,9 +447,9 @@ void darius_state::darius_cpub_map(address_map &map) } -/***************************************************** - SOUND -*****************************************************/ +/******************************************************************************* + SOUND +*******************************************************************************/ void darius_state::sound_bankswitch_w(u8 data) { @@ -254,9 +470,9 @@ void darius_state::display_value(u8 data) #endif -/***************************************************** - Sound mixer/pan control -*****************************************************/ +/******************************************************************************* + Sound mixer/pan control +*******************************************************************************/ void darius_state::update_fm0() { @@ -415,9 +631,9 @@ void darius_state::write_portB1(u8 data) } -/***************************************************** - Sound memory structures / ADPCM -*****************************************************/ +/******************************************************************************* + Sound memory structures / ADPCM +*******************************************************************************/ void darius_state::darius_sound_map(address_map &map) { @@ -495,9 +711,9 @@ void darius_state::darius_sound2_io_map(address_map &map) } -/*********************************************************** - INPUT PORTS, DIPs -***********************************************************/ +/******************************************************************************* + INPUT PORTS, DIPs +*******************************************************************************/ #define TAITO_COINAGE_JAPAN_16 \ PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:5,6") \ @@ -614,9 +830,9 @@ static INPUT_PORTS_START( dariusu ) // US version uses the Japan coinage setting INPUT_PORTS_END -/************************************************************** - GFX DECODING -**************************************************************/ +/******************************************************************************* + GFX DECODING +*******************************************************************************/ static const gfx_layout tilelayout = { @@ -647,9 +863,9 @@ static GFXDECODE_START( gfx_darius ) GFXDECODE_END -/*********************************************************** - MACHINE DRIVERS -***********************************************************/ +/******************************************************************************* + MACHINE DRIVERS +*******************************************************************************/ void darius_state::device_post_load() { @@ -806,9 +1022,9 @@ void darius_state::darius(machine_config &config) } -/*************************************************************************** - DRIVERS -***************************************************************************/ +/******************************************************************************* + ROM DEFINITIONS +*******************************************************************************/ ROM_START( darius ) ROM_REGION( 0x60000, "maincpu", 0 ) /* 68000 code */ @@ -1093,6 +1309,12 @@ ROM_START( dariuse ) ROM_LOAD16_BYTE( "a96-26.165", 0x0800, 0x0400, CRC(4891b9c0) SHA1(1f550a9a4ad3ca379f88f5865ed1b281c7b87f31) ) ROM_END +} // anonymous namespace + + +/******************************************************************************* + DRIVERS +*******************************************************************************/ GAME( 1986, darius, 0, darius, darius, darius_state, empty_init, ROT0, "Taito Corporation Japan", "Darius (World, rev 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, dariusu, darius, darius, dariusu, darius_state, empty_init, ROT0, "Taito America Corporation", "Darius (US, rev 2)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/taito/darius.h b/src/mame/taito/darius.h deleted file mode 100644 index 64c758179e4..00000000000 --- a/src/mame/taito/darius.h +++ /dev/null @@ -1,128 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:David Graves, Jarek Burczynski -/************************************************************************* - - Darius - -*************************************************************************/ -#ifndef MAME_TAITO_DARIUS_H -#define MAME_TAITO_DARIUS_H - -#pragma once - -#include "sound/flt_vol.h" -#include "sound/msm5205.h" -#include "pc080sn.h" -#include "emupal.h" -#include "tilemap.h" - -#define VOL_MAX (3 * 2 + 2) -#define PAN_MAX (2 + 2 + 1) /* FM 2port + PSG 2port + DA 1port */ - -class darius_state : public driver_device -{ -public: - darius_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_spriteram(*this, "spriteram"), - m_fg_ram(*this, "fg_ram"), - m_audiobank(*this, "audiobank"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_msm(*this, "msm"), - m_cpub(*this, "cpub"), - m_adpcm(*this, "adpcm"), - m_pc080sn(*this, "pc080sn"), - m_filter_l{{*this, "filter0.%ul", 0U}, - {*this, "filter1.%ul", 0U}}, - m_filter_r{{*this, "filter0.%ur", 0U}, - {*this, "filter1.%ur", 0U}}, - m_msm5205_l(*this, "msm5205.l"), - m_msm5205_r(*this, "msm5205.r"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - void darius(machine_config &config); - -protected: - virtual void device_post_load() override; - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - -private: - /* memory pointers */ - required_shared_ptr m_spriteram; - required_shared_ptr m_fg_ram; - required_memory_bank m_audiobank; - - /* video-related */ - tilemap_t *m_fg_tilemap = nullptr; - - /* misc */ - u16 m_cpua_ctrl = 0; - u16 m_coin_word = 0; - u8 m_adpcm_command = 0; - u8 m_nmi_enable = 0; - u32 m_def_vol[0x10]{}; - u8 m_vol[VOL_MAX]{}; - u8 m_pan[PAN_MAX]{}; - - /* devices */ - required_device m_maincpu; - required_device m_audiocpu; - required_device m_msm; - required_device m_cpub; - required_device m_adpcm; - required_device m_pc080sn; - - required_device_array m_filter_l[2]; - required_device_array m_filter_r[2]; - required_device m_msm5205_l; - required_device m_msm5205_r; - required_device m_gfxdecode; - required_device m_palette; - - void cpua_ctrl_w(u16 data); - u16 coin_r(); - void coin_w(u16 data); - void sound_bankswitch_w(u8 data); - void adpcm_command_w(u8 data); - void fm0_pan_w(u8 data); - void fm1_pan_w(u8 data); - void psg0_pan_w(u8 data); - void psg1_pan_w(u8 data); - void da_pan_w(u8 data); - u8 adpcm_command_r(); - u8 readport2(); - u8 readport3(); - void adpcm_nmi_disable(u8 data); - void adpcm_nmi_enable(u8 data); - void fg_layer_w(offs_t offset, u16 data, u16 mem_mask = ~0); - void write_portA0(u8 data); - void write_portA1(u8 data); - void write_portB0(u8 data); - void write_portB1(u8 data); - void adpcm_data_w(u8 data); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - u32 screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - u32 screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - u32 screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs); - u32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs); - void parse_control(); // assumes Z80 sandwiched between 68Ks - void update_fm0(); - void update_fm1(); - void update_psg0(int port); - void update_psg1(int port); - void update_da(); - void adpcm_int(int state); - void darius_cpub_map(address_map &map); - void darius_map(address_map &map); - void darius_sound2_io_map(address_map &map); - void darius_sound2_map(address_map &map); - void darius_sound_map(address_map &map); -}; - -#endif // MAME_TAITO_DARIUS_H diff --git a/src/mame/taito/darius_v.cpp b/src/mame/taito/darius_v.cpp deleted file mode 100644 index 61184beae5e..00000000000 --- a/src/mame/taito/darius_v.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// license:GPL-2.0+ -// copyright-holders:David Graves, Jarek Burczynski -#include "emu.h" -#include "darius.h" -#include "screen.h" - -/***************************************************************************/ - -TILE_GET_INFO_MEMBER(darius_state::get_fg_tile_info) -{ - u16 code = (m_fg_ram[tile_index + 0x2000] & 0x7ff); - u16 attr = m_fg_ram[tile_index]; - - tileinfo.set(2, - code, - (attr & 0x7f), - TILE_FLIPYX((attr & 0xc000) >> 14)); -} - -/***************************************************************************/ - -void darius_state::video_start() -{ - m_gfxdecode->gfx(2)->set_granularity(16); - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(darius_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 128, 64); - - m_fg_tilemap->set_transparent_pen(0); -} - -/***************************************************************************/ - -void darius_state::fg_layer_w(offs_t offset, u16 data, u16 mem_mask) -{ - COMBINE_DATA(&m_fg_ram[offset]); - if (offset < 0x4000) - m_fg_tilemap->mark_tile_dirty((offset & 0x1fff)); -} - -/***************************************************************************/ - -void darius_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs) -{ - static const u32 primask[2] = - { - GFX_PMASK_2, // draw sprites with priority 0 which are under the mid layer - 0 // draw sprites with priority 1 which are over the mid layer - }; - - for (int offs = 0; offs < m_spriteram.bytes() / 2; offs += 4) - { - const u32 code = m_spriteram[offs + 2] & 0x1fff; - - if (code) - { - u16 data = m_spriteram[offs]; - const int sy = (256 - data) & 0x1ff; - - data = m_spriteram[offs + 1]; - const int sx = data & 0x3ff; - - data = m_spriteram[offs + 2]; - const bool flipx = ((data & 0x4000) >> 14); - const bool flipy = ((data & 0x8000) >> 15); - - data = m_spriteram[offs + 3]; - const int priority = (data & 0x80) >> 7; // 0 = low - const u32 color = (data & 0x7f); - - int curx = sx - x_offs; - int cury = sy + y_offs; - - if (curx > 900) curx -= 1024; - if (cury > 400) cury -= 512; - - m_gfxdecode->gfx(0)->prio_transpen(bitmap,cliprect, - code, color, - flipx, flipy, - curx, cury, - screen.priority(), primask[priority], 0); - } - } -} - - -u32 darius_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs) -{ - screen.priority().fill(0, cliprect); - m_pc080sn->tilemap_update(); - - // draw bottom layer(always active) - m_pc080sn->tilemap_draw_offset(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 1, -xoffs, 0); - - // draw middle layer - m_pc080sn->tilemap_draw_offset(screen, bitmap, cliprect, 1, 0, 2, -xoffs, 0); - - /* Sprites can be under/over the layer below text layer */ - draw_sprites(screen, bitmap, cliprect, xoffs, -8); - - /* top(text) layer is in fixed position */ - m_fg_tilemap->set_scrollx(0, 0 + xoffs); - m_fg_tilemap->set_scrolly(0, -8); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - return 0; -} - -u32 darius_state::screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8 * 0); } -u32 darius_state::screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8 * 1); } -u32 darius_state::screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8 * 2); } diff --git a/src/mame/taito/ninjaw.cpp b/src/mame/taito/ninjaw.cpp index 749cb233f38..0919abec400 100644 --- a/src/mame/taito/ninjaw.cpp +++ b/src/mame/taito/ninjaw.cpp @@ -1,7 +1,7 @@ // license:BSD-3-Clause // copyright-holders:David Graves // thanks-to:Richard Bush -/*************************************************************************** +/******************************************************************************* Taito Triple Screen Games ========================= @@ -312,21 +312,279 @@ Darius 2 (When you lose a life or big enemies appear it's meant to create rumbling on a subwoofer in the cabinet.) - -***************************************************************************/ +*******************************************************************************/ #include "emu.h" -#include "ninjaw.h" + +#include "taitoio.h" #include "taitoipt.h" +#include "taitosnd.h" + +#include "tc0100scn.h" +#include "tc0110pcr.h" #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" +#include "sound/flt_vol.h" #include "sound/ymopn.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" #include "ninjaw.lh" + +namespace { + +class ninjaw_state : public driver_device +{ +public: + ninjaw_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_subcpu(*this, "sub"), + m_tc0140syt(*this, "tc0140syt"), + m_tc0100scn(*this, "tc0100scn_%u", 1), + m_tc0110pcr(*this, "tc0110pcr_%u", 1), + m_2610_l(*this, "2610.%u.l", 1), + m_2610_r(*this, "2610.%u.r", 1), + m_gfxdecode(*this, "gfxdecode_%u", 1), + m_spriteram(*this, "spriteram"), + m_z80bank(*this, "z80bank") + { } + + void darius2(machine_config &config); + void ninjaw(machine_config &config); + +protected: + virtual void device_post_load() override; + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + /* devices */ + required_device m_maincpu; + required_device m_subcpu; + required_device m_tc0140syt; + required_device_array m_tc0100scn; + required_device_array m_tc0110pcr; + required_device_array m_2610_l; + required_device_array m_2610_r; + required_device_array m_gfxdecode; + + /* memory pointers */ + required_shared_ptr m_spriteram; + + /* memory regions */ + required_memory_bank m_z80bank; + + /* misc */ + u16 m_cpua_ctrl = 0; + int m_pandata[4]{}; + + void coin_control_w(u8 data); + void cpua_ctrl_w(u16 data); + void sound_bankswitch_w(u8 data); + void pancontrol_w(offs_t offset, u8 data); + void tc0100scn_triple_screen_w(offs_t offset, u16 data, u16 mem_mask = ~0); + + u32 screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return update_screen(screen, bitmap, cliprect, 36 * 8, 0); } + u32 screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return update_screen(screen, bitmap, cliprect, 36 * 8, 1); } + u32 screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return update_screen(screen, bitmap, cliprect, 36 * 8, 2); } + void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs, int chip); + void parse_control(); + u32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, int chip); + void darius2_master_map(address_map &map); + void darius2_slave_map(address_map &map); + void ninjaw_master_map(address_map &map); + void ninjaw_slave_map(address_map &map); + void sound_map(address_map &map); +}; + + +/******************************************************************************* + SUBWOOFER (SOUND) +*******************************************************************************/ +#if 0 + +class subwoofer_device : public device_t, public device_sound_interface +{ +public: + subwoofer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + ~subwoofer_device() {} + +protected: + // device-level overrides + virtual void device_start(); + + // sound stream update overrides + virtual void sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) override; +}; + +extern const device_type SUBWOOFER; + +const device_type SUBWOOFER = device_creator; + +subwoofer_device::subwoofer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + device_t(mconfig, SUBWOOFER, "Subwoofer", tag, owner, clock), + device_sound_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void subwoofer_device::device_start() +{ + /* Adjust the lowpass filter of the first three YM2610 channels */ + + /* The 150 Hz is a common top frequency played by a generic */ + /* subwoofer, the real Arcade Machine may differ */ + + mixer_set_lowpass_frequency(0, 20); + mixer_set_lowpass_frequency(1, 20); + mixer_set_lowpass_frequency(2, 20); + + return 0; +} + +//------------------------------------------------- +// sound_stream_update - handle a stream update +//------------------------------------------------- + +void subwoofer_device::sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) +{ + outputs[0].fill(0); +} + +#endif + + +/******************************************************************************* + SPRITE DRAW ROUTINE +*******************************************************************************/ + +void ninjaw_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs, int chip) +{ +#ifdef MAME_DEBUG + int unknown = 0; +#endif + + static const u32 primask[2] = + { + GFX_PMASK_4, // draw sprites with priority 0 which are over the mid layer + (GFX_PMASK_4 | GFX_PMASK_2) // draw sprites with priority 1 which are under the mid layer + }; + + for (int offs = 0; offs < (m_spriteram.bytes() / 2); offs += 4) + { + int data = m_spriteram[offs + 2]; + const u32 tilenum = data & 0x7fff; + + if (!tilenum) + continue; + + data = m_spriteram[offs + 0]; + int x = (data - 32) & 0x3ff; /* aligns sprites on rock outcrops and sewer hole */ + + data = m_spriteram[offs + 1]; + int y = (data - 0) & 0x1ff; + + /* + The purpose of the bit at data&0x8 (below) is unknown, but it is set + on Darius explosions, some enemy missiles and at least 1 boss. + It is most likely another priority bit but as there are no obvious + visual problems it will need checked against the original pcb. + + There is a report this bit is set when the player intersects + the tank sprite in Ninja Warriors however I was unable to repro + this or find any use of this bit in that game. + + Bit&0x8000 is set on some sprites in later levels of Darius + but is again unknown, and there is no obvious visual problem. + */ + data = m_spriteram[offs + 3]; + const bool flipx = (data & 0x1); + const bool flipy = (data & 0x2) >> 1; + const int priority = (data & 0x4) >> 2; // 1 = low + /* data&0x8 - unknown */ + const u32 color = (data & 0x7f00) >> 8; + /* data&0x8000 - unknown */ + +#ifdef MAME_DEBUG + if (data & 0x80f0) unknown |= (data &0x80f0); +#endif + + x -= x_offs; + y += y_offs; + + /* sprite wrap: coords become negative at high values */ + if (x > 0x3c0) x -= 0x400; + if (y > 0x180) y -= 0x200; + + const int curx = x; + const int cury = y; + const u32 code = tilenum; + + m_gfxdecode[chip]->gfx(0)->prio_transpen(bitmap,cliprect, + code, color, + flipx, flipy, + curx, cury, + screen.priority(), primask[priority], + 0); + } + +#ifdef MAME_DEBUG + if (unknown) + popmessage("unknown sprite bits: %04x",unknown); +#endif +} + + +/******************************************************************************* + SCREEN REFRESH +*******************************************************************************/ + +u32 ninjaw_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, int chip) +{ + tc0100scn_device *tc0100scn = m_tc0100scn[chip]; + xoffs *= chip; + u8 layer[3]; + + tc0100scn->tilemap_update(); + + layer[0] = m_tc0100scn[0]->bottomlayer(); + layer[1] = layer[0] ^ 1; + layer[2] = 2; + + screen.priority().fill(0, cliprect); + /* chip 0 does tilemaps on the left, chip 1 center, chip 2 the right */ + // draw bottom layer + u8 nodraw = tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1); /* left */ + + /* Ensure screen blanked even when bottom layers not drawn due to disable bit */ + if (nodraw) + bitmap.fill(m_tc0110pcr[chip]->black_pen(), cliprect); + + // draw middle layer + tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2); + + // draw top(text) layer + tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4); + + /* Sprites can be under/over the layer below text layer */ + draw_sprites(screen, bitmap, cliprect, xoffs, 8, chip); + + return 0; +} + + +/******************************************************************************* + MISC. CONTROL +*******************************************************************************/ + void ninjaw_state::parse_control() /* assumes Z80 sandwiched between 68Ks */ { /* bit 0 enables cpu B */ @@ -357,16 +615,15 @@ void ninjaw_state::coin_control_w(u8 data) } -/***************************************** - SOUND -*****************************************/ +/******************************************************************************* + SOUND +*******************************************************************************/ void ninjaw_state::sound_bankswitch_w(u8 data) { m_z80bank->set_entry(data & 7); } - /**** sound pan control ****/ void ninjaw_state::pancontrol_w(offs_t offset, u8 data) @@ -396,9 +653,10 @@ void ninjaw_state::tc0100scn_triple_screen_w(offs_t offset, u16 data, u16 mem_ma m_tc0100scn[2]->ram_w(offset, data, mem_mask); } -/*********************************************************** - MEMORY STRUCTURES -***********************************************************/ + +/******************************************************************************* + MEMORY STRUCTURES +*******************************************************************************/ void ninjaw_state::ninjaw_master_map(address_map &map) { @@ -469,7 +727,7 @@ void ninjaw_state::darius2_slave_map(address_map &map) } -/***************************************************************************/ +/******************************************************************************/ void ninjaw_state::sound_map(address_map &map) { @@ -487,9 +745,9 @@ void ninjaw_state::sound_map(address_map &map) } -/*********************************************************** - INPUT PORTS, DIPs -***********************************************************/ +/******************************************************************************* + INPUT PORTS, DIPs +*******************************************************************************/ static INPUT_PORTS_START( ninjaw ) /* 0x200000 (port 0) -> 0x0c2291.b and 0x24122c (shared RAM) */ @@ -580,11 +838,9 @@ static INPUT_PORTS_START( darius2 ) INPUT_PORTS_END -/*********************************************************** - GFX DECODING - - (Thanks to Raine for the obj decoding) -***********************************************************/ +/******************************************************************************* + GFX DECODING (Thanks to Raine for the obj decoding) +*******************************************************************************/ static const gfx_layout tilelayout = { @@ -602,80 +858,15 @@ static GFXDECODE_START( gfx_ninjaw ) GFXDECODE_END -/************************************************************** - SUBWOOFER (SOUND) -**************************************************************/ -#if 0 - -class subwoofer_device : public device_t, - public device_sound_interface -{ -public: - subwoofer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - ~subwoofer_device() {} - -protected: - // device-level overrides - virtual void device_start(); - - // sound stream update overrides - virtual void sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) override; - -private: - // internal state - -}; - -extern const device_type SUBWOOFER; - -const device_type SUBWOOFER = device_creator; - -subwoofer_device::subwoofer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : device_t(mconfig, SUBWOOFER, "Subwoofer", tag, owner, clock), - device_sound_interface(mconfig, *this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void subwoofer_device::device_start() -{ - /* Adjust the lowpass filter of the first three YM2610 channels */ - - /* The 150 Hz is a common top frequency played by a generic */ - /* subwoofer, the real Arcade Machine may differs */ - - mixer_set_lowpass_frequency(0, 20); - mixer_set_lowpass_frequency(1, 20); - mixer_set_lowpass_frequency(2, 20); - - return 0; -} - -//------------------------------------------------- -// sound_stream_update - handle a stream update -//------------------------------------------------- - -void subwoofer_device::sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) -{ - outputs[0].fill(0); -} - - -#endif - - -/************************************************************* - MACHINE DRIVERS - +/******************************************************************************* + MACHINE DRIVERS +-------------------------------------------------------------------------------- Ninjaw: high interleaving of 100, but doesn't stop enemies "sliding" when they should be standing still relative to the scrolling background. Darius2: arbitrary interleaving of 10 to keep cpus synced. -*************************************************************/ +*******************************************************************************/ void ninjaw_state::device_post_load() { @@ -914,9 +1105,9 @@ void ninjaw_state::darius2(machine_config &config) } -/*************************************************************************** - DRIVERS -***************************************************************************/ +/******************************************************************************* + ROM DEFINITIONS +*******************************************************************************/ ROM_START( ninjaw ) ROM_REGION( 0xc0000, "maincpu", 0 ) /* 256K for 68000 CPUA code */ @@ -1180,12 +1371,16 @@ ROM_START( darius2 ) ROM_LOAD( "c07-12.107", 0x00000, 0x80000, CRC(e0b71258) SHA1(0258e308b643d723475824752ebffc4ea29d1ac4) ) ROM_END +} // anonymous namespace -/* Working Games */ -// YEAR, NAME, PARENT, MACHINE, INPUT, STATE INIT,MONITOR,COMPANY, FULLNAME,FLAGS -GAME( 1987, ninjaw, 0, ninjaw, ninjaw, ninjaw_state, empty_init, ROT0, "Taito Corporation Japan", "The Ninja Warriors (World, later version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -GAME( 1987, ninjaw1, ninjaw, ninjaw, ninjaw, ninjaw_state, empty_init, ROT0, "Taito Corporation Japan", "The Ninja Warriors (World, earlier version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -GAME( 1987, ninjawj, ninjaw, ninjaw, ninjawj, ninjaw_state, empty_init, ROT0, "Taito Corporation", "The Ninja Warriors (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -GAME( 1987, ninjawu, ninjaw, ninjaw, ninjawj, ninjaw_state, empty_init, ROT0, "Taito Corporation America (licensed to Romstar)", "The Ninja Warriors (US, Romstar license)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) /* Uses same coinage as World, see notes */ -GAME( 1989, darius2, 0, darius2, darius2, ninjaw_state, empty_init, ROT0, "Taito Corporation", "Darius II (triple screen) (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +/******************************************************************************* + DRIVERS +*******************************************************************************/ + +// YEAR, NAME, PARENT, MACHINE, INPUT, CLASS, INIT, MONITOR, COMPANY, FULLNAME, FLAGS +GAME( 1987, ninjaw, 0, ninjaw, ninjaw, ninjaw_state, empty_init, ROT0, "Taito Corporation Japan", "The Ninja Warriors (World, later version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +GAME( 1987, ninjaw1, ninjaw, ninjaw, ninjaw, ninjaw_state, empty_init, ROT0, "Taito Corporation Japan", "The Ninja Warriors (World, earlier version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +GAME( 1987, ninjawj, ninjaw, ninjaw, ninjawj, ninjaw_state, empty_init, ROT0, "Taito Corporation", "The Ninja Warriors (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) +GAME( 1987, ninjawu, ninjaw, ninjaw, ninjawj, ninjaw_state, empty_init, ROT0, "Taito Corporation America (licensed to Romstar)", "The Ninja Warriors (US, Romstar license)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) /* Uses same coinage as World, see notes */ +GAME( 1989, darius2, 0, darius2, darius2, ninjaw_state, empty_init, ROT0, "Taito Corporation", "Darius II (triple screen) (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) diff --git a/src/mame/taito/ninjaw.h b/src/mame/taito/ninjaw.h deleted file mode 100644 index d71d85ee0f3..00000000000 --- a/src/mame/taito/ninjaw.h +++ /dev/null @@ -1,86 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Graves -/************************************************************************* - - Taito Triple Screen Games - -*************************************************************************/ -#ifndef MAME_TAITO_NINJAW_H -#define MAME_TAITO_NINJAW_H - -#pragma once - -#include "taitosnd.h" -#include "taitoio.h" -#include "sound/flt_vol.h" -#include "tc0100scn.h" -#include "tc0110pcr.h" -#include "emupal.h" - - -class ninjaw_state : public driver_device -{ -public: - ninjaw_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub"), - m_tc0140syt(*this, "tc0140syt"), - m_tc0100scn(*this, "tc0100scn_%u", 1), - m_tc0110pcr(*this, "tc0110pcr_%u", 1), - m_2610_l(*this, "2610.%u.l", 1), - m_2610_r(*this, "2610.%u.r", 1), - m_gfxdecode(*this, "gfxdecode_%u", 1), - m_spriteram(*this, "spriteram"), - m_z80bank(*this, "z80bank") - { } - - void darius2(machine_config &config); - void ninjaw(machine_config &config); - -protected: - virtual void device_post_load() override; - virtual void machine_start() override; - virtual void machine_reset() override; - -private: - /* devices */ - required_device m_maincpu; - required_device m_subcpu; - required_device m_tc0140syt; - required_device_array m_tc0100scn; - required_device_array m_tc0110pcr; - required_device_array m_2610_l; - required_device_array m_2610_r; - required_device_array m_gfxdecode; - - /* memory pointers */ - required_shared_ptr m_spriteram; - - /* memory regions */ - required_memory_bank m_z80bank; - - /* misc */ - u16 m_cpua_ctrl = 0; - int m_pandata[4]{}; - - void coin_control_w(u8 data); - void cpua_ctrl_w(u16 data); - void sound_bankswitch_w(u8 data); - void pancontrol_w(offs_t offset, u8 data); - void tc0100scn_triple_screen_w(offs_t offset, u16 data, u16 mem_mask = ~0); - - u32 screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - u32 screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - u32 screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs, int chip); - void parse_control(); - u32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, int chip); - void darius2_master_map(address_map &map); - void darius2_slave_map(address_map &map); - void ninjaw_master_map(address_map &map); - void ninjaw_slave_map(address_map &map); - void sound_map(address_map &map); -}; - -#endif // MAME_TAITO_NINJAW_H diff --git a/src/mame/taito/ninjaw_v.cpp b/src/mame/taito/ninjaw_v.cpp deleted file mode 100644 index a84982a070b..00000000000 --- a/src/mame/taito/ninjaw_v.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Graves -#include "emu.h" -#include "ninjaw.h" - -/************************************************************ - SPRITE DRAW ROUTINE -************************************************************/ - -void ninjaw_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs, int chip) -{ -#ifdef MAME_DEBUG - int unknown = 0; -#endif - - static const u32 primask[2] = - { - GFX_PMASK_4, // draw sprites with priority 0 which are over the mid layer - (GFX_PMASK_4 | GFX_PMASK_2) // draw sprites with priority 1 which are under the mid layer - }; - - for (int offs = 0; offs < (m_spriteram.bytes() / 2); offs += 4) - { - int data = m_spriteram[offs + 2]; - const u32 tilenum = data & 0x7fff; - - if (!tilenum) - continue; - - data = m_spriteram[offs + 0]; - int x = (data - 32) & 0x3ff; /* aligns sprites on rock outcrops and sewer hole */ - - data = m_spriteram[offs + 1]; - int y = (data - 0) & 0x1ff; - - /* - The purpose of the bit at data&0x8 (below) is unknown, but it is set - on Darius explosions, some enemy missiles and at least 1 boss. - It is most likely another priority bit but as there are no obvious - visual problems it will need checked against the original pcb. - - There is a report this bit is set when the player intersects - the tank sprite in Ninja Warriors however I was unable to repro - this or find any use of this bit in that game. - - Bit&0x8000 is set on some sprites in later levels of Darius - but is again unknown, and there is no obvious visual problem. - */ - data = m_spriteram[offs + 3]; - const bool flipx = (data & 0x1); - const bool flipy = (data & 0x2) >> 1; - const int priority = (data & 0x4) >> 2; // 1 = low - /* data&0x8 - unknown */ - const u32 color = (data & 0x7f00) >> 8; - /* data&0x8000 - unknown */ - -#ifdef MAME_DEBUG - if (data & 0x80f0) unknown |= (data &0x80f0); -#endif - - x -= x_offs; - y += y_offs; - - /* sprite wrap: coords become negative at high values */ - if (x > 0x3c0) x -= 0x400; - if (y > 0x180) y -= 0x200; - - const int curx = x; - const int cury = y; - const u32 code = tilenum; - - m_gfxdecode[chip]->gfx(0)->prio_transpen(bitmap,cliprect, - code, color, - flipx, flipy, - curx, cury, - screen.priority(), primask[priority], - 0); - } - -#ifdef MAME_DEBUG - if (unknown) - popmessage("unknown sprite bits: %04x",unknown); -#endif -} - - -/************************************************************** - SCREEN REFRESH -**************************************************************/ - -u32 ninjaw_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, int chip) -{ - tc0100scn_device *tc0100scn = m_tc0100scn[chip]; - xoffs *= chip; - u8 layer[3]; - - tc0100scn->tilemap_update(); - - layer[0] = m_tc0100scn[0]->bottomlayer(); - layer[1] = layer[0] ^ 1; - layer[2] = 2; - - screen.priority().fill(0, cliprect); - /* chip 0 does tilemaps on the left, chip 1 center, chip 2 the right */ - // draw bottom layer - u8 nodraw = tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1); /* left */ - - /* Ensure screen blanked even when bottom layers not drawn due to disable bit */ - if (nodraw) - bitmap.fill(m_tc0110pcr[chip]->black_pen(), cliprect); - - // draw middle layer - tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2); - - // draw top(text) layer - tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4); - - /* Sprites can be under/over the layer below text layer */ - draw_sprites(screen, bitmap, cliprect, xoffs, 8, chip); - - return 0; -} - -u32 ninjaw_state::screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8, 0); } -u32 ninjaw_state::screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8, 1); } -u32 ninjaw_state::screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8, 2); } diff --git a/src/mame/taito/spdheat.cpp b/src/mame/taito/spdheat.cpp index 361be000320..30e34713c11 100644 --- a/src/mame/taito/spdheat.cpp +++ b/src/mame/taito/spdheat.cpp @@ -12,21 +12,107 @@ ***************************************************************************/ #include "emu.h" -#include "spdheat.h" -#include "spdheat.lh" -#include "speaker.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" +#include "machine/input_merger.h" #include "machine/watchdog.h" #include "sound/ay8910.h" +#include "sound/dac.h" #include "sound/flt_vol.h" #include "sound/ymopn.h" +#include "emupal.h" +#include "screen.h" +#include "speaker.h" +#include "tilemap.h" -static constexpr XTAL MASTER_CLOCK = 16_MHz_XTAL; -static constexpr XTAL SOUND_CLOCK = 4_MHz_XTAL; -static constexpr XTAL FM_CLOCK = SOUND_CLOCK / 2; +#include "spdheat.lh" + + +namespace { + +/************************************* + * + * Machine class + * + *************************************/ + +class spdheat_state : public driver_device +{ +public: + spdheat_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_subcpu(*this, "subcpu"), + m_audiocpu(*this, "audiocpu"), + m_audio_irq(*this, "audio_irq"), + m_fg_ram(*this, "fg_ram%u", 0U), + m_spriteram(*this, "spriteram"), + m_gfxdecode(*this, "gfxdecode"), + m_palette0(*this, "palette0"), + m_palette1(*this, "palette1"), + m_palette2(*this, "palette2"), + m_palette3(*this, "palette3"), + m_dac(*this, "dac") + { } + + void spdheat(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_subcpu; + required_device m_audiocpu; + required_device m_audio_irq; + required_shared_ptr_array m_fg_ram; + required_shared_ptr m_spriteram; + tilemap_t *m_fg_tilemap[4]{}; + + required_device m_gfxdecode; + required_device m_palette0; + required_device m_palette1; + required_device m_palette2; + required_device m_palette3; + required_device m_dac; + + uint32_t m_sound_data[4]{}; + uint32_t m_sound_status = 0; + uint32_t m_sub_data = 0; + uint32_t m_sub_status = 0; + + void main_map(address_map &map); + void sub_map(address_map &map); + void sub_io_map(address_map &map); + void sound_map(address_map &map); + + void sub_dac_w(uint8_t data); + void sub_nmi_w(uint8_t data); + void sub_status_w(uint8_t data); + uint8_t sub_snd_r(); + uint8_t soundstatus_r(); + uint8_t sub_status_r(); + uint16_t sound_status_r(); + template void sound_w(uint16_t data); + template uint8_t sndcpu_sound_r(); + void ym1_port_a_w(uint8_t data); + void ym1_port_b_w(uint8_t data); + void ym2_port_a_w(uint8_t data); + void ym2_port_b_w(uint8_t data); + void ym3_port_a_w(uint8_t data); + void ym3_port_b_w(uint8_t data); + void ym4_port_a_w(uint8_t data); + void ym4_port_b_w(uint8_t data); + + template void text_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + template TILE_GET_INFO_MEMBER(get_fg_tile_info); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint32_t xo, uint32_t yo); + template uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; /************************************* @@ -298,11 +384,6 @@ void spdheat_state::sound_w(uint16_t data) m_sound_status &= ~(1 << screen); } -uint8_t spdheat_state::sub_r() -{ - return 0; // TODO -} - void spdheat_state::sub_dac_w(uint8_t data) { m_dac->write(data); @@ -685,6 +766,10 @@ GFXDECODE_END void spdheat_state::spdheat(machine_config &config) { + constexpr XTAL MASTER_CLOCK = 16_MHz_XTAL; + constexpr XTAL SOUND_CLOCK = 4_MHz_XTAL; + constexpr XTAL FM_CLOCK = SOUND_CLOCK / 2; + /* basic machine hardware */ M68000(config, m_maincpu, MASTER_CLOCK / 2); m_maincpu->set_addrmap(AS_PROGRAM, &spdheat_state::main_map); @@ -842,6 +927,8 @@ ROM_START( spdheatj ) ROM_LOAD( "a55-14.ic36", 0x18000, 0x08000, CRC(31c38779) SHA1(42ce3441a540644d17f27e84f8c5693cbee3e9f1) ) ROM_END +} // anonymous namespace + /************************************* * diff --git a/src/mame/taito/spdheat.h b/src/mame/taito/spdheat.h deleted file mode 100644 index 880574bc5c1..00000000000 --- a/src/mame/taito/spdheat.h +++ /dev/null @@ -1,103 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Philip Bennett -/************************************************************************* - - Super Dead Heat hardware - -*************************************************************************/ -#ifndef MAME_TAITO_SPDHEAT_H -#define MAME_TAITO_SPDHEAT_H - -#pragma once - -#include "emupal.h" -#include "screen.h" -#include "tilemap.h" -#include "machine/input_merger.h" -#include "sound/dac.h" - - -/************************************* - * - * Machine class - * - *************************************/ - -class spdheat_state : public driver_device -{ -public: - spdheat_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "subcpu"), - m_audiocpu(*this, "audiocpu"), - m_audio_irq(*this, "audio_irq"), - m_fg_ram(*this, "fg_ram%u", 0U), - m_spriteram(*this, "spriteram"), - m_gfxdecode(*this, "gfxdecode"), - m_palette0(*this, "palette0"), - m_palette1(*this, "palette1"), - m_palette2(*this, "palette2"), - m_palette3(*this, "palette3"), - m_dac(*this, "dac") - { } - - void spdheat(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - -private: - required_device m_maincpu; - required_device m_subcpu; - required_device m_audiocpu; - required_device m_audio_irq; - required_shared_ptr_array m_fg_ram; - required_shared_ptr m_spriteram; - tilemap_t *m_fg_tilemap[4]{}; - - required_device m_gfxdecode; - required_device m_palette0; - required_device m_palette1; - required_device m_palette2; - required_device m_palette3; - required_device m_dac; - - uint32_t m_sound_data[4]{}; - uint32_t m_sound_status = 0; - uint32_t m_sub_data = 0; - uint32_t m_sub_status = 0; - - void main_map(address_map &map); - void sub_map(address_map &map); - void sub_io_map(address_map &map); - void sound_map(address_map &map); - - uint8_t sub_r(); - void sub_dac_w(uint8_t data); - void sub_nmi_w(uint8_t data); - void sub_status_w(uint8_t data); - uint8_t sub_snd_r(); - uint8_t soundstatus_r(); - uint8_t sub_status_r(); - uint16_t sound_status_r(); - template void sound_w(uint16_t data); - template uint8_t sndcpu_sound_r(); - void ym1_port_a_w(uint8_t data); - void ym1_port_b_w(uint8_t data); - void ym2_port_a_w(uint8_t data); - void ym2_port_b_w(uint8_t data); - void ym3_port_a_w(uint8_t data); - void ym3_port_b_w(uint8_t data); - void ym4_port_a_w(uint8_t data); - void ym4_port_b_w(uint8_t data); - - template void text_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - template TILE_GET_INFO_MEMBER(get_fg_tile_info); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint32_t xo, uint32_t yo); - template uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); -}; - -#endif // MAME_TAITO_SPDHEAT_H