summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2019-06-04 09:45:29 -0400
committer GitHub <noreply@github.com>2019-06-04 09:45:29 -0400
commit22f0bd5d0789cd948181b41a3980affe8f175b99 (patch)
tree9bf3392db5e94d70d1379ec20ebc1d5ee7cb0d28
parenta9c01535bd03b7109cdc381efff8c10d2a0dc7d5 (diff)
parent11eb5c168338074ae193be633cd0a8f183493fc1 (diff)
Merge pull request #5147 from cam900/prio_copybitmap
drawgfx.cpp : Updates
-rw-r--r--src/devices/video/stvvdp2.cpp48
-rw-r--r--src/emu/drawgfx.cpp581
-rw-r--r--src/emu/drawgfx.h90
-rw-r--r--src/emu/drawgfxm.h72
-rw-r--r--src/mame/drivers/realbrk.cpp18
-rw-r--r--src/mame/includes/realbrk.h45
-rw-r--r--src/mame/video/hng64.cpp21
-rw-r--r--src/mame/video/realbrk.cpp129
8 files changed, 838 insertions, 166 deletions
diff --git a/src/devices/video/stvvdp2.cpp b/src/devices/video/stvvdp2.cpp
index bf8470433fd..91d127499fd 100644
--- a/src/devices/video/stvvdp2.cpp
+++ b/src/devices/video/stvvdp2.cpp
@@ -2369,16 +2369,6 @@ uint8_t saturn_state::stv_vdp2_check_vram_cycle_pattern_registers( uint8_t acces
return access_command_ok == 3 ? 1 : 0;
}
-static inline uint32_t stv_add_blend(uint32_t a, uint32_t b)
-{
- rgb_t rb = (a & 0xff00ff) + (b & 0xff00ff);
- rgb_t g = (a & 0x00ff00) + (b & 0x00ff00);
- return rgb_t((rb & 0x1000000) ? 0xff : rb.r(),
- (g & 0x0010000) ? 0xff : g.g(),
- (rb & 0x0000100) ? 0xff : rb.b()
- );
-}
-
void saturn_state::stv_vdp2_compute_color_offset( int *r, int *g, int *b, int cor )
{
@@ -2572,7 +2562,7 @@ void saturn_state::stv_vdp2_drawgfxzoom(
{
int c = source[x_index>>16];
if ((transparency & STV_TRANSPARENCY_NONE) || (c != 0))
- dest[x] = stv_add_blend(dest[x],pal[c]);
+ dest[x] = add_blend_r32(dest[x],pal[c]);
}
x_index += dx;
}
@@ -2768,7 +2758,7 @@ void saturn_state::stv_vdp2_drawgfxzoom_rgb555(
stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2);
if ((transparency & STV_TRANSPARENCY_NONE) || (data & 0x8000))
- dest[x] = stv_add_blend(dest[x], rgb_t(r, g, b));
+ dest[x] = add_blend_r32(dest[x], rgb_t(r, g, b));
x_index += dx;
}
@@ -4366,7 +4356,7 @@ void saturn_state::stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cli
pen = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1];
pix = bitmap.pix32(y, x);
- bitmap.pix32(y, x) = stv_add_blend(m_palette->pen(pen & 0x7ff),pix);
+ bitmap.pix32(y, x) = add_blend_r32(m_palette->pen(pen & 0x7ff),pix);
}
}
}
@@ -4842,7 +4832,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap,
if(stv2_current_tilemap.fade_control & 1)
stv_vdp2_compute_color_offset_UINT32(&pix,stv2_current_tilemap.fade_control & 2);
- line[hcnt] = stv_add_blend( line[hcnt], pix );
+ line[hcnt] = add_blend_r32( line[hcnt], pix );
}
}
else
@@ -4946,7 +4936,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap,
if(stv2_current_tilemap.fade_control & 1)
stv_vdp2_compute_color_offset_UINT32(&pix,stv2_current_tilemap.fade_control & 2);
- line[hcnt] = stv_add_blend( line[hcnt], pix );
+ line[hcnt] = add_blend_r32( line[hcnt], pix );
}
}
else
@@ -6867,7 +6857,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
ccr = sprite_ccr[0];
if ( STV_VDP2_CCMD )
{
- bitmap_line[x] = stv_add_blend( bitmap_line[x], rgb_t(r, g, b));
+ bitmap_line[x] = add_blend_r32( bitmap_line[x], rgb_t(r, g, b));
}
else
{
@@ -6914,7 +6904,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
{
if ( STV_VDP2_CCMD )
{
- bitmap_line[x] = stv_add_blend( bitmap_line[x], m_palette->pen(pix) );
+ bitmap_line[x] = add_blend_r32( bitmap_line[x], m_palette->pen(pix) );
}
else
{
@@ -7004,15 +6994,15 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
{
if(double_x)
{
- bitmap_line[x*2] = stv_add_blend( bitmap_line[x*2], rgb_t(r, g, b) );
- if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = stv_add_blend( bitmap_line2[x*2], rgb_t(r, g, b) );
- bitmap_line[x*2+1] = stv_add_blend( bitmap_line[x*2+1], rgb_t(r, g, b) );
- if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = stv_add_blend( bitmap_line2[x*2+1], rgb_t(r, g, b) );
+ bitmap_line[x*2] = add_blend_r32( bitmap_line[x*2], rgb_t(r, g, b) );
+ if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = add_blend_r32( bitmap_line2[x*2], rgb_t(r, g, b) );
+ bitmap_line[x*2+1] = add_blend_r32( bitmap_line[x*2+1], rgb_t(r, g, b) );
+ if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = add_blend_r32( bitmap_line2[x*2+1], rgb_t(r, g, b) );
}
else
{
- bitmap_line[x] = stv_add_blend( bitmap_line[x], rgb_t(r, g, b) );
- if ( interlace_framebuffer == 1 ) bitmap_line2[x] = stv_add_blend( bitmap_line2[x], rgb_t(r, g, b) );
+ bitmap_line[x] = add_blend_r32( bitmap_line[x], rgb_t(r, g, b) );
+ if ( interlace_framebuffer == 1 ) bitmap_line2[x] = add_blend_r32( bitmap_line2[x], rgb_t(r, g, b) );
}
}
else
@@ -7098,15 +7088,15 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
{
if(double_x)
{
- bitmap_line[x*2] = stv_add_blend( bitmap_line[x*2], m_palette->pen(pix) );
- if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = stv_add_blend( bitmap_line2[x], m_palette->pen(pix) );
- bitmap_line[x*2+1] = stv_add_blend( bitmap_line[x*2+1], m_palette->pen(pix) );
- if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = stv_add_blend( bitmap_line2[x], m_palette->pen(pix) );
+ bitmap_line[x*2] = add_blend_r32( bitmap_line[x*2], m_palette->pen(pix) );
+ if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = add_blend_r32( bitmap_line2[x], m_palette->pen(pix) );
+ bitmap_line[x*2+1] = add_blend_r32( bitmap_line[x*2+1], m_palette->pen(pix) );
+ if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = add_blend_r32( bitmap_line2[x], m_palette->pen(pix) );
}
else
{
- bitmap_line[x] = stv_add_blend( bitmap_line[x], m_palette->pen(pix) );
- if ( interlace_framebuffer == 1 ) bitmap_line2[x] = stv_add_blend( bitmap_line2[x], m_palette->pen(pix) );
+ bitmap_line[x] = add_blend_r32( bitmap_line[x], m_palette->pen(pix) );
+ if ( interlace_framebuffer == 1 ) bitmap_line2[x] = add_blend_r32( bitmap_line2[x], m_palette->pen(pix) );
}
}
else
diff --git a/src/emu/drawgfx.cpp b/src/emu/drawgfx.cpp
index 3a00569e32c..841ae7c670f 100644
--- a/src/emu/drawgfx.cpp
+++ b/src/emu/drawgfx.cpp
@@ -1520,20 +1520,7 @@ do
if (srcdata != trans_pen) \
{ \
if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \
- { \
- u32 srcdata2 = paldata[srcdata]; \
- \
- u32 add; \
- add = (srcdata2 & 0x00ff0000) + (DEST & 0x00ff0000); \
- if (add & 0x01000000) DEST = (DEST & 0xff00ffff) | (0x00ff0000); \
- else DEST = (DEST & 0xff00ffff) | (add & 0x00ff0000); \
- add = (srcdata2 & 0x000000ff) + (DEST & 0x000000ff); \
- if (add & 0x00000100) DEST = (DEST & 0xffffff00) | (0x000000ff); \
- else DEST = (DEST & 0xffffff00) | (add & 0x000000ff); \
- add = (srcdata2 & 0x0000ff00) + (DEST & 0x0000ff00); \
- if (add & 0x00010000) DEST = (DEST & 0xffff00ff) | (0x0000ff00); \
- else DEST = (DEST & 0xffff00ff) | (add & 0x0000ff00); \
- } \
+ (DEST) = add_blend_r32((DEST), paldata[srcdata]); \
(PRIORITY) = 31; \
} \
} \
@@ -1689,7 +1676,7 @@ void gfx_element::alphastore(bitmap_rgb32 &dest, const rectangle &cliprect,
-------------------------------------------------*/
void gfx_element::alphatable(bitmap_rgb32 &dest, const rectangle &cliprect,
u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty,
- int fixedalpha ,u8 *alphatable)
+ int fixedalpha, u8 *alphatable)
{
DECLARE_NO_PRIORITY;
@@ -1753,6 +1740,62 @@ void draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, cons
DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
}
+void prio_draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8);
+}
+
+void prio_draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8);
+}
+
+void primask_draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ return draw_scanline8(bitmap, destx, desty, length, srcptr, paldata);
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8);
+}
+
+void primask_draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ return draw_scanline8(bitmap, destx, desty, length, srcptr, paldata);
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8);
+}
+
/*-------------------------------------------------
draw_scanline16 - copy pixels from a 16bpp
@@ -1785,6 +1828,62 @@ void draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, con
DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
}
+void prio_draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8);
+}
+
+void prio_draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8);
+}
+
+void primask_draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ return draw_scanline16(bitmap, destx, desty, length, srcptr, paldata);
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8);
+}
+
+void primask_draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ return draw_scanline16(bitmap, destx, desty, length, srcptr, paldata);
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8);
+}
+
/*-------------------------------------------------
draw_scanline32 - copy pixels from a 32bpp
@@ -1817,6 +1916,62 @@ void draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, con
DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
}
+void prio_draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8);
+}
+
+void prio_draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8);
+}
+
+void primask_draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ return draw_scanline32(bitmap, destx, desty, length, srcptr, paldata);
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8);
+}
+
+void primask_draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ return draw_scanline32(bitmap, destx, desty, length, srcptr, paldata);
+
+ // palette lookup case
+ if (paldata != nullptr)
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8);
+
+ // raw copy case
+ else
+ DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8);
+}
+
/***************************************************************************
@@ -1893,6 +2048,38 @@ void copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flip
COPYBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
}
+void prio_copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ COPYBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8);
+}
+
+void prio_copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ COPYBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8);
+}
+
+void primask_copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ copybitmap(dest, src, flipx, flipy, destx, desty, cliprect);
+ else
+ COPYBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8);
+}
+
+void primask_copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ copybitmap(dest, src, flipx, flipy, destx, desty, cliprect);
+ else
+ COPYBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8);
+}
+
/*-------------------------------------------------
copybitmap_trans - copy from one bitmap to
@@ -1918,6 +2105,48 @@ void copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, in
COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
}
+void prio_copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ if (trans_pen > 0xffff)
+ prio_copybitmap(dest, src, flipx, flipy, destx, desty, cliprect, priority, pmask);
+ else
+ COPYBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN_PRIORITY, u8);
+}
+
+void prio_copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ if (trans_pen == 0xffffffff)
+ prio_copybitmap(dest, src, flipx, flipy, destx, desty, cliprect, priority, pmask);
+ else
+ COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN_PRIORITY, u8);
+}
+
+void primask_copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 trans_pen, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ copybitmap_trans(dest, src, flipx, flipy, destx, desty, cliprect, trans_pen);
+ else if (trans_pen > 0xffff)
+ primask_copybitmap(dest, src, flipx, flipy, destx, desty, cliprect, priority, pcode, pmask);
+ else
+ COPYBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN_PRIMASK, u8);
+}
+
+void primask_copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 trans_pen, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ copybitmap_trans(dest, src, flipx, flipy, destx, desty, cliprect, trans_pen);
+ else if (trans_pen == 0xffffffff)
+ primask_copybitmap(dest, src, flipx, flipy, destx, desty, cliprect, priority, pcode, pmask);
+ else
+ COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN_PRIMASK, u8);
+}
+
/*-------------------------------------------------
copybitmap_transalphpa - copy from one bitmap
@@ -1931,6 +2160,22 @@ void copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flip
COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSALPHA, NO_PRIORITY);
}
+void prio_copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSALPHA_PRIORITY, u8);
+}
+
+void primask_copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ copybitmap_transalpha(dest, src, flipx, flipy, destx, desty, cliprect);
+ else
+ COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSALPHA_PRIMASK, u8);
+}
+
/***************************************************************************
COPYSCROLLBITMAP IMPLEMENTATIONS
@@ -1956,6 +2201,40 @@ void copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows,
copyscrollbitmap_trans(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, 0xffffffff);
}
+void prio_copyscrollbitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask)
+{
+ // just call through to the transparent case as the underlying copybitmap will
+ // optimize for pen == 0xffffffff
+ prio_copyscrollbitmap_trans(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, priority, pmask, 0xffffffff);
+}
+
+void prio_copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask)
+{
+ // just call through to the transparent case as the underlying copybitmap will
+ // optimize for pen == 0xffffffff
+ prio_copyscrollbitmap_trans(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, priority, pmask, 0xffffffff);
+}
+
+void primask_copyscrollbitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ // just call through to the transparent case as the underlying copybitmap will
+ // optimize for pen == 0xffffffff
+ if (pcode == 0 && pmask == 0xff)
+ copyscrollbitmap(dest, src, numrows, rowscroll, numcols, colscroll, cliprect);
+ else
+ primask_copyscrollbitmap_trans(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, 0xffffffff, priority, pcode, pmask);
+}
+
+void primask_copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ // just call through to the transparent case as the underlying copybitmap will
+ // optimize for pen == 0xffffffff
+ if (pcode == 0 && pmask == 0xff)
+ copyscrollbitmap(dest, src, numrows, rowscroll, numcols, colscroll, cliprect);
+ else
+ primask_copyscrollbitmap_trans(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, 0xffffffff, priority, pcode, pmask);
+}
+
/*-------------------------------------------------
copyscrollbitmap_trans - copy from one bitmap
@@ -2067,6 +2346,214 @@ void copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 num
void copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen)
{ copyscrollbitmap_trans_common(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, trans_pen); }
+template<class _BitmapClass>
+static inline void prio_copyscrollbitmap_trans_common(_BitmapClass &dest, const _BitmapClass &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen)
+{
+ // no rowscroll and no colscroll means no scroll
+ if (numrows == 0 && numcols == 0)
+ return prio_copybitmap_trans(dest, src, 0, 0, 0, 0, cliprect, priority, pmask, trans_pen);
+
+ assert(numrows != 0 || rowscroll == nullptr);
+ assert(numrows == 0 || rowscroll != nullptr);
+ assert(numcols != 0 || colscroll == nullptr);
+ assert(numcols == 0 || colscroll != nullptr);
+
+ // fully scrolling X,Y playfield
+ if (numrows <= 1 && numcols <= 1)
+ {
+ s32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]);
+ s32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]);
+
+ // iterate over all portions of the scroll that overlap the destination
+ for (s32 sx = xscroll - src.width(); sx < dest.width(); sx += src.width())
+ for (s32 sy = yscroll - src.height(); sy < dest.height(); sy += src.height())
+ prio_copybitmap_trans(dest, src, 0, 0, sx, sy, cliprect, priority, pmask, trans_pen);
+ }
+
+ // scrolling columns plus horizontal scroll
+ else if (numrows <= 1)
+ {
+ s32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]);
+ rectangle subclip = cliprect;
+
+ // determine width of each column
+ int colwidth = src.width() / numcols;
+ assert(src.width() % colwidth == 0);
+
+ // iterate over each column
+ int groupcols;
+ for (int col = 0; col < numcols; col += groupcols)
+ {
+ s32 yscroll = colscroll[col];
+
+ // count consecutive columns scrolled by the same amount
+ for (groupcols = 1; col + groupcols < numcols; groupcols++)
+ if (colscroll[col + groupcols] != yscroll)
+ break;
+
+ // iterate over reps of the columns in question
+ yscroll = normalize_yscroll(src, yscroll);
+ for (s32 sx = xscroll - src.width(); sx < dest.width(); sx += src.width())
+ {
+ // compute the cliprect for this group
+ subclip.setx(col * colwidth + sx, (col + groupcols) * colwidth - 1 + sx);
+ subclip &= cliprect;
+
+ // iterate over all portions of the scroll that overlap the destination
+ for (s32 sy = yscroll - src.height(); sy < dest.height(); sy += src.height())
+ prio_copybitmap_trans(dest, src, 0, 0, sx, sy, subclip, priority, pmask, trans_pen);
+ }
+ }
+ }
+
+ // scrolling rows plus vertical scroll
+ else if (numcols <= 1)
+ {
+ s32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]);
+ rectangle subclip = cliprect;
+
+ // determine width of each rows
+ int rowheight = src.height() / numrows;
+ assert(src.height() % rowheight == 0);
+
+ // iterate over each row
+ int grouprows;
+ for (int row = 0; row < numrows; row += grouprows)
+ {
+ s32 xscroll = rowscroll[row];
+
+ // count consecutive rows scrolled by the same amount
+ for (grouprows = 1; row + grouprows < numrows; grouprows++)
+ if (rowscroll[row + grouprows] != xscroll)
+ break;
+
+ // iterate over reps of the rows in question
+ xscroll = normalize_xscroll(src, xscroll);
+ for (s32 sy = yscroll - src.height(); sy < dest.height(); sy += src.height())
+ {
+ // compute the cliprect for this group
+ subclip.sety(row * rowheight + sy, (row + grouprows) * rowheight - 1 + sy);
+ subclip &= cliprect;
+
+ // iterate over all portions of the scroll that overlap the destination
+ for (s32 sx = xscroll - src.width(); sx < dest.width(); sx += src.width())
+ prio_copybitmap_trans(dest, src, 0, 0, sx, sy, subclip, priority, pmask, trans_pen);
+ }
+ }
+ }
+}
+
+void prio_copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen)
+{ prio_copyscrollbitmap_trans_common(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, priority, pmask, trans_pen); }
+
+void prio_copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen)
+{ prio_copyscrollbitmap_trans_common(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, priority, pmask, trans_pen); }
+
+template<class _BitmapClass>
+static inline void primask_copyscrollbitmap_trans_common(_BitmapClass &dest, const _BitmapClass &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff)
+{
+ // no rowscroll and no colscroll means no scroll
+ if (pcode == 0 && pmask == 0xff)
+ return copyscrollbitmap_trans_common(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, trans_pen);
+
+ if (numrows == 0 && numcols == 0)
+ return primask_copybitmap_trans(dest, src, 0, 0, 0, 0, cliprect, trans_pen, priority, pcode, pmask);
+
+ assert(numrows != 0 || rowscroll == nullptr);
+ assert(numrows == 0 || rowscroll != nullptr);
+ assert(numcols != 0 || colscroll == nullptr);
+ assert(numcols == 0 || colscroll != nullptr);
+
+ // fully scrolling X,Y playfield
+ if (numrows <= 1 && numcols <= 1)
+ {
+ s32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]);
+ s32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]);
+
+ // iterate over all portions of the scroll that overlap the destination
+ for (s32 sx = xscroll - src.width(); sx < dest.width(); sx += src.width())
+ for (s32 sy = yscroll - src.height(); sy < dest.height(); sy += src.height())
+ primask_copybitmap_trans(dest, src, 0, 0, sx, sy, cliprect, trans_pen, priority, pcode, pmask);
+ }
+
+ // scrolling columns plus horizontal scroll
+ else if (numrows <= 1)
+ {
+ s32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]);
+ rectangle subclip = cliprect;
+
+ // determine width of each column
+ int colwidth = src.width() / numcols;
+ assert(src.width() % colwidth == 0);
+
+ // iterate over each column
+ int groupcols;
+ for (int col = 0; col < numcols; col += groupcols)
+ {
+ s32 yscroll = colscroll[col];
+
+ // count consecutive columns scrolled by the same amount
+ for (groupcols = 1; col + groupcols < numcols; groupcols++)
+ if (colscroll[col + groupcols] != yscroll)
+ break;
+
+ // iterate over reps of the columns in question
+ yscroll = normalize_yscroll(src, yscroll);
+ for (s32 sx = xscroll - src.width(); sx < dest.width(); sx += src.width())
+ {
+ // compute the cliprect for this group
+ subclip.setx(col * colwidth + sx, (col + groupcols) * colwidth - 1 + sx);
+ subclip &= cliprect;
+
+ // iterate over all portions of the scroll that overlap the destination
+ for (s32 sy = yscroll - src.height(); sy < dest.height(); sy += src.height())
+ primask_copybitmap_trans(dest, src, 0, 0, sx, sy, subclip, trans_pen, priority, pcode, pmask);
+ }
+ }
+ }
+
+ // scrolling rows plus vertical scroll
+ else if (numcols <= 1)
+ {
+ s32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]);
+ rectangle subclip = cliprect;
+
+ // determine width of each rows
+ int rowheight = src.height() / numrows;
+ assert(src.height() % rowheight == 0);
+
+ // iterate over each row
+ int grouprows;
+ for (int row = 0; row < numrows; row += grouprows)
+ {
+ s32 xscroll = rowscroll[row];
+
+ // count consecutive rows scrolled by the same amount
+ for (grouprows = 1; row + grouprows < numrows; grouprows++)
+ if (rowscroll[row + grouprows] != xscroll)
+ break;
+
+ // iterate over reps of the rows in question
+ xscroll = normalize_xscroll(src, xscroll);
+ for (s32 sy = yscroll - src.height(); sy < dest.height(); sy += src.height())
+ {
+ // compute the cliprect for this group
+ subclip.sety(row * rowheight + sy, (row + grouprows) * rowheight - 1 + sy);
+ subclip &= cliprect;
+
+ // iterate over all portions of the scroll that overlap the destination
+ for (s32 sx = xscroll - src.width(); sx < dest.width(); sx += src.width())
+ primask_copybitmap_trans(dest, src, 0, 0, sx, sy, subclip, trans_pen, priority, pcode, pmask);
+ }
+ }
+ }
+}
+
+void primask_copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{ primask_copyscrollbitmap_trans_common(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, trans_pen, priority, pcode, pmask); }
+
+void primask_copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{ primask_copyscrollbitmap_trans_common(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, trans_pen, priority, pcode, pmask); }
/***************************************************************************
@@ -2091,6 +2578,38 @@ void copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_r
COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY);
}
+void prio_copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8);
+}
+
+void prio_copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8);
+}
+
+void primask_copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ copyrozbitmap(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound);
+ else
+ COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8);
+}
+
+void primask_copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ copyrozbitmap(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound);
+ else
+ COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8);
+}
+
/*-------------------------------------------------
copyrozbitmap_trans - copy from one bitmap to
@@ -2110,3 +2629,35 @@ void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bi
DECLARE_NO_PRIORITY;
COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY);
}
+
+void prio_copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask, u32 trans_pen)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN_PRIORITY, u8);
+}
+
+void prio_copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask, u32 trans_pen)
+{
+ // high bit of the mask is implicitly on
+ pmask |= 1 << 31;
+
+ COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN_PRIORITY, u8);
+}
+
+void primask_copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 trans_pen, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ copyrozbitmap_trans(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, trans_pen);
+ else
+ COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN_PRIMASK, u8);
+}
+
+void primask_copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 trans_pen, bitmap_ind8 &priority, u8 pcode, u8 pmask)
+{
+ if (pcode == 0 && pmask == 0xff)
+ copyrozbitmap_trans(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, trans_pen);
+ else
+ COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN_PRIMASK, u8);
+}
diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h
index 96bdc592ab1..4d3f4d0e0c9 100644
--- a/src/emu/drawgfx.h
+++ b/src/emu/drawgfx.h
@@ -262,9 +262,9 @@ public:
// implementations moved here from specific drivers
void prio_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask, u32 trans_pen);
- void prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect,u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty,u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask,u32 trans_pen);
- void alphastore(bitmap_rgb32 &dest, const rectangle &cliprect,u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty,int fixedalpha, u8 *alphatable);
- void alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, int fixedalpha ,u8 *alphatable);
+ void prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, u32 trans_pen);
+ void alphastore(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, int fixedalpha, u8 *alphatable);
+ void alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, int fixedalpha, u8 *alphatable);
private:
// internal helpers
void decode(u32 code);
@@ -316,14 +316,32 @@ private:
void draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata);
void draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata);
+void prio_draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask);
+void prio_draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask);
+
+void primask_draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+void primask_draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+
// copy pixels from a 16bpp buffer to a single scanline of a bitmap
void draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata);
void draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata);
+void prio_draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask);
+void prio_draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask);
+
+void primask_draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+void primask_draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+
// copy pixels from a 32bpp buffer to a single scanline of a bitmap
void draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata);
void draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata);
+void prio_draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask);
+void prio_draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask);
+
+void primask_draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+void primask_draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+
// ----- scanline extraction -----
@@ -348,12 +366,28 @@ void extract_scanline32(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 leng
void copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect);
void copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect);
+void prio_copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask);
+void prio_copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask);
+
+void primask_copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+void primask_copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+
// copy from one bitmap to another, copying all unclipped pixels except those that match transpen
void copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 transpen);
void copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 transpen);
+void prio_copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 transpen);
+void prio_copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 transpen);
+
+void primask_copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 transpen, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+void primask_copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 transpen, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+
void copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect);
+void prio_copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask);
+
+void primask_copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+
/*
Copy a bitmap onto another with scroll and wraparound.
These functions support multiple independently scrolling rows/columns.
@@ -370,10 +404,22 @@ void copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flip
void copyscrollbitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect);
void copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect);
+void prio_copyscrollbitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask);
+void prio_copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask);
+
+void primask_copyscrollbitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+void primask_copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+
// copy from one bitmap to another, copying all unclipped pixels except those that match transpen, and applying scrolling to one or more rows/columns
void copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 transpen);
void copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 transpen);
+void prio_copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 transpen);
+void prio_copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 transpen);
+
+void primask_copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 transpen, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+void primask_copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 transpen, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+
/*
Copy a bitmap applying rotation, zooming, and arbitrary distortion.
This function works in a way that mimics some real hardware like the Konami
@@ -407,10 +453,22 @@ void copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 num
void copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound);
void copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound);
+void prio_copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask);
+void prio_copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask);
+
+void primask_copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+void primask_copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+
// copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels whose values do not match transpen
void copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 transparent_color);
void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 transparent_color);
+void prio_copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask, u32 transparent_color);
+void prio_copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask, u32 transparent_color);
+
+void primask_copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 transparent_color, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+void primask_copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 transparent_color, bitmap_ind8 &priority, u8 pcode = 0, u8 pmask = 0xff);
+
/***************************************************************************
@@ -442,6 +500,32 @@ constexpr u32 alpha_blend_r32(u32 d, u32 s, u8 level)
((((s & 0xff0000) * level + (d & 0xff0000) * int(256 - level)) >> 8) & 0xff0000);
}
+
+//-------------------------------------------------
+// add_blend_r16 - additive blend two 16-bit
+// 5-5-5 RGB pixels
+//-------------------------------------------------
+
+constexpr u32 add_blend_r16(u32 d, u32 s)
+{
+ return std::min(u32((s & 0x001f) + (d & 0x001f)), u32(0x001f)) |
+ std::min(u32((s & 0x03e0) + (d & 0x03e0)), u32(0x03e0)) |
+ std::min(u32((s & 0x7c00) + (d & 0x7c00)), u32(0x7c00));
+}
+
+
+//-------------------------------------------------
+// add_blend_r32 - additive blend two 32-bit
+// 8-8-8 RGB pixels
+//-------------------------------------------------
+
+constexpr u32 add_blend_r32(u32 d, u32 s)
+{
+ return std::min(u32((s & 0x0000ff) + (d & 0x0000ff)), u32(0x0000ff)) |
+ std::min(u32((s & 0x00ff00) + (d & 0x00ff00)), u32(0x00ff00)) |
+ std::min(u32((s & 0xff0000) + (d & 0xff0000)), u32(0xff0000));
+}
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h
index f4566e9b59f..6361ed8bf92 100644
--- a/src/emu/drawgfxm.h
+++ b/src/emu/drawgfxm.h
@@ -78,6 +78,21 @@ do
(DEST) = SOURCE; \
} \
while (0)
+#define PIXEL_OP_COPY_OPAQUE_PRIORITY(DEST, PRIORITY, SOURCE) \
+do \
+{ \
+ if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \
+ (DEST) = SOURCE; \
+ (PRIORITY) = 31; \
+} \
+while (0)
+#define PIXEL_OP_COPY_OPAQUE_PRIMASK(DEST, PRIORITY, SOURCE) \
+do \
+{ \
+ (DEST) = SOURCE; \
+ (PRIORITY) = ((PRIORITY) & pmask) | pcode; \
+} \
+while (0)
/*-------------------------------------------------
PIXEL_OP_COPY_TRANSPEN - render all pixels
@@ -93,6 +108,29 @@ do
(DEST) = SOURCE; \
} \
while (0)
+#define PIXEL_OP_COPY_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \
+do \
+{ \
+ u32 srcdata = (SOURCE); \
+ if (srcdata != trans_pen) \
+ { \
+ if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \
+ (DEST) = SOURCE; \
+ (PRIORITY) = 31; \
+ } \
+} \
+while (0)
+#define PIXEL_OP_COPY_TRANSPEN_PRIMASK(DEST, PRIORITY, SOURCE) \
+do \
+{ \
+ u32 srcdata = (SOURCE); \
+ if (srcdata != trans_pen) \
+ { \
+ (DEST) = SOURCE; \
+ (PRIORITY) = ((PRIORITY) & pmask) | pcode; \
+ } \
+} \
+while (0)
/*-------------------------------------------------
PIXEL_OP_COPY_TRANSALPHA - render all pixels
@@ -100,12 +138,35 @@ while (0)
directly
-------------------------------------------------*/
-#define PIXEL_OP_COPY_TRANSALPHA(DEST, PRIORITY, SOURCE) \
+#define PIXEL_OP_COPY_TRANSALPHA(DEST, PRIORITY, SOURCE) \
+do \
+{ \
+ u32 srcdata = (SOURCE); \
+ if ((srcdata & 0xff000000) != 0) \
+ (DEST) = SOURCE; \
+} \
+while (0)
+#define PIXEL_OP_COPY_TRANSALPHA_PRIORITY(DEST, PRIORITY, SOURCE) \
+do \
+{ \
+ u32 srcdata = (SOURCE); \
+ if ((srcdata & 0xff000000) != 0) \
+ { \
+ if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \
+ (DEST) = SOURCE; \
+ (PRIORITY) = 31; \
+ } \
+} \
+while (0)
+#define PIXEL_OP_COPY_TRANSALPHA_PRIMASK(DEST, PRIORITY, SOURCE) \
do \
{ \
u32 srcdata = (SOURCE); \
- if ((srcdata & 0xff000000) != 0) \
+ if ((srcdata & 0xff000000) != 0) \
+ { \
(DEST) = SOURCE; \
+ (PRIORITY) = ((PRIORITY) & pmask) | pcode; \
+ } \
} \
while (0)
@@ -129,6 +190,13 @@ do
(PRIORITY) = 31; \
} \
while (0)
+#define PIXEL_OP_REMAP_OPAQUE_PRIMASK(DEST, PRIORITY, SOURCE) \
+do \
+{ \
+ (DEST) = paldata[SOURCE]; \
+ (PRIORITY) = ((PRIORITY) & pmask) | pcode; \
+} \
+while (0)
/*-------------------------------------------------
PIXEL_OP_REBASE_OPAQUE - render all pixels
diff --git a/src/mame/drivers/realbrk.cpp b/src/mame/drivers/realbrk.cpp
index a3b810bc6ac..7376ec109ae 100644
--- a/src/mame/drivers/realbrk.cpp
+++ b/src/mame/drivers/realbrk.cpp
@@ -53,9 +53,9 @@ To Do:
/* Read 4 ten bit dip switches */
-READ16_MEMBER(realbrk_state::realbrk_dsw_r)
+u16 realbrk_state::realbrk_dsw_r()
{
- uint16_t sel = ~m_dsw_select[0];
+ const u16 sel = ~m_dsw_select[0];
if (sel & 0x01) return (m_dsw_io[0]->read() & 0x00ff) << 8; // DSW1 low bits
if (sel & 0x02) return (m_dsw_io[1]->read() & 0x00ff) << 8; // DSW2 low bits
if (sel & 0x04) return (m_dsw_io[2]->read() & 0x00ff) << 8; // DSW3 low bits
@@ -70,7 +70,7 @@ READ16_MEMBER(realbrk_state::realbrk_dsw_r)
return 0xffff;
}
-READ16_MEMBER(realbrk_state::pkgnsh_input_r)
+u16 realbrk_state::pkgnsh_input_r(offs_t offset)
{
switch(offset)
{
@@ -88,9 +88,9 @@ READ16_MEMBER(realbrk_state::pkgnsh_input_r)
return 0xffff;
}
-READ16_MEMBER(realbrk_state::pkgnshdx_input_r)
+u16 realbrk_state::pkgnshdx_input_r(offs_t offset)
{
- uint16_t sel = ~m_dsw_select[0];
+ const u16 sel = ~m_dsw_select[0];
switch(offset)
{
@@ -122,7 +122,7 @@ READ16_MEMBER(realbrk_state::pkgnshdx_input_r)
}
-READ16_MEMBER(realbrk_state::backup_ram_r)
+u16 realbrk_state::backup_ram_r(offs_t offset)
{
/*TODO: understand the format & cmds of the backup-ram,maybe it's an
unemulated tmp68301 feature?*/
@@ -133,7 +133,7 @@ READ16_MEMBER(realbrk_state::backup_ram_r)
}
-READ16_MEMBER(realbrk_state::backup_ram_dx_r)
+u16 realbrk_state::backup_ram_dx_r(offs_t offset)
{
/*TODO: understand the format & cmds of the backup-ram,maybe it's an
unemulated tmp68301 feature?*/
@@ -143,13 +143,13 @@ READ16_MEMBER(realbrk_state::backup_ram_dx_r)
return m_backup_ram[offset];
}
-WRITE16_MEMBER(realbrk_state::backup_ram_w)
+void realbrk_state::backup_ram_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_backup_ram[offset]);
}
template<int Layer>
-WRITE16_MEMBER(realbrk_state::vram_w)
+void realbrk_state::vram_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_vram[Layer][offset]);
m_tilemap[Layer]->mark_tile_dirty(offset/2);
diff --git a/src/mame/includes/realbrk.h b/src/mame/includes/realbrk.h
index 179674e17a0..7c0c1546673 100644
--- a/src/mame/includes/realbrk.h
+++ b/src/mame/includes/realbrk.h
@@ -35,18 +35,21 @@ public:
void realbrk(machine_config &config);
void pkgnshdx(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
required_device<tmp68301_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
- required_shared_ptr<uint16_t> m_spriteram;
- required_shared_ptr_array<uint16_t, 3> m_vram;
- required_shared_ptr<uint16_t> m_vregs;
- optional_shared_ptr<uint16_t> m_dsw_select;
- optional_shared_ptr<uint16_t> m_backup_ram;
- optional_shared_ptr_array<uint16_t, 2> m_vram_ras;
+ required_shared_ptr<u16> m_spriteram;
+ required_shared_ptr_array<u16, 3> m_vram;
+ required_shared_ptr<u16> m_vregs;
+ optional_shared_ptr<u16> m_dsw_select;
+ optional_shared_ptr<u16> m_backup_ram;
+ optional_shared_ptr_array<u16, 2> m_vram_ras;
optional_ioport_array<2> m_in_io;
optional_ioport_array<4> m_dsw_io;
@@ -59,30 +62,28 @@ private:
tilemap_t *m_tilemap[3];
// common
- template<int Layer> DECLARE_WRITE16_MEMBER(vram_w);
- DECLARE_WRITE16_MEMBER(vram_2_w);
- DECLARE_WRITE16_MEMBER(vregs_w);
+ template<int Layer> void vram_w(offs_t offset, u16 data, u16 mem_mask);
+ void vram_2_w(offs_t offset, u16 data, u16 mem_mask);
+ void vregs_w(offs_t offset, u16 data, u16 mem_mask);
// realbrk and/or dai2kaku
- DECLARE_READ16_MEMBER(realbrk_dsw_r);
- DECLARE_WRITE16_MEMBER(realbrk_flipscreen_w);
- DECLARE_WRITE16_MEMBER(dai2kaku_flipscreen_w);
+ u16 realbrk_dsw_r();
+ void realbrk_flipscreen_w(offs_t offset, u16 data, u16 mem_mask);
+ void dai2kaku_flipscreen_w(u16 data);
// pkgnsh and/or pkgnshdx
- DECLARE_READ16_MEMBER(pkgnsh_input_r);
- DECLARE_READ16_MEMBER(pkgnshdx_input_r);
- DECLARE_READ16_MEMBER(backup_ram_r);
- DECLARE_READ16_MEMBER(backup_ram_dx_r);
- DECLARE_WRITE16_MEMBER(backup_ram_w);
+ u16 pkgnsh_input_r(offs_t offset);
+ u16 pkgnshdx_input_r(offs_t offset);
+ u16 backup_ram_r(offs_t offset);
+ u16 backup_ram_dx_r(offs_t offset);
+ void backup_ram_w(offs_t offset, u16 data, u16 mem_mask);
template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
TILE_GET_INFO_MEMBER(get_tile_info_2);
- virtual void video_start() override;
-
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- uint32_t screen_update_dai2kaku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- template <bool Rotatable> void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer);
+ u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ u32 screen_update_dai2kaku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ template <bool Rotatable> void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, bitmap_ind8 &priority);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void base_mem(address_map &map);
diff --git a/src/mame/video/hng64.cpp b/src/mame/video/hng64.cpp
index 7628fafe227..942bac2c7b3 100644
--- a/src/mame/video/hng64.cpp
+++ b/src/mame/video/hng64.cpp
@@ -24,10 +24,10 @@ void hng64_state::hng64_mark_tile_dirty( int tilemap, int tile_index )
// make this a function!
-// pppppppp ff--atttt tttttttt tttttttt
+// pppppppp ffattttt tttttttt tttttttt
#define HNG64_GET_TILE_INFO \
{ \
- uint16_t tilemapinfo = (m_videoregs[reg]>>shift)&0xffff; \
+ uint16_t tilemapinfo = (m_videoregs[reg]>>shift)&0xffff; \
int tileno,pal, flip; \
\
tileno = m_videoram[tile_index+(offset/4)]; \
@@ -220,21 +220,6 @@ static void hng64_configure_blit_parameters(blit_parameters *blit, tilemap_t *tm
}
}
-static inline uint32_t alpha_additive_r32(uint32_t d, uint32_t s, uint8_t level)
-{
- uint32_t add;
- add = (s & 0x00ff0000) + (d & 0x00ff0000);
- if (add & 0x01000000) d = (d & 0xff00ffff) | (0x00ff0000);
- else d = (d & 0xff00ffff) | (add & 0x00ff0000);
- add = (s & 0x000000ff) + (d & 0x000000ff);
- if (add & 0x00000100) d = (d & 0xffffff00) | (0x000000ff);
- else d = (d & 0xffffff00) | (add & 0x000000ff);
- add = (s & 0x0000ff00) + (d & 0x0000ff00);
- if (add & 0x00010000) d = (d & 0xffff00ff) | (0x0000ff00);
- else d = (d & 0xffff00ff) | (add & 0x0000ff00);
- return d;
-}
-
/*-------------------------------------------------
tilemap_draw_roz_core - render the tilemap's
@@ -247,7 +232,7 @@ do {
if (blit->drawformat == HNG64_TILEMAP_NORMAL) \
*(uint32_t *)dest = clut[INPUT_VAL]; \
else if (blit->drawformat == HNG64_TILEMAP_ADDITIVE) \
- *(uint32_t *)dest = alpha_additive_r32(*(uint32_t *)dest, clut[INPUT_VAL], alpha); \
+ *(uint32_t *)dest = add_blend_r32(*(uint32_t *)dest, clut[INPUT_VAL]); \
else if (blit->drawformat == HNG64_TILEMAP_ALPHA) \
*(uint32_t *)dest = alpha_blend_r32(*(uint32_t *)dest, clut[INPUT_VAL], alpha); \
} while (0)
diff --git a/src/mame/video/realbrk.cpp b/src/mame/video/realbrk.cpp
index 02b1118f122..f05e7f4877e 100644
--- a/src/mame/video/realbrk.cpp
+++ b/src/mame/video/realbrk.cpp
@@ -25,7 +25,7 @@
#include "includes/realbrk.h"
-WRITE16_MEMBER(realbrk_state::realbrk_flipscreen_w)
+void realbrk_state::realbrk_flipscreen_w(offs_t offset, u16 data, u16 mem_mask)
{
if (ACCESSING_BITS_0_7)
{
@@ -41,7 +41,7 @@ WRITE16_MEMBER(realbrk_state::realbrk_flipscreen_w)
}
}
-WRITE16_MEMBER(realbrk_state::dai2kaku_flipscreen_w)
+void realbrk_state::dai2kaku_flipscreen_w(u16 data)
{
m_disable_video = 0;
}
@@ -73,8 +73,8 @@ WRITE16_MEMBER(realbrk_state::dai2kaku_flipscreen_w)
template<int Layer>
TILE_GET_INFO_MEMBER(realbrk_state::get_tile_info)
{
- uint16_t attr = m_vram[Layer][tile_index * 2 + 0];
- uint16_t code = m_vram[Layer][tile_index * 2 + 1];
+ const u16 attr = m_vram[Layer][tile_index * 2 + 0];
+ const u16 code = m_vram[Layer][tile_index * 2 + 1];
SET_TILE_INFO_MEMBER(0,
code,
attr & 0x7f,
@@ -97,14 +97,14 @@ TILE_GET_INFO_MEMBER(realbrk_state::get_tile_info)
TILE_GET_INFO_MEMBER(realbrk_state::get_tile_info_2)
{
- uint16_t code = m_vram[2][tile_index];
+ const u16 code = m_vram[2][tile_index];
SET_TILE_INFO_MEMBER(1,
code & 0x0fff,
((code & 0xf000) >> 12) | ((m_vregs[0xa/2] & 0x7f) << 4),
0);
}
-WRITE16_MEMBER(realbrk_state::vram_2_w)
+void realbrk_state::vram_2_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_vram[2][offset]);
m_tilemap[2]->mark_tile_dirty(offset);
@@ -125,7 +125,7 @@ void realbrk_state::video_start()
m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(realbrk_state::get_tile_info<1>),this), TILEMAP_SCAN_ROWS, 16, 16, 0x40, 0x20);
/* Text */
- m_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(realbrk_state::get_tile_info_2),this), TILEMAP_SCAN_ROWS, 8, 8, 0x40, 0x20);
+ m_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(realbrk_state::get_tile_info_2),this), TILEMAP_SCAN_ROWS, 8, 8, 0x40, 0x20);
m_tilemap[0]->set_transparent_pen(0);
m_tilemap[1]->set_transparent_pen(0);
@@ -187,44 +187,47 @@ void realbrk_state::video_start()
// DaiDaiKakumei
// layer : 0== bghigh<spr 1== bglow<spr<bghigh 2==spr<bglow 3==boarder
template <bool Rotatable>
-void realbrk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer)
+void realbrk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority)
{
- int const max_x(m_screen->width());
- int const max_y(m_screen->height());
+ constexpr u32 PRI_MAP[4]{
+ GFX_PMASK_4, // over m_tilemap[1], over m_tilemap[0], under m_tilemap[2]
+ GFX_PMASK_4 | GFX_PMASK_2, // over m_tilemap[1], under m_tilemap[0], under m_tilemap[2]
+ GFX_PMASK_4 | GFX_PMASK_2 | GFX_PMASK_1, // under m_tilemap[1], under m_tilemap[0], under m_tilemap[2]
+ GFX_PMASK_4 | GFX_PMASK_2 | GFX_PMASK_1 }; // unknown
- for (int offs = 0x3000 / 2; offs < 0x3600 / 2; offs += 2 / 2)
+ const int max_x(m_screen->width());
+ const int max_y(m_screen->height());
+
+ for (int offs = (0x3600 - 2) / 2; offs >= 0x3000 / 2; offs -= 2 / 2)
{
if (BIT(m_spriteram[offs], 15))
continue;
- uint16_t const *const s(&m_spriteram[(m_spriteram[offs] & 0x3ff) * 16 / 2]);
-
- int sy = s[0];
+ const u16 *const s(&m_spriteram[(m_spriteram[offs] & 0x3ff) * 16 / 2]);
- int sx = s[1];
+ int sy = s[0];
- int xnum = ((s[2] >> 0) & 0x001f) + 1;
- int ynum = ((s[2] >> 8) & 0x001f) + 1;
+ int sx = s[1];
- int xdim = ((s[3] >> 0) & 0x00ff) << (16 - 6 + 4);
- int ydim = ((s[3] >> 8) & 0x00ff) << (16 - 6 + 4);
+ const int xnum = ((s[2] >> 0) & 0x001f) + 1;
+ const int ynum = ((s[2] >> 8) & 0x001f) + 1;
- int flipx = BIT(s[4], 8);
- int flipy = BIT(s[4], 9);
- int rot = (s[4] >> 4) & 0x0003;
- int pri = (s[4] >> 0) & 0x0003;
+ const int xdim = ((s[3] >> 0) & 0x00ff) << (16 - 6 + 4);
+ const int ydim = ((s[3] >> 8) & 0x00ff) << (16 - 6 + 4);
- int color = s[5];
+ int flipx = BIT(s[4], 8);
+ int flipy = BIT(s[4], 9);
+ const u8 rot = (s[4] >> 4) & 0x0003;
+ const u8 pri = (s[4] >> 0) & 0x0003;
- int gfx = (s[6] & 0x0001) + 2;
+ const u32 color = s[5];
- int code = s[7];
+ const u8 gfx = m_gfxdecode->gfx(3) ? (s[6] & 0x0001) + 2 : 2;
- if (pri != layer)
- continue;
+ u32 code = s[7];
- sx = ((sx & 0x1ff) - (sx & 0x200)) << 16;
- sy = ((sy & 0x0ff) - (sy & 0x100)) << 16;
+ sx = ((sx & 0x1ff) - (sx & 0x200)) << 16;
+ sy = ((sy & 0x0ff) - (sy & 0x100)) << 16;
if (flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; }
if (flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; }
@@ -256,8 +259,8 @@ void realbrk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
int currx = (sx + x * xdim) / 0x10000;
int curry = (sy + y * ydim) / 0x10000;
- int scalex = (sx + (x + 1) * xdim) / 0x10000 - currx;
- int scaley = (sy + (y + 1) * ydim) / 0x10000 - curry;
+ const int scalex = (sx + (x + 1) * xdim) / 0x10000 - currx;
+ const int scaley = (sy + (y + 1) * ydim) / 0x10000 - curry;
if (Rotatable && rot)
{
@@ -279,8 +282,8 @@ void realbrk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
{
case 0x1: // rot 90
copyrozbitmap_trans(*m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
- uint32_t(0) << 16,
- uint32_t(16) << 16,
+ u32(0) << 16,
+ u32(16) << 16,
0 << 16,
0xffff << 16,
1 << 16,
@@ -293,8 +296,8 @@ void realbrk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
case 0x2: // rot 180
copyrozbitmap_trans(*m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
- uint32_t(16) << 16,
- uint32_t(16) << 16,
+ u32(16) << 16,
+ u32(16) << 16,
0xffff << 16,
0 << 16,
0 << 16,
@@ -307,8 +310,8 @@ void realbrk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
case 0x3: // rot 270
copyrozbitmap_trans(*m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
- uint32_t(16) << 16,
- uint32_t(0) << 16,
+ u32(16) << 16,
+ u32(0) << 16,
0 << 16,
1 << 16,
0xffff << 16,
@@ -320,16 +323,17 @@ void realbrk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
break;
}
- copybitmap_trans(bitmap, *m_tmpbitmap1, 0, 0, currx, curry, cliprect, 0);
+ prio_copybitmap_trans(bitmap, *m_tmpbitmap1, 0, 0, currx, curry, cliprect, priority, PRI_MAP[pri], 0);
}
else
{
- m_gfxdecode->gfx(gfx)->zoom_transpen(bitmap, cliprect,
+ m_gfxdecode->gfx(gfx)->prio_zoom_transpen(bitmap, cliprect,
code++,
color,
flipx, flipy,
currx, curry,
scalex << 12, scaley << 12,
+ priority, PRI_MAP[pri],
0);
}
}
@@ -365,18 +369,18 @@ void realbrk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
***************************************************************************/
-WRITE16_MEMBER(realbrk_state::vregs_w)
+void realbrk_state::vregs_w(offs_t offset, u16 data, u16 mem_mask)
{
- uint16_t old_data = m_vregs[offset];
- uint16_t new_data = COMBINE_DATA(&m_vregs[offset]);
- if (new_data != old_data)
+ const u16 old_data = m_vregs[offset];
+ data = COMBINE_DATA(&m_vregs[offset]);
+ if (data != old_data)
{
- if (offset == 0xa/2)
+ if ((offset == 0xa/2) && ((old_data ^ data) & 0x7f))
m_tilemap[0]->mark_all_dirty();
}
}
-uint32_t realbrk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+u32 realbrk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_tilemap[0]->set_scrolly(0, m_vregs[0x0/2]);
m_tilemap[0]->set_scrollx(0, m_vregs[0x2/2]);
@@ -406,29 +410,24 @@ uint32_t realbrk_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
}
#endif
- if (layers_ctrl & 8) draw_sprites<true>(bitmap, cliprect, 3); // Unknown
- if (layers_ctrl & 8) draw_sprites<true>(bitmap, cliprect, 2); // Under m_tilemap[1], Under m_tilemap[0]
-
if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 1);
- if (layers_ctrl & 8) draw_sprites<true>(bitmap,cliprect, 1); // Over m_tilemap[1], Under m_tilemap[0]
-
if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 2);
- if (layers_ctrl & 8) draw_sprites<true>(bitmap,cliprect, 0); // Over m_tilemap[1], Over m_tilemap[0]
-
if (layers_ctrl & 4) m_tilemap[2]->draw(screen, bitmap, cliprect, 0, 4);
+ if (layers_ctrl & 8) draw_sprites<true>(bitmap,cliprect, screen.priority());
+
// popmessage("%04x",m_vregs[0x8/2]);
return 0;
}
/* DaiDaiKakumei */
-uint32_t realbrk_state::screen_update_dai2kaku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+u32 realbrk_state::screen_update_dai2kaku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// bg0
- int const bgy0(m_vregs[0x0 / 2]);
- int const bgx0(m_vregs[0x2 / 2]);
+ const int bgy0(m_vregs[0x0 / 2]);
+ const int bgx0(m_vregs[0x2 / 2]);
if (BIT(m_vregs[8 / 2], 8))
{
m_tilemap[0]->set_scroll_rows(512);
@@ -443,8 +442,8 @@ uint32_t realbrk_state::screen_update_dai2kaku(screen_device &screen, bitmap_ind
m_tilemap[0]->set_scrolly(0, bgy0);
// bg1
- int const bgy1(m_vregs[0x4 / 2]);
- int const bgx1(m_vregs[0x6 / 2]);
+ const int bgy1(m_vregs[0x4 / 2]);
+ const int bgx1(m_vregs[0x6 / 2]);
if (BIT(m_vregs[8 / 2], 0))
{
m_tilemap[1]->set_scroll_rows(512);
@@ -480,26 +479,20 @@ uint32_t realbrk_state::screen_update_dai2kaku(screen_device &screen, bitmap_ind
}
#endif
- bool const bgpri(BIT(m_vregs[8 / 2], 15));
-
- // spr 0
- if (layers_ctrl & 8) draw_sprites<false>(bitmap, cliprect, 2);
+ const bool bgpri(BIT(m_vregs[8 / 2], 15));
// bglow
if (layers_ctrl & (bgpri ? 1 : 2)) m_tilemap[bgpri ? 0 : 1]->draw(screen, bitmap, cliprect, 0, 1);
- // spr 1
- if (layers_ctrl & 8) draw_sprites<false>(bitmap, cliprect, 1);
-
// bghigh
if (layers_ctrl & (bgpri ? 2 : 1)) m_tilemap[bgpri ? 1 : 0]->draw(screen, bitmap, cliprect, 0, 2);
- // spr 2
- if (layers_ctrl & 8) draw_sprites<false>(bitmap, cliprect, 0);
-
// fix
if (layers_ctrl & 4) m_tilemap[2]->draw(screen, bitmap, cliprect, 0, 4);
+ // spr
+ if (layers_ctrl & 8) draw_sprites<false>(bitmap, cliprect, screen.priority());
+
// usrintf_showmessage("%04x",m_vregs[0x8/2]);
return 0;
}