decbac06.cpp : Updates (#4976)

Allow priority drawing behavior, Use shorter / correct type values, Fix spacings
dec0.cpp, dec8.cpp : Add priority values for future use (priority mixing)
This commit is contained in:
cam900 2019-05-09 06:09:40 +09:00 committed by R. Belmont
parent bc431c5d63
commit d062256a06
8 changed files with 206 additions and 193 deletions

View File

@ -249,10 +249,10 @@ uint32_t madmotor_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
m_tilegen[2]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
m_spritegen->draw_sprites(bitmap, cliprect, m_spriteram, 0x00, 0x00, 0x0f);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
return 0;
}

View File

@ -25,9 +25,9 @@ uint32_t actfancr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
m_tilegen[1]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
m_spritegen->draw_sprites(bitmap, cliprect, m_spriteram16.get(), 0x00, 0x00, 0x0f);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
return 0;
}

View File

@ -17,20 +17,21 @@
uint32_t dec0_state::screen_update_hbarrel(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0,cliprect);
bool flip = m_tilegen[0]->get_flip_state();
m_tilegen[0]->set_flip_screen(flip);
m_tilegen[1]->set_flip_screen(flip);
m_tilegen[2]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 1);
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x08, 0x08, 0x0f);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 2);
/* HB always keeps pf2 on top of pf3, no need explicitly support priority register */
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x08, 0x00, 0x0f);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
return 0;
}
@ -38,6 +39,7 @@ uint32_t dec0_state::screen_update_hbarrel(screen_device &screen, bitmap_ind16 &
uint32_t dec0_state::screen_update_bandit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0,cliprect);
bool flip = m_tilegen[0]->get_flip_state();
m_tilegen[0]->set_flip_screen(flip);
m_tilegen[1]->set_flip_screen(flip);
@ -46,16 +48,16 @@ uint32_t dec0_state::screen_update_bandit(screen_device &screen, bitmap_ind16 &b
if (m_pri==0)
{
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 1);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 2);
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 4);
}
else
{
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 1);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 2);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 4);
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f);
}
return 0;
@ -74,32 +76,32 @@ uint32_t dec0_state::screen_update_baddudes(screen_device &screen, bitmap_ind16
/* WARNING: inverted wrt Midnight Resistance */
if ((m_pri & 0x01) == 0)
{
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
if (m_pri & 2)
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0,0x08,0x08,0x08,0x08, 0); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f);
if (m_pri & 4)
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
}
else
{
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
if (m_pri & 2)
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,0,0x08,0x08,0x08,0x08, 0); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f);
if (m_pri & 4)
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0,0x08,0x08,0x08,0x08, 0); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
}
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
return 0;
}
@ -107,6 +109,7 @@ uint32_t dec0_state::screen_update_baddudes(screen_device &screen, bitmap_ind16
uint32_t dec0_state::screen_update_robocop(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0,cliprect);
int trans;
bool flip = m_tilegen[0]->get_flip_state();
@ -126,21 +129,21 @@ uint32_t dec0_state::screen_update_robocop(screen_device &screen, bitmap_ind16 &
/* Robocop uses it only for the title screen, so this might be just */
/* completely wrong. The top 8 bits of the register might mean */
/* something (they are 0x80 in midres, 0x00 here) */
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 1);
if (m_pri & 0x02)
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f);
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 2);
}
else
{
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 1);
if (m_pri & 0x02)
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 2);
}
if (m_pri & 0x02)
@ -148,13 +151,14 @@ uint32_t dec0_state::screen_update_robocop(screen_device &screen, bitmap_ind16 &
else
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
return 0;
}
uint32_t dec0_automat_state::screen_update_automat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0,cliprect);
int trans;
// layer enables seem different... where are they?
@ -199,21 +203,21 @@ uint32_t dec0_automat_state::screen_update_automat(screen_device &screen, bitmap
if (m_pri & 0x01)
{
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 1);
if (m_pri & 0x02)
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f);
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 2);
}
else
{
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 1);
if (m_pri & 0x02)
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 2);
}
if (m_pri & 0x02)
@ -221,7 +225,7 @@ uint32_t dec0_automat_state::screen_update_automat(screen_device &screen, bitmap
else
m_spritegen->draw_sprites_bootleg(bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
return 0;
}
@ -261,16 +265,16 @@ uint32_t dec0_automat_state::screen_update_secretab(screen_device &screen, bitma
m_tilegen[2]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
m_spritegen->draw_sprites_bootleg(bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f);
/* Redraw top 8 pens of top 8 palettes over sprites */
if (m_pri & 0x80)
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0,0x08,0x08,0x08,0x08, 0); // upper 8 pens of upper 8 priority marked tiles
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
return 0;
}
@ -287,9 +291,9 @@ uint32_t dec0_state::screen_update_birdtry(screen_device &screen, bitmap_ind16 &
/* This game doesn't have the extra playfield chip on the game board, but
the palette does show through. */
bitmap.fill(m_palette->pen(768), cliprect);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
return 0;
}
@ -305,17 +309,17 @@ uint32_t dec0_state::screen_update_hippodrm(screen_device &screen, bitmap_ind16
if (m_pri & 0x01)
{
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
}
else
{
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
}
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
return 0;
}
@ -329,16 +333,16 @@ uint32_t dec0_state::screen_update_slyspy(screen_device &screen, bitmap_ind16 &b
m_tilegen[2]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f);
/* Redraw top 8 pens of top 8 palettes over sprites */
if (m_pri & 0x80)
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0,0x08,0x08,0x08,0x08, 0); // upper 8 pens of upper 8 priority marked tiles
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
return 0;
}
@ -346,6 +350,7 @@ uint32_t dec0_state::screen_update_slyspy(screen_device &screen, bitmap_ind16 &b
uint32_t dec0_state::screen_update_midres(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0,cliprect);
int trans;
bool flip = m_tilegen[0]->get_flip_state();
@ -360,21 +365,21 @@ uint32_t dec0_state::screen_update_midres(screen_device &screen, bitmap_ind16 &b
if (m_pri & 0x01)
{
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 1);
if (m_pri & 0x02)
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f);
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 2);
}
else
{
m_tilegen[2]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 1);
if (m_pri & 0x02)
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x08, trans, 0x0f);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 2);
}
if (m_pri & 0x02)
@ -382,7 +387,7 @@ uint32_t dec0_state::screen_update_midres(screen_device &screen, bitmap_ind16 &b
else
m_spritegen->draw_sprites(bitmap, cliprect, m_buffered_spriteram, 0x00, 0x00, 0x0f);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 0);
return 0;
}

