small cleanup

This commit is contained in:
Michaël Banaan Ananas 2014-04-02 00:26:00 +00:00
parent 08f871c71c
commit ef5e10c0ab
4 changed files with 135 additions and 98 deletions

View File

@ -271,8 +271,8 @@ static ADDRESS_MAP_START( perfrman_map, AS_PROGRAM, 8, slapfght_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM
AM_RANGE(0x8800, 0x8fff) AM_RAM AM_SHARE("share1")
AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE(slapfight_videoram_w) AM_SHARE("videoram")
AM_RANGE(0x9800, 0x9fff) AM_RAM_WRITE(slapfight_colorram_w) AM_SHARE("colorram")
AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0x9800, 0x9fff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE("spriteram")
ADDRESS_MAP_END
@ -281,15 +281,15 @@ static ADDRESS_MAP_START( tigerh_map, AS_PROGRAM, 8, slapfght_state )
AM_RANGE(0x0000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM
AM_RANGE(0xc800, 0xcfff) AM_RAM AM_SHARE("share1")
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(slapfight_videoram_w) AM_SHARE("videoram")
AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(slapfight_colorram_w) AM_SHARE("colorram")
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0xe800, 0xe800) AM_WRITEONLY AM_SHARE("scrollx_lo")
AM_RANGE(0xe801, 0xe801) AM_WRITEONLY AM_SHARE("scrollx_hi")
AM_RANGE(0xe802, 0xe802) AM_WRITEONLY AM_SHARE("scrolly")
AM_RANGE(0xe800, 0xe800) AM_WRITE(scrollx_lo_w)
AM_RANGE(0xe801, 0xe801) AM_WRITE(scrollx_hi_w)
AM_RANGE(0xe802, 0xe802) AM_WRITE(scrolly_w)
AM_RANGE(0xe803, 0xe803) AM_READWRITE(tigerh_mcu_r, tigerh_mcu_w)
AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(slapfight_fixram_w) AM_SHARE("fixvideoram")
AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(slapfight_fixcol_w) AM_SHARE("fixcolorram")
AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(fixram_w) AM_SHARE("fixvideoram")
AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(fixcol_w) AM_SHARE("fixcolorram")
ADDRESS_MAP_END
static ADDRESS_MAP_START( tigerhb1_map, AS_PROGRAM, 8, slapfght_state )
@ -308,15 +308,15 @@ static ADDRESS_MAP_START( slapfigh_map, AS_PROGRAM, 8, slapfght_state )
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xc7ff) AM_RAM
AM_RANGE(0xc800, 0xcfff) AM_RAM AM_SHARE("share1")
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(slapfight_videoram_w) AM_SHARE("videoram")
AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(slapfight_colorram_w) AM_SHARE("colorram")
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0xe800, 0xe800) AM_WRITEONLY AM_SHARE("scrollx_lo")
AM_RANGE(0xe801, 0xe801) AM_WRITEONLY AM_SHARE("scrollx_hi")
AM_RANGE(0xe802, 0xe802) AM_WRITEONLY AM_SHARE("scrolly")
AM_RANGE(0xe800, 0xe800) AM_WRITE(scrollx_lo_w)
AM_RANGE(0xe801, 0xe801) AM_WRITE(scrollx_hi_w)
AM_RANGE(0xe802, 0xe802) AM_WRITE(scrolly_w)
AM_RANGE(0xe803, 0xe803) AM_READWRITE(tigerh_mcu_r, tigerh_mcu_w)
AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(slapfight_fixram_w) AM_SHARE("fixvideoram")
AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(slapfight_fixcol_w) AM_SHARE("fixcolorram")
AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(fixram_w) AM_SHARE("fixvideoram")
AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(fixcol_w) AM_SHARE("fixcolorram")
ADDRESS_MAP_END
static ADDRESS_MAP_START( slapfighb1_map, AS_PROGRAM, 8, slapfght_state )
@ -334,15 +334,15 @@ static ADDRESS_MAP_START( slapfighb2_map, AS_PROGRAM, 8, slapfght_state )
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
AM_RANGE(0xc000, 0xc7ff) AM_RAM
AM_RANGE(0xc800, 0xcfff) AM_RAM AM_SHARE("share1")
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(slapfight_videoram_w) AM_SHARE("videoram")
AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(slapfight_colorram_w) AM_SHARE("colorram")
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram")
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0xe800, 0xe800) AM_WRITEONLY AM_SHARE("scrollx_hi")
AM_RANGE(0xe802, 0xe802) AM_WRITEONLY AM_SHARE("scrolly")
AM_RANGE(0xe803, 0xe803) AM_WRITEONLY AM_SHARE("scrollx_lo")
AM_RANGE(0xe800, 0xe800) AM_WRITE(scrollx_hi_w)
AM_RANGE(0xe802, 0xe802) AM_WRITE(scrolly_w)
AM_RANGE(0xe803, 0xe803) AM_WRITE(scrollx_lo_w)
AM_RANGE(0xec00, 0xefff) AM_ROM // it reads a copy of the logo from here!
AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(slapfight_fixram_w) AM_SHARE("fixvideoram")
AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(slapfight_fixcol_w) AM_SHARE("fixcolorram")
AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(fixram_w) AM_SHARE("fixvideoram")
AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(fixcol_w) AM_SHARE("fixcolorram")
ADDRESS_MAP_END
@ -758,6 +758,9 @@ void slapfght_state::machine_start()
// zerofill
m_palette_bank = 0;
m_flipscreen = 0;
m_scrollx_lo = 0;
m_scrollx_hi = 0;
m_scrolly = 0;
m_main_irq_enabled = false;
m_sound_nmi_enabled = false;
@ -787,6 +790,9 @@ void slapfght_state::machine_start()
// savestates
save_item(NAME(m_palette_bank));
save_item(NAME(m_flipscreen));
save_item(NAME(m_scrollx_lo));
save_item(NAME(m_scrollx_hi));
save_item(NAME(m_scrolly));
save_item(NAME(m_main_irq_enabled));
save_item(NAME(m_sound_nmi_enabled));
@ -1009,7 +1015,7 @@ static MACHINE_CONFIG_START( perfrman, slapfght_state )
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 34*8-1, 2*8, 32*8-1)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(slapfght_state, screen_update_perfrman)
MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette")
@ -1055,7 +1061,7 @@ static MACHINE_CONFIG_START( tigerh, slapfght_state )
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 36*8-1, 2*8, 32*8-1)
MCFG_SCREEN_VISIBLE_AREA(1*8, 36*8-1, 2*8-1, 32*8-1-1)
MCFG_SCREEN_UPDATE_DRIVER(slapfght_state, screen_update_slapfight)
MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette")
@ -1118,7 +1124,7 @@ static MACHINE_CONFIG_START( slapfigh, slapfght_state )
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 36*8-1, 2*8, 32*8-1)
MCFG_SCREEN_VISIBLE_AREA(1*8, 36*8-1, 2*8-1, 32*8-1-1)
MCFG_SCREEN_UPDATE_DRIVER(slapfght_state, screen_update_slapfight)
MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising)
MCFG_SCREEN_PALETTE("palette")

