k007420: apply same sprite code mask fix as with k007121

This commit is contained in:
hap 2024-11-24 05:05:43 +01:00
parent 9feddc7241
commit 135d83ea3e
2 changed files with 63 additions and 46 deletions

View File

@ -48,9 +48,6 @@ k007342_device::k007342_device(const machine_config &mconfig, const char *tag, d
m_tilemap{ nullptr, nullptr }, m_tilemap{ nullptr, nullptr },
m_flipscreen(false), m_flipscreen(false),
m_int_enabled(false), m_int_enabled(false),
//m_regs[8],
//m_scrollx[2],
//m_scrolly[2],
m_callback(*this) m_callback(*this)
{ {
} }
@ -269,11 +266,7 @@ void k007342_device::get_tile_info( tile_data &tileinfo, int tile_index, uint8_t
if (!m_callback.isnull()) if (!m_callback.isnull())
m_callback(layer, m_regs[1], code, color, flags); m_callback(layer, m_regs[1], code, color, flags);
tileinfo.set(0, code, color, flags);
tileinfo.set(0,
code,
color,
flags);
} }
TILE_GET_INFO_MEMBER(k007342_device::get_tile_info0) TILE_GET_INFO_MEMBER(k007342_device::get_tile_info0)

View File

@ -28,7 +28,6 @@ k007420_device::k007420_device(const machine_config &mconfig, const char *tag, d
, m_flipscreen(false) , m_flipscreen(false)
, m_banklimit(0) , m_banklimit(0)
, m_callback(*this) , m_callback(*this)
//, m_regs[8]
{ {
} }
@ -115,50 +114,71 @@ void k007420_device::sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprec
const uint32_t bank = code & bankmask; const uint32_t bank = code & bankmask;
code &= codemask; code &= codemask;
/* 0x080 = normal scale, 0x040 = double size, 0x100 half size */ // 0x080 = normal scale, 0x040 = double size, 0x100 half size
uint32_t zoom = m_ram[offs + 5] | ((m_ram[offs + 4] & 0x03) << 8); uint32_t zoom = m_ram[offs + 5] | ((m_ram[offs + 4] & 0x03) << 8);
if (!zoom) if (!zoom)
continue; continue;
zoom = 0x10000 * 128 / zoom; zoom = 0x10000 * 128 / zoom;
uint8_t w, h; uint8_t width, height;
switch (m_ram[offs + 4] & 0x70) switch (m_ram[offs + 4] & 0x70)
{ {
case 0x30: w = h = 1; break; case 0x30:
case 0x20: w = 2; h = 1; code &= (~1); break; width = height = 1;
case 0x10: w = 1; h = 2; code &= (~2); break; break;
case 0x00: w = h = 2; code &= (~3); break;
case 0x40: w = h = 4; code &= (~3); break; case 0x20:
default: w = 1; h = 1; width = 2; height = 1;
code &= ~1;
break;
case 0x10:
width = 1; height = 2;
code &= ~2;
break;
case 0x00:
width = height = 2;
code &= ~3;
break;
case 0x40:
width = height = 4;
code &= ~0xf;
break;
default:
width = 1; height = 1;
//logerror("Unknown sprite size %02x\n",(m_ram[offs + 4] & 0x70) >> 4); //logerror("Unknown sprite size %02x\n",(m_ram[offs + 4] & 0x70) >> 4);
break;
} }
if (m_flipscreen) if (m_flipscreen)
{ {
ox = 256 - ox - ((zoom * w + (1 << 12)) >> 13); ox = 256 - ox - ((zoom * width + (1 << 12)) >> 13);
oy = 256 - oy - ((zoom * h + (1 << 12)) >> 13); oy = 256 - oy - ((zoom * height + (1 << 12)) >> 13);
flipx = !flipx; flipx = !flipx;
flipy = !flipy; flipy = !flipy;
} }
if (zoom == 0x10000) if (zoom == 0x10000)
{ {
for (int y = 0; y < h; y++) for (int y = 0; y < height; y++)
{ {
const int sy = oy + 8 * y; const int sy = oy + 8 * y;
for (int x = 0; x < w; x++) for (int x = 0; x < width; x++)
{ {
uint32_t c = code; uint32_t c = code;
const int sx = ox + 8 * x; const int sx = ox + 8 * x;
if (flipx) if (flipx)
c += xoffset[(w - 1 - x)]; c += xoffset[(width - 1 - x)];
else else
c += xoffset[x]; c += xoffset[x];
if (flipy) if (flipy)
c += yoffset[(h - 1 - y)]; c += yoffset[(height - 1 - y)];
else else
c += yoffset[y]; c += yoffset[y];
@ -174,6 +194,7 @@ void k007420_device::sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprec
sx,sy,0); sx,sy,0);
if (m_regs[2] & 0x80) if (m_regs[2] & 0x80)
{
gfx(0)->transpen(bitmap,cliprect, gfx(0)->transpen(bitmap,cliprect,
c, c,
color, color,
@ -182,26 +203,27 @@ void k007420_device::sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprec
} }
} }
} }
}
else else
{ {
for (int y = 0; y < h; y++) for (int y = 0; y < height; y++)
{ {
const int sy = oy + ((zoom * y + (1 << 12)) >> 13); const int sy = oy + ((zoom * y + (1 << 12)) >> 13);
const int zh = (oy + ((zoom * (y + 1) + (1 << 12)) >> 13)) - sy; const int zh = (oy + ((zoom * (y + 1) + (1 << 12)) >> 13)) - sy;
for (int x = 0; x < w; x++) for (int x = 0; x < width; x++)
{ {
uint32_t c = code; uint32_t c = code;
const int sx = ox + ((zoom * x + (1 << 12)) >> 13); const int sx = ox + ((zoom * x + (1 << 12)) >> 13);
const int zw = (ox + ((zoom * (x + 1) + (1 << 12)) >> 13)) - sx; const int zw = (ox + ((zoom * (x + 1) + (1 << 12)) >> 13)) - sx;
if (flipx) if (flipx)
c += xoffset[(w - 1 - x)]; c += xoffset[(width - 1 - x)];
else else
c += xoffset[x]; c += xoffset[x];
if (flipy) if (flipy)
c += yoffset[(h - 1 - y)]; c += yoffset[(height - 1 - y)];
else else
c += yoffset[y]; c += yoffset[y];
@ -218,6 +240,7 @@ void k007420_device::sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprec
(zw << 16) / 8,(zh << 16) / 8,0); (zw << 16) / 8,(zh << 16) / 8,0);
if (m_regs[2] & 0x80) if (m_regs[2] & 0x80)
{
gfx(0)->zoom_transpen(bitmap,cliprect, gfx(0)->zoom_transpen(bitmap,cliprect,
c, c,
color, color,
@ -228,6 +251,7 @@ void k007420_device::sprites_draw(bitmap_ind16 &bitmap, const rectangle &cliprec
} }
} }
} }
}
#if 0 #if 0
{ {
static int current_sprite = 0; static int current_sprite = 0;