View File

@ -208,15 +208,16 @@ void dec8_state::srdarwin_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cl
uint32_t dec8_state::screen_update_cobracom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0,cliprect);
bool flip = m_tilegen[0]->get_flip_state();
m_tilegen[0]->set_flip_screen(flip);
m_tilegen[1]->set_flip_screen(flip);
m_spritegen_mxc->set_flip_screen(flip);
m_fix_tilemap->set_flip(flip ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 1);
m_spritegen_mxc->draw_sprites(bitmap, cliprect, m_buffered_spriteram16.get(), 0x04, 0x00, 0x03);
m_tilegen[1]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00, 2);
m_spritegen_mxc->draw_sprites(bitmap, cliprect, m_buffered_spriteram16.get(), 0x04, 0x04, 0x03);
m_fix_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
@ -253,7 +254,7 @@ VIDEO_START_MEMBER(dec8_state,cobracom)
uint32_t dec8_state::screen_update_ghostb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
m_spritegen_krn->draw_sprites(screen, bitmap, cliprect, m_gfxdecode->gfx(1), m_buffered_spriteram16.get(), 0x400);
m_fix_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
@ -294,9 +295,9 @@ uint32_t dec8_state::screen_update_oscar(screen_device &screen, bitmap_ind16 &bi
m_fix_tilemap->set_flip(flip ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
// we mimic the priority scheme in dec0.cpp, this was originally a bit different, so this could be wrong
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
m_spritegen_mxc->draw_sprites(bitmap, cliprect, m_buffered_spriteram16.get(), 0x00, 0x00, 0x0f);
m_tilegen[0]->deco_bac06_pf_draw(bitmap,cliprect,0, 0x08,0x08,0x08,0x08);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0x08,0x08,0x08,0x08, 0);
m_fix_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}

View File