View File

@ -20,13 +20,10 @@ public:
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_spriteram(*this, "spriteram"),
m_slapfight_videoram(*this, "videoram"),
m_slapfight_colorram(*this, "colorram"),
m_slapfight_fixvideoram(*this, "fixvideoram"),
m_slapfight_fixcolorram(*this, "fixcolorram"),
m_slapfight_scrollx_lo(*this, "scrollx_lo"),
m_slapfight_scrollx_hi(*this, "scrollx_hi"),
m_slapfight_scrolly(*this, "scrolly")
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_fixvideoram(*this, "fixvideoram"),
m_fixcolorram(*this, "fixcolorram")
{ }
// devices, memory pointers
@ -38,13 +35,10 @@ public:
required_device<palette_device> m_palette;
required_device<buffered_spriteram8_device> m_spriteram;
required_shared_ptr<UINT8> m_slapfight_videoram;
required_shared_ptr<UINT8> m_slapfight_colorram;
optional_shared_ptr<UINT8> m_slapfight_fixvideoram;
optional_shared_ptr<UINT8> m_slapfight_fixcolorram;
optional_shared_ptr<UINT8> m_slapfight_scrollx_lo;
optional_shared_ptr<UINT8> m_slapfight_scrollx_hi;
optional_shared_ptr<UINT8> m_slapfight_scrolly;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_colorram;
optional_shared_ptr<UINT8> m_fixvideoram;
optional_shared_ptr<UINT8> m_fixcolorram;
/* This it the best way to allow game specific kludges until the system is fully understood */
enum getstar_id
@ -60,6 +54,9 @@ public:
tilemap_t *m_fix_tilemap;
UINT8 m_palette_bank;
UINT8 m_flipscreen;
UINT8 m_scrollx_lo;
UINT8 m_scrollx_hi;
UINT8 m_scrolly;
bool m_main_irq_enabled;
bool m_sound_nmi_enabled;
@ -91,10 +88,13 @@ public:
DECLARE_WRITE8_MEMBER(prg_bank_w);
DECLARE_READ8_MEMBER(vblank_r);
DECLARE_WRITE8_MEMBER(sound_nmi_enable_w);
DECLARE_WRITE8_MEMBER(slapfight_videoram_w);
DECLARE_WRITE8_MEMBER(slapfight_colorram_w);
DECLARE_WRITE8_MEMBER(slapfight_fixram_w);
DECLARE_WRITE8_MEMBER(slapfight_fixcol_w);
DECLARE_WRITE8_MEMBER(videoram_w);
DECLARE_WRITE8_MEMBER(colorram_w);
DECLARE_WRITE8_MEMBER(fixram_w);
DECLARE_WRITE8_MEMBER(fixcol_w);
DECLARE_WRITE8_MEMBER(scrollx_lo_w);
DECLARE_WRITE8_MEMBER(scrollx_hi_w);
DECLARE_WRITE8_MEMBER(scrolly_w);
DECLARE_WRITE8_MEMBER(flipscreen_w);
DECLARE_WRITE8_MEMBER(palette_bank_w);
@ -145,7 +145,8 @@ public:
DECLARE_VIDEO_START(perfrman);
DECLARE_VIDEO_START(slapfight);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority_to_display);
void draw_perfrman_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer);
void draw_slapfight_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_perfrman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_slapfight(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

View File

@ -160,11 +160,11 @@ WRITE8_MEMBER(slapfght_state::slapfight_68705_portB_w)
}
if ((m_ddrB & 0x08) && (~data & 0x08) && (m_portB_out & 0x08))
{
*m_slapfight_scrollx_lo = m_portA_out;
m_scrollx_lo = m_portA_out;
}
if ((m_ddrB & 0x10) && (~data & 0x10) && (m_portB_out & 0x10))
{
*m_slapfight_scrollx_hi = m_portA_out;
m_scrollx_hi = m_portA_out;
}
m_portB_out = data;

