summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/dcheese.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/dcheese.cpp')
-rw-r--r--src/mame/video/dcheese.cpp75
1 files changed, 41 insertions, 34 deletions
diff --git a/src/mame/video/dcheese.cpp b/src/mame/video/dcheese.cpp
index f7a82d589aa..8e4e1d5b1ff 100644
--- a/src/mame/video/dcheese.cpp
+++ b/src/mame/video/dcheese.cpp
@@ -17,8 +17,8 @@
*
*************************************/
-static constexpr u32 DSTBITMAP_WIDTH = 512;
-static constexpr u32 DSTBITMAP_HEIGHT = 512;
+#define DSTBITMAP_WIDTH 512
+#define DSTBITMAP_HEIGHT 512
/*************************************
@@ -31,7 +31,7 @@ void dcheese_state::dcheese_palette(palette_device &palette) const
{
for (int i = 0; i < 65536; i++)
{
- u16 const data = m_palrom[i];
+ int const data = m_palrom[i];
palette.set_pen_color(i, pal6bit(data >> 0), pal5bit(data >> 6), pal5bit(data >> 11));
}
}
@@ -49,13 +49,16 @@ void dcheese_state::update_scanline_irq()
/* if not in range, don't bother */
if (m_blitter_vidparam[0x22/2] <= m_blitter_vidparam[0x1e/2])
{
+ int effscan;
+ attotime time;
+
/* compute the effective scanline of the interrupt */
- int effscan = m_blitter_vidparam[0x22/2] - m_blitter_vidparam[0x1a/2];
+ effscan = m_blitter_vidparam[0x22/2] - m_blitter_vidparam[0x1a/2];
if (effscan < 0)
effscan += m_blitter_vidparam[0x1e/2];
/* determine the time; if it's in this scanline, bump to the next frame */
- attotime time = m_screen->time_until_pos(effscan);
+ time = m_screen->time_until_pos(effscan);
if (time < m_screen->scan_period())
time += m_screen->frame_period();
m_blitter_timer->adjust(time);
@@ -68,11 +71,11 @@ void dcheese_state::device_timer(emu_timer &timer, device_timer_id id, int param
switch (id)
{
case TIMER_BLITTER_SCANLINE:
- signal_irq(3);
+ dcheese_signal_irq(3);
update_scanline_irq();
break;
case TIMER_SIGNAL_IRQ:
- signal_irq(param);
+ dcheese_signal_irq(param);
break;
default:
assert_always(false, "Unknown id in dcheese_state::device_timer");
@@ -111,15 +114,17 @@ void dcheese_state::video_start()
*
*************************************/
-u32 dcheese_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t dcheese_state::screen_update_dcheese(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
+ int x, y;
+
/* update the pixels */
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.min_y; y <= cliprect.max_y; y++)
{
- u16 *dest = &bitmap.pix16(y);
- u16 *src = &m_dstbitmap->pix16((y + m_blitter_vidparam[0x28/2]) & 0x1ff);
+ uint16_t *dest = &bitmap.pix16(y);
+ uint16_t *src = &m_dstbitmap->pix16((y + m_blitter_vidparam[0x28/2]) & 0x1ff);
- for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.min_x; x <= cliprect.max_x; x++)
dest[x] = src[x];
}
return 0;
@@ -133,10 +138,12 @@ u32 dcheese_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co
*
*************************************/
-void dcheese_state::do_clear()
+void dcheese_state::do_clear( )
{
+ int y;
+
/* clear the requested scanlines */
- for (int y = m_blitter_vidparam[0x2c/2]; y < m_blitter_vidparam[0x2a/2]; y++)
+ for (y = m_blitter_vidparam[0x2c/2]; y < m_blitter_vidparam[0x2a/2]; y++)
memset(&m_dstbitmap->pix16(y & 0x1ff), 0, DSTBITMAP_WIDTH * 2);
/* signal an IRQ when done (timing is just a guess) */
@@ -144,31 +151,31 @@ void dcheese_state::do_clear()
}
-void dcheese_state::do_blit()
+void dcheese_state::do_blit( )
{
- s32 const srcminx = m_blitter_xparam[0] << 12;
- s32 const srcmaxx = m_blitter_xparam[1] << 12;
- s32 const srcminy = m_blitter_yparam[0] << 12;
- s32 const srcmaxy = m_blitter_yparam[1] << 12;
- s32 const srcx = ((m_blitter_xparam[2] & 0x0fff) | ((m_blitter_xparam[3] & 0x0fff) << 12)) << 7;
- s32 const srcy = ((m_blitter_yparam[2] & 0x0fff) | ((m_blitter_yparam[3] & 0x0fff) << 12)) << 7;
- s32 const dxdx = (s32)(((m_blitter_xparam[4] & 0x0fff) | ((m_blitter_xparam[5] & 0x0fff) << 12)) << 12) >> 12;
- s32 const dxdy = (s32)(((m_blitter_xparam[6] & 0x0fff) | ((m_blitter_xparam[7] & 0x0fff) << 12)) << 12) >> 12;
- s32 const dydx = (s32)(((m_blitter_yparam[4] & 0x0fff) | ((m_blitter_yparam[5] & 0x0fff) << 12)) << 12) >> 12;
- s32 const dydy = (s32)(((m_blitter_yparam[6] & 0x0fff) | ((m_blitter_yparam[7] & 0x0fff) << 12)) << 12) >> 12;
- u32 const pagemask = m_gfxrom.mask() >> 18;
+ int32_t const srcminx = m_blitter_xparam[0] << 12;
+ int32_t const srcmaxx = m_blitter_xparam[1] << 12;
+ int32_t const srcminy = m_blitter_yparam[0] << 12;
+ int32_t const srcmaxy = m_blitter_yparam[1] << 12;
+ int32_t const srcx = ((m_blitter_xparam[2] & 0x0fff) | ((m_blitter_xparam[3] & 0x0fff) << 12)) << 7;
+ int32_t const srcy = ((m_blitter_yparam[2] & 0x0fff) | ((m_blitter_yparam[3] & 0x0fff) << 12)) << 7;
+ int32_t const dxdx = (int32_t)(((m_blitter_xparam[4] & 0x0fff) | ((m_blitter_xparam[5] & 0x0fff) << 12)) << 12) >> 12;
+ int32_t const dxdy = (int32_t)(((m_blitter_xparam[6] & 0x0fff) | ((m_blitter_xparam[7] & 0x0fff) << 12)) << 12) >> 12;
+ int32_t const dydx = (int32_t)(((m_blitter_yparam[4] & 0x0fff) | ((m_blitter_yparam[5] & 0x0fff) << 12)) << 12) >> 12;
+ int32_t const dydy = (int32_t)(((m_blitter_yparam[6] & 0x0fff) | ((m_blitter_yparam[7] & 0x0fff) << 12)) << 12) >> 12;
+ uint32_t const pagemask = m_gfxrom.mask() >> 18;
int const xstart = m_blitter_xparam[14];
int const xend = m_blitter_xparam[15] + 1;
int const ystart = m_blitter_yparam[14];
int const yend = m_blitter_yparam[15];
- u32 const color = (m_blitter_color[0] << 8) & 0xff00;
- u8 const mask = (m_blitter_color[0] >> 8) & 0x00ff;
- bool const opaque = (dxdx | dxdy | dydx | dydy) == 0; /* bit of a hack for fredmem */
+ int const color = (m_blitter_color[0] << 8) & 0xff00;
+ int const mask = (m_blitter_color[0] >> 8) & 0x00ff;
+ int const opaque = (dxdx | dxdy | dydx | dydy) == 0; /* bit of a hack for fredmem */
/* loop over target rows */
for (int y = ystart; y <= yend; y++)
{
- u16 *dst = &m_dstbitmap->pix16(y & 0x1ff);
+ uint16_t *dst = &m_dstbitmap->pix16(y & 0x1ff);
/* loop over target columns */
for (int x = xstart; x <= xend; x++)
@@ -181,8 +188,8 @@ void dcheese_state::do_blit()
if (sx >= srcminx && sx <= srcmaxx && sy >= srcminy && sy <= srcmaxy)
{
/* page comes from bit 22 of Y and bit 21 of X */
- u32 const page = (((sy >> 21) & 2) | ((sx >> 21) & 1) | ((sx >> 20) & 4)) & pagemask;
- u8 const pix = m_gfxrom[(page << 18) | (((sy >> 12) & 0x1ff) << 9) | ((sx >> 12) & 0x1ff)];
+ int const page = (((sy >> 21) & 2) | ((sx >> 21) & 1) | ((sx >> 20) & 4)) & pagemask;
+ int const pix = m_gfxrom[(page << 18) | (((sy >> 12) & 0x1ff) << 9) | ((sx >> 12) & 0x1ff)];
/* only non-zero pixels get written */
if (pix | opaque)
@@ -293,9 +300,9 @@ READ16_MEMBER(dcheese_state::blitter_vidparam_r)
{
/* analog inputs seem to be hooked up here -- might not actually map to blitter */
if (offset == 0x02/2)
- return m_2a0002_io->read();
+ return ioport("2a0002")->read();
if (offset == 0x0e/2)
- return m_2a000e_io->read();
+ return ioport("2a000e")->read();
/* early code polls on this bit, wants it to be 0 */
if (offset == 0x36/2)