diff --git a/src/mame/snk/bbusters.cpp b/src/mame/snk/bbusters.cpp index 9d8c0246603..db11b634a33 100644 --- a/src/mame/snk/bbusters.cpp +++ b/src/mame/snk/bbusters.cpp @@ -130,14 +130,14 @@ public: m_sprites(*this, "sprites%u", 1U), m_spriteram(*this, "spriteram%u", 1U), m_soundlatch(*this, "soundlatch%u", 1U), - m_tx_videoram(*this, "tx_videoram"), - m_pf_data(*this, "pf%u_data", 1U), - m_pf_scroll_data(*this, "pf%u_scroll_data", 1U), + m_tx_vram(*this, "tx_videoram"), + m_pf_vram(*this, "pf%u_vram", 1U), + m_pf_scroll_reg(*this, "pf%u_scroll_reg", 1U), m_gun_recoil(*this, "Player%u_Gun_Recoil", 1U), m_eprom_data(*this, "eeprom") { } - void bbusters(machine_config &config); + void bbusters(machine_config &config) ATTR_COLD; protected: virtual void machine_start() override ATTR_COLD; @@ -152,9 +152,9 @@ private: required_device_array m_spriteram; required_device_array m_soundlatch; - required_shared_ptr m_tx_videoram; - required_shared_ptr_array m_pf_data; - required_shared_ptr_array m_pf_scroll_data; + required_shared_ptr m_tx_vram; + required_shared_ptr_array m_pf_vram; + required_shared_ptr_array m_pf_scroll_reg; output_finder<3> m_gun_recoil; required_shared_ptr m_eprom_data; @@ -162,29 +162,27 @@ private: tilemap_t *m_fix_tilemap = nullptr; tilemap_t *m_pf_tilemap[2]{}; + bitmap_ind16 m_bitmap_sprites[2]; + TILE_GET_INFO_MEMBER(get_tile_info); template TILE_GET_INFO_MEMBER(get_pf_tile_info); void sound_cpu_w(uint8_t data); - void video_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - template void pf_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void tx_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + template void pf_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void coin_counter_w(uint8_t data); - void bbusters_map(address_map &map) ATTR_COLD; - void sound_map(address_map &map) ATTR_COLD; - void sound_portmap(address_map &map) ATTR_COLD; - uint16_t eprom_r(offs_t offset); - void three_gun_output_w(uint16_t data); - - void mixlow(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &cliprect); - void mix(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &cliprect); + void gun_output_w(uint16_t data); template void mix_sprites(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &cliprect, Proc MIX); - bitmap_ind16 m_bitmap_sprites[2]; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map) ATTR_COLD; + void sound_map(address_map &map) ATTR_COLD; + void sound_portmap(address_map &map) ATTR_COLD; }; void bbusters_state::machine_start() @@ -204,16 +202,16 @@ uint16_t bbusters_state::eprom_r(offs_t offset) return (m_eprom_data[offset] & 0xff) | 0xff00; } -void bbusters_state::three_gun_output_w(uint16_t data) +void bbusters_state::gun_output_w(uint16_t data) { for (int i = 0; i < 3; i++) m_gun_recoil[i] = BIT(data, i); } template -void bbusters_state::pf_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void bbusters_state::pf_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - COMBINE_DATA(&m_pf_data[Layer][offset]); + COMBINE_DATA(&m_pf_vram[Layer][offset]); m_pf_tilemap[Layer]->mark_tile_dirty(offset); } @@ -226,22 +224,22 @@ void bbusters_state::coin_counter_w(uint8_t data) TILE_GET_INFO_MEMBER(bbusters_state::get_tile_info) { - uint16_t tile = m_tx_videoram[tile_index]; + uint16_t const tile = m_tx_vram[tile_index]; - tileinfo.set(0, tile&0xfff, tile>>12, 0); + tileinfo.set(0, tile & 0xfff, tile >> 12, 0); } template TILE_GET_INFO_MEMBER(bbusters_state::get_pf_tile_info) { - uint16_t tile = m_pf_data[Layer][tile_index]; + uint16_t const tile = m_pf_vram[Layer][tile_index]; - tileinfo.set(Gfx, tile&0xfff, tile>>12, 0); + tileinfo.set(Gfx, tile & 0xfff, tile >> 12, 0); } -void bbusters_state::video_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void bbusters_state::tx_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - COMBINE_DATA(&m_tx_videoram[offset]); + COMBINE_DATA(&m_tx_vram[offset]); m_fix_tilemap->mark_tile_dirty(offset); } @@ -258,12 +256,11 @@ void bbusters_state::video_start() m_pf_tilemap[0]->set_transparent_pen(15); - for (int i = 0; i < 2; i++) + for (auto &bitmap : m_bitmap_sprites) { - m_screen->register_screen_bitmap(m_bitmap_sprites[i]); - m_bitmap_sprites[i].fill(0xffff); + m_screen->register_screen_bitmap(bitmap); + bitmap.fill(0xffff); } - } /******************************************************************************/ @@ -275,11 +272,11 @@ void bbusters_state::mix_sprites(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *srcbuf = &srcbitmap.pix(y); - uint16_t *dstbuf = &bitmap.pix(y); + uint16_t const *const srcbuf = &srcbitmap.pix(y); + uint16_t *const dstbuf = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint16_t srcdat = srcbuf[x]; + uint16_t const srcdat = srcbuf[x]; if ((srcdat & 0xf) != 0xf) MIX(srcdat, x, dstbuf); } @@ -293,10 +290,10 @@ uint32_t bbusters_state::screen_update(screen_device &screen, bitmap_ind16 &bitm m_sprites[1]->draw_sprites(m_bitmap_sprites[1], cliprect); m_sprites[0]->draw_sprites(m_bitmap_sprites[0], cliprect); - m_pf_tilemap[0]->set_scrollx(0, m_pf_scroll_data[0][0]); - m_pf_tilemap[0]->set_scrolly(0, m_pf_scroll_data[0][1]); - m_pf_tilemap[1]->set_scrollx(0, m_pf_scroll_data[1][0]); - m_pf_tilemap[1]->set_scrolly(0, m_pf_scroll_data[1][1]); + m_pf_tilemap[0]->set_scrollx(0, m_pf_scroll_reg[0][0]); + m_pf_tilemap[0]->set_scrolly(0, m_pf_scroll_reg[0][1]); + m_pf_tilemap[1]->set_scrollx(0, m_pf_scroll_reg[1][0]); + m_pf_tilemap[1]->set_scrolly(0, m_pf_scroll_reg[1][1]); m_pf_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); @@ -313,20 +310,20 @@ uint32_t bbusters_state::screen_update(screen_device &screen, bitmap_ind16 &bitm /*******************************************************************************/ -void bbusters_state::bbusters_map(address_map &map) +void bbusters_state::main_map(address_map &map) { map(0x000000, 0x07ffff).rom(); - map(0x080000, 0x08ffff).ram().share("ram"); - map(0x090000, 0x090fff).ram().w(FUNC(bbusters_state::video_w)).share("tx_videoram"); + map(0x080000, 0x08ffff).ram(); + map(0x090000, 0x090fff).ram().w(FUNC(bbusters_state::tx_vram_w)).share(m_tx_vram); map(0x0a0000, 0x0a0fff).ram().share("spriteram1"); map(0x0a1000, 0x0a7fff).ram(); /* service mode */ map(0x0a8000, 0x0a8fff).ram().share("spriteram2"); map(0x0a9000, 0x0affff).ram(); /* service mode */ - map(0x0b0000, 0x0b1fff).ram().w(FUNC(bbusters_state::pf_w<0>)).share("pf1_data"); - map(0x0b2000, 0x0b3fff).ram().w(FUNC(bbusters_state::pf_w<1>)).share("pf2_data"); + map(0x0b0000, 0x0b1fff).ram().w(FUNC(bbusters_state::pf_vram_w<0>)).share(m_pf_vram[0]); + map(0x0b2000, 0x0b3fff).ram().w(FUNC(bbusters_state::pf_vram_w<1>)).share(m_pf_vram[1]); map(0x0b4000, 0x0b5fff).ram(); /* service mode */ - map(0x0b8000, 0x0b8003).writeonly().share("pf1_scroll_data"); - map(0x0b8008, 0x0b800b).writeonly().share("pf2_scroll_data"); + map(0x0b8000, 0x0b8003).writeonly().share(m_pf_scroll_reg[0]); + map(0x0b8008, 0x0b800b).writeonly().share(m_pf_scroll_reg[1]); map(0x0d0000, 0x0d0fff).ram().w("palette", FUNC(palette_device::write16)).share("palette"); map(0x0e0000, 0x0e0001).portr("COINS"); /* Coins */ map(0x0e0002, 0x0e0003).portr("IN0"); /* Player 1 & 2 */ @@ -336,9 +333,9 @@ void bbusters_state::bbusters_map(address_map &map) map(0x0e0019, 0x0e0019).r(m_soundlatch[1], FUNC(generic_latch_8_device::read)); map(0x0e8000, 0x0e8003).rw("adc", FUNC(upd7004_device::read), FUNC(upd7004_device::write)).umask16(0x00ff); map(0x0f0000, 0x0f0001).w(FUNC(bbusters_state::coin_counter_w)); - map(0x0f0008, 0x0f0009).w(FUNC(bbusters_state::three_gun_output_w)); + map(0x0f0008, 0x0f0009).w(FUNC(bbusters_state::gun_output_w)); map(0x0f0019, 0x0f0019).w(FUNC(bbusters_state::sound_cpu_w)); - map(0x0f8000, 0x0f80ff).r(FUNC(bbusters_state::eprom_r)).writeonly().share("eeprom"); /* Eeprom */ + map(0x0f8000, 0x0f80ff).r(FUNC(bbusters_state::eprom_r)).writeonly().share(m_eprom_data); /* Eeprom */ } /*******************************************************************************/ @@ -464,9 +461,9 @@ INPUT_PORTS_END /******************************************************************************/ static GFXDECODE_START( gfx_bbusters ) - GFXDECODE_ENTRY( "tx_tiles", 0, gfx_8x8x4_packed_msb, 0, 16 ) - GFXDECODE_ENTRY( "gfx4", 0, gfx_8x8x4_col_2x2_group_packed_msb, 768, 16 ) - GFXDECODE_ENTRY( "gfx5", 0, gfx_8x8x4_col_2x2_group_packed_msb, 1024+256, 16 ) + GFXDECODE_ENTRY( "tx_tiles", 0, gfx_8x8x4_packed_msb, 0, 16 ) + GFXDECODE_ENTRY( "bg1_tiles", 0, gfx_8x8x4_col_2x2_group_packed_msb, 768, 16 ) + GFXDECODE_ENTRY( "bg2_tiles", 0, gfx_8x8x4_col_2x2_group_packed_msb, 1024+256, 16 ) GFXDECODE_END /******************************************************************************/ @@ -475,7 +472,7 @@ void bbusters_state::bbusters(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, 12000000); - m_maincpu->set_addrmap(AS_PROGRAM, &bbusters_state::bbusters_map); + m_maincpu->set_addrmap(AS_PROGRAM, &bbusters_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(bbusters_state::irq6_line_hold)); Z80(config, m_audiocpu, 4000000); // Accurate @@ -561,10 +558,10 @@ ROM_START( bbusters ) ROM_LOAD16_WORD_SWAP( "bb-f23.l13", 0x100000, 0x80000, CRC(c89fe0da) SHA1(92be860a7191e7473c42aa2da981eda873219d3d) ) ROM_LOAD16_WORD_SWAP( "bb-f24.l15", 0x180000, 0x80000, CRC(e0d81359) SHA1(2213c17651b6c023a456447f352b0739439f913a) ) - ROM_REGION( 0x80000, "gfx4", 0 ) + ROM_REGION( 0x80000, "bg1_tiles", 0 ) ROM_LOAD( "bb-back1.m4", 0x000000, 0x80000, CRC(b5445313) SHA1(3c99b557b2af30ff0fbc8a7dc6c40448c4f327db) ) - ROM_REGION( 0x80000, "gfx5", 0 ) + ROM_REGION( 0x80000, "bg2_tiles", 0 ) ROM_LOAD( "bb-back2.m6", 0x000000, 0x80000, CRC(8be996f6) SHA1(1e2c56f4c24793f806d7b366b92edc03145ae94c) ) ROM_REGION( 0x10000, "sprites1:scale_table", 0 ) /* Zoom table - same rom exists in 4 different locations on the board */ @@ -607,10 +604,10 @@ ROM_START( bbustersu ) ROM_LOAD16_WORD_SWAP( "bb-f23.l13", 0x100000, 0x80000, CRC(c89fe0da) SHA1(92be860a7191e7473c42aa2da981eda873219d3d) ) ROM_LOAD16_WORD_SWAP( "bb-f24.l15", 0x180000, 0x80000, CRC(e0d81359) SHA1(2213c17651b6c023a456447f352b0739439f913a) ) - ROM_REGION( 0x80000, "gfx4", 0 ) + ROM_REGION( 0x80000, "bg1_tiles", 0 ) ROM_LOAD( "bb-back1.m4", 0x000000, 0x80000, CRC(b5445313) SHA1(3c99b557b2af30ff0fbc8a7dc6c40448c4f327db) ) - ROM_REGION( 0x80000, "gfx5", 0 ) + ROM_REGION( 0x80000, "bg2_tiles", 0 ) ROM_LOAD( "bb-back2.m6", 0x000000, 0x80000, CRC(8be996f6) SHA1(1e2c56f4c24793f806d7b366b92edc03145ae94c) ) ROM_REGION( 0x10000, "sprites1:scale_table", 0 ) /* Zoom table - same rom exists in 4 different locations on the board */ @@ -653,10 +650,10 @@ ROM_START( bbustersua ) ROM_LOAD16_WORD_SWAP( "bb-f23.l13", 0x100000, 0x80000, CRC(c89fe0da) SHA1(92be860a7191e7473c42aa2da981eda873219d3d) ) ROM_LOAD16_WORD_SWAP( "bb-f24.l15", 0x180000, 0x80000, CRC(e0d81359) SHA1(2213c17651b6c023a456447f352b0739439f913a) ) - ROM_REGION( 0x80000, "gfx4", 0 ) + ROM_REGION( 0x80000, "bg1_tiles", 0 ) ROM_LOAD( "bb-back1.m4", 0x000000, 0x80000, CRC(b5445313) SHA1(3c99b557b2af30ff0fbc8a7dc6c40448c4f327db) ) - ROM_REGION( 0x80000, "gfx5", 0 ) + ROM_REGION( 0x80000, "bg2_tiles", 0 ) ROM_LOAD( "bb-back2.m6", 0x000000, 0x80000, CRC(8be996f6) SHA1(1e2c56f4c24793f806d7b366b92edc03145ae94c) ) ROM_REGION( 0x10000, "sprites1:scale_table", 0 ) /* Zoom table - same rom exists in 4 different locations on the board */ @@ -699,10 +696,10 @@ ROM_START( bbustersj ) ROM_LOAD16_WORD_SWAP( "bb-f23.l13", 0x100000, 0x80000, CRC(c89fe0da) SHA1(92be860a7191e7473c42aa2da981eda873219d3d) ) ROM_LOAD16_WORD_SWAP( "bb-f24.l15", 0x180000, 0x80000, CRC(e0d81359) SHA1(2213c17651b6c023a456447f352b0739439f913a) ) - ROM_REGION( 0x80000, "gfx4", 0 ) + ROM_REGION( 0x80000, "bg1_tiles", 0 ) ROM_LOAD( "bb-back1.m4", 0x000000, 0x80000, CRC(b5445313) SHA1(3c99b557b2af30ff0fbc8a7dc6c40448c4f327db) ) - ROM_REGION( 0x80000, "gfx5", 0 ) + ROM_REGION( 0x80000, "bg2_tiles", 0 ) ROM_LOAD( "bb-back2.m6", 0x000000, 0x80000, CRC(8be996f6) SHA1(1e2c56f4c24793f806d7b366b92edc03145ae94c) ) ROM_REGION( 0x10000, "sprites1:scale_table", 0 ) /* Zoom table - same rom exists in 4 different locations on the board */ @@ -745,10 +742,10 @@ ROM_START( bbustersja ) ROM_LOAD16_WORD_SWAP( "bb-f23.l13", 0x100000, 0x80000, CRC(c89fe0da) SHA1(92be860a7191e7473c42aa2da981eda873219d3d) ) ROM_LOAD16_WORD_SWAP( "bb-f24.l15", 0x180000, 0x80000, CRC(e0d81359) SHA1(2213c17651b6c023a456447f352b0739439f913a) ) - ROM_REGION( 0x80000, "gfx4", 0 ) + ROM_REGION( 0x80000, "bg1_tiles", 0 ) ROM_LOAD( "bb-back1.m4", 0x000000, 0x80000, CRC(b5445313) SHA1(3c99b557b2af30ff0fbc8a7dc6c40448c4f327db) ) - ROM_REGION( 0x80000, "gfx5", 0 ) + ROM_REGION( 0x80000, "bg2_tiles", 0 ) ROM_LOAD( "bb-back2.m6", 0x000000, 0x80000, CRC(8be996f6) SHA1(1e2c56f4c24793f806d7b366b92edc03145ae94c) ) ROM_REGION( 0x10000, "sprites1:scale_table", 0 ) /* Zoom table - same rom exists in 4 different locations on the board */ diff --git a/src/mame/snk/mechatt.cpp b/src/mame/snk/mechatt.cpp index 1086a955400..3c41ea4117c 100644 --- a/src/mame/snk/mechatt.cpp +++ b/src/mame/snk/mechatt.cpp @@ -156,17 +156,17 @@ public: m_audiocpu(*this, "audiocpu"), m_screen(*this, "screen"), m_gfxdecode(*this, "gfxdecode"), - m_sprites(*this, "sprites1"), - m_spriteram(*this, "spriteram1"), + m_sprites(*this, "sprites"), + m_spriteram(*this, "spriteram"), m_soundlatch(*this, "soundlatch%u", 1U), - m_tx_videoram(*this, "tx_videoram"), - m_pf_data(*this, "pf%u_data", 1U), - m_pf_scroll_data(*this, "pf%u_scroll_data", 1U), + m_tx_vram(*this, "tx_videoram"), + m_pf_vram(*this, "pf%u_vram", 1U), + m_pf_scroll_reg(*this, "pf%u_scroll_reg", 1U), m_gun_io(*this, { "GUNX1", "GUNY1", "GUNX2", "GUNY2" }), m_gun_recoil(*this, "Player%u_Gun_Recoil", 1U) { } - void mechatt(machine_config &config); + void mechatt(machine_config &config) ATTR_COLD; protected: virtual void machine_start() override ATTR_COLD; @@ -180,35 +180,36 @@ private: required_device m_sprites; required_device m_spriteram; required_device_array m_soundlatch; - required_shared_ptr m_tx_videoram; - required_shared_ptr_array m_pf_data; - required_shared_ptr_array m_pf_scroll_data; + required_shared_ptr m_tx_vram; + required_shared_ptr_array m_pf_vram; + required_shared_ptr_array m_pf_scroll_reg; required_ioport_array<4> m_gun_io; output_finder<2> m_gun_recoil; tilemap_t *m_fix_tilemap = nullptr; tilemap_t *m_pf_tilemap[2]{}; + bitmap_ind16 m_bitmap_sprites; + TILE_GET_INFO_MEMBER(get_tile_info); template TILE_GET_INFO_MEMBER(get_pf_tile_info); void sound_cpu_w(uint8_t data); - void video_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - template void pf_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void tx_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + template void pf_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void coin_counter_w(uint8_t data); - void mechatt_map(address_map &map) ATTR_COLD; - void sound_map(address_map &map) ATTR_COLD; - void sounda_portmap(address_map &map) ATTR_COLD; - - void two_gun_output_w(uint16_t data); - uint16_t mechatt_gun_r(offs_t offset); + void gun_output_w(uint16_t data); + uint16_t gun_r(offs_t offset); template void mix_sprites(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &cliprect, Proc MIX); - bitmap_ind16 m_bitmap_sprites; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map) ATTR_COLD; + void sound_map(address_map &map) ATTR_COLD; + void sounda_portmap(address_map &map) ATTR_COLD; }; /******************************************************************************/ @@ -225,9 +226,9 @@ void mechatt_state::sound_cpu_w(uint8_t data) } template -void mechatt_state::pf_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void mechatt_state::pf_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - COMBINE_DATA(&m_pf_data[Layer][offset]); + COMBINE_DATA(&m_pf_vram[Layer][offset]); m_pf_tilemap[Layer]->mark_tile_dirty(offset); } @@ -240,20 +241,20 @@ void mechatt_state::coin_counter_w(uint8_t data) TILE_GET_INFO_MEMBER(mechatt_state::get_tile_info) { - uint16_t tile = m_tx_videoram[tile_index]; - tileinfo.set(0, tile&0xfff, tile>>12, 0); + uint16_t const tile = m_tx_vram[tile_index]; + tileinfo.set(0, tile & 0xfff, tile >> 12, 0); } template TILE_GET_INFO_MEMBER(mechatt_state::get_pf_tile_info) { - uint16_t tile = m_pf_data[Layer][tile_index]; - tileinfo.set(Gfx, tile&0xfff, tile>>12, 0); + uint16_t const tile = m_pf_vram[Layer][tile_index]; + tileinfo.set(Gfx, tile & 0xfff, tile >> 12, 0); } -void mechatt_state::video_w(offs_t offset, uint16_t data, uint16_t mem_mask) +void mechatt_state::tx_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - COMBINE_DATA(&m_tx_videoram[offset]); + COMBINE_DATA(&m_tx_vram[offset]); m_fix_tilemap->mark_tile_dirty(offset); } @@ -278,11 +279,11 @@ void mechatt_state::mix_sprites(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, c { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *srcbuf = &srcbitmap.pix(y); - uint16_t *dstbuf = &bitmap.pix(y); + uint16_t const *const srcbuf = &srcbitmap.pix(y); + uint16_t *const dstbuf = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint16_t srcdat = srcbuf[x]; + uint16_t const srcdat = srcbuf[x]; if ((srcdat & 0xf) != 0xf) MIX(srcdat, x, dstbuf); } @@ -294,10 +295,10 @@ uint32_t mechatt_state::screen_update(screen_device &screen, bitmap_ind16 &bitma m_bitmap_sprites.fill(0xffff); m_sprites->draw_sprites(m_bitmap_sprites, cliprect); - m_pf_tilemap[0]->set_scrollx(0, m_pf_scroll_data[0][0]); - m_pf_tilemap[0]->set_scrolly(0, m_pf_scroll_data[0][1]); - m_pf_tilemap[1]->set_scrollx(0, m_pf_scroll_data[1][0]); - m_pf_tilemap[1]->set_scrolly(0, m_pf_scroll_data[1][1]); + m_pf_tilemap[0]->set_scrollx(0, m_pf_scroll_reg[0][0]); + m_pf_tilemap[0]->set_scrolly(0, m_pf_scroll_reg[0][1]); + m_pf_tilemap[1]->set_scrollx(0, m_pf_scroll_reg[1][0]); + m_pf_tilemap[1]->set_scrolly(0, m_pf_scroll_reg[1][1]); m_pf_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); @@ -312,13 +313,13 @@ uint32_t mechatt_state::screen_update(screen_device &screen, bitmap_ind16 &bitma /*******************************************************************************/ -void mechatt_state::two_gun_output_w(uint16_t data) +void mechatt_state::gun_output_w(uint16_t data) { for (int i = 0; i < 2; i++) m_gun_recoil[i] = BIT(data, i); } -uint16_t mechatt_state::mechatt_gun_r(offs_t offset) +uint16_t mechatt_state::gun_r(offs_t offset) { int x = m_gun_io[offset ? 2 : 0]->read(); int y = m_gun_io[offset ? 3 : 1]->read(); @@ -331,23 +332,23 @@ uint16_t mechatt_state::mechatt_gun_r(offs_t offset) return x | (y << 8); } -void mechatt_state::mechatt_map(address_map &map) +void mechatt_state::main_map(address_map &map) { map(0x000000, 0x06ffff).rom(); - map(0x070000, 0x07ffff).ram().share("ram"); - map(0x090000, 0x090fff).ram().w(FUNC(mechatt_state::video_w)).share("tx_videoram"); - map(0x0a0000, 0x0a0fff).ram().share("spriteram1"); + map(0x070000, 0x07ffff).ram(); + map(0x090000, 0x090fff).ram().w(FUNC(mechatt_state::tx_vram_w)).share(m_tx_vram); + map(0x0a0000, 0x0a0fff).ram().share("spriteram"); map(0x0a1000, 0x0a7fff).nopw(); - map(0x0b0000, 0x0b3fff).ram().w(FUNC(mechatt_state::pf_w<0>)).share("pf1_data"); - map(0x0b8000, 0x0b8003).writeonly().share("pf1_scroll_data"); - map(0x0c0000, 0x0c3fff).ram().w(FUNC(mechatt_state::pf_w<1>)).share("pf2_data"); - map(0x0c8000, 0x0c8003).writeonly().share("pf2_scroll_data"); + map(0x0b0000, 0x0b3fff).ram().w(FUNC(mechatt_state::pf_vram_w<0>)).share(m_pf_vram[0]); + map(0x0b8000, 0x0b8003).writeonly().share(m_pf_scroll_reg[0]); + map(0x0c0000, 0x0c3fff).ram().w(FUNC(mechatt_state::pf_vram_w<1>)).share(m_pf_vram[1]); + map(0x0c8000, 0x0c8003).writeonly().share(m_pf_scroll_reg[1]); map(0x0d0000, 0x0d07ff).ram().w("palette", FUNC(palette_device::write16)).share("palette"); map(0x0e0000, 0x0e0001).portr("IN0"); map(0x0e0002, 0x0e0003).portr("DSW1"); - map(0x0e0004, 0x0e0007).r(FUNC(mechatt_state::mechatt_gun_r)); + map(0x0e0004, 0x0e0007).r(FUNC(mechatt_state::gun_r)); map(0x0e4000, 0x0e4001).w(FUNC(mechatt_state::coin_counter_w)); - map(0x0e4002, 0x0e4003).w(FUNC(mechatt_state::two_gun_output_w)); + map(0x0e4002, 0x0e4003).w(FUNC(mechatt_state::gun_output_w)); map(0x0e8001, 0x0e8001).r(m_soundlatch[1], FUNC(generic_latch_8_device::read)).w(FUNC(mechatt_state::sound_cpu_w)); } @@ -476,9 +477,9 @@ INPUT_PORTS_END /******************************************************************************/ static GFXDECODE_START( gfx_mechatt ) - GFXDECODE_ENTRY( "tx_tiles", 0, gfx_8x8x4_packed_msb, 0, 16 ) - GFXDECODE_ENTRY( "gfx3", 0, gfx_8x8x4_col_2x2_group_packed_msb, 512, 16 ) - GFXDECODE_ENTRY( "gfx4", 0, gfx_8x8x4_col_2x2_group_packed_msb, 768, 16 ) + GFXDECODE_ENTRY( "tx_tiles", 0, gfx_8x8x4_packed_msb, 0, 16 ) + GFXDECODE_ENTRY( "bg1_tiles", 0, gfx_8x8x4_col_2x2_group_packed_msb, 512, 16 ) + GFXDECODE_ENTRY( "bg2_tiles", 0, gfx_8x8x4_col_2x2_group_packed_msb, 768, 16 ) GFXDECODE_END @@ -488,7 +489,7 @@ void mechatt_state::mechatt(machine_config &config) { /* basic machine hardware */ M68000(config, m_maincpu, 12000000); - m_maincpu->set_addrmap(AS_PROGRAM, &mechatt_state::mechatt_map); + m_maincpu->set_addrmap(AS_PROGRAM, &mechatt_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(mechatt_state::irq4_line_hold)); Z80(config, m_audiocpu, 4000000); /* Accurate */ @@ -510,9 +511,9 @@ void mechatt_state::mechatt(machine_config &config) BUFFERED_SPRITERAM16(config, m_spriteram); SNK_BBUSTERS_SPR(config, m_sprites, 0); - m_sprites->set_scaletable_tag("sprites1:scale_table"); + m_sprites->set_scaletable_tag("sprites:scale_table"); m_sprites->set_palette("palette"); - m_sprites->set_spriteram_tag("spriteram1"); + m_sprites->set_spriteram_tag("spriteram"); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -544,22 +545,22 @@ ROM_START( mechatt ) ROM_REGION( 0x020000, "tx_tiles", 0 ) // Located on the A8002-2 board ROM_LOAD( "ma_1.l2", 0x000000, 0x10000, CRC(24766917) SHA1(9082a8ae849605ce65b5a0493ae69cfe282f7e7b) ) - ROM_REGION( 0x200000, "sprites1", 0 ) // Located on the A8002-2 board + ROM_REGION( 0x200000, "sprites", 0 ) // Located on the A8002-2 board ROM_LOAD16_WORD_SWAP( "mao89p13.bin", 0x000000, 0x80000, CRC(8bcb16cf) SHA1(409ee1944188d9ce39adce29b1df029b560dd5b0) ) ROM_LOAD16_WORD_SWAP( "ma189p15.bin", 0x080000, 0x80000, CRC(b84d9658) SHA1(448adecb0067d8f5b219ec2f94a8dec84187a554) ) ROM_LOAD16_WORD_SWAP( "ma289p17.bin", 0x100000, 0x80000, CRC(6cbe08ac) SHA1(8f81f6e92b84ab6867452011d52f3e7689c62a1a) ) ROM_LOAD16_WORD_SWAP( "ma389m15.bin", 0x180000, 0x80000, CRC(34d4585e) SHA1(38d9fd5d775e4b3c8b8b487a6ba9b8bdcb3274b0) ) - ROM_REGION( 0x80000, "gfx3", 0 ) // Located on the A8002-2 board + ROM_REGION( 0x80000, "bg1_tiles", 0 ) // Located on the A8002-2 board ROM_LOAD( "mab189a2.bin", 0x000000, 0x80000, CRC(e1c8b4d0) SHA1(2f8a1839cca892f8380c7cffe7a12e615d38fd55) ) - ROM_REGION( 0x80000, "gfx4", 0 ) // Located on the A8002-2 board + ROM_REGION( 0x80000, "bg2_tiles", 0 ) // Located on the A8002-2 board ROM_LOAD( "mab289c2.bin", 0x000000, 0x80000, CRC(14f97ceb) SHA1(a22033532ea616dc3a3db8b66ad6ccc6172ed7cc) ) ROM_REGION( 0x20000, "ymsnd", 0 ) // Located on the A8002-1 main board ROM_LOAD( "ma_2.d10", 0x000000, 0x20000, CRC(ea4cc30d) SHA1(d8f089fc0ce76309411706a8110ad907f93dc97e) ) - ROM_REGION( 0x20000, "sprites1:scale_table", 0 ) // Zoom table - Located on the A8002-2 board + ROM_REGION( 0x20000, "sprites:scale_table", 0 ) // Zoom table - Located on the A8002-2 board ROM_LOAD( "ma_8.f10", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) ROM_LOAD( "ma_9.f12", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) // identical to ma_8.f10 ROM_END @@ -577,7 +578,7 @@ ROM_START( mechattj ) // Uses EPROMs on official SNK A8002-5 & A8002-6 sub board ROM_REGION( 0x020000, "tx_tiles", 0 ) // Located on the A8002-2 board ROM_LOAD( "ma_1.l2", 0x000000, 0x10000, CRC(24766917) SHA1(9082a8ae849605ce65b5a0493ae69cfe282f7e7b) ) - ROM_REGION( 0x200000, "sprites1", 0 ) // Located on the A8002-6 sub board + ROM_REGION( 0x200000, "sprites", 0 ) // Located on the A8002-6 sub board ROM_LOAD16_BYTE( "s_9.a1", 0x000001, 0x20000, CRC(6e8e194c) SHA1(02bbd573a322a3f7f8e92ccceebffdd598b5489e) ) // these 4 == mao89p13.bin ROM_LOAD16_BYTE( "s_1.b1", 0x000000, 0x20000, CRC(fd9161ed) SHA1(b3e2434dd9cb1cafe1022774b863b5f1a008a9d2) ) ROM_LOAD16_BYTE( "s_10.a2", 0x040001, 0x20000, CRC(fad6a1ab) SHA1(5347b4493c8004dc8cedc0b37aba494f203142b8) ) @@ -595,13 +596,13 @@ ROM_START( mechattj ) // Uses EPROMs on official SNK A8002-5 & A8002-6 sub board ROM_LOAD16_BYTE( "s_16.a8", 0x1c0001, 0x20000, CRC(70f28040) SHA1(91012728953563fcc576725337e6ba7e1b49d1ba) ) ROM_LOAD16_BYTE( "s_8.b8", 0x1c0000, 0x20000, CRC(a6f8574f) SHA1(87c041669b2eaec495ae10a6f45b6668accb92bf) ) - ROM_REGION( 0x80000, "gfx3", 0 ) // these 4 == mab189a2.bin - Located on the A8002-5 sub board + ROM_REGION( 0x80000, "bg1_tiles", 0 ) // these 4 == mab189a2.bin - Located on the A8002-5 sub board ROM_LOAD( "s_21.b3", 0x000000, 0x20000, CRC(701a0072) SHA1(b03b6fa18e0cfcd5c7c541025fa2d3632d2f8387) ) ROM_LOAD( "s_22.b4", 0x020000, 0x20000, CRC(34e6225c) SHA1(f6335084f4f4c7a4b6528e6ad74962b88f81e3bc) ) ROM_LOAD( "s_23.b5", 0x040000, 0x20000, CRC(9a7399d3) SHA1(04e0327b0da75f621b51e1831cbdc4537082e32b) ) ROM_LOAD( "s_24.b6", 0x060000, 0x20000, CRC(f097459d) SHA1(466364677f048519eb2894ddecf76f5c52f6afe9) ) - ROM_REGION( 0x80000, "gfx4", 0 ) // these 4 == mab289c2.bin - Located on the A8002-5 sub board + ROM_REGION( 0x80000, "bg2_tiles", 0 ) // these 4 == mab289c2.bin - Located on the A8002-5 sub board ROM_LOAD( "s_17.a3", 0x000000, 0x20000, CRC(cc47c4a3) SHA1(140f53b671b4eaed6fcc516c4018f07a6d7c2290) ) ROM_LOAD( "s_18.a4", 0x020000, 0x20000, CRC(a04377e8) SHA1(841c6c3073b137f6a5c875db32039186c014f785) ) ROM_LOAD( "s_19.a5", 0x040000, 0x20000, CRC(b07f5289) SHA1(8817bd225edf9b0fa439b220617f925365e39253) ) @@ -610,7 +611,7 @@ ROM_START( mechattj ) // Uses EPROMs on official SNK A8002-5 & A8002-6 sub board ROM_REGION( 0x20000, "ymsnd", 0 ) // Located on the A8002-1 main board ROM_LOAD( "ma_2.d10", 0x000000, 0x20000, CRC(ea4cc30d) SHA1(d8f089fc0ce76309411706a8110ad907f93dc97e) ) - ROM_REGION( 0x20000, "sprites1:scale_table", 0 ) // Zoom table - Located on the A8002-2 board + ROM_REGION( 0x20000, "sprites:scale_table", 0 ) // Zoom table - Located on the A8002-2 board ROM_LOAD( "ma_8.f10", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) ROM_LOAD( "ma_9.f12", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) // identical to ma_8.f10 ROM_END @@ -628,22 +629,22 @@ ROM_START( mechattu ) ROM_REGION( 0x020000, "tx_tiles", 0 ) // Located on the A8002-2 board ROM_LOAD( "ma_1.l2", 0x000000, 0x10000, CRC(24766917) SHA1(9082a8ae849605ce65b5a0493ae69cfe282f7e7b) ) - ROM_REGION( 0x200000, "sprites1", 0 ) // Located on the A8002-2 board + ROM_REGION( 0x200000, "sprites", 0 ) // Located on the A8002-2 board ROM_LOAD16_WORD_SWAP( "mao89p13.bin", 0x000000, 0x80000, CRC(8bcb16cf) SHA1(409ee1944188d9ce39adce29b1df029b560dd5b0) ) ROM_LOAD16_WORD_SWAP( "ma189p15.bin", 0x080000, 0x80000, CRC(b84d9658) SHA1(448adecb0067d8f5b219ec2f94a8dec84187a554) ) ROM_LOAD16_WORD_SWAP( "ma289p17.bin", 0x100000, 0x80000, CRC(6cbe08ac) SHA1(8f81f6e92b84ab6867452011d52f3e7689c62a1a) ) ROM_LOAD16_WORD_SWAP( "ma389m15.bin", 0x180000, 0x80000, CRC(34d4585e) SHA1(38d9fd5d775e4b3c8b8b487a6ba9b8bdcb3274b0) ) - ROM_REGION( 0x80000, "gfx3", 0 ) // Located on the A8002-2 board + ROM_REGION( 0x80000, "bg1_tiles", 0 ) // Located on the A8002-2 board ROM_LOAD( "mab189a2.bin", 0x000000, 0x80000, CRC(e1c8b4d0) SHA1(2f8a1839cca892f8380c7cffe7a12e615d38fd55) ) - ROM_REGION( 0x80000, "gfx4", 0 ) // Located on the A8002-2 board + ROM_REGION( 0x80000, "bg2_tiles", 0 ) // Located on the A8002-2 board ROM_LOAD( "mab289c2.bin", 0x000000, 0x80000, CRC(14f97ceb) SHA1(a22033532ea616dc3a3db8b66ad6ccc6172ed7cc) ) ROM_REGION( 0x20000, "ymsnd", 0 ) // Located on the A8002-1 main board ROM_LOAD( "ma_2.d10", 0x000000, 0x20000, CRC(ea4cc30d) SHA1(d8f089fc0ce76309411706a8110ad907f93dc97e) ) - ROM_REGION( 0x20000, "sprites1:scale_table", 0 ) // Zoom table - Located on the A8002-2 board + ROM_REGION( 0x20000, "sprites:scale_table", 0 ) // Zoom table - Located on the A8002-2 board ROM_LOAD( "ma_8.f10", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) ROM_LOAD( "ma_9.f12", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) // identical to ma_8.f10 ROM_END @@ -662,7 +663,7 @@ ROM_START( mechattu1 ) // Uses EPROMs on official SNK A8002-5 & A8002-6 sub boar ROM_REGION( 0x020000, "tx_tiles", 0 ) // Located on the A8002-2 board ROM_LOAD( "ma_1.l2", 0x000000, 0x10000, CRC(24766917) SHA1(9082a8ae849605ce65b5a0493ae69cfe282f7e7b) ) - ROM_REGION( 0x200000, "sprites1", 0 ) // Located on the A8002-6 sub board + ROM_REGION( 0x200000, "sprites", 0 ) // Located on the A8002-6 sub board ROM_LOAD16_BYTE( "s_9.a1", 0x000001, 0x20000, CRC(6e8e194c) SHA1(02bbd573a322a3f7f8e92ccceebffdd598b5489e) ) // these 4 == mao89p13.bin ROM_LOAD16_BYTE( "s_1.b1", 0x000000, 0x20000, CRC(fd9161ed) SHA1(b3e2434dd9cb1cafe1022774b863b5f1a008a9d2) ) ROM_LOAD16_BYTE( "s_10.a2", 0x040001, 0x20000, CRC(fad6a1ab) SHA1(5347b4493c8004dc8cedc0b37aba494f203142b8) ) @@ -680,13 +681,13 @@ ROM_START( mechattu1 ) // Uses EPROMs on official SNK A8002-5 & A8002-6 sub boar ROM_LOAD16_BYTE( "s_16.a8", 0x1c0001, 0x20000, CRC(70f28040) SHA1(91012728953563fcc576725337e6ba7e1b49d1ba) ) ROM_LOAD16_BYTE( "s_8.b8", 0x1c0000, 0x20000, CRC(a6f8574f) SHA1(87c041669b2eaec495ae10a6f45b6668accb92bf) ) - ROM_REGION( 0x80000, "gfx3", 0 ) // these 4 == mab189a2.bin - Located on the A8002-5 sub board + ROM_REGION( 0x80000, "bg1_tiles", 0 ) // these 4 == mab189a2.bin - Located on the A8002-5 sub board ROM_LOAD( "s_21.b3", 0x000000, 0x20000, CRC(701a0072) SHA1(b03b6fa18e0cfcd5c7c541025fa2d3632d2f8387) ) ROM_LOAD( "s_22.b4", 0x020000, 0x20000, CRC(34e6225c) SHA1(f6335084f4f4c7a4b6528e6ad74962b88f81e3bc) ) ROM_LOAD( "s_23.b5", 0x040000, 0x20000, CRC(9a7399d3) SHA1(04e0327b0da75f621b51e1831cbdc4537082e32b) ) ROM_LOAD( "s_24.b6", 0x060000, 0x20000, CRC(f097459d) SHA1(466364677f048519eb2894ddecf76f5c52f6afe9) ) - ROM_REGION( 0x80000, "gfx4", 0 ) // these 4 == mab289c2.bin - Located on the A8002-5 sub board + ROM_REGION( 0x80000, "bg2_tiles", 0 ) // these 4 == mab289c2.bin - Located on the A8002-5 sub board ROM_LOAD( "s_17.a3", 0x000000, 0x20000, CRC(cc47c4a3) SHA1(140f53b671b4eaed6fcc516c4018f07a6d7c2290) ) ROM_LOAD( "s_18.a4", 0x020000, 0x20000, CRC(a04377e8) SHA1(841c6c3073b137f6a5c875db32039186c014f785) ) ROM_LOAD( "s_19.a5", 0x040000, 0x20000, CRC(b07f5289) SHA1(8817bd225edf9b0fa439b220617f925365e39253) ) @@ -695,7 +696,7 @@ ROM_START( mechattu1 ) // Uses EPROMs on official SNK A8002-5 & A8002-6 sub boar ROM_REGION( 0x20000, "ymsnd", 0 ) // Located on the A8002-1 main board ROM_LOAD( "ma_2.d10", 0x000000, 0x20000, CRC(ea4cc30d) SHA1(d8f089fc0ce76309411706a8110ad907f93dc97e) ) - ROM_REGION( 0x20000, "sprites1:scale_table", 0 ) // Zoom table - Located on the A8002-2 board + ROM_REGION( 0x20000, "sprites:scale_table", 0 ) // Zoom table - Located on the A8002-2 board ROM_LOAD( "ma_8.f10", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) ROM_LOAD( "ma_9.f12", 0x000000, 0x10000, CRC(61f3de03) SHA1(736f9634fe054ea68a2aa90a743bd0dc320f23c9) ) // identical to ma_8.f10 ROM_END diff --git a/src/mame/snk/snk_bbusters_spr.cpp b/src/mame/snk/snk_bbusters_spr.cpp index 1dc4ca27e72..fd56116111b 100644 --- a/src/mame/snk/snk_bbusters_spr.cpp +++ b/src/mame/snk/snk_bbusters_spr.cpp @@ -98,7 +98,7 @@ inline const uint8_t *snk_bbusters_spr_device::get_source_ptr(gfx_element *tileg break; } - return tilegfx->get_data((sprite + code) % tilegfx->elements()) + ((dy % 16) * tilegfx->rowbytes()); + return tilegfx->get_data((sprite + code) % tilegfx->elements()) + ((dy & 0xf) * tilegfx->rowbytes()); } void snk_bbusters_spr_device::draw_block(bitmap_ind16 &dest, const rectangle &cliprect, int x, int y, int size, int flipx, int flipy, uint32_t sprite, int color, int block) @@ -106,10 +106,10 @@ void snk_bbusters_spr_device::draw_block(bitmap_ind16 &dest, const rectangle &cl // TODO: respect cliprect gfx_element *tilegfx = gfx(0); - pen_t pen_base = tilegfx->colorbase() + tilegfx->granularity() * (color % tilegfx->colors()); - uint32_t xinc = (m_scale_line_count * 0x10000) / size; + pen_t const pen_base = tilegfx->colorbase() + tilegfx->granularity() * (color % tilegfx->colors()); + uint32_t const xinc = (m_scale_line_count * 0x10000) / size; int dy = y; - int ex = m_scale_line_count; + int const ex = m_scale_line_count; while (m_scale_line_count) { @@ -130,11 +130,11 @@ void snk_bbusters_spr_device::draw_block(bitmap_ind16 &dest, const rectangle &cl for (int sx = 0; sx < size; sx++) { - if ((sx % 16) == 0) + if ((sx & 0xf) == 0) srcptr = get_source_ptr(tilegfx, sprite, sx, srcline, block); - uint8_t pixel = *srcptr++; - if (pixel != 15) + uint8_t const pixel = *srcptr++; + if (pixel != 0xf) destline[(x + (x_index >> 16)) & 0x1ff] = pen_base + pixel; if (flipx) @@ -184,14 +184,14 @@ void snk_bbusters_spr_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle Block type 3: 0x00 = no scale, 0x3f == half size - 128 pixel sprite */ + int const block = (colour >> 8) & 0x3; + bool const fy = BIT(colour, 10); + bool const fx = BIT(colour, 11); colour >>= 12; - int block = (sprram[offs + 0] >> 8) & 0x3; - int fy = sprram[offs + 0] & 0x400; - int fx = sprram[offs + 0] & 0x800; sprite &= 0x3fff; int scale; - switch ((sprram[offs + 0] >> 8) & 0x3) + switch (block) { case 0: scale = sprram[offs + 0] & 0x7;