diff options
Diffstat (limited to 'src/devices/video/jangou_blitter.cpp')
-rw-r--r-- | src/devices/video/jangou_blitter.cpp | 170 |
1 files changed, 100 insertions, 70 deletions
diff --git a/src/devices/video/jangou_blitter.cpp b/src/devices/video/jangou_blitter.cpp index b5e75a44eff..9f6cc6ddca3 100644 --- a/src/devices/video/jangou_blitter.cpp +++ b/src/devices/video/jangou_blitter.cpp @@ -40,6 +40,27 @@ jangou_blitter_device::jangou_blitter_device(const machine_config &mconfig, cons } +DEVICE_ADDRESS_MAP_START( blit_v1_regs, 8, jangou_blitter_device ) + AM_RANGE(0x00, 0x00) AM_WRITE(src_lo_address_w) + AM_RANGE(0x01, 0x01) AM_WRITE(src_md_address_w) + AM_RANGE(0x02, 0x02) AM_WRITE(x_w) + AM_RANGE(0x03, 0x03) AM_WRITE(y_w) + AM_RANGE(0x04, 0x04) AM_WRITE(width_w) + AM_RANGE(0x05, 0x05) AM_WRITE(height_and_trigger_w) + AM_RANGE(0x06, 0x06) AM_WRITE(src_hi_address_w) +ADDRESS_MAP_END + +// Sexy Gal and variants (v2) swaps around upper src address +DEVICE_ADDRESS_MAP_START( blit_v2_regs, 8, jangou_blitter_device ) + AM_RANGE(0x00, 0x00) AM_WRITE(src_lo_address_w) + AM_RANGE(0x01, 0x01) AM_WRITE(src_md_address_w) + AM_RANGE(0x02, 0x02) AM_WRITE(src_hi_address_w) + AM_RANGE(0x03, 0x03) AM_WRITE(x_w) + AM_RANGE(0x04, 0x04) AM_WRITE(y_w) + AM_RANGE(0x05, 0x05) AM_WRITE(width_w) + AM_RANGE(0x06, 0x06) AM_WRITE(height_and_trigger_w) +ADDRESS_MAP_END + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -53,7 +74,11 @@ void jangou_blitter_device::device_start() m_gfxrommask = devregion->bytes()-1; save_item(NAME(m_pen_data)); - save_item(NAME(m_blit_data)); + save_item(NAME(m_x)); + save_item(NAME(m_y)); + save_item(NAME(m_width)); + save_item(NAME(m_height)); + save_item(NAME(m_src_addr)); save_item(NAME(m_blit_buffer)); } @@ -64,7 +89,6 @@ void jangou_blitter_device::device_start() void jangou_blitter_device::device_reset() { - memset(m_blit_data, 0, ARRAY_LENGTH(m_blit_data)); memset(m_pen_data, 0, ARRAY_LENGTH(m_pen_data)); m_bltflip = false; } @@ -96,83 +120,59 @@ void jangou_blitter_device::plot_gfx_pixel( uint8_t pix, int x, int y ) m_blit_buffer[(y * 256) + (x >> 1)] = (m_blit_buffer[(y * 256) + (x >> 1)] & 0xf0) | (pix & 0x0f); } -WRITE8_MEMBER( jangou_blitter_device::process_w ) +void jangou_blitter_device::trigger_write(void) { int src, x, y, h, w, flipx; - m_blit_data[offset] = data; + int count = 0; + int xcount, ycount; + + w = (m_width & 0xff) + 1; + h = (m_height & 0xff) + 1; + src = m_src_addr & m_gfxrommask; + if(m_src_addr & ~m_gfxrommask) + logerror("%s: Warning blit src address = %08x above ROM mask %08x\n",this->tag(),m_src_addr,m_gfxrommask); + x = (m_x & 0xff); + y = (m_y & 0xff); + + // lowest bit of src controls flipping / draw direction? + flipx = (m_src_addr & 1); + + if (!flipx) + src += (w * h) - 1; + else + src -= (w * h) - 1; - if (offset == 5) + for (ycount = 0; ycount < h; ycount++) { - int count = 0; - int xcount, ycount; - - w = (m_blit_data[4] & 0xff) + 1; - h = (m_blit_data[5] & 0xff) + 1; - src = ((m_blit_data[1] << 8)|(m_blit_data[0] << 0)); - src |= (m_blit_data[6] & 3) << 16; - x = (m_blit_data[2] & 0xff); - y = (m_blit_data[3] & 0xff); - - #if 0 - if(m_bltflip == true) - { - printf("%02x %02x %02x %02x %02x %02x %02x\n", m_blit_data[0], m_blit_data[1], m_blit_data[2],m_blit_data[3], m_blit_data[4], m_blit_data[5],m_blit_data[6]); - printf("=>"); - for(int i=0;i<0x10;i++) - printf("%02x ",m_pen_data[i]); - printf("\n"); - } - #endif - // lowest bit of src controls flipping / draw direction? - flipx = (m_blit_data[0] & 1); - - if (!flipx) - src += (w * h) - 1; - else - src -= (w * h) - 1; - - - for (ycount = 0; ycount < h; ycount++) + for(xcount = 0; xcount < w; xcount++) { - for(xcount = 0; xcount < w; xcount++) - { - int drawx = (x + xcount) & 0xff; - int drawy = (y + ycount) & 0xff; - uint8_t dat = gfx_nibble(src + count); - uint8_t cur_pen = m_pen_data[dat & 0x0f]; - - //dat = cur_pen_lo | (cur_pen_hi << 4); - - if ((cur_pen & 0xff) != 0) - plot_gfx_pixel(cur_pen, drawx, drawy); - - if (!flipx) - count--; - else - count++; - } + int drawx = (x + xcount) & 0xff; + int drawy = (y + ycount) & 0xff; + uint8_t dat = gfx_nibble(src + count); + uint8_t cur_pen = m_pen_data[dat & 0x0f]; + //dat = cur_pen_lo | (cur_pen_hi << 4); + + if ((cur_pen & 0xff) != 0) + plot_gfx_pixel(cur_pen, drawx, drawy); + + if (!flipx) + count--; + else + count++; } - - //uint32_t new_src = src + count; - - // update source and height after blitter operation - // TODO: Jangou doesn't agree with this, later HW? - #if 0 - m_blit_data[0] = new_src & 0xfe; - m_blit_data[1] = new_src >> 8; - m_blit_data[5] = 0; - m_blit_data[6] = new_src >> 16; - #endif - m_bltflip = false; } -} -// Sexy Gal swaps around upper src address -WRITE8_MEMBER( jangou_blitter_device::alt_process_w ) -{ - const uint8_t translate_addr[7] = { 0, 1, 6, 2, 3, 4, 5 }; + //uint32_t new_src = src + count; - process_w(space,translate_addr[offset],data); + // update source and height after blitter operation + // TODO: Jangou doesn't agree with this, later HW? + #if 0 + m_blit_data[0] = new_src & 0xfe; + m_blit_data[1] = new_src >> 8; + m_blit_data[5] = 0; + m_blit_data[6] = new_src >> 16; + #endif + m_bltflip = false; } WRITE8_MEMBER( jangou_blitter_device::vregs_w ) @@ -192,3 +192,33 @@ READ_LINE_MEMBER( jangou_blitter_device::status_r ) { return false; } + +// data accessors + +WRITE8_MEMBER( jangou_blitter_device::x_w ) { m_x = data; } +WRITE8_MEMBER( jangou_blitter_device::y_w ) { m_y = data; } +WRITE8_MEMBER( jangou_blitter_device::src_lo_address_w ) +{ + m_src_addr &= ~0xff; + m_src_addr |= data & 0xff; +} +WRITE8_MEMBER( jangou_blitter_device::src_md_address_w ) +{ + m_src_addr &= ~0xff00; + m_src_addr |= data << 8; +} +WRITE8_MEMBER( jangou_blitter_device::src_hi_address_w ) +{ + m_src_addr &= ~0xff0000; + m_src_addr |= data << 16; +} +WRITE8_MEMBER( jangou_blitter_device::width_w ) +{ + m_width = data; +} +WRITE8_MEMBER( jangou_blitter_device::height_and_trigger_w ) +{ + m_height = data; + trigger_write(); +} + |