m92.cpp - only use 'palette bank' on the later games with ROM banking (MT03289) (#9492)

This commit is contained in:
David Haywood 2022-04-02 21:55:43 +01:00 committed by GitHub
parent 720835ec86
commit ba7824cd43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 14 deletions

View File

@ -935,7 +935,8 @@ void m92_state::m92(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_m92);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
MCFG_VIDEO_START_OVERRIDE(m92_state,m92)
@ -962,6 +963,9 @@ void m92_state::m92_banked(machine_config &config)
m92(config);
m_maincpu->set_addrmap(AS_PROGRAM, &m92_state::m92_banked_map);
m_maincpu->set_addrmap(AS_IO, &m92_state::m92_banked_portmap);
// the 'banked' ROM setup also has a larger, banked palette
m_palette->set_format(palette_device::xBGR_555, 2048);
}
void m92_state::gunforce(machine_config &config)

View File

@ -47,7 +47,8 @@ public:
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_upd71059c(*this, "upd71059c"),
m_mainbank(*this, "mainbank")
m_mainbank(*this, "mainbank"),
m_dsw(*this, "DSW")
{ }
void m92(machine_config &config);
@ -86,6 +87,7 @@ private:
required_device<pic8259_device> m_upd71059c;
optional_memory_bank m_mainbank;
required_ioport m_dsw;
emu_timer *m_spritebuffer_timer;
uint32_t m_raster_irq_position;

View File

@ -111,6 +111,17 @@ void m92_state::videocontrol_w(offs_t offset, uint16_t data, uint16_t mem_mask)
enabled. This was one of the earlier games and could actually
be a different motherboard revision (most games use M92-A-B top
pcb, a M92-A-A revision could exist...).
There is a further test case with R-Type Leo. The flickering
invulnerability effect when you spawn does not work correctly
with the palette bank hooked up, and also causes a 2nd player
spawning in to have the incorrect palette at first.
It appears that the only games requiring the palette bank logic
are Major Title 2, Ninja Baseball Bat Man, Dream Soccer '94
and Gun Force 2. These are also the games with the extended
ROM banking, suggesting a difference on those boards is a more
likely explanation.
*/
/*
@ -128,7 +139,8 @@ void m92_state::videocontrol_w(offs_t offset, uint16_t data, uint16_t mem_mask)
*/
/* Access to upper palette bank */
m_palette_bank = (m_videocontrol >> 1) & 1;
if (m_palette->entries() == 2048)
m_palette_bank = (m_videocontrol >> 1) & 1;
// logerror("%s: videocontrol_w %d = %02x\n",m_maincpu->pc(),offset,data);
}
@ -156,7 +168,7 @@ TILE_GET_INFO_MEMBER(m92_state::get_pf_tile_info)
tileinfo.set(0,
tile,
attrib & 0x7f,
(m_palette->entries() == 2048) ? (attrib & 0x7f) : (attrib & 0x3f),
TILE_FLIPYX(attrib >> 9));
if (attrib & 0x100) tileinfo.group = 2;
else if (attrib & 0x80) tileinfo.group = 1;
@ -304,23 +316,22 @@ VIDEO_START_MEMBER(m92_state,ppan)
void m92_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint16_t *source = m_spriteram->buffer();
int offs, layer;
for (layer = 0; layer < 8; layer++)
for (int layer = 0; layer < 8; layer++)
{
for (offs = 0; offs < m_sprite_list; )
for (int offs = 0; offs < m_sprite_list; )
{
int x = source[offs+3] & 0x1ff;
int y = source[offs+0] & 0x1ff;
int code = source[offs+1];
int color = source[offs+2] & 0x007f;
int color = source[offs+2];
color &= (m_palette->entries() == 2048) ? 0x7f : 0x3f;
int pri = (~source[offs+2] >> 6) & 2;
int curlayer = (source[offs+0] >> 13) & 7;
int flipx = (source[offs+2] >> 8) & 1;
int flipy = (source[offs+2] >> 9) & 1;
int numcols = 1 << ((source[offs+0] >> 11) & 3);
int numrows = 1 << ((source[offs+0] >> 9) & 3);
int row, col, s_ptr;
offs += 4 * numcols;
if (layer != curlayer) continue;
@ -330,12 +341,12 @@ void m92_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const
if (flipx) x += 16 * (numcols - 1);
for (col = 0; col < numcols; col++)
for (int col = 0; col < numcols; col++)
{
s_ptr = 8 * col;
int s_ptr = 8 * col;
if (!flipy) s_ptr += numrows - 1;
for (row = 0; row < numrows; row++)
for (int row = 0; row < numrows; row++)
{
if (flip_screen())
{
@ -528,7 +539,7 @@ uint32_t m92_state::screen_update_m92(screen_device &screen, bitmap_ind16 &bitma
draw_sprites(screen, bitmap, cliprect);
/* Flipscreen appears hardwired to the dipswitch - strange */
if (ioport("DSW")->read() & 0x100)
if (m_dsw->read() & 0x100)
flip_screen_set(0);
else
flip_screen_set(1);
@ -545,7 +556,7 @@ uint32_t m92_state::screen_update_ppan(screen_device &screen, bitmap_ind16 &bitm
ppan_draw_sprites(screen, bitmap, cliprect);
/* Flipscreen appears hardwired to the dipswitch - strange */
if (ioport("DSW")->read() & 0x100)
if (m_dsw->read() & 0x100)
flip_screen_set(0);
else
flip_screen_set(1);