diff options
| author | 2025-07-11 14:09:37 +0200 | |
|---|---|---|
| committer | 2025-07-11 14:09:53 +0200 | |
| commit | e9557601830777bba7e2b79a03ac234c43203d72 (patch) | |
| tree | bd80885b1d7f7aaf9fd694e00b18b4e120b5ba94 | |
| parent | ee8ae3f991907b09f55976bdb46c3e9f549fae0a (diff) | |
xexex: hook up ccu, k053250: small cleanup
| -rw-r--r-- | src/mame/konami/k053250.cpp | 90 | ||||
| -rw-r--r-- | src/mame/konami/k053250.h | 10 | ||||
| -rw-r--r-- | src/mame/konami/k053250_ps.cpp | 104 | ||||
| -rw-r--r-- | src/mame/konami/k053250_ps.h | 10 | ||||
| -rw-r--r-- | src/mame/konami/xexex.cpp | 29 |
5 files changed, 118 insertions, 125 deletions
diff --git a/src/mame/konami/k053250.cpp b/src/mame/konami/k053250.cpp index 6022f059d68..a59617237d2 100644 --- a/src/mame/konami/k053250.cpp +++ b/src/mame/konami/k053250.cpp @@ -7,11 +7,11 @@ DEFINE_DEVICE_TYPE(K053250, k053250_device, "k053250", "K053250 LVC") -k053250_device::k053250_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, K053250, tag, owner, clock), - device_gfx_interface(mconfig, *this), - device_video_interface(mconfig, *this), - m_rom(*this, DEVICE_SELF) +k053250_device::k053250_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, K053250, tag, owner, clock), + device_gfx_interface(mconfig, *this), + device_video_interface(mconfig, *this), + m_rom(*this, DEVICE_SELF) { } @@ -49,20 +49,20 @@ void k053250_device::device_reset() // utility function to render a clipped scanline vertically or horizontally inline void k053250_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *pal_base, uint8_t *source, - const rectangle &cliprect, int linepos, int scroll, int zoom, - uint32_t clipmask, uint32_t wrapmask, uint32_t orientation, bitmap_ind8 &priority, uint8_t pri) + const rectangle &cliprect, int linepos, int scroll, int zoom, + uint32_t clipmask, uint32_t wrapmask, uint32_t orientation, bitmap_ind8 &priority, uint8_t 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)) + // a sixteen-bit fixed point resolution should be adequate to our application + constexpr uint32_t FIXPOINT_PRECISION = 16; + constexpr uint32_t FIXPOINT_PRECISION_HALF = 1 << (FIXPOINT_PRECISION-1); int end_pixel, flip, dst_min, dst_max, dst_start, dst_length; uint32_t src_wrapmask; - uint8_t *src_base; + uint8_t *src_base; int src_fx, src_fdx; int pix_data, dst_offset; - uint8_t *pri_base; + uint8_t *pri_base; uint32_t *dst_base; int dst_adv; @@ -204,12 +204,9 @@ inline void k053250_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t * } while (dst_offset += dst_adv); } - -#undef FIXPOINT_PRECISION -#undef FIXPOINT_PRECISION_HALF } -void k053250_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int colorbase, int flags, bitmap_ind8 &priority_bitmap, int priority ) +void k053250_device::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, int colorbase, int flags, bitmap_ind8 &priority_bitmap, int priority) { uint8_t *pix_ptr; const pen_t *pal_base, *pal_ptr; @@ -218,29 +215,32 @@ void k053250_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int int color, offset, zoom, scroll, passes, i; bool wrap500 = false; - uint16_t *line_ram = m_buffer[m_page]; // pointer to physical line RAM + uint16_t *line_ram = m_buffer[m_page]; // pointer to physical line RAM int map_scrollx = short(m_regs[0] << 8 | m_regs[1]) - m_offx; // signed horizontal scroll value int map_scrolly = short(m_regs[2] << 8 | m_regs[3]) - m_offy; // signed vertical scroll value - uint8_t ctrl = m_regs[4]; // register four is the main control register + uint8_t ctrl = m_regs[4]; // register four is the main control register // copy visible boundary values to more accessible locations - int dst_minx = cliprect.min_x; - int dst_maxx = cliprect.max_x; - int dst_miny = cliprect.min_y; - int dst_maxy = cliprect.max_y; + int dst_minx = cliprect.min_x; + int dst_maxx = cliprect.max_x; + 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 512 pixels + int orientation = 0; // orientation defaults to no swapping and no flipping + int dst_height = 512; // virtual bitmap height defaults to 512 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; + if (!(ctrl & 0x01)) + orientation |= ORIENTATION_SWAP_XY; // invert X parameters when the forth bit of the control register is set - if (ctrl & 0x08) orientation |= ORIENTATION_FLIP_X; + if (ctrl & 0x08) + orientation |= ORIENTATION_FLIP_X; // invert Y parameters when the fifth bit of the control register is set - if (ctrl & 0x10) orientation |= ORIENTATION_FLIP_Y; + if (ctrl & 0x10) + orientation |= ORIENTATION_FLIP_Y; switch (ctrl >> 5) // the upper four bits of the control register select source and target dimensions { @@ -278,24 +278,25 @@ void k053250_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int } // disable source clipping when the third bit of the control register is set - if (ctrl & 0x04) src_clipmask = 0; + 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 + 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 scenarios } 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 scenarios + linedata_offs += screen().visible_area().max_y; // and get info for the first line from the bottom } dst_wrapmask = ~0; // scanlines don't seem to wrap horizontally in normal orientation @@ -304,13 +305,13 @@ void k053250_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int 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 + 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 @@ -321,8 +322,8 @@ void k053250_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int 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 scenarios + linedata_offs += screen().visible_area().max_x; // and get info for the first line from the bottom } if (src_clipmask) @@ -347,14 +348,14 @@ void k053250_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int pal_base = palette().pens() + (colorbase << 4) % palette().entries(); // 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++) + 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 - color = line_ram[linedata_offs]; // get scanline color code + 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 + 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 0 // calculate physical palette location @@ -369,12 +370,13 @@ void k053250_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int // For example, 0x20 doubles the length, 0x40 maintains a one-to-one length, // and 0x80 halves the length. The zoom center is at the beginning of the // scanline therefore it is not necessary to adjust render start position - zoom = line_ram[linedata_offs + 2]; + 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; + if (wrap500 && scroll >= 0x500) + scroll -= 0x800; scroll += scroll_corr; // apply final scroll correction scroll &= dst_wrapmask; // wraparound scroll value if necessary @@ -402,7 +404,7 @@ void k053250_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority : value to be written to the priority bitmap, no effect when equals 0 */ pdraw_scanline32(bitmap, pal_ptr, pix_ptr, cliprect, - line_pos, scroll, zoom, src_clipmask, src_wrapmask, orientation, priority_bitmap, (uint8_t)priority); + line_pos, scroll, zoom, src_clipmask, src_wrapmask, orientation, priority_bitmap, (uint8_t)priority); // shift scanline position one virtual screen upward to render the wrapped end if necessary scroll -= dst_height; diff --git a/src/mame/konami/k053250.h b/src/mame/konami/k053250.h index 2940981980f..c68f8893234 100644 --- a/src/mame/konami/k053250.h +++ b/src/mame/konami/k053250.h @@ -10,9 +10,7 @@ // -class k053250_device : public device_t, - public device_gfx_interface, - public device_video_interface +class k053250_device : public device_t, public device_gfx_interface, public device_video_interface { public: template <typename T, typename U> @@ -37,7 +35,7 @@ public: void ram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); uint16_t rom_r(offs_t offset); - void draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int colorbase, int flags, bitmap_ind8 &priority_bitmap, int priority ); + void draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, int colorbase, int flags, bitmap_ind8 &priority_bitmap, int priority); protected: // device-level overrides @@ -61,8 +59,8 @@ private: void unpack_nibbles(); void dma(int limiter); static void pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *pal_base, uint8_t *source, - const rectangle &cliprect, int linepos, int scroll, int zoom, - uint32_t clipmask, uint32_t wrapmask, uint32_t orientation, bitmap_ind8 &priority, uint8_t pri); + const rectangle &cliprect, int linepos, int scroll, int zoom, + uint32_t clipmask, uint32_t wrapmask, uint32_t orientation, bitmap_ind8 &priority, uint8_t pri); }; DECLARE_DEVICE_TYPE(K053250, k053250_device) diff --git a/src/mame/konami/k053250_ps.cpp b/src/mame/konami/k053250_ps.cpp index a02c02b81c1..c7ef50f5344 100644 --- a/src/mame/konami/k053250_ps.cpp +++ b/src/mame/konami/k053250_ps.cpp @@ -4,6 +4,8 @@ #include "k053250_ps.h" #include "screen.h" +// TODO: Why do we have two of these?! This should be merged with k053250.cpp + /* Registers @@ -40,12 +42,12 @@ DEFINE_DEVICE_TYPE(K053250PS, k053250ps_device, "k053250ps", "K053250PS LVC") -k053250ps_device::k053250ps_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, K053250PS, tag, owner, clock), - device_gfx_interface(mconfig, *this), - device_video_interface(mconfig, *this), - m_dmairq_cb(*this), - m_rom(*this, DEVICE_SELF) +k053250ps_device::k053250ps_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, K053250PS, tag, owner, clock), + device_gfx_interface(mconfig, *this), + device_video_interface(mconfig, *this), + m_dmairq_cb(*this), + m_rom(*this, DEVICE_SELF) { } @@ -92,20 +94,20 @@ void k053250ps_device::device_reset() // utility function to render a clipped scanline vertically or horizontally inline void k053250ps_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *pal_base, uint8_t *source, - const rectangle &cliprect, int linepos, int scroll, int zoom, - uint32_t clipmask, uint32_t wrapmask, uint32_t orientation, bitmap_ind8 &priority, uint8_t pri) + const rectangle &cliprect, int linepos, int scroll, int zoom, + uint32_t clipmask, uint32_t wrapmask, uint32_t orientation, bitmap_ind8 &priority, uint8_t 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)) + // a sixteen-bit fixed point resolution should be adequate to our application + constexpr uint32_t FIXPOINT_PRECISION = 16; + constexpr uint32_t FIXPOINT_PRECISION_HALF = 1 << (FIXPOINT_PRECISION-1); int end_pixel, flip, dst_min, dst_max, dst_start, dst_length; uint32_t src_wrapmask; - uint8_t *src_base; + uint8_t *src_base; int src_fx, src_fdx; int pix_data, dst_offset; - uint8_t *pri_base; + uint8_t *pri_base; uint32_t *dst_base; int dst_adv; @@ -247,13 +249,11 @@ inline void k053250ps_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t } while (dst_offset += dst_adv); } - -#undef FIXPOINT_PRECISION -#undef FIXPOINT_PRECISION_HALF } -void k053250ps_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int colorbase, int flags, bitmap_ind8 &priority_bitmap, int priority ) +void k053250ps_device::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, int colorbase, int flags, bitmap_ind8 &priority_bitmap, int priority) { +#if 0 static int16_t scroll_x; if (machine().input().code_pressed(KEYCODE_A)) @@ -267,37 +267,41 @@ void k053250ps_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, in scroll_x++; popmessage("SCROLL: %d\n", scroll_x); } +#endif uint8_t *pix_ptr; const pen_t *pal_base, *pal_ptr; uint32_t src_clipmask, src_wrapmask; //, dst_wrapmask; int linedata_offs, line_pos, line_start, line_end, scroll_corr; int color, offset, zoom, scroll, passes, i; - bool wrap500 = false; +// bool wrap500 = false; - uint16_t *line_ram = m_buffer[0]; // pointer to physical line RAM + uint16_t *line_ram = m_buffer[0]; // pointer to physical line RAM int map_scrollx = short(m_regs[0] << 8 | m_regs[1]) - m_offx; // signed horizontal scroll value int map_scrolly = short(m_regs[2] << 8 | m_regs[3]) - m_offy; // signed vertical scroll value - uint8_t ctrl = m_regs[4]; // register four is the main control register + uint8_t ctrl = m_regs[4]; // register four is the main control register // copy visible boundary values to more accessible locations - int dst_minx = cliprect.min_x; - int dst_maxx = cliprect.max_x; - int dst_miny = cliprect.min_y; - int dst_maxy = cliprect.max_y; + int dst_minx = cliprect.min_x; + int dst_maxx = cliprect.max_x; + 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 512 pixels + int orientation = 0; // orientation defaults to no swapping and no flipping + int dst_height = 512; // virtual bitmap height defaults to 512 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; + if (!(ctrl & 0x01)) + orientation |= ORIENTATION_SWAP_XY; // invert X parameters when the forth bit of the control register is set - if (ctrl & 0x08) orientation |= ORIENTATION_FLIP_X; + if (ctrl & 0x08) + orientation |= ORIENTATION_FLIP_X; // invert Y parameters when the fifth bit of the control register is set - if (ctrl & 0x10) orientation |= ORIENTATION_FLIP_Y; + if (ctrl & 0x10) + orientation |= ORIENTATION_FLIP_Y; //printf("CTRL: %x\n", ctrl); @@ -330,7 +334,7 @@ void k053250ps_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, in // crop source offset between 0 and 255 inclusive, // and allow source offset to wrap back at 0x500 to -0x300 src_wrapmask = src_clipmask = 0xff; - wrap500 = true; +// wrap500 = true; break; // case 2 : // Xexex: title // case 7 : // Xexex: L4 organic stage @@ -345,22 +349,22 @@ void k053250ps_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, in 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 + 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 scenarios } 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 scenarios + linedata_offs += screen().visible_area().max_y; // and get info for the first line from the bottom } // dst_wrapmask = ~0; // scanlines don't seem to wrap horizontally in normal orientation @@ -369,13 +373,13 @@ void k053250ps_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, in 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 + 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 @@ -386,8 +390,8 @@ void k053250ps_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, in 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 scenarios + linedata_offs += screen().visible_area().max_x; // and get info for the first line from the bottom } if (src_clipmask) @@ -416,16 +420,15 @@ void k053250ps_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, in //printf("Line Start: %u Line End: %u Advance: %u\n", line_start, line_end, linedata_adv); - // 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++) + 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 - color = line_ram[linedata_offs]; // get scanline color code + 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 + 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 0 // calculate physical palette location @@ -440,25 +443,22 @@ void k053250ps_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, in // For example, 0x20 doubles the length, 0x40 maintains a one-to-one length, // and 0x80 halves the length. The zoom center is at the beginning of the // scanline therefore it is not necessary to adjust render start position - zoom = line_ram[linedata_offs + 2]; + 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; - - if (1 && scroll >= 0x500) scroll -= 0x800; + if (1 && scroll >= 0x500) + scroll -= 0x800; scroll += scroll_corr; // apply final scroll correction - // PJB - //scroll &= src_wrapmask; // wraparound scroll value if necessary +// scroll &= dst_wrapmask; // wraparound scroll value if necessary if (0) { printf("%u: [%x] COLR:%x OFFS:%x ZOOM:%x SCRL:%d (%.4x)\n", line_pos, linedata_offs, color, offset, zoom, scroll, line_ram[linedata_offs + 3]); } - // 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 i = passes; @@ -482,7 +482,7 @@ void k053250ps_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, in priority : value to be written to the priority bitmap, no effect when equals 0 */ pdraw_scanline32(bitmap, pal_ptr, pix_ptr, cliprect, - line_pos, scroll, zoom, src_clipmask, src_wrapmask, orientation, priority_bitmap, (uint8_t)priority); + line_pos, scroll, zoom, src_clipmask, src_wrapmask, orientation, priority_bitmap, (uint8_t)priority); // shift scanline position one virtual screen upward to render the wrapped end if necessary scroll -= dst_height; diff --git a/src/mame/konami/k053250_ps.h b/src/mame/konami/k053250_ps.h index a8bd5b56a30..42604b1cf51 100644 --- a/src/mame/konami/k053250_ps.h +++ b/src/mame/konami/k053250_ps.h @@ -10,9 +10,7 @@ // -class k053250ps_device : public device_t, - public device_gfx_interface, - public device_video_interface +class k053250ps_device : public device_t, public device_gfx_interface, public device_video_interface { public: template <typename T, typename U> @@ -41,7 +39,7 @@ public: void vblank_w(int state); int dmairq_r(); - void draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int colorbase, int flags, bitmap_ind8 &priority_bitmap, int priority ); + void draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, int colorbase, int flags, bitmap_ind8 &priority_bitmap, int priority); protected: // device-level overrides @@ -78,8 +76,8 @@ private: // internal helpers void unpack_nibbles(); static void pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t *pal_base, uint8_t *source, - const rectangle &cliprect, int linepos, int scroll, int zoom, - uint32_t clipmask, uint32_t wrapmask, uint32_t orientation, bitmap_ind8 &priority, uint8_t pri); + const rectangle &cliprect, int linepos, int scroll, int zoom, + uint32_t clipmask, uint32_t wrapmask, uint32_t orientation, bitmap_ind8 &priority, uint8_t pri); }; DECLARE_DEVICE_TYPE(K053250PS, k053250ps_device) diff --git a/src/mame/konami/xexex.cpp b/src/mame/konami/xexex.cpp index 05201df02c9..406a1c72bad 100644 --- a/src/mame/konami/xexex.cpp +++ b/src/mame/konami/xexex.cpp @@ -154,6 +154,7 @@ reference(xexexj) : https://www.youtube.com/watch?v=TegjBEvvGxI #include "sound/flt_vol.h" #include "sound/k054539.h" #include "sound/ymopm.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" @@ -417,7 +418,6 @@ void xexex_state::xexex_objdma(int limiter) return; // make sure we only do DMA transfer once per frame m_k053246->k053247_get_ram(&dst); - counter = m_k053246->k053247_get_dy(); src = m_spriteram; num_inactive = counter = 256; @@ -542,8 +542,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(xexex_state::xexex_interrupt) m_maincpu->set_input_line(6, HOLD_LINE); } - /* TODO: vblank is at 256! (enable CCU then have fun in fixing offsetted layers) */ - if (scanline == 128) + if (scanline == 256) { if (m_k053246->k053246_is_irq_enabled()) { @@ -580,7 +579,7 @@ void xexex_state::main_map(address_map &map) map(0x0c8000, 0x0c800f).rw(m_k053250, FUNC(k053250_device::reg_r), FUNC(k053250_device::reg_w)); map(0x0ca000, 0x0ca01f).w(m_k054338, FUNC(k054338_device::word_w)); // CLTC map(0x0cc000, 0x0cc01f).w(m_k053251, FUNC(k053251_device::write)).umask16(0x00ff); // priority encoder -// map(0x0d0000, 0x0d001f).rw(m_k053252, FUNC(k053252_device::read), FUNC(k053252_device::write)).umask16(0x00ff); // CCU + map(0x0d0000, 0x0d001f).rw(m_k053252, FUNC(k053252_device::read), FUNC(k053252_device::write)).umask16(0x00ff); // CCU map(0x0d4000, 0x0d4001).w(FUNC(xexex_state::sound_irq_w)); map(0x0d6000, 0x0d601f).m(m_k054321, FUNC(k054321_device::main_map)).umask16(0x00ff); map(0x0d8000, 0x0d8007).w(m_k056832, FUNC(k056832_device::b_word_w)); // VSCCS regs @@ -688,26 +687,22 @@ void xexex_state::machine_reset() void xexex_state::xexex(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, XTAL(32'000'000)/2); // 16MHz + // basic machine hardware + M68000(config, m_maincpu, 32_MHz_XTAL / 2); // 16MHz m_maincpu->set_addrmap(AS_PROGRAM, &xexex_state::main_map); TIMER(config, "scantimer").configure_scanline(FUNC(xexex_state::xexex_interrupt), "screen", 0, 1); - Z80(config, m_audiocpu, XTAL(32'000'000)/4); // Z80E 8Mhz + Z80(config, m_audiocpu, 32_MHz_XTAL / 4); // Z80E 8Mhz m_audiocpu->set_addrmap(AS_PROGRAM, &xexex_state::sound_map); config.set_maximum_quantum(attotime::from_hz(1920)); EEPROM_ER5911_8BIT(config, "eeprom"); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); -// m_screen->set_refresh_hz(XTAL(32'000'000)/4/512/288); - m_screen->set_raw(XTAL(32'000'000)/4, 384+33+40+55, 0, 383, 256+12+6+14, 0, 255); // 8Mhz horizontal dotclock - m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); - m_screen->set_size(64*8, 32*8); - m_screen->set_visarea(40, 40+384-1, 0, 0+256-1); + m_screen->set_raw(32_MHz_XTAL / 4, 512, 0+40, 384+40, 289, 0, 256); // from CCU m_screen->set_screen_update(FUNC(xexex_state::screen_update_xexex)); PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 2048); @@ -728,22 +723,22 @@ void xexex_state::xexex(machine_config &config) K053251(config, m_k053251, 0); - K053252(config, m_k053252, XTAL(32'000'000)/4); + K053252(config, m_k053252, 32_MHz_XTAL / 4).set_offsets(40, 0); K054338(config, m_k054338, 0); - /* sound hardware */ + // sound hardware SPEAKER(config, "speaker", 2).front(); K054321(config, m_k054321, "speaker"); - ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(32'000'000)/8)); // 4MHz + ym2151_device &ymsnd(YM2151(config, "ymsnd", 32_MHz_XTAL / 8)); // 4MHz ymsnd.add_route(0, "filter1_l", 0.2); ymsnd.add_route(0, "filter1_r", 0.2); ymsnd.add_route(1, "filter2_l", 0.2); ymsnd.add_route(1, "filter2_r", 0.2); - K054539(config, m_k054539, XTAL(18'432'000)); + K054539(config, m_k054539, 18.432_MHz_XTAL); m_k054539->set_analog_callback(FUNC(xexex_state::ym_set_mixing)); m_k054539->add_route(0, "speaker", 0.4, 0); m_k054539->add_route(0, "speaker", 0.4, 1); |
