diff options
Diffstat (limited to 'src/emu/video/k053250.c')
-rw-r--r-- | src/emu/video/k053250.c | 117 |
1 files changed, 58 insertions, 59 deletions
diff --git a/src/emu/video/k053250.c b/src/emu/video/k053250.c index b5f86814ace..fe7eefb9f3b 100644 --- a/src/emu/video/k053250.c +++ b/src/emu/video/k053250.c @@ -59,12 +59,12 @@ void k053250_t::device_reset() // utility function to render a clipped scanline vertically or horizontally inline void k053250_t::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *palette, UINT8 *source, - const rectangle &cliprect, int linepos, int scroll, int zoom, - UINT32 clipmask, UINT32 wrapmask, UINT32 orientation, bitmap_ind8 &priority, UINT8 pri) + const rectangle &cliprect, int linepos, int scroll, int zoom, + UINT32 clipmask, UINT32 wrapmask, UINT32 orientation, bitmap_ind8 &priority, UINT8 pri) { // a sixteen-bit fixed point resolution should be adequate to our application -#define FIXPOINT_PRECISION 16 -#define FIXPOINT_PRECISION_HALF (1<<(FIXPOINT_PRECISION-1)) +#define FIXPOINT_PRECISION 16 +#define FIXPOINT_PRECISION_HALF (1<<(FIXPOINT_PRECISION-1)) int end_pixel, flip, dst_min, dst_max, dst_start, dst_length; @@ -144,7 +144,7 @@ inline void k053250_t::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *palet { // draw wrapped scanline at virtual bitmap boundary when source clipping is off dst_start = dst_min; - dst_length = dst_max - dst_min + 1; // target scanline spans the entire visible area + dst_length = dst_max - dst_min + 1; // target scanline spans the entire visible area src_fdx = zoom << (FIXPOINT_PRECISION-6); // pre-advance source for the clipped region @@ -230,10 +230,10 @@ void k053250_t::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int color int color, offset, zoom, scroll, passes, i; bool wrap500 = false; - UINT16 *line_ram = buffer[page]; // pointer to physical line RAM - int map_scrollx = short(regs[0] << 8 | regs[1]) - offx; // signed horizontal scroll value - int map_scrolly = short(regs[2] << 8 | regs[3]) - offy; // signed vertical scroll value - UINT8 ctrl = regs[4]; // register four is the main control register + UINT16 *line_ram = buffer[page]; // pointer to physical line RAM + int map_scrollx = short(regs[0] << 8 | regs[1]) - offx; // signed horizontal scroll value + int map_scrolly = short(regs[2] << 8 | regs[3]) - offy; // signed vertical scroll value + UINT8 ctrl = regs[4]; // register four is the main control register // copy visible boundary values to more accessible locations int dst_minx = cliprect.min_x; @@ -241,9 +241,9 @@ void k053250_t::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int color int dst_miny = cliprect.min_y; int dst_maxy = cliprect.max_y; - int orientation = 0; // orientation defaults to no swapping and no flipping - int dst_height = 512; // virtual bitmap height defaults to five hundred and twelve pixels - int linedata_adv = 4; // line info packets are four words(eight bytes) apart + int orientation = 0; // orientation defaults to no swapping and no flipping + int dst_height = 512; // virtual bitmap height defaults to five hundred and twelve pixels + int linedata_adv = 4; // line info packets are four words(eight bytes) apart // switch X and Y parameters when the first bit of the control register is cleared if (!(ctrl & 0x01)) orientation |= ORIENTATION_SWAP_XY; @@ -292,49 +292,49 @@ void k053250_t::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int color // disable source clipping when the third bit of the control register is set if (ctrl & 0x04) src_clipmask = 0; - if (!(orientation & ORIENTATION_SWAP_XY)) // normal orientaion with no X Y switching + if (!(orientation & ORIENTATION_SWAP_XY)) // normal orientaion with no X Y switching { - line_start = dst_miny; // the first scanline starts at the minimum Y clip location - line_end = dst_maxy; // the last scanline ends at the maximum Y clip location - scroll_corr = map_scrollx; // concentrate global X scroll - linedata_offs = map_scrolly; // determine where to get info for the first line + line_start = dst_miny; // the first scanline starts at the minimum Y clip location + line_end = dst_maxy; // the last scanline ends at the maximum Y clip location + scroll_corr = map_scrollx; // concentrate global X scroll + linedata_offs = map_scrolly; // determine where to get info for the first line if (orientation & ORIENTATION_FLIP_X) { - scroll_corr = -scroll_corr; // X scroll adjustment should be negated in X flipped scenarioes + scroll_corr = -scroll_corr; // X scroll adjustment should be negated in X flipped scenarioes } if (orientation & ORIENTATION_FLIP_Y) { - linedata_adv = -linedata_adv; // traverse line RAM backward in Y flipped scenarioes - linedata_offs += bitmap.height() - 1; // and get info for the first line from the bottom + linedata_adv = -linedata_adv; // traverse line RAM backward in Y flipped scenarioes + linedata_offs += bitmap.height() - 1; // and get info for the first line from the bottom } - dst_wrapmask = ~0; // scanlines don't seem to wrap horizontally in normal orientation - passes = 1; // draw scanline in a single pass + dst_wrapmask = ~0; // scanlines don't seem to wrap horizontally in normal orientation + passes = 1; // draw scanline in a single pass } else // orientaion with X and Y parameters switched { - line_start = dst_minx; // the first scanline starts at the minimum X clip location - line_end = dst_maxx; // the last scanline ends at the maximum X clip location - scroll_corr = map_scrolly; // concentrate global Y scroll - linedata_offs = map_scrollx; // determine where to get info for the first line + line_start = dst_minx; // the first scanline starts at the minimum X clip location + line_end = dst_maxx; // the last scanline ends at the maximum X clip location + scroll_corr = map_scrolly; // concentrate global Y scroll + linedata_offs = map_scrollx; // determine where to get info for the first line if (orientation & ORIENTATION_FLIP_Y) { - scroll_corr = 0x100 - scroll_corr; // apply common vertical correction + scroll_corr = 0x100 - scroll_corr; // apply common vertical correction // Y correction (ref: 1st and 5th boss) - scroll_corr -= 2; // apply unique vertical correction + scroll_corr -= 2; // apply unique vertical correction // X correction (ref: 1st boss, seems to undo non-rotated global X offset) - linedata_offs -= 5; // apply unique horizontal correction + linedata_offs -= 5; // apply unique horizontal correction } if (orientation & ORIENTATION_FLIP_X) { - linedata_adv = -linedata_adv; // traverse line RAM backward in X flipped scenarioes - linedata_offs += bitmap.width() - 1; // and get info for the first line from the bottom + linedata_adv = -linedata_adv; // traverse line RAM backward in X flipped scenarioes + linedata_offs += bitmap.width() - 1; // and get info for the first line from the bottom } if (src_clipmask) @@ -351,9 +351,9 @@ void k053250_t::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int color } } - linedata_offs *= 4; // each line info packet has four words(eight bytes) - linedata_offs &= 0x7ff; // and it should wrap at the four-kilobyte boundary - linedata_offs += line_start * linedata_adv; // pre-advance line info offset for the clipped region + linedata_offs *= 4; // each line info packet has four words(eight bytes) + linedata_offs &= 0x7ff; // and it should wrap at the four-kilobyte boundary + linedata_offs += line_start * linedata_adv; // pre-advance line info offset for the clipped region // load physical palette base pal_base = machine().pens + (colorbase << 4) % machine().total_colors(); @@ -361,13 +361,13 @@ void k053250_t::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int color // walk the target bitmap within the visible area vertically or horizontally, one line at a time for (line_pos=line_start; line_pos <= line_end; linedata_offs += linedata_adv, line_pos++) { - linedata_offs &= 0x7ff; // line info data wraps at the four-kilobyte boundary + linedata_offs &= 0x7ff; // line info data wraps at the four-kilobyte boundary - color = line_ram[linedata_offs]; // get scanline color code - if (color == 0xffff) continue; // reject scanline if color code equals minus one + color = line_ram[linedata_offs]; // get scanline color code + if (color == 0xffff) continue; // reject scanline if color code equals minus one - offset = line_ram[linedata_offs + 1]; // get first pixel offset in ROM - if (!(color & 0xff) && !offset) continue; // reject scanline if both color and pixel offset are zero + offset = line_ram[linedata_offs + 1]; // get first pixel offset in ROM + if (!(color & 0xff) && !offset) continue; // reject scanline if both color and pixel offset are zero // calculate physical palette location // there can be thirty-two color codes and each code represents sixteen pens @@ -383,13 +383,13 @@ void k053250_t::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int color // scanline therefore it is not necessary to adjust render start position zoom = line_ram[linedata_offs + 2]; - scroll = (short)line_ram[linedata_offs + 3]; // get signed local scroll value for the current scanline + scroll = (short)line_ram[linedata_offs + 3]; // get signed local scroll value for the current scanline // scavenged from old code; improves Xexex' first level sky if (wrap500 && scroll >= 0x500) scroll -= 0x800; - scroll += scroll_corr; // apply final scroll correction - scroll &= dst_wrapmask; // wraparound scroll value if necessary + scroll += scroll_corr; // apply final scroll correction + scroll &= dst_wrapmask; // wraparound scroll value if necessary // draw scanlines wrapped at virtual bitmap boundary in two passes // this should not impose too much overhead due to clipping performed by the render code @@ -397,22 +397,22 @@ void k053250_t::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int color do { /* - Parameter descriptions: - - bitmap : pointer to a MAME bitmap as the render target - pal_ptr : pointer to the palette's physical location relative to the scanline - pix_ptr : pointer to the physical start location of source pixels in ROM - cliprect : pointer to a rectangle structue which describes the visible area of the target bitmap - line_pos : scanline render position relative to the target bitmap - should be a Y offset to the target bitmap in normal orientaion, - or an X offset to the target bitmap if X,Y are swapped - scroll : source scroll value of the scanline - zoom : source zoom factor of the scanline - src_clipmask : source offset clip mask; source pixels with offsets beyond the scope of this mask will not be drawn - src_wrapmask : source offset wrap mask; wraps source offset around, no effect when src_clipmask is set - orientation : flags indicating whether scanlines should be drawn horizontally, vertically, forward or backward - priority : value to be written to the priority bitmap, no effect when equals zero - */ + Parameter descriptions: + + bitmap : pointer to a MAME bitmap as the render target + pal_ptr : pointer to the palette's physical location relative to the scanline + pix_ptr : pointer to the physical start location of source pixels in ROM + cliprect : pointer to a rectangle structue which describes the visible area of the target bitmap + line_pos : scanline render position relative to the target bitmap + should be a Y offset to the target bitmap in normal orientaion, + or an X offset to the target bitmap if X,Y are swapped + scroll : source scroll value of the scanline + zoom : source zoom factor of the scanline + src_clipmask : source offset clip mask; source pixels with offsets beyond the scope of this mask will not be drawn + src_wrapmask : source offset wrap mask; wraps source offset around, no effect when src_clipmask is set + orientation : flags indicating whether scanlines should be drawn horizontally, vertically, forward or backward + priority : value to be written to the priority bitmap, no effect when equals zero + */ pdraw_scanline32(bitmap, pal_ptr, pix_ptr, cliprect, line_pos, scroll, zoom, src_clipmask, src_wrapmask, orientation, machine().priority_bitmap, (UINT8)priority); @@ -466,4 +466,3 @@ READ16_MEMBER(k053250_t::rom_r) { return m_region->base()[0x80000 * regs[6] + 0x800 * regs[7] + offset/2]; } - |