From df6884eee7a7a35cd4c8de18b7ae63ed9d899665 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 23 Aug 2022 17:58:29 +0200 Subject: - tehkan/spbactn.cpp: added preliminary inputs and sound for the prototype. - tehkan/solomon.cpp, tehkan/spbactn.cpp, tecmo16.cpp: consolidated drivers in single files, minor cleanups --- src/mame/nintendo/popeye.cpp | 2 +- src/mame/tehkan/solomon.cpp | 253 ++++++++++++++++----- src/mame/tehkan/solomon.h | 69 ------ src/mame/tehkan/solomon_v.cpp | 105 --------- src/mame/tehkan/spbactn.cpp | 516 ++++++++++++++++++++++++++++++++++-------- src/mame/tehkan/spbactn.h | 101 --------- src/mame/tehkan/spbactn_v.cpp | 144 ------------ src/mame/tehkan/tecmo16.cpp | 433 +++++++++++++++++++++++++++++------ src/mame/tehkan/tecmo16.h | 105 --------- src/mame/tehkan/tecmo16_v.cpp | 249 -------------------- 10 files changed, 995 insertions(+), 982 deletions(-) delete mode 100644 src/mame/tehkan/solomon.h delete mode 100644 src/mame/tehkan/solomon_v.cpp delete mode 100644 src/mame/tehkan/spbactn.h delete mode 100644 src/mame/tehkan/spbactn_v.cpp delete mode 100644 src/mame/tehkan/tecmo16.h delete mode 100644 src/mame/tehkan/tecmo16_v.cpp diff --git a/src/mame/nintendo/popeye.cpp b/src/mame/nintendo/popeye.cpp index 90f2de4abd6..f5b78979447 100644 --- a/src/mame/nintendo/popeye.cpp +++ b/src/mame/nintendo/popeye.cpp @@ -538,7 +538,7 @@ void tnx1_state::config(machine_config &config) m_maincpu->refresh_cb().set(FUNC(tnx1_state::refresh_w)); /* video hardware */ - // FIXME: 59.94 screen refresch is the NTSC standard + // FIXME: 59.94 screen refresh is the NTSC standard auto &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(59.94) .set_vblank_time(ATTOSECONDS_IN_USEC(0)) diff --git a/src/mame/tehkan/solomon.cpp b/src/mame/tehkan/solomon.cpp index 270cd823c2e..5d019ca4878 100644 --- a/src/mame/tehkan/solomon.cpp +++ b/src/mame/tehkan/solomon.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Mirko Buffoni + /*************************************************************************** Solomon's Key @@ -9,15 +10,167 @@ driver by Mirko Buffoni ***************************************************************************/ #include "emu.h" -#include "solomon.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "sound/ay8910.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class solomon_state : public driver_device +{ +public: + solomon_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_spriteram(*this, "spriteram"), + m_videoram(*this, "videoram%u", 1U), + m_colorram(*this, "colorram%u", 1U), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") + { } + + void solomon(machine_config &config); + +protected: + virtual void video_start() override; + +private: + required_shared_ptr m_spriteram; + required_shared_ptr_array m_videoram; + required_shared_ptr_array m_colorram; + + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_soundlatch; + + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_fg_tilemap = nullptr; + + uint8_t m_nmi_mask = 0; + + void sh_command_w(uint8_t data); + uint8_t _0xe603_r(); + void nmi_mask_w(uint8_t data); + template void videoram_w(offs_t offset, uint8_t data); + template void colorram_w(offs_t offset, uint8_t data); + void flipscreen_w(uint8_t data); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(vblank_irq); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map); + void sound_map(address_map &map); + void sound_portmap(address_map &map); +}; + + +// video + +template +void solomon_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[Which][offset] = data; + Which ? m_bg_tilemap->mark_tile_dirty(offset) : m_fg_tilemap->mark_tile_dirty(offset); +} +template +void solomon_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[Which][offset] = data; + Which ? m_bg_tilemap->mark_tile_dirty(offset) : m_fg_tilemap->mark_tile_dirty(offset); +} + +void solomon_state::flipscreen_w(uint8_t data) +{ + if (flip_screen() != (data & 0x01)) + { + flip_screen_set(data & 0x01); + machine().tilemap().mark_all_dirty(); + } +} + +TILE_GET_INFO_MEMBER(solomon_state::get_bg_tile_info) +{ + int const attr = m_colorram[1][tile_index]; + int const code = m_videoram[1][tile_index] + 256 * (attr & 0x07); + int const color = ((attr & 0x70) >> 4); + int const flags = ((attr & 0x80) ? TILE_FLIPX : 0) | ((attr & 0x08) ? TILE_FLIPY : 0); + + tileinfo.set(1, code, color, flags); +} -void solomon_state::solomon_sh_command_w(uint8_t data) +TILE_GET_INFO_MEMBER(solomon_state::get_fg_tile_info) +{ + int const attr = m_colorram[0][tile_index]; + int const code = m_videoram[0][tile_index] + 256 * (attr & 0x07); + int const color = (attr & 0x70) >> 4; + + tileinfo.set(0, code, color, 0); +} + +void solomon_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(solomon_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, + 8, 8, 32, 32); + + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(solomon_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, + 8, 8, 32, 32); + + m_fg_tilemap->set_transparent_pen(0); +} + +void solomon_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) + { + int const code = m_spriteram[offs] + 16 * (m_spriteram[offs + 1] & 0x10); + int const color = (m_spriteram[offs + 1] & 0x0e) >> 1; + int flipx = m_spriteram[offs + 1] & 0x40; + int flipy = m_spriteram[offs + 1] & 0x80; + int sx = m_spriteram[offs + 3]; + int sy = 241 - m_spriteram[offs + 2]; + + if (flip_screen()) + { + sx = 240 - sx; + sy = 242 - sy; + flipx = !flipx; + flipy = !flipy; + } + + + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + code, color, + flipx, flipy, + sx, sy, 0); + } +} + +uint32_t solomon_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + return 0; +} + + +// machine + +void solomon_state::sh_command_w(uint8_t data) { m_soundlatch->write(data); m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); @@ -27,7 +180,7 @@ void solomon_state::solomon_sh_command_w(uint8_t data) it could be a form of protection. the real board needs to be analysed to find out what really lives here */ -uint8_t solomon_state::solomon_0xe603_r() +uint8_t solomon_state::_0xe603_r() { if (m_maincpu->pc() == 0x161) // all the time .. return 0 to act as before for coin / startup etc. { @@ -39,7 +192,7 @@ uint8_t solomon_state::solomon_0xe603_r() } else { - osd_printf_debug("unhandled solomon_0xe603_r %04x\n", m_maincpu->pc()); + osd_printf_debug("unhandled _0xe603_r %04x\n", m_maincpu->pc()); return 0; } } @@ -53,22 +206,22 @@ void solomon_state::main_map(address_map &map) { map(0x0000, 0xbfff).rom(); map(0xc000, 0xcfff).ram(); - map(0xd000, 0xd3ff).ram().w(FUNC(solomon_state::solomon_colorram_w)).share("colorram"); - map(0xd400, 0xd7ff).ram().w(FUNC(solomon_state::solomon_videoram_w)).share("videoram"); - map(0xd800, 0xdbff).ram().w(FUNC(solomon_state::solomon_colorram2_w)).share("colorram2"); - map(0xdc00, 0xdfff).ram().w(FUNC(solomon_state::solomon_videoram2_w)).share("videoram2"); - map(0xe000, 0xe07f).ram().share("spriteram"); + map(0xd000, 0xd3ff).ram().w(FUNC(solomon_state::colorram_w<0>)).share(m_colorram[0]); + map(0xd400, 0xd7ff).ram().w(FUNC(solomon_state::videoram_w<0>)).share(m_videoram[0]); + map(0xd800, 0xdbff).ram().w(FUNC(solomon_state::colorram_w<1>)).share(m_colorram[1]); + map(0xdc00, 0xdfff).ram().w(FUNC(solomon_state::videoram_w<1>)).share(m_videoram[1]); + map(0xe000, 0xe07f).ram().share(m_spriteram); map(0xe400, 0xe5ff).ram().w(m_palette, FUNC(palette_device::write8)).share("palette"); map(0xe600, 0xe600).portr("P1"); map(0xe601, 0xe601).portr("P2"); map(0xe602, 0xe602).portr("SYSTEM"); - map(0xe603, 0xe603).r(FUNC(solomon_state::solomon_0xe603_r)); + map(0xe603, 0xe603).r(FUNC(solomon_state::_0xe603_r)); map(0xe604, 0xe604).portr("DSW1"); map(0xe605, 0xe605).portr("DSW2"); - map(0xe606, 0xe606).nopr(); /* watchdog? */ + map(0xe606, 0xe606).nopr(); // watchdog? map(0xe600, 0xe600).w(FUNC(solomon_state::nmi_mask_w)); - map(0xe604, 0xe604).w(FUNC(solomon_state::solomon_flipscreen_w)); - map(0xe800, 0xe800).w(FUNC(solomon_state::solomon_sh_command_w)); + map(0xe604, 0xe604).w(FUNC(solomon_state::flipscreen_w)); + map(0xe800, 0xe800).w(FUNC(solomon_state::sh_command_w)); map(0xf000, 0xffff).rom(); } @@ -77,7 +230,7 @@ void solomon_state::sound_map(address_map &map) map(0x0000, 0x3fff).rom(); map(0x4000, 0x47ff).ram(); map(0x8000, 0x8000).r(m_soundlatch, FUNC(generic_latch_8_device::read)); - map(0xffff, 0xffff).nopw(); /* watchdog? */ + map(0xffff, 0xffff).nopw(); // watchdog? } void solomon_state::sound_portmap(address_map &map) @@ -171,34 +324,23 @@ INPUT_PORTS_END -static const gfx_layout charlayout = -{ - 8,8, /* 8*8 characters */ - 2048, /* 2048 characters */ - 4, /* 4 bits per pixel */ - { 0, 1, 2, 3 }, /* the bitplanes are packed in one nibble */ - { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, - { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, - 32*8 /* every char takes 32 consecutive bytes */ -}; - static const gfx_layout spritelayout = { - 16,16, /* 8*8 sprites */ - 512, /* 512 sprites */ - 4, /* 4 bits per pixel */ - { 0, 512*32*8, 2*512*32*8, 3*512*32*8 }, /* the bitplanes are separated */ - { 0, 1, 2, 3, 4, 5, 6, 7, /* pretty straightforward layout */ + 16,16, // 8*8 sprites + 512, // 512 sprites + 4, // 4 bits per pixel + { 0, 512*32*8, 2*512*32*8, 3*512*32*8 }, // the bitplanes are separated + { 0, 1, 2, 3, 4, 5, 6, 7, // pretty straightforward layout 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 }, - 32*8 /* every sprite takes 32 consecutive bytes */ + 32*8 // every sprite takes 32 consecutive bytes }; static GFXDECODE_START( gfx_solomon ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 8 ) /* colors 0-127 */ - GFXDECODE_ENTRY( "gfx2", 0, charlayout, 128, 8 ) /* colors 128-255 */ - GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 0, 8 ) /* colors 0-127 */ + GFXDECODE_ENTRY( "fgtiles", 0, gfx_8x8x4_packed_msb, 0, 8 ) // colors 0-127 + GFXDECODE_ENTRY( "bgtiles", 0, gfx_8x8x4_packed_msb, 128, 8 ) // colors 128-255 + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 8 ) // colors 0-127 GFXDECODE_END INTERRUPT_GEN_MEMBER(solomon_state::vblank_irq) @@ -211,37 +353,37 @@ INTERRUPT_GEN_MEMBER(solomon_state::vblank_irq) void solomon_state::solomon(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 4000000); /* 4.0 MHz (?????) */ + // basic machine hardware + Z80(config, m_maincpu, 4'000'000); // 4.0 MHz (?????) m_maincpu->set_addrmap(AS_PROGRAM, &solomon_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(solomon_state::vblank_irq)); - Z80(config, m_audiocpu, 3072000); + Z80(config, m_audiocpu, 3'072'000); m_audiocpu->set_addrmap(AS_PROGRAM, &solomon_state::sound_map); m_audiocpu->set_addrmap(AS_IO, &solomon_state::sound_portmap); - m_audiocpu->set_periodic_int(FUNC(solomon_state::irq0_line_hold), attotime::from_hz(2*60)); /* ??? */ - /* NMIs are caused by the main CPU */ + m_audiocpu->set_periodic_int(FUNC(solomon_state::irq0_line_hold), attotime::from_hz(2*60)); // ??? + // NMIs are caused by the main CPU - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(32*8, 32*8); screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(solomon_state::screen_update_solomon)); + screen.set_screen_update(FUNC(solomon_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_solomon); PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 256); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); - AY8910(config, "ay1", 1500000).add_route(ALL_OUTPUTS, "mono", 0.12); - AY8910(config, "ay2", 1500000).add_route(ALL_OUTPUTS, "mono", 0.12); - AY8910(config, "ay3", 1500000).add_route(ALL_OUTPUTS, "mono", 0.12); + AY8910(config, "ay1", 1'500'000).add_route(ALL_OUTPUTS, "mono", 0.12); + AY8910(config, "ay2", 1'500'000).add_route(ALL_OUTPUTS, "mono", 0.12); + AY8910(config, "ay3", 1'500'000).add_route(ALL_OUTPUTS, "mono", 0.12); } /*************************************************************************** @@ -261,16 +403,16 @@ ROM_START( solomon ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "1.3jk", 0x0000, 0x4000, CRC(fa6e562e) SHA1(713036c0a80b623086aa674bb5f8a135b6fedb01) ) - ROM_REGION( 0x10000, "gfx1", 0 ) - ROM_LOAD( "12.3t", 0x00000, 0x08000, CRC(b371291c) SHA1(27302898c64330870c47025e61bd5acbd9483865) ) /* characters */ + ROM_REGION( 0x10000, "fgtiles", 0 ) + ROM_LOAD( "12.3t", 0x00000, 0x08000, CRC(b371291c) SHA1(27302898c64330870c47025e61bd5acbd9483865) ) ROM_LOAD( "11.3r", 0x08000, 0x08000, CRC(6f94d2af) SHA1(2e070c0fd5b9d7eb9b7e0d53f25b1a5063ef3095) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "10.3p", 0x00000, 0x08000, CRC(8310c2a1) SHA1(8cc87ab8faacdb1973791d207bb25ea9b444b66d) ) ROM_LOAD( "9.3m", 0x08000, 0x08000, CRC(ab7e6c42) SHA1(0fc3b4a0bd2b17b79e2d1f7d4fe445c09ce4e730) ) - ROM_REGION( 0x10000, "gfx3", 0 ) - ROM_LOAD( "2.5lm", 0x00000, 0x04000, CRC(80fa2be3) SHA1(8e7a78186473a6b5c42577ac9e4591ee2d1151f2) ) /* sprites */ + ROM_REGION( 0x10000, "sprites", 0 ) + ROM_LOAD( "2.5lm", 0x00000, 0x04000, CRC(80fa2be3) SHA1(8e7a78186473a6b5c42577ac9e4591ee2d1151f2) ) ROM_LOAD( "3.6lm", 0x04000, 0x04000, CRC(236106b4) SHA1(8eaf3150568c407bd8dc1cdf874b8417e5cca3d2) ) ROM_LOAD( "4.7lm", 0x08000, 0x04000, CRC(088fe5d9) SHA1(e29ffb9fcff50ce982d5e502e10a8e29a4c47390) ) ROM_LOAD( "5.8lm", 0x0c000, 0x04000, CRC(8366232a) SHA1(1c7a01dab056ec7d787a6f55772b9fa6fe67305a) ) @@ -287,21 +429,22 @@ ROM_START( solomonj ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "slmn_01.bin", 0x0000, 0x4000, CRC(fa6e562e) SHA1(713036c0a80b623086aa674bb5f8a135b6fedb01) ) - ROM_REGION( 0x10000, "gfx1", 0 ) - ROM_LOAD( "slmn_12.bin", 0x00000, 0x08000, CRC(aa26dfcb) SHA1(71748eaceeca878ae9f871e30d5951ca4dde37d6) ) /* characters */ + ROM_REGION( 0x10000, "fgtiles", 0 ) + ROM_LOAD( "slmn_12.bin", 0x00000, 0x08000, CRC(aa26dfcb) SHA1(71748eaceeca878ae9f871e30d5951ca4dde37d6) ) ROM_LOAD( "slmn_11.bin", 0x08000, 0x08000, CRC(6f94d2af) SHA1(2e070c0fd5b9d7eb9b7e0d53f25b1a5063ef3095) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "slmn_10.bin", 0x00000, 0x08000, CRC(8310c2a1) SHA1(8cc87ab8faacdb1973791d207bb25ea9b444b66d) ) ROM_LOAD( "slmn_09.bin", 0x08000, 0x08000, CRC(ab7e6c42) SHA1(0fc3b4a0bd2b17b79e2d1f7d4fe445c09ce4e730) ) - ROM_REGION( 0x10000, "gfx3", 0 ) - ROM_LOAD( "slmn_02.bin", 0x00000, 0x04000, CRC(80fa2be3) SHA1(8e7a78186473a6b5c42577ac9e4591ee2d1151f2) ) /* sprites */ + ROM_REGION( 0x10000, "sprites", 0 ) + ROM_LOAD( "slmn_02.bin", 0x00000, 0x04000, CRC(80fa2be3) SHA1(8e7a78186473a6b5c42577ac9e4591ee2d1151f2) ) ROM_LOAD( "slmn_03.bin", 0x04000, 0x04000, CRC(236106b4) SHA1(8eaf3150568c407bd8dc1cdf874b8417e5cca3d2) ) ROM_LOAD( "slmn_04.bin", 0x08000, 0x04000, CRC(088fe5d9) SHA1(e29ffb9fcff50ce982d5e502e10a8e29a4c47390) ) ROM_LOAD( "slmn_05.bin", 0x0c000, 0x04000, CRC(8366232a) SHA1(1c7a01dab056ec7d787a6f55772b9fa6fe67305a) ) ROM_END +} // anonymous namespace GAME( 1986, solomon, 0, solomon, solomon, solomon_state, empty_init, ROT0, "Tecmo", "Solomon's Key (US)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/tehkan/solomon.h b/src/mame/tehkan/solomon.h deleted file mode 100644 index 6d44900d18a..00000000000 --- a/src/mame/tehkan/solomon.h +++ /dev/null @@ -1,69 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mirko Buffoni -#ifndef MAME_INCLUDES_SOLOMON_H -#define MAME_INCLUDES_SOLOMON_H - -#pragma once - -#include "machine/gen_latch.h" -#include "emupal.h" -#include "tilemap.h" - -class solomon_state : public driver_device -{ -public: - solomon_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_spriteram(*this, "spriteram"), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_videoram2(*this, "videoram2"), - m_colorram2(*this, "colorram2"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") - { } - - void solomon(machine_config &config); - -protected: - virtual void video_start() override; - -private: - required_shared_ptr m_spriteram; - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_shared_ptr m_videoram2; - required_shared_ptr m_colorram2; - - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - - uint8_t m_nmi_mask = 0; - void solomon_sh_command_w(uint8_t data); - uint8_t solomon_0xe603_r(); - void nmi_mask_w(uint8_t data); - void solomon_videoram_w(offs_t offset, uint8_t data); - void solomon_colorram_w(offs_t offset, uint8_t data); - void solomon_videoram2_w(offs_t offset, uint8_t data); - void solomon_colorram2_w(offs_t offset, uint8_t data); - void solomon_flipscreen_w(uint8_t data); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - uint32_t screen_update_solomon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vblank_irq); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_soundlatch; - - void main_map(address_map &map); - void sound_map(address_map &map); - void sound_portmap(address_map &map); -}; - -#endif // MAME_INCLUDES_SOLOMON_H diff --git a/src/mame/tehkan/solomon_v.cpp b/src/mame/tehkan/solomon_v.cpp deleted file mode 100644 index 0d64c4fa493..00000000000 --- a/src/mame/tehkan/solomon_v.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mirko Buffoni -#include "emu.h" -#include "solomon.h" - -void solomon_state::solomon_videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset); -} - -void solomon_state::solomon_colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset); -} - -void solomon_state::solomon_videoram2_w(offs_t offset, uint8_t data) -{ - m_videoram2[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void solomon_state::solomon_colorram2_w(offs_t offset, uint8_t data) -{ - m_colorram2[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void solomon_state::solomon_flipscreen_w(uint8_t data) -{ - if (flip_screen() != (data & 0x01)) - { - flip_screen_set(data & 0x01); - machine().tilemap().mark_all_dirty(); - } -} - -TILE_GET_INFO_MEMBER(solomon_state::get_bg_tile_info) -{ - int attr = m_colorram2[tile_index]; - int code = m_videoram2[tile_index] + 256 * (attr & 0x07); - int color = ((attr & 0x70) >> 4); - int flags = ((attr & 0x80) ? TILE_FLIPX : 0) | ((attr & 0x08) ? TILE_FLIPY : 0); - - tileinfo.set(1, code, color, flags); -} - -TILE_GET_INFO_MEMBER(solomon_state::get_fg_tile_info) -{ - int attr = m_colorram[tile_index]; - int code = m_videoram[tile_index] + 256 * (attr & 0x07); - int color = (attr & 0x70) >> 4; - - tileinfo.set(0, code, color, 0); -} - -void solomon_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(solomon_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, - 8, 8, 32, 32); - - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(solomon_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, - 8, 8, 32, 32); - - m_fg_tilemap->set_transparent_pen(0); -} - -void solomon_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - uint8_t *spriteram = m_spriteram; - int offs; - - for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) - { - int code = spriteram[offs] + 16 * (spriteram[offs + 1] & 0x10); - int color = (spriteram[offs + 1] & 0x0e) >> 1; - int flipx = spriteram[offs + 1] & 0x40; - int flipy = spriteram[offs + 1] & 0x80; - int sx = spriteram[offs + 3]; - int sy = 241 - spriteram[offs + 2]; - - if (flip_screen()) - { - sx = 240 - sx; - sy = 242 - sy; - flipx = !flipx; - flipy = !flipy; - } - - - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code, color, - flipx, flipy, - sx, sy, 0); - } -} - -uint32_t solomon_state::screen_update_solomon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - return 0; -} diff --git a/src/mame/tehkan/spbactn.cpp b/src/mame/tehkan/spbactn.cpp index d56cc62e0c6..3ba4b899004 100644 --- a/src/mame/tehkan/spbactn.cpp +++ b/src/mame/tehkan/spbactn.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause // copyright-holders:David Haywood + /******************************************************************************* Super Pinball Action (c) 1991 Tecmo ******************************************************************************** @@ -10,7 +11,7 @@ A Pinball Game from Tecmo, the Hardware seems to be somewhere between that used for Tecmo's classic game Ninja Gaiden (see gaiden.cpp) and that used in Comad's - Gals Pinball (see galspnbl.cpp) I imagine Comad took the hardware that this uses + Gals Pinball (see galspnbl.cpp). I imagine Comad took the hardware that this uses as a basis for writing their game on, adding a couple of features such as the pixel layer. @@ -85,8 +86,8 @@ The manual defines the controls as 4 push buttons: TODO : (also check the notes from the galspnbl.cpp driver) - coin insertion is not recognized consistently. - - convert to tilemaps - all the unknown regs + - Oki fills the log with 'Requested to play sample 0X on non-stopped voice' Unmapped writes (P.O.S.T.) @@ -132,27 +133,278 @@ cpu #0 (PC=00001A1A): unmapped memory word write to 00090030 = 00F7 & 00FF *******************************************************************************/ #include "emu.h" -#include "spbactn.h" + +#include "tecmo_spr.h" +#include "tecmo_mix.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "sound/okim6295.h" #include "sound/ymopl.h" + +#include "emupal.h" +#include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +// configurable logging +#define LOG_PROTO (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_PROTO) + +#include "logmacro.h" + +#define LOGPROTO(...) LOGMASKED(LOG_PROTO, __VA_ARGS__) + + +namespace { + +class spbactn_state : public driver_device +{ +public: + spbactn_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_sprgen(*this, "spritegen"), + m_mixer(*this, "mixer"), + m_soundlatch(*this, "soundlatch"), + m_bgvideoram(*this, "bgvideoram"), + m_fgvideoram(*this, "fgvideoram"), + m_spvideoram(*this, "spvideoram") + { } + + void spbactn(machine_config &config); + +protected: + virtual void video_start() override; + + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_device m_sprgen; + required_device m_mixer; + required_device m_soundlatch; + + required_shared_ptr m_bgvideoram; + required_shared_ptr m_fgvideoram; + required_shared_ptr m_spvideoram; + + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_fg_tilemap = nullptr; + + void main_irq_ack_w(uint16_t data); + + void bg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void fg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + + int draw_video(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, bool alt_sprites); + + void sound_map(address_map &map); + +private: + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + + bitmap_ind16 m_tile_bitmap_bg; + bitmap_ind16 m_tile_bitmap_fg; + bitmap_ind16 m_sprite_bitmap; + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map); +}; + +class spbactnp_state : public spbactn_state +{ +public: + spbactnp_state(const machine_config &mconfig, device_type type, const char *tag) : + spbactn_state(mconfig, type, tag), + m_extraram(*this, "extraram%u", 1U) + { } + + void spbactnp(machine_config &config); + +protected: + virtual void video_start() override; + +private: + required_shared_ptr_array m_extraram; + + tilemap_t *m_extra_tilemap = nullptr; + + void extraram_w(offs_t offset, uint8_t data, uint8_t mem_mask = ~0); + TILE_GET_INFO_MEMBER(get_extra_tile_info); + + void _9000a_w(uint16_t data); + void _9000c_w(uint16_t data); + void _9000e_w(uint16_t data); + + void _90124_w(uint16_t data); + void _9012c_w(uint16_t data); + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void extra_map(address_map &map); + void main_map(address_map &map); +}; + + +// video + +void spbactn_state::bg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_bgvideoram[offset]); + m_bg_tilemap->mark_tile_dirty(offset & 0x1fff); +} + +TILE_GET_INFO_MEMBER(spbactn_state::get_bg_tile_info) +{ + int const attr = m_bgvideoram[tile_index]; + int const tileno = m_bgvideoram[tile_index + 0x2000]; + tileinfo.set(1, tileno, ((attr & 0x00f0) >> 4), 0); +} + + +void spbactn_state::fg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_fgvideoram[offset]); + m_fg_tilemap->mark_tile_dirty(offset & 0x1fff); +} + +TILE_GET_INFO_MEMBER(spbactn_state::get_fg_tile_info) +{ + int const attr = m_fgvideoram[tile_index]; + int const tileno = m_fgvideoram[tile_index + 0x2000]; + + int color = ((attr & 0x00f0) >> 4); + + // blending + if (attr & 0x0008) + color += 0x0010; + + tileinfo.set(0, tileno, color, 0); +} + + + +void spbactn_state::video_start() +{ + // allocate bitmaps + m_screen->register_screen_bitmap(m_tile_bitmap_bg); + m_screen->register_screen_bitmap(m_tile_bitmap_fg); + m_screen->register_screen_bitmap(m_sprite_bitmap); + + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(spbactn_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 8, 64, 128); + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(spbactn_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 16, 8, 64, 128); + m_bg_tilemap->set_transparent_pen(0); + m_fg_tilemap->set_transparent_pen(0); +} + +void spbactnp_state::video_start() +{ + spbactn_state::video_start(); + // no idea.. + m_extra_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(spbactnp_state::get_extra_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 16, 16); +} + +void spbactnp_state::_9000c_w(uint16_t data) +{ + LOGPROTO("_9000c_w %04x\n", data); +} + +void spbactnp_state::_9000e_w(uint16_t data) +{ + LOGPROTO("_9000e_w %04x\n", data); +} + +void spbactnp_state::_9000a_w(uint16_t data) +{ + LOGPROTO("_9000a_w %04x\n", data); +} + +void spbactnp_state::_90124_w(uint16_t data) +{ + LOGPROTO("_90124_w %04x\n", data); + m_bg_tilemap->set_scrolly(0, data); + +} + +void spbactnp_state::_9012c_w(uint16_t data) +{ + LOGPROTO("_9012c_w %04x\n", data); + m_bg_tilemap->set_scrollx(0, data); +} + + +void spbactnp_state::extraram_w(offs_t offset, uint8_t data, uint8_t mem_mask) +{ + COMBINE_DATA(&m_extraram[0][offset]); + m_extra_tilemap->mark_tile_dirty(offset / 2); +} + +TILE_GET_INFO_MEMBER(spbactnp_state::get_extra_tile_info) +{ + int tileno = m_extraram[0][(tile_index * 2) + 1]; + tileno |= m_extraram[0][(tile_index * 2)] << 8; + tileinfo.set(3, tileno, 0, 0); +} + + + + +int spbactn_state::draw_video(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, bool alt_sprites) +{ + m_tile_bitmap_bg.fill(0, cliprect); + m_tile_bitmap_fg.fill(0, cliprect); + m_sprite_bitmap.fill(0, cliprect); + bitmap.fill(0, cliprect); + + m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode->gfx(2), cliprect, &m_spvideoram[0], 0, 0, flip_screen(), m_sprite_bitmap); + m_bg_tilemap->draw(screen, m_tile_bitmap_bg, cliprect, 0, 0); + m_fg_tilemap->draw(screen, m_tile_bitmap_fg, cliprect, 0, 0); + m_mixer->mix_bitmaps(screen, bitmap, cliprect, *m_palette, &m_tile_bitmap_bg, &m_tile_bitmap_fg, (bitmap_ind16*)nullptr, &m_sprite_bitmap); + + return 0; +} + +uint32_t spbactn_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return draw_video(screen, bitmap, cliprect, false); +} + +uint32_t spbactnp_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + // hack to make the extra CPU do something.. + m_extraram[1][0x104] = machine().rand(); + m_extraram[1][0x105] = machine().rand(); + + return draw_video(screen, bitmap, cliprect, true); +} + + +// machine void spbactn_state::main_irq_ack_w(uint16_t data) { m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE); } -void spbactn_state::spbactn_map(address_map &map) +void spbactn_state::main_map(address_map &map) { map(0x00000, 0x3ffff).rom(); - map(0x40000, 0x43fff).ram(); // main ram - map(0x50000, 0x50fff).ram().share("spvideoram"); - map(0x60000, 0x67fff).ram().w(FUNC(spbactn_state::fg_videoram_w)).share("fgvideoram"); - map(0x70000, 0x77fff).ram().w(FUNC(spbactn_state::bg_videoram_w)).share("bgvideoram"); + map(0x40000, 0x43fff).ram(); // main RAM + map(0x50000, 0x50fff).ram().share(m_spvideoram); + map(0x60000, 0x67fff).ram().w(FUNC(spbactn_state::fg_videoram_w)).share(m_fgvideoram); + map(0x70000, 0x77fff).ram().w(FUNC(spbactn_state::bg_videoram_w)).share(m_bgvideoram); map(0x80000, 0x827ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x90000, 0x90001).portr("IN0"); map(0x90010, 0x90011).portr("IN1"); @@ -160,7 +412,7 @@ void spbactn_state::spbactn_map(address_map &map) map(0x90030, 0x90031).portr("DSW1"); map(0x90040, 0x90041).portr("DSW2"); - /* this are an awful lot of unknowns */ + // these are an awful lot of unknowns map(0x90000, 0x90001).nopw(); map(0x90011, 0x90011).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0x90020, 0x90021).w(FUNC(spbactn_state::main_irq_ack_w)); @@ -196,46 +448,47 @@ void spbactn_state::spbactn_map(address_map &map) -void spbactn_state::spbactnp_map(address_map &map) +void spbactnp_state::main_map(address_map &map) { map(0x00000, 0x3ffff).rom(); - map(0x40000, 0x43fff).ram(); // main ram - map(0x50000, 0x50fff).ram().share("spvideoram"); - map(0x60000, 0x67fff).ram().w(FUNC(spbactn_state::fg_videoram_w)).share("fgvideoram"); - map(0x70000, 0x77fff).ram().w(FUNC(spbactn_state::bg_videoram_w)).share("bgvideoram"); + map(0x40000, 0x43fff).ram(); // main RAM + map(0x50000, 0x50fff).ram().share(m_spvideoram); + map(0x60000, 0x67fff).ram().w(FUNC(spbactnp_state::fg_videoram_w)).share(m_fgvideoram); + map(0x70000, 0x77fff).ram().w(FUNC(spbactnp_state::bg_videoram_w)).share(m_bgvideoram); map(0x80000, 0x827ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // yes R and G are swapped vs. the released version - map(0x90002, 0x90003).w(FUNC(spbactn_state::main_irq_ack_w)); - map(0x90006, 0x90007).w(FUNC(spbactn_state::spbatnp_90006_w)); - map(0x9000a, 0x9000b).w(FUNC(spbactn_state::spbatnp_9000a_w)); - map(0x9000c, 0x9000d).w(FUNC(spbactn_state::spbatnp_9000c_w)); - map(0x9000e, 0x9000f).w(FUNC(spbactn_state::spbatnp_9000e_w)); - - map(0x90124, 0x90125).w(FUNC(spbactn_state::spbatnp_90124_w)); // bg scroll - map(0x9012c, 0x9012d).w(FUNC(spbactn_state::spbatnp_9012c_w)); // bg scroll - - map(0x90000, 0x900ff).r(FUNC(spbactn_state::temp_read_handler_r)); // temp + map(0x90000, 0x90001).portr("IN0"); + map(0x90002, 0x90003).portr("IN1").w(FUNC(spbactnp_state::main_irq_ack_w)); + map(0x90006, 0x90007).portr("DSW"); + map(0x90007, 0x90007).w(m_soundlatch, FUNC(generic_latch_8_device::write)); + map(0x9000a, 0x9000b).w(FUNC(spbactnp_state::_9000a_w)); + map(0x9000c, 0x9000d).w(FUNC(spbactnp_state::_9000c_w)); + map(0x9000e, 0x9000f).w(FUNC(spbactnp_state::_9000e_w)); + + map(0x90124, 0x90125).w(FUNC(spbactnp_state::_90124_w)); // bg scroll + map(0x9012c, 0x9012d).w(FUNC(spbactnp_state::_9012c_w)); // bg scroll } -void spbactn_state::spbactn_sound_map(address_map &map) +void spbactn_state::sound_map(address_map &map) { map(0x0000, 0xefff).rom(); map(0xf000, 0xf7ff).ram(); map(0xf800, 0xf800).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); map(0xf810, 0xf811).w("ymsnd", FUNC(ym3812_device::write)); - map(0xfc00, 0xfc00).nopr().nopw(); /* irq ack ?? */ + map(0xfc00, 0xfc00).nopr().nopw(); // IRQ ack ?? map(0xfc20, 0xfc20).r(m_soundlatch, FUNC(generic_latch_8_device::read)); } -void spbactn_state::spbactnp_extra_map(address_map &map) +void spbactnp_state::extra_map(address_map &map) { + map(0x0000, 0xffff).noprw(); map(0x0000, 0xbfff).rom(); - map(0xc000, 0xc7ff).ram().share("extraram2"); + map(0xc000, 0xc7ff).ram().share(m_extraram[1]); map(0xe000, 0xefff).ram(); - map(0xd000, 0xd1ff).ram().w(FUNC(spbactn_state::extraram_w)).share("extraram"); + map(0xd000, 0xd1ff).ram().w(FUNC(spbactnp_state::extraram_w)).share(m_extraram[0]); map(0xd200, 0xd200).ram(); } @@ -265,7 +518,7 @@ static INPUT_PORTS_START( spbactn ) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME( "Start" ) /* needed to avoid confusion with # of players. Press mulitple times for multiple players */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME( "Start" ) // needed to avoid confusion with # of players. Press multiple times for multiple players PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -311,10 +564,10 @@ static INPUT_PORTS_START( spbactn ) PORT_DIPNAME( 0x10, 0x10, "Hit Difficulty" ) PORT_DIPLOCATION("SW2:5") // From .xls file - WHAT does that mean ? PORT_DIPSETTING( 0x10, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x00, DEF_STR( Difficult ) ) - PORT_DIPNAME( 0x20, 0x20, "Display Instructions" ) PORT_DIPLOCATION("SW2:6") /* Listed in manual as "Change Software", but seems to have no effect? */ + PORT_DIPNAME( 0x20, 0x20, "Display Instructions" ) PORT_DIPLOCATION("SW2:6") // Listed in manual as "Change Software", but seems to have no effect? PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7") /* As listed in manual, but seems to have no effect? */ + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7") // As listed in manual, but seems to have no effect? Works on the prototype, though PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x40, DEF_STR( On ) ) PORT_DIPNAME( 0x80, 0x80, "Match" ) PORT_DIPLOCATION("SW2:8") // Check code at 0x00bf8c @@ -322,6 +575,92 @@ static INPUT_PORTS_START( spbactn ) PORT_DIPSETTING( 0x00, "1/40" ) INPUT_PORTS_END +static INPUT_PORTS_START( spbactnp ) + PORT_START("IN0") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME( "Right Flippers" ) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Left Flippers" ) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME( "Start" ) // needed to avoid confusion with # of players. Press multiple times for multiple players + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN1") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME( "Launch Ball / Shake" ) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("DSW") // TODO: double check these + PORT_DIPNAME( 0x0003, 0x0003, "Balls" ) PORT_DIPLOCATION("SW1:8,7") + PORT_DIPSETTING( 0x0000, "2" ) + PORT_DIPSETTING( 0x0003, "3" ) + PORT_DIPSETTING( 0x0001, "4" ) + PORT_DIPSETTING( 0x0002, "5" ) + PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:6,5,4") + PORT_DIPSETTING( 0x0008, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x000c, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x0004, "2 Coins/1 Credit 3/2" ) + PORT_DIPSETTING( 0x001c, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x0014, "1 Coin/1 Credit 2/3" ) + PORT_DIPSETTING( 0x0018, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x0000, "1 Coin/1 Credit 5/6" ) + PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:3,2,1") + PORT_DIPSETTING( 0x0040, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x0060, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0080, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x0020, "2 Coins/1 Credit 3/2" ) + PORT_DIPSETTING( 0x00e0, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x00a0, "1 Coin/1 Credit 2/3" ) + PORT_DIPSETTING( 0x00c0, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x0000, "1 Coin/1 Credit 5/6" ) + PORT_DIPNAME( 0x0100, 0x0100, "Match" ) PORT_DIPLOCATION("SW2:8") + PORT_DIPSETTING( 0x0100, "1/20" ) + PORT_DIPSETTING( 0x0000, "1/40" ) + PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7") + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0200, DEF_STR( On ) ) + PORT_DIPNAME( 0x0400, 0x0400, "Display Instructions" ) PORT_DIPLOCATION("SW2:6") + PORT_DIPSETTING( 0x0000, DEF_STR( No ) ) + PORT_DIPSETTING( 0x0400, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x0800, 0x0800, "Hit Difficulty" ) PORT_DIPLOCATION("SW2:5") + PORT_DIPSETTING( 0x0800, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( Difficult ) ) + PORT_DIPNAME( 0x3000, 0x3000, "Extra Ball" ) PORT_DIPLOCATION("SW2:4,3") + PORT_DIPSETTING( 0x1000, "100k and 500k" ) + PORT_DIPSETTING( 0x3000, "200k and 800k" ) + PORT_DIPSETTING( 0x2000, "200k" ) + PORT_DIPSETTING( 0x0000, DEF_STR( None ) ) + PORT_DIPNAME( 0xc000, 0xc000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2,1") + PORT_DIPSETTING( 0x8000, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0xc000, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x4000, DEF_STR( Hard ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( Very_Hard ) ) +INPUT_PORTS_END + + static const gfx_layout fgtilelayout = { 16,8, @@ -362,9 +701,9 @@ static const gfx_layout spritelayout = }; static GFXDECODE_START( gfx_spbactn ) - GFXDECODE_ENTRY( "gfx1", 0, fgtilelayout, 0x0200, 16 + 240 ) - GFXDECODE_ENTRY( "gfx2", 0, bgtilelayout, 0x0300, 16 + 128 ) - GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 0x0000, 0x100 ) + GFXDECODE_ENTRY( "fgtiles", 0, fgtilelayout, 0x0200, 16 + 240 ) + GFXDECODE_ENTRY( "bgtiles", 0, bgtilelayout, 0x0300, 16 + 128 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0x0000, 0x100 ) GFXDECODE_END @@ -382,35 +721,33 @@ static const gfx_layout proto_fgtilelayout = static GFXDECODE_START( gfx_spbactnp ) - GFXDECODE_ENTRY( "gfx1", 0, proto_fgtilelayout, 0x0200, 16 + 240 ) - GFXDECODE_ENTRY( "gfx2", 0, proto_fgtilelayout, 0x0300, 16 + 128 ) // wrong - GFXDECODE_ENTRY( "gfx3", 0, gfx_8x8x4_packed_msb, 0x0000, 16 + 384 ) + GFXDECODE_ENTRY( "fgtiles", 0, proto_fgtilelayout, 0x0200, 16 + 240 ) + GFXDECODE_ENTRY( "bgtiles", 0, proto_fgtilelayout, 0x0300, 16 + 128 ) // wrong + GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_packed_msb, 0x0000, 16 + 384 ) - GFXDECODE_ENTRY( "gfx4", 0, gfx_8x8x4_packed_msb, 0x0000, 16 + 384 ) // more sprites maybe? + GFXDECODE_ENTRY( "unkgfx", 0, gfx_8x8x4_packed_msb, 0x0000, 16 + 384 ) // more sprites maybe? GFXDECODE_END void spbactn_state::spbactn(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware M68000(config, m_maincpu, XTAL(12'000'000)); - m_maincpu->set_addrmap(AS_PROGRAM, &spbactn_state::spbactn_map); + m_maincpu->set_addrmap(AS_PROGRAM, &spbactn_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(spbactn_state::irq3_line_assert)); Z80(config, m_audiocpu, XTAL(4'000'000)); - m_audiocpu->set_addrmap(AS_PROGRAM, &spbactn_state::spbactn_sound_map); + m_audiocpu->set_addrmap(AS_PROGRAM, &spbactn_state::sound_map); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); // TODO: verify actual blanking frequencies (should be close to NTSC) m_screen->set_raw(XTAL(22'656'000) / 2, 720, 0, 512, 262, 16, 240); - m_screen->set_screen_update(FUNC(spbactn_state::screen_update_spbactn)); - - MCFG_VIDEO_START_OVERRIDE(spbactn_state,spbactn) + m_screen->set_screen_update(FUNC(spbactn_state::screen_update)); GFXDECODE(config, m_gfxdecode, m_palette, gfx_spbactn); - PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x2800/2); + PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x2800 / 2); TECMO_SPRITE(config, m_sprgen, 0); @@ -421,49 +758,47 @@ void spbactn_state::spbactn(machine_config &config) m_mixer->set_blendsource( 0x1000 + 0x000, 0x1000 + 0x100); m_mixer->set_bgpen(0x800 + 0x300, 0x000 + 0x300); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); - ym3812_device &ymsnd(YM3812(config, "ymsnd", XTAL(4'000'000))); /* Was 3.579545MHz, a common clock, but no way to generate via on PCB OSCs */ + ym3812_device &ymsnd(YM3812(config, "ymsnd", XTAL(4'000'000))); // Was 3.579545MHz, a common clock, but no way to generate via on PCB OSCs ymsnd.irq_handler().set_inputline("audiocpu", 0); ymsnd.add_route(ALL_OUTPUTS, "mono", 1.0); - /* Was 1.056MHz, a common clock, but no way to generate via on PCB OSCs. clock frequency & pin 7 not verified */ + // Was 1.056MHz, a common clock, but no way to generate via on PCB OSCs. Clock frequency & pin 7 not verified okim6295_device &oki(OKIM6295(config, "oki", XTAL(4'000'000) / 4, okim6295_device::PIN7_HIGH)); oki.add_route(ALL_OUTPUTS, "mono", 0.50); } -void spbactn_state::spbactnp(machine_config &config) +void spbactnp_state::spbactnp(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware M68000(config, m_maincpu, XTAL(12'000'000)); - m_maincpu->set_addrmap(AS_PROGRAM, &spbactn_state::spbactnp_map); - m_maincpu->set_vblank_int("screen", FUNC(spbactn_state::irq3_line_assert)); + m_maincpu->set_addrmap(AS_PROGRAM, &spbactnp_state::main_map); + m_maincpu->set_vblank_int("screen", FUNC(spbactnp_state::irq3_line_assert)); Z80(config, m_audiocpu, XTAL(4'000'000)); - m_audiocpu->set_addrmap(AS_PROGRAM, &spbactn_state::spbactn_sound_map); + m_audiocpu->set_addrmap(AS_PROGRAM, &spbactnp_state::sound_map); - // yes another cpu.. + // yes another CPU.. z80_device &extracpu(Z80(config, "extracpu", XTAL(4'000'000))); - extracpu.set_addrmap(AS_PROGRAM, &spbactn_state::spbactnp_extra_map); - extracpu.set_vblank_int("screen", FUNC(spbactn_state::irq0_line_hold)); -// extracpu.set_vblank_int("screen", FUNC(spbactn_state::nmi_line_pulse)); + extracpu.set_addrmap(AS_PROGRAM, &spbactnp_state::extra_map); + extracpu.set_vblank_int("screen", FUNC(spbactnp_state::irq0_line_hold)); +// extracpu.set_vblank_int("screen", FUNC(spbactnp_state::nmi_line_pulse)); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); m_screen->set_size(64*8, 32*8); m_screen->set_visarea(0*8, 64*8-1, 2*8, 30*8-1); - m_screen->set_screen_update(FUNC(spbactn_state::screen_update_spbactnp)); - - MCFG_VIDEO_START_OVERRIDE(spbactn_state,spbactnp) + m_screen->set_screen_update(FUNC(spbactnp_state::screen_update)); GFXDECODE(config, m_gfxdecode, m_palette, gfx_spbactnp); - PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 0x2800/2); + PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 0x2800 / 2); TECMO_SPRITE(config, m_sprgen, 0); @@ -474,7 +809,7 @@ void spbactn_state::spbactnp(machine_config &config) m_mixer->set_blendsource( 0x1000 + 0x000, 0x1000 + 0x100); m_mixer->set_bgpen(0x800 + 0x300, 0x000 + 0x300); - /* sound hardware - different? */ + // sound hardware - different? SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); @@ -484,13 +819,13 @@ void spbactn_state::spbactnp(machine_config &config) ymsnd.irq_handler().set_inputline(m_audiocpu, 0); ymsnd.add_route(ALL_OUTPUTS, "mono", 1.0); - okim6295_device &oki(OKIM6295(config, "oki", XTAL(4'000'000)/4, okim6295_device::PIN7_HIGH)); + okim6295_device &oki(OKIM6295(config, "oki", XTAL(4'000'000) / 4, okim6295_device::PIN7_HIGH)); oki.add_route(ALL_OUTPUTS, "mono", 0.50); } ROM_START( spbactn ) - /* Board 9002-A (CPU Board) */ + // Board 9002-A (CPU Board) ROM_REGION( 0x40000, "maincpu", 0 ) ROM_LOAD16_BYTE( "rom1.bin", 0x00000, 0x20000, CRC(6741bd3f) SHA1(844eb6465a15d339043fd6d2b6ba20ba216de493) ) ROM_LOAD16_BYTE( "rom2.bin", 0x00001, 0x20000, CRC(488cc511) SHA1(41b4a01f35e0e93634b4843dbb894ab9840807bf) ) @@ -501,22 +836,22 @@ ROM_START( spbactn ) ROM_REGION( 0x40000, "oki", 0 ) ROM_LOAD( "a-u19", 0x00000, 0x20000, CRC(87427d7d) SHA1(f76b0dc3f0d87deb0f0c81084aff9756b236e867) ) - /* Board 9002-B (GFX Board) */ - ROM_REGION( 0x080000, "gfx1", 0 ) /* 16x8 FG Tiles */ + // Board 9002-B (GFX Board) + ROM_REGION( 0x080000, "fgtiles", 0 ) // 16x8 ROM_LOAD( "b-u98", 0x00000, 0x40000, CRC(315eab4d) SHA1(6f812c85981dc649caca8b4635e3b8fd3a3c054d) ) ROM_LOAD( "b-u99", 0x40000, 0x40000, CRC(7b76efd9) SHA1(9f23460aebe12cb5c4193776bf876d6044892979) ) - ROM_REGION( 0x080000, "gfx2", 0 ) /* 16x8 BG Tiles */ + ROM_REGION( 0x080000, "bgtiles", 0 ) // 16x8 ROM_LOAD( "b-u104", 0x00000, 0x40000, CRC(b648a40a) SHA1(1fb756dcd027a5702596e33bbe8a0beeb3ceb22b) ) ROM_LOAD( "b-u105", 0x40000, 0x40000, CRC(0172d79a) SHA1(7ee1faa65c85860bd81988329df516bc34940ef5) ) - ROM_REGION( 0x080000, "gfx3", 0 ) /* 8x8 Sprite Tiles */ + ROM_REGION( 0x080000, "sprites", 0 ) // 8x8 ROM_LOAD( "b-u110", 0x00000, 0x40000, CRC(862ebacd) SHA1(05732e8524c50256c1db29317625d0edc19b87d2) ) ROM_LOAD( "b-u111", 0x40000, 0x40000, CRC(1cc1379a) SHA1(44fdab8cb5ab1488688f1ac52f005454e835efee) ) ROM_END ROM_START( spbactnj ) - /* Board 9002-A (CPU Board) */ + // Board 9002-A (CPU Board) ROM_REGION( 0x40000, "maincpu", 0 ) ROM_LOAD16_BYTE( "a-u68.1", 0x00000, 0x20000, CRC(b5b2d824) SHA1(be04ca370a381d7396f39e31fb2680973193daee) ) ROM_LOAD16_BYTE( "a-u67.2", 0x00001, 0x20000, CRC(9577b48b) SHA1(291d890a9d0e434455f183eb12ae6edf3156688d) ) @@ -527,16 +862,16 @@ ROM_START( spbactnj ) ROM_REGION( 0x40000, "oki", 0 ) ROM_LOAD( "a-u19", 0x00000, 0x20000, CRC(87427d7d) SHA1(f76b0dc3f0d87deb0f0c81084aff9756b236e867) ) - /* Board 9002-B (GFX Board) */ - ROM_REGION( 0x080000, "gfx1", 0 ) /* 16x8 FG Tiles */ + // Board 9002-B (GFX Board) + ROM_REGION( 0x080000, "fgtiles", 0 ) // 16x8 ROM_LOAD( "b-u98", 0x00000, 0x40000, CRC(315eab4d) SHA1(6f812c85981dc649caca8b4635e3b8fd3a3c054d) ) ROM_LOAD( "b-u99", 0x40000, 0x40000, CRC(7b76efd9) SHA1(9f23460aebe12cb5c4193776bf876d6044892979) ) - ROM_REGION( 0x080000, "gfx2", 0 ) /* 16x8 BG Tiles */ + ROM_REGION( 0x080000, "bgtiles", 0 ) // 16x8 ROM_LOAD( "b-u104", 0x00000, 0x40000, CRC(b648a40a) SHA1(1fb756dcd027a5702596e33bbe8a0beeb3ceb22b) ) ROM_LOAD( "b-u105", 0x40000, 0x40000, CRC(0172d79a) SHA1(7ee1faa65c85860bd81988329df516bc34940ef5) ) - ROM_REGION( 0x080000, "gfx3", 0 ) /* 8x8 Sprite Tiles */ + ROM_REGION( 0x080000, "sprites", 0 ) // 8x8 ROM_LOAD( "b-u110", 0x00000, 0x40000, CRC(862ebacd) SHA1(05732e8524c50256c1db29317625d0edc19b87d2) ) ROM_LOAD( "b-u111", 0x40000, 0x40000, CRC(1cc1379a) SHA1(44fdab8cb5ab1488688f1ac52f005454e835efee) ) ROM_END @@ -556,32 +891,35 @@ ROM_START( spbactnp ) ROM_REGION( 0x40000, "oki", 0 ) ROM_LOAD( "spa_data_2-21-a10.8e", 0x00000, 0x20000, CRC(87427d7d) SHA1(f76b0dc3f0d87deb0f0c81084aff9756b236e867) ) // same as regular - ROM_REGION( 0x080000, "gfx1", 0 ) /* 16x8 FG Tiles */ + ROM_REGION( 0x080000, "fgtiles", 0 ) // 16x8 ROM_LOAD16_BYTE( "spa_back0_split0_5-17-p-1.27b", 0x00000, 0x20000, CRC(37922110) SHA1(8edb6745ab6b6937f1365d35bfcdbe86198de668) ) ROM_LOAD16_BYTE( "spa_back0_split1_5-17-p-1.27c", 0x00001, 0x20000, CRC(9d6ef9ab) SHA1(338ff1bd9d30a61d782616cccb4108daac6a8612) ) - ROM_REGION( 0x080000, "gfx2", 0 ) /* 16x8 BG Tiles */ // it only ever draws the background from the rocket level, for all levels?? + ROM_REGION( 0x080000, "bgtiles", 0 ) // 16x8. It only ever draws the background from the rocket level, for all levels?? ROM_LOAD16_BYTE( "spa_back1_split0_3-14-a-11.26b", 0x00000, 0x20000, CRC(6953fd62) SHA1(fb6061f5ad48e0d91d3dad96afbac2d64908f0a7) ) ROM_LOAD16_BYTE( "spa_back1_split1_3-14-a-11.26c", 0x00001, 0x20000, CRC(b4123511) SHA1(c65b912238bab74bf46b5d5486c1d998813ef511) ) - ROM_REGION( 0x040000, "gfx3", 0 ) /* 8x8 Sprite Tiles */ + ROM_REGION( 0x040000, "sprites", 0 ) // 8x8 ROM_LOAD( "spa_sp0_4-18-p-8.5m", 0x00000, 0x20000, CRC(cd6ba360) SHA1(a01f65a678b6987ae877c381f74515efee4b492e) ) ROM_LOAD( "spa_sp1_3-14-a-10.4m", 0x20000, 0x20000, CRC(86406336) SHA1(bf091dc13404535e6baee990f5e957d3538841ac) ) - /* does this have an extra (horizontal) screen maybe, with the girls being displayed on that instead of the main one.. */ - ROM_REGION( 0x10000, "extracpu", 0 ) // what? it's another z80 rom... unused for now + // does this have an extra (horizontal) screen maybe, with the girls being displayed on that instead of the main one.. + ROM_REGION( 0x10000, "extracpu", 0 ) // what? it's another z80 ROM... ROM_LOAD( "6204_6-6.29c", 0x00000, 0x10000, CRC(e8250c26) SHA1(9b669878790c8e3c5d80f165b5ffa1d6830f4696) ) - ROM_REGION( 0x080000, "gfx4", 0 ) /* 8x8 BG Tiles */ // more 8x8 tiles, with the girl graphics? unused for now .. for horizontal orientation?? + ROM_REGION( 0x080000, "unkgfx", 0 ) // more 8x8 tiles, with the girl graphics? unused for now .. for horizontal orientation?? ROM_LOAD( "spa.25c", 0x00000, 0x20000, CRC(02b69ab9) SHA1(368e774693a6fab756faaeec4ffd42406816e6e2) ) - ROM_REGION( 0x10000, "misc", 0 ) //misc - ROM_LOAD( "p109.18d", 0x00000, 0x100, CRC(2297a725) SHA1(211ebae11ca55cc67df29291c3e0916836550bfb) ) // mostly empty.. is this correct? - ROM_LOAD( "pin.b.sub.23g", 0x00000, 0x100, CRC(3a0c70ed) SHA1(9be38c421e9a14f6811752a4464dd5dbf037e385) ) // mostly empty.. is this correct? - ROM_LOAD( "tcm1.19g.bin", 0x00000, 0x53, CRC(2c54354a) SHA1(11d8b6cdaf052b5a9fbcf6b6fbf99c5f89575cfa) ) + ROM_REGION( 0x253, "misc", 0 ) //misc + ROM_LOAD( "p109.18d", 0x000, 0x100, CRC(2297a725) SHA1(211ebae11ca55cc67df29291c3e0916836550bfb) ) // mostly empty.. is this correct? + ROM_LOAD( "pin.b.sub.23g", 0x000, 0x100, CRC(3a0c70ed) SHA1(9be38c421e9a14f6811752a4464dd5dbf037e385) ) // mostly empty.. is this correct? + ROM_LOAD( "tcm1.19g.bin", 0x000, 0x053, CRC(2c54354a) SHA1(11d8b6cdaf052b5a9fbcf6b6fbf99c5f89575cfa) ) ROM_END -GAME( 1991, spbactn, 0, spbactn, spbactn, spbactn_state, empty_init, ROT90, "Tecmo", "Super Pinball Action (US)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1991, spbactnj, spbactn, spbactn, spbactn, spbactn_state, empty_init, ROT90, "Tecmo", "Super Pinball Action (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1989, spbactnp, spbactn, spbactnp, spbactn, spbactn_state, empty_init, ROT90, "Tecmo", "Super Pinball Action (prototype)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // early proto, (c) date is 2 years earlier! +} // anonymous namespace + + +GAME( 1991, spbactn, 0, spbactn, spbactn, spbactn_state, empty_init, ROT90, "Tecmo", "Super Pinball Action (US)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1991, spbactnj, spbactn, spbactn, spbactn, spbactn_state, empty_init, ROT90, "Tecmo", "Super Pinball Action (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1989, spbactnp, spbactn, spbactnp, spbactnp, spbactnp_state, empty_init, ROT90, "Tecmo", "Super Pinball Action (prototype)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // early proto, (c) date is 2 years earlier! diff --git a/src/mame/tehkan/spbactn.h b/src/mame/tehkan/spbactn.h deleted file mode 100644 index c0b93caf9d7..00000000000 --- a/src/mame/tehkan/spbactn.h +++ /dev/null @@ -1,101 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood -#ifndef MAME_INCLUDES_SPBACTN_H -#define MAME_INCLUDES_SPBACTN_H - -#pragma once - -#include "machine/gen_latch.h" -#include "tecmo_spr.h" -#include "tecmo_mix.h" -#include "emupal.h" -#include "screen.h" -#include "tilemap.h" - -class spbactn_state : public driver_device -{ -public: - spbactn_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_sprgen(*this, "spritegen"), - m_mixer(*this, "mixer"), - m_soundlatch(*this, "soundlatch"), - m_bgvideoram(*this, "bgvideoram"), - m_fgvideoram(*this, "fgvideoram"), - m_spvideoram(*this, "spvideoram"), - m_extraram(*this, "extraram"), - m_extraram2(*this, "extraram2") - { } - - void spbactn(machine_config &config); - void spbactnp(machine_config &config); - -private: - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_device m_sprgen; - required_device m_mixer; - required_device m_soundlatch; - - required_shared_ptr m_bgvideoram; - required_shared_ptr m_fgvideoram; - required_shared_ptr m_spvideoram; - optional_shared_ptr m_extraram; - optional_shared_ptr m_extraram2; - - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - - tilemap_t *m_extra_tilemap = nullptr; - - void main_irq_ack_w(uint16_t data); - - void bg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void fg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - - void extraram_w(offs_t offset, uint8_t data, uint8_t mem_mask = ~0); - TILE_GET_INFO_MEMBER(get_extra_tile_info); - - bitmap_ind16 m_tile_bitmap_bg; - bitmap_ind16 m_tile_bitmap_fg; - bitmap_ind16 m_sprite_bitmap; - - void spbatnp_90006_w(uint16_t data); - void spbatnp_9000a_w(uint16_t data); - void spbatnp_9000c_w(uint16_t data); - void spbatnp_9000e_w(uint16_t data); - - void spbatnp_90124_w(uint16_t data); - void spbatnp_9012c_w(uint16_t data); - - DECLARE_VIDEO_START(spbactn); - DECLARE_VIDEO_START(spbactnp); - - //virtual void video_start(); - uint32_t screen_update_spbactn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t screen_update_spbactnp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - int draw_video(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, bool alt_sprites); - - // temp hack - uint16_t temp_read_handler_r() - { - return 0xffff; - } - - void spbactn_map(address_map &map); - void spbactn_sound_map(address_map &map); - void spbactnp_extra_map(address_map &map); - void spbactnp_map(address_map &map); -}; - -#endif // MAME_INCLUDES_SPBACTN_H diff --git a/src/mame/tehkan/spbactn_v.cpp b/src/mame/tehkan/spbactn_v.cpp deleted file mode 100644 index 93e45f5e8b4..00000000000 --- a/src/mame/tehkan/spbactn_v.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:David Haywood - -#include "emu.h" -#include "spbactn.h" - - - -void spbactn_state::bg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_bgvideoram[offset]); - m_bg_tilemap->mark_tile_dirty(offset&0x1fff); -} - -TILE_GET_INFO_MEMBER(spbactn_state::get_bg_tile_info) -{ - int attr = m_bgvideoram[tile_index]; - int tileno = m_bgvideoram[tile_index+0x2000]; - tileinfo.set(1, tileno, ((attr & 0x00f0)>>4), 0); -} - - -void spbactn_state::fg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_fgvideoram[offset]); - m_fg_tilemap->mark_tile_dirty(offset&0x1fff); -} - -TILE_GET_INFO_MEMBER(spbactn_state::get_fg_tile_info) -{ - int attr = m_fgvideoram[tile_index]; - int tileno = m_fgvideoram[tile_index+0x2000]; - - int color = ((attr & 0x00f0)>>4); - - /* blending */ - if (attr & 0x0008) - color += 0x0010; - - tileinfo.set(0, tileno, color, 0); -} - - - -VIDEO_START_MEMBER(spbactn_state,spbactn) -{ - /* allocate bitmaps */ - m_screen->register_screen_bitmap(m_tile_bitmap_bg); - m_screen->register_screen_bitmap(m_tile_bitmap_fg); - m_screen->register_screen_bitmap(m_sprite_bitmap); - - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(spbactn_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 8, 64, 128); - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(spbactn_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 16, 8, 64, 128); - m_bg_tilemap->set_transparent_pen(0); - m_fg_tilemap->set_transparent_pen(0); -} - -VIDEO_START_MEMBER(spbactn_state,spbactnp) -{ - VIDEO_START_CALL_MEMBER(spbactn); - // no idea.. - m_extra_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(spbactn_state::get_extra_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 16, 16); -} - -void spbactn_state::spbatnp_90006_w(uint16_t data) -{ - //printf("spbatnp_90006_w %04x\n",data); -} - - -void spbactn_state::spbatnp_9000c_w(uint16_t data) -{ - //printf("spbatnp_9000c_w %04x\n",data); -} - -void spbactn_state::spbatnp_9000e_w(uint16_t data) -{ - //printf("spbatnp_9000e_w %04x\n",data); -} - -void spbactn_state::spbatnp_9000a_w(uint16_t data) -{ - //printf("spbatnp_9000a_w %04x\n",data); -} - -void spbactn_state::spbatnp_90124_w(uint16_t data) -{ - //printf("spbatnp_90124_w %04x\n",data); - m_bg_tilemap->set_scrolly(0, data); - -} - -void spbactn_state::spbatnp_9012c_w(uint16_t data) -{ - //printf("spbatnp_9012c_w %04x\n",data); - m_bg_tilemap->set_scrollx(0, data); -} - - -void spbactn_state::extraram_w(offs_t offset, uint8_t data, uint8_t mem_mask) -{ - COMBINE_DATA(&m_extraram[offset]); - m_extra_tilemap->mark_tile_dirty(offset/2); -} - -TILE_GET_INFO_MEMBER(spbactn_state::get_extra_tile_info) -{ - int tileno = m_extraram[(tile_index*2)+1]; - tileno |= m_extraram[(tile_index*2)] << 8; - tileinfo.set(3, tileno, 0, 0); -} - - - - -int spbactn_state::draw_video(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, bool alt_sprites) -{ - m_tile_bitmap_bg.fill(0, cliprect); - m_tile_bitmap_fg.fill(0, cliprect); - m_sprite_bitmap.fill(0, cliprect); - bitmap.fill(0, cliprect); - - m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode->gfx(2), cliprect, &m_spvideoram[0], 0, 0, flip_screen(), m_sprite_bitmap); - m_bg_tilemap->draw(screen, m_tile_bitmap_bg, cliprect, 0, 0); - m_fg_tilemap->draw(screen, m_tile_bitmap_fg, cliprect, 0, 0); - - m_mixer->mix_bitmaps(screen, bitmap, cliprect, *m_palette, &m_tile_bitmap_bg, &m_tile_bitmap_fg, (bitmap_ind16*)nullptr, &m_sprite_bitmap); - - return 0; -} - -uint32_t spbactn_state::screen_update_spbactn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - return draw_video(screen,bitmap,cliprect,false); -} - -uint32_t spbactn_state::screen_update_spbactnp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - // hack to make the extra cpu do something.. - m_extraram2[0x104] = machine().rand(); - m_extraram2[0x105] = machine().rand(); - - return draw_video(screen,bitmap,cliprect,true); -} diff --git a/src/mame/tehkan/tecmo16.cpp b/src/mame/tehkan/tecmo16.cpp index 7f9535579b9..e2859d96aeb 100644 --- a/src/mame/tehkan/tecmo16.cpp +++ b/src/mame/tehkan/tecmo16.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Hau, Nicola Salmoria + /****************************************************************************** Ganbare Ginkun (Japan) (c)1995 TECMO @@ -27,32 +28,334 @@ TODO: Notes: - To enter into service mode in Final Star Force press and hold start buttons 1 and 2 during P.O.S.T. -- The games seem to be romswaps. At least you can swap Riot roms on the pcb +- The games seem to be romswaps. At least you can swap Riot ROMs on the PCB with Final Star Force and it'll work without problems. ******************************************************************************/ #include "emu.h" -#include "tecmo16.h" + +#include "tecmo_spr.h" +#include "tecmo_mix.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "machine/gen_latch.h" #include "sound/okim6295.h" #include "sound/ymopm.h" +#include "video/bufsprite.h" + +#include "emupal.h" +#include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class tecmo16_state : public driver_device +{ +public: + tecmo16_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_sprgen(*this, "spritegen"), + m_mixer(*this, "mixer"), + m_videoram(*this, "videoram%u", 1U), + m_colorram(*this, "colorram%u", 1U), + m_charram(*this, "charram"), + m_spriteram(*this, "spriteram") + { } + + void base(machine_config &config); + void ginkun(machine_config &config); + void riot(machine_config &config); + +protected: + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_device m_sprgen; + required_device m_mixer; + + required_shared_ptr_array m_videoram; + required_shared_ptr_array m_colorram; + required_shared_ptr m_charram; + required_device m_spriteram; + + tilemap_t *m_fg_tilemap = nullptr; + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_tx_tilemap = nullptr; + bitmap_ind16 m_sprite_bitmap; + bitmap_ind16 m_tile_bitmap_bg; + bitmap_ind16 m_tile_bitmap_fg; + bitmap_ind16 m_tile_bitmap_tx; + uint8_t m_game_is_riot = 0; + uint16_t m_scroll_x[2]{}; + uint16_t m_scroll_y[2]{}; + uint16_t m_scroll_char_x = 0; + uint16_t m_scroll_char_y = 0; + + template void videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + template void colorram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void charram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void flipscreen_w(uint16_t data); + template void scroll_x_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + template void scroll_y_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void scroll_char_x_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void scroll_char_y_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + + void irq_150021_w(uint16_t data); + void irq_150031_w(offs_t offset, uint16_t data, uint16_t mem_mask); + + TILE_GET_INFO_MEMBER(fg_get_tile_info); + TILE_GET_INFO_MEMBER(bg_get_tile_info); + TILE_GET_INFO_MEMBER(tx_get_tile_info); + + DECLARE_VIDEO_START(ginkun); + DECLARE_VIDEO_START(riot); + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + DECLARE_WRITE_LINE_MEMBER(screen_vblank); + + void save_state(); + void common_map(address_map& map); + void fstarfrc_map(address_map &map); + void ginkun_map(address_map &map); + void sound_map(address_map &map); +}; + + +// video + +// Based on sprite drivers from tehkan/wc90.cpp by Ernesto Corvi (ernesto@imagina.com) + + +void tecmo16_state::save_state() +{ + save_item(NAME(m_scroll_x)); + save_item(NAME(m_scroll_y)); + save_item(NAME(m_scroll_char_x)); + save_item(NAME(m_scroll_char_y)); +} + +TILE_GET_INFO_MEMBER(tecmo16_state::fg_get_tile_info) +{ + int const tile = m_videoram[0][tile_index] & 0x1fff; + int const color = m_colorram[0][tile_index] & 0x1f; + + // bit 4 controls blending + //tileinfo.category = (m_colorram[0][tile_index] & 0x10) >> 4; + + tileinfo.set(1, + tile, + color, + 0); +} + +TILE_GET_INFO_MEMBER(tecmo16_state::bg_get_tile_info) +{ + int const tile = m_videoram[1][tile_index] & 0x1fff; + int const color = (m_colorram[1][tile_index] & 0x0f); + + tileinfo.set(1, + tile, + color, + 0); +} + +TILE_GET_INFO_MEMBER(tecmo16_state::tx_get_tile_info) +{ + int const tile = m_charram[tile_index]; + tileinfo.set(0, + tile & 0x0fff, + tile >> 12, + 0); +} + +/******************************************************************************/ + +void tecmo16_state::video_start() +{ + // set up tile layers + m_screen->register_screen_bitmap(m_tile_bitmap_bg); + m_screen->register_screen_bitmap(m_tile_bitmap_fg); + m_screen->register_screen_bitmap(m_tile_bitmap_tx); + + // set up sprites + m_screen->register_screen_bitmap(m_sprite_bitmap); + + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::fg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 32,32); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::bg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 32,32); + m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::tx_get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64,32); + + m_fg_tilemap->set_transparent_pen(0); + m_bg_tilemap->set_transparent_pen(0); + m_tx_tilemap->set_transparent_pen(0); + + m_tx_tilemap->set_scrolly(0,-16); + m_game_is_riot = 0; + + save_state(); +} + +VIDEO_START_MEMBER(tecmo16_state, ginkun) +{ + // set up tile layers + m_screen->register_screen_bitmap(m_tile_bitmap_bg); + m_screen->register_screen_bitmap(m_tile_bitmap_fg); + m_screen->register_screen_bitmap(m_tile_bitmap_tx); + + // set up sprites + m_screen->register_screen_bitmap(m_sprite_bitmap); + + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::fg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 64,32); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::bg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 64,32); + m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::tx_get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64,32); + + m_fg_tilemap->set_transparent_pen(0); + m_bg_tilemap->set_transparent_pen(0); + m_tx_tilemap->set_transparent_pen(0); + m_game_is_riot = 0; + + save_state(); +} + +VIDEO_START_MEMBER(tecmo16_state, riot) +{ + // set up tile layers + m_screen->register_screen_bitmap(m_tile_bitmap_bg); + m_screen->register_screen_bitmap(m_tile_bitmap_fg); + m_screen->register_screen_bitmap(m_tile_bitmap_tx); + + // set up sprites + m_screen->register_screen_bitmap(m_sprite_bitmap); + + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::fg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 64,32); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::bg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 64,32); + m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::tx_get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64,32); + + m_fg_tilemap->set_transparent_pen(0); + m_bg_tilemap->set_transparent_pen(0); + m_tx_tilemap->set_transparent_pen(0); + m_tx_tilemap->set_scrolldy(-16,-16); + m_game_is_riot = 1; + + save_state(); +} + +/******************************************************************************/ + +template +void tecmo16_state::videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_videoram[Which][offset]); + Which ? m_bg_tilemap->mark_tile_dirty(offset) : m_fg_tilemap->mark_tile_dirty(offset); +} + +template +void tecmo16_state::colorram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_colorram[Which][offset]); + Which ? m_bg_tilemap->mark_tile_dirty(offset) : m_fg_tilemap->mark_tile_dirty(offset); +} + +void tecmo16_state::charram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_charram[offset]); + m_tx_tilemap->mark_tile_dirty(offset); +} + +void tecmo16_state::flipscreen_w(uint16_t data) +{ + flip_screen_set(data & 0x01); +} + +/******************************************************************************/ + +template +void tecmo16_state::scroll_x_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_scroll_x[Which]); + Which ? m_bg_tilemap->set_scrollx(0, m_scroll_x[1]) : m_fg_tilemap->set_scrollx(0, m_scroll_x[0]); +} + +template +void tecmo16_state::scroll_y_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_scroll_y[Which]); + Which ? m_bg_tilemap->set_scrolly(0, m_scroll_y[1]) : m_fg_tilemap->set_scrolly(0, m_scroll_y[0]); +} + +void tecmo16_state::scroll_char_x_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_scroll_char_x); + m_tx_tilemap->set_scrollx(0, m_scroll_char_x); +} + +void tecmo16_state::scroll_char_y_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_scroll_char_y); + m_tx_tilemap->set_scrolly(0, m_scroll_char_y - 16); +} + +/******************************************************************************/ +/******************************************************************************/ + +uint32_t tecmo16_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + m_tile_bitmap_bg.fill(0, cliprect); + m_tile_bitmap_fg.fill(0, cliprect); + m_tile_bitmap_tx.fill(0, cliprect); + bitmap.fill(0, cliprect); + + m_bg_tilemap->draw(screen, m_tile_bitmap_bg, cliprect, 0, 0); + m_fg_tilemap->draw(screen, m_tile_bitmap_fg, cliprect, 0, 0); + m_tx_tilemap->draw(screen, m_tile_bitmap_tx, cliprect, 0, 0); + + m_mixer->mix_bitmaps(screen, bitmap, cliprect, *m_palette, &m_tile_bitmap_bg, &m_tile_bitmap_fg, &m_tile_bitmap_tx, &m_sprite_bitmap); + + return 0; +} + +WRITE_LINE_MEMBER(tecmo16_state::screen_vblank) +{ + if (state) + { + const rectangle visarea = m_screen->visible_area(); + // 2 frame sprite lags + m_sprite_bitmap.fill(0, visarea); + if (m_game_is_riot) m_sprgen->gaiden_draw_sprites(*m_screen, m_gfxdecode->gfx(2), visarea, m_spriteram->buffer(), 0, 0, flip_screen(), m_sprite_bitmap); + else m_sprgen->gaiden_draw_sprites(*m_screen, m_gfxdecode->gfx(2), visarea, m_spriteram->buffer(), 2, 0, flip_screen(), m_sprite_bitmap); + + m_spriteram->copy(); + } +} + + +// machine + /******************************************************************************/ /* (without setting D0) -move.b D0, $150031.l (start of interupt) +move.b D0, $150031.l (start of interrupt) move.b D0, $150021.l (end of interrupt in riot, straight after above in ginkun, not used in fstarfrc?) */ -void tecmo16_state::irq_150021_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void tecmo16_state::irq_150021_w(uint16_t data) { // does this disable the vblank IRQ until next frame? fstarfrc expects multiple interrupts per // frame and never writes it, while the others do. riot will start to glitch towards the end @@ -69,7 +372,7 @@ void tecmo16_state::irq_150031_w(offs_t offset, uint16_t data, uint16_t mem_mask void tecmo16_state::common_map(address_map& map) { map(0x000000, 0x07ffff).rom(); - map(0x100000, 0x103fff).ram(); /* Main RAM */ + map(0x100000, 0x103fff).ram(); // Main RAM // tilemap sizes differ between games, probably configurable // but for now we add them in different maps @@ -82,37 +385,37 @@ void tecmo16_state::common_map(address_map& map) map(0x150030, 0x150031).portr("DSW2").w(FUNC(tecmo16_state::irq_150031_w)); map(0x150040, 0x150041).portr("DSW1"); map(0x150050, 0x150051).portr("P1_P2"); -// map(0x160000, 0x160001).nopr(); /* ??? Read at every scene changes */ +// map(0x160000, 0x160001).nopr(); // ??? Read at every scene changes map(0x160000, 0x160001).w(FUNC(tecmo16_state::scroll_char_x_w)); map(0x160006, 0x160007).w(FUNC(tecmo16_state::scroll_char_y_w)); - map(0x16000c, 0x16000d).w(FUNC(tecmo16_state::scroll_x_w)); - map(0x160012, 0x160013).w(FUNC(tecmo16_state::scroll_y_w)); - map(0x160018, 0x160019).w(FUNC(tecmo16_state::scroll2_x_w)); - map(0x16001e, 0x16001f).w(FUNC(tecmo16_state::scroll2_y_w)); + map(0x16000c, 0x16000d).w(FUNC(tecmo16_state::scroll_x_w<0>)); + map(0x160012, 0x160013).w(FUNC(tecmo16_state::scroll_y_w<0>)); + map(0x160018, 0x160019).w(FUNC(tecmo16_state::scroll_x_w<1>)); + map(0x16001e, 0x16001f).w(FUNC(tecmo16_state::scroll_y_w<1>)); } void tecmo16_state::fstarfrc_map(address_map &map) { - map(0x110000, 0x110fff).ram().w(FUNC(tecmo16_state::charram_w)).share("charram"); - map(0x120000, 0x1207ff).ram().w(FUNC(tecmo16_state::videoram_w)).share("videoram"); - map(0x120800, 0x120fff).ram().w(FUNC(tecmo16_state::colorram_w)).share("colorram"); - map(0x121000, 0x1217ff).ram().w(FUNC(tecmo16_state::videoram2_w)).share("videoram2"); - map(0x121800, 0x121fff).ram().w(FUNC(tecmo16_state::colorram2_w)).share("colorram2"); - map(0x122000, 0x127fff).ram(); /* work area */ + map(0x110000, 0x110fff).ram().w(FUNC(tecmo16_state::charram_w)).share(m_charram); + map(0x120000, 0x1207ff).ram().w(FUNC(tecmo16_state::videoram_w<0>)).share(m_videoram[0]); + map(0x120800, 0x120fff).ram().w(FUNC(tecmo16_state::colorram_w<0>)).share(m_colorram[0]); + map(0x121000, 0x1217ff).ram().w(FUNC(tecmo16_state::videoram_w<1>)).share(m_videoram[1]); + map(0x121800, 0x121fff).ram().w(FUNC(tecmo16_state::colorram_w<1>)).share(m_colorram[1]); + map(0x122000, 0x127fff).ram(); // work area common_map(map); } void tecmo16_state::ginkun_map(address_map &map) { - map(0x110000, 0x110fff).ram().w(FUNC(tecmo16_state::charram_w)).share("charram"); - map(0x120000, 0x120fff).ram().w(FUNC(tecmo16_state::videoram_w)).share("videoram"); - map(0x121000, 0x121fff).ram().w(FUNC(tecmo16_state::colorram_w)).share("colorram"); - map(0x122000, 0x122fff).ram().w(FUNC(tecmo16_state::videoram2_w)).share("videoram2"); - map(0x123000, 0x123fff).ram().w(FUNC(tecmo16_state::colorram2_w)).share("colorram2"); - map(0x124000, 0x124fff).ram(); /* extra RAM for Riot */ + map(0x110000, 0x110fff).ram().w(FUNC(tecmo16_state::charram_w)).share(m_charram); + map(0x120000, 0x120fff).ram().w(FUNC(tecmo16_state::videoram_w<0>)).share(m_videoram[0]); + map(0x121000, 0x121fff).ram().w(FUNC(tecmo16_state::colorram_w<0>)).share(m_colorram[0]); + map(0x122000, 0x122fff).ram().w(FUNC(tecmo16_state::videoram_w<1>)).share(m_videoram[1]); + map(0x123000, 0x123fff).ram().w(FUNC(tecmo16_state::colorram_w<1>)).share(m_colorram[1]); + map(0x124000, 0x124fff).ram(); // extra RAM for Riot common_map(map); } @@ -120,7 +423,7 @@ void tecmo16_state::ginkun_map(address_map &map) void tecmo16_state::sound_map(address_map &map) { map(0x0000, 0xefff).rom(); - map(0xf000, 0xfbff).ram(); /* Sound RAM */ + map(0xf000, 0xfbff).ram(); // Sound RAM map(0xfc00, 0xfc00).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); map(0xfc04, 0xfc05).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); map(0xfc08, 0xfc08).r("soundlatch", FUNC(generic_latch_8_device::read)); @@ -196,7 +499,7 @@ static INPUT_PORTS_START( fstarfrc ) PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_START("EXTRA") - /* Not used */ + // Not used INPUT_PORTS_END static INPUT_PORTS_START( ginkun ) @@ -239,7 +542,7 @@ static INPUT_PORTS_START( ginkun ) PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:3") - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) /* Doesn't work? */ + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) // Doesn't work? PORT_DIPSETTING( 0x20, DEF_STR( On ) ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:2") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) @@ -267,7 +570,7 @@ static INPUT_PORTS_START( ginkun ) PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_START("EXTRA") - /* Not used */ + // Not used INPUT_PORTS_END static INPUT_PORTS_START( riot ) @@ -349,28 +652,28 @@ INPUT_PORTS_END /******************************************************************************/ static GFXDECODE_START( gfx_tecmo16 ) - GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 1*16*16, 16 ) - GFXDECODE_ENTRY( "gfx2", 0, gfx_8x8x4_row_2x2_group_packed_msb, 0, 0x100 ) - GFXDECODE_ENTRY( "gfx3", 0, gfx_8x8x4_packed_msb, 0, 0x100 ) + GFXDECODE_ENTRY( "fgtiles", 0, gfx_8x8x4_packed_msb, 1*16*16, 16 ) + GFXDECODE_ENTRY( "bgtiles", 0, gfx_8x8x4_row_2x2_group_packed_msb, 0, 0x100 ) + GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_packed_msb, 0, 0x100 ) GFXDECODE_END /******************************************************************************/ -#define MASTER_CLOCK XTAL(24'000'000) -#define OKI_CLOCK XTAL(8'000'000) - void tecmo16_state::base(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, MASTER_CLOCK/2); /* 12MHz */ + static constexpr XTAL MASTER_CLOCK = XTAL(24'000'000); + static constexpr XTAL OKI_CLOCK = XTAL(8'000'000); + + // basic machine hardware + M68000(config, m_maincpu, MASTER_CLOCK / 2); // 12 MHz m_maincpu->set_addrmap(AS_PROGRAM, &tecmo16_state::fstarfrc_map); - Z80(config, m_audiocpu, MASTER_CLOCK/6); /* 4MHz */ + Z80(config, m_audiocpu, MASTER_CLOCK / 6); // 4 MHz m_audiocpu->set_addrmap(AS_PROGRAM, &tecmo16_state::sound_map); - /* NMIs are triggered by the main CPU */ + // NMIs are triggered by the main CPU config.set_maximum_quantum(attotime::from_hz(600)); - /* video hardware */ + // video hardware BUFFERED_SPRITERAM16(config, m_spriteram); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); @@ -388,14 +691,14 @@ void tecmo16_state::base(machine_config &config) TECMO_SPRITE(config, m_sprgen, 0); TECMO_MIXER(config, m_mixer, 0); - m_mixer->set_mixer_shifts(10,9,4); + m_mixer->set_mixer_shifts(10, 9, 4); m_mixer->set_blendcols( 0x0400 + 0x300, 0x0400 + 0x200, 0x0400 + 0x100, 0x0400 + 0x000 ); m_mixer->set_regularcols( 0x0000 + 0x300, 0x0000 + 0x200, 0x0000 + 0x100, 0x0000 + 0x000 ); m_mixer->set_blendsource( 0x0800 + 0x000, 0x0800 + 0x100); // riot seems to set palettes in 0x800 + 0x200, could be more to this.. m_mixer->set_revspritetile(); m_mixer->set_bgpen(0x000 + 0x300, 0x400 + 0x300); - /* sound hardware */ + // sound hardware SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -406,7 +709,7 @@ void tecmo16_state::base(machine_config &config) ymsnd.add_route(0, "lspeaker", 0.60); ymsnd.add_route(1, "rspeaker", 0.60); - okim6295_device &oki(OKIM6295(config, "oki", OKI_CLOCK/8, okim6295_device::PIN7_HIGH)); // sample rate 1 MHz / 132 + okim6295_device &oki(OKIM6295(config, "oki", OKI_CLOCK / 8, okim6295_device::PIN7_HIGH)); // sample rate 1 MHz / 132 oki.add_route(ALL_OUTPUTS, "lspeaker", 0.40); oki.add_route(ALL_OUTPUTS, "rspeaker", 0.40); } @@ -417,15 +720,14 @@ void tecmo16_state::ginkun(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &tecmo16_state::ginkun_map); - MCFG_VIDEO_START_OVERRIDE(tecmo16_state,ginkun) + MCFG_VIDEO_START_OVERRIDE(tecmo16_state, ginkun) } void tecmo16_state::riot(machine_config &config) { ginkun(config); - /* basic machine hardware */ - MCFG_VIDEO_START_OVERRIDE(tecmo16_state,riot) + MCFG_VIDEO_START_OVERRIDE(tecmo16_state, riot) } /******************************************************************************/ @@ -438,14 +740,14 @@ ROM_START( fstarfrc ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "fstarf07.rom", 0x00000, 0x10000, CRC(e0ad5de1) SHA1(677237341e837061b6cc02200c0752964caed907) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "fgtiles", 0 ) ROM_LOAD( "fstarf03.rom", 0x00000, 0x20000, CRC(54375335) SHA1(d1af56a7c7fff877066dad3144d0b5147da28c6a) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "bgtiles", 0 ) ROM_LOAD16_BYTE( "fstarf05.rom", 0x00000, 0x80000, CRC(77a281e7) SHA1(a87a90c2c856d45785cb56185b1a7dff3404b5cb) ) ROM_LOAD16_BYTE( "fstarf04.rom", 0x00001, 0x80000, CRC(398a920d) SHA1(eecc167803f48517348d68ce70f15e87eac204bb) ) - ROM_REGION( 0x100000, "gfx3", 0 ) + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD16_BYTE( "fstarf09.rom", 0x00000, 0x80000, CRC(d51341d2) SHA1(e46c319158046d407d4387cb2d8f0b6cfd7be576) ) ROM_LOAD16_BYTE( "fstarf06.rom", 0x00001, 0x80000, CRC(07e40e87) SHA1(22867e52a8267ae8ae0ff0dba6bb846cb3e1b63d) ) @@ -461,14 +763,14 @@ ROM_START( fstarfrcj ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "fstarf07.rom", 0x00000, 0x10000, CRC(e0ad5de1) SHA1(677237341e837061b6cc02200c0752964caed907) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "fgtiles", 0 ) ROM_LOAD( "fstarf03.rom", 0x00000, 0x20000, CRC(54375335) SHA1(d1af56a7c7fff877066dad3144d0b5147da28c6a) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "bgtiles", 0 ) ROM_LOAD16_BYTE( "fstarf05.rom", 0x00000, 0x80000, CRC(77a281e7) SHA1(a87a90c2c856d45785cb56185b1a7dff3404b5cb) ) ROM_LOAD16_BYTE( "fstarf04.rom", 0x00001, 0x80000, CRC(398a920d) SHA1(eecc167803f48517348d68ce70f15e87eac204bb) ) - ROM_REGION( 0x100000, "gfx3", 0 ) + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD16_BYTE( "fstarf09.rom", 0x00000, 0x80000, CRC(d51341d2) SHA1(e46c319158046d407d4387cb2d8f0b6cfd7be576) ) ROM_LOAD16_BYTE( "fstarf06.rom", 0x00001, 0x80000, CRC(07e40e87) SHA1(22867e52a8267ae8ae0ff0dba6bb846cb3e1b63d) ) @@ -484,14 +786,14 @@ ROM_START( fstarfrcja ) // very minor differences with fstarfrcj ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "fstarf07.rom", 0x00000, 0x10000, CRC(e0ad5de1) SHA1(677237341e837061b6cc02200c0752964caed907) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "fgtiles", 0 ) ROM_LOAD( "fstarf03.rom", 0x00000, 0x20000, CRC(54375335) SHA1(d1af56a7c7fff877066dad3144d0b5147da28c6a) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "bgtiles", 0 ) ROM_LOAD16_BYTE( "fstarf05.rom", 0x00000, 0x80000, CRC(77a281e7) SHA1(a87a90c2c856d45785cb56185b1a7dff3404b5cb) ) ROM_LOAD16_BYTE( "fstarf04.rom", 0x00001, 0x80000, CRC(398a920d) SHA1(eecc167803f48517348d68ce70f15e87eac204bb) ) - ROM_REGION( 0x100000, "gfx3", 0 ) + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD16_BYTE( "fstarf09.rom", 0x00000, 0x80000, CRC(d51341d2) SHA1(e46c319158046d407d4387cb2d8f0b6cfd7be576) ) ROM_LOAD16_BYTE( "fstarf06.rom", 0x00001, 0x80000, CRC(07e40e87) SHA1(22867e52a8267ae8ae0ff0dba6bb846cb3e1b63d) ) @@ -507,14 +809,14 @@ ROM_START( fstarfrcw ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "fstarf07.rom", 0x00000, 0x10000, CRC(e0ad5de1) SHA1(677237341e837061b6cc02200c0752964caed907) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "fgtiles", 0 ) ROM_LOAD( "fstarf03.rom", 0x00000, 0x20000, CRC(54375335) SHA1(d1af56a7c7fff877066dad3144d0b5147da28c6a) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "bgtiles", 0 ) ROM_LOAD16_BYTE( "fstarf05.rom", 0x00000, 0x80000, CRC(77a281e7) SHA1(a87a90c2c856d45785cb56185b1a7dff3404b5cb) ) ROM_LOAD16_BYTE( "fstarf04.rom", 0x00001, 0x80000, CRC(398a920d) SHA1(eecc167803f48517348d68ce70f15e87eac204bb) ) - ROM_REGION( 0x100000, "gfx3", 0 ) + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD16_BYTE( "fstarf09.rom", 0x00000, 0x80000, CRC(d51341d2) SHA1(e46c319158046d407d4387cb2d8f0b6cfd7be576) ) ROM_LOAD16_BYTE( "fstarf06.rom", 0x00001, 0x80000, CRC(07e40e87) SHA1(22867e52a8267ae8ae0ff0dba6bb846cb3e1b63d) ) @@ -530,14 +832,14 @@ ROM_START( ginkun ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "ginkun07.i17", 0x00000, 0x10000, CRC(8836b1aa) SHA1(22bd5258e5971aa69eaa516d7358d87fbb65bee4) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "fgtiles", 0 ) ROM_LOAD( "ginkun03.i03", 0x00000, 0x20000, CRC(4456e0df) SHA1(1509474cfbb208502262b7039e28d37be1131a46) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "bgtiles", 0 ) ROM_LOAD16_BYTE( "ginkun05.i09", 0x00000, 0x80000, CRC(1263bd42) SHA1(bff93633d42bae5b8273465e16bdb4db81bbd6e0) ) ROM_LOAD16_BYTE( "ginkun04.i05", 0x00001, 0x80000, CRC(9e4cf611) SHA1(57242f0aac49e0569a57372e59ccc643924e9b44) ) - ROM_REGION( 0x100000, "gfx3", 0 ) + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD16_BYTE( "ginkun09.i22", 0x00000, 0x80000, CRC(233384b9) SHA1(031735b0fb2c89b0af26ba76061776767647c59c) ) ROM_LOAD16_BYTE( "ginkun06.i16", 0x00001, 0x80000, CRC(f8589184) SHA1(b933265960742cb3505eb73631ec419b7e1d1d63) ) @@ -660,14 +962,14 @@ ROM_START( riot ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "7.ic17", 0x00000, 0x10000, CRC(0a95b8f3) SHA1(cc6bdeeeb184eb4f3867eb9c961b0b82743fac9f) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "fgtiles", 0 ) ROM_LOAD( "3.ic3", 0x00000, 0x20000, CRC(f60f5c96) SHA1(56ea21f22d3cf47071bfb3555b331a676463b63e) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "bgtiles", 0 ) ROM_LOAD16_BYTE( "5.ic9", 0x00000, 0x80000, CRC(056fce78) SHA1(25234fa0282fdbefefb06e6aa5a467f9d08ed534) ) ROM_LOAD16_BYTE( "4.ic5", 0x00001, 0x80000, CRC(0894e7b4) SHA1(37a04476770942f292d836997c649a343f71e317) ) - ROM_REGION( 0x100000, "gfx3", 0 ) + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD16_BYTE( "9.ic22", 0x00000, 0x80000, CRC(0ead54f3) SHA1(4848eb158d9e2279332225e0b25f1c96a8a5a0c4) ) ROM_LOAD16_BYTE( "6.ic16", 0x00001, 0x80000, CRC(96ef61da) SHA1(c306e4d1eee19af0229a47c2f115f98c74f33d33) ) @@ -683,14 +985,14 @@ ROM_START( riotw ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "7.ic17", 0x00000, 0x10000, CRC(0a95b8f3) SHA1(cc6bdeeeb184eb4f3867eb9c961b0b82743fac9f) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "fgtiles", 0 ) ROM_LOAD( "3.ic3", 0x00000, 0x20000, CRC(f60f5c96) SHA1(56ea21f22d3cf47071bfb3555b331a676463b63e) ) - ROM_REGION( 0x100000, "gfx2", 0 ) + ROM_REGION( 0x100000, "bgtiles", 0 ) ROM_LOAD16_BYTE( "5.ic9", 0x00000, 0x80000, CRC(056fce78) SHA1(25234fa0282fdbefefb06e6aa5a467f9d08ed534) ) ROM_LOAD16_BYTE( "4.ic5", 0x00001, 0x80000, CRC(0894e7b4) SHA1(37a04476770942f292d836997c649a343f71e317) ) - ROM_REGION( 0x100000, "gfx3", 0 ) + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD16_BYTE( "9.ic22", 0x00000, 0x80000, CRC(0ead54f3) SHA1(4848eb158d9e2279332225e0b25f1c96a8a5a0c4) ) ROM_LOAD16_BYTE( "6.ic16", 0x00001, 0x80000, CRC(96ef61da) SHA1(c306e4d1eee19af0229a47c2f115f98c74f33d33) ) @@ -698,6 +1000,9 @@ ROM_START( riotw ) ROM_LOAD( "8.ic18", 0x00000, 0x20000, CRC(4b70e266) SHA1(4ed23de9223cc7359fbaff9dd500ef6daee00fb0) ) ROM_END +} // anonymous namespace + + /******************************************************************************/ GAME( 1992, fstarfrc, 0, base, fstarfrc, tecmo16_state, empty_init, ROT90, "Tecmo", "Final Star Force (US)", MACHINE_SUPPORTS_SAVE ) // Has 'Recycle it, don't trash it" and 'Winners don't use drugs' screens after first attract cycle diff --git a/src/mame/tehkan/tecmo16.h b/src/mame/tehkan/tecmo16.h deleted file mode 100644 index 630a312cbba..00000000000 --- a/src/mame/tehkan/tecmo16.h +++ /dev/null @@ -1,105 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Hau, Nicola Salmoria -#ifndef MAME_INCLUDES_TECMO16_H -#define MAME_INCLUDES_TECMO16_H - -#pragma once - -#include "video/bufsprite.h" -#include "tecmo_spr.h" -#include "tecmo_mix.h" -#include "emupal.h" -#include "screen.h" -#include "tilemap.h" - -class tecmo16_state : public driver_device -{ -public: - tecmo16_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_sprgen(*this, "spritegen"), - m_mixer(*this, "mixer"), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_videoram2(*this, "videoram2"), - m_colorram2(*this, "colorram2"), - m_charram(*this, "charram"), - m_spriteram(*this, "spriteram") - { } - - void base(machine_config &config); - void ginkun(machine_config &config); - void riot(machine_config &config); - -private: - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_device m_sprgen; - required_device m_mixer; - - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_shared_ptr m_videoram2; - required_shared_ptr m_colorram2; - required_shared_ptr m_charram; - required_device m_spriteram; - - tilemap_t *m_fg_tilemap = nullptr; - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_tx_tilemap = nullptr; - bitmap_ind16 m_sprite_bitmap; - bitmap_ind16 m_tile_bitmap_bg; - bitmap_ind16 m_tile_bitmap_fg; - bitmap_ind16 m_tile_bitmap_tx; - int m_flipscreen = 0; - int m_game_is_riot = 0; - uint16_t m_scroll_x_w = 0; - uint16_t m_scroll_y_w = 0; - uint16_t m_scroll2_x_w = 0; - uint16_t m_scroll2_y_w = 0; - uint16_t m_scroll_char_x_w = 0; - uint16_t m_scroll_char_y_w = 0; - - void videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void colorram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void videoram2_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void colorram2_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void charram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void flipscreen_w(uint16_t data); - void scroll_x_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void scroll_y_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void scroll2_x_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void scroll2_y_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void scroll_char_x_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void scroll_char_y_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - - void irq_150021_w(offs_t offset, uint16_t data, uint16_t mem_mask); - void irq_150031_w(offs_t offset, uint16_t data, uint16_t mem_mask); - - TILE_GET_INFO_MEMBER(fg_get_tile_info); - TILE_GET_INFO_MEMBER(bg_get_tile_info); - TILE_GET_INFO_MEMBER(tx_get_tile_info); - - virtual void video_start() override; - DECLARE_VIDEO_START(ginkun); - DECLARE_VIDEO_START(riot); - - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(screen_vblank); - - void save_state(); - void common_map(address_map& map); - void fstarfrc_map(address_map &map); - void ginkun_map(address_map &map); - void sound_map(address_map &map); -}; - -#endif // MAME_INCLUDES_TECMO16_H diff --git a/src/mame/tehkan/tecmo16_v.cpp b/src/mame/tehkan/tecmo16_v.cpp deleted file mode 100644 index 90a636871c3..00000000000 --- a/src/mame/tehkan/tecmo16_v.cpp +++ /dev/null @@ -1,249 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Hau, Nicola Salmoria -/****************************************************************************** - - Ganbare Ginkun (Japan) (c)1995 TECMO - Final StarForce (US) (c)1992 TECMO - Riot (Japan) (c)1992 NMK - - Based on sprite drivers from video/wc90.c by Ernesto Corvi (ernesto@imagina.com) - -******************************************************************************/ - -#include "emu.h" -#include "tecmo16.h" - - -/******************************************************************************/ - - -void tecmo16_state::save_state() -{ - save_item(NAME(m_flipscreen)); - save_item(NAME(m_scroll_x_w)); - save_item(NAME(m_scroll_y_w)); - save_item(NAME(m_scroll2_x_w)); - save_item(NAME(m_scroll2_y_w)); - save_item(NAME(m_scroll_char_x_w)); - save_item(NAME(m_scroll_char_y_w)); -} - -TILE_GET_INFO_MEMBER(tecmo16_state::fg_get_tile_info) -{ - int tile = m_videoram[tile_index] & 0x1fff; - int color = m_colorram[tile_index] & 0x1f; - - /* bit 4 controls blending */ - //tileinfo.category = (m_colorram[tile_index] & 0x10) >> 4; - - tileinfo.set(1, - tile, - color, - 0); -} - -TILE_GET_INFO_MEMBER(tecmo16_state::bg_get_tile_info) -{ - int tile = m_videoram2[tile_index] & 0x1fff; - int color = (m_colorram2[tile_index] & 0x0f); - - tileinfo.set(1, - tile, - color, - 0); -} - -TILE_GET_INFO_MEMBER(tecmo16_state::tx_get_tile_info) -{ - int tile = m_charram[tile_index]; - tileinfo.set(0, - tile & 0x0fff, - tile >> 12, - 0); -} - -/******************************************************************************/ - -void tecmo16_state::video_start() -{ - /* set up tile layers */ - m_screen->register_screen_bitmap(m_tile_bitmap_bg); - m_screen->register_screen_bitmap(m_tile_bitmap_fg); - m_screen->register_screen_bitmap(m_tile_bitmap_tx); - - /* set up sprites */ - m_screen->register_screen_bitmap(m_sprite_bitmap); - - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::fg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 32,32); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::bg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 32,32); - m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::tx_get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64,32); - - m_fg_tilemap->set_transparent_pen(0); - m_bg_tilemap->set_transparent_pen(0); - m_tx_tilemap->set_transparent_pen(0); - - m_tx_tilemap->set_scrolly(0,-16); - m_flipscreen = 0; - m_game_is_riot = 0; - - save_state(); -} - -VIDEO_START_MEMBER(tecmo16_state,ginkun) -{ - /* set up tile layers */ - m_screen->register_screen_bitmap(m_tile_bitmap_bg); - m_screen->register_screen_bitmap(m_tile_bitmap_fg); - m_screen->register_screen_bitmap(m_tile_bitmap_tx); - - /* set up sprites */ - m_screen->register_screen_bitmap(m_sprite_bitmap); - - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::fg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 64,32); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::bg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 64,32); - m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::tx_get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64,32); - - m_fg_tilemap->set_transparent_pen(0); - m_bg_tilemap->set_transparent_pen(0); - m_tx_tilemap->set_transparent_pen(0); - m_flipscreen = 0; - m_game_is_riot = 0; - - save_state(); -} - -VIDEO_START_MEMBER(tecmo16_state,riot) -{ - /* set up tile layers */ - m_screen->register_screen_bitmap(m_tile_bitmap_bg); - m_screen->register_screen_bitmap(m_tile_bitmap_fg); - m_screen->register_screen_bitmap(m_tile_bitmap_tx); - - /* set up sprites */ - m_screen->register_screen_bitmap(m_sprite_bitmap); - - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::fg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 64,32); - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::bg_get_tile_info)), TILEMAP_SCAN_ROWS, 16,16, 64,32); - m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tecmo16_state::tx_get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64,32); - - m_fg_tilemap->set_transparent_pen(0); - m_bg_tilemap->set_transparent_pen(0); - m_tx_tilemap->set_transparent_pen(0); - m_tx_tilemap->set_scrolldy(-16,-16); - m_flipscreen = 0; - m_game_is_riot = 1; - - save_state(); -} - -/******************************************************************************/ - -void tecmo16_state::videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_videoram[offset]); - m_fg_tilemap->mark_tile_dirty(offset); -} - -void tecmo16_state::colorram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_colorram[offset]); - m_fg_tilemap->mark_tile_dirty(offset); -} - -void tecmo16_state::videoram2_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_videoram2[offset]); - m_bg_tilemap->mark_tile_dirty(offset); -} - -void tecmo16_state::colorram2_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_colorram2[offset]); - m_bg_tilemap->mark_tile_dirty(offset); -} - - -void tecmo16_state::charram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_charram[offset]); - m_tx_tilemap->mark_tile_dirty(offset); -} - -void tecmo16_state::flipscreen_w(uint16_t data) -{ - m_flipscreen = data & 0x01; - flip_screen_set(m_flipscreen); -} - -/******************************************************************************/ - -void tecmo16_state::scroll_x_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_scroll_x_w); - m_fg_tilemap->set_scrollx(0,m_scroll_x_w); -} - -void tecmo16_state::scroll_y_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_scroll_y_w); - m_fg_tilemap->set_scrolly(0,m_scroll_y_w); -} - -void tecmo16_state::scroll2_x_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_scroll2_x_w); - m_bg_tilemap->set_scrollx(0,m_scroll2_x_w); -} - -void tecmo16_state::scroll2_y_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_scroll2_y_w); - m_bg_tilemap->set_scrolly(0,m_scroll2_y_w); -} - -void tecmo16_state::scroll_char_x_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_scroll_char_x_w); - m_tx_tilemap->set_scrollx(0,m_scroll_char_x_w); -} - -void tecmo16_state::scroll_char_y_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_scroll_char_y_w); - m_tx_tilemap->set_scrolly(0,m_scroll_char_y_w-16); -} - -/******************************************************************************/ - - -/******************************************************************************/ - -uint32_t tecmo16_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - m_tile_bitmap_bg.fill(0, cliprect); - m_tile_bitmap_fg.fill(0, cliprect); - m_tile_bitmap_tx.fill(0, cliprect); - bitmap.fill(0, cliprect); - - m_bg_tilemap->draw(screen, m_tile_bitmap_bg, cliprect, 0, 0); - m_fg_tilemap->draw(screen, m_tile_bitmap_fg, cliprect, 0, 0); - m_tx_tilemap->draw(screen, m_tile_bitmap_tx, cliprect, 0, 0); - - m_mixer->mix_bitmaps(screen, bitmap, cliprect, *m_palette, &m_tile_bitmap_bg, &m_tile_bitmap_fg, &m_tile_bitmap_tx, &m_sprite_bitmap); - - return 0; -} - -WRITE_LINE_MEMBER(tecmo16_state::screen_vblank) -{ - if (state) - { - const rectangle visarea = m_screen->visible_area(); - // 2 frame sprite lags - m_sprite_bitmap.fill(0, visarea); - if (m_game_is_riot) m_sprgen->gaiden_draw_sprites(*m_screen, m_gfxdecode->gfx(2), visarea, m_spriteram->buffer(), 0, 0, flip_screen(), m_sprite_bitmap); - else m_sprgen->gaiden_draw_sprites(*m_screen, m_gfxdecode->gfx(2), visarea, m_spriteram->buffer(), 2, 0, flip_screen(), m_sprite_bitmap); - - m_spriteram->copy(); - } -} -- cgit v1.2.3