@ -70,9 +70,11 @@ Priority word (Midres):
#include "emu.h"
#include "decbac06.h"
#include <algorithm>
DEFINE_DEVICE_TYPE(DECO_BAC06, deco_bac06_device, "deco_back06", "DECO BAC06 Tilemap")
deco_bac06_device::deco_bac06_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
deco_bac06_device::deco_bac06_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, DECO_BAC06, tag, owner, clock)
, m_pf_data(nullptr)
, m_pf_rowscroll(nullptr)
@ -93,11 +95,8 @@ deco_bac06_device::deco_bac06_device(const machine_config &mconfig, const char *
, m_bppmask_16x16(0)
, m_gfxdecode(*this, finder_base::DUMMY_TAG)
{
for (int i = 0; i < 8; i++)
{
m_pf_control_0[i] = 0;
m_pf_control_1[i] = 0;
}
std::fill(std::begin(m_pf_control_0), std::end(m_pf_control_0), 0);
std::fill(std::begin(m_pf_control_1), std::end(m_pf_control_1), 0);
}
void deco_bac06_device::device_start()
@ -105,9 +104,9 @@ void deco_bac06_device::device_start()
if(!m_gfxdecode->started())
throw device_missing_dependencies();
m_pf_data = make_unique_clear<uint16_t[]>(0x4000 / 2); // 0x2000 is the maximum needed, some games / chip setups map less and mirror - stadium hero banks this to 0x4000?!
m_pf_rowscroll = make_unique_clear<uint16_t[]>(0x2000 / 2);
m_pf_colscroll = make_unique_clear<uint16_t[]>(0x2000 / 2);
m_pf_data = make_unique_clear<u16[]>(0x4000 / 2); // 0x2000 is the maximum needed, some games / chip setups map less and mirror - stadium hero banks this to 0x4000?!
m_pf_rowscroll = make_unique_clear<u16[]>(0x2000 / 2);
m_pf_colscroll = make_unique_clear<u16[]>(0x2000 / 2);
create_tilemaps(m_gfxregion8x8, m_gfxregion16x16);
m_gfxcolmask = 0x0f;
@ -121,9 +120,9 @@ void deco_bac06_device::device_start()
m_rambank = 0;
m_flip_screen = false;
save_pointer(NAME(m_pf_data), 0x4000/2);
save_pointer(NAME(m_pf_rowscroll), 0x2000/2);
save_pointer(NAME(m_pf_colscroll), 0x2000/2);
save_pointer(NAME(m_pf_data), 0x4000 / 2);
save_pointer(NAME(m_pf_rowscroll), 0x2000 / 2);
save_pointer(NAME(m_pf_colscroll), 0x2000 / 2);
save_item(NAME(m_pf_control_0));
save_item(NAME(m_pf_control_1));
save_item(NAME(m_gfxcolmask));
@ -150,7 +149,7 @@ void deco_bac06_device::set_flip_screen(bool flip)
TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape0_scan)
{
if ((m_pf_control_0[0]&2)==0)
if ((m_pf_control_0[0] & 2) == 0)
{
int col_mask = num_cols - 1;
return (row & 0xf) + ((col_mask - (col & col_mask)) << 4);
@ -160,56 +159,56 @@ TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape0_scan)
TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape1_scan)
{
//if (m_pf_control_0[0]&2) // Needs testing on real hardware, not used by any game
//if (m_pf_control_0[0] & 2) // Needs testing on real hardware, not used by any game
// return (row & 0xf) + ((col & 0x1f) << 4) + ((col & 0xf0) << 5);
return (col & 0xf) + ((row & 0x1f) << 4) + ((col & 0xf0) << 5);
}
TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape2_scan)
{
//if (m_pf_control_0[0]&2) // Needs testing on real hardware, not used by any game
//if (m_pf_control_0[0] & 2) // Needs testing on real hardware, not used by any game
// return (col & 0xf) + ((row & 0x3f) << 4) + ((row & 0x70) << 6);
return (col & 0xf) + ((row & 0x3f) << 4) + ((col & 0x70) << 6);
}
TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape0_8x8_scan)
{
//if (m_pf_control_0[0]&2) // Needs testing on real hardware, not used by any game
//if (m_pf_control_0[0] & 2) // Needs testing on real hardware, not used by any game
// return (col & 0x1f) + ((row & 0x1f) << 5) + ((row & 0x60) << 5);
return (col & 0x1f) + ((row & 0x1f) << 5) + ((col & 0x60) << 5);
}
TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape1_8x8_scan)
{
//if (m_pf_control_0[0]&2) // Needs testing on real hardware, not used by any game
//if (m_pf_control_0[0] & 2) // Needs testing on real hardware, not used by any game
// return (row & 0x1f) + ((col & 0x1f) << 5) + ((col & 0x20) << 5) + ((row & 0x20) << 6);
return (col & 0x1f) + ((row & 0x1f) << 5) + ((row & 0x20) << 5) + ((col & 0x20) << 6);
}
TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape2_8x8_scan)
{
//if (m_pf_control_0[0]&2) // Needs testing on real hardware, not used by any game
//if (m_pf_control_0[0] & 2) // Needs testing on real hardware, not used by any game
// return (row & 0x1f) + ((col & 0x7f) << 5);
return (col & 0x1f) + ((row & 0x7f) << 5);
}
TILE_GET_INFO_MEMBER(deco_bac06_device::get_pf8x8_tile_info)
{
if (m_rambank&1) tile_index+=0x1000;
int tile=m_pf_data[tile_index];
int colourpri=(tile>>12);
int flags=(m_pf_control_0[0]&2) ? 0 : TILE_FLIPX;
SET_TILE_INFO_MEMBER(m_tile_region_8,tile&0xfff,0,flags);
if (m_rambank & 1) tile_index += 0x1000;
int tile = m_pf_data[tile_index];
int colourpri = (tile >> 12);
int flags = (m_pf_control_0[0] & 2) ? 0 : TILE_FLIPX;
SET_TILE_INFO_MEMBER(m_tile_region_8,tile & 0xfff,0,flags);
tileinfo.category = colourpri;
}
TILE_GET_INFO_MEMBER(deco_bac06_device::get_pf16x16_tile_info)
{
if (m_rambank&1) tile_index+=0x1000;
int tile=m_pf_data[tile_index];
int colourpri=(tile>>12);
int flags=(m_pf_control_0[0]&2) ? 0 : TILE_FLIPX;
SET_TILE_INFO_MEMBER(m_tile_region_16,tile&0xfff,0,flags);
if (m_rambank & 1) tile_index += 0x1000;
int tile = m_pf_data[tile_index];
int colourpri = (tile >> 12);
int flags = (m_pf_control_0[0] & 2) ? 0 : TILE_FLIPX;
SET_TILE_INFO_MEMBER(m_tile_region_16,tile & 0xfff,0,flags);
tileinfo.category = colourpri;
}
@ -222,13 +221,13 @@ void deco_bac06_device::create_tilemaps(int region8x8, int region16x16)
m_pf8x8_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf8x8_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_8x8_scan),this), 8, 8, 64, 64);
m_pf8x8_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf8x8_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_8x8_scan),this), 8, 8, 32,128);
if (m_wide==2)
if (m_wide == 2)
{
m_pf16x16_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16, 16, 256, 16);
m_pf16x16_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16, 16, 128, 32);
m_pf16x16_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16, 16, 64, 64);
}
else if (m_wide==1)
else if (m_wide == 1)
{
m_pf16x16_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16, 16, 128, 16);
m_pf16x16_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16, 16, 64, 32);
@ -243,38 +242,38 @@ void deco_bac06_device::create_tilemaps(int region8x8, int region16x16)
}
void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap,
bitmap_ind8 &primap,
const rectangle &cliprect,
tilemap_t *tilemap_ptr,
const uint16_t *rowscroll_ptr,
const uint16_t *colscroll_ptr,
const uint16_t *control0,
const uint16_t *control1,
const u16 *rowscroll_ptr,
const u16 *colscroll_ptr,
const u16 *control0,
const u16 *control1,
int flags,
uint16_t penmask,
uint16_t pencondition,
uint16_t colprimask,
uint16_t colpricondition,
uint8_t bppmult,
uint8_t bppmask)
u16 penmask,
u16 pencondition,
u16 colprimask,
u16 colpricondition,
u8 bppmult,
u8 bppmask,
u8 pri,
u8 pmask)
{
const bitmap_ind16 &src_bitmap = tilemap_ptr->pixmap();
const bitmap_ind8 &flags_bitmap = tilemap_ptr->flagsmap();
int x, y, p, colpri;
int column_offset=0, src_x=0, src_y=0;
uint32_t scrollx = 0;
uint32_t scrolly = 0;
int column_offset = 0, src_x = 0, src_y = 0;
u32 scrollx = 0;
u32 scrolly = 0;
if (control1)
{
if (control0 && (control0[0]&2)==0) // Use of column major mode inverts scroll direction
if (control0 && (control0[0] & 2) == 0) // Use of column major mode inverts scroll direction
scrollx = -control1[0] - 0x100;
else
scrollx = control1[0];
scrolly = control1[1];
}
int width_mask;
int height_mask;
int row_scroll_enabled = 0;
int col_scroll_enabled = 0;
@ -287,8 +286,8 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap,
}
}
width_mask = src_bitmap.width() - 1;
height_mask = src_bitmap.height() - 1;
const int width_mask = src_bitmap.width() - 1;
const int height_mask = src_bitmap.height() - 1;
/* Column scroll & row scroll may per applied per pixel, there are
shift registers for each which control the granularity of the row/col
@ -314,10 +313,12 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap,
src_y = scrolly;
src_y += cliprect.top();
for (y=cliprect.top(); y<=cliprect.bottom(); y++)
for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
u16 *dstpix = &bitmap.pix16(y);
u8 *dstpri = &primap.pix8(y);
if (row_scroll_enabled)
src_x=scrollx + rowscroll_ptr[(src_y >> (control1[3]&0xf))&(0x1ff>>(control1[3]&0xf))];
src_x=scrollx + rowscroll_ptr[(src_y >> (control1[3] & 0xf)) & (0x1ff >> (control1[3] & 0xf))];
else
src_x=scrollx;
@ -325,35 +326,38 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap,
src_x=(src_bitmap.width() - 256) - src_x;
src_x += cliprect.left();
for (x=cliprect.left(); x<=cliprect.right(); x++)
for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
if (col_scroll_enabled)
column_offset=colscroll_ptr[((src_x >> 3) >> (control1[2]&0xf))&(0x3f>>(control1[2]&0xf))];
column_offset=colscroll_ptr[((src_x >> 3) >> (control1[2] & 0xf)) & (0x3f >> (control1[2] & 0xf))];
p = src_bitmap.pix16((src_y + column_offset)&height_mask, src_x&width_mask);
colpri = flags_bitmap.pix8((src_y + column_offset)&height_mask, src_x&width_mask)&0xf;
const u16 p = src_bitmap.pix16((src_y + column_offset) & height_mask, src_x & width_mask);
const u8 colpri = flags_bitmap.pix8((src_y + column_offset) & height_mask, src_x & width_mask) & 0xf;
src_x++;
if ((flags&TILEMAP_DRAW_OPAQUE) || (p&bppmask))
if ((flags & TILEMAP_DRAW_OPAQUE) || (p & bppmask))
{
if ((p&penmask)==pencondition)
if((colpri&colprimask)==colpricondition)
bitmap.pix16(y, x) = p+(colpri&m_gfxcolmask)*bppmult;
if ((p & penmask) == pencondition)
if((colpri & colprimask) == colpricondition)
{
dstpix[x] = p + (colpri & m_gfxcolmask) * bppmult;
dstpri[x] = (dstpri[x] & pmask) | pri;
}
}
}
src_y++;
}
}
void deco_bac06_device::deco_bac06_pf_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,int flags,uint16_t penmask, uint16_t pencondition,uint16_t colprimask, uint16_t colpricondition)
void deco_bac06_device::deco_bac06_pf_draw(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,int flags,u16 penmask, u16 pencondition,u16 colprimask, u16 colpricondition, u8 pri, u8 primask)
{
tilemap_t* tm = nullptr;
uint8_t bppmult = 0, bppmask = 0;
u8 bppmult = 0, bppmask = 0;
int tm_dimensions = m_pf_control_0[3] & 0x3;
if (tm_dimensions == 3) tm_dimensions = 1; // 3 is invalid / the same as 1?
if (m_pf_control_0[0]&0x1) // is 8x8 tiles mode selected?
if (m_pf_control_0[0] & 0x1) // is 8x8 tiles mode selected?
{
if (m_supports_8x8)
{
@ -385,14 +389,14 @@ void deco_bac06_device::deco_bac06_pf_draw(bitmap_ind16 &bitmap,const rectangle
}
if (tm)
custom_tilemap_draw(bitmap,cliprect,tm,m_pf_rowscroll.get(),m_pf_colscroll.get(),m_pf_control_0,m_pf_control_1,flags, penmask, pencondition, colprimask, colpricondition, bppmult, bppmask);
custom_tilemap_draw(bitmap,screen.priority(),cliprect,tm,m_pf_rowscroll.get(),m_pf_colscroll.get(),m_pf_control_0,m_pf_control_1,flags, penmask, pencondition, colprimask, colpricondition, bppmult, bppmask);
}
// used for pocket gal bootleg, which doesn't set registers properly and simply expects a fixed size tilemap.
void deco_bac06_device::deco_bac06_pf_draw_bootleg(bitmap_ind16 &bitmap,const rectangle &cliprect,int flags, int mode, int type)
void deco_bac06_device::deco_bac06_pf_draw_bootleg(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,int flags, int mode, int type, u8 pri, u8 primask)
{
tilemap_t* tm = nullptr;
uint8_t bppmult, bppmask;
u8 bppmult, bppmask;
if (!mode)
{
tm = m_pf8x8_tilemap[type];
@ -406,7 +410,7 @@ void deco_bac06_device::deco_bac06_pf_draw_bootleg(bitmap_ind16 &bitmap,const re
bppmask = m_bppmask_16x16;
}
custom_tilemap_draw(bitmap,cliprect,tm,m_pf_rowscroll.get(),m_pf_colscroll.get(),nullptr,nullptr,flags, 0, 0, 0, 0, bppmult, bppmask);
custom_tilemap_draw(bitmap,screen.priority(),cliprect,tm,m_pf_rowscroll.get(),m_pf_colscroll.get(),nullptr,nullptr,flags, 0, 0, 0, 0, bppmult, bppmask);
}
@ -420,9 +424,9 @@ void deco_bac06_device::pf_control_0_w(offs_t offset, u16 data, u16 mem_mask)
COMBINE_DATA(&m_pf_control_0[offset]);
bool dirty_all = false;
if (offset==0)
if (offset == 0)
{
if ((old_register0&2)!=(m_pf_control_0[offset]&2))
if ((old_register0 & 2) != (m_pf_control_0[offset] & 2))
{
// The tilemap has changed from row major to column major or vice versa.
// Must force an update of the mapping.
@ -434,18 +438,18 @@ void deco_bac06_device::pf_control_0_w(offs_t offset, u16 data, u16 mem_mask)
dirty_all = true;
}
}
if (offset==2)
if (offset == 2)
{
int newbank = m_pf_control_0[offset]&1;
if ((newbank&1) != (m_rambank&1))
int newbank = m_pf_control_0[offset] & 1;
if ((newbank & 1) != (m_rambank & 1))
{
// I don't know WHY Stadium Hero uses this as a bank but the RAM test expects it..
// I'm curious as to if anything else sets it tho
if (strcmp(machine().system().name,"stadhero"))
logerror("tilemap ram bank change to %02x\n", newbank&1);
logerror("tilemap ram bank change to %02x\n", newbank & 1);
dirty_all = true;
m_rambank = newbank&1;
m_rambank = newbank & 1;
}
}
@ -473,7 +477,7 @@ void deco_bac06_device::pf_control_1_w(offs_t offset, u16 data, u16 mem_mask)
void deco_bac06_device::pf_data_w(offs_t offset, u16 data, u16 mem_mask)
{
if (m_rambank&1) offset+=0x1000;
if (m_rambank & 1) offset += 0x1000;
COMBINE_DATA(&m_pf_data[offset]);
@ -486,25 +490,25 @@ void deco_bac06_device::pf_data_w(offs_t offset, u16 data, u16 mem_mask)
u16 deco_bac06_device::pf_data_r(offs_t offset)
{
if (m_rambank&1) offset+=0x1000;
if (m_rambank & 1) offset += 0x1000;
return m_pf_data[offset];
}
void deco_bac06_device::pf_data_8bit_w(offs_t offset, u8 data)
{
if (offset&1)
pf_data_w(offset/2,data,0x00ff);
if (offset & 1)
pf_data_w(offset / 2, data, 0x00ff);
else
pf_data_w(offset/2,data<<8,0xff00);
pf_data_w(offset / 2, data << 8, 0xff00);
}
u8 deco_bac06_device::pf_data_8bit_r(offs_t offset)
{
if (offset&1) /* MSB */
return pf_data_r(offset/2);
if (offset & 1) /* MSB */
return pf_data_r(offset / 2);
else
return pf_data_r(offset/2)>>8;
return pf_data_r(offset / 2)>>8;
}
void deco_bac06_device::pf_rowscroll_w(offs_t offset, u16 data, u16 mem_mask)
@ -530,19 +534,19 @@ u16 deco_bac06_device::pf_colscroll_r(offs_t offset)
/* used by dec8.cpp */
void deco_bac06_device::pf_control0_8bit_w(offs_t offset, u8 data)
{
if (offset&1)
pf_control_0_w(offset/2,data,0x00ff); // oscar (mirrors?)
if (offset & 1)
pf_control_0_w(offset / 2, data, 0x00ff); // oscar (mirrors?)
else
pf_control_0_w(offset/2,data,0x00ff);
pf_control_0_w(offset / 2, data, 0x00ff);
}
/* used by dec8.cpp */
u8 deco_bac06_device::pf_control1_8bit_r(offs_t offset)
{
if (offset&1)
return pf_control_1_r(offset/2);
if (offset & 1)
return pf_control_1_r(offset / 2);
else
return pf_control_1_r(offset/2)>>8;
return pf_control_1_r(offset / 2)>>8;
}
/* used by dec8.cpp */
@ -550,77 +554,77 @@ void deco_bac06_device::pf_control1_8bit_w(offs_t offset, u8 data)
{
if (offset<4) // these registers are 16-bit?
{
if (offset&1)
pf_control_1_w(offset/2,data,0x00ff);
if (offset & 1)
pf_control_1_w(offset / 2, data, 0x00ff);
else
pf_control_1_w(offset/2,data<<8,0xff00);
pf_control_1_w(offset / 2, data << 8, 0xff00);
}
else // these registers are 8-bit and mirror? (triothep vs actfancr)
{
if (offset&1)
pf_control_1_w(offset/2,data,0x00ff);
if (offset & 1)
pf_control_1_w(offset / 2, data, 0x00ff);
else
pf_control_1_w(offset/2,data,0x00ff);
pf_control_1_w(offset / 2, data, 0x00ff);
}
}
u8 deco_bac06_device::pf_rowscroll_8bit_r(offs_t offset)
{
if (offset&1)
return pf_rowscroll_r(offset/2);
if (offset & 1)
return pf_rowscroll_r(offset / 2);
else
return pf_rowscroll_r(offset/2)>>8;
return pf_rowscroll_r(offset / 2)>>8;
}
void deco_bac06_device::pf_rowscroll_8bit_w(offs_t offset, u8 data)
{
if (offset&1)
pf_rowscroll_w(offset/2,data,0x00ff);
if (offset & 1)
pf_rowscroll_w(offset / 2, data, 0x00ff);
else
pf_rowscroll_w(offset/2,data<<8,0xff00);
pf_rowscroll_w(offset / 2, data << 8, 0xff00);
}
u8 deco_bac06_device::pf_rowscroll_8bit_swap_r(offs_t offset)
{
if (offset&1)
return pf_rowscroll_r(offset/2)>>8;
if (offset & 1)
return pf_rowscroll_r(offset / 2)>>8;
else
return pf_rowscroll_r(offset/2);
return pf_rowscroll_r(offset / 2);
}
void deco_bac06_device::pf_rowscroll_8bit_swap_w(offs_t offset, u8 data)
{
if (offset&1)
pf_rowscroll_w(offset/2,data<<8,0xff00);
if (offset & 1)
pf_rowscroll_w(offset / 2, data << 8, 0xff00);
else
pf_rowscroll_w(offset/2,data,0x00ff);
pf_rowscroll_w(offset / 2, data, 0x00ff);
}
/* used by hippodrm */
void deco_bac06_device::pf_control0_8bit_packed_w(offs_t offset, u8 data)
{
if (offset&1)
pf_control_0_w(offset/2,data<<8,0xff00);
if (offset & 1)
pf_control_0_w(offset / 2, data << 8, 0xff00);
else
pf_control_0_w(offset/2,data,0x00ff);
pf_control_0_w(offset / 2, data, 0x00ff);
}
/* used by hippodrm */
void deco_bac06_device::pf_control1_8bit_swap_w(offs_t offset, u8 data)
{
pf_control1_8bit_w(offset^1, data);
pf_control1_8bit_w(offset ^ 1, data);
}
/* used by hippodrm */
u8 deco_bac06_device::pf_data_8bit_swap_r(offs_t offset)
{
return pf_data_8bit_r(offset^1);
return pf_data_8bit_r(offset ^ 1);
}
/* used by hippodrm */
void deco_bac06_device::pf_data_8bit_swap_w(offs_t offset, u8 data)
{
pf_data_8bit_w(offset^1, data);
pf_data_8bit_w(offset ^ 1, data);
}

