From 2ed9b028b20a4207e971b9845fc82a6ba252d6d1 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Sat, 20 Aug 2022 06:44:52 +0200 Subject: tecfri/holeland.cpp, tecfri/sauro.cpp, tecfri/speedbal.cpp: consolidated drivers in single files, minor cleanups --- src/mame/misc/astrcorp.cpp | 3 +- src/mame/taito/buggychl.cpp | 4 +- src/mame/tecfri/holeland.cpp | 449 ++++++++++++++++++++++++++------- src/mame/tecfri/holeland.h | 74 ------ src/mame/tecfri/holeland_v.cpp | 202 --------------- src/mame/tecfri/sauro.cpp | 553 ++++++++++++++++++++++++++++++++--------- src/mame/tecfri/sauro.h | 99 -------- src/mame/tecfri/sauro_v.cpp | 233 ----------------- src/mame/tecfri/speedbal.cpp | 288 +++++++++++++++++---- src/mame/tecfri/speedbal.h | 69 ----- src/mame/tecfri/speedbal_v.cpp | 133 ---------- 11 files changed, 1039 insertions(+), 1068 deletions(-) delete mode 100644 src/mame/tecfri/holeland.h delete mode 100644 src/mame/tecfri/holeland_v.cpp delete mode 100644 src/mame/tecfri/sauro.h delete mode 100644 src/mame/tecfri/sauro_v.cpp delete mode 100644 src/mame/tecfri/speedbal.h delete mode 100644 src/mame/tecfri/speedbal_v.cpp diff --git a/src/mame/misc/astrcorp.cpp b/src/mame/misc/astrcorp.cpp index 149b238d158..4abadbf51f6 100644 --- a/src/mame/misc/astrcorp.cpp +++ b/src/mame/misc/astrcorp.cpp @@ -1,12 +1,11 @@ // license:BSD-3-Clause -// copyright-holders:Luca Elia, Olivier Galibert, Ivan Vangelista +// copyright-holders:Luca Elia, Olivier Galibert /************************************************************************************************************* -= Astro Corp. CGA Hardware =- driver by Luca Elia (l.elia@tin.it) decryption by Olivier Galibert - additional decryption work by Ivan Vangelista CPU: 68000 GFX: ASTRO V0x (seen with x = 1,2,5,6 or 7) diff --git a/src/mame/taito/buggychl.cpp b/src/mame/taito/buggychl.cpp index 794f2132bb5..604cef0e444 100644 --- a/src/mame/taito/buggychl.cpp +++ b/src/mame/taito/buggychl.cpp @@ -226,8 +226,6 @@ void buggychl_state::video_start() save_item(NAME(m_tmp_bitmap[0])); save_item(NAME(m_tmp_bitmap[1])); - - m_gfxdecode->gfx(0)->set_source(m_charram); } void buggychl_state::chargen_w(offs_t offset, uint8_t data) @@ -786,7 +784,7 @@ static const gfx_layout spritelayout = }; static GFXDECODE_START( gfx_buggychl ) - GFXDECODE_ENTRY( nullptr, 0, charlayout, 0, 8 ) // decoded at runtime + GFXDECODE_RAM( "charram", 0, charlayout, 0, 8 ) // decoded at runtime // sprites are drawn pixel by pixel by draw_sprites() GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 8 ) GFXDECODE_END diff --git a/src/mame/tecfri/holeland.cpp b/src/mame/tecfri/holeland.cpp index a5df4bd8f08..27570fdbcf4 100644 --- a/src/mame/tecfri/holeland.cpp +++ b/src/mame/tecfri/holeland.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause // copyright-holders:Mathis Rosenhauer + /*************************************************************************** Hole Land @@ -17,56 +18,329 @@ ***************************************************************************/ #include "emu.h" -#include "holeland.h" #include "cpu/z80/z80.h" +#include "machine/74259.h" #include "machine/nvram.h" #include "machine/watchdog.h" #include "sound/ay8910.h" #include "sound/sp0256.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class base_state : public driver_device +{ +public: + base_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_latch(*this, "latch"), + m_videoram(*this, "videoram"), + m_colorram(*this, "colorram"), + m_spriteram(*this, "spriteram") + { } + +protected: + // devices + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_latch; + + // memory pointers + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_shared_ptr m_spriteram; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + uint8_t m_palette_offset = 0U; + + DECLARE_WRITE_LINE_MEMBER(coin_counter_w); + + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + void pal_offs_w(uint8_t data); + void scroll_w(uint8_t data); + DECLARE_WRITE_LINE_MEMBER(flipscreen_x_w); + DECLARE_WRITE_LINE_MEMBER(flipscreen_y_w); + + void io_map(address_map &map); +}; + +class holeland_state : public base_state +{ +public: + holeland_state(const machine_config &mconfig, device_type type, const char *tag) : + base_state(mconfig, type, tag) + { } + + void holeland(machine_config &config); + +protected: + virtual void video_start() override; + +private: + TILE_GET_INFO_MEMBER(get_tile_info); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void prg_map(address_map &map); +}; + +class crzrally_state : public base_state +{ +public: + crzrally_state(const machine_config &mconfig, device_type type, const char *tag) : + base_state(mconfig, type, tag) + { } + + void crzrally(machine_config &config); + +protected: + virtual void video_start() override; + +private: + TILE_GET_INFO_MEMBER(get_tile_info); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void prg_map(address_map &map); +}; + +// video + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ +TILE_GET_INFO_MEMBER(holeland_state::get_tile_info) +{ + /* + x--- ---- priority (1) behind sprites + xxxx ---- color + ---- xx-- flip yx + ---- --xx tile upper bits + */ + + int const attr = m_colorram[tile_index]; + int const tile_number = m_videoram[tile_index] | ((attr & 0x03) << 8); + + tileinfo.set(0, + tile_number, + m_palette_offset + ((attr >> 4) & 0x0f), + TILE_FLIPYX((attr >> 2) & 0x03)); + tileinfo.group = (attr >> 7) & 1; +} -WRITE_LINE_MEMBER(holeland_state::coin_counter_w) +TILE_GET_INFO_MEMBER(crzrally_state::get_tile_info) +{ + int const attr = m_colorram[tile_index]; + int const tile_number = m_videoram[tile_index] | ((attr & 0x03) << 8); + + tileinfo.set(0, + tile_number, + m_palette_offset + ((attr >> 4) & 0x0f), + TILE_FLIPYX((attr >> 2) & 0x03)); + tileinfo.group = (attr >> 5) & 1; +} + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void holeland_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(holeland_state::get_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); + + m_bg_tilemap->set_transmask(0, 0xff, 0x00); // split type 0 is totally transparent in front half + m_bg_tilemap->set_transmask(1, 0x01, 0xfe); // split type 1 has pen 0? transparent in front half + + save_item(NAME(m_palette_offset)); +} + +void crzrally_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(crzrally_state::get_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 32, 32); + + save_item(NAME(m_palette_offset)); +} + +void base_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void base_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void base_state::pal_offs_w(uint8_t data) +{ + if ((m_palette_offset >> 4) != (data & 3)) + { + m_palette_offset = (data & 3) << 4; + machine().tilemap().mark_all_dirty(); + } +} + +void base_state::scroll_w(uint8_t data) +{ + m_bg_tilemap->set_scrollx(0, data); +} + +WRITE_LINE_MEMBER(base_state::flipscreen_x_w) +{ + flip_screen_x_set(state); +} + +WRITE_LINE_MEMBER(base_state::flipscreen_y_w) +{ + flip_screen_y_set(state); +} + + +void holeland_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // Weird, sprites entries don't start on DWORD boundary + for (int offs = 3; offs < m_spriteram.bytes() - 1; offs += 4) + { + int sy = 236 - m_spriteram[offs]; + int sx = m_spriteram[offs + 2]; + + // Bit 7 unknown + int const code = m_spriteram[offs + 1] & 0x7f; + int const color = m_palette_offset + (m_spriteram[offs + 3] >> 4); + + // Bit 0, 1 unknown + int flipx = m_spriteram[offs + 3] & 0x04; + int flipy = m_spriteram[offs + 3] & 0x08; + + if (flip_screen_x()) + { + flipx = !flipx; + sx = 240 - sx; + } + + if (flip_screen_y()) + { + flipy = !flipy; + sy = 240 - sy; + } + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, + color, + flipx, flipy, + 2 * sx, 2 * sy, 0); + } +} + +void crzrally_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // Weird, sprites entries don't start on DWORD boundary + for (int offs = 3; offs < m_spriteram.bytes() - 1; offs += 4) + { + int sy = 236 - m_spriteram[offs]; + int sx = m_spriteram[offs + 2]; + + int const code = m_spriteram[offs + 1] + ((m_spriteram[offs + 3] & 0x01) << 8); + int const color = (m_spriteram[offs + 3] >> 4) + ((m_spriteram[offs + 3] & 0x01) << 4); + + // Bit 1 unknown but somehow related to X offset (clipping range?) + int flipx = m_spriteram[offs + 3] & 0x04; + int flipy = m_spriteram[offs + 3] & 0x08; + + if (flip_screen_x()) + { + flipx = !flipx; + sx = 240 - sx; + } + + if (flip_screen_y()) + { + flipy = !flipy; + sy = 240 - sy; + } + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, + color, + flipx, flipy, + sx, sy, 0); + } +} + +uint32_t holeland_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); + draw_sprites(bitmap, cliprect); + m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); + return 0; +} + +uint32_t crzrally_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + return 0; +} + + +// machine + +WRITE_LINE_MEMBER(base_state::coin_counter_w) { machine().bookkeeping().coin_counter_w(0, state); } -void holeland_state::holeland_map(address_map &map) +void holeland_state::prg_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0x8000, 0x87ff).ram(); map(0xa000, 0xbfff).rom(); map(0xa000, 0xa000).w("speech", FUNC(sp0256_device::ald_w)); map(0xc000, 0xc007).w(m_latch, FUNC(ls259_device::write_d0)).nopr(); - map(0xe000, 0xe3ff).ram().w(FUNC(holeland_state::colorram_w)).share("colorram"); - map(0xe400, 0xe7ff).ram().w(FUNC(holeland_state::videoram_w)).share("videoram"); - map(0xf000, 0xf3ff).ram().share("spriteram"); + map(0xe000, 0xe3ff).ram().w(FUNC(holeland_state::colorram_w)).share(m_colorram); + map(0xe400, 0xe7ff).ram().w(FUNC(holeland_state::videoram_w)).share(m_videoram); + map(0xf000, 0xf3ff).ram().share(m_spriteram); } -void holeland_state::crzrally_map(address_map &map) +void crzrally_state::prg_map(address_map &map) { map(0x0000, 0xbfff).rom(); map(0xc000, 0xc7ff).ram().share("nvram"); - map(0xe000, 0xe3ff).ram().w(FUNC(holeland_state::colorram_w)).share("colorram"); - map(0xe400, 0xe7ff).ram().w(FUNC(holeland_state::videoram_w)).share("videoram"); - map(0xe800, 0xebff).ram().share("spriteram"); - map(0xf000, 0xf000).w(FUNC(holeland_state::scroll_w)); + map(0xe000, 0xe3ff).ram().w(FUNC(crzrally_state::colorram_w)).share(m_colorram); + map(0xe400, 0xe7ff).ram().w(FUNC(crzrally_state::videoram_w)).share(m_videoram); + map(0xe800, 0xebff).ram().share(m_spriteram); + map(0xf000, 0xf000).w(FUNC(crzrally_state::scroll_w)); map(0xf800, 0xf807).w(m_latch, FUNC(ls259_device::write_d0)); } -void holeland_state::io_map(address_map &map) +void base_state::io_map(address_map &map) { map.global_mask(0xff); - map(0x01, 0x01).r("watchdog", FUNC(watchdog_timer_device::reset_r)); /* ? */ + map(0x01, 0x01).r("watchdog", FUNC(watchdog_timer_device::reset_r)); // ? map(0x04, 0x04).r("ay1", FUNC(ay8910_device::data_r)); map(0x04, 0x05).w("ay1", FUNC(ay8910_device::address_data_w)); map(0x06, 0x06).r("ay2", FUNC(ay8910_device::data_r)); map(0x06, 0x07).w("ay2", FUNC(ay8910_device::address_data_w)); } -/* Note - manual states cocktail mode should be default */ +// Note - manual states cocktail mode should be default static INPUT_PORTS_START( holeland ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) @@ -269,21 +543,21 @@ static const gfx_layout crzrally_spritelayout = }; static GFXDECODE_START( gfx_holeland ) - GFXDECODE_ENTRY( "gfx1", 0, holeland_charlayout, 0, 256 ) - GFXDECODE_ENTRY( "gfx2", 0, holeland_spritelayout, 0, 256 ) + GFXDECODE_ENTRY( "chars", 0, holeland_charlayout, 0, 256 ) + GFXDECODE_ENTRY( "sprites", 0, holeland_spritelayout, 0, 256 ) GFXDECODE_END static GFXDECODE_START( gfx_crzrally ) - GFXDECODE_ENTRY( "gfx1", 0, crzrally_charlayout, 0, 256 ) - GFXDECODE_ENTRY( "gfx2", 0, crzrally_spritelayout, 0, 256 ) + GFXDECODE_ENTRY( "chars", 0, crzrally_charlayout, 0, 256 ) + GFXDECODE_ENTRY( "sprites", 0, crzrally_spritelayout, 0, 256 ) GFXDECODE_END void holeland_state::holeland(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 3355700); /* measured 298ns on PCB */ - m_maincpu->set_addrmap(AS_PROGRAM, &holeland_state::holeland_map); + // basic machine hardware + Z80(config, m_maincpu, 3'355'700); // measured 298ns on PCB + m_maincpu->set_addrmap(AS_PROGRAM, &holeland_state::prg_map); m_maincpu->set_addrmap(AS_IO, &holeland_state::io_map); m_maincpu->set_vblank_int("screen", FUNC(holeland_state::irq0_line_hold)); @@ -295,70 +569,68 @@ void holeland_state::holeland(machine_config &config) WATCHDOG_TIMER(config, "watchdog"); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); // TODO: 448i, compensate. - screen.set_raw((20000000/4)*4, 332*2, 0, 256*2, 256*2, 16*2, 240*2); - screen.set_screen_update(FUNC(holeland_state::screen_update_holeland)); + screen.set_raw((20_MHz_XTAL / 4) * 4, 332 * 2, 0, 256 * 2, 256 * 2, 16 * 2, 240 * 2); + screen.set_screen_update(FUNC(holeland_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_holeland); PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256); - MCFG_VIDEO_START_OVERRIDE(holeland_state,holeland) - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - ay8910_device &ay1(AY8910(config, "ay1", 20000000 / 32)); /* verified on PCB */ + ay8910_device &ay1(AY8910(config, "ay1", 20_MHz_XTAL / 32)); // verified on PCB ay1.port_a_read_callback().set_ioport("IN0"); ay1.port_b_read_callback().set_ioport("IN1"); ay1.add_route(ALL_OUTPUTS, "mono", 0.25); - ay8910_device &ay2(AY8910(config, "ay2", 20000000 / 16)); /* verified on PCB */ + ay8910_device &ay2(AY8910(config, "ay2", 20_MHz_XTAL / 16)); // verified on PCB ay2.port_a_read_callback().set_ioport("DSW1"); ay2.port_b_read_callback().set_ioport("DSW2"); ay2.add_route(ALL_OUTPUTS, "mono", 0.25); - sp0256_device &speech(SP0256(config, "speech", 3355700)); /* measured 298ns on PCB */ + sp0256_device &speech(SP0256(config, "speech", 3'355'700)); // measured 298ns on PCB speech.data_request_callback().set_inputline("maincpu", INPUT_LINE_NMI); speech.add_route(ALL_OUTPUTS, "mono", 1.0); } -void holeland_state::crzrally(machine_config &config) +void crzrally_state::crzrally(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 20000000/4); /* 5 MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &holeland_state::crzrally_map); - m_maincpu->set_addrmap(AS_IO, &holeland_state::io_map); - m_maincpu->set_vblank_int("screen", FUNC(holeland_state::irq0_line_hold)); + // basic machine hardware + Z80(config, m_maincpu, 20_MHz_XTAL / 4); // 5 MHz + m_maincpu->set_addrmap(AS_PROGRAM, &crzrally_state::prg_map); + m_maincpu->set_addrmap(AS_IO, &crzrally_state::io_map); + m_maincpu->set_vblank_int("screen", FUNC(crzrally_state::irq0_line_hold)); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); LS259(config, m_latch); - m_latch->parallel_out_cb().set(FUNC(holeland_state::pal_offs_w)).mask(0x03); - m_latch->q_out_cb<5>().set(FUNC(holeland_state::coin_counter_w)); + m_latch->parallel_out_cb().set(FUNC(crzrally_state::pal_offs_w)).mask(0x03); + m_latch->q_out_cb<5>().set(FUNC(crzrally_state::coin_counter_w)); WATCHDOG_TIMER(config, "watchdog"); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_raw(20000000/4, 332, 0, 256, 256, 16, 240); - screen.set_screen_update(FUNC(holeland_state::screen_update_crzrally)); + screen.set_raw(20_MHz_XTAL / 4, 332, 0, 256, 256, 16, 240); + screen.set_screen_update(FUNC(crzrally_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_crzrally); PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256); - MCFG_VIDEO_START_OVERRIDE(holeland_state,crzrally) - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - ay8910_device &ay1(AY8910(config, "ay1", 20000000/16)); + ay8910_device &ay1(AY8910(config, "ay1", 20_MHz_XTAL / 16)); ay1.port_a_read_callback().set_ioport("IN0"); ay1.port_b_read_callback().set_ioport("IN1"); ay1.add_route(ALL_OUTPUTS, "mono", 0.25); - ay8910_device &ay2(AY8910(config, "ay2", 20000000/16)); + ay8910_device &ay2(AY8910(config, "ay2", 20_MHz_XTAL / 16)); ay2.port_a_read_callback().set_ioport("DSW1"); ay2.port_b_read_callback().set_ioport("DSW2"); ay2.add_route(ALL_OUTPUTS, "mono", 0.25); @@ -379,27 +651,27 @@ ROM_START( holeland ) ROM_LOAD( "3.2d", 0x6000, 0x2000, CRC(5537c22e) SHA1(030f34d3cbc5eea30a3ede77008eba394ef37e8f) ) ROM_LOAD( "4.1e", 0xa000, 0x2000, CRC(c95c355d) SHA1(44984108b6a3dab05855da4c4a3ff58d849559b8) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x4000, "chars", ROMREGION_INVERT ) ROM_LOAD( "5.4d", 0x0000, 0x2000, CRC(7f19e1f9) SHA1(75026da91e0cff262e5f6e32f836907a786aef42) ) ROM_LOAD( "6.4e", 0x2000, 0x2000, CRC(844400e3) SHA1(d306b26f838b043b71c5f9d2d240228986b695fa) ) - ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_REGION( 0x8000, "sprites", 0 ) ROM_LOAD( "7.4m", 0x0000, 0x2000, CRC(d7feb25b) SHA1(581e20b07d33ba350601fc56074c43aaf13078b4) ) ROM_LOAD( "8.4n", 0x2000, 0x2000, CRC(4b6eec16) SHA1(4c5da89c2babeb33951d101703e6699fbcb886b4) ) ROM_LOAD( "9.4p", 0x4000, 0x2000, CRC(6fe7fcc0) SHA1(fa982551285f728cee0055a0c473f6c74d802d2e) ) ROM_LOAD( "10.4r", 0x6000, 0x2000, CRC(e1e11e8f) SHA1(56082fe497d8ee8ecfe1b89c0c5ada4ddfa4740f) ) ROM_REGION( 0x10000, "speech", 0 ) - /* SP0256 mask rom */ + // SP0256 mask ROM ROM_LOAD( "sp0256a-al2.1b", 0x1000, 0x0800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "82s129.3m", 0x0000, 0x0100, CRC(9d6fef5a) SHA1(e2b62909fecadfc9e0eb1ad72c8b7712a26d184e) ) /* Red component */ - ROM_LOAD( "82s129.3l", 0x0100, 0x0100, CRC(f6682705) SHA1(1ab952c1e2a45e9b0dc9144f50711f99f6b1ebc4) ) /* Green component */ - ROM_LOAD( "82s129.3n", 0x0200, 0x0100, CRC(3d7b3af6) SHA1(0c4f95b26e9fe25a5d8c79f06e7ceab78a07d35c) ) /* Blue component */ + ROM_LOAD( "82s129.3m", 0x0000, 0x0100, CRC(9d6fef5a) SHA1(e2b62909fecadfc9e0eb1ad72c8b7712a26d184e) ) // Red component + ROM_LOAD( "82s129.3l", 0x0100, 0x0100, CRC(f6682705) SHA1(1ab952c1e2a45e9b0dc9144f50711f99f6b1ebc4) ) // Green component + ROM_LOAD( "82s129.3n", 0x0200, 0x0100, CRC(3d7b3af6) SHA1(0c4f95b26e9fe25a5d8c79f06e7ceab78a07d35c) ) // Blue component ROM_END -ROM_START( holeland2 ) +ROM_START( holeland2 ) // PCB REF.001/B ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "2.2a", 0x0000, 0x2000, CRC(b26212a9) SHA1(93ac3910b22e29f66a8ecbc9f7df8aa6b405ca9a) ) ROM_LOAD( "3.2b", 0x2000, 0x2000, CRC(623bca75) SHA1(a3406077271229a3a4f253d238aece369b0120d9) ) @@ -407,24 +679,24 @@ ROM_START( holeland2 ) ROM_LOAD( "4.2d", 0x6000, 0x2000, CRC(88a8ba11) SHA1(ce810c8ea0a78f94025f1ac40d5641a9287df4f0) ) ROM_LOAD( "1.1e", 0xa000, 0x2000, CRC(ec338f4b) SHA1(ae78a40f85b489e57377e4c60181895f781efe16) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x4000, "chars", ROMREGION_INVERT ) ROM_LOAD( "5.4d", 0x0000, 0x2000, CRC(7f19e1f9) SHA1(75026da91e0cff262e5f6e32f836907a786aef42) ) ROM_LOAD( "6.4e", 0x2000, 0x2000, CRC(844400e3) SHA1(d306b26f838b043b71c5f9d2d240228986b695fa) ) - ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_REGION( 0x8000, "sprites", 0 ) ROM_LOAD( "7.4m", 0x0000, 0x2000, CRC(d7feb25b) SHA1(581e20b07d33ba350601fc56074c43aaf13078b4) ) ROM_LOAD( "8.4n", 0x2000, 0x2000, CRC(4b6eec16) SHA1(4c5da89c2babeb33951d101703e6699fbcb886b4) ) ROM_LOAD( "9.4p", 0x4000, 0x2000, CRC(6fe7fcc0) SHA1(fa982551285f728cee0055a0c473f6c74d802d2e) ) ROM_LOAD( "10.4r", 0x6000, 0x2000, CRC(e1e11e8f) SHA1(56082fe497d8ee8ecfe1b89c0c5ada4ddfa4740f) ) ROM_REGION( 0x10000, "speech", 0 ) - /* SP0256 mask rom */ + // SP0256 mask ROM ROM_LOAD( "sp0256a_al2.1b", 0x1000, 0x0800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "82s129.3m", 0x0000, 0x0100, CRC(9d6fef5a) SHA1(e2b62909fecadfc9e0eb1ad72c8b7712a26d184e) ) /* Red component */ - ROM_LOAD( "82s129.3l", 0x0100, 0x0100, CRC(f6682705) SHA1(1ab952c1e2a45e9b0dc9144f50711f99f6b1ebc4) ) /* Green component */ - ROM_LOAD( "82s129.3n", 0x0200, 0x0100, CRC(3d7b3af6) SHA1(0c4f95b26e9fe25a5d8c79f06e7ceab78a07d35c) ) /* Blue component */ + ROM_LOAD( "82s129.3m", 0x0000, 0x0100, CRC(9d6fef5a) SHA1(e2b62909fecadfc9e0eb1ad72c8b7712a26d184e) ) // Red component + ROM_LOAD( "82s129.3l", 0x0100, 0x0100, CRC(f6682705) SHA1(1ab952c1e2a45e9b0dc9144f50711f99f6b1ebc4) ) // Green component + ROM_LOAD( "82s129.3n", 0x0200, 0x0100, CRC(3d7b3af6) SHA1(0c4f95b26e9fe25a5d8c79f06e7ceab78a07d35c) ) // Blue component ROM_END /* @@ -467,29 +739,29 @@ ROM_START( crzrally ) ROM_LOAD( "2.7f", 0x4000, 0x4000, CRC(67110f1d) SHA1(cc500017057e39cc8a6cb4e4ccae3c3cbab6c2ba) ) ROM_LOAD( "3.7d", 0x8000, 0x4000, CRC(25c861c3) SHA1(cc9f5f33833279b4430a4b8497cc16a222d31805) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x4000, "chars", ROMREGION_INVERT ) ROM_LOAD( "4.5h", 0x0000, 0x2000, CRC(29dece8b) SHA1(d8a0cfd1259d49f59f9751a2db99b46b9da6a87d) ) ROM_LOAD( "5.5g", 0x2000, 0x2000, CRC(b34aa904) SHA1(fb4301fd06efc33df9d9f611c3e67a9f7198531d) ) - ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_REGION( 0x8000, "sprites", 0 ) ROM_LOAD( "6.1f", 0x0000, 0x2000, CRC(a909ff0f) SHA1(9ce37a6bbb09c936551082dea62a791d10d7d346) ) ROM_LOAD( "7.1l", 0x2000, 0x2000, CRC(38fb0a16) SHA1(a17ec5c9acc5c244ffc715ee2376fbf8209e72fd) ) ROM_LOAD( "8.1k", 0x4000, 0x2000, CRC(660aa0f0) SHA1(1bb85851349f772f21db9629b0086b2460614b9d) ) ROM_LOAD( "9.1i", 0x6000, 0x2000, CRC(37d0790e) SHA1(877335a06d1842264daff9eb46d6ea1ce8249c29) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "82s129.9n", 0x0000, 0x0100, CRC(98ff725a) SHA1(553f033212a7c4785c0beb8156400cabcd53cf25) ) /* Red component */ - ROM_LOAD( "82s129.9m", 0x0100, 0x0100, CRC(d41f5800) SHA1(446046f5694357da876e1307f49584d79c8d9a1a) ) /* Green component */ - ROM_LOAD( "82s129.9l", 0x0200, 0x0100, CRC(9ed49cb4) SHA1(f54e66e2211d5fb0da9a81e11670367ee4d9b49a) ) /* Blue component */ + ROM_LOAD( "82s129.9n", 0x0000, 0x0100, CRC(98ff725a) SHA1(553f033212a7c4785c0beb8156400cabcd53cf25) ) // Red component + ROM_LOAD( "82s129.9m", 0x0100, 0x0100, CRC(d41f5800) SHA1(446046f5694357da876e1307f49584d79c8d9a1a) ) // Green component + ROM_LOAD( "82s129.9l", 0x0200, 0x0100, CRC(9ed49cb4) SHA1(f54e66e2211d5fb0da9a81e11670367ee4d9b49a) ) // Blue component ROM_REGION( 0x0200, "user1", 0 ) // unknown ROM_LOAD( "82s147.1f", 0x0000, 0x0200, CRC(5261bc11) SHA1(1cc7a9a7376e65f4587b75ef9382049458656372) ) ROM_REGION( 0x0800, "plds", 0 ) ROM_LOAD( "pal16r6a.5k", 0x0000, 0x0104, CRC(3d12afba) SHA1(60245089947e4a4f7bfa94a8cc96d4d8eebe4afc) ) - ROM_LOAD( "pal16r4a.5l", 0x0200, 0x0104, NO_DUMP ) /* PAL is read protected */ - ROM_LOAD( "pal16r4a.5m", 0x0400, 0x0104, NO_DUMP ) /* PAL is read protected */ - ROM_LOAD( "pal16r8a.1d", 0x0600, 0x0104, NO_DUMP ) /* PAL is read protected */ + ROM_LOAD( "pal16r4a.5l", 0x0200, 0x0104, NO_DUMP ) // PAL is read protected + ROM_LOAD( "pal16r4a.5m", 0x0400, 0x0104, NO_DUMP ) // PAL is read protected + ROM_LOAD( "pal16r8a.1d", 0x0600, 0x0104, NO_DUMP ) // PAL is read protected ROM_END ROM_START( crzrallya ) @@ -498,29 +770,29 @@ ROM_START( crzrallya ) ROM_LOAD( "crzralla_2.7f", 0x4000, 0x4000, CRC(7fdd4a45) SHA1(194d504adfd83adc52df2df27a18116a3072ea9d) ) ROM_LOAD( "crzralla_3.7d", 0x8000, 0x4000, CRC(a25edd17) SHA1(8f883bf3e42b9bf929717f6f13a281f0b83669b1) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x4000, "chars", ROMREGION_INVERT ) ROM_LOAD( "4.5h", 0x0000, 0x2000, CRC(29dece8b) SHA1(d8a0cfd1259d49f59f9751a2db99b46b9da6a87d) ) ROM_LOAD( "crzralla_5.5g", 0x2000, 0x2000, CRC(81e9b043) SHA1(effc082a025ce36ab6ba8603a82be1469eee6276) ) - ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_REGION( 0x8000, "sprites", 0 ) ROM_LOAD( "6.1f", 0x0000, 0x2000, CRC(a909ff0f) SHA1(9ce37a6bbb09c936551082dea62a791d10d7d346) ) ROM_LOAD( "7.1l", 0x2000, 0x2000, CRC(38fb0a16) SHA1(a17ec5c9acc5c244ffc715ee2376fbf8209e72fd) ) ROM_LOAD( "8.1k", 0x4000, 0x2000, CRC(660aa0f0) SHA1(1bb85851349f772f21db9629b0086b2460614b9d) ) ROM_LOAD( "9.1i", 0x6000, 0x2000, CRC(37d0790e) SHA1(877335a06d1842264daff9eb46d6ea1ce8249c29) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "82s129.9n", 0x0000, 0x0100, CRC(98ff725a) SHA1(553f033212a7c4785c0beb8156400cabcd53cf25) ) /* Red component */ - ROM_LOAD( "82s129.9m", 0x0100, 0x0100, CRC(d41f5800) SHA1(446046f5694357da876e1307f49584d79c8d9a1a) ) /* Green component */ - ROM_LOAD( "82s129.9l", 0x0200, 0x0100, CRC(9ed49cb4) SHA1(f54e66e2211d5fb0da9a81e11670367ee4d9b49a) ) /* Blue component */ + ROM_LOAD( "82s129.9n", 0x0000, 0x0100, CRC(98ff725a) SHA1(553f033212a7c4785c0beb8156400cabcd53cf25) ) // Red component + ROM_LOAD( "82s129.9m", 0x0100, 0x0100, CRC(d41f5800) SHA1(446046f5694357da876e1307f49584d79c8d9a1a) ) // Green component + ROM_LOAD( "82s129.9l", 0x0200, 0x0100, CRC(9ed49cb4) SHA1(f54e66e2211d5fb0da9a81e11670367ee4d9b49a) ) // Blue component ROM_REGION( 0x0200, "user1", 0 ) // unknown ROM_LOAD( "82s147.1f", 0x0000, 0x0200, CRC(5261bc11) SHA1(1cc7a9a7376e65f4587b75ef9382049458656372) ) ROM_REGION( 0x0800, "plds", 0 ) ROM_LOAD( "pal16r6a.5k", 0x0000, 0x0104, CRC(3d12afba) SHA1(60245089947e4a4f7bfa94a8cc96d4d8eebe4afc) ) - ROM_LOAD( "pal16r4a.5l", 0x0200, 0x0104, NO_DUMP ) /* PAL is read protected */ - ROM_LOAD( "pal16r4a.5m", 0x0400, 0x0104, NO_DUMP ) /* PAL is read protected */ - ROM_LOAD( "pal16r8a.1d", 0x0600, 0x0104, NO_DUMP ) /* PAL is read protected */ + ROM_LOAD( "pal16r4a.5l", 0x0200, 0x0104, NO_DUMP ) // PAL is read protected + ROM_LOAD( "pal16r4a.5m", 0x0400, 0x0104, NO_DUMP ) // PAL is read protected + ROM_LOAD( "pal16r8a.1d", 0x0600, 0x0104, NO_DUMP ) // PAL is read protected ROM_END ROM_START( crzrallyg ) @@ -529,29 +801,29 @@ ROM_START( crzrallyg ) ROM_LOAD( "13.7f", 0x4000, 0x4000, CRC(e19a8e13) SHA1(1462b21f16990eb9ae2f2d1cd5c097edf88bf614) ) ROM_LOAD( "14.7d", 0x8000, 0x4000, CRC(4c0351ba) SHA1(0ed04825d3affe0477bb963f1c96ff223e4bcf50) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x4000, "chars", ROMREGION_INVERT ) ROM_LOAD( "4.5h", 0x0000, 0x2000, CRC(29dece8b) SHA1(d8a0cfd1259d49f59f9751a2db99b46b9da6a87d) ) ROM_LOAD( "16.5g", 0x2000, 0x2000, CRC(94289f9e) SHA1(8da00814d8f769de124bc09f4c1ee851c99cec0e) ) - ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_REGION( 0x8000, "sprites", 0 ) ROM_LOAD( "17.1n", 0x0000, 0x2000, CRC(985ed5c8) SHA1(ee91a6701a8b8bb24d6fa08596deff95816e759e) ) ROM_LOAD( "18.1l", 0x2000, 0x2000, CRC(c02ddda2) SHA1(262e33cada0e7935d03014583117c2bc6278865b) ) ROM_LOAD( "19.1k", 0x4000, 0x2000, CRC(2a0d5bca) SHA1(8d7aedd63ea374a5809c24f957b0afa3cad437d0) ) ROM_LOAD( "20.1i", 0x6000, 0x2000, CRC(49c0c2b8) SHA1(30c4fe1dc2df499927f8fd4a041a707b81a04e1d) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "82s129.9n", 0x0000, 0x0100, CRC(98ff725a) SHA1(553f033212a7c4785c0beb8156400cabcd53cf25) ) /* Red component */ - ROM_LOAD( "82s129.9m", 0x0100, 0x0100, CRC(d41f5800) SHA1(446046f5694357da876e1307f49584d79c8d9a1a) ) /* Green component */ - ROM_LOAD( "82s129.9l", 0x0200, 0x0100, CRC(9ed49cb4) SHA1(f54e66e2211d5fb0da9a81e11670367ee4d9b49a) ) /* Blue component */ + ROM_LOAD( "82s129.9n", 0x0000, 0x0100, CRC(98ff725a) SHA1(553f033212a7c4785c0beb8156400cabcd53cf25) ) // Red component + ROM_LOAD( "82s129.9m", 0x0100, 0x0100, CRC(d41f5800) SHA1(446046f5694357da876e1307f49584d79c8d9a1a) ) // Green component + ROM_LOAD( "82s129.9l", 0x0200, 0x0100, CRC(9ed49cb4) SHA1(f54e66e2211d5fb0da9a81e11670367ee4d9b49a) ) // Blue component ROM_REGION( 0x0200, "user1", 0 ) // unknown ROM_LOAD( "82s147.1f", 0x0000, 0x0200, CRC(5261bc11) SHA1(1cc7a9a7376e65f4587b75ef9382049458656372) ) ROM_REGION( 0x0800, "plds", 0 ) ROM_LOAD( "pal16r6a.5k", 0x0000, 0x0104, CRC(3d12afba) SHA1(60245089947e4a4f7bfa94a8cc96d4d8eebe4afc) ) - ROM_LOAD( "pal16r4a.5l", 0x0200, 0x0104, NO_DUMP ) /* PAL is read protected */ - ROM_LOAD( "pal16r4a.5m", 0x0400, 0x0104, NO_DUMP ) /* PAL is read protected */ - ROM_LOAD( "pal16r8a.1d", 0x0600, 0x0104, NO_DUMP ) /* PAL is read protected */ + ROM_LOAD( "pal16r4a.5l", 0x0200, 0x0104, NO_DUMP ) // PAL is read protected + ROM_LOAD( "pal16r4a.5m", 0x0400, 0x0104, NO_DUMP ) // PAL is read protected + ROM_LOAD( "pal16r8a.1d", 0x0600, 0x0104, NO_DUMP ) // PAL is read protected ROM_END /* Recreativos Franco */ @@ -561,11 +833,11 @@ ROM_START( crzrallyrf ) ROM_LOAD( "crzrallyrf_2.7f", 0x4000, 0x4000, CRC(8a594a0e) SHA1(8da7099ae7a272dd10bb58b114ca98a58f1df4bb) ) ROM_LOAD( "crzrallyrf_3.7d", 0x8000, 0x4000, CRC(01ed44dc) SHA1(6078f21f281e3de54f4a2f9869da2728f184bea7) ) - ROM_REGION( 0x4000, "gfx1", ROMREGION_INVERT ) + ROM_REGION( 0x4000, "chars", ROMREGION_INVERT ) ROM_LOAD( "crzrallyrf_4.5h", 0x0000, 0x2000, CRC(68ec2811) SHA1(6a30544d905e373440740877cdbae4a9c4e361cb) ) ROM_LOAD( "crzrallyrf_5.5g", 0x2000, 0x2000, CRC(81e9b043) SHA1(effc082a025ce36ab6ba8603a82be1469eee6276) ) - ROM_REGION( 0x8000, "gfx2", 0 ) + ROM_REGION( 0x8000, "sprites", 0 ) ROM_LOAD( "crzrallyrf_6.1n", 0x0000, 0x2000, CRC(985ed5c8) SHA1(ee91a6701a8b8bb24d6fa08596deff95816e759e) ) ROM_LOAD( "crzrallyrf_7.1l", 0x2000, 0x2000, CRC(c02ddda2) SHA1(262e33cada0e7935d03014583117c2bc6278865b) ) ROM_LOAD( "crzrallyrf_8.1k", 0x4000, 0x2000, CRC(2a0d5bca) SHA1(8d7aedd63ea374a5809c24f957b0afa3cad437d0) ) @@ -589,9 +861,12 @@ ROM_START( crzrallyrf ) ROM_LOAD( "pal16r8a.1d", 0x0600, 0x0104, NO_DUMP ) // PAL is read protected ROM_END +} // anonymous namespace + + GAME( 1984, holeland, 0, holeland, holeland, holeland_state, empty_init, ROT0, "Tecfri", "Hole Land (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1984, holeland2, holeland, holeland, holeland2, holeland_state, empty_init, ROT0, "Tecfri", "Hole Land (Spain)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) //attract is different -GAME( 1985, crzrally, 0, crzrally, crzrally, holeland_state, empty_init, ROT270, "Tecfri", "Crazy Rally (set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1985, crzrallya, crzrally, crzrally, crzrally, holeland_state, empty_init, ROT270, "Tecfri", "Crazy Rally (set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1985, crzrallyg, crzrally, crzrally, crzrally, holeland_state, empty_init, ROT270, "Tecfri (Gecas license)", "Crazy Rally (Gecas license)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1985, crzrallyrf, crzrally, crzrally, crzrally, holeland_state, empty_init, ROT270, "Tecfri (Recreativos Franco license)", "Crazy Rally (Recreativos Franco license)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1985, crzrally, 0, crzrally, crzrally, crzrally_state, empty_init, ROT270, "Tecfri", "Crazy Rally (set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1985, crzrallya, crzrally, crzrally, crzrally, crzrally_state, empty_init, ROT270, "Tecfri", "Crazy Rally (set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1985, crzrallyg, crzrally, crzrally, crzrally, crzrally_state, empty_init, ROT270, "Tecfri (Gecas license)", "Crazy Rally (Gecas license)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1985, crzrallyrf, crzrally, crzrally, crzrally, crzrally_state, empty_init, ROT270, "Tecfri (Recreativos Franco license)", "Crazy Rally (Recreativos Franco license)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/tecfri/holeland.h b/src/mame/tecfri/holeland.h deleted file mode 100644 index 4e527718d34..00000000000 --- a/src/mame/tecfri/holeland.h +++ /dev/null @@ -1,74 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mathis Rosenhauer -/************************************************************************* - - Hole Land - -*************************************************************************/ -#ifndef MAME_INCLUDES_HOLELAND_H -#define MAME_INCLUDES_HOLELAND_H - -#pragma once - -#include "machine/74259.h" -#include "emupal.h" -#include "tilemap.h" - -class holeland_state : public driver_device -{ -public: - holeland_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_latch(*this, "latch"), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_spriteram(*this, "spriteram") - { } - - void crzrally(machine_config &config); - void holeland(machine_config &config); - -private: - /* devices */ - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_latch; - - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_shared_ptr m_spriteram; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - int m_palette_offset = 0; - - DECLARE_WRITE_LINE_MEMBER(coin_counter_w); - - void videoram_w(offs_t offset, uint8_t data); - void colorram_w(offs_t offset, uint8_t data); - void pal_offs_w(uint8_t data); - void scroll_w(uint8_t data); - DECLARE_WRITE_LINE_MEMBER(flipscreen_x_w); - DECLARE_WRITE_LINE_MEMBER(flipscreen_y_w); - - TILE_GET_INFO_MEMBER(holeland_get_tile_info); - TILE_GET_INFO_MEMBER(crzrally_get_tile_info); - - DECLARE_VIDEO_START(holeland); - DECLARE_VIDEO_START(crzrally); - - uint32_t screen_update_holeland(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_crzrally(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void holeland_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void crzrally_draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect ); - void crzrally_map(address_map &map); - void holeland_map(address_map &map); - void io_map(address_map &map); -}; - -#endif // MAME_INCLUDES_HOLELAND_H diff --git a/src/mame/tecfri/holeland_v.cpp b/src/mame/tecfri/holeland_v.cpp deleted file mode 100644 index 98bf0608111..00000000000 --- a/src/mame/tecfri/holeland_v.cpp +++ /dev/null @@ -1,202 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Mathis Rosenhauer -/*************************************************************************** - - holeland.cpp - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "holeland.h" - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(holeland_state::holeland_get_tile_info) -{ - /* - x--- ---- priority (1) behind sprites - xxxx ---- color - ---- xx-- flip yx - ---- --xx tile upper bits - */ - - int attr = m_colorram[tile_index]; - int tile_number = m_videoram[tile_index] | ((attr & 0x03) << 8); - - tileinfo.set(0, - tile_number, - m_palette_offset + ((attr >> 4) & 0x0f), - TILE_FLIPYX((attr >> 2) & 0x03)); - tileinfo.group = (attr >> 7) & 1; -} - -TILE_GET_INFO_MEMBER(holeland_state::crzrally_get_tile_info) -{ - int attr = m_colorram[tile_index]; - int tile_number = m_videoram[tile_index] | ((attr & 0x03) << 8); - - tileinfo.set(0, - tile_number, - m_palette_offset + ((attr >> 4) & 0x0f), - TILE_FLIPYX((attr >> 2) & 0x03)); - tileinfo.group = (attr >> 5) & 1; -} - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -VIDEO_START_MEMBER(holeland_state,holeland) -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(holeland_state::holeland_get_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); - - m_bg_tilemap->set_transmask(0, 0xff, 0x00); /* split type 0 is totally transparent in front half */ - m_bg_tilemap->set_transmask(1, 0x01, 0xfe); /* split type 1 has pen 0? transparent in front half */ - - save_item(NAME(m_palette_offset)); -} - -VIDEO_START_MEMBER(holeland_state,crzrally) -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(holeland_state::crzrally_get_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 32, 32); - - save_item(NAME(m_palette_offset)); -} - -void holeland_state::videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void holeland_state::colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void holeland_state::pal_offs_w(uint8_t data) -{ - if ((m_palette_offset >> 4) != (data & 3)) - { - m_palette_offset = (data & 3) << 4; - machine().tilemap().mark_all_dirty(); - } -} - -void holeland_state::scroll_w(uint8_t data) -{ - m_bg_tilemap->set_scrollx(0, data); -} - -WRITE_LINE_MEMBER(holeland_state::flipscreen_x_w) -{ - flip_screen_x_set(state); -} - -WRITE_LINE_MEMBER(holeland_state::flipscreen_y_w) -{ - flip_screen_y_set(state); -} - - -void holeland_state::holeland_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - uint8_t *spriteram = m_spriteram; - int offs, code, sx, sy, color, flipx, flipy; - - /* Weird, sprites entries don't start on DWORD boundary */ - for (offs = 3; offs < m_spriteram.bytes() - 1; offs += 4) - { - sy = 236 - spriteram[offs]; - sx = spriteram[offs + 2]; - - /* Bit 7 unknown */ - code = spriteram[offs + 1] & 0x7f; - color = m_palette_offset + (spriteram[offs + 3] >> 4); - - /* Bit 0, 1 unknown */ - flipx = spriteram[offs + 3] & 0x04; - flipy = spriteram[offs + 3] & 0x08; - - if (flip_screen_x()) - { - flipx = !flipx; - sx = 240 - sx; - } - - if (flip_screen_y()) - { - flipy = !flipy; - sy = 240 - sy; - } - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code, - color, - flipx,flipy, - 2*sx,2*sy,0); - } -} - -void holeland_state::crzrally_draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect ) -{ - uint8_t *spriteram = m_spriteram; - int offs, code, sx, sy, color, flipx, flipy; - - /* Weird, sprites entries don't start on DWORD boundary */ - for (offs = 3; offs < m_spriteram.bytes() - 1; offs += 4) - { - sy = 236 - spriteram[offs]; - sx = spriteram[offs + 2]; - - code = spriteram[offs + 1] + ((spriteram[offs + 3] & 0x01) << 8); - color = (spriteram[offs + 3] >> 4) + ((spriteram[offs + 3] & 0x01) << 4); - - /* Bit 1 unknown but somehow related to X offset (clipping range?) */ - flipx = spriteram[offs + 3] & 0x04; - flipy = spriteram[offs + 3] & 0x08; - - if (flip_screen_x()) - { - flipx = !flipx; - sx = 240 - sx; - } - - if (flip_screen_y()) - { - flipy = !flipy; - sy = 240 - sy; - } - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code, - color, - flipx,flipy, - sx,sy,0); - } -} - -uint32_t holeland_state::screen_update_holeland(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); - holeland_draw_sprites(bitmap, cliprect); - m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); - return 0; -} - -uint32_t holeland_state::screen_update_crzrally(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - crzrally_draw_sprites(bitmap, cliprect); - return 0; -} diff --git a/src/mame/tecfri/sauro.cpp b/src/mame/tecfri/sauro.cpp index 672ea8a5785..f9df75290c1 100644 --- a/src/mame/tecfri/sauro.cpp +++ b/src/mame/tecfri/sauro.cpp @@ -55,11 +55,6 @@ e00e-e00f W ??? TODO ---- -- The readme claims there is a GI-SP0256A-AL ADPCM on the PCB. Needs to be - emulated. Done (couriersud) - -- Verify all clock speeds - - I'm only using colors 0-15. The other 3 banks are mostly the same, but, for example, the color that's used to paint the gradients of the sky (color 2) is different, so there might be a palette select. I don't see anything @@ -126,88 +121,416 @@ Stephh's notes (based on the games Z80 code and some tests) : ***************************************************************************/ #include "emu.h" -#include "sauro.h" #include "cpu/z80/z80.h" +#include "machine/74259.h" +#include "machine/gen_latch.h" #include "machine/nvram.h" #include "machine/watchdog.h" +#include "sound/sp0256.h" #include "sound/ymopl.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class base_state : public driver_device +{ +public: + base_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_mainlatch(*this, "mainlatch"), + m_spriteram(*this, "spriteram"), + m_bg_videoram(*this, "bg_videoram"), + m_bg_colorram(*this, "bg_colorram") + { } + + void tecfri(machine_config &config); + +protected: + virtual void machine_start() override; + + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_mainlatch; + + required_shared_ptr m_spriteram; + required_shared_ptr m_bg_videoram; + required_shared_ptr m_bg_colorram; + + tilemap_t *m_bg_tilemap = nullptr; + uint8_t m_palette_bank = 0U; + + bool m_irq_enable = 0; + + // common + DECLARE_WRITE_LINE_MEMBER(vblank_irq); + DECLARE_WRITE_LINE_MEMBER(irq_reset_w); + template DECLARE_WRITE_LINE_MEMBER(coin_w); + DECLARE_WRITE_LINE_MEMBER(flip_screen_w); + void bg_videoram_w(offs_t offset, uint8_t data); + void bg_colorram_w(offs_t offset, uint8_t data); + void scroll_bg_w(uint8_t data); + + TILE_GET_INFO_MEMBER(get_tile_info_bg); +}; + +class trckydoc_state : public base_state +{ +public: + trckydoc_state(const machine_config &mconfig, device_type type, const char *tag) : + base_state(mconfig, type, tag) + { } + + void trckydoc(machine_config &config); + +protected: + virtual void video_start() override; + +private: + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + + void prg_map(address_map &map); +}; + +class sauro_state : public base_state +{ +public: + sauro_state(const machine_config &mconfig, device_type type, const char *tag) : + base_state(mconfig, type, tag), + m_soundlatch(*this, "soundlatch"), + m_fg_videoram(*this, "fg_videoram"), + m_fg_colorram(*this, "fg_colorram") + { } + + void sauro(machine_config &config); + void saurobl(machine_config &config); + +protected: + virtual void video_start() override; + +private: + required_device m_soundlatch; + + required_shared_ptr m_fg_videoram; + required_shared_ptr m_fg_colorram; + + tilemap_t *m_fg_tilemap = nullptr; + + void sound_command_w(uint8_t data); + uint8_t sound_command_r(); + DECLARE_WRITE_LINE_MEMBER(palette_bank0_w); + DECLARE_WRITE_LINE_MEMBER(palette_bank1_w); + void scroll_fg_w(uint8_t data); + void fg_videoram_w(offs_t offset, uint8_t data); + void fg_colorram_w(offs_t offset, uint8_t data); + + TILE_GET_INFO_MEMBER(get_tile_info_fg); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_io_map(address_map &map); + void main_prg_map(address_map &map); + void sauro_sound_map(address_map &map); + void saurobl_sound_map(address_map &map); +}; + + +// video + +// General + +void base_state::bg_videoram_w(offs_t offset, uint8_t data) +{ + m_bg_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void base_state::bg_colorram_w(offs_t offset, uint8_t data) +{ + m_bg_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void sauro_state::fg_videoram_w(offs_t offset, uint8_t data) +{ + m_fg_videoram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset); +} +void sauro_state::fg_colorram_w(offs_t offset, uint8_t data) +{ + m_fg_colorram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset); +} -void sauro_state::machine_start() +void base_state::scroll_bg_w(uint8_t data) +{ + m_bg_tilemap->set_scrollx(0, data); +} + +TILE_GET_INFO_MEMBER(base_state::get_tile_info_bg) +{ + int const code = m_bg_videoram[tile_index] + ((m_bg_colorram[tile_index] & 0x07) << 8); + int const color = ((m_bg_colorram[tile_index] >> 4) & 0x0f) | m_palette_bank; + int const flags = m_bg_colorram[tile_index] & 0x08 ? TILE_FLIPX : 0; + + tileinfo.set(0, code, color, flags); +} + +TILE_GET_INFO_MEMBER(sauro_state::get_tile_info_fg) +{ + int const code = m_fg_videoram[tile_index] + ((m_fg_colorram[tile_index] & 0x07) << 8); + int const color = ((m_fg_colorram[tile_index] >> 4) & 0x0f) | m_palette_bank; + int const flags = m_fg_colorram[tile_index] & 0x08 ? TILE_FLIPX : 0; + + tileinfo.set(1, code, color, flags); +} + +// Sauro + +static const int scroll2_map[8] = {2, 1, 4, 3, 6, 5, 0, 7}; +static const int scroll2_map_flip[8] = {0, 7, 2, 1, 4, 3, 6, 5}; + +WRITE_LINE_MEMBER(sauro_state::palette_bank0_w) +{ + if (state) + m_palette_bank |= 0x10; + else + m_palette_bank &= ~0x10; + machine().tilemap().mark_all_dirty(); +} + +WRITE_LINE_MEMBER(sauro_state::palette_bank1_w) +{ + if (state) + m_palette_bank |= 0x20; + else + m_palette_bank &= ~0x20; + machine().tilemap().mark_all_dirty(); +} + +void sauro_state::scroll_fg_w(uint8_t data) +{ + const int *map = (flip_screen() ? scroll2_map_flip : scroll2_map); + int const scroll = (data & 0xf8) | map[data & 7]; + + m_fg_tilemap->set_scrollx(0, scroll); +} + +void sauro_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sauro_state::get_tile_info_bg)), TILEMAP_SCAN_COLS, + 8, 8, 32, 32); + + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sauro_state::get_tile_info_fg)), TILEMAP_SCAN_COLS, + 8, 8, 32, 32); + + m_fg_tilemap->set_transparent_pen(0); + m_palette_bank = 0; + + save_item(NAME(m_palette_bank)); +} + +void sauro_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int const flipy = flip_screen(); + + for (int offs = 3; offs < m_spriteram.bytes() - 1; offs += 4) + { + int sy = m_spriteram[offs]; + if (sy == 0xf8) continue; + + int const code = m_spriteram[offs + 1] + ((m_spriteram[offs + 3] & 0x03) << 8); + int sx = m_spriteram[offs + 2]; + sy = 236 - sy; + int const color = ((m_spriteram[offs + 3] >> 4) & 0x0f) | m_palette_bank; + + // I'm not really sure how this bit works + if (m_spriteram[offs + 3] & 0x08) + { + if (sx > 0xc0) + { + // Sign extend + sx = (signed int)(signed char)sx; + } + } + else + { + if (sx < 0x40) continue; + } + + int flipx = m_spriteram[offs + 3] & 0x04; + + if (flipy) + { + flipx = !flipx; + sx = (235 - sx) & 0xff; // The &0xff is not 100% percent correct + sy = 240 - sy; + } + + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + code, + color, + flipx, flipy, + sx, sy, 0); + } +} + +uint32_t sauro_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; +} + +// Tricky Doc + +void trckydoc_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(trckydoc_state::get_tile_info_bg)), TILEMAP_SCAN_COLS, + 8, 8, 32, 32); + + m_palette_bank = 0; +} + +void trckydoc_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int const flipy = flip_screen(); + + // Weird, sprites entries don't start on DWORD boundary + for (int offs = 3; offs < m_spriteram.bytes() - 1; offs += 4) + { + int sy = m_spriteram[offs]; + + if (m_spriteram[offs + 3] & 0x08) + { + // needed by the elevator cable (2nd stage), balls bouncing (3rd stage) and maybe other things + sy += 6; + } + + int const code = m_spriteram[offs + 1] + ((m_spriteram[offs + 3] & 0x01) << 8); + + int sx = m_spriteram[offs + 2] - 2; + int const color = (m_spriteram[offs + 3] >> 4) & 0x0f; + + sy = 236 - sy; + + // similar to sauro but different bit is used .. + if (m_spriteram[offs + 3] & 0x02) + { + if (sx > 0xc0) + { + // Sign extend + sx = (signed int)(signed char)sx; + } + } + else + { + if (sx < 0x40) continue; + } + + int flipx = m_spriteram[offs + 3] & 0x04; + + if (flipy) + { + flipx = !flipx; + sx = (235 - sx) & 0xff; // The &0xff is not 100% percent correct + sy = 240 - sy; + } + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, + color, + flipx, flipy, + sx, sy, 0); + } +} + +uint32_t trckydoc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + return 0; +} + + +// machine + +void base_state::machine_start() { save_item(NAME(m_irq_enable)); } -void sauro_state::sauro_sound_command_w(uint8_t data) +void sauro_state::sound_command_w(uint8_t data) { data |= 0x80; m_soundlatch->write(data); } -uint8_t sauro_state::sauro_sound_command_r() +uint8_t sauro_state::sound_command_r() { int ret = m_soundlatch->read(); m_soundlatch->clear_w(); return ret; } -WRITE_LINE_MEMBER(sauro_state::vblank_irq) +WRITE_LINE_MEMBER(base_state::vblank_irq) { if (state && m_irq_enable) m_maincpu->set_input_line(0, ASSERT_LINE); } -WRITE_LINE_MEMBER(sauro_state::irq_reset_w) +WRITE_LINE_MEMBER(base_state::irq_reset_w) { m_irq_enable = !state; if (m_irq_enable) m_maincpu->set_input_line(0, CLEAR_LINE); } -WRITE_LINE_MEMBER(sauro_state::coin1_w) +template +WRITE_LINE_MEMBER(base_state::coin_w) { - machine().bookkeeping().coin_counter_w(0, state); + machine().bookkeeping().coin_counter_w(Which, state); } -WRITE_LINE_MEMBER(sauro_state::coin2_w) -{ - machine().bookkeeping().coin_counter_w(1, state); -} - -WRITE_LINE_MEMBER(sauro_state::flip_screen_w) +WRITE_LINE_MEMBER(base_state::flip_screen_w) { flip_screen_set(state); } -void sauro_state::adpcm_w(uint8_t data) -{ - m_sp0256->ald_w(data); -} - -void sauro_state::sauro_map(address_map &map) +void sauro_state::main_prg_map(address_map &map) { map(0x0000, 0xdfff).rom(); map(0xe000, 0xe7ff).ram().share("nvram"); - map(0xe800, 0xebff).ram().share("spriteram"); - map(0xf000, 0xf3ff).ram().w(FUNC(sauro_state::videoram_w)).share("videoram"); - map(0xf400, 0xf7ff).ram().w(FUNC(sauro_state::colorram_w)).share("colorram"); - map(0xf800, 0xfbff).ram().w(FUNC(sauro_state::sauro_videoram2_w)).share("videoram2"); - map(0xfc00, 0xffff).ram().w(FUNC(sauro_state::sauro_colorram2_w)).share("colorram2"); + map(0xe800, 0xebff).ram().share(m_spriteram); + map(0xf000, 0xf3ff).ram().w(FUNC(sauro_state::bg_videoram_w)).share(m_bg_videoram); + map(0xf400, 0xf7ff).ram().w(FUNC(sauro_state::bg_colorram_w)).share(m_bg_colorram); + map(0xf800, 0xfbff).ram().w(FUNC(sauro_state::fg_videoram_w)).share(m_fg_videoram); + map(0xfc00, 0xffff).ram().w(FUNC(sauro_state::fg_colorram_w)).share(m_fg_colorram); } -void sauro_state::sauro_io_map(address_map &map) +void sauro_state::main_io_map(address_map &map) { map.global_mask(0xff); map(0x00, 0x00).portr("DSW1"); map(0x20, 0x20).portr("DSW2"); map(0x40, 0x40).portr("P1"); map(0x60, 0x60).portr("P2"); - map(0x80, 0x80).w(FUNC(sauro_state::sauro_sound_command_w)); + map(0x80, 0x80).w(FUNC(sauro_state::sound_command_w)); map(0xa0, 0xa0).w(FUNC(sauro_state::scroll_bg_w)); - map(0xa1, 0xa1).w(FUNC(sauro_state::sauro_scroll_fg_w)); + map(0xa1, 0xa1).w(FUNC(sauro_state::scroll_fg_w)); map(0xc0, 0xcf).w(m_mainlatch, FUNC(ls259_device::write_a0)); map(0xe0, 0xe0).w("watchdog", FUNC(watchdog_timer_device::reset_w)); } @@ -217,8 +540,8 @@ void sauro_state::sauro_sound_map(address_map &map) map(0x0000, 0x7fff).rom(); map(0x8000, 0x87ff).ram(); map(0xc000, 0xc001).w("ymsnd", FUNC(ym3812_device::write)); - map(0xa000, 0xa000).w(FUNC(sauro_state::adpcm_w)); - map(0xe000, 0xe000).r(FUNC(sauro_state::sauro_sound_command_r)); + map(0xa000, 0xa000).w("speech", FUNC(sp0256_device::ald_w)); + map(0xe000, 0xe000).r(FUNC(sauro_state::sound_command_r)); map(0xe000, 0xe006).nopw(); // echo from write to e0000 map(0xe00e, 0xe00f).nopw(); } @@ -230,26 +553,26 @@ void sauro_state::saurobl_sound_map(address_map &map) map(0x8000, 0x87ff).ram(); map(0xc000, 0xc001).w("ymsnd", FUNC(ym3812_device::write)); map(0xa000, 0xa000).nopw(); - map(0xe000, 0xe000).r(FUNC(sauro_state::sauro_sound_command_r)); + map(0xe000, 0xe000).r(FUNC(sauro_state::sound_command_r)); map(0xe000, 0xe006).nopw(); // echo from write to e0000 map(0xe00e, 0xe00f).nopw(); } -void sauro_state::trckydoc_map(address_map &map) +void trckydoc_state::prg_map(address_map &map) { map(0x0000, 0xdfff).rom(); map(0xe000, 0xe7ff).ram().share("nvram"); - map(0xe800, 0xebff).ram().mirror(0x400).share("spriteram"); - map(0xf000, 0xf3ff).ram().w(FUNC(sauro_state::videoram_w)).share("videoram"); - map(0xf400, 0xf7ff).ram().w(FUNC(sauro_state::colorram_w)).share("colorram"); + map(0xe800, 0xebff).ram().mirror(0x400).share(m_spriteram); + map(0xf000, 0xf3ff).ram().w(FUNC(trckydoc_state::bg_videoram_w)).share(m_bg_videoram); + map(0xf400, 0xf7ff).ram().w(FUNC(trckydoc_state::bg_colorram_w)).share(m_bg_colorram); map(0xf800, 0xf800).portr("DSW1"); map(0xf808, 0xf808).portr("DSW2"); map(0xf810, 0xf810).portr("P1"); map(0xf818, 0xf818).portr("P2"); map(0xf820, 0xf821).w("ymsnd", FUNC(ym3812_device::write)); map(0xf828, 0xf828).r("watchdog", FUNC(watchdog_timer_device::reset_r)); - map(0xf830, 0xf830).w(FUNC(sauro_state::scroll_bg_w)); + map(0xf830, 0xf830).w(FUNC(trckydoc_state::scroll_bg_w)); map(0xf838, 0xf83f).w(m_mainlatch, FUNC(ls259_device::write_d0)); } @@ -438,24 +761,24 @@ static const gfx_layout sauro_spritelayout = }; static GFXDECODE_START( gfx_sauro ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0, charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx3", 0, sauro_spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "bgtiles", 0, charlayout, 0, 64 ) + GFXDECODE_ENTRY( "fgtiles", 0, charlayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0, sauro_spritelayout, 0, 64 ) GFXDECODE_END static GFXDECODE_START( gfx_trckydoc ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0, trckydoc_spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "bgtiles", 0, charlayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0, trckydoc_spritelayout, 0, 64 ) GFXDECODE_END -void sauro_state::tecfri(machine_config &config) +void base_state::tecfri(machine_config &config) { // Basic machine hardware - Z80(config, m_maincpu, XTAL(20'000'000)/4); // Verified on PCB + Z80(config, m_maincpu, XTAL(20'000'000) / 4); // Verified on PCB LS259(config, m_mainlatch); - m_mainlatch->q_out_cb<4>().set(FUNC(sauro_state::irq_reset_w)); + m_mainlatch->q_out_cb<4>().set(FUNC(base_state::irq_reset_w)); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); @@ -468,73 +791,69 @@ void sauro_state::tecfri(machine_config &config) screen.set_size(32 * 8, 32 * 8); screen.set_visarea(1 * 8, 31 * 8 - 1, 2 * 8, 30 * 8 - 1); screen.set_palette(m_palette); - screen.screen_vblank().set(FUNC(sauro_state::vblank_irq)); + screen.screen_vblank().set(FUNC(base_state::vblank_irq)); PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 1024); // Sound hardware SPEAKER(config, "mono").front_center(); - YM3812(config, "ymsnd", XTAL(20'000'000)/8).add_route(ALL_OUTPUTS, "mono", 1.0); // Verified on PCB + YM3812(config, "ymsnd", XTAL(20'000'000) / 8).add_route(ALL_OUTPUTS, "mono", 1.0); // Verified on PCB } -void sauro_state::trckydoc(machine_config &config) +void trckydoc_state::trckydoc(machine_config &config) { tecfri(config); - m_maincpu->set_addrmap(AS_PROGRAM, &sauro_state::trckydoc_map); + m_maincpu->set_addrmap(AS_PROGRAM, &trckydoc_state::prg_map); - m_mainlatch->q_out_cb<1>().set(FUNC(sauro_state::flip_screen_w)); - m_mainlatch->q_out_cb<2>().set(FUNC(sauro_state::coin1_w)); - m_mainlatch->q_out_cb<3>().set(FUNC(sauro_state::coin2_w)); + m_mainlatch->q_out_cb<1>().set(FUNC(trckydoc_state::flip_screen_w)); + m_mainlatch->q_out_cb<2>().set(FUNC(trckydoc_state::coin_w<0>)); + m_mainlatch->q_out_cb<3>().set(FUNC(trckydoc_state::coin_w<1>)); GFXDECODE(config, m_gfxdecode, m_palette, gfx_trckydoc); - MCFG_VIDEO_START_OVERRIDE(sauro_state,trckydoc) - subdevice("screen")->set_screen_update(FUNC(sauro_state::screen_update_trckydoc)); + subdevice("screen")->set_screen_update(FUNC(trckydoc_state::screen_update)); } -void sauro_state::sauro(machine_config &config) +void sauro_state::saurobl(machine_config &config) { tecfri(config); - m_maincpu->set_addrmap(AS_PROGRAM, &sauro_state::sauro_map); - m_maincpu->set_addrmap(AS_IO, &sauro_state::sauro_io_map); + m_maincpu->set_addrmap(AS_PROGRAM, &sauro_state::main_prg_map); + m_maincpu->set_addrmap(AS_IO, &sauro_state::main_io_map); // Z3 m_mainlatch->q_out_cb<0>().set(FUNC(sauro_state::flip_screen_w)); - m_mainlatch->q_out_cb<1>().set(FUNC(sauro_state::coin1_w)); - m_mainlatch->q_out_cb<2>().set(FUNC(sauro_state::coin2_w)); + m_mainlatch->q_out_cb<1>().set(FUNC(sauro_state::coin_w<0>)); + m_mainlatch->q_out_cb<2>().set(FUNC(sauro_state::coin_w<1>)); m_mainlatch->q_out_cb<3>().set_nop(); // sound IRQ trigger? - m_mainlatch->q_out_cb<5>().set(FUNC(sauro_state::sauro_palette_bank0_w)); - m_mainlatch->q_out_cb<6>().set(FUNC(sauro_state::sauro_palette_bank1_w)); + m_mainlatch->q_out_cb<5>().set(FUNC(sauro_state::palette_bank0_w)); + m_mainlatch->q_out_cb<6>().set(FUNC(sauro_state::palette_bank1_w)); z80_device &audiocpu(Z80(config, "audiocpu", XTAL(20'000'000) / 5)); // Verified on PCB - audiocpu.set_addrmap(AS_PROGRAM, &sauro_state::sauro_sound_map); + audiocpu.set_addrmap(AS_PROGRAM, &sauro_state::saurobl_sound_map); audiocpu.set_periodic_int(FUNC(sauro_state::irq0_line_hold), attotime::from_hz(8 * 60)); // ? GFXDECODE(config, m_gfxdecode, m_palette, gfx_sauro); - MCFG_VIDEO_START_OVERRIDE(sauro_state, sauro) - subdevice("screen")->set_screen_update(FUNC(sauro_state::screen_update_sauro)); + subdevice("screen")->set_screen_update(FUNC(sauro_state::screen_update)); GENERIC_LATCH_8(config, m_soundlatch); subdevice("ymsnd")->set_clock(XTAL(20'000'000) / 5); // Verified on PCB - - SP0256(config, m_sp0256, XTAL(20'000'000) / 5); // Verified on PCB - m_sp0256->data_request_callback().set_inputline("audiocpu", INPUT_LINE_NMI); - m_sp0256->add_route(ALL_OUTPUTS, "mono", 1.0); } -void sauro_state::saurobl(machine_config &config) +void sauro_state::sauro(machine_config &config) { - sauro(config); + saurobl(config); - subdevice("audiocpu")->set_addrmap(AS_PROGRAM, &sauro_state::saurobl_sound_map); + subdevice("audiocpu")->set_addrmap(AS_PROGRAM, &sauro_state::sauro_sound_map); // Sound hardware - config.device_remove("speech"); + sp0256_device &sp0256(SP0256(config, "speech", XTAL(20'000'000) / 5)); // Verified on PCB + sp0256.data_request_callback().set_inputline("audiocpu", INPUT_LINE_NMI); + sp0256.add_route(ALL_OUTPUTS, "mono", 1.0); } /*************************************************************************** @@ -551,15 +870,15 @@ ROM_START( sauro ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "sauro-3.bin", 0x00000, 0x8000, CRC(0d501e1b) SHA1(20a56ff30d4fa5d2f483a449703b49153839f6bc) ) - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "sauro-6.bin", 0x00000, 0x8000, CRC(4b77cb0f) SHA1(7b9cb2dca561d81390106c1a5c0533dcecaf6f1a) ) ROM_LOAD( "sauro-7.bin", 0x08000, 0x8000, CRC(187da060) SHA1(1df156e58379bb39acade02aabab6ff1cb7cc288) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "fgtiles", 0 ) ROM_LOAD( "sauro-4.bin", 0x00000, 0x8000, CRC(9b617cda) SHA1(ce26b84ad5ecd6185ae218520e9972645bbf09ad) ) ROM_LOAD( "sauro-5.bin", 0x08000, 0x8000, CRC(a6e2640d) SHA1(346ffcf62e27ce8134f4e5e0dbcf11f110e19e04) ) - ROM_REGION( 0x20000, "gfx3", 0 ) + ROM_REGION( 0x20000, "sprites", 0 ) ROM_LOAD( "sauro-8.bin", 0x00000, 0x8000, CRC(e08b5d5e) SHA1(eaaeaa08b19c034ab2a2140f887edffca5f441b9) ) ROM_LOAD( "sauro-9.bin", 0x08000, 0x8000, CRC(7c707195) SHA1(0529f6808b0cec3e12ca51bee189841d21577786) ) ROM_LOAD( "sauro-10.bin", 0x10000, 0x8000, CRC(c93380d1) SHA1(fc9655cc94c2d2058f83eb341be7e7856a08194f) ) @@ -583,15 +902,15 @@ ROM_START( sauroa ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "sauro-3.bin", 0x00000, 0x8000, CRC(0d501e1b) SHA1(20a56ff30d4fa5d2f483a449703b49153839f6bc) ) - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "sauro-6.bin", 0x00000, 0x8000, CRC(4b77cb0f) SHA1(7b9cb2dca561d81390106c1a5c0533dcecaf6f1a) ) ROM_LOAD( "sauro-7.bin", 0x08000, 0x8000, CRC(187da060) SHA1(1df156e58379bb39acade02aabab6ff1cb7cc288) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "fgtiles", 0 ) ROM_LOAD( "sauro-4.bin", 0x00000, 0x8000, CRC(9b617cda) SHA1(ce26b84ad5ecd6185ae218520e9972645bbf09ad) ) ROM_LOAD( "sauro-5.bin", 0x08000, 0x8000, CRC(a6e2640d) SHA1(346ffcf62e27ce8134f4e5e0dbcf11f110e19e04) ) - ROM_REGION( 0x20000, "gfx3", 0 ) + ROM_REGION( 0x20000, "sprites", 0 ) ROM_LOAD( "sauro-8.bin", 0x00000, 0x8000, CRC(e08b5d5e) SHA1(eaaeaa08b19c034ab2a2140f887edffca5f441b9) ) ROM_LOAD( "sauro-9.bin", 0x08000, 0x8000, CRC(7c707195) SHA1(0529f6808b0cec3e12ca51bee189841d21577786) ) ROM_LOAD( "sauro-10.bin", 0x10000, 0x8000, CRC(c93380d1) SHA1(fc9655cc94c2d2058f83eb341be7e7856a08194f) ) @@ -615,15 +934,15 @@ ROM_START( saurob ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "3 tecfri", 0x00000, 0x8000, CRC(3eca1c5c) SHA1(0a16ddfbc3bb948023456f1c9a32593cbca5d9b0) ) - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "6 tecfri", 0x00000, 0x8000, CRC(4b77cb0f) SHA1(7b9cb2dca561d81390106c1a5c0533dcecaf6f1a) ) ROM_LOAD( "7 tecfri", 0x08000, 0x8000, CRC(187da060) SHA1(1df156e58379bb39acade02aabab6ff1cb7cc288) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "fgtiles", 0 ) ROM_LOAD( "4 tecfri", 0x00000, 0x8000, CRC(9b617cda) SHA1(ce26b84ad5ecd6185ae218520e9972645bbf09ad) ) ROM_LOAD( "5 tecfri", 0x08000, 0x8000, CRC(a6e2640d) SHA1(346ffcf62e27ce8134f4e5e0dbcf11f110e19e04) ) - ROM_REGION( 0x20000, "gfx3", 0 ) + ROM_REGION( 0x20000, "sprites", 0 ) ROM_LOAD( "8 tecfri", 0x00000, 0x8000, CRC(e08b5d5e) SHA1(eaaeaa08b19c034ab2a2140f887edffca5f441b9) ) ROM_LOAD( "9 tecfri", 0x08000, 0x8000, CRC(7c707195) SHA1(0529f6808b0cec3e12ca51bee189841d21577786) ) ROM_LOAD( "10 tecfri", 0x10000, 0x8000, CRC(c93380d1) SHA1(fc9655cc94c2d2058f83eb341be7e7856a08194f) ) @@ -647,15 +966,15 @@ ROM_START( saurop ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "s3.5x", 0x00000, 0x8000, CRC(0d501e1b) SHA1(20a56ff30d4fa5d2f483a449703b49153839f6bc) ) - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "s6.7x", 0x00000, 0x8000, CRC(4b77cb0f) SHA1(7b9cb2dca561d81390106c1a5c0533dcecaf6f1a) ) ROM_LOAD( "s7.7z", 0x08000, 0x8000, CRC(187da060) SHA1(1df156e58379bb39acade02aabab6ff1cb7cc288) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "fgtiles", 0 ) ROM_LOAD( "s4.7h", 0x00000, 0x8000, CRC(9b617cda) SHA1(ce26b84ad5ecd6185ae218520e9972645bbf09ad) ) ROM_LOAD( "s5.7k", 0x08000, 0x8000, CRC(de5cd249) SHA1(e3752b88b539e1057a35619ffbad01720ab60d7d) ) - ROM_REGION( 0x20000, "gfx3", 0 ) + ROM_REGION( 0x20000, "sprites", 0 ) ROM_LOAD( "s8.10l", 0x00000, 0x8000, CRC(e08b5d5e) SHA1(eaaeaa08b19c034ab2a2140f887edffca5f441b9) ) ROM_LOAD( "s9.10p", 0x08000, 0x8000, CRC(7c707195) SHA1(0529f6808b0cec3e12ca51bee189841d21577786) ) ROM_LOAD( "s10.10r", 0x10000, 0x8000, CRC(c93380d1) SHA1(fc9655cc94c2d2058f83eb341be7e7856a08194f) ) @@ -679,15 +998,15 @@ ROM_START( saurorr ) // all roms have original Tecfri stickers ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "sauro-3.bin", 0x00000, 0x8000, CRC(0d501e1b) SHA1(20a56ff30d4fa5d2f483a449703b49153839f6bc) ) - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "sauro-6.bin", 0x00000, 0x8000, CRC(4b77cb0f) SHA1(7b9cb2dca561d81390106c1a5c0533dcecaf6f1a) ) ROM_LOAD( "sauro-7.bin", 0x08000, 0x8000, CRC(187da060) SHA1(1df156e58379bb39acade02aabab6ff1cb7cc288) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "fgtiles", 0 ) ROM_LOAD( "sauro-4.bin", 0x00000, 0x8000, CRC(9b617cda) SHA1(ce26b84ad5ecd6185ae218520e9972645bbf09ad) ) ROM_LOAD( "27256-5.bin", 0x08000, 0x8000, CRC(9aabdbe5) SHA1(ef008e368024f9377a8d2bc5863b01c63bc8f55b) ) // contains the changed license logo - ROM_REGION( 0x20000, "gfx3", 0 ) + ROM_REGION( 0x20000, "sprites", 0 ) ROM_LOAD( "sauro-8.bin", 0x00000, 0x8000, CRC(e08b5d5e) SHA1(eaaeaa08b19c034ab2a2140f887edffca5f441b9) ) ROM_LOAD( "sauro-9.bin", 0x08000, 0x8000, CRC(7c707195) SHA1(0529f6808b0cec3e12ca51bee189841d21577786) ) ROM_LOAD( "sauro-10.bin", 0x10000, 0x8000, CRC(c93380d1) SHA1(fc9655cc94c2d2058f83eb341be7e7856a08194f) ) @@ -711,15 +1030,15 @@ ROM_START( seawolft ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "tmm24256ap.bin", 0x00000, 0x8000, CRC(0d501e1b) SHA1(20a56ff30d4fa5d2f483a449703b49153839f6bc) ) // Same as parent - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "4.bin", 0x00000, 0x8000, CRC(4b77cb0f) SHA1(7b9cb2dca561d81390106c1a5c0533dcecaf6f1a) ) // Same as parent ROM_LOAD( "3.bin", 0x08000, 0x8000, CRC(883bb7d1) SHA1(7320e5cddb5c2127b3679b7bc72b273860d178b9) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "fgtiles", 0 ) ROM_LOAD( "6.bin", 0x00000, 0x8000, CRC(9b617cda) SHA1(ce26b84ad5ecd6185ae218520e9972645bbf09ad) ) // Same as parent ROM_LOAD( "5.bin", 0x08000, 0x8000, CRC(a6e2640d) SHA1(346ffcf62e27ce8134f4e5e0dbcf11f110e19e04) ) // Same as parent - ROM_REGION( 0x20000, "gfx3", 0 ) + ROM_REGION( 0x20000, "sprites", 0 ) ROM_LOAD( "10.bin", 0x00000, 0x8000, CRC(b93f5487) SHA1(a3f36793ded053db7b370bc54a1b59d7b0603590) ) ROM_LOAD( "9.bin", 0x08000, 0x8000, CRC(0964ac95) SHA1(acc55ed318adee33c76ac24002a0cd7d35f38d98) ) ROM_LOAD( "8.bin", 0x10000, 0x8000, CRC(e71726a9) SHA1(2ef83432eb02ea0849547e5cb2b2215b8e68d714) ) @@ -760,15 +1079,15 @@ ROM_START( saurobl ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "sauro03.16e", 0x00000, 0x8000, CRC(a30b60fc) SHA1(48ea586a333e42852a6c9a5df48b2f2ccace6d36) ) - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "sauro-6.bin", 0x00000, 0x8000, CRC(4b77cb0f) SHA1(7b9cb2dca561d81390106c1a5c0533dcecaf6f1a) ) // sauro06.16g ROM_LOAD( "sauro-7.bin", 0x08000, 0x8000, CRC(187da060) SHA1(1df156e58379bb39acade02aabab6ff1cb7cc288) ) // sauro07.18g - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "fgtiles", 0 ) ROM_LOAD( "sauro-4.bin", 0x00000, 0x8000, CRC(9b617cda) SHA1(ce26b84ad5ecd6185ae218520e9972645bbf09ad) ) // sauro04.7g ROM_LOAD( "sauro-5.bin", 0x08000, 0x8000, CRC(a6e2640d) SHA1(346ffcf62e27ce8134f4e5e0dbcf11f110e19e04) ) // sauro05.8g - ROM_REGION( 0x20000, "gfx3", 0 ) + ROM_REGION( 0x20000, "sprites", 0 ) ROM_LOAD( "sauro-8.bin", 0x00000, 0x8000, CRC(e08b5d5e) SHA1(eaaeaa08b19c034ab2a2140f887edffca5f441b9) ) // sauro08.9j ROM_LOAD( "sauro-9.bin", 0x08000, 0x8000, CRC(7c707195) SHA1(0529f6808b0cec3e12ca51bee189841d21577786) ) // sauro09.11j ROM_LOAD( "sauro-10.bin", 0x10000, 0x8000, CRC(c93380d1) SHA1(fc9655cc94c2d2058f83eb341be7e7856a08194f) ) // sauro10.12j @@ -789,17 +1108,17 @@ ROM_START( trckydoc ) ROM_LOAD( "trckydoc.d9", 0x0000, 0x8000, CRC(c6242fc3) SHA1(c8a6f6abe8b51061a113ed75fead0479df68ec40) ) ROM_LOAD( "trckydoc.b9", 0x8000, 0x8000, CRC(8645c840) SHA1(79c2acfc1aeafbe94afd9d230200bd7cdd7bcd1b) ) - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "trckydoc.e6", 0x00000, 0x8000, CRC(ec326392) SHA1(e6954fecc501a821caa21e67597914519fbbe58f) ) ROM_LOAD( "trckydoc.g6", 0x08000, 0x8000, CRC(6a65c088) SHA1(4a70c104809d86b4eef6cc0df9452966fe7c9859) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "sprites", 0 ) ROM_LOAD( "trckydoc.h1", 0x00000, 0x4000, CRC(8b73cbf3) SHA1(d10f79a38c1596c90bac9cf4c64ba38ae6ecd8cb) ) ROM_LOAD( "trckydoc.e1", 0x04000, 0x4000, CRC(841be98e) SHA1(82da07490b73edcbffc3b9247205aab3a1f7d7ad) ) ROM_LOAD( "trckydoc.c1", 0x08000, 0x4000, CRC(1d25574b) SHA1(924e4376a7fe6cdfff0fa6045aaa3f7c0633d275) ) ROM_LOAD( "trckydoc.a1", 0x0c000, 0x4000, CRC(436c59ba) SHA1(2aa9c155c432a3c81420520c53bb944dcc613a94) ) - ROM_REGION( 0x0c00, "proms", 0 ) // colour proms + ROM_REGION( 0x0c00, "proms", 0 ) // colour PROMs ROM_LOAD( "tdclr3.prm", 0x0000, 0x0100, CRC(671d0140) SHA1(7d5fcd9589c46590b0a240cac428f993201bec2a) ) ROM_LOAD( "tdclr2.prm", 0x0400, 0x0100, CRC(874f9050) SHA1(db40d68f5166657fce0eadcd82143112b0388894) ) ROM_LOAD( "tdclr1.prm", 0x0800, 0x0100, CRC(57f127b0) SHA1(3d2b18a7a31933579f06d92fa0cc3f0e1fe8b98a) ) @@ -813,17 +1132,17 @@ ROM_START( trckydoca ) ROM_LOAD( "trckydca.d9", 0x0000, 0x8000, CRC(99c38aa4) SHA1(298a19439cc17743e10d101c50a26b9a7348299e) ) ROM_LOAD( "trckydca.b9", 0x8000, 0x8000, CRC(b6048a15) SHA1(d982fafbfa391ef9bab50bfd52607494e2a9eedf) ) - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "bgtiles", 0 ) ROM_LOAD( "trckydoc.e6", 0x00000, 0x8000, CRC(ec326392) SHA1(e6954fecc501a821caa21e67597914519fbbe58f) ) ROM_LOAD( "trckydoc.g6", 0x08000, 0x8000, CRC(6a65c088) SHA1(4a70c104809d86b4eef6cc0df9452966fe7c9859) ) - ROM_REGION( 0x10000, "gfx2", 0 ) + ROM_REGION( 0x10000, "sprites", 0 ) ROM_LOAD( "trckydoc.h1", 0x00000, 0x4000, CRC(8b73cbf3) SHA1(d10f79a38c1596c90bac9cf4c64ba38ae6ecd8cb) ) ROM_LOAD( "trckydoc.e1", 0x04000, 0x4000, CRC(841be98e) SHA1(82da07490b73edcbffc3b9247205aab3a1f7d7ad) ) ROM_LOAD( "trckydoc.c1", 0x08000, 0x4000, CRC(1d25574b) SHA1(924e4376a7fe6cdfff0fa6045aaa3f7c0633d275) ) ROM_LOAD( "trckydoc.a1", 0x0c000, 0x4000, CRC(436c59ba) SHA1(2aa9c155c432a3c81420520c53bb944dcc613a94) ) - ROM_REGION( 0x0c00, "proms", 0 ) // colour proms + ROM_REGION( 0x0c00, "proms", 0 ) // colour PROMs ROM_LOAD( "tdclr3.prm", 0x0000, 0x0100, CRC(671d0140) SHA1(7d5fcd9589c46590b0a240cac428f993201bec2a) ) ROM_LOAD( "tdclr2.prm", 0x0400, 0x0100, CRC(874f9050) SHA1(db40d68f5166657fce0eadcd82143112b0388894) ) ROM_LOAD( "tdclr1.prm", 0x0800, 0x0100, CRC(57f127b0) SHA1(3d2b18a7a31933579f06d92fa0cc3f0e1fe8b98a) ) @@ -832,24 +1151,16 @@ ROM_START( trckydoca ) ROM_LOAD( "tdprm.prm", 0x0000, 0x0200, CRC(5261bc11) SHA1(1cc7a9a7376e65f4587b75ef9382049458656372) ) ROM_END -void sauro_state::init_tecfri() -{ - /* This game doesn't like all memory to be initialized to zero, it won't - initialize the high scores */ - - uint8_t *RAM = memregion("maincpu")->base(); +} // anonymous namespace - memset(&RAM[0xe000], 0, 0x100); - RAM[0xe000] = 1; -} -GAME( 1987, sauro, 0, sauro, tecfri, sauro_state, init_tecfri, ROT0, "Tecfri", "Sauro (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, sauroa, sauro, sauro, tecfri, sauro_state, init_tecfri, ROT0, "Tecfri", "Sauro (set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, saurob, sauro, sauro, tecfri, sauro_state, init_tecfri, ROT0, "Tecfri", "Sauro (set 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, saurop, sauro, sauro, tecfri, sauro_state, init_tecfri, ROT0, "Tecfri (Philko license)", "Sauro (Philko license)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, saurorr, sauro, sauro, tecfri, sauro_state, init_tecfri, ROT0, "Tecfri (Recreativos Real S.A. license)","Sauro (Recreativos Real S.A. license)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, saurobl, sauro, saurobl, saurobl, sauro_state, init_tecfri, ROT0, "bootleg", "Sauro (bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, seawolft, sauro, sauro, tecfri, sauro_state, init_tecfri, ROT0, "Tecfri", "Sea Wolf (Tecfri)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, sauro, 0, sauro, tecfri, sauro_state, empty_init, ROT0, "Tecfri", "Sauro (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, sauroa, sauro, sauro, tecfri, sauro_state, empty_init, ROT0, "Tecfri", "Sauro (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, saurob, sauro, sauro, tecfri, sauro_state, empty_init, ROT0, "Tecfri", "Sauro (set 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, saurop, sauro, sauro, tecfri, sauro_state, empty_init, ROT0, "Tecfri (Philko license)", "Sauro (Philko license)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, saurorr, sauro, sauro, tecfri, sauro_state, empty_init, ROT0, "Tecfri (Recreativos Real S.A. license)","Sauro (Recreativos Real S.A. license)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, saurobl, sauro, saurobl, saurobl, sauro_state, empty_init, ROT0, "bootleg", "Sauro (bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, seawolft, sauro, sauro, tecfri, sauro_state, empty_init, ROT0, "Tecfri", "Sea Wolf (Tecfri)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, trckydoc, 0, trckydoc, tecfri, sauro_state, init_tecfri, ROT0, "Tecfri", "Tricky Doc (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, trckydoca,trckydoc, trckydoc, trckydoca, sauro_state, init_tecfri, ROT0, "Tecfri", "Tricky Doc (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, trckydoc, 0, trckydoc, tecfri, trckydoc_state, empty_init, ROT0, "Tecfri", "Tricky Doc (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1987, trckydoca, trckydoc, trckydoc, trckydoca, trckydoc_state, empty_init, ROT0, "Tecfri", "Tricky Doc (set 2)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/tecfri/sauro.h b/src/mame/tecfri/sauro.h deleted file mode 100644 index 1ff057db168..00000000000 --- a/src/mame/tecfri/sauro.h +++ /dev/null @@ -1,99 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari -#ifndef MAME_INCLUDES_SAURO_H -#define MAME_INCLUDES_SAURO_H - -#pragma once - -#include "machine/74259.h" -#include "machine/gen_latch.h" -#include "sound/sp0256.h" -#include "emupal.h" -#include "tilemap.h" - -class sauro_state : public driver_device -{ -public: - sauro_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_sp0256(*this, "speech"), - m_mainlatch(*this, "mainlatch"), - m_soundlatch(*this, "soundlatch"), - m_spriteram(*this, "spriteram"), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_videoram2(*this, "videoram2"), - m_colorram2(*this, "colorram2") - { } - - void trckydoc(machine_config &config); - void tecfri(machine_config &config); - void sauro(machine_config &config); - void saurobl(machine_config &config); - - void init_tecfri(); - -private: - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - optional_device m_sp0256; - optional_device m_mainlatch; - optional_device m_soundlatch; // sauro only - - required_shared_ptr m_spriteram; - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - optional_shared_ptr m_videoram2; - optional_shared_ptr m_colorram2; - - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - uint8_t m_palette_bank = 0; - - bool m_irq_enable = 0; - - virtual void machine_start() override; - - // common - DECLARE_WRITE_LINE_MEMBER(vblank_irq); - DECLARE_WRITE_LINE_MEMBER(irq_reset_w); - DECLARE_WRITE_LINE_MEMBER(coin1_w); - DECLARE_WRITE_LINE_MEMBER(coin2_w); - DECLARE_WRITE_LINE_MEMBER(flip_screen_w); - void videoram_w(offs_t offset, uint8_t data); - void colorram_w(offs_t offset, uint8_t data); - void scroll_bg_w(uint8_t data); - - // sauro specific - void sauro_sound_command_w(uint8_t data); - uint8_t sauro_sound_command_r(); - DECLARE_WRITE_LINE_MEMBER(sauro_palette_bank0_w); - DECLARE_WRITE_LINE_MEMBER(sauro_palette_bank1_w); - void sauro_scroll_fg_w(uint8_t data); - void sauro_videoram2_w(offs_t offset, uint8_t data); - void sauro_colorram2_w(offs_t offset, uint8_t data); - void adpcm_w(uint8_t data); - - TILE_GET_INFO_MEMBER(get_tile_info_bg); - TILE_GET_INFO_MEMBER(get_tile_info_fg); - - DECLARE_VIDEO_START(trckydoc); - DECLARE_VIDEO_START(sauro); - - uint32_t screen_update_trckydoc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_sauro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void sauro_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - void trckydoc_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - - void sauro_io_map(address_map &map); - void sauro_map(address_map &map); - void sauro_sound_map(address_map &map); - void saurobl_sound_map(address_map &map); - void trckydoc_map(address_map &map); -}; - -#endif // MAME_INCLUDES_SAURO_H diff --git a/src/mame/tecfri/sauro_v.cpp b/src/mame/tecfri/sauro_v.cpp deleted file mode 100644 index 2f2779efcd0..00000000000 --- a/src/mame/tecfri/sauro_v.cpp +++ /dev/null @@ -1,233 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari -/*************************************************************************** - - sauro.cpp - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "sauro.h" - -/* General */ - -void sauro_state::videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void sauro_state::colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void sauro_state::sauro_videoram2_w(offs_t offset, uint8_t data) -{ - m_videoram2[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset); -} - -void sauro_state::sauro_colorram2_w(offs_t offset, uint8_t data) -{ - m_colorram2[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset); -} - -void sauro_state::scroll_bg_w(uint8_t data) -{ - m_bg_tilemap->set_scrollx(0, data); -} - -TILE_GET_INFO_MEMBER(sauro_state::get_tile_info_bg) -{ - int code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x07) << 8); - int color = ((m_colorram[tile_index] >> 4) & 0x0f) | m_palette_bank; - int flags = m_colorram[tile_index] & 0x08 ? TILE_FLIPX : 0; - - tileinfo.set(0, code, color, flags); -} - -TILE_GET_INFO_MEMBER(sauro_state::get_tile_info_fg) -{ - int code = m_videoram2[tile_index] + ((m_colorram2[tile_index] & 0x07) << 8); - int color = ((m_colorram2[tile_index] >> 4) & 0x0f) | m_palette_bank; - int flags = m_colorram2[tile_index] & 0x08 ? TILE_FLIPX : 0; - - tileinfo.set(1, code, color, flags); -} - -/* Sauro */ - -static const int scroll2_map[8] = {2, 1, 4, 3, 6, 5, 0, 7}; -static const int scroll2_map_flip[8] = {0, 7, 2, 1, 4, 3, 6, 5}; - -WRITE_LINE_MEMBER(sauro_state::sauro_palette_bank0_w) -{ - if (state) - m_palette_bank |= 0x10; - else - m_palette_bank &= ~0x10; - machine().tilemap().mark_all_dirty(); -} - -WRITE_LINE_MEMBER(sauro_state::sauro_palette_bank1_w) -{ - if (state) - m_palette_bank |= 0x20; - else - m_palette_bank &= ~0x20; - machine().tilemap().mark_all_dirty(); -} - -void sauro_state::sauro_scroll_fg_w(uint8_t data) -{ - const int *map = (flip_screen() ? scroll2_map_flip : scroll2_map); - int scroll = (data & 0xf8) | map[data & 7]; - - m_fg_tilemap->set_scrollx(0, scroll); -} - -VIDEO_START_MEMBER(sauro_state,sauro) -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sauro_state::get_tile_info_bg)), TILEMAP_SCAN_COLS, - 8, 8, 32, 32); - - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sauro_state::get_tile_info_fg)), TILEMAP_SCAN_COLS, - 8, 8, 32, 32); - - m_fg_tilemap->set_transparent_pen(0); - m_palette_bank = 0; - - save_item(NAME(m_palette_bank)); -} - -void sauro_state::sauro_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - uint8_t *spriteram = m_spriteram; - int offs,code,sx,sy,color,flipx; - int flipy = flip_screen(); - - for (offs = 3; offs < m_spriteram.bytes() - 1; offs += 4) - { - sy = spriteram[offs]; - if (sy == 0xf8) continue; - - code = spriteram[offs+1] + ((spriteram[offs+3] & 0x03) << 8); - sx = spriteram[offs+2]; - sy = 236 - sy; - color = ((spriteram[offs+3] >> 4) & 0x0f) | m_palette_bank; - - // I'm not really sure how this bit works - if (spriteram[offs+3] & 0x08) - { - if (sx > 0xc0) - { - // Sign extend - sx = (signed int)(signed char)sx; - } - } - else - { - if (sx < 0x40) continue; - } - - flipx = spriteram[offs+3] & 0x04; - - if (flipy) - { - flipx = !flipx; - sx = (235 - sx) & 0xff; // The &0xff is not 100% percent correct - sy = 240 - sy; - } - - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code, - color, - flipx, flipy, - sx,sy,0); - } -} - -uint32_t sauro_state::screen_update_sauro(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); - sauro_draw_sprites(bitmap, cliprect); - return 0; -} - -/* Tricky Doc */ - -VIDEO_START_MEMBER(sauro_state,trckydoc) -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sauro_state::get_tile_info_bg)), TILEMAP_SCAN_COLS, - 8, 8, 32, 32); - - m_palette_bank = 0; -} - -void sauro_state::trckydoc_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - uint8_t *spriteram = m_spriteram; - int offs,code,sy,color,flipx,sx; - int flipy = flip_screen(); - - /* Weird, sprites entries don't start on DWORD boundary */ - for (offs = 3; offs < m_spriteram.bytes() - 1; offs += 4) - { - sy = spriteram[offs]; - - if(spriteram[offs+3] & 0x08) - { - /* needed by the elevator cable (2nd stage), balls bouncing (3rd stage) and maybe other things */ - sy += 6; - } - - code = spriteram[offs+1] + ((spriteram[offs+3] & 0x01) << 8); - - sx = spriteram[offs+2]-2; - color = (spriteram[offs+3] >> 4) & 0x0f; - - sy = 236 - sy; - - /* similar to sauro but different bit is used .. */ - if (spriteram[offs+3] & 0x02) - { - if (sx > 0xc0) - { - /* Sign extend */ - sx = (signed int)(signed char)sx; - } - } - else - { - if (sx < 0x40) continue; - } - - flipx = spriteram[offs+3] & 0x04; - - if (flipy) - { - flipx = !flipx; - sx = (235 - sx) & 0xff; /* The &0xff is not 100% percent correct */ - sy = 240 - sy; - } - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code, - color, - flipx, flipy, - sx,sy,0); - } -} - -uint32_t sauro_state::screen_update_trckydoc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - trckydoc_draw_sprites(bitmap, cliprect); - return 0; -} diff --git a/src/mame/tecfri/speedbal.cpp b/src/mame/tecfri/speedbal.cpp index f25a1f94bf1..b52b5c25bd8 100644 --- a/src/mame/tecfri/speedbal.cpp +++ b/src/mame/tecfri/speedbal.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Joseba Epalza,Andreas Naive +// copyright-holders:Joseba Epalza, Andreas Naive + /*************************************************************************** Speed Ball / Music Ball @@ -30,16 +31,212 @@ Interrupt frequency on audio CPU is not a periodical signal, but there are a lot ***************************************************************************/ #include "emu.h" -#include "speedbal.h" #include "cpu/z80/z80.h" #include "sound/ymopl.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" #include "speedbal.lh" +// configurable logging +#define LOG_UNKWRITE (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_UNKWRITE) + +#include "logmacro.h" + +#define LOGUNKWRITE(...) LOGMASKED(LOG_UNKWRITE, __VA_ARGS__) + + +namespace { + +class speedbal_state : public driver_device +{ +public: + speedbal_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_spriteram(*this, "spriteram") + , m_background_videoram(*this, "bg_videoram") + , m_foreground_videoram(*this, "fg_videoram") + , m_digits(*this, "digit%u", 0U) + { } + + void speedbal(machine_config &config); + + void init_speedbal(); + void init_musicbal(); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + + required_shared_ptr m_spriteram; + required_shared_ptr m_background_videoram; + required_shared_ptr m_foreground_videoram; + output_finder<73> m_digits; + + bool m_leds_start = 0; + uint32_t m_leds_shiftreg = 0U; + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_fg_tilemap = nullptr; + + void coincounter_w(uint8_t data); + void foreground_videoram_w(offs_t offset, uint8_t data); + void background_videoram_w(offs_t offset, uint8_t data); + void maincpu_50_w(uint8_t data); + void leds_output_block(uint8_t data); + void leds_start_block(uint8_t data); + void leds_shift_bit(uint8_t data); + + TILE_GET_INFO_MEMBER(get_tile_info_bg); + TILE_GET_INFO_MEMBER(get_tile_info_fg); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_cpu_io_map(address_map &map); + void main_cpu_map(address_map &map); + void sound_cpu_io_map(address_map &map); + void sound_cpu_map(address_map &map); +}; + + +// video + +TILE_GET_INFO_MEMBER(speedbal_state::get_tile_info_bg) +{ + int const code = m_background_videoram[tile_index * 2] + ((m_background_videoram[tile_index * 2 + 1] & 0x30) << 4); + int const color = m_background_videoram[tile_index * 2 + 1] & 0x0f; + + tileinfo.set(1, code, color, 0); + tileinfo.group = (color == 8); +} + +TILE_GET_INFO_MEMBER(speedbal_state::get_tile_info_fg) +{ + int const code = m_foreground_videoram[tile_index * 2] + ((m_foreground_videoram[tile_index * 2 + 1] & 0x30) << 4); + int const color = m_foreground_videoram[tile_index * 2 + 1] & 0x0f; + + tileinfo.set(0, code, color, 0); + tileinfo.group = (color == 9); +} + +/************************************* + * * + * Start-Stop * + * * + *************************************/ + +void speedbal_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(speedbal_state::get_tile_info_bg)), TILEMAP_SCAN_COLS_FLIP_X, 16, 16, 16, 16); + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(speedbal_state::get_tile_info_fg)), TILEMAP_SCAN_COLS_FLIP_X, 8, 8, 32, 32); + + m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); // split type 0 is totally transparent in front half + m_bg_tilemap->set_transmask(1, 0x00f7, 0x0000); // split type 1 has pen 0-2, 4-7 transparent in front half + + m_fg_tilemap->set_transmask(0, 0xffff, 0x0001); // split type 0 is totally transparent in front half and has pen 0 transparent in back half + m_fg_tilemap->set_transmask(1, 0x0001, 0x0001); // split type 1 has pen 0 transparent in front and back half +} + + + +/************************************* + * * + * Foreground characters RAM * + * * + *************************************/ + +void speedbal_state::foreground_videoram_w(offs_t offset, uint8_t data) +{ + m_foreground_videoram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset >> 1); +} + +/************************************* + * * + * Background tiles RAM * + * * + *************************************/ + +void speedbal_state::background_videoram_w(offs_t offset, uint8_t data) +{ + m_background_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset >> 1); +} + + +/************************************* + * * + * Sprite drawing * + * * + *************************************/ + +void speedbal_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + // Drawing sprites: 64 in total + + for (int offset = 0; offset < m_spriteram.bytes(); offset += 4) + { + if (!(m_spriteram[offset + 2] & 0x80)) + continue; + + int x = 243 - m_spriteram[offset + 3]; + int y = 239 - m_spriteram[offset + 0]; + + int const code = (m_spriteram[offset + 1]) | ((m_spriteram[offset + 2] & 0x40) << 2); + + int const color = m_spriteram[offset + 2] & 0x0f; + + int flipx = 0, flipy = 0; + + if (flip_screen()) + { + x = 246 - x; + y = 238 - y; + flipx = flipy = 1; + } + + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + code, + color, + flipx, flipy, + x, y, 0); + } +} + +/************************************* + * * + * Refresh screen * + * * + *************************************/ + +uint32_t speedbal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); + m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); + draw_sprites(bitmap, cliprect); + m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); + m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); + return 0; +} + + +// machine + void speedbal_state::machine_start() { m_digits.resolve(); @@ -52,23 +249,23 @@ void speedbal_state::coincounter_w(uint8_t data) machine().bookkeeping().coin_counter_w(0, data & 0x80); machine().bookkeeping().coin_counter_w(1, data & 0x40); flip_screen_set(data & 8); // also changes data & 0x10 at the same time too (flipx and flipy?) - /* unknown: (data & 0x10) and (data & 4) */ + // unknown: (data & 0x10) and (data & 4) } void speedbal_state::main_cpu_map(address_map &map) { map(0x0000, 0xdbff).rom(); map(0xdc00, 0xdfff).ram().share("share1"); // shared with SOUND - map(0xe000, 0xe1ff).ram().w(FUNC(speedbal_state::background_videoram_w)).share("bg_videoram"); - map(0xe800, 0xefff).ram().w(FUNC(speedbal_state::foreground_videoram_w)).share("fg_videoram"); + map(0xe000, 0xe1ff).ram().w(FUNC(speedbal_state::background_videoram_w)).share(m_background_videoram); + map(0xe800, 0xefff).ram().w(FUNC(speedbal_state::foreground_videoram_w)).share(m_foreground_videoram); map(0xf000, 0xf5ff).ram().w(m_palette, FUNC(palette_device::write8)).share("palette"); map(0xf600, 0xfeff).ram(); - map(0xff00, 0xffff).ram().share("spriteram"); + map(0xff00, 0xffff).ram().share(m_spriteram); } void speedbal_state::maincpu_50_w(uint8_t data) { - //logerror("%s: maincpu_50_w %02x\n", machine().describe_context(), data); + LOGUNKWRITE("%s: maincpu_50_w %02x\n", machine().describe_context(), data); } void speedbal_state::main_cpu_io_map(address_map &map) @@ -101,7 +298,7 @@ void speedbal_state::leds_output_block(uint8_t data) // Each hypothetical led block has 3 7seg leds. // The shift register is 28 bits, led block number is in the upper bits // and the other 3 bytes in it go to each 7seg led of the current block. - int block = m_leds_shiftreg >> 24 & 7; + int const block = m_leds_shiftreg >> 24 & 7; m_digits[10 * block] = ~m_leds_shiftreg & 0xff; m_digits[10 * block + 1] = ~m_leds_shiftreg >> 8 & 0xff; m_digits[10 * block + 2] = ~m_leds_shiftreg >> 16 & 0xff; @@ -220,44 +417,44 @@ INPUT_PORTS_END static const gfx_layout charlayout = { - 8,8, /* 8*8 characters */ - RGN_FRAC(1,2), /* 1024 characters */ - 4, /* actually 2 bits per pixel - two of the planes are empty */ + 8,8, // 8*8 characters + RGN_FRAC(1,2), // 1024 characters + 4, // actually 2 bits per pixel - two of the planes are empty { RGN_FRAC(1,2)+4, RGN_FRAC(1,2)+0, 4, 0 }, { 8+3, 8+2, 8+1, 8+0, 3, 2, 1, 0 }, - { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, /* characters are rotated 90 degrees */ - 16*8 /* every char takes 16 bytes */ + { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 }, // characters are rotated 90 degrees + 16*8 // every char takes 16 bytes }; static const gfx_layout tilelayout = { - 16,16, /* 16*16 tiles */ - RGN_FRAC(1,1), /* 1024 tiles */ - 4, /* 4 bits per pixel */ - { 0, 2, 4, 6 }, /* the bitplanes are packed in one nibble */ + 16,16, // 16*16 tiles + RGN_FRAC(1,1), // 1024 tiles + 4, // 4 bits per pixel + { 0, 2, 4, 6 }, // the bitplanes are packed in one nibble { 0*8+0, 0*8+1, 7*8+0, 7*8+1, 6*8+0, 6*8+1, 5*8+0, 5*8+1, 4*8+0, 4*8+1, 3*8+0, 3*8+1, 2*8+0, 2*8+1, 1*8+0, 1*8+1 }, { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 }, - 128*8 /* every sprite takes 128 consecutive bytes */ + 128*8 // every sprite takes 128 consecutive bytes }; static const gfx_layout spritelayout = { - 16,16, /* 16*16 sprites */ - RGN_FRAC(1,1), /* 512 sprites */ - 4, /* 4 bits per pixel */ - { 0, 2, 4, 6 }, /* the bitplanes are packed in one nibble */ + 16,16, // 16*16 sprites + RGN_FRAC(1,1), // 512 sprites + 4, // 4 bits per pixel + { 0, 2, 4, 6 }, // the bitplanes are packed in one nibble { 7*8+1, 7*8+0, 6*8+1, 6*8+0, 5*8+1, 5*8+0, 4*8+1, 4*8+0, 3*8+1, 3*8+0, 2*8+1, 2*8+0, 1*8+1, 1*8+0, 0*8+1, 0*8+0 }, { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 }, - 128*8 /* every sprite takes 128 consecutive bytes */ + 128*8 // every sprite takes 128 consecutive bytes }; static GFXDECODE_START( gfx_speedbal ) - GFXDECODE_ENTRY( "chars", 0, charlayout, 256, 16 ) - GFXDECODE_ENTRY( "bgtiles", 0, tilelayout, 512, 16 ) + GFXDECODE_ENTRY( "chars", 0, charlayout, 256, 16 ) + GFXDECODE_ENTRY( "bgtiles", 0, tilelayout, 512, 16 ) GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 16 ) GFXDECODE_END @@ -265,21 +462,21 @@ GFXDECODE_END void speedbal_state::speedbal(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, XTAL(4'000'000)); // 4 MHz + // basic machine hardware + Z80(config, m_maincpu, XTAL(4'000'000)); m_maincpu->set_addrmap(AS_PROGRAM, &speedbal_state::main_cpu_map); m_maincpu->set_addrmap(AS_IO, &speedbal_state::main_cpu_io_map); m_maincpu->set_vblank_int("screen", FUNC(speedbal_state::irq0_line_hold)); - z80_device &audiocpu(Z80(config, "audiocpu", XTAL(4'000'000))); // 4 MHz + z80_device &audiocpu(Z80(config, "audiocpu", XTAL(4'000'000))); audiocpu.set_addrmap(AS_PROGRAM, &speedbal_state::sound_cpu_map); audiocpu.set_addrmap(AS_IO, &speedbal_state::sound_cpu_io_map); - audiocpu.set_periodic_int(FUNC(speedbal_state::irq0_line_hold), attotime::from_hz(1000/2)); // approximate? + audiocpu.set_periodic_int(FUNC(speedbal_state::irq0_line_hold), attotime::from_hz(1000 / 2)); // approximate? - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(56.4); // measured - screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate 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(speedbal_state::screen_update)); @@ -288,7 +485,7 @@ void speedbal_state::speedbal(machine_config &config) GFXDECODE(config, m_gfxdecode, m_palette, gfx_speedbal); PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 768).set_endianness(ENDIANNESS_BIG); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); YM3812(config, "ymsnd", XTAL(4'000'000)).add_route(ALL_OUTPUTS, "mono", 1.0); // 4 MHz(?) @@ -298,16 +495,16 @@ void speedbal_state::speedbal(machine_config &config) void speedbal_state::init_speedbal() { // sprite tiles are in an odd order, rearrange to simplify video drawing function - uint8_t* rom = memregion("sprites")->base(); - uint8_t temp[0x200*128]; + uint8_t *rom = memregion("sprites")->base(); + uint8_t temp[0x200 * 128]; for (int i = 0; i < 0x200; i++) { - int j = bitswap<16>(i, 15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7); - memcpy(temp + i*128, rom + j*128, 128); + int j = bitswap<16>(i, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 7); + memcpy(temp + i * 128, rom + j * 128, 128); } - memcpy(rom,temp,0x200*128); + memcpy(rom, temp, 0x200 * 128); } @@ -318,7 +515,7 @@ void speedbal_state::init_speedbal() ***************************************************************************/ -ROM_START( speedbal ) // seems to have a more complete hidden test mode, with a 'hard test' that's not enabled in the alternate Speed Ball rom set +ROM_START( speedbal ) // seems to have a more complete hidden test mode, with a 'hard test' that's not enabled in the alternate Speed Ball ROM set ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "1.u14", 0x0000, 0x8000, CRC(94c6f107) SHA1(cd7ada17f0f59623cf615df68c5f8f4077377820) ) ROM_LOAD( "3.u15", 0x8000, 0x8000, CRC(a036687f) SHA1(fc2cd683cd6a9a75ab6b188f7b4592b355a569e0) ) @@ -387,7 +584,7 @@ ROM_END void speedbal_state::init_musicbal() { - uint8_t* rom = memregion("maincpu")->base(); + uint8_t *rom = memregion("maincpu")->base(); const uint8_t xorTable[8] = {0x05, 0x06, 0x84, 0x84, 0x00, 0x87, 0x84, 0x84}; // XORs affecting bits #0, #1, #2 & #7 const int swapTable[4][4] = { // 4 possible swaps affecting bits #0, #1, #2 & #7 @@ -397,21 +594,22 @@ void speedbal_state::init_musicbal() {0,2,1,7} }; - for (int i=0;i<0x8000;i++) + for (int i = 0; i < 0x8000; i++) { - int addIdx = BIT(i,3)^(BIT(i,5)<<1)^(BIT(i,9)<<2); // 3 bits of address... - int xorMask = xorTable[addIdx]; // ... control the xor... - int bswIdx = xorMask & 3; // ... and the bitswap + int addIdx = BIT(i, 3) ^ (BIT(i, 5) << 1) ^ (BIT(i, 9) << 2); // 3 bits of address... + int xorMask = xorTable[addIdx]; // ... control the XOR... + int bswIdx = xorMask & 3; // ... and the bitswap // only bits #0, #1, #2 & #7 are affected - rom[i] = bitswap<8>(rom[i], swapTable[bswIdx][3], 6,5,4,3, swapTable[bswIdx][2], swapTable[bswIdx][1], swapTable[bswIdx][0]) ^ xorTable[addIdx]; + rom[i] = bitswap<8>(rom[i], swapTable[bswIdx][3], 6, 5, 4, 3, swapTable[bswIdx][2], swapTable[bswIdx][1], swapTable[bswIdx][0]) ^ xorTable[addIdx]; } init_speedbal(); } +} // anonymous namespace GAMEL( 1987, speedbal, 0, speedbal, speedbal, speedbal_state, init_speedbal, ROT270, "Tecfri / Desystem S.A.", "Speed Ball (set 1)", MACHINE_SUPPORTS_SAVE, layout_speedbal ) GAMEL( 1987, speedbala, speedbal, speedbal, speedbal, speedbal_state, init_speedbal, ROT270, "Tecfri / Desystem S.A.", "Speed Ball (set 2)", MACHINE_SUPPORTS_SAVE, layout_speedbal ) -GAMEL( 1988, musicbal, 0, speedbal, musicbal, speedbal_state, init_musicbal, ROT270, "Tecfri / Desystem S.A.", "Music Ball", MACHINE_SUPPORTS_SAVE, layout_speedbal ) +GAMEL( 1988, musicbal, 0, speedbal, musicbal, speedbal_state, init_musicbal, ROT270, "Tecfri / Desystem S.A.", "Music Ball", MACHINE_SUPPORTS_SAVE, layout_speedbal ) diff --git a/src/mame/tecfri/speedbal.h b/src/mame/tecfri/speedbal.h deleted file mode 100644 index 0b199ea67bc..00000000000 --- a/src/mame/tecfri/speedbal.h +++ /dev/null @@ -1,69 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Joseba Epalza -#ifndef MAME_INCLUDES_SPEEDBAL_H -#define MAME_INCLUDES_SPEEDBAL_H - -#pragma once - -#include "emupal.h" -#include "tilemap.h" - -class speedbal_state : public driver_device -{ -public: - speedbal_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_gfxdecode(*this, "gfxdecode") - , m_palette(*this, "palette") - , m_spriteram(*this, "spriteram") - , m_background_videoram(*this, "bg_videoram") - , m_foreground_videoram(*this, "fg_videoram") - , m_digits(*this, "digit%u", 0U) - { } - - void speedbal(machine_config &config); - - void init_speedbal(); - void init_musicbal(); - -protected: - virtual void machine_start() override; - virtual void video_start() override; - -private: - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - - required_shared_ptr m_spriteram; - required_shared_ptr m_background_videoram; - required_shared_ptr m_foreground_videoram; - output_finder<73> m_digits; - - bool m_leds_start = 0; - uint32_t m_leds_shiftreg = 0; - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - - void coincounter_w(uint8_t data); - void foreground_videoram_w(offs_t offset, uint8_t data); - void background_videoram_w(offs_t offset, uint8_t data); - void maincpu_50_w(uint8_t data); - void leds_output_block(uint8_t data); - void leds_start_block(uint8_t data); - void leds_shift_bit(uint8_t data); - - TILE_GET_INFO_MEMBER(get_tile_info_bg); - TILE_GET_INFO_MEMBER(get_tile_info_fg); - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - - void main_cpu_io_map(address_map &map); - void main_cpu_map(address_map &map); - void sound_cpu_io_map(address_map &map); - void sound_cpu_map(address_map &map); -}; - -#endif // MAME_INCLUDES_SPEEDBAL_H diff --git a/src/mame/tecfri/speedbal_v.cpp b/src/mame/tecfri/speedbal_v.cpp deleted file mode 100644 index ad6ee09e803..00000000000 --- a/src/mame/tecfri/speedbal_v.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Joseba Epalza -/**************************************************************************** - * * - * Speed Ball * - * * - * Functions to emulate the video hardware of the machine. * - * * - ****************************************************************************/ - -#include "emu.h" -#include "speedbal.h" - - -TILE_GET_INFO_MEMBER(speedbal_state::get_tile_info_bg) -{ - int code = m_background_videoram[tile_index*2] + ((m_background_videoram[tile_index*2+1] & 0x30) << 4); - int color = m_background_videoram[tile_index*2+1] & 0x0f; - - tileinfo.set(1, code, color, 0); - tileinfo.group = (color == 8); -} - -TILE_GET_INFO_MEMBER(speedbal_state::get_tile_info_fg) -{ - int code = m_foreground_videoram[tile_index*2] + ((m_foreground_videoram[tile_index*2+1] & 0x30) << 4); - int color = m_foreground_videoram[tile_index*2+1] & 0x0f; - - tileinfo.set(0, code, color, 0); - tileinfo.group = (color == 9); -} - -/************************************* - * * - * Start-Stop * - * * - *************************************/ - -void speedbal_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(speedbal_state::get_tile_info_bg)), TILEMAP_SCAN_COLS_FLIP_X, 16, 16, 16, 16); - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(speedbal_state::get_tile_info_fg)), TILEMAP_SCAN_COLS_FLIP_X, 8, 8, 32, 32); - - m_bg_tilemap->set_transmask(0,0xffff,0x0000); /* split type 0 is totally transparent in front half */ - m_bg_tilemap->set_transmask(1,0x00f7,0x0000); /* split type 1 has pen 0-2, 4-7 transparent in front half */ - - m_fg_tilemap->set_transmask(0,0xffff,0x0001); /* split type 0 is totally transparent in front half and has pen 0 transparent in back half */ - m_fg_tilemap->set_transmask(1,0x0001,0x0001); /* split type 1 has pen 0 transparent in front and back half */ -} - - - -/************************************* - * * - * Foreground characters RAM * - * * - *************************************/ - -void speedbal_state::foreground_videoram_w(offs_t offset, uint8_t data) -{ - m_foreground_videoram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset>>1); -} - -/************************************* - * * - * Background tiles RAM * - * * - *************************************/ - -void speedbal_state::background_videoram_w(offs_t offset, uint8_t data) -{ - m_background_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset>>1); -} - - -/************************************* - * * - * Sprite drawing * - * * - *************************************/ - -void speedbal_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int x,y,code,color,offset,flipx,flipy; - - /* Drawing sprites: 64 in total */ - - for (offset = 0;offset < m_spriteram.bytes();offset += 4) - { - if(!(m_spriteram[offset + 2] & 0x80)) - continue; - - x = 243 - m_spriteram[offset + 3]; - y = 239 - m_spriteram[offset + 0]; - - code = (m_spriteram[offset + 1]) | ((m_spriteram[offset + 2] & 0x40) << 2); - - color = m_spriteram[offset + 2] & 0x0f; - - flipx = flipy = 0; - - if(flip_screen()) - { - x = 246 - x; - y = 238 - y; - flipx = flipy = 1; - } - - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code, - color, - flipx,flipy, - x,y,0); - } -} - -/************************************* - * * - * Refresh screen * - * * - *************************************/ - -uint32_t speedbal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); - m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); - draw_sprites(bitmap, cliprect); - m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); - m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); - return 0; -} -- cgit v1.2.3