From b3225de898347772c504511b72e1df6c973f82c8 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Sat, 14 May 2022 08:12:49 +0200 Subject: [PATCH] vball.cpp: used finder for memory bank and other small cleanups --- scripts/target/mame/arcade.lua | 2 - src/mame/drivers/vball.cpp | 464 ++++++++++++++++++++++++--------- src/mame/includes/vball.h | 72 ----- src/mame/video/vball.cpp | 166 ------------ 4 files changed, 346 insertions(+), 358 deletions(-) delete mode 100644 src/mame/includes/vball.h delete mode 100644 src/mame/video/vball.cpp diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 2c0a5914377..85b566f0e97 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -4269,8 +4269,6 @@ files { MAME_DIR .. "src/mame/includes/tagteam.h", MAME_DIR .. "src/mame/video/tagteam.cpp", MAME_DIR .. "src/mame/drivers/vball.cpp", - MAME_DIR .. "src/mame/includes/vball.h", - MAME_DIR .. "src/mame/video/vball.cpp", MAME_DIR .. "src/mame/drivers/wwfsstar.cpp", MAME_DIR .. "src/mame/includes/wwfsstar.h", MAME_DIR .. "src/mame/video/wwfsstar.cpp", diff --git a/src/mame/drivers/vball.cpp b/src/mame/drivers/vball.cpp index 9f4b5e3c694..d2f28fbe89e 100644 --- a/src/mame/drivers/vball.cpp +++ b/src/mame/drivers/vball.cpp @@ -4,10 +4,6 @@ Championship VBall Driver by Paul "TBBle" Hampson - TODO: - Needs to be tilemapped. The background layer and sprite layer are identical to spdodgeb, except for the - back-switched graphics roms and the size of the palette banks. - 03/28/03 - Additions by Steve Ellenoff --------------------------------------- @@ -33,9 +29,9 @@ VBlank = 58Hz -2) X Line Scrolling doesn't work 100% when Flip Screen Dip is set -3) 2 Player Version - Dips for difficulty don't seem to work or just need more testing - -4) 2 Player Version - sound ROM is different and the adpcm chip is addressed differently - Changed it to use a rom that was dumped from original PCB (readme below), - this makes the non-working ROM not used - i don't know where it come from. + -4) 2 Player Version - sound ROM is different and the ADPCM chip is addressed differently + Changed it to use a ROM that was dumped from original PCB (readme below), + this makes the non-working ROM not used - I don't know where it came from. @@ -85,19 +81,250 @@ VBlank = 58Hz *********************************************************************************************************************/ #include "emu.h" -#include "includes/vball.h" #include "cpu/m6502/m6502.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" +#include "machine/timer.h" #include "sound/okim6295.h" #include "sound/ymopm.h" + +#include "emupal.h" +#include "screen.h" #include "speaker.h" +#include "tilemap.h" -#define MAIN_CLOCK XTAL(12'000'000) -#define CPU_CLOCK MAIN_CLOCK / 6 -#define PIXEL_CLOCK MAIN_CLOCK / 2 -/* Based on ddragon driver */ +// configurable logging +#define LOG_SCROLL (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_SCROLL) + +#include "logmacro.h" + +#define LOGSCROLL(...) LOGMASKED(LOG_SCROLL, __VA_ARGS__) + + +namespace { + +class vball_state : public driver_device +{ +public: + vball_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + + m_attribram(*this, "attribram"), + m_videoram(*this, "videoram"), + m_scrolly_lo(*this, "scrolly_lo"), + m_spriteram(*this, "spriteram"), + m_color_proms(*this, "color_proms"), + m_mainbank(*this, "mainbank") { } + + void vball(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + +private: + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + + required_shared_ptr m_attribram; + required_shared_ptr m_videoram; + required_shared_ptr m_scrolly_lo; + required_shared_ptr m_spriteram; + required_region_ptr m_color_proms; + required_memory_bank m_mainbank; + + uint16_t m_scrollx_hi = 0U; + uint16_t m_scrolly_hi = 0U; + uint8_t m_scrollx_lo = 0U; + uint8_t m_gfxset = 0U; + uint16_t m_scrollx[256]{}; + uint8_t m_bgprombank = 0U; + uint8_t m_spprombank = 0U; + tilemap_t *m_bg_tilemap = nullptr; + + void irq_ack_w(offs_t offset, uint8_t data); + void bankswitch_w(uint8_t data); + void scrollx_hi_w(uint8_t data); + void scrollx_lo_w(uint8_t data); + void videoram_w(offs_t offset, uint8_t data); + void attrib_w(offs_t offset, uint8_t data); + + TILEMAP_MAPPER_MEMBER(background_scan); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(vball_scanline); + void bgprombank_w(int bank); + void spprombank_w(int bank); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + inline int scanline_to_vcount(int scanline); + + void main_map(address_map &map); + void sound_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Video Hardware for Championship V'ball by Paul Hampson + Generally copied from China Gate by Paul Hampson + "Mainly copied from video of Double Dragon (bootleg) & Double Dragon II" + +***************************************************************************/ + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILEMAP_MAPPER_MEMBER(vball_state::background_scan) +{ + // logical (col, row) -> memory offset + return (col & 0x1f) + ((row & 0x1f) << 5) + ((col & 0x20) << 5) + ((row & 0x20) << 6); +} + +TILE_GET_INFO_MEMBER(vball_state::get_bg_tile_info) +{ + uint8_t code = m_videoram[tile_index]; + uint8_t attr = m_attribram[tile_index]; + tileinfo.set(0, + code + ((attr & 0x1f) << 8) + (m_gfxset << 8), + (attr >> 5) & 0x7, + 0); +} + + +void vball_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vball_state::get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(vball_state::background_scan)), 8, 8, 64, 64); + + m_bg_tilemap->set_scroll_rows(32); + m_gfxset = 0; + m_bgprombank = 0xff; + m_spprombank = 0xff; + + save_item(NAME(m_scrollx_hi)); + save_item(NAME(m_scrolly_hi)); + save_item(NAME(m_scrollx_lo)); + save_item(NAME(m_gfxset)); + save_item(NAME(m_scrollx)); + save_item(NAME(m_bgprombank)); + save_item(NAME(m_spprombank)); +} + +void vball_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void vball_state::attrib_w(offs_t offset, uint8_t data) +{ + m_attribram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void vball_state::bgprombank_w(int bank) +{ + if (bank == m_bgprombank) return; + + uint8_t *color_prom = &m_color_proms[bank * 0x80]; + + for (int i = 0; i < 128; i++, color_prom++) + m_palette->set_pen_color(i, pal4bit(color_prom[0] >> 0), pal4bit(color_prom[0] >> 4), pal4bit(color_prom[0x800] >> 0)); + + m_bgprombank = bank; +} + +void vball_state::spprombank_w(int bank) +{ + if (bank == m_spprombank) return; + + uint8_t *color_prom = &m_color_proms[0x400 + bank * 0x80]; + + for (int i = 128; i < 256; i++, color_prom++) + m_palette->set_pen_color(i, pal4bit(color_prom[0] >> 0), pal4bit(color_prom[0] >> 4), pal4bit(color_prom[0x800] >> 0)); + + m_spprombank = bank; +} + + +void vball_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + gfx_element *gfx = m_gfxdecode->gfx(1); + +/* 240-Y S|X|CLR|WCH WHICH 240-X + xxxxxxxx x|x|xxx|xxx xxxxxxxx xxxxxxxx +*/ + for (int i = 0; i < m_spriteram.bytes(); i += 4) + { + int attr = m_spriteram[i + 1]; + int which = m_spriteram[i + 2]+ ((attr & 0x07) << 8); + int sx = ((m_spriteram[i + 3] + 8) & 0xff) - 7; + int sy = 240 - m_spriteram[i]; + int size = (attr & 0x80) >> 7; + int color = (attr & 0x38) >> 3; + int flipx = ~attr & 0x40; + int flipy = 0; + int dy = -16; + + if (flip_screen()) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + dy = -dy; + } + + switch (size) + { + case 0: // normal + gfx->transpen(bitmap, cliprect, (which + 0), color, flipx, flipy, sx, sy, 0); + break; + + case 1: // double y + gfx->transpen(bitmap, cliprect, (which + 0), color, flipx, flipy, sx, sy + dy, 0); + gfx->transpen(bitmap, cliprect, (which + 1), color, flipx, flipy, sx, sy, 0); + break; + } + } +} + +uint32_t vball_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->set_scrolly(0, m_scrolly_hi + *m_scrolly_lo); + + // To get linescrolling to work properly, we must ignore the 1st two scroll values, no idea why! -SJE + for (int i = 2; i < 256; i++) + { + m_bg_tilemap->set_scrollx(i, m_scrollx[i - 2]); + LOGSCROLL("scrollx[%d] = %d\n", i, m_scrollx[i]); + } + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + return 0; +} + + +// machine + +// Based on ddragon driver inline int vball_state::scanline_to_vcount(int scanline) { int vcount = scanline + 8; @@ -114,25 +341,25 @@ TIMER_DEVICE_CALLBACK_MEMBER(vball_state::vball_scanline) int vcount_old = scanline_to_vcount((scanline == 0) ? screen_height - 1 : scanline - 1); int vcount = scanline_to_vcount(scanline); - /* Update to the current point */ + // Update to the current point if (scanline > 0) { m_screen->update_partial(scanline - 1); } - /* IRQ fires every on every 8th scanline */ + // IRQ fires every on every 8th scanline if (!(vcount_old & 8) && (vcount & 8)) { m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); } - /* NMI fires on scanline 248 (VBL) and is latched */ + // NMI fires on scanline 248 (VBL) and is latched if (vcount == 0xf8) { m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); } - /* Save the scroll x register value */ + // Save the scroll x register value if (scanline < 256) { m_scrollx[255 - scanline] = (m_scrollx_hi + m_scrollx_lo + 4); @@ -160,11 +387,11 @@ void vball_state::irq_ack_w(offs_t offset, uint8_t data) */ void vball_state::bankswitch_w(uint8_t data) { - membank("mainbank")->set_entry(data & 1); + m_mainbank->set_entry(data & 1); - if (m_gfxset != ((data & 0x20) ^ 0x20)) + if (m_gfxset != ((data & 0x20) ^ 0x20)) { - m_gfxset = (data & 0x20) ^ 0x20; + m_gfxset = (data & 0x20) ^ 0x20; m_bg_tilemap->mark_all_dirty(); } m_scrolly_hi = (data & 0x40) << 2; @@ -182,25 +409,25 @@ void vball_state::bankswitch_w(uint8_t data) */ void vball_state::scrollx_hi_w(uint8_t data) { - flip_screen_set(~data&1); + flip_screen_set(~data & 1); m_scrollx_hi = (data & 0x02) << 7; bgprombank_w((data >> 2) & 0x07); spprombank_w((data >> 5) & 0x07); - //logerror("%04x: scrollx_hi = %d\n", m_maincpu->pcbase(), m_scrollx_hi); + LOGSCROLL("%04x: scrollx_hi = %d\n", m_maincpu->pcbase(), m_scrollx_hi); } void vball_state::scrollx_lo_w(uint8_t data) { m_scrollx_lo = data; - //logerror("%04x: scrollx_lo =%d\n", m_maincpu->pcbase(), m_scrollx_lo); + LOGSCROLL("%04x: scrollx_lo = %d\n", m_maincpu->pcbase(), m_scrollx_lo); } -//Cheaters note: Scores are stored in ram @ 0x57-0x58 (though the space is used for other things between matches) +// Cheaters note: Scores are stored in RAM @ 0x57-0x58 (though the space is used for other things between matches) void vball_state::main_map(address_map &map) { map(0x0000, 0x07ff).ram(); - map(0x0800, 0x08ff).ram().share("spriteram"); + map(0x0800, 0x08ff).ram().share(m_spriteram); map(0x1000, 0x1000).portr("P1"); map(0x1001, 0x1001).portr("P2"); map(0x1002, 0x1002).portr("SYSTEM"); @@ -210,13 +437,13 @@ void vball_state::main_map(address_map &map) map(0x1006, 0x1006).portr("P4"); map(0x1008, 0x1008).w(FUNC(vball_state::scrollx_hi_w)); map(0x1009, 0x1009).w(FUNC(vball_state::bankswitch_w)); - map(0x100a, 0x100b).w(FUNC(vball_state::irq_ack_w)); /* is there a scanline counter here? */ + map(0x100a, 0x100b).w(FUNC(vball_state::irq_ack_w)); // is there a scanline counter here? map(0x100c, 0x100c).w(FUNC(vball_state::scrollx_lo_w)); - map(0x100d, 0x100d).w(m_soundlatch, FUNC(generic_latch_8_device::write)); - map(0x100e, 0x100e).writeonly().share("scrolly_lo"); - map(0x2000, 0x2fff).w(FUNC(vball_state::videoram_w)).share("videoram"); - map(0x3000, 0x3fff).w(FUNC(vball_state::attrib_w)).share("attribram"); - map(0x4000, 0x7fff).bankr("mainbank"); + map(0x100d, 0x100d).w("soundlatch", FUNC(generic_latch_8_device::write)); + map(0x100e, 0x100e).writeonly().share(m_scrolly_lo); + map(0x2000, 0x2fff).w(FUNC(vball_state::videoram_w)).share(m_videoram); + map(0x3000, 0x3fff).w(FUNC(vball_state::attrib_w)).share(m_attribram); + map(0x4000, 0x7fff).bankr(m_mainbank); map(0x8000, 0xffff).rom(); } @@ -226,7 +453,7 @@ void vball_state::sound_map(address_map &map) map(0x8000, 0x87ff).ram(); map(0x8800, 0x8801).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); map(0x9800, 0x9803).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); - map(0xa000, 0xa000).r(m_soundlatch, FUNC(generic_latch_8_device::read)); + map(0xa000, 0xa000).r("soundlatch", FUNC(generic_latch_8_device::read)); } @@ -262,7 +489,7 @@ static INPUT_PORTS_START( vball ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:1,2") /* Verified against Taito's US Vball manual */ + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:1,2") // Verified against Taito's US Vball manual PORT_DIPSETTING( 0x02, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) PORT_DIPSETTING( 0x01, DEF_STR( Hard ) ) @@ -334,7 +561,7 @@ INPUT_PORTS_END static INPUT_PORTS_START (vball2pj) PORT_INCLUDE( vball ) - /* The 2-player roms have the game-time in the difficulty spot, and I've assumed vice-versa. (VS the instructions scanned in Naz's dump) */ + // The 2-player ROMs have the game-time in the difficulty spot, and I've assumed vice-versa. (VS the instructions scanned in Naz's dump) PORT_MODIFY("DSW1") PORT_DIPNAME( 0x03, 0x00, "Single Player Game Time") PORT_DIPLOCATION("SW1:1,2") @@ -342,26 +569,26 @@ static INPUT_PORTS_START (vball2pj) PORT_DIPSETTING( 0x01, "1:45") PORT_DIPSETTING( 0x03, "2:00") PORT_DIPSETTING( 0x02, "2:15") - PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4") /* Difficulty order needs to be verified */ + PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4") // Difficulty order needs to be verified PORT_DIPSETTING( 0x04, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x00, DEF_STR( Medium ) ) PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x0c, DEF_STR( Very_Hard ) ) - PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW1:5" ) /* Dips 5 through 8 are used for 4 player mode, not supported in 2 player set */ + PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW1:5" ) // Dips 5 through 8 are used for 4 player mode, not supported in 2 player set PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW1:6" ) PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW1:7" ) PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW1:8" ) PORT_MODIFY("P3") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) /* Used in 4 player mode, not supported in 2 player set */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) // Used in 4 player mode, not supported in 2 player set PORT_MODIFY("P4") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) /* Used in 4 player mode, not supported in 2 player set */ + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) // Used in 4 player mode, not supported in 2 player set INPUT_PORTS_END void vball_state::machine_start() { - membank("mainbank")->configure_entries(0, 2, memregion("maincpu")->base(), 0x4000); + m_mainbank->configure_entries(0, 2, memregion("maincpu")->base(), 0x4000); } @@ -391,45 +618,44 @@ static const gfx_layout spritelayout = static GFXDECODE_START( gfx_vb ) - GFXDECODE_ENTRY( "fg_tiles", 0, charlayout, 0, 8 ) /* 8x8 chars */ - GFXDECODE_ENTRY( "sprites", 0, spritelayout, 128, 8 ) /* 16x16 sprites */ + GFXDECODE_ENTRY( "fg_tiles", 0, charlayout, 0, 8 ) // 8x8 chars + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 128, 8 ) // 16x16 sprites GFXDECODE_END void vball_state::vball(machine_config &config) { - /* basic machine hardware */ - M6502(config, m_maincpu, CPU_CLOCK); /* 2 MHz - measured by guru but it makes the game far far too slow ?! */ + // basic machine hardware + M6502(config, m_maincpu, 12_MHz_XTAL / 6); // 2 MHz - measured by Guru but it makes the game far far too slow ?! m_maincpu->set_addrmap(AS_PROGRAM, &vball_state::main_map); TIMER(config, "scantimer").configure_scanline(FUNC(vball_state::vball_scanline), "screen", 0, 1); - Z80(config, m_audiocpu, 3579545); /* 3.579545 MHz */ + Z80(config, m_audiocpu, 3.579545_MHz_XTAL); m_audiocpu->set_addrmap(AS_PROGRAM, &vball_state::sound_map); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_size(32*8, 32*8); - m_screen->set_raw(PIXEL_CLOCK, 384, 0, 256, 272, 8, 248); /* based on ddragon driver */ + m_screen->set_raw(12_MHz_XTAL / 2, 384, 0, 256, 272, 8, 248); // based on ddragon driver m_screen->set_screen_update(FUNC(vball_state::screen_update)); m_screen->set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_vb); PALETTE(config, m_palette).set_entries(256); - /* sound hardware */ + // sound hardware SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); // The sound system comes all but verbatim from Double Dragon - GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); - ym2151_device &ymsnd(YM2151(config, "ymsnd", 3579545)); + ym2151_device &ymsnd(YM2151(config, "ymsnd", 3.579545_MHz_XTAL)); ymsnd.irq_handler().set_inputline(m_audiocpu, 0); ymsnd.add_route(0, "lspeaker", 0.60); ymsnd.add_route(1, "rspeaker", 0.60); - okim6295_device &oki(OKIM6295(config, "oki", 1056000, okim6295_device::PIN7_HIGH)); + okim6295_device &oki(OKIM6295(config, "oki", 1.056_MHz_XTAL, okim6295_device::PIN7_HIGH)); oki.add_route(ALL_OUTPUTS, "lspeaker", 1.0); oki.add_route(ALL_OUTPUTS, "rspeaker", 1.0); } @@ -441,126 +667,128 @@ void vball_state::vball(machine_config &config) ***************************************************************************/ -ROM_START( vball ) /* US version */ - ROM_REGION( 0x10000, "maincpu", 0 ) /* Main CPU */ - ROM_LOAD( "25a2-4.124", 0x00000, 0x10000, CRC(06d0c013) SHA1(e818ae0ffb32bcf97da2651a9b8efbd4859b2f4c) ) /* First 0x8000 banked, second 0x8000 fixed */ +ROM_START( vball ) // US version + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "25a2-4.124", 0x00000, 0x10000, CRC(06d0c013) SHA1(e818ae0ffb32bcf97da2651a9b8efbd4859b2f4c) ) // First 0x8000 banked, second 0x8000 fixed - ROM_REGION( 0x8000, "audiocpu", 0 ) /* region#2: music CPU, 64kb */ + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "25j1-0.47", 0x00000, 0x8000, CRC(10ca79ad) SHA1(aad4a09d6745ca0b5665cb00ff7a4e08ea434068) ) /* the original has the image data stored in a special ceramic embedded package made by Toshiba with part number 'TOSHIBA TRJ-101' (which has been dumped using a custom made adapter) there are a few bytes different between the bootleg and the original (the original is correct though!) */ - ROM_REGION(0x80000, "fg_tiles", 0 ) /* fg tiles */ + ROM_REGION(0x80000, "fg_tiles", 0 ) ROM_LOAD( "trj-101.96", 0x00000, 0x80000, CRC(f343eee4) SHA1(1ce95285631f7ec91fe3f6c3d62b13f565d3816a) ) - ROM_REGION(0x40000, "sprites", 0 ) /* sprites */ - ROM_LOAD( "25j4-0.35", 0x00000, 0x20000, CRC(877826d8) SHA1(fd77298f9343051f66259dad9127f40afb95f385) ) /* 0,1,2,3 */ - ROM_LOAD( "25j3-0.5", 0x20000, 0x20000, CRC(c6afb4fa) SHA1(6d7c966300ce5fb2094476b393434486965d62b4) ) /* 0,1,2,3 */ + ROM_REGION(0x40000, "sprites", 0 ) + ROM_LOAD( "25j4-0.35", 0x00000, 0x20000, CRC(877826d8) SHA1(fd77298f9343051f66259dad9127f40afb95f385) ) // 0,1,2,3 + ROM_LOAD( "25j3-0.5", 0x20000, 0x20000, CRC(c6afb4fa) SHA1(6d7c966300ce5fb2094476b393434486965d62b4) ) // 0,1,2,3 - ROM_REGION(0x40000, "oki", 0 ) /* Sound region#1: adpcm */ + ROM_REGION(0x40000, "oki", 0 ) ROM_LOAD( "25j0-0.78", 0x00000, 0x20000, CRC(8e04bdbf) SHA1(baafc5033c9442b83cb332c2c453c13117b31a3b) ) - ROM_REGION(0x1000, "proms", 0 ) /* color PROMs */ + ROM_REGION(0x1000, "color_proms", 0 ) ROM_LOAD_NIB_LOW ( "25j5-0.144", 0x0000, 0x00800, CRC(a317240f) SHA1(bd57ad516f7a8ff774276fd26b02dd34659d41ad) ) ROM_LOAD_NIB_HIGH( "25j6-0.143", 0x0000, 0x00800, CRC(1ff70b4f) SHA1(a469baa0dda844ba307c09ddefb23f239cfe7b5f) ) ROM_LOAD( "25j7-0.160", 0x0800, 0x00800, CRC(2ffb68b3) SHA1(d560fdcd5e5c79d37e5b5bde22fbaf662fe89252) ) ROM_END -ROM_START( vball2pj ) /* Japan version */ - ROM_REGION( 0x10000, "maincpu", 0 ) /* Main CPU */ - ROM_LOAD( "25j2-2-5.124", 0x00000, 0x10000, CRC(432509c4) SHA1(6de50e21d279f4ac9674bc91990ba9535e80908c) ) /* First 0x8000 banked, second 0x8000 fixed */ +ROM_START( vball2pj ) // Japan version + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "25j2-2-5.124", 0x00000, 0x10000, CRC(432509c4) SHA1(6de50e21d279f4ac9674bc91990ba9535e80908c) ) // First 0x8000 banked, second 0x8000 fixed - ROM_REGION( 0x8000, "audiocpu", 0 ) /* region#2: music CPU, 64kb */ + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "25j1-0.47", 0x00000, 0x8000, CRC(10ca79ad) SHA1(aad4a09d6745ca0b5665cb00ff7a4e08ea434068) ) /* the original has the image data stored in a special ceramic embedded package made by Toshiba with part number 'TOSHIBA TRJ-101' (which has been dumped using a custom made adapter) there are a few bytes different between the bootleg and the original (the original is correct though!) */ - ROM_REGION(0x80000, "fg_tiles", 0 ) /* fg tiles */ + ROM_REGION(0x80000, "fg_tiles", 0 ) ROM_LOAD( "trj-101.96", 0x00000, 0x80000, CRC(f343eee4) SHA1(1ce95285631f7ec91fe3f6c3d62b13f565d3816a) ) - ROM_REGION(0x40000, "sprites", 0 ) /* sprites */ - ROM_LOAD( "25j4-0.35", 0x00000, 0x20000, CRC(877826d8) SHA1(fd77298f9343051f66259dad9127f40afb95f385) ) /* 0,1,2,3 */ - ROM_LOAD( "25j3-0.5", 0x20000, 0x20000, CRC(c6afb4fa) SHA1(6d7c966300ce5fb2094476b393434486965d62b4) ) /* 0,1,2,3 */ + ROM_REGION(0x40000, "sprites", 0 ) + ROM_LOAD( "25j4-0.35", 0x00000, 0x20000, CRC(877826d8) SHA1(fd77298f9343051f66259dad9127f40afb95f385) ) // 0,1,2,3 + ROM_LOAD( "25j3-0.5", 0x20000, 0x20000, CRC(c6afb4fa) SHA1(6d7c966300ce5fb2094476b393434486965d62b4) ) // 0,1,2,3 - ROM_REGION(0x40000, "oki", 0 ) /* Sound region#1: adpcm */ + ROM_REGION(0x40000, "oki", 0 ) ROM_LOAD( "25j0-0.78", 0x00000, 0x20000, CRC(8e04bdbf) SHA1(baafc5033c9442b83cb332c2c453c13117b31a3b) ) - ROM_REGION(0x1000, "proms", 0 ) /* color PROMs */ + ROM_REGION(0x1000, "color_proms", 0 ) ROM_LOAD_NIB_LOW ( "25j5-0.144", 0x0000, 0x00800, CRC(a317240f) SHA1(bd57ad516f7a8ff774276fd26b02dd34659d41ad) ) ROM_LOAD_NIB_HIGH( "25j6-0.143", 0x0000, 0x00800, CRC(1ff70b4f) SHA1(a469baa0dda844ba307c09ddefb23f239cfe7b5f) ) ROM_LOAD( "25j7-0.160", 0x0800, 0x00800, CRC(2ffb68b3) SHA1(d560fdcd5e5c79d37e5b5bde22fbaf662fe89252) ) ROM_END -ROM_START( vballb ) /* bootleg */ - ROM_REGION( 0x10000, "maincpu", 0 ) /* Main CPU: 64k for code */ - ROM_LOAD( "vball.124", 0x00000, 0x10000, CRC(be04c2b5) SHA1(40fed4ae272719e940f1796ef35420ab451ab7b6) ) /* First 0x8000 banked, second 0x8000 fixed */ +ROM_START( vballb ) // bootleg + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "vball.124", 0x00000, 0x10000, CRC(be04c2b5) SHA1(40fed4ae272719e940f1796ef35420ab451ab7b6) ) // First 0x8000 banked, second 0x8000 fixed - ROM_REGION( 0x8000, "audiocpu", 0 ) /* region#2: music CPU, 64kb */ + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "25j1-0.47", 0x00000, 0x8000, CRC(10ca79ad) SHA1(aad4a09d6745ca0b5665cb00ff7a4e08ea434068) ) - /* The bootlegs used standard roms on a daughter card that plugs into the socket for the TOSHIBA TRJ-101 dip rom */ - ROM_REGION(0x80000, "fg_tiles", 0 ) /* fg tiles */ - ROM_LOAD( "13", 0x00000, 0x10000, CRC(f26df8e1) SHA1(72186c1430d07c7fd9211245b539f05a0660bebe) ) /* 0,1,2,3 */ - ROM_LOAD( "14", 0x10000, 0x10000, CRC(c9798d0e) SHA1(ec156f6c7ecccaa216ce8076f75ad7627ee90945) ) /* 0,1,2,3 */ - ROM_LOAD( "15", 0x20000, 0x10000, CRC(68e69c4b) SHA1(9870674c91cab7215ad8ed40eb82facdee478fde) ) /* 0,1,2,3 */ - ROM_LOAD( "16", 0x30000, 0x10000, CRC(936457ba) SHA1(1662bbd777fcd33a298d192a3f06681809b9d049) ) /* 0,1,2,3 */ - ROM_LOAD( "9", 0x40000, 0x10000, CRC(42874924) SHA1(a75eed7934e089f035000b7f35f6ba8dd96f1e98) ) /* 0,1,2,3 */ - ROM_LOAD( "10", 0x50000, 0x10000, CRC(6cc676ee) SHA1(6e8c590946211baa9266b19b871f252829057696) ) /* 0,1,2,3 */ - ROM_LOAD( "11", 0x60000, 0x10000, CRC(4754b303) SHA1(8630f077b542590ef1340a2f0a6b94086ff91c40) ) /* 0,1,2,3 */ - ROM_LOAD( "12", 0x70000, 0x10000, CRC(21294a84) SHA1(b36ea9ddf6879443d3104241997fa0f916856528) ) /* 0,1,2,3 */ + // The bootlegs used standard ROMs on a daughter card that plugs into the socket for the TOSHIBA TRJ-101 DIP ROM + ROM_REGION(0x80000, "fg_tiles", 0 ) + ROM_LOAD( "13", 0x00000, 0x10000, CRC(f26df8e1) SHA1(72186c1430d07c7fd9211245b539f05a0660bebe) ) // 0,1,2,3 + ROM_LOAD( "14", 0x10000, 0x10000, CRC(c9798d0e) SHA1(ec156f6c7ecccaa216ce8076f75ad7627ee90945) ) // 0,1,2,3 + ROM_LOAD( "15", 0x20000, 0x10000, CRC(68e69c4b) SHA1(9870674c91cab7215ad8ed40eb82facdee478fde) ) // 0,1,2,3 + ROM_LOAD( "16", 0x30000, 0x10000, CRC(936457ba) SHA1(1662bbd777fcd33a298d192a3f06681809b9d049) ) // 0,1,2,3 + ROM_LOAD( "9", 0x40000, 0x10000, CRC(42874924) SHA1(a75eed7934e089f035000b7f35f6ba8dd96f1e98) ) // 0,1,2,3 + ROM_LOAD( "10", 0x50000, 0x10000, CRC(6cc676ee) SHA1(6e8c590946211baa9266b19b871f252829057696) ) // 0,1,2,3 + ROM_LOAD( "11", 0x60000, 0x10000, CRC(4754b303) SHA1(8630f077b542590ef1340a2f0a6b94086ff91c40) ) // 0,1,2,3 + ROM_LOAD( "12", 0x70000, 0x10000, CRC(21294a84) SHA1(b36ea9ddf6879443d3104241997fa0f916856528) ) // 0,1,2,3 - ROM_REGION(0x40000, "sprites", 0 ) /* sprites */ - ROM_LOAD( "vball.35", 0x00000, 0x20000, CRC(877826d8) SHA1(fd77298f9343051f66259dad9127f40afb95f385) ) /* 0,1,2,3 == 25j4-0.35 */ - ROM_LOAD( "vball.5", 0x20000, 0x20000, CRC(c6afb4fa) SHA1(6d7c966300ce5fb2094476b393434486965d62b4) ) /* 0,1,2,3 == 25j3-0.5 */ + ROM_REGION(0x40000, "sprites", 0 ) + ROM_LOAD( "vball.35", 0x00000, 0x20000, CRC(877826d8) SHA1(fd77298f9343051f66259dad9127f40afb95f385) ) // 0,1,2,3 == 25j4-0.35 + ROM_LOAD( "vball.5", 0x20000, 0x20000, CRC(c6afb4fa) SHA1(6d7c966300ce5fb2094476b393434486965d62b4) ) // 0,1,2,3 == 25j3-0.5 - ROM_REGION(0x40000, "oki", 0 ) /* Sound region#1: adpcm */ - ROM_LOAD( "vball.78a", 0x00000, 0x10000, CRC(f3e63b76) SHA1(da54d1d7d7d55b73e49991e4363bc6f46e0f70eb) ) /* == 1st half of 25j0-0.78 */ - ROM_LOAD( "vball.78b", 0x10000, 0x10000, CRC(7ad9d338) SHA1(3e3c270fa69bda93b03f07a54145eb5e211ec8ba) ) /* == 2nd half of 25j0-0.78 */ + ROM_REGION(0x40000, "oki", 0 ) + ROM_LOAD( "vball.78a", 0x00000, 0x10000, CRC(f3e63b76) SHA1(da54d1d7d7d55b73e49991e4363bc6f46e0f70eb) ) // == 1st half of 25j0-0.78 + ROM_LOAD( "vball.78b", 0x10000, 0x10000, CRC(7ad9d338) SHA1(3e3c270fa69bda93b03f07a54145eb5e211ec8ba) ) // == 2nd half of 25j0-0.78 - ROM_REGION(0x1000, "proms", 0 ) /* color PROMs */ + ROM_REGION(0x1000, "color_proms", 0 ) ROM_LOAD_NIB_LOW ( "25j5-0.144", 0x0000, 0x00800, CRC(a317240f) SHA1(bd57ad516f7a8ff774276fd26b02dd34659d41ad) ) ROM_LOAD_NIB_HIGH( "25j6-0.143", 0x0000, 0x00800, CRC(1ff70b4f) SHA1(a469baa0dda844ba307c09ddefb23f239cfe7b5f) ) ROM_LOAD( "25j7-0.160", 0x0800, 0x00800, CRC(2ffb68b3) SHA1(d560fdcd5e5c79d37e5b5bde22fbaf662fe89252) ) ROM_END -ROM_START( vball2pjb ) /* bootleg of the Japan set with unmoddified program rom */ - ROM_REGION( 0x10000, "maincpu", 0 ) /* Main CPU: 64k for code */ - ROM_LOAD( "1.124", 0x00000, 0x10000, CRC(432509c4) SHA1(6de50e21d279f4ac9674bc91990ba9535e80908c) )/* First 0x8000 banked, second 0x8000 fixed == 25j2-2-5.124 from vball2pj */ +ROM_START( vball2pjb ) // bootleg of the Japan set with unmoddified program ROM + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "1.124", 0x00000, 0x10000, CRC(432509c4) SHA1(6de50e21d279f4ac9674bc91990ba9535e80908c) )// First 0x8000 banked, second 0x8000 fixed == 25j2-2-5.124 from vball2pj - ROM_REGION( 0x8000, "audiocpu", 0 ) /* Sound CPU, 64kb */ + ROM_REGION( 0x8000, "audiocpu", 0 ) ROM_LOAD( "4.ic47", 0x00000, 0x8000, CRC(534dfbd9) SHA1(d0cb37caf94fa85da4ebdfe15e7a78109084bf91) ) - /* The bootlegs used standard roms on a daughter card that plugs into the socket for the TOSHIBA TRJ-101 dip rom */ - ROM_REGION(0x80000, "fg_tiles", 0 ) /* fg tiles */ - ROM_LOAD( "13", 0x00000, 0x10000, CRC(f26df8e1) SHA1(72186c1430d07c7fd9211245b539f05a0660bebe) ) /* 0,1,2,3 */ - ROM_LOAD( "14", 0x10000, 0x10000, CRC(c9798d0e) SHA1(ec156f6c7ecccaa216ce8076f75ad7627ee90945) ) /* 0,1,2,3 */ - ROM_LOAD( "15", 0x20000, 0x10000, CRC(68e69c4b) SHA1(9870674c91cab7215ad8ed40eb82facdee478fde) ) /* 0,1,2,3 */ - ROM_LOAD( "16", 0x30000, 0x10000, CRC(936457ba) SHA1(1662bbd777fcd33a298d192a3f06681809b9d049) ) /* 0,1,2,3 */ - ROM_LOAD( "9", 0x40000, 0x10000, CRC(42874924) SHA1(a75eed7934e089f035000b7f35f6ba8dd96f1e98) ) /* 0,1,2,3 */ - ROM_LOAD( "10", 0x50000, 0x10000, CRC(6cc676ee) SHA1(6e8c590946211baa9266b19b871f252829057696) ) /* 0,1,2,3 */ - ROM_LOAD( "11", 0x60000, 0x10000, CRC(4754b303) SHA1(8630f077b542590ef1340a2f0a6b94086ff91c40) ) /* 0,1,2,3 */ - ROM_LOAD( "12", 0x70000, 0x10000, CRC(21294a84) SHA1(b36ea9ddf6879443d3104241997fa0f916856528) ) /* 0,1,2,3 */ + // The bootlegs used standard ROMs on a daughter card that plugs into the socket for the TOSHIBA TRJ-101 DIP ROM + ROM_REGION(0x80000, "fg_tiles", 0 ) + ROM_LOAD( "13", 0x00000, 0x10000, CRC(f26df8e1) SHA1(72186c1430d07c7fd9211245b539f05a0660bebe) ) // 0,1,2,3 + ROM_LOAD( "14", 0x10000, 0x10000, CRC(c9798d0e) SHA1(ec156f6c7ecccaa216ce8076f75ad7627ee90945) ) // 0,1,2,3 + ROM_LOAD( "15", 0x20000, 0x10000, CRC(68e69c4b) SHA1(9870674c91cab7215ad8ed40eb82facdee478fde) ) // 0,1,2,3 + ROM_LOAD( "16", 0x30000, 0x10000, CRC(936457ba) SHA1(1662bbd777fcd33a298d192a3f06681809b9d049) ) // 0,1,2,3 + ROM_LOAD( "9", 0x40000, 0x10000, CRC(42874924) SHA1(a75eed7934e089f035000b7f35f6ba8dd96f1e98) ) // 0,1,2,3 + ROM_LOAD( "10", 0x50000, 0x10000, CRC(6cc676ee) SHA1(6e8c590946211baa9266b19b871f252829057696) ) // 0,1,2,3 + ROM_LOAD( "11", 0x60000, 0x10000, CRC(4754b303) SHA1(8630f077b542590ef1340a2f0a6b94086ff91c40) ) // 0,1,2,3 + ROM_LOAD( "12", 0x70000, 0x10000, CRC(21294a84) SHA1(b36ea9ddf6879443d3104241997fa0f916856528) ) // 0,1,2,3 - ROM_REGION(0x40000, "sprites", 0 ) /* sprites */ - ROM_LOAD( "8", 0x00000, 0x10000, CRC(b18d083c) SHA1(8c7a39b8a9c79a13682a4f283470801c3cbb748c) ) /* == 1st half of 25j4-0.35 */ - ROM_LOAD( "7", 0x10000, 0x10000, CRC(79a35321) SHA1(0953730b1baa9bda4b2eb703258476423e5448f5) ) /* == 2nd half of 25j4-0.35 */ - ROM_LOAD( "6", 0x20000, 0x10000, CRC(49c6aad7) SHA1(6c026ddd97a5dfd138fb65781504f192c11ee6aa) ) /* == 1st half of 25j3-0.5 */ - ROM_LOAD( "5", 0x30000, 0x10000, CRC(9bb95651) SHA1(ec8a481cc7f0d6e469489db7c51103446910ae80) ) /* == 2nd half of 25j3-0.5 */ + ROM_REGION(0x40000, "sprites", 0 ) + ROM_LOAD( "8", 0x00000, 0x10000, CRC(b18d083c) SHA1(8c7a39b8a9c79a13682a4f283470801c3cbb748c) ) // == 1st half of 25j4-0.35 + ROM_LOAD( "7", 0x10000, 0x10000, CRC(79a35321) SHA1(0953730b1baa9bda4b2eb703258476423e5448f5) ) // == 2nd half of 25j4-0.35 + ROM_LOAD( "6", 0x20000, 0x10000, CRC(49c6aad7) SHA1(6c026ddd97a5dfd138fb65781504f192c11ee6aa) ) // == 1st half of 25j3-0.5 + ROM_LOAD( "5", 0x30000, 0x10000, CRC(9bb95651) SHA1(ec8a481cc7f0d6e469489db7c51103446910ae80) ) // == 2nd half of 25j3-0.5 - ROM_REGION(0x40000, "oki", 0 ) /* Sound region#1: adpcm */ - ROM_LOAD( "vball.78a", 0x00000, 0x10000, CRC(f3e63b76) SHA1(da54d1d7d7d55b73e49991e4363bc6f46e0f70eb) ) /* == 1st half of 25j0-0.78 (ROM type 27512) */ - ROM_LOAD( "3.ic79", 0x10000, 0x08000, CRC(d77349ba) SHA1(5ef25636056607fae7a5463957487b53da0dd310) ) /* == 3rd quarter of 25j0-0.78 (ROM type 27256) */ + ROM_REGION(0x40000, "oki", 0 ) + ROM_LOAD( "vball.78a", 0x00000, 0x10000, CRC(f3e63b76) SHA1(da54d1d7d7d55b73e49991e4363bc6f46e0f70eb) ) // == 1st half of 25j0-0.78 (ROM type 27512) + ROM_LOAD( "3.ic79", 0x10000, 0x08000, CRC(d77349ba) SHA1(5ef25636056607fae7a5463957487b53da0dd310) ) // == 3rd quarter of 25j0-0.78 (ROM type 27256) - ROM_REGION(0x1000, "proms", 0 ) /* color PROMs */ + ROM_REGION(0x1000, "color_proms", 0 ) ROM_LOAD_NIB_LOW ( "25j5-0.144", 0x0000, 0x00800, CRC(a317240f) SHA1(bd57ad516f7a8ff774276fd26b02dd34659d41ad) ) ROM_LOAD_NIB_HIGH( "25j6-0.143", 0x0000, 0x00800, CRC(1ff70b4f) SHA1(a469baa0dda844ba307c09ddefb23f239cfe7b5f) ) ROM_LOAD( "25j7-0.160", 0x0800, 0x00800, CRC(2ffb68b3) SHA1(d560fdcd5e5c79d37e5b5bde22fbaf662fe89252) ) ROM_END +} // anonymous namespace -GAME( 1988, vball, 0, vball, vball, vball_state, empty_init, ROT0, "Technos Japan", "U.S. Championship V'ball (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, vball2pj, vball, vball, vball2pj, vball_state, empty_init, ROT0, "Technos Japan", "U.S. Championship V'ball (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, vballb, vball, vball, vball, vball_state, empty_init, ROT0, "bootleg", "U.S. Championship V'ball (bootleg of US set)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, vball2pjb,vball, vball, vball, vball_state, empty_init, ROT0, "bootleg", "U.S. Championship V'ball (bootleg of Japan set)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1988, vball, 0, vball, vball, vball_state, empty_init, ROT0, "Technos Japan", "U.S. Championship V'ball (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, vball2pj, vball, vball, vball2pj, vball_state, empty_init, ROT0, "Technos Japan", "U.S. Championship V'ball (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, vballb, vball, vball, vball, vball_state, empty_init, ROT0, "bootleg", "U.S. Championship V'ball (bootleg of US set)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, vball2pjb,vball, vball, vball, vball_state, empty_init, ROT0, "bootleg", "U.S. Championship V'ball (bootleg of Japan set)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/vball.h b/src/mame/includes/vball.h deleted file mode 100644 index 9abbe220f93..00000000000 --- a/src/mame/includes/vball.h +++ /dev/null @@ -1,72 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Paul Hampson - -#include "machine/gen_latch.h" -#include "machine/timer.h" -#include "emupal.h" -#include "screen.h" -#include "tilemap.h" - -class vball_state : public driver_device -{ -public: - vball_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_attribram(*this, "attribram"), - m_videoram(*this, "videoram"), - m_scrolly_lo(*this, "scrolly_lo"), - m_spriteram(*this, "spriteram") { } - - void vball(machine_config &config); - -private: - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_device m_soundlatch; - - required_shared_ptr m_attribram; - required_shared_ptr m_videoram; - required_shared_ptr m_scrolly_lo; - required_shared_ptr m_spriteram; - - int m_scrollx_hi = 0; - int m_scrolly_hi = 0; - int m_scrollx_lo = 0; - int m_gfxset = 0; - int m_scrollx[256]{}; - int m_bgprombank = 0; - int m_spprombank = 0; - tilemap_t *m_bg_tilemap = nullptr; - - void irq_ack_w(offs_t offset, uint8_t data); - void bankswitch_w(uint8_t data); - void scrollx_hi_w(uint8_t data); - void scrollx_lo_w(uint8_t data); - void videoram_w(offs_t offset, uint8_t data); - void attrib_w(offs_t offset, uint8_t data); - - TILEMAP_MAPPER_MEMBER(background_scan); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - - virtual void machine_start() override; - virtual void video_start() override; - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(vball_scanline); - void bgprombank_w(int bank); - void spprombank_w(int bank); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - inline int scanline_to_vcount(int scanline); - - void main_map(address_map &map); - void sound_map(address_map &map); -}; diff --git a/src/mame/video/vball.cpp b/src/mame/video/vball.cpp deleted file mode 100644 index 779124b8b2a..00000000000 --- a/src/mame/video/vball.cpp +++ /dev/null @@ -1,166 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Paul Hampson -/*************************************************************************** - - Video Hardware for Championship V'ball by Paul Hampson - Generally copied from China Gate by Paul Hampson - "Mainly copied from video of Double Dragon (bootleg) & Double Dragon II" - -***************************************************************************/ - -#include "emu.h" -#include "cpu/m6502/m6502.h" -#include "includes/vball.h" - - - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILEMAP_MAPPER_MEMBER(vball_state::background_scan) -{ - /* logical (col,row) -> memory offset */ - return (col & 0x1f) + ((row & 0x1f) << 5) + ((col & 0x20) << 5) + ((row & 0x20) <<6); -} - -TILE_GET_INFO_MEMBER(vball_state::get_bg_tile_info) -{ - uint8_t code = m_videoram[tile_index]; - uint8_t attr = m_attribram[tile_index]; - tileinfo.set(0, - code + ((attr & 0x1f) << 8) + (m_gfxset<<8), - (attr >> 5) & 0x7, - 0); -} - - -void vball_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vball_state::get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(vball_state::background_scan)), 8, 8, 64, 64); - - m_bg_tilemap->set_scroll_rows(32); - m_gfxset=0; - m_bgprombank=0xff; - m_spprombank=0xff; - - save_item(NAME(m_scrollx_hi)); - save_item(NAME(m_scrolly_hi)); - save_item(NAME(m_scrollx_lo)); - save_item(NAME(m_gfxset)); - save_item(NAME(m_scrollx)); - save_item(NAME(m_bgprombank)); - save_item(NAME(m_spprombank)); -} - -void vball_state::videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void vball_state::attrib_w(offs_t offset, uint8_t data) -{ - m_attribram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void vball_state::bgprombank_w( int bank ) -{ - int i; - uint8_t* color_prom; - - if (bank==m_bgprombank) return; - - color_prom = memregion("proms")->base() + bank*0x80; - for (i=0;i<128;i++, color_prom++) { - m_palette->set_pen_color(i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4), - pal4bit(color_prom[0x800] >> 0)); - } - m_bgprombank=bank; -} - -void vball_state::spprombank_w( int bank ) -{ - int i; - uint8_t* color_prom; - - if (bank==m_spprombank) return; - - color_prom = memregion("proms")->base()+0x400 + bank*0x80; - for (i=128;i<256;i++,color_prom++) { - m_palette->set_pen_color(i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4), - pal4bit(color_prom[0x800] >> 0)); - } - m_spprombank=bank; -} - - -#define DRAW_SPRITE( order, sx, sy ) gfx->transpen(bitmap,\ - cliprect, \ - (which+order),color,flipx,flipy,sx,sy,0); - -void vball_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - gfx_element *gfx = m_gfxdecode->gfx(1); - uint8_t *src = m_spriteram; - int i; - -/* 240-Y S|X|CLR|WCH WHICH 240-X - xxxxxxxx x|x|xxx|xxx xxxxxxxx xxxxxxxx -*/ - for (i = 0;i < m_spriteram.bytes();i += 4) - { - int attr = src[i+1]; - int which = src[i+2]+((attr & 0x07)<<8); - int sx = ((src[i+3] + 8) & 0xff) - 7; - int sy = 240 - src[i]; - int size = (attr & 0x80) >> 7; - int color = (attr & 0x38) >> 3; - int flipx = ~attr & 0x40; - int flipy = 0; - int dy = -16; - - if (flip_screen()) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - dy = -dy; - } - - switch (size) - { - case 0: /* normal */ - DRAW_SPRITE(0,sx,sy); - break; - - case 1: /* double y */ - DRAW_SPRITE(0,sx,sy + dy); - DRAW_SPRITE(1,sx,sy); - break; - } - } -} - -#undef DRAW_SPRITE - -uint32_t vball_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int i; - - m_bg_tilemap->set_scrolly(0,m_scrolly_hi + *m_scrolly_lo); - - /*To get linescrolling to work properly, we must ignore the 1st two scroll values, no idea why! -SJE */ - for (i = 2; i < 256; i++) { - m_bg_tilemap->set_scrollx(i,m_scrollx[i-2]); - //logerror("scrollx[%d] = %d\n",i,m_scrollx[i]); - } - m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0); - draw_sprites(bitmap,cliprect); - return 0; -}