View File

@ -5,6 +5,7 @@
#pragma once
#include "screen.h"
#include <memory>
class deco_bac06_device : public device_t
@ -24,9 +25,9 @@ public:
void disable_16x16() { m_supports_16x16 = false; }
void disable_rc_scroll() { m_supports_rc_scroll = false; }
std::unique_ptr<uint16_t[]> m_pf_data;
std::unique_ptr<uint16_t[]> m_pf_rowscroll;
std::unique_ptr<uint16_t[]> m_pf_colscroll;
std::unique_ptr<u16[]> m_pf_data;
std::unique_ptr<u16[]> m_pf_rowscroll;
std::unique_ptr<u16[]> m_pf_colscroll;
tilemap_t* m_pf8x8_tilemap[3];
tilemap_t* m_pf16x16_tilemap[3];
@ -39,11 +40,11 @@ public:
bool m_supports_rc_scroll;
void create_tilemaps(int region8x8,int region16x16);
uint16_t m_pf_control_0[8];
uint16_t m_pf_control_1[8];
u16 m_pf_control_0[8];
u16 m_pf_control_1[8];
void deco_bac06_pf_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,int flags,uint16_t penmask, uint16_t pencondition,uint16_t colprimask, uint16_t colpricondition);
void deco_bac06_pf_draw_bootleg(bitmap_ind16 &bitmap,const rectangle &cliprect,int flags, int mode, int type);
void deco_bac06_pf_draw(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,int flags,u16 penmask, u16 pencondition,u16 colprimask, u16 colpricondition, u8 pri = 0, u8 primask = 0xff);
void deco_bac06_pf_draw_bootleg(screen_device &screen,bitmap_ind16 &bitmap,const rectangle &cliprect,int flags, int mode, int type, u8 pri = 0, u8 primask = 0xff);
/* I wonder if pf_control_0 is really registers, or a selection of pins.
@ -58,12 +59,12 @@ public:
For now we have this get_flip_state function so that drivers can query the bit and set other
flip flags accordingly
*/
uint8_t get_flip_state(void) { return m_pf_control_0[0]&0x80; };
u8 get_flip_state(void) { return m_pf_control_0[0] & 0x80; };
void set_colmask(int data) { m_gfxcolmask = data; }
void set_flip_screen(bool flip);
uint8_t m_gfxcolmask;
u8 m_gfxcolmask;
int m_rambank; // external connection?
bool m_flip_screen;
@ -105,26 +106,28 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
uint8_t m_gfxregion8x8;
uint8_t m_gfxregion16x16;
u8 m_gfxregion8x8;
u8 m_gfxregion16x16;
int m_wide;
uint8_t m_bppmult_8x8;
uint8_t m_bppmask_8x8;
u8 m_bppmult_8x8;
u8 m_bppmask_8x8;
uint8_t m_bppmult_16x16;
uint8_t m_bppmask_16x16;
u8 m_bppmult_16x16;
u8 m_bppmask_16x16;
void custom_tilemap_draw(bitmap_ind16 &bitmap,
bitmap_ind8 &primap,
const rectangle &cliprect,
tilemap_t *tilemap_ptr,
const uint16_t *rowscroll_ptr,
const uint16_t *colscroll_ptr,
const uint16_t *control0,
const uint16_t *control1,
const u16 *rowscroll_ptr,
const u16 *colscroll_ptr,
const u16 *control0,
const u16 *control1,
int flags,
uint16_t penmask, uint16_t pencondition,uint16_t colprimask, uint16_t colpricondition,
uint8_t bppmult, uint8_t bppmask);
u16 penmask, u16 pencondition,u16 colprimask, u16 colpricondition,
u8 bppmult, u8 bppmask,
u8 pri = 0, u8 pmask = 0xff);
private:
TILEMAP_MAPPER_MEMBER(tile_shape0_scan);

