mirror of
https://github.com/holub/mame
synced 2025-04-25 17:56:43 +03:00
konicdev et al.: Turn the 053250 into a modern device. [O. Galibert]
This commit is contained in:
parent
f424a6b6f1
commit
035f516ddb
@ -260,7 +260,8 @@ EMUVIDEOOBJS = \
|
||||
$(EMUVIDEO)/hd44102.o \
|
||||
$(EMUVIDEO)/hd61830.o \
|
||||
$(EMUVIDEO)/hd63484.o \
|
||||
$(EMUVIDEO)/i8275.o \
|
||||
$(EMUVIDEO)/i8275.o \
|
||||
$(EMUVIDEO)/k053250.o \
|
||||
$(EMUVIDEO)/mc6845.o \
|
||||
$(EMUVIDEO)/msm6255.o \
|
||||
$(EMUVIDEO)/pc_vga.o \
|
||||
|
@ -0,0 +1,469 @@
|
||||
#include "k053250.h"
|
||||
|
||||
const device_type K053250 = &device_creator<k053250_t>;
|
||||
|
||||
k053250_t::k053250_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, K053250, "K053250", tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
void k053250_t::static_set_screen_tag(device_t &device, const char *screen_tag)
|
||||
{
|
||||
k053250_t &dev = downcast<k053250_t &>(device);
|
||||
dev.screen_tag = screen_tag;
|
||||
}
|
||||
|
||||
void k053250_t::static_set_offsets(device_t &device, int offx, int offy)
|
||||
{
|
||||
k053250_t &dev = downcast<k053250_t &>(device);
|
||||
dev.offx = offx;
|
||||
dev.offy = offy;
|
||||
}
|
||||
|
||||
void k053250_t::unpack_nibbles()
|
||||
{
|
||||
if(!m_region)
|
||||
throw emu_fatalerror("k053250 %s: no associated region found\n", tag());
|
||||
|
||||
const UINT8 *base = m_region->base();
|
||||
int size = m_region->bytes();
|
||||
unpacked = auto_alloc_array(machine(), UINT8, size*2);
|
||||
for(int i=0; i<size; i++) {
|
||||
unpacked[2*i] = base[i] >> 4;
|
||||
unpacked[2*i+1] = base[i] & 15;
|
||||
}
|
||||
unpacked_size = 2*size;
|
||||
}
|
||||
|
||||
void k053250_t::device_start()
|
||||
{
|
||||
screen = machine().device<screen_device>(screen_tag);
|
||||
ram = auto_alloc_array_clear(machine(), UINT16, 0x6000/2);
|
||||
buffer[0] = ram + 0x2000;
|
||||
buffer[1] = ram + 0x2800;
|
||||
|
||||
unpack_nibbles();
|
||||
|
||||
save_pointer(NAME(ram), 0x6000/2);
|
||||
save_item(NAME(regs));
|
||||
save_item(NAME(page));
|
||||
save_item(NAME(frame));
|
||||
}
|
||||
|
||||
void k053250_t::device_reset()
|
||||
{
|
||||
page = 0;
|
||||
frame = -1;
|
||||
memset(regs, 0, sizeof(regs));
|
||||
}
|
||||
|
||||
// utility function to render a clipped scanline vertically or horizontally
|
||||
inline void k053250_t::pdraw_scanline32(bitmap_t *bitmap, const pen_t *palette, UINT8 *source,
|
||||
const rectangle *cliprect, int linepos, int scroll, int zoom,
|
||||
UINT32 clipmask, UINT32 wrapmask, UINT32 orientation, bitmap_t *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))
|
||||
|
||||
int end_pixel, flip, dst_min, dst_max, dst_start, dst_length;
|
||||
|
||||
UINT32 src_wrapmask;
|
||||
UINT8 *src_base;
|
||||
int src_fx, src_fdx;
|
||||
int pix_data, dst_offset;
|
||||
const pen_t *pal_base;
|
||||
UINT8 *pri_base;
|
||||
UINT32 *dst_base;
|
||||
int dst_adv;
|
||||
|
||||
// flip X and flip Y also switch role when the X Y coordinates are swapped
|
||||
if (!(orientation & ORIENTATION_SWAP_XY))
|
||||
{
|
||||
flip = orientation & ORIENTATION_FLIP_X;
|
||||
dst_min = cliprect->min_x;
|
||||
dst_max = cliprect->max_x;
|
||||
}
|
||||
else
|
||||
{
|
||||
flip = orientation & ORIENTATION_FLIP_Y;
|
||||
dst_min = cliprect->min_y;
|
||||
dst_max = cliprect->max_y;
|
||||
}
|
||||
|
||||
if (clipmask)
|
||||
{
|
||||
// reject scanlines that are outside of the target bitmap's right(bottom) clip boundary
|
||||
dst_start = -scroll;
|
||||
if (dst_start > dst_max) return;
|
||||
|
||||
// calculate target length
|
||||
dst_length = clipmask + 1;
|
||||
if (zoom) dst_length = (dst_length << 6) / zoom;
|
||||
|
||||
// reject scanlines that are outside of the target bitmap's left(top) clip boundary
|
||||
end_pixel = dst_start + dst_length - 1;
|
||||
if (end_pixel < dst_min) return;
|
||||
|
||||
// clip scanline tail
|
||||
if ((end_pixel -= dst_max) > 0) dst_length -= end_pixel;
|
||||
|
||||
// reject zero-length scanlines
|
||||
if (dst_length <= 0) return;
|
||||
|
||||
// calculate zoom factor
|
||||
src_fdx = zoom << (FIXPOINT_PRECISION-6);
|
||||
|
||||
// clip scanline head
|
||||
end_pixel = dst_min;
|
||||
if ((end_pixel -= dst_start) > 0)
|
||||
{
|
||||
// chop scanline to the correct length and move target start location to the left(top) clip boundary
|
||||
dst_length -= end_pixel;
|
||||
dst_start = dst_min;
|
||||
|
||||
// and skip the source for the left(top) clip region
|
||||
src_fx = end_pixel * src_fdx + FIXPOINT_PRECISION_HALF;
|
||||
}
|
||||
else
|
||||
// the point five bias is to ensure even distribution of stretched or shrinked pixels
|
||||
src_fx = FIXPOINT_PRECISION_HALF;
|
||||
|
||||
// adjust flipped source
|
||||
if (flip)
|
||||
{
|
||||
// start from the target's clipped end if the scanline is flipped
|
||||
dst_start = dst_max + dst_min - dst_start - (dst_length-1);
|
||||
|
||||
// and move source start location to the opposite end
|
||||
src_fx += (dst_length-1) * src_fdx - 1;
|
||||
src_fdx = -src_fdx;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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
|
||||
src_fdx = zoom << (FIXPOINT_PRECISION-6);
|
||||
|
||||
// pre-advance source for the clipped region
|
||||
if (!flip)
|
||||
src_fx = (scroll + dst_min) * src_fdx + FIXPOINT_PRECISION_HALF;
|
||||
else
|
||||
{
|
||||
src_fx = (scroll + dst_max) * src_fdx + FIXPOINT_PRECISION_HALF-1;
|
||||
src_fdx = -src_fdx;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(orientation & ORIENTATION_SWAP_XY))
|
||||
{
|
||||
// calculate target increment for horizontal scanlines which is exactly one
|
||||
dst_adv = 1;
|
||||
dst_offset = dst_length;
|
||||
pri_base = BITMAP_ADDR8(priority, linepos, dst_start + dst_offset);
|
||||
dst_base = BITMAP_ADDR32(bitmap, linepos, dst_start + dst_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
// calculate target increment for vertical scanlines which is the bitmap's pitch value
|
||||
dst_adv = bitmap->rowpixels;
|
||||
dst_offset= dst_length * dst_adv;
|
||||
pri_base = BITMAP_ADDR8(priority, dst_start, linepos + dst_offset);
|
||||
dst_base = BITMAP_ADDR32(bitmap, dst_start, linepos + dst_offset);
|
||||
}
|
||||
|
||||
// generalized
|
||||
src_base = source;
|
||||
|
||||
// there is no need to wrap source offsets along with source clipping
|
||||
// so we set all bits of the wrapmask to one
|
||||
src_wrapmask = (clipmask) ? ~0 : wrapmask;
|
||||
|
||||
pal_base = palette;
|
||||
dst_offset = -dst_offset; // negate target offset in order to terminated draw loop at zero condition
|
||||
|
||||
if (pri)
|
||||
{
|
||||
// draw scanline and update priority bitmap
|
||||
do
|
||||
{
|
||||
pix_data = src_base[(src_fx>>FIXPOINT_PRECISION) & src_wrapmask];
|
||||
src_fx += src_fdx;
|
||||
|
||||
if (pix_data)
|
||||
{
|
||||
pix_data = pal_base[pix_data];
|
||||
pri_base[dst_offset] = pri;
|
||||
dst_base[dst_offset] = pix_data;
|
||||
}
|
||||
}
|
||||
while (dst_offset += dst_adv);
|
||||
}
|
||||
else
|
||||
{
|
||||
// draw scanline but do not update priority bitmap
|
||||
do
|
||||
{
|
||||
pix_data = src_base[(src_fx>>FIXPOINT_PRECISION) & src_wrapmask];
|
||||
src_fx += src_fdx;
|
||||
|
||||
if (pix_data)
|
||||
{
|
||||
dst_base[dst_offset] = pal_base[pix_data];
|
||||
}
|
||||
}
|
||||
while (dst_offset += dst_adv);
|
||||
}
|
||||
|
||||
#undef FIXPOINT_PRECISION
|
||||
#undef FIXPOINT_PRECISION_HALF
|
||||
}
|
||||
|
||||
void k053250_t::draw( bitmap_t *bitmap, const rectangle *cliprect, int colorbase, int flags, int priority )
|
||||
{
|
||||
UINT8 *pix_ptr;
|
||||
const pen_t *pal_base, *pal_ptr;
|
||||
UINT32 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;
|
||||
|
||||
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;
|
||||
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 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;
|
||||
|
||||
// invert X parameters when the forth bit of the control register is set
|
||||
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;
|
||||
|
||||
switch (ctrl >> 5) // the upper four bits of the control register select source and target dimensions
|
||||
{
|
||||
case 0 :
|
||||
// Xexex: L6 galaxies
|
||||
// Metam: L4 forest, L5 arena, L6 tower interior, final boss
|
||||
|
||||
// crop source offset between zero and two hundred and fifty-five inclusive,
|
||||
// and set virtual bitmap height to two hundred and fifty-six pixels
|
||||
src_wrapmask = src_clipmask = 0xff;
|
||||
dst_height = 0x100;
|
||||
break;
|
||||
case 1 :
|
||||
// Xexex: prologue, L7 nebulae
|
||||
|
||||
// the source offset is cropped to zero and five hundred and eleven inclusive
|
||||
src_wrapmask = src_clipmask = 0x1ff;
|
||||
break;
|
||||
case 4 :
|
||||
// Xexex: L1 sky and boss, L3 planet, L5 poly-face, L7 battle ship patches
|
||||
// Metam: L1 summoning circle, L3 caves, L6 gargoyle towers
|
||||
|
||||
// crop source offset between zero and two hundred and fifty-five inclusive,
|
||||
// and allow source offset to wrap back at 500 hexadecimal to minus 300 hexadecimal
|
||||
src_wrapmask = src_clipmask = 0xff;
|
||||
wrap500 = true;
|
||||
break;
|
||||
// case 2 : // Xexex: title
|
||||
// case 7 : // Xexex: L4 organic stage
|
||||
default:
|
||||
// crop source offset between zero and one thousand and eleven inclusive,
|
||||
// keep other dimensions to their defaults
|
||||
src_wrapmask = src_clipmask = 0x3ff;
|
||||
break;
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
if (orientation & ORIENTATION_FLIP_Y)
|
||||
{
|
||||
scroll_corr = 0x100 - scroll_corr; // apply common vertical correction
|
||||
|
||||
// Y correction (ref: 1st and 5th boss)
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
if (src_clipmask)
|
||||
{
|
||||
// determine target wrap boundary and draw scanline in two passes if the source is clipped
|
||||
dst_wrapmask = dst_height - 1;
|
||||
passes = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise disable target wraparound and draw scanline in a single pass
|
||||
dst_wrapmask = ~0;
|
||||
passes = 1;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
// 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
|
||||
|
||||
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
|
||||
|
||||
// calculate physical palette location
|
||||
// there can be thirty-two color codes and each code represents sixteen pens
|
||||
pal_ptr = pal_base + ((color & 0x1f) << 4);
|
||||
|
||||
// calculate physical pixel location
|
||||
// each offset unit represents two hundred and fifty six pixels and should wrap at ROM boundary for safty
|
||||
pix_ptr = unpacked + ((offset << 8) % unpacked_size);
|
||||
|
||||
// get scanline zoom factor
|
||||
// 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];
|
||||
|
||||
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
|
||||
|
||||
// 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;
|
||||
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
|
||||
*/
|
||||
pdraw_scanline32(bitmap, pal_ptr, pix_ptr, cliprect,
|
||||
line_pos, scroll, zoom, src_clipmask, src_wrapmask, orientation, machine().priority_bitmap, (UINT8)priority);
|
||||
|
||||
// shift scanline position one virtual screen upward to render the wrapped end if necessary
|
||||
scroll -= dst_height;
|
||||
}
|
||||
while (--i);
|
||||
}
|
||||
}
|
||||
|
||||
void k053250_t::dma(int limiter)
|
||||
{
|
||||
int current_frame = screen->frame_number();
|
||||
|
||||
if (limiter && current_frame == frame)
|
||||
return; // make sure we only do DMA transfer once per frame
|
||||
|
||||
frame = current_frame;
|
||||
memcpy(buffer[page], ram, 0x1000);
|
||||
page ^= 1;
|
||||
}
|
||||
|
||||
READ16_MEMBER(k053250_t::reg_r)
|
||||
{
|
||||
return regs[offset];
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(k053250_t::reg_w)
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
// start LVC DMA transfer at the falling edge of control register's bit1
|
||||
if (offset == 4 && !(data & 2) && (regs[4] & 2))
|
||||
dma(1);
|
||||
|
||||
regs[offset] = data;
|
||||
}
|
||||
}
|
||||
|
||||
READ16_MEMBER(k053250_t::ram_r)
|
||||
{
|
||||
return ram[offset];
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(k053250_t::ram_w)
|
||||
{
|
||||
COMBINE_DATA(ram+offset);
|
||||
}
|
||||
|
||||
READ16_MEMBER(k053250_t::rom_r)
|
||||
{
|
||||
return m_region->base()[0x80000 * regs[6] + 0x800 * regs[7] + offset/2];
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
#ifndef __K053250_H__
|
||||
#define __K053250_H__
|
||||
|
||||
//
|
||||
// Konami 053250 road generator
|
||||
//
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#define MCFG_K053250_ADD(_tag, screen_tag, offx, offy) \
|
||||
MCFG_DEVICE_ADD(_tag, K053250, 0) \
|
||||
k053250_t::static_set_screen_tag(*device, screen_tag); \
|
||||
k053250_t::static_set_offsets(*device, offx, offy);
|
||||
|
||||
class k053250_t : public device_t
|
||||
{
|
||||
public:
|
||||
k053250_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
static void static_set_screen_tag(device_t &device, const char *screen_tag);
|
||||
static void static_set_offsets(device_t &device, int offx, int offy);
|
||||
|
||||
DECLARE_READ16_MEMBER(reg_r);
|
||||
DECLARE_WRITE16_MEMBER(reg_w);
|
||||
DECLARE_READ16_MEMBER(ram_r);
|
||||
DECLARE_WRITE16_MEMBER(ram_w);
|
||||
DECLARE_READ16_MEMBER(rom_r);
|
||||
|
||||
void draw( bitmap_t *bitmap, const rectangle *cliprect, int colorbase, int flags, int priority );
|
||||
|
||||
protected:
|
||||
void device_start();
|
||||
void device_reset();
|
||||
|
||||
private:
|
||||
UINT8 regs[8];
|
||||
UINT8 *unpacked;
|
||||
UINT32 unpacked_size;
|
||||
UINT16 *ram;
|
||||
UINT16 *buffer[2];
|
||||
UINT32 page;
|
||||
INT32 frame;
|
||||
int offx, offy;
|
||||
const char *screen_tag;
|
||||
screen_device *screen;
|
||||
|
||||
void unpack_nibbles();
|
||||
void dma(int limiter);
|
||||
static void pdraw_scanline32(bitmap_t *bitmap, const pen_t *palette, UINT8 *source,
|
||||
const rectangle *cliprect, int linepos, int scroll, int zoom,
|
||||
UINT32 clipmask, UINT32 wrapmask, UINT32 orientation, bitmap_t *priority, UINT8 pri);
|
||||
};
|
||||
|
||||
extern const device_type K053250;
|
||||
|
||||
#endif
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "deprecat.h"
|
||||
|
||||
#include "video/konamiic.h"
|
||||
#include "video/k053250.h"
|
||||
#include "machine/k053252.h"
|
||||
#include "includes/konamigx.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
@ -305,8 +306,8 @@ static ADDRESS_MAP_START( metamrph_map, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0x240000, 0x240007) AM_WRITE(K053246_word_w)
|
||||
AM_RANGE(0x244000, 0x24400f) AM_READ(K055673_rom_word_r)
|
||||
AM_RANGE(0x244010, 0x24401f) AM_WRITE(K053247_reg_word_w)
|
||||
AM_RANGE(0x24c000, 0x24ffff) AM_READWRITE(K053250_0_ram_r,K053250_0_ram_w) // "LVC RAM" (53250_ram)
|
||||
AM_RANGE(0x250000, 0x25000f) AM_READWRITE(K053250_0_r,K053250_0_w)
|
||||
AM_RANGE(0x24c000, 0x24ffff) AM_DEVREADWRITE_MODERN("k053250_1", k053250_t, ram_r, ram_w)
|
||||
AM_RANGE(0x250000, 0x25000f) AM_DEVREADWRITE_MODERN("k053250_1", k053250_t, reg_r, reg_w)
|
||||
AM_RANGE(0x254000, 0x25401f) AM_WRITE(K054338_word_w)
|
||||
AM_RANGE(0x258000, 0x2580ff) AM_WRITE(K055555_word_w)
|
||||
AM_RANGE(0x260000, 0x26001f) AM_DEVREADWRITE8("k053252",k053252_r,k053252_w,0x00ff)
|
||||
@ -326,7 +327,7 @@ static ADDRESS_MAP_START( metamrph_map, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0x300000, 0x301fff) AM_READWRITE(K056832_ram_word_r,K056832_ram_word_w)
|
||||
AM_RANGE(0x302000, 0x303fff) AM_READWRITE(K056832_ram_word_r,K056832_ram_word_w) // tilemap RAM mirror read/write (essential)
|
||||
AM_RANGE(0x310000, 0x311fff) AM_READ(K056832_mw_rom_word_r)
|
||||
AM_RANGE(0x320000, 0x321fff) AM_READ(K053250_0_rom_r)
|
||||
AM_RANGE(0x320000, 0x321fff) AM_DEVREAD_MODERN("k053250_1", k053250_t, rom_r)
|
||||
AM_RANGE(0x330000, 0x331fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_BASE_GENERIC(paletteram)
|
||||
#if MW_DEBUG
|
||||
AM_RANGE(0x240000, 0x240007) AM_READ(K053246_reg_word_r)
|
||||
@ -347,8 +348,8 @@ static ADDRESS_MAP_START( viostorm_map, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0x240000, 0x240007) AM_WRITE(K053246_word_w)
|
||||
AM_RANGE(0x244000, 0x24400f) AM_READ(K055673_rom_word_r)
|
||||
AM_RANGE(0x244010, 0x24401f) AM_WRITE(K053247_reg_word_w)
|
||||
AM_RANGE(0x24c000, 0x24ffff) AM_RAM // K053250_0_ram_r / K053250_0_ram_w
|
||||
AM_RANGE(0x250000, 0x25000f) AM_RAM // K053250_0_r / K053250_0_w
|
||||
AM_RANGE(0x24c000, 0x24ffff) AM_RAM // K053250 ram
|
||||
AM_RANGE(0x250000, 0x25000f) AM_RAM // K053250 reg
|
||||
AM_RANGE(0x254000, 0x25401f) AM_WRITE(K054338_word_w)
|
||||
AM_RANGE(0x258000, 0x2580ff) AM_WRITE(K055555_word_w)
|
||||
AM_RANGE(0x25c000, 0x25c03f) AM_READWRITE(K055550_word_r,K055550_word_w)
|
||||
@ -1082,6 +1083,7 @@ static MACHINE_CONFIG_DERIVED( metamrph, mystwarr )
|
||||
|
||||
MCFG_DEVICE_REMOVE("k053252")
|
||||
MCFG_K053252_ADD("k053252", 6000000, metamrph_k053252_intf) // 6 MHz?
|
||||
MCFG_K053250_ADD("k053250_1", "screen", -7, 0)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_VIDEO_START(metamrph)
|
||||
@ -1574,13 +1576,9 @@ ROM_START( metamrph )
|
||||
ROM_LOAD64_WORD( "224a12", 0x000004, 2*1024*1024, CRC(ca72a4b3) SHA1(a09deb6d7cb8be4edaeb78e0e676ea2d6055e9e0) )
|
||||
ROM_LOAD64_WORD( "224a13", 0x000006, 2*1024*1024, CRC(86b58feb) SHA1(5a43746e2cd3c7aca21496c092aef83e64b3ab2c) )
|
||||
|
||||
/* K053250 linescroll/zoom thingy (unpacked) */
|
||||
ROM_REGION( 0x80000, "gfx3", ROMREGION_ERASE00 ) // NOTE: region must be 2xROM size for unpacking
|
||||
ROM_LOAD( "224a14", 0x000000, 0x40000, CRC(3c79b404) SHA1(7c6bb4cbf050f314ea0cd3e8bc6e1947d0573084) )
|
||||
|
||||
/* K053250 linescroll/zoom thingy */
|
||||
ROM_REGION( 0x40000, "gfx4", ROMREGION_ERASE00 )
|
||||
ROM_COPY( "gfx3", 0x00000, 0x00000, 0x40000 )
|
||||
ROM_REGION( 0x40000, "k053250_1", 0 )
|
||||
ROM_LOAD( "224a14", 0x000000, 0x40000, CRC(3c79b404) SHA1(7c6bb4cbf050f314ea0cd3e8bc6e1947d0573084) )
|
||||
|
||||
/* sound data */
|
||||
ROM_REGION( 0x400000, "shared", 0 )
|
||||
@ -1617,12 +1615,9 @@ ROM_START( metamrphu )
|
||||
ROM_LOAD64_WORD( "224a13", 0x000006, 2*1024*1024, CRC(86b58feb) SHA1(5a43746e2cd3c7aca21496c092aef83e64b3ab2c) )
|
||||
|
||||
/* K053250 linescroll/zoom thingy */
|
||||
ROM_REGION( 0x40000, "gfx3", ROMREGION_ERASE00 )
|
||||
ROM_REGION( 0x40000, "k053250_1", 0 )
|
||||
ROM_LOAD( "224a14", 0x000000, 0x40000, CRC(3c79b404) SHA1(7c6bb4cbf050f314ea0cd3e8bc6e1947d0573084) )
|
||||
|
||||
ROM_REGION( 0x80000, "gfx4", ROMREGION_ERASE00 ) // NOTE: region must be 2xROM size for unpacking
|
||||
ROM_COPY( "gfx3", 0x00000, 0x00000, 0x40000 )
|
||||
|
||||
/* sound data */
|
||||
ROM_REGION( 0x400000, "shared", 0 )
|
||||
ROM_LOAD( "224a06", 0x000000, 2*1024*1024, CRC(972f6abe) SHA1(30907495fc49fe3424c092b074c1dc137aa14306) )
|
||||
@ -1658,12 +1653,9 @@ ROM_START( metamrphj )
|
||||
ROM_LOAD64_WORD( "224a13", 0x000006, 2*1024*1024, CRC(86b58feb) SHA1(5a43746e2cd3c7aca21496c092aef83e64b3ab2c) )
|
||||
|
||||
/* K053250 linescroll/zoom thingy */
|
||||
ROM_REGION( 0x40000, "gfx3", ROMREGION_ERASE00 )
|
||||
ROM_REGION( 0x40000, "k053250_1", 0 )
|
||||
ROM_LOAD( "224a14", 0x000000, 0x40000, CRC(3c79b404) SHA1(7c6bb4cbf050f314ea0cd3e8bc6e1947d0573084) )
|
||||
|
||||
ROM_REGION( 0x80000, "gfx4", ROMREGION_ERASE00 ) // NOTE: region must be 2xROM size for unpacking
|
||||
ROM_COPY( "gfx3", 0x00000, 0x00000, 0x40000 )
|
||||
|
||||
/* sound data */
|
||||
ROM_REGION( 0x400000, "shared", 0 )
|
||||
ROM_LOAD( "224a06", 0x000000, 2*1024*1024, CRC(972f6abe) SHA1(30907495fc49fe3424c092b074c1dc137aa14306) )
|
||||
@ -2098,38 +2090,32 @@ ROM_START( dadandrn )
|
||||
ROM_LOAD( "dadandrn.nv", 0x0000, 0x080, CRC(346ae0cf) SHA1(1f79b2e21766f7a971c7d0f618700deb8a32f78a) )
|
||||
ROM_END
|
||||
|
||||
static DRIVER_INIT(metamrph)
|
||||
{
|
||||
K053250_unpack_pixels(machine, "gfx4", "gfx3");
|
||||
}
|
||||
|
||||
|
||||
/* ROM parent machine inp init */
|
||||
GAME( 1993, mystwarr, 0, mystwarr, mystwarr, 0, ROT0, "Konami", "Mystic Warriors (ver EAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mystwarru, mystwarr, mystwarr, mystwarr, 0, ROT0, "Konami", "Mystic Warriors (ver UAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mystwarrj, mystwarr, mystwarr, mystwarr, 0, ROT0, "Konami", "Mystic Warriors (ver JAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mystwarra, mystwarr, mystwarr, mystwarr, 0, ROT0, "Konami", "Mystic Warriors (ver AAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mystwarr, 0, mystwarr, mystwarr, 0, ROT0, "Konami", "Mystic Warriors (ver EAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mystwarru, mystwarr, mystwarr, mystwarr, 0, ROT0, "Konami", "Mystic Warriors (ver UAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mystwarrj, mystwarr, mystwarr, mystwarr, 0, ROT0, "Konami", "Mystic Warriors (ver JAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mystwarra, mystwarr, mystwarr, mystwarr, 0, ROT0, "Konami", "Mystic Warriors (ver AAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
|
||||
GAME( 1993, mmaulers, 0, dadandrn, dadandrn, 0, ROT0, "Konami", "Monster Maulers (ver EAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, dadandrn, mmaulers, dadandrn, dadandrn, 0, ROT0, "Konami", "Kyukyoku Sentai Dadandarn (ver JAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mmaulers, 0, dadandrn, dadandrn, 0, ROT0, "Konami", "Monster Maulers (ver EAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, dadandrn, mmaulers, dadandrn, dadandrn, 0, ROT0, "Konami", "Kyukyoku Sentai Dadandarn (ver JAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
|
||||
GAME( 1993, viostorm, 0, viostorm, viostorm, 0, ROT0, "Konami", "Violent Storm (ver EAB)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, viostormu, viostorm, viostorm, viostorm, 0, ROT0, "Konami", "Violent Storm (ver UAC)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, viostormub,viostorm, viostorm, viostorm, 0, ROT0, "Konami", "Violent Storm (ver UAB)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, viostormj, viostorm, viostorm, viostorm, 0, ROT0, "Konami", "Violent Storm (ver JAC)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, viostorma, viostorm, viostorm, viostorm, 0, ROT0, "Konami", "Violent Storm (ver AAC)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, viostormab, viostorm, viostorm, viostorm, 0, ROT0, "Konami", "Violent Storm (ver AAB)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, viostorm, 0, viostorm, viostorm, 0, ROT0, "Konami", "Violent Storm (ver EAB)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, viostormu, viostorm, viostorm, viostorm, 0, ROT0, "Konami", "Violent Storm (ver UAC)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, viostormub,viostorm, viostorm, viostorm, 0, ROT0, "Konami", "Violent Storm (ver UAB)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, viostormj, viostorm, viostorm, viostorm, 0, ROT0, "Konami", "Violent Storm (ver JAC)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, viostorma, viostorm, viostorm, viostorm, 0, ROT0, "Konami", "Violent Storm (ver AAC)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, viostormab, viostorm, viostorm, viostorm, 0,ROT0, "Konami", "Violent Storm (ver AAB)", GAME_IMPERFECT_GRAPHICS )
|
||||
|
||||
GAME( 1993, metamrph, 0, metamrph, metamrph, metamrph, ROT0, "Konami", "Metamorphic Force (ver EAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, metamrphu, metamrph, metamrph, metamrph, metamrph, ROT0, "Konami", "Metamorphic Force (ver UAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, metamrphj, metamrph, metamrph, metamrph, metamrph, ROT0, "Konami", "Metamorphic Force (ver JAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, metamrph, 0, metamrph, metamrph, 0, ROT0, "Konami", "Metamorphic Force (ver EAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, metamrphu, metamrph, metamrph, metamrph, 0, ROT0, "Konami", "Metamorphic Force (ver UAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, metamrphj, metamrph, metamrph, metamrph, 0, ROT0, "Konami", "Metamorphic Force (ver JAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
|
||||
GAME( 1993, mtlchamp, 0, martchmp, martchmp, 0, ROT0, "Konami", "Martial Champion (ver EAB)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mtlchamp1, mtlchamp, martchmp, martchmp, 0, ROT0, "Konami", "Martial Champion (ver EAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mtlchampu, mtlchamp, martchmp, martchmp, 0, ROT0, "Konami", "Martial Champion (ver UAD)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mtlchampj, mtlchamp, martchmp, martchmp, 0, ROT0, "Konami", "Martial Champion (ver JAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mtlchampa, mtlchamp, martchmp, martchmp, 0, ROT0, "Konami", "Martial Champion (ver AAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mtlchamp, 0, martchmp, martchmp, 0, ROT0, "Konami", "Martial Champion (ver EAB)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mtlchamp1, mtlchamp, martchmp, martchmp, 0, ROT0, "Konami", "Martial Champion (ver EAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mtlchampu, mtlchamp, martchmp, martchmp, 0, ROT0, "Konami", "Martial Champion (ver UAD)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mtlchampj, mtlchamp, martchmp, martchmp, 0, ROT0, "Konami", "Martial Champion (ver JAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, mtlchampa, mtlchamp, martchmp, martchmp, 0, ROT0, "Konami", "Martial Champion (ver AAA)", GAME_IMPERFECT_GRAPHICS )
|
||||
|
||||
GAME( 1993, gaiapols, 0, gaiapols, dadandrn, 0, ROT90, "Konami", "Gaiapolis (ver EAF)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, gaiapolsu, gaiapols, gaiapols, dadandrn, 0, ROT90, "Konami", "Gaiapolis (ver UAF)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, gaiapolsj, gaiapols, gaiapols, dadandrn, 0, ROT90, "Konami", "Gaiapolis (ver JAF)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, gaiapols, 0, gaiapols, dadandrn, 0, ROT90, "Konami", "Gaiapolis (ver EAF)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, gaiapolsu, gaiapols, gaiapols, dadandrn, 0, ROT90, "Konami", "Gaiapolis (ver UAF)", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1993, gaiapolsj, gaiapols, gaiapols, dadandrn, 0, ROT90, "Konami", "Gaiapolis (ver JAF)", GAME_IMPERFECT_GRAPHICS )
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "emu.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "video/konicdev.h"
|
||||
#include "video/k053250.h"
|
||||
#include "machine/k053252.h"
|
||||
#include "machine/eeprom.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
@ -190,16 +191,16 @@ static ADDRESS_MAP_START( overdriv_slave_map, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x03ffff) AM_ROM
|
||||
AM_RANGE(0x080000, 0x083fff) AM_RAM /* work RAM */
|
||||
AM_RANGE(0x0c0000, 0x0c1fff) AM_RAM //AM_DEVREADWRITE("k053250_1", k053250_ram_r, k053250_ram_w)
|
||||
AM_RANGE(0x100000, 0x10000f) AM_DEVREADWRITE("k053250_1", k053250_r, k053250_w) // K053250 #0
|
||||
AM_RANGE(0x108000, 0x10800f) AM_DEVREADWRITE("k053250_2", k053250_r, k053250_w) // K053250 #1
|
||||
AM_RANGE(0x100000, 0x10000f) AM_DEVREADWRITE_MODERN("k053250_1", k053250_t, reg_r, reg_w)
|
||||
AM_RANGE(0x108000, 0x10800f) AM_DEVREADWRITE_MODERN("k053250_2", k053250_t, reg_r, reg_w)
|
||||
AM_RANGE(0x118000, 0x118fff) AM_DEVREADWRITE("k053246", k053247_word_r, k053247_word_w)
|
||||
AM_RANGE(0x120000, 0x120001) AM_DEVREAD("k053246", k053246_word_r)
|
||||
AM_RANGE(0x128000, 0x128001) AM_READWRITE(cpuB_ctrl_r, cpuB_ctrl_w) /* enable K053247 ROM reading, plus something else */
|
||||
AM_RANGE(0x130000, 0x130007) AM_DEVWRITE("k053246", k053246_word_w)
|
||||
AM_RANGE(0x200000, 0x203fff) AM_RAM AM_SHARE("share1")
|
||||
AM_RANGE(0x208000, 0x20bfff) AM_RAM
|
||||
AM_RANGE(0x218000, 0x219fff) AM_DEVREAD("k053250_1", k053250_rom_r) // K053250 #0 gfx ROM read (LSB)
|
||||
AM_RANGE(0x220000, 0x221fff) AM_DEVREAD("k053250_2", k053250_rom_r) // K053250 #1 gfx ROM read (LSB)
|
||||
AM_RANGE(0x218000, 0x219fff) AM_DEVREAD_MODERN("k053250_1", k053250_t, rom_r)
|
||||
AM_RANGE(0x220000, 0x221fff) AM_DEVREAD_MODERN("k053250_2", k053250_t, rom_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( overdriv_sound_map, AS_PROGRAM, 8 )
|
||||
@ -246,25 +247,6 @@ static INPUT_PORTS_START( overdriv )
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
#if 0
|
||||
static const gfx_layout charlayout =
|
||||
{
|
||||
8,8,
|
||||
RGN_FRAC(1,1),
|
||||
4,
|
||||
{ 0, 1, 2, 3 },
|
||||
{ STEP8(0,4) },
|
||||
{ STEP8(7*8*4,-8*4) },
|
||||
8*8*4
|
||||
};
|
||||
|
||||
static GFXDECODE_START( overdriv )
|
||||
GFXDECODE_ENTRY( "gfx4", 0, charlayout, 0, 0x80 )
|
||||
GFXDECODE_ENTRY( "gfx5", 0, charlayout, 0, 0x80 )
|
||||
GFXDECODE_END
|
||||
#endif
|
||||
|
||||
|
||||
static const k053260_interface k053260_config =
|
||||
{
|
||||
"shared"
|
||||
@ -332,22 +314,6 @@ static MACHINE_RESET( overdriv )
|
||||
cputag_set_input_line(machine, "sub", INPUT_LINE_RESET, ASSERT_LINE);
|
||||
}
|
||||
|
||||
static const k053250_interface overdriv_k053250_intf_1 =
|
||||
{
|
||||
"screen",
|
||||
"gfx6",
|
||||
"gfx4",
|
||||
0, 0 //TODO
|
||||
};
|
||||
|
||||
static const k053250_interface overdriv_k053250_intf_2 =
|
||||
{
|
||||
"screen",
|
||||
"gfx7",
|
||||
"gfx5",
|
||||
0, 0 //TODO
|
||||
};
|
||||
|
||||
static const k053252_interface overdriv_k053252_intf =
|
||||
{
|
||||
"screen",
|
||||
@ -402,8 +368,8 @@ static MACHINE_CONFIG_START( overdriv, overdriv_state )
|
||||
MCFG_K051316_ADD("k051316_1", overdriv_k051316_intf_1)
|
||||
MCFG_K051316_ADD("k051316_2", overdriv_k051316_intf_2)
|
||||
MCFG_K053251_ADD("k053251")
|
||||
MCFG_K053250_ADD("k053250_1", overdriv_k053250_intf_1)
|
||||
MCFG_K053250_ADD("k053250_2", overdriv_k053250_intf_2)
|
||||
MCFG_K053250_ADD("k053250_1", "screen", 0, 0)
|
||||
MCFG_K053250_ADD("k053250_2", "screen", 0, 0)
|
||||
MCFG_K053252_ADD("k053252", 24000000/4, overdriv_k053252_intf)
|
||||
|
||||
/* sound hardware */
|
||||
@ -456,30 +422,14 @@ ROM_START( overdriv )
|
||||
ROM_REGION( 0x020000, "gfx3", 0 ) /* graphics (addressable by the CPU) */
|
||||
ROM_LOAD( "e07.c23", 0x000000, 0x020000, CRC(8a6ceab9) SHA1(1a52b7361f71a6126cd648a76af00223d5b25c7a) ) /* zoom/rotate */
|
||||
|
||||
// sum16
|
||||
// 16 current 0x811c correct: 0xb1cc
|
||||
// 17 current 0xb221 correct: 0xb474
|
||||
// 18 current 0x4f4e correct: 0xabd9
|
||||
// 19 current 0x4096 correct: 0xf21e
|
||||
// 20 current 0x0000 correct: 0xa317
|
||||
|
||||
ROM_REGION( 0x0c0000, "gfx4", ROMREGION_ERASE00 ) /* graphics (addressable by the CPU) */
|
||||
ROM_LOAD( "e19.r22", 0x000000, 0x040000, CRC(15c54ea2) SHA1(5b10bd28e48e51613359820ba8c75d4a91c2d322) )
|
||||
ROM_LOAD( "e18.p22", 0x040000, 0x040000, CRC(985a4a75) SHA1(b726166c295be6fbec38a9d11098cc4a4a5de456) ) /* 053250 #0 */
|
||||
ROM_REGION( 0x0c0000, "k053250_1", 0 ) /* graphics (addressable by the CPU) */
|
||||
ROM_LOAD( "e18.p22", 0x000000, 0x040000, CRC(985a4a75) SHA1(b726166c295be6fbec38a9d11098cc4a4a5de456) )
|
||||
ROM_LOAD( "e19.r22", 0x040000, 0x040000, CRC(15c54ea2) SHA1(5b10bd28e48e51613359820ba8c75d4a91c2d322) )
|
||||
ROM_LOAD( "e20.s22", 0x080000, 0x040000, CRC(ea204acd) SHA1(52b8c30234eaefcba1074496028a4ac2bca48e95) )
|
||||
|
||||
ROM_REGION( 0x080000, "gfx5", ROMREGION_ERASE00 ) /* unknown (053250?) */
|
||||
ROM_LOAD( "e16.p12", 0x000000, 0x040000, CRC(9348dee1) SHA1(367193373e28962b5b0e54cc15d68ed88ab83f12) ) /* 053250 #1 */
|
||||
ROM_LOAD( "e17.p17", 0x040000, 0x040000, CRC(04c07248) SHA1(873445002cbf90c9fc5a35bf4a8f6c43193ee342) )
|
||||
|
||||
ROM_REGION( 0x0c0000*2, "gfx6", ROMREGION_ERASE00 ) /* graphics (addressable by the CPU, unpacked) */
|
||||
ROM_LOAD( "e19.r22", 0x000000, 0x040000, CRC(15c54ea2) SHA1(5b10bd28e48e51613359820ba8c75d4a91c2d322) )
|
||||
ROM_LOAD( "e18.p22", 0x040000, 0x040000, CRC(985a4a75) SHA1(b726166c295be6fbec38a9d11098cc4a4a5de456) ) /* 053250 #0, unpacked */
|
||||
ROM_LOAD( "e20.s22", 0x080000, 0x040000, CRC(ea204acd) SHA1(52b8c30234eaefcba1074496028a4ac2bca48e95) )
|
||||
|
||||
ROM_REGION( 0x080000*2, "gfx7", ROMREGION_ERASE00 ) /* unknown (053250, unpacked?) */
|
||||
ROM_LOAD( "e16.p12", 0x000000, 0x040000, CRC(9348dee1) SHA1(367193373e28962b5b0e54cc15d68ed88ab83f12) ) /* 053250 #1, unpacked */
|
||||
ROM_LOAD( "e17.p17", 0x040000, 0x040000, CRC(04c07248) SHA1(873445002cbf90c9fc5a35bf4a8f6c43193ee342) )
|
||||
ROM_REGION( 0x080000, "k053250_2", 0 ) /* graphics (addressable by the CPU) */
|
||||
ROM_LOAD( "e17.p17", 0x000000, 0x040000, CRC(04c07248) SHA1(873445002cbf90c9fc5a35bf4a8f6c43193ee342) )
|
||||
ROM_LOAD( "e16.p12", 0x040000, 0x040000, CRC(9348dee1) SHA1(367193373e28962b5b0e54cc15d68ed88ab83f12) )
|
||||
|
||||
ROM_REGION( 0x200000, "shared", 0 ) /* 053260 samples */
|
||||
ROM_LOAD( "e03.j1", 0x000000, 0x100000, CRC(51ebfebe) SHA1(17f0c23189258e801f48d5833fe934e7a48d071b) )
|
||||
|
@ -335,8 +335,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0x0c0000, 0x0c003f) AM_DEVWRITE("k056832", k056832_word_w) // VACSET (K054157)
|
||||
AM_RANGE(0x0c2000, 0x0c2007) AM_DEVWRITE("k053246", k053246_word_w) // OBJSET1
|
||||
AM_RANGE(0x0c4000, 0x0c4001) AM_DEVREAD("k053246", k053246_word_r) // Passthrough to sprite roms
|
||||
AM_RANGE(0x0c6000, 0x0c7fff) AM_DEVREADWRITE("k053250", k053250_ram_r, k053250_ram_w) // K053250 "road" RAM
|
||||
AM_RANGE(0x0c8000, 0x0c800f) AM_DEVREADWRITE("k053250", k053250_r, k053250_w)
|
||||
AM_RANGE(0x0c6000, 0x0c7fff) AM_DEVREADWRITE_MODERN("k053250", k053250_t, ram_r, ram_w) // K053250 "road" RAM
|
||||
AM_RANGE(0x0c8000, 0x0c800f) AM_DEVREADWRITE_MODERN("k053250", k053250_t, reg_r, reg_w)
|
||||
AM_RANGE(0x0ca000, 0x0ca01f) AM_DEVWRITE("k054338", k054338_word_w) // CLTC
|
||||
AM_RANGE(0x0cc000, 0x0cc01f) AM_DEVWRITE("k053251", k053251_lsb_w) // priority encoder
|
||||
// AM_RANGE(0x0d0000, 0x0d001f) AM_DEVREADWRITE8("k053252", k053252_r,k053252_w,0x00ff) // CCU
|
||||
@ -355,7 +355,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0x180000, 0x181fff) AM_DEVREADWRITE("k056832", k056832_ram_word_r, k056832_ram_word_w)
|
||||
AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE("k056832", k056832_ram_word_r, k056832_ram_word_w)
|
||||
AM_RANGE(0x190000, 0x191fff) AM_DEVREAD("k056832", k056832_rom_word_r) // Passthrough to tile roms
|
||||
AM_RANGE(0x1a0000, 0x1a1fff) AM_DEVREAD("k053250", k053250_rom_r)
|
||||
AM_RANGE(0x1a0000, 0x1a1fff) AM_DEVREAD_MODERN("k053250", k053250_t, rom_r)
|
||||
AM_RANGE(0x1b0000, 0x1b1fff) AM_RAM_WRITE(paletteram16_xrgb_word_be_w) AM_BASE_GENERIC(paletteram)
|
||||
|
||||
#if XE_DEBUG
|
||||
@ -428,15 +428,6 @@ static const k054338_interface xexex_k054338_intf =
|
||||
"none"
|
||||
};
|
||||
|
||||
|
||||
static const k053250_interface xexex_k053250_intf =
|
||||
{
|
||||
"screen",
|
||||
"gfx4",
|
||||
"gfx3",
|
||||
-5, -16
|
||||
};
|
||||
|
||||
static const k056832_interface xexex_k056832_intf =
|
||||
{
|
||||
"gfx1", 0,
|
||||
@ -483,7 +474,7 @@ static MACHINE_START( xexex )
|
||||
state->m_maincpu = machine.device("maincpu");
|
||||
state->m_audiocpu = machine.device("audiocpu");
|
||||
state->m_k053246 = machine.device("k053246");
|
||||
state->m_k053250 = machine.device("k053250");
|
||||
state->m_k053250 = machine.device<k053250_t>("k053250");
|
||||
state->m_k053251 = machine.device("k053251");
|
||||
state->m_k053252 = machine.device("k053252");
|
||||
state->m_k056832 = machine.device("k056832");
|
||||
@ -567,7 +558,7 @@ static MACHINE_CONFIG_START( xexex, xexex_state )
|
||||
|
||||
MCFG_K056832_ADD("k056832", xexex_k056832_intf)
|
||||
MCFG_K053246_ADD("k053246", xexex_k053246_intf)
|
||||
MCFG_K053250_ADD("k053250", xexex_k053250_intf)
|
||||
MCFG_K053250_ADD("k053250", "screen", -5, -16)
|
||||
MCFG_K053251_ADD("k053251")
|
||||
MCFG_K053252_ADD("k053252", 32000000/4, xexex_k053252_intf)
|
||||
MCFG_K054338_ADD("k054338", xexex_k054338_intf)
|
||||
@ -620,12 +611,9 @@ ROM_START( xexex ) /* Europe, Version AA */
|
||||
ROM_LOAD( "067_b10.rom", 0x200000, 0x100000, CRC(ee31db8d) SHA1(c41874fb8b401ea9cdd327ee6239b5925418cf7b) )
|
||||
ROM_LOAD( "067_b09.rom", 0x300000, 0x100000, CRC(88f072ef) SHA1(7ecc04dbcc29b715117e970cc96e11137a21b83a) )
|
||||
|
||||
ROM_REGION( 0x080000, "gfx3", ROMREGION_ERASE00 )
|
||||
ROM_REGION( 0x080000, "k053250", 0 )
|
||||
ROM_LOAD( "067_b08.rom", 0x000000, 0x080000, CRC(ca816b7b) SHA1(769ce3700e41200c34adec98598c0fe371fe1e6d) )
|
||||
|
||||
ROM_REGION( 0x100000, "gfx4", ROMREGION_ERASE00 ) // NOTE: region must be 2xROM size for unpacking
|
||||
ROM_COPY( "gfx3", 0x000000, 0x000000, 0x080000 )
|
||||
|
||||
ROM_REGION( 0x300000, "k054539", 0 )
|
||||
ROM_LOAD( "067_b06.rom", 0x000000, 0x200000, CRC(3b12fce4) SHA1(c69172d9965b8da8a539812fac92d5f1a3c80d17) )
|
||||
ROM_LOAD( "067_b07.rom", 0x200000, 0x100000, CRC(ec87fe1b) SHA1(ec9823aea5a1fc5c47c8262e15e10b28be87231c) )
|
||||
@ -655,12 +643,9 @@ ROM_START( xexexa ) /* Asia, Version AA */
|
||||
ROM_LOAD( "067_b10.rom", 0x200000, 0x100000, CRC(ee31db8d) SHA1(c41874fb8b401ea9cdd327ee6239b5925418cf7b) )
|
||||
ROM_LOAD( "067_b09.rom", 0x300000, 0x100000, CRC(88f072ef) SHA1(7ecc04dbcc29b715117e970cc96e11137a21b83a) )
|
||||
|
||||
ROM_REGION( 0x080000, "gfx3", ROMREGION_ERASE00 )
|
||||
ROM_REGION( 0x080000, "k053250", 0 )
|
||||
ROM_LOAD( "067_b08.rom", 0x000000, 0x080000, CRC(ca816b7b) SHA1(769ce3700e41200c34adec98598c0fe371fe1e6d) )
|
||||
|
||||
ROM_REGION( 0x100000, "gfx4", ROMREGION_ERASE00 ) // NOTE: region must be 2xROM size for unpacking
|
||||
ROM_COPY( "gfx3", 0x000000, 0x000000, 0x080000 )
|
||||
|
||||
ROM_REGION( 0x300000, "k054539", 0 )
|
||||
ROM_LOAD( "067_b06.rom", 0x000000, 0x200000, CRC(3b12fce4) SHA1(c69172d9965b8da8a539812fac92d5f1a3c80d17) )
|
||||
ROM_LOAD( "067_b07.rom", 0x200000, 0x100000, CRC(ec87fe1b) SHA1(ec9823aea5a1fc5c47c8262e15e10b28be87231c) )
|
||||
@ -690,13 +675,9 @@ ROM_START( xexexj ) /* Japan, Version AA */
|
||||
ROM_LOAD( "067_b10.rom", 0x200000, 0x100000, CRC(ee31db8d) SHA1(c41874fb8b401ea9cdd327ee6239b5925418cf7b) )
|
||||
ROM_LOAD( "067_b09.rom", 0x300000, 0x100000, CRC(88f072ef) SHA1(7ecc04dbcc29b715117e970cc96e11137a21b83a) )
|
||||
|
||||
ROM_REGION( 0x80000, "gfx3",ROMREGION_ERASE00 )
|
||||
ROM_REGION( 0x080000, "k053250", 0 )
|
||||
ROM_LOAD( "067_b08.rom", 0x000000, 0x080000, CRC(ca816b7b) SHA1(769ce3700e41200c34adec98598c0fe371fe1e6d) )
|
||||
|
||||
ROM_REGION( 0x100000, "gfx4", ROMREGION_ERASE00 ) // NOTE: region must be 2xROM size for unpacking
|
||||
ROM_COPY( "gfx3", 0x000000, 0x000000, 0x080000 )
|
||||
|
||||
|
||||
ROM_REGION( 0x300000, "k054539", 0 )
|
||||
ROM_LOAD( "067_b06.rom", 0x000000, 0x200000, CRC(3b12fce4) SHA1(c69172d9965b8da8a539812fac92d5f1a3c80d17) )
|
||||
ROM_LOAD( "067_b07.rom", 0x200000, 0x100000, CRC(ec87fe1b) SHA1(ec9823aea5a1fc5c47c8262e15e10b28be87231c) )
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
#include <video/k053250.h>
|
||||
|
||||
class xexex_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -40,7 +42,7 @@ public:
|
||||
device_t *m_filter2r;
|
||||
device_t *m_k056832;
|
||||
device_t *m_k053246;
|
||||
device_t *m_k053250;
|
||||
k053250_t *m_k053250;
|
||||
device_t *m_k053251;
|
||||
device_t *m_k053252;
|
||||
device_t *m_k054338;
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "video/konamiic.h"
|
||||
#include "video/k053250.h"
|
||||
#include "includes/konamigx.h"
|
||||
|
||||
|
||||
@ -1588,7 +1589,7 @@ void konamigx_mixer(running_machine &machine, bitmap_t *bitmap, const rectangle
|
||||
}
|
||||
else
|
||||
{
|
||||
K053250_draw(machine, bitmap, cliprect, 0, vcblk[4]<<l, 0, 0);
|
||||
machine.device<k053250_t>("k053250_1")->draw(bitmap, cliprect, vcblk[4]<<l, 0, 0);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@ -1650,7 +1651,7 @@ void konamigx_mixer(running_machine &machine, bitmap_t *bitmap, const rectangle
|
||||
}
|
||||
}
|
||||
else
|
||||
K053250_draw(machine, bitmap, cliprect, 1, vcblk[5]<<l, 0, 0);
|
||||
machine.device<k053250_t>("k053250_2")->draw(bitmap, cliprect, vcblk[5]<<l, 0, 0);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ Status of the ROM tests in the emulated games:
|
||||
Chequered Flag pass
|
||||
Ajax / Typhoon pass
|
||||
Super Contra pass
|
||||
Over Drive fails 16..20 (053250)
|
||||
Over Drive pass
|
||||
The Main Event pass
|
||||
Missing in Action pass
|
||||
Crime Fighters pass
|
||||
@ -3312,929 +3312,6 @@ void K054338_export_config(int **shdRGB)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* 053250 */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
struct K053250_CHIPTAG
|
||||
{
|
||||
UINT8 regs[8];
|
||||
UINT8 *base;
|
||||
UINT16 *ram, *rammax;
|
||||
UINT16 *buffer[2];
|
||||
UINT32 rommask;
|
||||
int page[2];
|
||||
int frame, offsx, offsy;
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
int chips;
|
||||
struct K053250_CHIPTAG chip[2];
|
||||
} K053250_info;
|
||||
|
||||
void K053250_set_LayerOffset(int chip, int offsx, int offsy)
|
||||
{
|
||||
K053250_info.chip[chip].offsx = offsx;
|
||||
K053250_info.chip[chip].offsy = offsy;
|
||||
}
|
||||
|
||||
// The DMA process should be instantaneous but since rendering in MAME is performed at SCREEN_UPDATE()
|
||||
// the K053250 memory must be buffered to maintain visual integrity.
|
||||
static void K053250_dma(running_machine &machine, int chip, int limiter)
|
||||
{
|
||||
struct K053250_CHIPTAG *chip_ptr;
|
||||
int last_frame, current_frame;
|
||||
|
||||
chip_ptr = &K053250_info.chip[chip];
|
||||
|
||||
current_frame = machine.primary_screen->frame_number();
|
||||
last_frame = chip_ptr->frame;
|
||||
|
||||
if (limiter && current_frame == last_frame) return; // make sure we only do DMA transfer once per frame
|
||||
|
||||
chip_ptr->frame = current_frame;
|
||||
memcpy(chip_ptr->buffer[chip_ptr->page[chip]], chip_ptr->ram, 0x1000);
|
||||
chip_ptr->page[chip] ^= 1;
|
||||
}
|
||||
|
||||
// Pixel data of the K053250 is nibble packed. It's preferable to be unpacked into byte format.
|
||||
void K053250_unpack_pixels(running_machine &machine, const char *src_region, const char *dst_region)
|
||||
{
|
||||
UINT8 *src_ptr, *dst_ptr;
|
||||
int hi_nibble, lo_nibble, offset;
|
||||
|
||||
dst_ptr = src_ptr = machine.region(dst_region)->base();
|
||||
offset = machine.region(src_region)->bytes() / 2 - 1;
|
||||
|
||||
do
|
||||
{
|
||||
lo_nibble = hi_nibble = src_ptr[offset];
|
||||
hi_nibble >>= 4;
|
||||
lo_nibble &= 0xf;
|
||||
dst_ptr[offset*2 ] = hi_nibble;
|
||||
dst_ptr[offset*2+1] = lo_nibble;
|
||||
}
|
||||
while ((--offset) >= 0);
|
||||
}
|
||||
|
||||
void K053250_vh_start(running_machine &machine, int chips, const char **region)
|
||||
{
|
||||
UINT16 *ram;
|
||||
int chip;
|
||||
|
||||
K053250_info.chips = chips;
|
||||
|
||||
for(chip=0; chip<chips; chip++)
|
||||
{
|
||||
K053250_info.chip[chip].base = machine.region(region[chip])->base();
|
||||
ram = auto_alloc_array(machine, UINT16, 0x6000/2);
|
||||
K053250_info.chip[chip].ram = ram;
|
||||
K053250_info.chip[chip].rammax = ram + 0x800;
|
||||
K053250_info.chip[chip].buffer[0] = ram + 0x2000;
|
||||
K053250_info.chip[chip].buffer[1] = ram + 0x2800;
|
||||
memset(ram+0x2000, 0, 0x2000);
|
||||
K053250_info.chip[chip].rommask = machine.region(region[chip])->bytes();
|
||||
K053250_info.chip[chip].page[1] = K053250_info.chip[chip].page[0] = 0;
|
||||
K053250_info.chip[chip].offsy = K053250_info.chip[chip].offsx = 0;
|
||||
K053250_info.chip[chip].frame = -1;
|
||||
|
||||
state_save_register_item_pointer(machine, "K053250", NULL, chip, K053250_info.chip[chip].ram, 0x800);
|
||||
state_save_register_item_array(machine, "K053250", NULL, chip, K053250_info.chip[chip].regs);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( K053250_0_w )
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
// start LVC DMA transfer at the falling edge of control register's bit1
|
||||
if (offset == 4 && !(data & 2) && (K053250_info.chip[0].regs[4] & 2)) K053250_dma(space->machine(), 0, 1);
|
||||
|
||||
K053250_info.chip[0].regs[offset] = data;
|
||||
}
|
||||
}
|
||||
|
||||
READ16_HANDLER( K053250_0_r )
|
||||
{
|
||||
return K053250_info.chip[0].regs[offset];
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( K053250_0_ram_w )
|
||||
{
|
||||
COMBINE_DATA( K053250_info.chip[0].ram + offset);
|
||||
}
|
||||
|
||||
READ16_HANDLER( K053250_0_ram_r )
|
||||
{
|
||||
return K053250_info.chip[0].ram[offset];
|
||||
}
|
||||
|
||||
READ16_HANDLER( K053250_0_rom_r )
|
||||
{
|
||||
// if (!(K053250_info.chip[0].regs[5] & 1)) logerror("Back: Reading rom memory with enable=0\n");
|
||||
|
||||
return *(K053250_info.chip[0].base + 0x80000*K053250_info.chip[0].regs[6] + 0x800*K053250_info.chip[0].regs[7] + (offset>>1));
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
WRITE16_HANDLER( K053250_1_w )
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
// start LVC DMA transfer at the falling edge of control register's bit1
|
||||
if (offset == 4 && !(data & 2) && (K053250_info.chip[1].regs[4] & 2)) K053250_dma(space->machine(), 1, 1);
|
||||
|
||||
K053250_info.chip[1].regs[offset] = data;
|
||||
}
|
||||
}
|
||||
|
||||
READ16_HANDLER( K053250_1_r )
|
||||
{
|
||||
return K053250_info.chip[1].regs[offset];
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( K053250_1_ram_w )
|
||||
{
|
||||
COMBINE_DATA( K053250_info.chip[1].ram + offset);
|
||||
}
|
||||
|
||||
READ16_HANDLER( K053250_1_ram_r )
|
||||
{
|
||||
return K053250_info.chip[1].ram[offset];
|
||||
}
|
||||
|
||||
READ16_HANDLER( K053250_1_rom_r )
|
||||
{
|
||||
// if (!(K053250_info.chip[1].regs[5] & 1)) logerror("Back: Reading rom memory with enable=0\n");
|
||||
|
||||
return *(K053250_info.chip[1].base + 0x80000*K053250_info.chip[1].regs[6] + 0x800*K053250_info.chip[1].regs[7] + (offset>>1));
|
||||
}
|
||||
|
||||
|
||||
static void K053250_pdraw_scanline8(
|
||||
bitmap_t *bitmap,int x,int y,int length,
|
||||
const UINT8 *src,pen_t *pens,int transparent_pen,UINT32 orient,bitmap_t *priority,UINT8 pri)
|
||||
{
|
||||
/* 8bpp destination */
|
||||
if (bitmap->bpp == 8)
|
||||
{
|
||||
/* adjust in case we're oddly oriented */
|
||||
ADJUST_FOR_ORIENTATION(UINT8, orient, bitmap, priority, x, y);
|
||||
|
||||
/* with pen lookups */
|
||||
if (pens)
|
||||
{
|
||||
if (transparent_pen == -1)
|
||||
while (length--)
|
||||
{
|
||||
*dsti = pens[*src++];
|
||||
*dstp = pri;
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
else
|
||||
while (length--)
|
||||
{
|
||||
UINT32 spixel = *src++;
|
||||
if (spixel != transparent_pen)
|
||||
{
|
||||
*dsti = pens[spixel];
|
||||
*dstp = pri;
|
||||
}
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
}
|
||||
|
||||
/* without pen lookups */
|
||||
else
|
||||
{
|
||||
if (transparent_pen == -1)
|
||||
while (length--)
|
||||
{
|
||||
*dsti = *src++;
|
||||
*dstp = pri;
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
else
|
||||
while (length--)
|
||||
{
|
||||
UINT32 spixel = *src++;
|
||||
if (spixel != transparent_pen)
|
||||
{
|
||||
*dsti = spixel;
|
||||
*dstp = pri;
|
||||
}
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 16bpp destination */
|
||||
else if(bitmap->bpp == 16)
|
||||
{
|
||||
/* adjust in case we're oddly oriented */
|
||||
ADJUST_FOR_ORIENTATION(UINT16, orient, bitmap, priority, x, y);
|
||||
/* with pen lookups */
|
||||
if (pens)
|
||||
{
|
||||
if (transparent_pen == -1)
|
||||
while (length--)
|
||||
{
|
||||
*dsti = pens[*src++];
|
||||
*dstp = pri;
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
else
|
||||
while (length--)
|
||||
{
|
||||
UINT32 spixel = *src++;
|
||||
if (spixel != transparent_pen)
|
||||
{
|
||||
*dsti = pens[spixel];
|
||||
*dstp = pri;
|
||||
}
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
}
|
||||
|
||||
/* without pen lookups */
|
||||
else
|
||||
{
|
||||
if (transparent_pen == -1)
|
||||
while (length--)
|
||||
{
|
||||
*dsti = *src++;
|
||||
*dstp = pri;
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
else
|
||||
while (length--)
|
||||
{
|
||||
UINT32 spixel = *src++;
|
||||
if (spixel != transparent_pen)
|
||||
{
|
||||
*dsti = spixel;
|
||||
*dstp = pri;
|
||||
}
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 32bpp destination */
|
||||
else
|
||||
{
|
||||
/* adjust in case we're oddly oriented */
|
||||
ADJUST_FOR_ORIENTATION(UINT32, orient, bitmap, priority, x, y);
|
||||
/* with pen lookups */
|
||||
if (pens)
|
||||
{
|
||||
if (transparent_pen == -1)
|
||||
while (length--)
|
||||
{
|
||||
*dsti = pens[*src++];
|
||||
*dstp = pri;
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
else
|
||||
while (length--)
|
||||
{
|
||||
UINT32 spixel = *src++;
|
||||
if (spixel != transparent_pen)
|
||||
{
|
||||
*dsti = pens[spixel];
|
||||
*dstp = pri;
|
||||
}
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
}
|
||||
|
||||
/* without pen lookups */
|
||||
else
|
||||
{
|
||||
if (transparent_pen == -1)
|
||||
while (length--)
|
||||
{
|
||||
*dsti = *src++;
|
||||
*dstp = pri;
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
else
|
||||
while (length--)
|
||||
{
|
||||
UINT32 spixel = *src++;
|
||||
if (spixel != transparent_pen)
|
||||
{
|
||||
*dsti = spixel;
|
||||
*dstp = pri;
|
||||
}
|
||||
dsti += xadv;
|
||||
dstp += xadv;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void K053250_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int chip, int colorbase, int pri)
|
||||
{
|
||||
static int pmode[2] = {-1,-1};
|
||||
static int kc=-1, kk=0, kxx=-105, kyy=0;
|
||||
|
||||
const rectangle area = *machine.primary_screen->visible_area();
|
||||
UINT16 *line;
|
||||
int delta, dim1, dim1_max, dim2_max;
|
||||
UINT32 mask1, mask2;
|
||||
int sp;
|
||||
#if 1
|
||||
int orientation = ((K053250_info.chip[chip].regs[4] & 8) ? ORIENTATION_FLIP_X : 0)
|
||||
| ((K053250_info.chip[chip].regs[4] & 16) ? ORIENTATION_FLIP_Y : 0)
|
||||
| ((K053250_info.chip[chip].regs[4] & 1) ? 0 : ORIENTATION_SWAP_XY);
|
||||
#else
|
||||
int orientation = (!K053250_info.chip[chip].regs[4] & 8 ? ORIENTATION_FLIP_X : 0)
|
||||
| (K053250_info.chip[chip].regs[4] & 16 ? ORIENTATION_FLIP_Y : 0)
|
||||
| (!(K053250_info.chip[chip].regs[4] & 1) ? 0 : ORIENTATION_SWAP_XY);
|
||||
#endif
|
||||
|
||||
INT16 cur_x = (K053250_info.chip[chip].regs[0] << 8) | K053250_info.chip[chip].regs[1];
|
||||
INT16 cur_y = (K053250_info.chip[chip].regs[2] << 8) | K053250_info.chip[chip].regs[3];
|
||||
|
||||
if(pmode[chip] != K053250_info.chip[chip].regs[4]) {
|
||||
pmode[chip] = K053250_info.chip[chip].regs[4];
|
||||
#if 0
|
||||
fprintf(stderr, "NEW MODE %d %02x [%x %c%c%c%c%c]\n", chip,
|
||||
pmode[chip],
|
||||
pmode[chip] >> 5,
|
||||
pmode[chip] & 16 ? 'y' : '-',
|
||||
pmode[chip] & 8 ? 'x' : '-',
|
||||
pmode[chip] & 4 ? 'w' : '-',
|
||||
pmode[chip] & 2 ? '?' : '-',
|
||||
pmode[chip] & 1 ? 's' : '-');
|
||||
#endif
|
||||
}
|
||||
|
||||
colorbase <<= 4;
|
||||
|
||||
if(orientation & ORIENTATION_SWAP_XY) {
|
||||
dim1_max = area.max_x - area.min_x + 1;
|
||||
dim2_max = area.max_y - area.min_y + 1;
|
||||
// -358 for level 1 boss, huh? -495
|
||||
if(orientation & ORIENTATION_FLIP_Y)
|
||||
delta = 238 - cur_y;
|
||||
else
|
||||
delta = kyy + cur_y;
|
||||
line = K053250_info.chip[chip].ram + (((area.min_x + cur_x + kxx) & 0x1ff) << 2);
|
||||
} else {
|
||||
dim1_max = area.max_y - area.min_y + 1;
|
||||
dim2_max = area.max_x - area.min_x + 1;
|
||||
delta = cur_x + 49;
|
||||
line = K053250_info.chip[chip].ram + (((area.min_y + cur_y + 16) & 0x1ff) << 2);
|
||||
}
|
||||
|
||||
if(chip && ++kk == 3) {
|
||||
int kx=0, kkc = 0;
|
||||
kk = 0;
|
||||
if(input_code_pressed(machine, KEYCODE_Y)) {
|
||||
kx = 1;
|
||||
kc--;
|
||||
if(kc<-1)
|
||||
kc = 511;
|
||||
}
|
||||
if(input_code_pressed(machine, KEYCODE_U)) {
|
||||
kx = 1;
|
||||
kc++;
|
||||
if(kc==512)
|
||||
kc = -1;
|
||||
}
|
||||
|
||||
if(input_code_pressed(machine, KEYCODE_T)) {
|
||||
kkc = 1;
|
||||
kyy--;
|
||||
}
|
||||
if(input_code_pressed(machine, KEYCODE_V)) {
|
||||
kkc = 1;
|
||||
kyy++;
|
||||
}
|
||||
if(input_code_pressed(machine, KEYCODE_F)) {
|
||||
kkc = 1;
|
||||
kxx--;
|
||||
}
|
||||
if(input_code_pressed(machine, KEYCODE_G)) {
|
||||
kkc = 1;
|
||||
kxx++;
|
||||
}
|
||||
#if 0
|
||||
if(kx) {
|
||||
UINT16 *l1 = line + ((4*kc) & 0x7ff);
|
||||
popmessage("Line %d [%02x] (%04x %04x %04x %04x)", kc,
|
||||
K053250_info.chip[chip].regs[4],
|
||||
l1[0],
|
||||
l1[1],
|
||||
l1[2],
|
||||
l1[3]);
|
||||
}
|
||||
|
||||
if(kkc)
|
||||
popmessage("(%d, %d)", kxx, kyy);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
switch(K053250_info.chip[chip].regs[4] >> 5) {
|
||||
case 0: // Not sure. Warp level
|
||||
mask1 = 0xffff0000;
|
||||
mask2 = 0x0000ffff;
|
||||
sp = 0;
|
||||
break;
|
||||
case 1: // Elaine's background
|
||||
mask1 = 0xffff8000;
|
||||
mask2 = 0x00007fff;
|
||||
sp = 0;
|
||||
break;
|
||||
case 2:
|
||||
mask1 = 0xffff0000;
|
||||
mask2 = 0x0000ffff;
|
||||
sp = 0;
|
||||
break;
|
||||
case 4: // Level 1 boss, water level (planet)
|
||||
mask1 = 0xffffc000;
|
||||
mask2 = 0x00003fff;
|
||||
sp = 0;
|
||||
break;
|
||||
case 7: // Organic level
|
||||
mask1 = 0xffff0000;
|
||||
mask2 = 0x0000ffff;
|
||||
sp = 1;
|
||||
break;
|
||||
default:
|
||||
// logerror("Unknown mode %02x\n", K053250_info.chip[chip].regs[4] & 0xe0);
|
||||
mask1 = 0xffff0000;
|
||||
mask2 = 0x0000ffff;
|
||||
sp = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(K053250_info.chip[chip].regs[4] & 4)
|
||||
mask1 = 0;
|
||||
|
||||
for(dim1 = 0; dim1 < dim1_max; dim1++) {
|
||||
UINT16 color = *line++;
|
||||
UINT16 start = *line++;
|
||||
UINT16 inc = *line++;
|
||||
INT16 offset = *line++;
|
||||
int dim2;
|
||||
UINT8 *pixel;
|
||||
UINT32 cpos;
|
||||
UINT8 scanline[512];
|
||||
UINT8 *gbase = K053250_info.chip[chip].base + (((start & 0xff00) << 7) % K053250_info.chip[chip].rommask);
|
||||
|
||||
if(offset >= 0x500)
|
||||
offset -= 0x800;
|
||||
|
||||
if(line == K053250_info.chip[chip].rammax)
|
||||
line = K053250_info.chip[chip].ram;
|
||||
|
||||
if(!color && !start)
|
||||
continue;
|
||||
|
||||
pixel = scanline;
|
||||
start = (start & 0xff) << 7;
|
||||
cpos = (offset + delta)*inc;
|
||||
// fprintf(stderr, "%3d %08x %04x\n", dim1, cpos, inc);
|
||||
|
||||
for(dim2 = 0; dim2 < dim2_max; dim2++) {
|
||||
int romp;
|
||||
UINT32 rcpos = cpos;
|
||||
|
||||
if(sp && (rcpos & mask1))
|
||||
rcpos += inc << 9;
|
||||
|
||||
if(rcpos & mask1) {
|
||||
*pixel++ = 0;
|
||||
cpos += inc;
|
||||
continue;
|
||||
}
|
||||
|
||||
romp = gbase[(((rcpos & mask2)>>7) + start) & 0x7fff];
|
||||
|
||||
if(rcpos & 0x40)
|
||||
romp &= 0xf;
|
||||
else
|
||||
romp >>= 4;
|
||||
*pixel++ = romp;
|
||||
cpos += inc;
|
||||
}
|
||||
if(orientation & ORIENTATION_SWAP_XY)
|
||||
K053250_pdraw_scanline8(bitmap, area.min_y, area.min_x+dim1, dim2_max, scanline,
|
||||
machine.pens + ((dim1 == kc ? 0x200 : colorbase) | ((color & 0x0f) << 4)),
|
||||
0, orientation, pri);
|
||||
else
|
||||
K053250_pdraw_scanline8(bitmap, area.min_x, area.min_y+dim1, dim2_max, scanline,
|
||||
machine.pens + ((dim1 == kc ? 0x200 : colorbase) | ((color & 0x0f) << 4)),
|
||||
0, orientation, pri);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// utility function to render a clipped scanline vertically or horizontally
|
||||
INLINE void K053250_pdraw_scanline32(bitmap_t *bitmap, const pen_t *palette, UINT8 *source,
|
||||
const rectangle *cliprect, int linepos, int scroll, int zoom,
|
||||
UINT32 clipmask, UINT32 wrapmask, UINT32 orientation, bitmap_t *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))
|
||||
|
||||
int end_pixel, flip, dst_min, dst_max, dst_start, dst_length;
|
||||
|
||||
UINT32 src_wrapmask;
|
||||
UINT8 *src_base;
|
||||
//int src_x;
|
||||
int src_fx, src_fdx;
|
||||
int pix_data, dst_offset;
|
||||
const pen_t *pal_base;
|
||||
UINT8 *pri_base;
|
||||
UINT32 *dst_base;
|
||||
int dst_adv;
|
||||
|
||||
// flip X and flip Y also switch role when the X Y coordinates are swapped
|
||||
if (!(orientation & ORIENTATION_SWAP_XY))
|
||||
{
|
||||
flip = orientation & ORIENTATION_FLIP_X;
|
||||
dst_min = cliprect->min_x;
|
||||
dst_max = cliprect->max_x;
|
||||
}
|
||||
else
|
||||
{
|
||||
flip = orientation & ORIENTATION_FLIP_Y;
|
||||
dst_min = cliprect->min_y;
|
||||
dst_max = cliprect->max_y;
|
||||
}
|
||||
|
||||
if (clipmask)
|
||||
{
|
||||
// reject scanlines that are outside of the target bitmap's right(bottom) clip boundary
|
||||
dst_start = -scroll;
|
||||
if (dst_start > dst_max) return;
|
||||
|
||||
// calculate target length
|
||||
dst_length = clipmask + 1;
|
||||
if (zoom) dst_length = (dst_length << 6) / zoom;
|
||||
|
||||
// reject scanlines that are outside of the target bitmap's left(top) clip boundary
|
||||
end_pixel = dst_start + dst_length - 1;
|
||||
if (end_pixel < dst_min) return;
|
||||
|
||||
// clip scanline tail
|
||||
if ((end_pixel -= dst_max) > 0) dst_length -= end_pixel;
|
||||
|
||||
// reject zero-length scanlines
|
||||
if (dst_length <= 0) return;
|
||||
|
||||
// calculate zoom factor
|
||||
src_fdx = zoom << (FIXPOINT_PRECISION-6);
|
||||
|
||||
// clip scanline head
|
||||
end_pixel = dst_min;
|
||||
if ((end_pixel -= dst_start) > 0)
|
||||
{
|
||||
// chop scanline to the correct length and move target start location to the left(top) clip boundary
|
||||
dst_length -= end_pixel;
|
||||
dst_start = dst_min;
|
||||
|
||||
// and skip the source for the left(top) clip region
|
||||
src_fx = end_pixel * src_fdx + FIXPOINT_PRECISION_HALF;
|
||||
}
|
||||
else
|
||||
// the point five bias is to ensure even distribution of stretched or shrinked pixels
|
||||
src_fx = FIXPOINT_PRECISION_HALF;
|
||||
|
||||
// adjust flipped source
|
||||
if (flip)
|
||||
{
|
||||
// start from the target's clipped end if the scanline is flipped
|
||||
dst_start = dst_max + dst_min - dst_start - (dst_length-1);
|
||||
|
||||
// and move source start location to the opposite end
|
||||
src_fx += (dst_length-1) * src_fdx - 1;
|
||||
src_fdx = -src_fdx;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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
|
||||
src_fdx = zoom << (FIXPOINT_PRECISION-6);
|
||||
|
||||
// pre-advance source for the clipped region
|
||||
if (!flip)
|
||||
src_fx = (scroll + dst_min) * src_fdx + FIXPOINT_PRECISION_HALF;
|
||||
else
|
||||
{
|
||||
src_fx = (scroll + dst_max) * src_fdx + FIXPOINT_PRECISION_HALF-1;
|
||||
src_fdx = -src_fdx;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(orientation & ORIENTATION_SWAP_XY))
|
||||
{
|
||||
// calculate target increment for horizontal scanlines which is exactly one
|
||||
dst_adv = 1;
|
||||
dst_offset = dst_length;
|
||||
pri_base = BITMAP_ADDR8(priority, linepos, dst_start + dst_offset);
|
||||
dst_base = BITMAP_ADDR32(bitmap, linepos, dst_start + dst_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
// calculate target increment for vertical scanlines which is the bitmap's pitch value
|
||||
dst_adv = bitmap->rowpixels;
|
||||
dst_offset= dst_length * dst_adv;
|
||||
pri_base = BITMAP_ADDR8(priority, dst_start, linepos + dst_offset);
|
||||
dst_base = BITMAP_ADDR32(bitmap, dst_start, linepos + dst_offset);
|
||||
}
|
||||
|
||||
// generalized
|
||||
src_base = source;
|
||||
//src_x = 0;
|
||||
|
||||
// there is no need to wrap source offsets along with source clipping
|
||||
// so we set all bits of the wrapmask to one
|
||||
src_wrapmask = (clipmask) ? ~0 : wrapmask;
|
||||
|
||||
pal_base = palette;
|
||||
dst_offset = -dst_offset; // negate target offset in order to terminated draw loop at zero condition
|
||||
|
||||
if (pri)
|
||||
{
|
||||
// draw scanline and update priority bitmap
|
||||
do
|
||||
{
|
||||
pix_data = src_base[(src_fx>>FIXPOINT_PRECISION) & src_wrapmask];
|
||||
src_fx += src_fdx;
|
||||
|
||||
if (pix_data)
|
||||
{
|
||||
pix_data = pal_base[pix_data];
|
||||
pri_base[dst_offset] = pri;
|
||||
dst_base[dst_offset] = pix_data;
|
||||
}
|
||||
}
|
||||
while (dst_offset += dst_adv);
|
||||
}
|
||||
else
|
||||
{
|
||||
// draw scanline but do not update priority bitmap
|
||||
do
|
||||
{
|
||||
pix_data = src_base[(src_fx>>FIXPOINT_PRECISION) & src_wrapmask];
|
||||
src_fx += src_fdx;
|
||||
|
||||
if (pix_data)
|
||||
{
|
||||
dst_base[dst_offset] = pal_base[pix_data];
|
||||
}
|
||||
}
|
||||
while (dst_offset += dst_adv);
|
||||
}
|
||||
|
||||
#undef FIXPOINT_PRECISION
|
||||
#undef FIXPOINT_PRECISION_HALF
|
||||
}
|
||||
|
||||
void K053250_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int chip, int colorbase, int flags, int priority)
|
||||
{
|
||||
struct K053250_CHIPTAG *chip_ptr;
|
||||
UINT16 *line_ram;
|
||||
UINT8 *pix_base, *pix_ptr, *regs;
|
||||
const pen_t *pal_base, *pal_ptr;
|
||||
UINT32 rommask, src_clipmask, src_wrapmask, dst_wrapmask;
|
||||
int map_scrollx, map_scrolly, ctrl, orientation;
|
||||
int dst_minx, dst_maxx, dst_miny, dst_maxy;
|
||||
int linedata_offs, linedata_adv, line_pos, line_start, line_end, scroll_corr;
|
||||
int color, offset, zoom, scroll, passes, i, dst_height;
|
||||
|
||||
chip_ptr = &K053250_info.chip[chip]; // pointer to chip parameters
|
||||
line_ram = chip_ptr->buffer[chip_ptr->page[chip]]; // pointer to physical line RAM
|
||||
pix_base = chip_ptr->base; // pointer to source pixel ROM
|
||||
rommask = chip_ptr->rommask; // source ROM limit
|
||||
regs = chip_ptr->regs; // pointer to registers group
|
||||
|
||||
map_scrollx = (short)(regs[0]<<8 | regs[1]); // signed horizontal scroll value
|
||||
map_scrolly = (short)(regs[2]<<8 | regs[3]); // signed vertical scroll value
|
||||
map_scrollx -= chip_ptr->offsx; // add user X offset to horizontal scroll
|
||||
map_scrolly -= chip_ptr->offsy; // add user Y offset to vertical scroll
|
||||
ctrl = regs[4]; // register four is the main control register
|
||||
|
||||
// copy visible boundary values to more accessible locations
|
||||
dst_minx = cliprect->min_x;
|
||||
dst_maxx = cliprect->max_x;
|
||||
dst_miny = cliprect->min_y;
|
||||
dst_maxy = cliprect->max_y;
|
||||
|
||||
orientation = 0; // orientation defaults to no swapping and no flipping
|
||||
dst_height = 512; // virtual bitmap height defaults to five hundred and twelve pixels
|
||||
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;
|
||||
|
||||
// invert X parameters when the forth bit of the control register is set
|
||||
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;
|
||||
|
||||
switch (ctrl>>5) // the upper four bits of the control register select source and target dimensions
|
||||
{
|
||||
case 0 :
|
||||
// Xexex: L6 galaxies
|
||||
// Metam: L4 forest, L5 arena, L6 tower interior, final boss
|
||||
|
||||
// crop source offset between zero and two hundred and fifty-five inclusive,
|
||||
// and set virtual bitmap height to two hundred and fifty-six pixels
|
||||
src_wrapmask = src_clipmask = 0xff;
|
||||
dst_height = 0x100;
|
||||
break;
|
||||
case 1 :
|
||||
// Xexex: prologue, L7 nebulae
|
||||
|
||||
// the source offset is cropped to zero and five hundred and eleven inclusive
|
||||
src_wrapmask = src_clipmask = 0x1ff;
|
||||
break;
|
||||
case 4 :
|
||||
// Xexex: L1 sky and boss, L3 planet, L5 poly-face, L7 battle ship patches
|
||||
// Metam: L1 summoning circle, L3 caves, L6 gargoyle towers
|
||||
|
||||
// crop source offset between zero and two hundred and fifty-five inclusive,
|
||||
// and allow source offset to wrap back at 500 hexadecimal to minus 300 hexadecimal
|
||||
src_wrapmask = src_clipmask = 0xff;
|
||||
flags |= K053250_WRAP500;
|
||||
break;
|
||||
// case 2 : // Xexex: title
|
||||
// case 7 : // Xexex: L4 organic stage
|
||||
default:
|
||||
|
||||
// crop source offset between zero and one thousand and eleven inclusive,
|
||||
// keep other dimensions to their defaults
|
||||
src_wrapmask = src_clipmask = 0x3ff;
|
||||
break;
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
if (orientation & ORIENTATION_FLIP_Y)
|
||||
{
|
||||
scroll_corr = 0x100 - scroll_corr; // apply common vertical correction
|
||||
|
||||
// Y correction (ref: 1st and 5th boss)
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
if (src_clipmask)
|
||||
{
|
||||
// determine target wrap boundary and draw scanline in two passes if the source is clipped
|
||||
dst_wrapmask = dst_height - 1;
|
||||
passes = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise disable target wraparound and draw scanline in a single pass
|
||||
dst_wrapmask = ~0;
|
||||
passes = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
// 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
|
||||
|
||||
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
|
||||
|
||||
// calculate physical palette location
|
||||
// there can be thirty-two color codes and each code represents sixteen pens
|
||||
pal_ptr = pal_base + ((color & 0x1f)<<4);
|
||||
|
||||
// calculate physical pixel location
|
||||
// each offset unit represents two hundred and fifty six pixels and should wrap at ROM boundary for safty
|
||||
pix_ptr = pix_base + (offset<<8) % rommask;
|
||||
|
||||
// get scanline zoom factor
|
||||
// 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];
|
||||
|
||||
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 (flags & K053250_WRAP500 && scroll >= 0x500) scroll -= 0x800;
|
||||
|
||||
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
|
||||
i = passes;
|
||||
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
|
||||
*/
|
||||
K053250_pdraw_scanline32(bitmap, pal_ptr, pix_ptr, cliprect,
|
||||
line_pos, scroll, zoom, src_clipmask, src_wrapmask, orientation, machine.priority_bitmap, (UINT8)priority);
|
||||
|
||||
// shift scanline position one virtual screen upward to render the wrapped end if necessary
|
||||
scroll -= dst_height;
|
||||
}
|
||||
while (--i);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* 053252 */
|
||||
|
@ -193,23 +193,6 @@ void K054338_export_config(int **shdRGB);
|
||||
#define K338_CTL_WAILSL 0x10
|
||||
#define K338_CTL_CLIPSL 0x20
|
||||
|
||||
void K053250_vh_start(running_machine &machine, int chips, const char **region);
|
||||
WRITE16_HANDLER( K053250_0_w );
|
||||
READ16_HANDLER( K053250_0_r );
|
||||
WRITE16_HANDLER( K053250_0_ram_w );
|
||||
READ16_HANDLER( K053250_0_ram_r );
|
||||
READ16_HANDLER( K053250_0_rom_r );
|
||||
|
||||
|
||||
// K053250_draw() control flags
|
||||
#define K053250_WRAP500 0x01
|
||||
#define K053250_OVERDRIVE 0x02
|
||||
|
||||
void K053250_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int chip, int colorbase, int flags, int pri);
|
||||
void K053250_set_LayerOffset(int chip, int offsx, int offsy);
|
||||
void K053250_unpack_pixels(running_machine &machine, const char *src_region, const char *dst_region);
|
||||
|
||||
|
||||
// K053252 CRT and interrupt control unit
|
||||
WRITE16_HANDLER( K053252_word_w );
|
||||
|
||||
|
@ -163,7 +163,7 @@ Status of the ROM tests in the emulated games:
|
||||
Chequered Flag pass
|
||||
Ajax / Typhoon pass
|
||||
Super Contra pass
|
||||
Over Drive fails 16..20 (053250)
|
||||
Over Drive pass
|
||||
The Main Event pass
|
||||
Missing in Action pass
|
||||
Crime Fighters pass
|
||||
@ -8409,565 +8409,6 @@ static DEVICE_RESET( k054338 )
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* 053250 */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
typedef struct _k053250_state k053250_state;
|
||||
struct _k053250_state
|
||||
{
|
||||
UINT8 regs[8];
|
||||
UINT8 *base;
|
||||
UINT16 *ram, *rammax;
|
||||
UINT16 *buffer[2];
|
||||
UINT32 rommask;
|
||||
UINT8 *packed;
|
||||
UINT32 packedmask;
|
||||
int page;
|
||||
int frame, offsx, offsy;
|
||||
|
||||
screen_device *screen;
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
INLINE FUNCTIONS
|
||||
*****************************************************************************/
|
||||
|
||||
INLINE k053250_state *k053250_get_safe_token( device_t *device )
|
||||
{
|
||||
assert(device != NULL);
|
||||
assert(device->type() == K053250);
|
||||
|
||||
return (k053250_state *)downcast<legacy_device_base *>(device)->token();
|
||||
}
|
||||
|
||||
INLINE const k053250_interface *k053250_get_interface( device_t *device )
|
||||
{
|
||||
assert(device != NULL);
|
||||
assert((device->type() == K053250));
|
||||
return (const k053250_interface *) device->static_config();
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
DEVICE HANDLERS
|
||||
*****************************************************************************/
|
||||
|
||||
// The DMA process should be instantaneous but since rendering in MAME is performed at SCREEN_UPDATE()
|
||||
// the k053250 memory must be buffered to maintain visual integrity.
|
||||
void k053250_dma( device_t *device, int limiter )
|
||||
{
|
||||
k053250_state *k053250 = k053250_get_safe_token(device);
|
||||
int last_frame, current_frame;
|
||||
|
||||
current_frame = k053250->screen->frame_number();
|
||||
last_frame = k053250->frame;
|
||||
|
||||
if (limiter && current_frame == last_frame)
|
||||
return; // make sure we only do DMA transfer once per frame
|
||||
|
||||
k053250->frame = current_frame;
|
||||
memcpy(k053250->buffer[k053250->page], k053250->ram, 0x1000);
|
||||
k053250->page ^= 1;
|
||||
}
|
||||
|
||||
WRITE16_DEVICE_HANDLER( k053250_w )
|
||||
{
|
||||
k053250_state *k053250 = k053250_get_safe_token(device);
|
||||
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
// start LVC DMA transfer at the falling edge of control register's bit1
|
||||
if (offset == 4 && !(data & 2) && (k053250->regs[4] & 2))
|
||||
k053250_dma(device, 1);
|
||||
|
||||
k053250->regs[offset] = data;
|
||||
}
|
||||
}
|
||||
|
||||
READ16_DEVICE_HANDLER( k053250_r )
|
||||
{
|
||||
k053250_state *k053250 = k053250_get_safe_token(device);
|
||||
return k053250->regs[offset];
|
||||
}
|
||||
|
||||
WRITE16_DEVICE_HANDLER( k053250_ram_w )
|
||||
{
|
||||
k053250_state *k053250 = k053250_get_safe_token(device);
|
||||
COMBINE_DATA(k053250->ram + offset);
|
||||
}
|
||||
|
||||
READ16_DEVICE_HANDLER( k053250_ram_r )
|
||||
{
|
||||
k053250_state *k053250 = k053250_get_safe_token(device);
|
||||
return k053250->ram[offset];
|
||||
}
|
||||
|
||||
READ16_DEVICE_HANDLER( k053250_rom_r )
|
||||
{
|
||||
k053250_state *k053250 = k053250_get_safe_token(device);
|
||||
|
||||
return *(k053250->packed + 0x80000 * k053250->regs[6] + 0x800 * k053250->regs[7] + offset);
|
||||
}
|
||||
|
||||
|
||||
// Pixel data of the k053250 is nibble packed. It's preferable to be unpacked into byte format.
|
||||
static void k053250_unpack_pixels(running_machine &machine, const char *src_region, const char *dst_region)
|
||||
{
|
||||
UINT8 *src_ptr, *dst_ptr;
|
||||
int hi_nibble, lo_nibble, offset;
|
||||
|
||||
dst_ptr = machine.region(dst_region)->base();
|
||||
src_ptr = machine.region(src_region)->base();
|
||||
offset = machine.region(dst_region)->bytes() / 2 - 1;
|
||||
|
||||
do
|
||||
{
|
||||
lo_nibble = hi_nibble = src_ptr[offset];
|
||||
hi_nibble >>= 4;
|
||||
lo_nibble &= 0xf;
|
||||
dst_ptr[offset * 2 ] = hi_nibble;
|
||||
dst_ptr[offset * 2 + 1] = lo_nibble;
|
||||
}
|
||||
while ((--offset) >= 0);
|
||||
}
|
||||
|
||||
|
||||
// utility function to render a clipped scanline vertically or horizontally
|
||||
INLINE void k053250_pdraw_scanline32(bitmap_t *bitmap, const pen_t *palette, UINT8 *source,
|
||||
const rectangle *cliprect, int linepos, int scroll, int zoom,
|
||||
UINT32 clipmask, UINT32 wrapmask, UINT32 orientation, bitmap_t *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))
|
||||
|
||||
int end_pixel, flip, dst_min, dst_max, dst_start, dst_length;
|
||||
|
||||
UINT32 src_wrapmask;
|
||||
UINT8 *src_base;
|
||||
//int src_x;
|
||||
int src_fx, src_fdx;
|
||||
int pix_data, dst_offset;
|
||||
const pen_t *pal_base;
|
||||
UINT8 *pri_base;
|
||||
UINT32 *dst_base;
|
||||
int dst_adv;
|
||||
|
||||
// flip X and flip Y also switch role when the X Y coordinates are swapped
|
||||
if (!(orientation & ORIENTATION_SWAP_XY))
|
||||
{
|
||||
flip = orientation & ORIENTATION_FLIP_X;
|
||||
dst_min = cliprect->min_x;
|
||||
dst_max = cliprect->max_x;
|
||||
}
|
||||
else
|
||||
{
|
||||
flip = orientation & ORIENTATION_FLIP_Y;
|
||||
dst_min = cliprect->min_y;
|
||||
dst_max = cliprect->max_y;
|
||||
}
|
||||
|
||||
if (clipmask)
|
||||
{
|
||||
// reject scanlines that are outside of the target bitmap's right(bottom) clip boundary
|
||||
dst_start = -scroll;
|
||||
if (dst_start > dst_max) return;
|
||||
|
||||
// calculate target length
|
||||
dst_length = clipmask + 1;
|
||||
if (zoom) dst_length = (dst_length << 6) / zoom;
|
||||
|
||||
// reject scanlines that are outside of the target bitmap's left(top) clip boundary
|
||||
end_pixel = dst_start + dst_length - 1;
|
||||
if (end_pixel < dst_min) return;
|
||||
|
||||
// clip scanline tail
|
||||
if ((end_pixel -= dst_max) > 0) dst_length -= end_pixel;
|
||||
|
||||
// reject zero-length scanlines
|
||||
if (dst_length <= 0) return;
|
||||
|
||||
// calculate zoom factor
|
||||
src_fdx = zoom << (FIXPOINT_PRECISION-6);
|
||||
|
||||
// clip scanline head
|
||||
end_pixel = dst_min;
|
||||
if ((end_pixel -= dst_start) > 0)
|
||||
{
|
||||
// chop scanline to the correct length and move target start location to the left(top) clip boundary
|
||||
dst_length -= end_pixel;
|
||||
dst_start = dst_min;
|
||||
|
||||
// and skip the source for the left(top) clip region
|
||||
src_fx = end_pixel * src_fdx + FIXPOINT_PRECISION_HALF;
|
||||
}
|
||||
else
|
||||
// the point five bias is to ensure even distribution of stretched or shrinked pixels
|
||||
src_fx = FIXPOINT_PRECISION_HALF;
|
||||
|
||||
// adjust flipped source
|
||||
if (flip)
|
||||
{
|
||||
// start from the target's clipped end if the scanline is flipped
|
||||
dst_start = dst_max + dst_min - dst_start - (dst_length-1);
|
||||
|
||||
// and move source start location to the opposite end
|
||||
src_fx += (dst_length-1) * src_fdx - 1;
|
||||
src_fdx = -src_fdx;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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
|
||||
src_fdx = zoom << (FIXPOINT_PRECISION-6);
|
||||
|
||||
// pre-advance source for the clipped region
|
||||
if (!flip)
|
||||
src_fx = (scroll + dst_min) * src_fdx + FIXPOINT_PRECISION_HALF;
|
||||
else
|
||||
{
|
||||
src_fx = (scroll + dst_max) * src_fdx + FIXPOINT_PRECISION_HALF-1;
|
||||
src_fdx = -src_fdx;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(orientation & ORIENTATION_SWAP_XY))
|
||||
{
|
||||
// calculate target increment for horizontal scanlines which is exactly one
|
||||
dst_adv = 1;
|
||||
dst_offset = dst_length;
|
||||
pri_base = BITMAP_ADDR8(priority, linepos, dst_start + dst_offset);
|
||||
dst_base = BITMAP_ADDR32(bitmap, linepos, dst_start + dst_length);
|
||||
}
|
||||
else
|
||||
{
|
||||
// calculate target increment for vertical scanlines which is the bitmap's pitch value
|
||||
dst_adv = bitmap->rowpixels;
|
||||
dst_offset= dst_length * dst_adv;
|
||||
pri_base = BITMAP_ADDR8(priority, dst_start, linepos + dst_offset);
|
||||
dst_base = BITMAP_ADDR32(bitmap, dst_start, linepos + dst_offset);
|
||||
}
|
||||
|
||||
// generalized
|
||||
src_base = source;
|
||||
//src_x = 0;
|
||||
|
||||
// there is no need to wrap source offsets along with source clipping
|
||||
// so we set all bits of the wrapmask to one
|
||||
src_wrapmask = (clipmask) ? ~0 : wrapmask;
|
||||
|
||||
pal_base = palette;
|
||||
dst_offset = -dst_offset; // negate target offset in order to terminated draw loop at zero condition
|
||||
|
||||
if (pri)
|
||||
{
|
||||
// draw scanline and update priority bitmap
|
||||
do
|
||||
{
|
||||
pix_data = src_base[(src_fx>>FIXPOINT_PRECISION) & src_wrapmask];
|
||||
src_fx += src_fdx;
|
||||
|
||||
if (pix_data)
|
||||
{
|
||||
pix_data = pal_base[pix_data];
|
||||
pri_base[dst_offset] = pri;
|
||||
dst_base[dst_offset] = pix_data;
|
||||
}
|
||||
}
|
||||
while (dst_offset += dst_adv);
|
||||
}
|
||||
else
|
||||
{
|
||||
// draw scanline but do not update priority bitmap
|
||||
do
|
||||
{
|
||||
pix_data = src_base[(src_fx>>FIXPOINT_PRECISION) & src_wrapmask];
|
||||
src_fx += src_fdx;
|
||||
|
||||
if (pix_data)
|
||||
{
|
||||
dst_base[dst_offset] = pal_base[pix_data];
|
||||
}
|
||||
}
|
||||
while (dst_offset += dst_adv);
|
||||
}
|
||||
|
||||
#undef FIXPOINT_PRECISION
|
||||
#undef FIXPOINT_PRECISION_HALF
|
||||
}
|
||||
|
||||
void k053250_draw( device_t *device, bitmap_t *bitmap, const rectangle *cliprect, int colorbase, int flags, int priority )
|
||||
{
|
||||
k053250_state *k053250 = k053250_get_safe_token(device);
|
||||
UINT16 *line_ram;
|
||||
UINT8 *pix_base, *pix_ptr, *regs;
|
||||
const pen_t *pal_base, *pal_ptr;
|
||||
UINT32 rommask, src_clipmask, src_wrapmask, dst_wrapmask;
|
||||
int map_scrollx, map_scrolly, ctrl, orientation;
|
||||
int dst_minx, dst_maxx, dst_miny, dst_maxy;
|
||||
int linedata_offs, linedata_adv, line_pos, line_start, line_end, scroll_corr;
|
||||
int color, offset, zoom, scroll, passes, i, dst_height;
|
||||
|
||||
line_ram = k053250->buffer[k053250->page]; // pointer to physical line RAM
|
||||
pix_base = k053250->base; // pointer to source pixel ROM
|
||||
rommask = k053250->rommask; // source ROM limit
|
||||
regs = k053250->regs; // pointer to registers group
|
||||
|
||||
map_scrollx = (short)(regs[0] << 8 | regs[1]); // signed horizontal scroll value
|
||||
map_scrolly = (short)(regs[2] << 8 | regs[3]); // signed vertical scroll value
|
||||
map_scrollx -= k053250->offsx; // add user X offset to horizontal scroll
|
||||
map_scrolly -= k053250->offsy; // add user Y offset to vertical scroll
|
||||
ctrl = regs[4]; // register four is the main control register
|
||||
|
||||
// copy visible boundary values to more accessible locations
|
||||
dst_minx = cliprect->min_x;
|
||||
dst_maxx = cliprect->max_x;
|
||||
dst_miny = cliprect->min_y;
|
||||
dst_maxy = cliprect->max_y;
|
||||
|
||||
orientation = 0; // orientation defaults to no swapping and no flipping
|
||||
dst_height = 512; // virtual bitmap height defaults to five hundred and twelve pixels
|
||||
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;
|
||||
|
||||
// invert X parameters when the forth bit of the control register is set
|
||||
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;
|
||||
|
||||
switch (ctrl >> 5) // the upper four bits of the control register select source and target dimensions
|
||||
{
|
||||
case 0 :
|
||||
// Xexex: L6 galaxies
|
||||
// Metam: L4 forest, L5 arena, L6 tower interior, final boss
|
||||
|
||||
// crop source offset between zero and two hundred and fifty-five inclusive,
|
||||
// and set virtual bitmap height to two hundred and fifty-six pixels
|
||||
src_wrapmask = src_clipmask = 0xff;
|
||||
dst_height = 0x100;
|
||||
break;
|
||||
case 1 :
|
||||
// Xexex: prologue, L7 nebulae
|
||||
|
||||
// the source offset is cropped to zero and five hundred and eleven inclusive
|
||||
src_wrapmask = src_clipmask = 0x1ff;
|
||||
break;
|
||||
case 4 :
|
||||
// Xexex: L1 sky and boss, L3 planet, L5 poly-face, L7 battle ship patches
|
||||
// Metam: L1 summoning circle, L3 caves, L6 gargoyle towers
|
||||
|
||||
// crop source offset between zero and two hundred and fifty-five inclusive,
|
||||
// and allow source offset to wrap back at 500 hexadecimal to minus 300 hexadecimal
|
||||
src_wrapmask = src_clipmask = 0xff;
|
||||
flags |= K053250_WRAP500;
|
||||
break;
|
||||
// case 2 : // Xexex: title
|
||||
// case 7 : // Xexex: L4 organic stage
|
||||
default:
|
||||
|
||||
// crop source offset between zero and one thousand and eleven inclusive,
|
||||
// keep other dimensions to their defaults
|
||||
src_wrapmask = src_clipmask = 0x3ff;
|
||||
break;
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
if (orientation & ORIENTATION_FLIP_Y)
|
||||
{
|
||||
scroll_corr = 0x100 - scroll_corr; // apply common vertical correction
|
||||
|
||||
// Y correction (ref: 1st and 5th boss)
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
if (src_clipmask)
|
||||
{
|
||||
// determine target wrap boundary and draw scanline in two passes if the source is clipped
|
||||
dst_wrapmask = dst_height - 1;
|
||||
passes = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise disable target wraparound and draw scanline in a single pass
|
||||
dst_wrapmask = ~0;
|
||||
passes = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 = device->machine().pens + (colorbase << 4) % device->machine().total_colors();
|
||||
|
||||
// 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
|
||||
|
||||
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
|
||||
|
||||
// calculate physical palette location
|
||||
// there can be thirty-two color codes and each code represents sixteen pens
|
||||
pal_ptr = pal_base + ((color & 0x1f) << 4);
|
||||
|
||||
// calculate physical pixel location
|
||||
// each offset unit represents two hundred and fifty six pixels and should wrap at ROM boundary for safty
|
||||
pix_ptr = pix_base + (offset << 8) % rommask;
|
||||
|
||||
// get scanline zoom factor
|
||||
// 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];
|
||||
|
||||
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 (flags & K053250_WRAP500 && scroll >= 0x500) scroll -= 0x800;
|
||||
|
||||
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
|
||||
i = passes;
|
||||
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
|
||||
*/
|
||||
k053250_pdraw_scanline32(bitmap, pal_ptr, pix_ptr, cliprect,
|
||||
line_pos, scroll, zoom, src_clipmask, src_wrapmask, orientation, device->machine().priority_bitmap, (UINT8)priority);
|
||||
|
||||
// shift scanline position one virtual screen upward to render the wrapped end if necessary
|
||||
scroll -= dst_height;
|
||||
}
|
||||
while (--i);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
DEVICE INTERFACE
|
||||
*****************************************************************************/
|
||||
|
||||
static DEVICE_START( k053250 )
|
||||
{
|
||||
k053250_state *k053250 = k053250_get_safe_token(device);
|
||||
const k053250_interface *intf = k053250_get_interface(device);
|
||||
|
||||
k053250->packed = device->machine().region(intf->gfx_memory_region)->base();
|
||||
k053250->packedmask = device->machine().region(intf->gfx_memory_region)->bytes();
|
||||
|
||||
k053250->base = device->machine().region(intf->gfx_memory_region_unpack)->base();
|
||||
k053250->rommask = device->machine().region(intf->gfx_memory_region_unpack)->bytes();
|
||||
|
||||
k053250->screen = device->machine().device<screen_device>(intf->screen);
|
||||
|
||||
k053250->ram = auto_alloc_array(device->machine(), UINT16, 0x6000 / 2);
|
||||
|
||||
k053250->rammax = k053250->ram + 0x800;
|
||||
k053250->buffer[0] = k053250->ram + 0x2000;
|
||||
k053250->buffer[1] = k053250->ram + 0x2800;
|
||||
|
||||
k053250->offsx = intf->xoff;
|
||||
k053250->offsy = intf->yoff;
|
||||
|
||||
/* unpack graphics */
|
||||
k053250_unpack_pixels(device->machine(), intf->gfx_memory_region, intf->gfx_memory_region_unpack);
|
||||
|
||||
device->save_pointer(NAME(k053250->ram), 0x6000 / 2);
|
||||
device->save_item(NAME(k053250->regs));
|
||||
device->save_item(NAME(k053250->page));
|
||||
device->save_item(NAME(k053250->frame));
|
||||
}
|
||||
|
||||
static DEVICE_RESET( k053250 )
|
||||
{
|
||||
k053250_state *k053250 = k053250_get_safe_token(device);
|
||||
int i;
|
||||
|
||||
k053250->page = 0;
|
||||
k053250->frame = -1;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
k053250->regs[i] = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Newer Konami devices
|
||||
|
||||
// from video/gticlub.c
|
||||
@ -11157,28 +10598,6 @@ DEVICE_GET_INFO( k054338 )
|
||||
}
|
||||
}
|
||||
|
||||
DEVICE_GET_INFO( k053250 )
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
/* --- the following bits of info are returned as 64-bit signed integers --- */
|
||||
case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(k053250_state); break;
|
||||
|
||||
/* --- the following bits of info are returned as pointers to data or functions --- */
|
||||
case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(k053250); break;
|
||||
case DEVINFO_FCT_STOP: /* Nothing */ break;
|
||||
case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(k053250); break;
|
||||
|
||||
/* --- the following bits of info are returned as NULL-terminated strings --- */
|
||||
case DEVINFO_STR_NAME: strcpy(info->s, "Konami 053250"); break;
|
||||
case DEVINFO_STR_FAMILY: strcpy(info->s, "Konami Video IC"); break;
|
||||
case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
|
||||
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
|
||||
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright MAME Team"); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DEVICE_GET_INFO( k001006 )
|
||||
{
|
||||
switch (state)
|
||||
@ -11283,7 +10702,6 @@ DEFINE_LEGACY_DEVICE(K051733, k051733);
|
||||
DEFINE_LEGACY_DEVICE(K056832, k056832);
|
||||
DEFINE_LEGACY_DEVICE(K055555, k055555);
|
||||
DEFINE_LEGACY_DEVICE(K054338, k054338);
|
||||
DEFINE_LEGACY_DEVICE(K053250, k053250);
|
||||
DEFINE_LEGACY_DEVICE(K001006, k001006);
|
||||
DEFINE_LEGACY_DEVICE(K001005, k001005);
|
||||
DEFINE_LEGACY_DEVICE(K001604, k001604);
|
||||
|
@ -121,15 +121,6 @@ struct _k054338_interface
|
||||
const char *k055555;
|
||||
};
|
||||
|
||||
typedef struct _k053250_interface k053250_interface;
|
||||
struct _k053250_interface
|
||||
{
|
||||
const char *screen;
|
||||
const char *gfx_memory_region;
|
||||
const char *gfx_memory_region_unpack;
|
||||
int xoff, yoff;
|
||||
};
|
||||
|
||||
typedef struct _k001006_interface k001006_interface;
|
||||
struct _k001006_interface
|
||||
{
|
||||
@ -185,7 +176,6 @@ DECLARE_LEGACY_DEVICE(K051733, k051733);
|
||||
DECLARE_LEGACY_DEVICE(K056832, k056832);
|
||||
DECLARE_LEGACY_DEVICE(K055555, k055555);
|
||||
DECLARE_LEGACY_DEVICE(K054338, k054338);
|
||||
DECLARE_LEGACY_DEVICE(K053250, k053250);
|
||||
DECLARE_LEGACY_DEVICE(K001006, k001006);
|
||||
DECLARE_LEGACY_DEVICE(K001005, k001005);
|
||||
DECLARE_LEGACY_DEVICE(K001604, k001604);
|
||||
@ -263,11 +253,6 @@ DECLARE_LEGACY_DEVICE(K037122, k037122);
|
||||
MCFG_DEVICE_ADD(_tag, K054338, 0) \
|
||||
MCFG_DEVICE_CONFIG(_interface)
|
||||
|
||||
#define MCFG_K053250_ADD(_tag, _interface) \
|
||||
MCFG_DEVICE_ADD(_tag, K053250, 0) \
|
||||
MCFG_DEVICE_CONFIG(_interface)
|
||||
|
||||
|
||||
#define MCFG_K001006_ADD(_tag, _interface) \
|
||||
MCFG_DEVICE_ADD(_tag, K001006, 0) \
|
||||
MCFG_DEVICE_CONFIG(_interface)
|
||||
@ -729,20 +714,6 @@ void k054338_invert_alpha(device_t *device, int invert); // 0=0x00(invis)
|
||||
#define K338_CTL_CLIPSL 0x20
|
||||
|
||||
|
||||
/** Konami 053250 **/
|
||||
WRITE16_DEVICE_HANDLER( k053250_w );
|
||||
READ16_DEVICE_HANDLER( k053250_r );
|
||||
WRITE16_DEVICE_HANDLER( k053250_ram_w );
|
||||
READ16_DEVICE_HANDLER( k053250_ram_r );
|
||||
READ16_DEVICE_HANDLER( k053250_rom_r );
|
||||
|
||||
// K053250_draw() control flags
|
||||
#define K053250_WRAP500 0x01
|
||||
#define K053250_OVERDRIVE 0x02
|
||||
|
||||
void k053250_draw(device_t *device, bitmap_t *bitmap, const rectangle *cliprect, int colorbase, int flags, int pri);
|
||||
void k053250_dma(device_t *device, int limiter);
|
||||
|
||||
/** Konami 001006 **/
|
||||
UINT32 k001006_get_palette(device_t *device, int index);
|
||||
|
||||
|
@ -260,13 +260,11 @@ VIDEO_START(mystwarr)
|
||||
VIDEO_START(metamrph)
|
||||
{
|
||||
mystwarr_state *state = machine.driver_data<mystwarr_state>();
|
||||
const char * rgn_250 = "gfx3";
|
||||
|
||||
state->m_gametype = 0;
|
||||
|
||||
K055555_vh_start(machine);
|
||||
K054338_vh_start(machine);
|
||||
K053250_vh_start(machine, 1, &rgn_250);
|
||||
|
||||
K056832_vh_start(machine, "gfx1", K056832_BPP_5, 0, NULL, game4bpp_tile_callback, 0);
|
||||
|
||||
@ -281,8 +279,6 @@ VIDEO_START(metamrph)
|
||||
K056832_set_LayerOffset(1, 0+4, 0); // attract sea
|
||||
K056832_set_LayerOffset(2, 2+4, 0); // attract red monster in background of sea
|
||||
K056832_set_LayerOffset(3, 3+4, 0); // attract sky background to sea
|
||||
|
||||
K053250_set_LayerOffset(0, -7, 0);
|
||||
}
|
||||
|
||||
VIDEO_START(viostorm)
|
||||
|
@ -87,7 +87,7 @@ SCREEN_UPDATE( xexex )
|
||||
{
|
||||
if (layer[plane] < 0)
|
||||
{
|
||||
k053250_draw(state->m_k053250, bitmap, cliprect, bg_colorbase, 0, 1 << plane);
|
||||
state->m_k053250->draw(bitmap, cliprect, bg_colorbase, 0, 1 << plane);
|
||||
}
|
||||
else if (!state->m_cur_alpha || layer[plane] != 1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user