View File

@ -19,24 +19,24 @@
TILE_GET_INFO_MEMBER(slapfght_state::get_pf_tile_info)
{
/* For Performan only */
int tile = m_slapfight_videoram[tile_index] | ((m_slapfight_colorram[tile_index] & 0x03) << 8);
int color = (m_slapfight_colorram[tile_index] >> 3) & 0x0f;
int tile = m_videoram[tile_index] | ((m_colorram[tile_index] & 0x03) << 8);
int color = (m_colorram[tile_index] >> 3) & 0x0f;
SET_TILE_INFO_MEMBER(0, tile, color, 0);
}
TILE_GET_INFO_MEMBER(slapfght_state::get_pf1_tile_info)
{
int tile = m_slapfight_videoram[tile_index] | ((m_slapfight_colorram[tile_index] & 0x0f) << 8);
int color = (m_slapfight_colorram[tile_index] & 0xf0) >> 4;
int tile = m_videoram[tile_index] | ((m_colorram[tile_index] & 0x0f) << 8);
int color = (m_colorram[tile_index] & 0xf0) >> 4;
SET_TILE_INFO_MEMBER(1, tile, color, 0);
}
TILE_GET_INFO_MEMBER(slapfght_state::get_fix_tile_info)
{
int tile = m_slapfight_fixvideoram[tile_index] | ((m_slapfight_fixcolorram[tile_index] & 0x03) << 8);
int color = (m_slapfight_fixcolorram[tile_index] & 0xfc) >> 2;
int tile = m_fixvideoram[tile_index] | ((m_fixcolorram[tile_index] & 0x03) << 8);
int color = (m_fixcolorram[tile_index] & 0xfc) >> 2;
SET_TILE_INFO_MEMBER(0, tile, color, 0);
}
@ -72,30 +72,45 @@ VIDEO_START_MEMBER(slapfght_state, slapfight)
***************************************************************************/
WRITE8_MEMBER(slapfght_state::slapfight_videoram_w)
WRITE8_MEMBER(slapfght_state::videoram_w)
{
m_slapfight_videoram[offset] = data;
m_videoram[offset] = data;
m_pf1_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(slapfght_state::slapfight_colorram_w)
WRITE8_MEMBER(slapfght_state::colorram_w)
{
m_slapfight_colorram[offset] = data;
m_colorram[offset] = data;
m_pf1_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(slapfght_state::slapfight_fixram_w)
WRITE8_MEMBER(slapfght_state::fixram_w)
{
m_slapfight_fixvideoram[offset] = data;
m_fixvideoram[offset] = data;
m_fix_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(slapfght_state::slapfight_fixcol_w)
WRITE8_MEMBER(slapfght_state::fixcol_w)
{
m_slapfight_fixcolorram[offset] = data;
m_fixcolorram[offset] = data;
m_fix_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(slapfght_state::scrollx_lo_w)
{
m_scrollx_lo = data;
}
WRITE8_MEMBER(slapfght_state::scrollx_hi_w)
{
m_scrollx_hi = data;
}
WRITE8_MEMBER(slapfght_state::scrolly_w)
{
m_scrolly = data;
}
WRITE8_MEMBER(slapfght_state::flipscreen_w)
{
m_flipscreen = offset ? 0 : 1;
@ -114,65 +129,80 @@ WRITE8_MEMBER(slapfght_state::palette_bank_w)
***************************************************************************/
void slapfght_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority_to_display)
void slapfght_state::draw_perfrman_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer)
{
UINT8 *src = m_spriteram->buffer();
for (int offs = 0; offs < m_spriteram->bytes(); offs += 4)
{
int sx, sy;
if ((src[offs + 2] & 0x80) == priority_to_display)
{
sx = src[offs + 1] + 3;
sy = src[offs + 3] - 1;
m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
src[offs],
((src[offs + 2] >> 1) & 3) | ((src[offs + 2] << 2) & 4) | (m_palette_bank << 3),
0, 0,
sx, sy, 0
);
}
/*
0: xxxxxxxx - code
1: xxxxxxxx - x
2: x....... - priority over backdrop
.x...... - sprite-sprite priority (see point-pop sprites)
..x..... - ?
...xx... - no function?
.....xxx - color
3: xxxxxxxx - y
*/
int code = src[offs + 0];
int sy = src[offs + 3] - 1;
int sx = src[offs + 1] - 13;
int pri = src[offs + 2] >> 6 & 3;
int color = (src[offs + 2] >> 1 & 3) | (src[offs + 2] << 2 & 4) | (m_palette_bank << 3);
if (layer == pri)
m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, code, color, 0, 0, sx, sy, 0);
}
}
UINT32 slapfght_state::screen_update_perfrman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_pf1_tilemap->set_scrollx(0, -16);
m_pf1_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE);
draw_perfrman_sprites(bitmap, cliprect, 0);
draw_perfrman_sprites(bitmap, cliprect, 1);
m_pf1_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
draw_sprites(bitmap,cliprect, 0);
m_pf1_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap,cliprect, 0x80);
m_pf1_tilemap->draw(screen, bitmap, cliprect, 0);
draw_perfrman_sprites(bitmap, cliprect, 2);
draw_perfrman_sprites(bitmap, cliprect, 3);
return 0;
}
UINT32 slapfght_state::screen_update_slapfight(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
void slapfght_state::draw_slapfight_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
UINT8 *src = m_spriteram->buffer();
m_fix_tilemap->set_scrollx(0, 0);
m_pf1_tilemap->set_scrollx(0, (*m_slapfight_scrollx_lo + 256 * *m_slapfight_scrollx_hi));
m_pf1_tilemap->set_scrolly(0, (*m_slapfight_scrolly) - 1);
m_fix_tilemap->set_scrolly(0, -1); /* Glitch in Tiger Heli otherwise */
m_pf1_tilemap->draw(screen, bitmap, cliprect, 0, 0);
/* Draw the sprites */
for (int offs = 0; offs < m_spriteram->bytes(); offs += 4)
{
m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
src[offs] + ((src[offs + 2] & 0xc0) << 2),
(src[offs + 2] & 0x1e) >> 1,
0, 0,
(src[offs + 1] + ((src[offs + 2] & 0x01) << 8)) - 13, src[offs + 3], 0
);
/*
0: xxxxxxxx - code low
1: xxxxxxxx - x low
2: xx...... - code high
..x..... - no function?
...xxxx. - color
.......x - x high
3: xxxxxxxx - y
*/
int code = src[offs + 0] | ((src[offs + 2] & 0xc0) << 2);
int sy = src[offs + 3];
int sx = (src[offs + 1] | (src[offs + 2] << 8 & 0x100)) - 13;
int color = src[offs + 2] >> 1 & 0xf;
m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, code, color, 0, 0, sx, sy, 0);
}
}
UINT32 slapfght_state::screen_update_slapfight(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_pf1_tilemap->set_scrollx(m_scrollx_hi << 8 | m_scrollx_lo);
m_pf1_tilemap->set_scrolly(m_scrolly);
m_pf1_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_slapfight_sprites(bitmap, cliprect);
m_fix_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;