View File

@ -65,7 +65,7 @@ uint32_t pcktgal_state::screen_update_pcktgal(screen_device &screen, bitmap_ind1
{
bool flip = m_tilegen->get_flip_state();
m_tilegen->set_flip_screen(flip);
m_tilegen->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
draw_sprites(bitmap, cliprect, flip);
return 0;
}
@ -75,7 +75,7 @@ uint32_t pcktgal_state::screen_update_pcktgalb(screen_device &screen, bitmap_ind
bool flip = m_tilegen->get_flip_state();
m_tilegen->set_flip_screen(flip);
// the bootleg doesn't properly set the tilemap registers, because it's on non-original hardware, which probably doesn't have the flexible tilemaps.
m_tilegen->deco_bac06_pf_draw_bootleg(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0, 2);
m_tilegen->deco_bac06_pf_draw_bootleg(screen, bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0, 2, 0);
draw_sprites(bitmap, cliprect, flip);
return 0;
}

View File

@ -27,7 +27,7 @@ uint32_t stadhero_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
m_spritegen->set_flip_screen(flip);
m_pf1_tilemap->set_flip(flip ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_tilegen->deco_bac06_pf_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
m_tilegen->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00, 0);
m_spritegen->draw_sprites(bitmap, cliprect, m_spriteram, 0x00, 0x00, 0x0f);
m_pf1_tilemap->draw(screen, bitmap, cliprect, 0,0);
return 0;