wrally.cpp : Cleanup gfxdecode, Duplicates, ACCESSING_BITS, Runtime tag lookups (#4060)

This commit is contained in:
cam900 2018-11-10 18:27:57 +09:00 committed by Ivan Vangelista
parent 95c2668f4c
commit a2af88a451
4 changed files with 16 additions and 29 deletions

View File

@ -160,7 +160,7 @@ void wrally_state::wrally_map(address_map &map)
[this](address_space &space, offs_t offset, u8 data, u8 mem_mask) { [this](address_space &space, offs_t offset, u8 data, u8 mem_mask) {
m_outlatch->write_d0(space, offset >> 3, data, mem_mask); m_outlatch->write_d0(space, offset >> 3, data, mem_mask);
}); });
map(0x70000c, 0x70000d).w(FUNC(wrally_state::okim6295_bankswitch_w)); /* OKI6295 bankswitch */ map(0x70000d, 0x70000d).w(FUNC(wrally_state::okim6295_bankswitch_w)); /* OKI6295 bankswitch */
map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); /* OKI6295 status/data register */ map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); /* OKI6295 status/data register */
map(0xfec000, 0xfeffff).ram().share("shareram"); /* Work RAM (shared with DS5002FP) */ map(0xfec000, 0xfeffff).ram().share("shareram"); /* Work RAM (shared with DS5002FP) */
} }
@ -253,10 +253,8 @@ static const gfx_layout wrally_tilelayout16 =
RGN_FRAC(1,2), /* number of tiles */ RGN_FRAC(1,2), /* number of tiles */
4, /* 4 bpp */ 4, /* 4 bpp */
{ RGN_FRAC(1,2)+8, RGN_FRAC(1,2)+0, 8, 0 }, { RGN_FRAC(1,2)+8, RGN_FRAC(1,2)+0, 8, 0 },
{ 0, 1, 2, 3, 4, 5, 6, 7, { STEP8(0,1), STEP8(16*16,1) },
16*16+0, 16*16+1, 16*16+2, 16*16+3, 16*16+4, 16*16+5, 16*16+6, 16*16+7 }, { STEP16(0,16) },
{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
64*8 64*8
}; };

View File

@ -17,6 +17,7 @@ public:
m_outlatch(*this, "outlatch"), m_outlatch(*this, "outlatch"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"), m_palette(*this, "palette"),
m_okibank(*this, "okibank"),
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_vregs(*this, "vregs"), m_vregs(*this, "vregs"),
m_spriteram(*this, "spriteram"), m_spriteram(*this, "spriteram"),
@ -32,14 +33,13 @@ private:
DECLARE_WRITE8_MEMBER(shareram_w); DECLARE_WRITE8_MEMBER(shareram_w);
DECLARE_WRITE16_MEMBER(vram_w); DECLARE_WRITE16_MEMBER(vram_w);
DECLARE_WRITE_LINE_MEMBER(flipscreen_w); DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
DECLARE_WRITE16_MEMBER(okim6295_bankswitch_w); DECLARE_WRITE8_MEMBER(okim6295_bankswitch_w);
DECLARE_WRITE_LINE_MEMBER(coin1_counter_w); DECLARE_WRITE_LINE_MEMBER(coin1_counter_w);
DECLARE_WRITE_LINE_MEMBER(coin2_counter_w); DECLARE_WRITE_LINE_MEMBER(coin2_counter_w);
DECLARE_WRITE_LINE_MEMBER(coin1_lockout_w); DECLARE_WRITE_LINE_MEMBER(coin1_lockout_w);
DECLARE_WRITE_LINE_MEMBER(coin2_lockout_w); DECLARE_WRITE_LINE_MEMBER(coin2_lockout_w);
TILE_GET_INFO_MEMBER(get_tile_info_screen0); template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
TILE_GET_INFO_MEMBER(get_tile_info_screen1);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -55,6 +55,7 @@ private:
required_device<ls259_device> m_outlatch; required_device<ls259_device> m_outlatch;
required_device<gfxdecode_device> m_gfxdecode; required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
required_memory_bank m_okibank;
required_shared_ptr<uint16_t> m_videoram; required_shared_ptr<uint16_t> m_videoram;
required_shared_ptr<uint16_t> m_vregs; required_shared_ptr<uint16_t> m_vregs;

View File

@ -17,7 +17,7 @@
void wrally_state::machine_start() void wrally_state::machine_start()
{ {
membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000); m_okibank->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
} }
/*************************************************************************** /***************************************************************************
@ -51,11 +51,9 @@ WRITE_LINE_MEMBER(wrally_state::flipscreen_w)
flip_screen_set(state); flip_screen_set(state);
} }
WRITE16_MEMBER(wrally_state::okim6295_bankswitch_w) WRITE8_MEMBER(wrally_state::okim6295_bankswitch_w)
{ {
if (ACCESSING_BITS_0_7){ m_okibank->set_entry(data & 0x0f);
membank("okibank")->set_entry(data & 0x0f);
}
} }
WRITE_LINE_MEMBER(wrally_state::coin1_counter_w) WRITE_LINE_MEMBER(wrally_state::coin1_counter_w)

View File

@ -36,21 +36,11 @@
1 | xxx----- -------- | not used? 1 | xxx----- -------- | not used?
*/ */
TILE_GET_INFO_MEMBER(wrally_state::get_tile_info_screen0) template<int Layer>
TILE_GET_INFO_MEMBER(wrally_state::get_tile_info)
{ {
int data = m_videoram[tile_index << 1]; int data = m_videoram[(Layer * 0x2000/2) + (tile_index << 1)];
int data2 = m_videoram[(tile_index << 1) + 1]; int data2 = m_videoram[(Layer * 0x2000/2) + (tile_index << 1) + 1];
int code = data & 0x3fff;
tileinfo.category = (data2 >> 5) & 0x01;
SET_TILE_INFO_MEMBER(0, code, data2 & 0x1f, TILE_FLIPYX((data2 >> 6) & 0x03));
}
TILE_GET_INFO_MEMBER(wrally_state::get_tile_info_screen1)
{
int data = m_videoram[(0x2000/2) + (tile_index << 1)];
int data2 = m_videoram[(0x2000/2) + (tile_index << 1) + 1];
int code = data & 0x3fff; int code = data & 0x3fff;
tileinfo.category = (data2 >> 5) & 0x01; tileinfo.category = (data2 >> 5) & 0x01;
@ -66,8 +56,8 @@ TILE_GET_INFO_MEMBER(wrally_state::get_tile_info_screen1)
void wrally_state::video_start() void wrally_state::video_start()
{ {
m_pant[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wrally_state::get_tile_info_screen0),this),TILEMAP_SCAN_ROWS,16,16,64,32); m_pant[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wrally_state::get_tile_info<0>),this),TILEMAP_SCAN_ROWS,16,16,64,32);
m_pant[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wrally_state::get_tile_info_screen1),this),TILEMAP_SCAN_ROWS,16,16,64,32); m_pant[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wrally_state::get_tile_info<1>),this),TILEMAP_SCAN_ROWS,16,16,64,32);
m_pant[0]->set_transmask(0,0xff01,0x00ff); /* this layer is split in two (pens 1..7, pens 8-15) */ m_pant[0]->set_transmask(0,0xff01,0x00ff); /* this layer is split in two (pens 1..7, pens 8-15) */
m_pant[1]->set_transparent_pen(0); m_pant[1]->set_transparent_pen(0);