mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
Merge pull request #5627 from cam900/i4100_struct
imagetek_i4100.cpp : Updates
This commit is contained in:
commit
5177be0a22
@ -22,6 +22,7 @@
|
|||||||
- Some gfx problems in ladykill, 3kokushi, puzzli, gakusai, seem related to how we handle
|
- Some gfx problems in ladykill, 3kokushi, puzzli, gakusai, seem related to how we handle
|
||||||
windows, wrapping, read-modify-write areas;
|
windows, wrapping, read-modify-write areas;
|
||||||
- puzzli: emulate hblank irq and fix video routines here (water effect not emulated?);
|
- puzzli: emulate hblank irq and fix video routines here (water effect not emulated?);
|
||||||
|
- Fix flipped screen behavior
|
||||||
|
|
||||||
============================================================================
|
============================================================================
|
||||||
|
|
||||||
@ -250,13 +251,11 @@ void imagetek_i4300_device::v3_map(address_map &map)
|
|||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
imagetek_i4100_device::imagetek_i4100_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool has_ext_tiles)
|
imagetek_i4100_device::imagetek_i4100_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, bool has_ext_tiles)
|
||||||
: device_t(mconfig, type, tag, owner, clock)
|
: device_t(mconfig, type, tag, owner, clock)
|
||||||
, device_gfx_interface(mconfig, *this, has_ext_tiles ? gfxinfo_ext : gfxinfo, "palette")
|
, device_gfx_interface(mconfig, *this, has_ext_tiles ? gfxinfo_ext : gfxinfo, "palette")
|
||||||
, device_video_interface(mconfig, *this)
|
, device_video_interface(mconfig, *this)
|
||||||
, m_vram_0(*this, "vram_0")
|
, m_vram(*this, "vram_%u", 0U)
|
||||||
, m_vram_1(*this, "vram_1")
|
|
||||||
, m_vram_2(*this, "vram_2")
|
|
||||||
, m_scratchram(*this, "scratchram")
|
, m_scratchram(*this, "scratchram")
|
||||||
, m_blitter_regs(*this, "blitter_regs")
|
, m_blitter_regs(*this, "blitter_regs")
|
||||||
, m_spriteram(*this, "spriteram")
|
, m_spriteram(*this, "spriteram")
|
||||||
@ -274,18 +273,18 @@ imagetek_i4100_device::imagetek_i4100_device(const machine_config &mconfig, devi
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
imagetek_i4100_device::imagetek_i4100_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
imagetek_i4100_device::imagetek_i4100_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||||
: imagetek_i4100_device(mconfig, I4100, tag, owner, clock, false)
|
: imagetek_i4100_device(mconfig, I4100, tag, owner, clock, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
imagetek_i4220_device::imagetek_i4220_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
imagetek_i4220_device::imagetek_i4220_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||||
: imagetek_i4100_device(mconfig, I4220, tag, owner, clock, true)
|
: imagetek_i4100_device(mconfig, I4220, tag, owner, clock, true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
imagetek_i4300_device::imagetek_i4300_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
imagetek_i4300_device::imagetek_i4300_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||||
: imagetek_i4100_device(mconfig, I4300, tag, owner, clock, true)
|
: imagetek_i4100_device(mconfig, I4300, tag, owner, clock, true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -312,13 +311,13 @@ void imagetek_i4100_device::expand_gfx1()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_inited_hack = true;
|
m_inited_hack = true;
|
||||||
uint32_t length = m_gfxrom_size * 2;
|
const u32 length = m_gfxrom_size * 2;
|
||||||
|
|
||||||
m_expanded_gfx1 = std::make_unique<uint8_t[]>(length);
|
m_expanded_gfx1 = std::make_unique<u8[]>(length);
|
||||||
|
|
||||||
for (int i = 0; i < length; i += 2)
|
for (int i = 0; i < length; i += 2)
|
||||||
{
|
{
|
||||||
uint8_t src = m_gfxrom[i / 2];
|
const u8 src = m_gfxrom[i / 2];
|
||||||
|
|
||||||
m_expanded_gfx1[i + 0] = src & 0xf;
|
m_expanded_gfx1[i + 0] = src & 0xf;
|
||||||
m_expanded_gfx1[i + 1] = src >> 4;
|
m_expanded_gfx1[i + 1] = src >> 4;
|
||||||
@ -353,6 +352,8 @@ void imagetek_i4100_device::device_start()
|
|||||||
m_blit_irq_cb.resolve_safe();
|
m_blit_irq_cb.resolve_safe();
|
||||||
m_blit_done_timer = timer_alloc(TIMER_BLIT_END);
|
m_blit_done_timer = timer_alloc(TIMER_BLIT_END);
|
||||||
|
|
||||||
|
m_spritelist = std::make_unique<sprite_t []>(0x1000 / 8);
|
||||||
|
m_sprite_end = m_spritelist.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -380,28 +381,29 @@ void imagetek_i4100_device::device_timer(emu_timer &timer, device_timer_id id, i
|
|||||||
// READ/WRITE HANDLERS
|
// READ/WRITE HANDLERS
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
|
||||||
READ16_MEMBER(imagetek_i4100_device::vram_0_r){ return m_vram_0[offset]; }
|
READ16_MEMBER(imagetek_i4100_device::vram_0_r){ return vram_r(offset, 0); }
|
||||||
READ16_MEMBER(imagetek_i4100_device::vram_1_r){ return m_vram_1[offset]; }
|
READ16_MEMBER(imagetek_i4100_device::vram_1_r){ return vram_r(offset, 1); }
|
||||||
READ16_MEMBER(imagetek_i4100_device::vram_2_r){ return m_vram_2[offset]; }
|
READ16_MEMBER(imagetek_i4100_device::vram_2_r){ return vram_r(offset, 2); }
|
||||||
WRITE16_MEMBER(imagetek_i4100_device::vram_0_w){ COMBINE_DATA(&m_vram_0[offset]); }
|
WRITE16_MEMBER(imagetek_i4100_device::vram_0_w){ vram_w(offset, data, mem_mask, 0); }
|
||||||
WRITE16_MEMBER(imagetek_i4100_device::vram_1_w){ COMBINE_DATA(&m_vram_1[offset]); }
|
WRITE16_MEMBER(imagetek_i4100_device::vram_1_w){ vram_w(offset, data, mem_mask, 1); }
|
||||||
WRITE16_MEMBER(imagetek_i4100_device::vram_2_w){ COMBINE_DATA(&m_vram_2[offset]); }
|
WRITE16_MEMBER(imagetek_i4100_device::vram_2_w){ vram_w(offset, data, mem_mask, 2); }
|
||||||
|
|
||||||
/* Some game uses almost only the blitter to write to the tilemaps.
|
/* Some game uses almost only the blitter to write to the tilemaps.
|
||||||
The CPU can only access a "window" of 512x256 pixels in the upper
|
The CPU can only access a "window" of 512x256 pixels in the upper
|
||||||
left corner of the big tilemap */
|
left corner of the big tilemap */
|
||||||
// TODO: Puzzlet, Sankokushi & Lady Killer contradicts with aformentioned description (more like RMW?)
|
// TODO: Puzzlet, Sankokushi & Lady Killer contradicts with aformentioned description (more like RMW?)
|
||||||
|
|
||||||
#define RMW_OFFS( _x_ ) ((_x_) & (0x3f)) + (((_x_) & ~(0x3f)) * (0x100 / 0x40))
|
static inline offs_t RMW_OFFS(offs_t offset)
|
||||||
|
{
|
||||||
|
return (offset & 0x3f) + ((offset & ~0x3f) * (0x100 / 0x40));
|
||||||
|
}
|
||||||
|
|
||||||
READ16_MEMBER(imagetek_i4100_device::rmw_vram_0_r){ return m_vram_0[RMW_OFFS(offset)]; }
|
READ16_MEMBER(imagetek_i4100_device::rmw_vram_0_r){ return vram_r(RMW_OFFS(offset), 0); }
|
||||||
READ16_MEMBER(imagetek_i4100_device::rmw_vram_1_r){ return m_vram_1[RMW_OFFS(offset)]; }
|
READ16_MEMBER(imagetek_i4100_device::rmw_vram_1_r){ return vram_r(RMW_OFFS(offset), 1); }
|
||||||
READ16_MEMBER(imagetek_i4100_device::rmw_vram_2_r){ return m_vram_2[RMW_OFFS(offset)]; }
|
READ16_MEMBER(imagetek_i4100_device::rmw_vram_2_r){ return vram_r(RMW_OFFS(offset), 2); }
|
||||||
WRITE16_MEMBER(imagetek_i4100_device::rmw_vram_0_w){ COMBINE_DATA(&m_vram_0[RMW_OFFS(offset)]); }
|
WRITE16_MEMBER(imagetek_i4100_device::rmw_vram_0_w){ vram_w(RMW_OFFS(offset), data, mem_mask, 0); }
|
||||||
WRITE16_MEMBER(imagetek_i4100_device::rmw_vram_1_w){ COMBINE_DATA(&m_vram_1[RMW_OFFS(offset)]); }
|
WRITE16_MEMBER(imagetek_i4100_device::rmw_vram_1_w){ vram_w(RMW_OFFS(offset), data, mem_mask, 1); }
|
||||||
WRITE16_MEMBER(imagetek_i4100_device::rmw_vram_2_w){ COMBINE_DATA(&m_vram_2[RMW_OFFS(offset)]); }
|
WRITE16_MEMBER(imagetek_i4100_device::rmw_vram_2_w){ vram_w(RMW_OFFS(offset), data, mem_mask, 2); }
|
||||||
|
|
||||||
#undef RMW_OFFS
|
|
||||||
|
|
||||||
READ16_MEMBER(imagetek_i4100_device::scratchram_r) { return m_scratchram[offset]; }
|
READ16_MEMBER(imagetek_i4100_device::scratchram_r) { return m_scratchram[offset]; }
|
||||||
WRITE16_MEMBER(imagetek_i4100_device::scratchram_w) { COMBINE_DATA(&m_scratchram[offset]); }
|
WRITE16_MEMBER(imagetek_i4100_device::scratchram_w) { COMBINE_DATA(&m_scratchram[offset]); }
|
||||||
@ -633,13 +635,11 @@ WRITE16_MEMBER( imagetek_i4100_device::crtc_unlock_w )
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
void imagetek_i4100_device::blt_write( address_space &space, const int tmap, const offs_t offs, const uint16_t data, const uint16_t mask )
|
void imagetek_i4100_device::blt_write(int const tmap, const offs_t offs, u16 const data, u16 const mask)
|
||||||
{
|
{
|
||||||
switch(tmap)
|
if (tmap >= 1 && tmap <= 3)
|
||||||
{
|
{
|
||||||
case 1: vram_0_w(space, offs, data, mask); break;
|
vram_w(offs, data, mask, tmap - 1);
|
||||||
case 2: vram_1_w(space, offs, data, mask); break;
|
|
||||||
case 3: vram_2_w(space, offs, data, mask); break;
|
|
||||||
}
|
}
|
||||||
// logerror("%s : Blitter %X] %04X <- %04X & %04X\n", machine().describe_context(), tmap, offs, data, mask);
|
// logerror("%s : Blitter %X] %04X <- %04X & %04X\n", machine().describe_context(), tmap, offs, data, mask);
|
||||||
}
|
}
|
||||||
@ -698,14 +698,14 @@ WRITE16_MEMBER( imagetek_i4100_device::blitter_w )
|
|||||||
|
|
||||||
if (offset == 0x0c / 2)
|
if (offset == 0x0c / 2)
|
||||||
{
|
{
|
||||||
//uint8_t *src = memregion(DEVICE_SELF)->base();
|
//u8 *src = memregion(DEVICE_SELF)->base();
|
||||||
|
|
||||||
uint32_t tmap = (m_blitter_regs[0x00 / 2] << 16) + m_blitter_regs[0x02 / 2];
|
u32 const tmap = (m_blitter_regs[0x00 / 2] << 16) + m_blitter_regs[0x02 / 2];
|
||||||
uint32_t src_offs = (m_blitter_regs[0x04 / 2] << 16) + m_blitter_regs[0x06 / 2];
|
u32 src_offs = (m_blitter_regs[0x04 / 2] << 16) + m_blitter_regs[0x06 / 2];
|
||||||
uint32_t dst_offs = (m_blitter_regs[0x08 / 2] << 16) + m_blitter_regs[0x0a / 2];
|
u32 dst_offs = (m_blitter_regs[0x08 / 2] << 16) + m_blitter_regs[0x0a / 2];
|
||||||
|
|
||||||
int shift = (dst_offs & 0x80) ? 0 : 8;
|
int const shift = (dst_offs & 0x80) ? 0 : 8;
|
||||||
uint16_t mask = (dst_offs & 0x80) ? 0x00ff : 0xff00;
|
u16 const mask = (dst_offs & 0x80) ? 0x00ff : 0xff00;
|
||||||
|
|
||||||
// logerror("%s Blitter regs %08X, %08X, %08X\n", machine().describe_context(), tmap, src_offs, dst_offs);
|
// logerror("%s Blitter regs %08X, %08X, %08X\n", machine().describe_context(), tmap, src_offs, dst_offs);
|
||||||
|
|
||||||
@ -723,7 +723,7 @@ WRITE16_MEMBER( imagetek_i4100_device::blitter_w )
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
uint16_t b1, b2, count;
|
u16 b1, b2, count;
|
||||||
|
|
||||||
src_offs %= m_gfxrom_size;
|
src_offs %= m_gfxrom_size;
|
||||||
b1 = m_gfxrom[src_offs];
|
b1 = m_gfxrom[src_offs];
|
||||||
@ -754,7 +754,7 @@ WRITE16_MEMBER( imagetek_i4100_device::blitter_w )
|
|||||||
src_offs++;
|
src_offs++;
|
||||||
|
|
||||||
dst_offs &= 0xffff;
|
dst_offs &= 0xffff;
|
||||||
blt_write(space, tmap, dst_offs, b2, mask);
|
blt_write(tmap, dst_offs, b2, mask);
|
||||||
dst_offs = ((dst_offs + 1) & (0x100 - 1)) | (dst_offs & (~(0x100 - 1)));
|
dst_offs = ((dst_offs + 1) & (0x100 - 1)) | (dst_offs & (~(0x100 - 1)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -768,7 +768,7 @@ WRITE16_MEMBER( imagetek_i4100_device::blitter_w )
|
|||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
dst_offs &= 0xffff;
|
dst_offs &= 0xffff;
|
||||||
blt_write(space, tmap, dst_offs, b2 << shift, mask);
|
blt_write(tmap, dst_offs, b2 << shift, mask);
|
||||||
dst_offs = ((dst_offs + 1) & (0x100 - 1)) | (dst_offs & (~(0x100 - 1)));
|
dst_offs = ((dst_offs + 1) & (0x100 - 1)) | (dst_offs & (~(0x100 - 1)));
|
||||||
b2++;
|
b2++;
|
||||||
}
|
}
|
||||||
@ -783,7 +783,7 @@ WRITE16_MEMBER( imagetek_i4100_device::blitter_w )
|
|||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
dst_offs &= 0xffff;
|
dst_offs &= 0xffff;
|
||||||
blt_write(space, tmap, dst_offs, b2, mask);
|
blt_write(tmap, dst_offs, b2, mask);
|
||||||
dst_offs = ((dst_offs + 1) & (0x100 - 1)) | (dst_offs & (~(0x100 - 1)));
|
dst_offs = ((dst_offs + 1) & (0x100 - 1)) | (dst_offs & (~(0x100 - 1)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -820,40 +820,42 @@ WRITE16_MEMBER( imagetek_i4100_device::blitter_w )
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
void imagetek_i4100_device::draw_spritegfx(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &clip,
|
void imagetek_i4100_device::draw_spritegfx(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &clip,
|
||||||
uint32_t const gfxstart, uint16_t const width, uint16_t const height,
|
u32 const gfxstart, u16 const width, u16 const height,
|
||||||
uint16_t color, int const flipx, int const flipy, int sx, int sy,
|
u16 color, int const flipx, int const flipy, int sx, int sy,
|
||||||
uint32_t const scale, uint8_t const prival )
|
u32 const scale, u8 const prival)
|
||||||
{
|
{
|
||||||
if (!scale) return;
|
if (!scale) return;
|
||||||
uint8_t trans;
|
u8 trans;
|
||||||
bool const is_8bpp = (m_support_8bpp == true && color == 0xf) ? true : false; /* 8bpp */
|
bool const is_8bpp = (m_support_8bpp == true && color == 0xf) ? true : false; /* 8bpp */
|
||||||
|
|
||||||
if (is_8bpp)
|
if (is_8bpp)
|
||||||
{
|
{
|
||||||
trans = 0xff;
|
|
||||||
color = 0;
|
|
||||||
/* Bounds checking */
|
/* Bounds checking */
|
||||||
if ((gfxstart + width * height - 1) >= m_gfxrom.bytes())
|
if ((gfxstart + width * height - 1) >= m_gfxrom.bytes())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
trans = 0xff;
|
||||||
|
color = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
trans = 0xf;
|
|
||||||
color <<= 4;
|
|
||||||
/* Bounds checking */
|
/* Bounds checking */
|
||||||
if ((gfxstart + width / 2 * height - 1) >= m_gfxrom.bytes())
|
if ((gfxstart + width / 2 * height - 1) >= m_gfxrom.bytes())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
trans = 0xf;
|
||||||
|
color <<= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pen_t *pal = &m_palette->pen((m_sprite_color_code & 0x0f) << 8);
|
const pen_t *pal = &m_palette->pen((m_sprite_color_code & 0x0f) << 8);
|
||||||
const uint8_t *source_base;
|
const u8 *source_base;
|
||||||
if (is_8bpp)
|
if (is_8bpp)
|
||||||
source_base = &m_gfxrom[gfxstart % m_gfxrom.bytes()];
|
source_base = &m_gfxrom[gfxstart % m_gfxrom.bytes()];
|
||||||
else
|
else
|
||||||
source_base = &m_expanded_gfx1[(gfxstart % m_gfxrom.bytes()) << 1];
|
source_base = &m_expanded_gfx1[(gfxstart % m_gfxrom.bytes()) << 1];
|
||||||
|
|
||||||
int const sprite_screen_height = (scale * height + 0x8000) >> 16;
|
const int sprite_screen_height = (scale * height + 0x8000) >> 16;
|
||||||
int const sprite_screen_width = (scale * width + 0x8000) >> 16;
|
const int sprite_screen_width = (scale * width + 0x8000) >> 16;
|
||||||
if (sprite_screen_width && sprite_screen_height)
|
if (sprite_screen_width && sprite_screen_height)
|
||||||
{
|
{
|
||||||
/* compute sprite increment per screen pixel */
|
/* compute sprite increment per screen pixel */
|
||||||
@ -911,20 +913,18 @@ void imagetek_i4100_device::draw_spritegfx(screen_device &screen, bitmap_rgb32 &
|
|||||||
|
|
||||||
if (ex > sx)
|
if (ex > sx)
|
||||||
{ /* skip if inner loop doesn't draw anything */
|
{ /* skip if inner loop doesn't draw anything */
|
||||||
int y;
|
|
||||||
bitmap_ind8 &priority_bitmap = screen.priority();
|
bitmap_ind8 &priority_bitmap = screen.priority();
|
||||||
if (priority_bitmap.valid())
|
if (priority_bitmap.valid())
|
||||||
{
|
{
|
||||||
for (y = sy; y < ey; y++)
|
for (int y = sy; y < ey; y++)
|
||||||
{
|
{
|
||||||
const uint8_t *source = source_base + (y_index >> 16) * width;
|
const u8 *source = source_base + (y_index >> 16) * width;
|
||||||
uint32_t *dest = &bitmap.pix32(y);
|
u32 *dest = &bitmap.pix32(y);
|
||||||
uint8_t *pri = &priority_bitmap.pix8(y);
|
u8 *pri = &priority_bitmap.pix8(y);
|
||||||
int x, x_index = x_index_base;
|
int x_index = x_index_base;
|
||||||
|
for (int x = sx; x < ex; x++)
|
||||||
{
|
{
|
||||||
for (x = sx; x < ex; x++)
|
const u8 c = source[x_index >> 16];
|
||||||
{
|
|
||||||
uint8_t const c = source[x_index >> 16];
|
|
||||||
|
|
||||||
if (c != trans)
|
if (c != trans)
|
||||||
{
|
{
|
||||||
@ -941,7 +941,6 @@ void imagetek_i4100_device::draw_spritegfx(screen_device &screen, bitmap_rgb32 &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
@ -973,16 +972,21 @@ void imagetek_i4100_device::draw_spritegfx(screen_device &screen, bitmap_rgb32 &
|
|||||||
|
|
||||||
void imagetek_i4100_device::draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
void imagetek_i4100_device::draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||||
{
|
{
|
||||||
int max_x = (m_screen_xoffset + 1) * 2;
|
int const max_x = (m_screen_xoffset + 1) * 2;
|
||||||
int max_y = (m_screen_yoffset + 1) * 2;
|
int const max_y = (m_screen_yoffset + 1) * 2;
|
||||||
int m_sprite_xoffs = m_sprite_xoffset - (m_screen_xoffset + 1);
|
int const m_sprite_xoffs = m_sprite_xoffset - (m_screen_xoffset + 1);
|
||||||
int m_sprite_yoffs = m_sprite_yoffset - (m_screen_yoffset + 1);
|
int const m_sprite_yoffs = m_sprite_yoffset - (m_screen_yoffset + 1);
|
||||||
|
|
||||||
int max_sprites = m_spriteram->bytes() / 8;
|
int const max_sprites = m_spriteram->bytes() / 8;
|
||||||
int sprites = m_sprite_count % max_sprites;
|
int const sprites = m_sprite_count % max_sprites;
|
||||||
|
|
||||||
|
u16 const layerpri_disable = (m_sprite_priority & 0x8000);
|
||||||
|
u16 const global_masknum = (m_sprite_priority & 0x1f);
|
||||||
|
u16 const global_pri = (m_sprite_priority & 0x0300) >> 8;
|
||||||
|
u16 const global_masklayer = (m_sprite_priority & 0x0c00) >> 10;
|
||||||
|
|
||||||
// Exponential zoom table extracted from daitoride
|
// Exponential zoom table extracted from daitoride
|
||||||
static const uint16_t zoomtable[0x40] =
|
static u16 const zoomtable[0x40] =
|
||||||
{ 0xAAC,0x800,0x668,0x554,0x494,0x400,0x390,0x334,
|
{ 0xAAC,0x800,0x668,0x554,0x494,0x400,0x390,0x334,
|
||||||
0x2E8,0x2AC,0x278,0x248,0x224,0x200,0x1E0,0x1C8,
|
0x2E8,0x2AC,0x278,0x248,0x224,0x200,0x1E0,0x1C8,
|
||||||
0x1B0,0x198,0x188,0x174,0x164,0x154,0x148,0x13C,
|
0x1B0,0x198,0x188,0x174,0x164,0x154,0x148,0x13C,
|
||||||
@ -992,61 +996,71 @@ void imagetek_i4100_device::draw_sprites( screen_device &screen, bitmap_rgb32 &b
|
|||||||
0x0A0,0x09C,0x098,0x094,0x090,0x08C,0x088,0x080,
|
0x0A0,0x09C,0x098,0x094,0x090,0x08C,0x088,0x080,
|
||||||
0x078,0x070,0x068,0x060,0x058,0x050,0x048,0x040 };
|
0x078,0x070,0x068,0x060,0x058,0x050,0x048,0x040 };
|
||||||
|
|
||||||
uint16_t *src;
|
|
||||||
int inc;
|
|
||||||
|
|
||||||
if (sprites == 0)
|
if (sprites == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < 0x20; i++)
|
sprite_t *sprite_ptr = m_spritelist.get();
|
||||||
|
|
||||||
|
const u16 *src = (m_spriteram_buffered ? m_spriteram->buffer() : m_spriteram->live());
|
||||||
|
int src_inc = 8 / 2;
|
||||||
|
if (!layerpri_disable)
|
||||||
{
|
{
|
||||||
if (!(m_sprite_priority & 0x8000))
|
src += (sprites - 1) * src_inc;
|
||||||
{
|
src_inc = -src_inc;
|
||||||
src = (m_spriteram_buffered ? m_spriteram->buffer() : m_spriteram->live()) + (sprites - 1) * (8 / 2);
|
|
||||||
inc = -(8 / 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
src = (m_spriteram_buffered ? m_spriteram->buffer() : m_spriteram->live());
|
|
||||||
inc = (8 / 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < sprites; j++)
|
for (int j = 0; j < sprites; j++, src += src_inc)
|
||||||
{
|
{
|
||||||
int x = src[0];
|
int x = src[0];
|
||||||
int const curr_pri = (x & 0xf800) >> 11;
|
int const curr_pri = (x & 0xf800) >> 11;
|
||||||
|
|
||||||
if ((curr_pri == 0x1f) || (curr_pri != i))
|
if ((curr_pri == 0x1f))
|
||||||
{
|
|
||||||
src += inc;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t pri = (m_sprite_priority & 0x0300) >> 8;
|
|
||||||
|
|
||||||
if (!(m_sprite_priority & 0x8000))
|
|
||||||
{
|
|
||||||
if (curr_pri > (m_sprite_priority & 0x1f))
|
|
||||||
pri = (m_sprite_priority & 0x0c00) >> 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
int y = src[1];
|
int y = src[1];
|
||||||
uint16_t const attr = src[2];
|
u16 const attr = src[2];
|
||||||
uint16_t const code = src[3];
|
u16 const code = src[3];
|
||||||
|
|
||||||
int flipx = attr & 0x8000;
|
sprite_ptr->curr_pri = curr_pri;
|
||||||
int flipy = attr & 0x4000;
|
sprite_ptr->flipx = attr & 0x8000;
|
||||||
uint16_t const color = (attr & 0xf0) >> 4;
|
sprite_ptr->flipy = attr & 0x4000;
|
||||||
|
sprite_ptr->color = (attr & 0xf0) >> 4;
|
||||||
|
|
||||||
uint32_t const zoom = zoomtable[(y & 0xfc00) >> 10] << (16 - 8);
|
sprite_ptr->zoom = zoomtable[(y & 0xfc00) >> 10] << (16 - 8);
|
||||||
|
|
||||||
x = (x & 0x07ff) - m_sprite_xoffs;
|
sprite_ptr->x = x & 0x07ff;
|
||||||
y = (y & 0x03ff) - m_sprite_yoffs;
|
sprite_ptr->y = y & 0x03ff;
|
||||||
|
|
||||||
int const width = (((attr >> 11) & 0x7) + 1) * 8;
|
sprite_ptr->width = (((attr >> 11) & 0x7) + 1) * 8;
|
||||||
int const height = (((attr >> 8) & 0x7) + 1) * 8;
|
sprite_ptr->height = (((attr >> 8) & 0x7) + 1) * 8;
|
||||||
|
|
||||||
uint32_t const gfxstart = (8 * 8 * 4 / 8) * (((attr & 0x000f) << 16) + code);
|
sprite_ptr->gfxstart = (8 * 8 * 4 / 8) * (((attr & 0x000f) << 16) + code);
|
||||||
|
sprite_ptr++;
|
||||||
|
}
|
||||||
|
m_sprite_end = sprite_ptr;
|
||||||
|
|
||||||
|
for (int i = 0; i < 0x20; i++)
|
||||||
|
{
|
||||||
|
sprite_ptr = m_spritelist.get();
|
||||||
|
|
||||||
|
while (sprite_ptr != m_sprite_end)
|
||||||
|
{
|
||||||
|
if ((sprite_ptr->curr_pri == i))
|
||||||
|
{
|
||||||
|
u8 pri = global_pri;
|
||||||
|
|
||||||
|
if (!layerpri_disable)
|
||||||
|
{
|
||||||
|
if (sprite_ptr->curr_pri > global_masknum)
|
||||||
|
pri = global_masklayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
int x = sprite_ptr->x - m_sprite_xoffs;
|
||||||
|
int y = sprite_ptr->y - m_sprite_yoffs;
|
||||||
|
int flipx = sprite_ptr->flipx;
|
||||||
|
int flipy = sprite_ptr->flipy;
|
||||||
|
int const width = sprite_ptr->width;
|
||||||
|
int const height = sprite_ptr->height;
|
||||||
|
|
||||||
if (m_screen_flip)
|
if (m_screen_flip)
|
||||||
{
|
{
|
||||||
@ -1054,19 +1068,25 @@ void imagetek_i4100_device::draw_sprites( screen_device &screen, bitmap_rgb32 &b
|
|||||||
flipy = !flipy; y = max_y - y - height;
|
flipy = !flipy; y = max_y - y - height;
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_spritegfx(screen, bitmap, cliprect, gfxstart, width, height, color, flipx, flipy, x, y, zoom, 3 - pri);
|
draw_spritegfx(screen, bitmap, cliprect,
|
||||||
|
sprite_ptr->gfxstart,
|
||||||
src += inc;
|
width, height,
|
||||||
|
sprite_ptr->color,
|
||||||
|
flipx, flipy,
|
||||||
|
x, y,
|
||||||
|
sprite_ptr->zoom, 3 - pri);
|
||||||
|
}
|
||||||
|
sprite_ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline uint8_t imagetek_i4100_device::get_tile_pix( uint16_t code, uint8_t x, uint8_t y, bool const big, uint32_t &pix)
|
inline u8 imagetek_i4100_device::get_tile_pix(u16 code, u8 x, u8 y, bool const big, u32 &pix)
|
||||||
{
|
{
|
||||||
// Use code as an index into the tiles set table
|
// Use code as an index into the tiles set table
|
||||||
int table_index = (code & 0x1ff0) >> 3;
|
int table_index = (code & 0x1ff0) >> 3;
|
||||||
uint32_t tile = (m_tiletable[table_index] << 16) + m_tiletable[table_index | 1];
|
u32 const tile = (m_tiletable[table_index] << 16) + m_tiletable[table_index | 1];
|
||||||
|
|
||||||
if (code & 0x8000) // Special: draw a tile of a single color (i.e. not from the gfx ROMs)
|
if (code & 0x8000) // Special: draw a tile of a single color (i.e. not from the gfx ROMs)
|
||||||
{
|
{
|
||||||
@ -1077,13 +1097,28 @@ inline uint8_t imagetek_i4100_device::get_tile_pix( uint16_t code, uint8_t x, ui
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (((tile & 0x00f00000) == 0x00f00000) && (m_support_8bpp == true)) /* draw tile as 8bpp (e.g. balcube bg) */
|
else
|
||||||
{
|
{
|
||||||
gfx_element *gfx1 = gfx(big ? 3 : 1);
|
int const tilesize = big ? 16 : 8;
|
||||||
uint32_t tile2 = big ? ((tile & 0xfffff) + ((code & 0xf) << 3)) :
|
u16 color = (tile & 0x0ff00000) >> 16;
|
||||||
((tile & 0xfffff) + ((code & 0xf) << 1));
|
u8 trans;
|
||||||
const uint8_t* data;
|
int tileshift;
|
||||||
uint8_t flipxy = (code & 0x6000) >> 13;
|
|
||||||
|
if (((color & 0x00f0) == 0x00f0) && (m_support_8bpp == true)) /* draw tile as 8bpp (e.g. balcube bg) */
|
||||||
|
{
|
||||||
|
color &= 0x0f00;
|
||||||
|
trans = 0xff;
|
||||||
|
tileshift = big ? 3 : 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trans = 0xf;
|
||||||
|
tileshift = big ? 2 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx_element *gfx1 = gfx(tileshift);
|
||||||
|
u32 tile2 = ((tile & 0xfffff) + ((code & 0xf) << tileshift));
|
||||||
|
const u8* data;
|
||||||
|
|
||||||
if (tile2 < gfx1->elements())
|
if (tile2 < gfx1->elements())
|
||||||
data = gfx1->get_data(tile2);
|
data = gfx1->get_data(tile2);
|
||||||
@ -1093,52 +1128,17 @@ inline uint8_t imagetek_i4100_device::get_tile_pix( uint16_t code, uint8_t x, ui
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t idx = 0;
|
u8 const flipxy = (code & 0x6000) >> 13;
|
||||||
switch (flipxy)
|
if (flipxy & 1)
|
||||||
{
|
y = tilesize - y - 1;
|
||||||
default:
|
if (flipxy & 2)
|
||||||
case 0x0: idx = (y * (big ? 16 : 8)) + x; break;
|
x = tilesize - x - 1;
|
||||||
case 0x1: idx = (((big ? 15 : 7) - y) * (big ? 16 : 8)) + x; break;
|
|
||||||
case 0x2: idx = (y * (big ? 16 : 8)) + ((big ? 15 : 7) - x); break;
|
|
||||||
case 0x3: idx = (((big ? 15 : 7) - y) * (big ? 16 : 8)) + ((big ? 15 : 7) - x); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pix = m_palette->pen(data[idx] | (tile & 0x0f000000) >> 16);
|
u32 const idx = (y * gfx1->rowbytes()) + x;
|
||||||
|
|
||||||
if ((data[idx] & 0xff) != 0xff)
|
pix = m_palette->pen(data[idx] | color);
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gfx_element *gfx1 = gfx(big ? 2 : 0);
|
|
||||||
uint32_t tile2 = big ? ((tile & 0xfffff) + ((code & 0xf) << 2)) :
|
|
||||||
((tile & 0xfffff) + (code & 0xf));
|
|
||||||
const uint8_t* data;
|
|
||||||
uint8_t flipxy = (code & 0x6000) >> 13;
|
|
||||||
|
|
||||||
if (tile2 < gfx1->elements())
|
if ((data[idx] & trans) != trans)
|
||||||
data = gfx1->get_data(tile2);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pix = rgb_t::black();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t idx = 0;
|
|
||||||
switch (flipxy)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
case 0x0: idx = (y * (big ? 16 : 8)) + x; break;
|
|
||||||
case 0x1: idx = (((big ? 15 : 7) - y) * (big ? 16 : 8)) + x; break;
|
|
||||||
case 0x2: idx = (y * (big ? 16 : 8)) + ((big ? 15 : 7) - x); break;
|
|
||||||
case 0x3: idx = (((big ? 15 : 7) - y) * (big ? 16 : 8)) + ((big ? 15 : 7) - x); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pix = m_palette->pen(data[idx] | (tile & 0x0ff00000) >> 16);
|
|
||||||
|
|
||||||
if ((data[idx] & 0xf) != 0xf)
|
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
@ -1165,30 +1165,32 @@ inline uint8_t imagetek_i4100_device::get_tile_pix( uint16_t code, uint8_t x, ui
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
void imagetek_i4100_device::draw_tilemap( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t flags, uint32_t const pcode,
|
void imagetek_i4100_device::draw_tilemap(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, u32 flags, u32 const pcode,
|
||||||
int sx, int sy, int wx, int wy, bool const big, uint16_t const *tilemapram, int const layer )
|
int sx, int sy, int wx, int wy, bool const big, int const layer)
|
||||||
{
|
{
|
||||||
int y;
|
|
||||||
|
|
||||||
bitmap_ind8 &priority_bitmap = screen.priority();
|
bitmap_ind8 &priority_bitmap = screen.priority();
|
||||||
|
|
||||||
int width = big ? 4096 : 2048;
|
int const tileshift = big ? 4 : 3;
|
||||||
int height = big ? 4096 : 2048;
|
int const tilemask = (1 << tileshift) - 1;
|
||||||
|
|
||||||
int scrwidth = bitmap.width();
|
int const width = BIG_NX << tileshift;
|
||||||
int scrheight = bitmap.height();
|
int const height = BIG_NY << tileshift;
|
||||||
|
|
||||||
int windowwidth = width >> 2;
|
int const scrwidth = bitmap.width();
|
||||||
int windowheight = height >> 3;
|
int const scrheight = bitmap.height();
|
||||||
|
|
||||||
int dx = m_tilemap_scrolldx[layer] * (m_screen_flip ? 1 : -1);
|
int const windowwidth = width >> 2;
|
||||||
int dy = m_tilemap_scrolldy[layer] * (m_screen_flip ? 1 : -1);
|
int const windowheight = height >> 3;
|
||||||
|
|
||||||
|
int const dx = m_tilemap_scrolldx[layer] * (m_screen_flip ? 1 : -1);
|
||||||
|
int const dy = m_tilemap_scrolldy[layer] * (m_screen_flip ? 1 : -1);
|
||||||
|
|
||||||
sx += dx;
|
sx += dx;
|
||||||
sy += dy;
|
sy += dy;
|
||||||
|
|
||||||
int min_x, max_x, min_y, max_y;
|
int min_x, max_x, min_y, max_y;
|
||||||
|
|
||||||
|
// TODO : allow cliprect related drawing with flipscreen
|
||||||
if (dx != 0)
|
if (dx != 0)
|
||||||
{
|
{
|
||||||
min_x = 0;
|
min_x = 0;
|
||||||
@ -1211,60 +1213,37 @@ void imagetek_i4100_device::draw_tilemap( screen_device &screen, bitmap_rgb32 &b
|
|||||||
max_y = cliprect.max_y;
|
max_y = cliprect.max_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y = min_y; y <= max_y; y++)
|
int draw_y = m_screen_flip ? scrheight - min_y - 1 : min_y;
|
||||||
|
int draw_inc = m_screen_flip ? -1 : 1;
|
||||||
|
|
||||||
|
for (int y = min_y; y <= max_y; draw_y += draw_inc, y++)
|
||||||
{
|
{
|
||||||
int scrolly = (sy + y - wy) & (windowheight - 1);
|
int const scrolly = (sy + y - wy) & (windowheight - 1);
|
||||||
int x;
|
|
||||||
uint8_t *priority_baseaddr;
|
|
||||||
int srcline = (wy + scrolly) & (height - 1);
|
int srcline = (wy + scrolly) & (height - 1);
|
||||||
int srctilerow = srcline >> (big ? 4 : 3);
|
int const srctilerow = srcline >> tileshift;
|
||||||
|
srcline &= tilemask;
|
||||||
|
|
||||||
if (!m_screen_flip)
|
u32 *dst = &bitmap.pix32(draw_y);
|
||||||
{
|
u8 *priority_baseaddr = &priority_bitmap.pix8(draw_y);
|
||||||
uint32_t *dst = &bitmap.pix32(y);
|
|
||||||
priority_baseaddr = &priority_bitmap.pix8(y);
|
|
||||||
|
|
||||||
for (x = min_x; x <= max_x; x++)
|
int draw_x = m_screen_flip ? scrwidth - min_x - 1 : min_x;
|
||||||
|
for (int x = min_x; x <= max_x; draw_x += draw_inc, x++)
|
||||||
{
|
{
|
||||||
int scrollx = (sx + x - wx) & (windowwidth - 1);
|
int const scrollx = (sx + x - wx) & (windowwidth - 1);
|
||||||
int srccol = (wx + scrollx) & (width - 1);
|
int srccol = (wx + scrollx) & (width - 1);
|
||||||
int srctilecol = srccol >> (big ? 4 : 3);
|
int const srctilecol = srccol >> tileshift;
|
||||||
int tileoffs = srctilecol + srctilerow * BIG_NX;
|
srccol &= tilemask;
|
||||||
|
int const tileoffs = srctilecol + srctilerow * BIG_NX;
|
||||||
|
|
||||||
uint32_t dat = 0;
|
u32 dat = 0;
|
||||||
|
|
||||||
uint16_t tile = tilemapram[tileoffs];
|
u16 const tile = m_vram[layer][tileoffs];
|
||||||
uint8_t draw = get_tile_pix(tile, big ? (srccol & 0xf) : (srccol & 0x7), big ? (srcline & 0xf) : (srcline & 0x7), big, dat);
|
u8 const draw = get_tile_pix(tile, srccol, srcline, big, dat);
|
||||||
|
|
||||||
if (draw)
|
if (draw)
|
||||||
{
|
{
|
||||||
dst[x] = dat;
|
dst[draw_x] = dat;
|
||||||
priority_baseaddr[x] = (priority_baseaddr[x] & (pcode >> 8)) | pcode;
|
priority_baseaddr[draw_x] = pcode;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // flipped case
|
|
||||||
{
|
|
||||||
uint32_t *dst = &bitmap.pix32(scrheight-y-1);
|
|
||||||
priority_baseaddr = &priority_bitmap.pix8(scrheight-y-1);
|
|
||||||
|
|
||||||
for (x = min_x; x <= max_x; x++)
|
|
||||||
{
|
|
||||||
int scrollx = (sx + x - wx) & (windowwidth-1);
|
|
||||||
int srccol = (wx + scrollx) & (width - 1);
|
|
||||||
int srctilecol = srccol >> (big ? 4 : 3);
|
|
||||||
int tileoffs = srctilecol + srctilerow * BIG_NX;
|
|
||||||
|
|
||||||
uint32_t dat = 0;
|
|
||||||
|
|
||||||
uint16_t tile = tilemapram[tileoffs];
|
|
||||||
uint8_t draw = get_tile_pix(tile, big ? (srccol & 0xf) : (srccol & 0x7), big ? (srcline & 0xf) : (srcline & 0x7), big, dat);
|
|
||||||
|
|
||||||
if (draw)
|
|
||||||
{
|
|
||||||
dst[scrwidth-x-1] = dat;
|
|
||||||
priority_baseaddr[scrwidth-x-1] = (priority_baseaddr[scrwidth-x-1] & (pcode >> 8)) | pcode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1279,21 +1258,12 @@ void imagetek_i4100_device::draw_layers( screen_device &screen, bitmap_rgb32 &bi
|
|||||||
if (pri == m_layer_priority[layer])
|
if (pri == m_layer_priority[layer])
|
||||||
{
|
{
|
||||||
// Scroll and Window values
|
// Scroll and Window values
|
||||||
uint16_t sy = m_scroll[layer * 2 + 0]; uint16_t sx = m_scroll[layer * 2 + 1];
|
u16 const sy = m_scroll[layer * 2 + 0]; u16 const sx = m_scroll[layer * 2 + 1];
|
||||||
uint16_t wy = m_window[layer * 2 + 0]; uint16_t wx = m_window[layer * 2 + 1];
|
u16 const wy = m_window[layer * 2 + 0]; u16 const wx = m_window[layer * 2 + 1];
|
||||||
|
|
||||||
uint16_t *tilemapram = nullptr;
|
|
||||||
|
|
||||||
switch (layer)
|
|
||||||
{
|
|
||||||
case 0: tilemapram = m_vram_0; break;
|
|
||||||
case 1: tilemapram = m_vram_1; break;
|
|
||||||
case 2: tilemapram = m_vram_2; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool const big = (m_support_16x16 && m_layer_tile_select[layer]) == 1;
|
bool const big = (m_support_16x16 && m_layer_tile_select[layer]) == 1;
|
||||||
|
|
||||||
draw_tilemap(screen, bitmap, cliprect, 0, 3 - pri, sx, sy, wx, wy, big, tilemapram, layer);
|
draw_tilemap(screen, bitmap, cliprect, 0, 3 - pri, sx, sy, wx, wy, big, layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1312,7 +1282,7 @@ void imagetek_i4100_device::draw_foreground(screen_device &screen, bitmap_rgb32
|
|||||||
draw_sprites(screen, bitmap, cliprect);
|
draw_sprites(screen, bitmap, cliprect);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t imagetek_i4100_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
u32 imagetek_i4100_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||||
{
|
{
|
||||||
bitmap.fill(m_palette->pen(m_background_color), cliprect);
|
bitmap.fill(m_palette->pen(m_background_color), cliprect);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class imagetek_i4100_device : public device_t,
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// construction/destruction
|
// construction/destruction
|
||||||
imagetek_i4100_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
imagetek_i4100_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||||
|
|
||||||
void map(address_map &map);
|
void map(address_map &map);
|
||||||
|
|
||||||
@ -38,12 +38,12 @@ public:
|
|||||||
auto blit_irq_cb() { return m_blit_irq_cb.bind(); }
|
auto blit_irq_cb() { return m_blit_irq_cb.bind(); }
|
||||||
void set_spriteram_buffered(bool buffer) { m_spriteram_buffered = buffer; }
|
void set_spriteram_buffered(bool buffer) { m_spriteram_buffered = buffer; }
|
||||||
|
|
||||||
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||||
void draw_foreground(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
void draw_foreground(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||||
DECLARE_WRITE_LINE_MEMBER(screen_eof);
|
DECLARE_WRITE_LINE_MEMBER(screen_eof);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
imagetek_i4100_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool has_ext_tiles);
|
imagetek_i4100_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, bool has_ext_tiles);
|
||||||
|
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
//virtual void device_validity_check(validity_checker &valid) const override;
|
//virtual void device_validity_check(validity_checker &valid) const override;
|
||||||
@ -52,33 +52,45 @@ protected:
|
|||||||
virtual void device_reset() override;
|
virtual void device_reset() override;
|
||||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||||
|
|
||||||
required_shared_ptr<uint16_t> m_vram_0;
|
required_shared_ptr_array<u16, 3> m_vram;
|
||||||
required_shared_ptr<uint16_t> m_vram_1;
|
required_shared_ptr<u16> m_scratchram;
|
||||||
required_shared_ptr<uint16_t> m_vram_2;
|
required_shared_ptr<u16> m_blitter_regs;
|
||||||
required_shared_ptr<uint16_t> m_scratchram;
|
|
||||||
required_shared_ptr<uint16_t> m_blitter_regs;
|
|
||||||
required_device<buffered_spriteram16_device> m_spriteram;
|
required_device<buffered_spriteram16_device> m_spriteram;
|
||||||
required_shared_ptr<uint16_t> m_tiletable;
|
required_shared_ptr<u16> m_tiletable;
|
||||||
required_shared_ptr<uint16_t> m_window;
|
required_shared_ptr<u16> m_window;
|
||||||
required_shared_ptr<uint16_t> m_scroll;
|
required_shared_ptr<u16> m_scroll;
|
||||||
|
|
||||||
required_device<palette_device> m_palette;
|
required_device<palette_device> m_palette;
|
||||||
required_region_ptr<uint8_t> m_gfxrom;
|
required_region_ptr<u8> m_gfxrom;
|
||||||
|
|
||||||
std::unique_ptr<uint8_t[]> m_expanded_gfx1;
|
std::unique_ptr<u8[]> m_expanded_gfx1;
|
||||||
|
|
||||||
devcb_write_line m_blit_irq_cb;
|
devcb_write_line m_blit_irq_cb;
|
||||||
|
|
||||||
uint16_t m_rombank;
|
struct sprite_t
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
u32 gfxstart;
|
||||||
|
int width, height;
|
||||||
|
int flipx, flipy;
|
||||||
|
u16 color;
|
||||||
|
u32 zoom;
|
||||||
|
int curr_pri;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<sprite_t []> m_spritelist;
|
||||||
|
const sprite_t *m_sprite_end;
|
||||||
|
|
||||||
|
u16 m_rombank;
|
||||||
size_t m_gfxrom_size;
|
size_t m_gfxrom_size;
|
||||||
bool m_crtc_unlock;
|
bool m_crtc_unlock;
|
||||||
uint16_t m_sprite_count;
|
u16 m_sprite_count;
|
||||||
uint16_t m_sprite_priority;
|
u16 m_sprite_priority;
|
||||||
uint16_t m_sprite_xoffset,m_sprite_yoffset;
|
u16 m_sprite_xoffset,m_sprite_yoffset;
|
||||||
uint16_t m_sprite_color_code;
|
u16 m_sprite_color_code;
|
||||||
uint8_t m_layer_priority[3];
|
u8 m_layer_priority[3];
|
||||||
uint16_t m_background_color;
|
u16 m_background_color;
|
||||||
uint16_t m_screen_xoffset,m_screen_yoffset;
|
u16 m_screen_xoffset,m_screen_yoffset;
|
||||||
bool m_layer_tile_select[3];
|
bool m_layer_tile_select[3];
|
||||||
bool m_screen_blank;
|
bool m_screen_blank;
|
||||||
bool m_screen_flip;
|
bool m_screen_flip;
|
||||||
@ -87,7 +99,7 @@ protected:
|
|||||||
int m_tilemap_scrolldy[3];
|
int m_tilemap_scrolldy[3];
|
||||||
bool m_spriteram_buffered;
|
bool m_spriteram_buffered;
|
||||||
|
|
||||||
void blt_write( address_space &space, const int tmap, const offs_t offs, const uint16_t data, const uint16_t mask );
|
void blt_write(const int tmap, const offs_t offs, const u16 data, const u16 mask);
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -97,6 +109,8 @@ protected:
|
|||||||
emu_timer *m_blit_done_timer;
|
emu_timer *m_blit_done_timer;
|
||||||
|
|
||||||
// I/O operations
|
// I/O operations
|
||||||
|
inline u16 vram_r(offs_t offset, int layer) { return m_vram[layer][offset]; }
|
||||||
|
inline void vram_w(offs_t offset, u16 data, u16 mem_mask, int layer) { COMBINE_DATA(&m_vram[layer][offset]); }
|
||||||
DECLARE_READ16_MEMBER(vram_0_r);
|
DECLARE_READ16_MEMBER(vram_0_r);
|
||||||
DECLARE_READ16_MEMBER(vram_1_r);
|
DECLARE_READ16_MEMBER(vram_1_r);
|
||||||
DECLARE_READ16_MEMBER(vram_2_r);
|
DECLARE_READ16_MEMBER(vram_2_r);
|
||||||
@ -150,23 +164,23 @@ protected:
|
|||||||
DECLARE_WRITE16_MEMBER(rombank_w);
|
DECLARE_WRITE16_MEMBER(rombank_w);
|
||||||
|
|
||||||
void draw_layers(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri);
|
void draw_layers(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int pri);
|
||||||
inline uint8_t get_tile_pix( uint16_t code, uint8_t x, uint8_t y, bool const big, uint32_t &pix );
|
inline u8 get_tile_pix(u16 code, u8 x, u8 y, bool const big, u32 &pix);
|
||||||
void draw_tilemap( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t flags, uint32_t const pcode,
|
void draw_tilemap(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, u32 flags, u32 const pcode,
|
||||||
int sx, int sy, int wx, int wy, bool const big, uint16_t const *tilemapram, int const layer );
|
int sx, int sy, int wx, int wy, bool const big, int const layer);
|
||||||
void draw_spritegfx(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &clip,
|
void draw_spritegfx(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &clip,
|
||||||
uint32_t const gfxstart, uint16_t const width, uint16_t const height,
|
u32 const gfxstart, u16 const width, u16 const height,
|
||||||
uint16_t color, int const flipx, int const flipy, int sx, int sy,
|
u16 color, int const flipx, int const flipy, int sx, int sy,
|
||||||
uint32_t const scale, uint8_t const prival );
|
u32 const scale, u8 const prival);
|
||||||
void draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
void draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||||
void expand_gfx1();
|
void expand_gfx1();
|
||||||
|
|
||||||
// A 2048 x 2048 virtual tilemap
|
// A 2048 x 2048 virtual tilemap
|
||||||
static constexpr uint32_t BIG_NX = (0x100);
|
static constexpr u32 BIG_NX = (0x100);
|
||||||
static constexpr uint32_t BIG_NY = (0x100);
|
static constexpr u32 BIG_NY = (0x100);
|
||||||
|
|
||||||
// A smaller 512 x 256 window defines the actual tilemap
|
// A smaller 512 x 256 window defines the actual tilemap
|
||||||
static constexpr uint32_t WIN_NX = (0x40);
|
static constexpr u32 WIN_NX = (0x40);
|
||||||
static constexpr uint32_t WIN_NY = (0x20);
|
static constexpr u32 WIN_NY = (0x20);
|
||||||
|
|
||||||
bool m_inited_hack;
|
bool m_inited_hack;
|
||||||
DECLARE_GFXDECODE_MEMBER(gfxinfo);
|
DECLARE_GFXDECODE_MEMBER(gfxinfo);
|
||||||
@ -177,11 +191,11 @@ class imagetek_i4220_device : public imagetek_i4100_device
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// construction/destruction
|
// construction/destruction
|
||||||
imagetek_i4220_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
imagetek_i4220_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||||
|
|
||||||
// needed by Blazing Tornado / Grand Striker 2 for mixing with PSAC
|
// needed by Blazing Tornado / Grand Striker 2 for mixing with PSAC
|
||||||
// (it's unknown how the chip enables external sync)
|
// (it's unknown how the chip enables external sync)
|
||||||
uint32_t get_background_pen() { return m_palette->pen(m_background_color); };
|
u32 get_background_pen() { return m_palette->pen(m_background_color); };
|
||||||
|
|
||||||
void v2_map(address_map &map);
|
void v2_map(address_map &map);
|
||||||
};
|
};
|
||||||
@ -190,7 +204,7 @@ class imagetek_i4300_device : public imagetek_i4100_device
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// construction/destruction
|
// construction/destruction
|
||||||
imagetek_i4300_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
imagetek_i4300_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||||
|
|
||||||
void v3_map(address_map &map);
|
void v3_map(address_map &map);
|
||||||
};
|
};
|
||||||
|
@ -566,6 +566,6 @@ void hyprduel_state::init_magerror()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GAME( 1993, hyprduel, 0, hyprduel, hyprduel, hyprduel_state, init_hyprduel, ROT0, "Technosoft", "Hyper Duel (Japan set 1)", MACHINE_SUPPORTS_SAVE )
|
GAME( 1993, hyprduel, 0, hyprduel, hyprduel, hyprduel_state, init_hyprduel, ROT0, "Technosoft", "Hyper Duel (Japan set 1)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
|
||||||
GAME( 1993, hyprduel2, hyprduel, hyprduel, hyprduel, hyprduel_state, init_hyprduel, ROT0, "Technosoft", "Hyper Duel (Japan set 2)", MACHINE_SUPPORTS_SAVE )
|
GAME( 1993, hyprduel2, hyprduel, hyprduel, hyprduel, hyprduel_state, init_hyprduel, ROT0, "Technosoft", "Hyper Duel (Japan set 2)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
|
||||||
GAME( 1994, magerror, 0, magerror, magerror, hyprduel_state, init_magerror, ROT0, "Technosoft / Jaleco", "Magical Error wo Sagase", MACHINE_SUPPORTS_SAVE )
|
GAME( 1994, magerror, 0, magerror, magerror, hyprduel_state, init_magerror, ROT0, "Technosoft / Jaleco", "Magical Error wo Sagase", MACHINE_SUPPORTS_SAVE )
|
||||||
|
Loading…
Reference in New Issue
Block a user