summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/megasys1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/megasys1.cpp')
-rw-r--r--src/mame/video/megasys1.cpp113
1 files changed, 58 insertions, 55 deletions
diff --git a/src/mame/video/megasys1.cpp b/src/mame/video/megasys1.cpp
index 8b0d3dc577d..ace59ad82cd 100644
--- a/src/mame/video/megasys1.cpp
+++ b/src/mame/video/megasys1.cpp
@@ -202,17 +202,14 @@ VIDEO_START_MEMBER(megasys1_state,megasys1)
{
m_spriteram = &m_ram[0x8000/2];
- m_buffer_objectram = std::make_unique<uint16_t[]>(0x2000);
- m_buffer_spriteram16 = std::make_unique<uint16_t[]>(0x2000);
- m_buffer2_objectram = std::make_unique<uint16_t[]>(0x2000);
- m_buffer2_spriteram16 = std::make_unique<uint16_t[]>(0x2000);
+ m_buffer_objectram = std::make_unique<u16[]>(0x2000);
+ m_buffer_spriteram16 = std::make_unique<u16[]>(0x2000);
+ m_buffer2_objectram = std::make_unique<u16[]>(0x2000);
+ m_buffer2_spriteram16 = std::make_unique<u16[]>(0x2000);
m_active_layers = m_sprite_bank = m_screen_flag = m_sprite_flag = 0;
m_hardware_type_z = 0;
- if (strcmp(machine().system().name, "lomakai") == 0 ||
- strcmp(machine().system().name, "makaiden") == 0)
- m_hardware_type_z = 1;
m_screen->register_screen_bitmap(m_sprite_buffer_bitmap);
@@ -225,6 +222,12 @@ VIDEO_START_MEMBER(megasys1_state,megasys1)
save_item(NAME(m_sprite_flag));
}
+VIDEO_START_MEMBER(megasys1_state,megasys1_z)
+{
+ VIDEO_START_CALL_MEMBER(megasys1);
+ m_hardware_type_z = 1;
+}
+
/***************************************************************************
Video registers access
@@ -268,20 +271,20 @@ WRITE16_MEMBER(megasys1_state::screen_flag_w)
WRITE16_MEMBER(megasys1_state::soundlatch_w)
{
- m_soundlatch->write(space, 0, data, mem_mask);
+ m_soundlatch[0]->write(space, 0, data, mem_mask);
m_audiocpu->set_input_line(4, HOLD_LINE);
}
WRITE16_MEMBER(megasys1_state::soundlatch_z_w)
{
- m_soundlatch_z->write(space, 0, data & 0xff);
+ m_soundlatch[0]->write(space, 0, data & 0xff);
m_audiocpu->set_input_line(5, HOLD_LINE);
}
WRITE16_MEMBER(megasys1_state::soundlatch_c_w)
{
// Cybattler reads sound latch on irq 2
- m_soundlatch->write(space, 0, data, mem_mask);
+ m_soundlatch[0]->write(space, 0, data, mem_mask);
m_audiocpu->set_input_line(2, HOLD_LINE);
}
@@ -331,17 +334,17 @@ WRITE16_MEMBER(megasys1_state::monkelf_scroll1_w)
void megasys1_state::mix_sprite_bitmap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
gfx_element *decodegfx = m_gfxdecode->gfx(0);
- uint16_t colorbase = decodegfx->colorbase();
+ u16 colorbase = decodegfx->colorbase();
for (int y = cliprect.min_y;y <= cliprect.max_y;y++)
{
- uint16_t* srcline = &m_sprite_buffer_bitmap.pix16(y);
- uint16_t* dstline = &bitmap.pix16(y);
- uint8_t *prio = &screen.priority().pix8(y);
+ u16* srcline = &m_sprite_buffer_bitmap.pix16(y);
+ u16* dstline = &bitmap.pix16(y);
+ u8 *prio = &screen.priority().pix8(y);
for (int x = cliprect.min_x;x <= cliprect.max_x;x++)
{
- uint16_t pixel = srcline[x];
+ u16 pixel = srcline[x];
if ((pixel & 0xf) != 0xf)
{
@@ -350,7 +353,7 @@ void megasys1_state::mix_sprite_bitmap(screen_device &screen, bitmap_ind16 &bitm
if ((priority & (1 << (prio[x] & 0x1f))) == 0)
{
- uint8_t coldat = pixel & 0x3fff;
+ u8 coldat = pixel & 0x3fff;
dstline[x] = coldat + colorbase;
}
@@ -359,15 +362,15 @@ void megasys1_state::mix_sprite_bitmap(screen_device &screen, bitmap_ind16 &bitm
}
}
-void megasys1_state::partial_clear_sprite_bitmap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t param)
+void megasys1_state::partial_clear_sprite_bitmap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, u8 param)
{
for (int y = cliprect.min_y;y <= cliprect.max_y;y++)
{
- uint16_t* srcline = &m_sprite_buffer_bitmap.pix16(y);
+ u16* srcline = &m_sprite_buffer_bitmap.pix16(y);
for (int x = cliprect.min_x;x <= cliprect.max_x;x++)
{
- uint16_t pixel = srcline[x];
+ u16 pixel = srcline[x];
srcline[x] = pixel & 0x7fff; // wipe our 'drawn here' marker otherwise trails will always have priority over new sprites, which is incorrect.
// guess, very unclear from the video refernece we have, used when removing p47 trails
@@ -378,13 +381,13 @@ void megasys1_state::partial_clear_sprite_bitmap(screen_device &screen, bitmap_i
}
-inline void megasys1_state::draw_16x16_priority_sprite(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect, int32_t code, int32_t color, int32_t sx, int32_t sy, int32_t flipx, int32_t flipy, uint8_t mosaic, uint8_t mosaicsol, int32_t priority)
+inline void megasys1_state::draw_16x16_priority_sprite(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect, s32 code, s32 color, s32 sx, s32 sy, s32 flipx, s32 flipy, u8 mosaic, u8 mosaicsol, s32 priority)
{
// if (sy >= nScreenHeight || sy < -15 || sx >= nScreenWidth || sx < -15) return;
gfx_element *decodegfx = m_gfxdecode->gfx(0);
sy = sy + 16;
- const uint8_t* gfx = decodegfx->get_data(code);
+ const u8* gfx = decodegfx->get_data(code);
flipy = (flipy) ? 0x0f : 0;
flipx = (flipx) ? 0x0f : 0;
@@ -392,28 +395,28 @@ inline void megasys1_state::draw_16x16_priority_sprite(screen_device &screen, bi
color = color * 16;
- for (int32_t y = 0; y < 16; y++, sy++, sx-=16)
+ for (s32 y = 0; y < 16; y++, sy++, sx-=16)
{
- // uint16_t *dest = &bitmap.pix16(sy)+ sx;
- // uint8_t *prio = &screen.priority().pix8(sy) + sx;
- uint16_t* dest = &m_sprite_buffer_bitmap.pix16(sy)+ sx;
+ // u16 *dest = &bitmap.pix16(sy)+ sx;
+ // u8 *prio = &screen.priority().pix8(sy) + sx;
+ u16* dest = &m_sprite_buffer_bitmap.pix16(sy)+ sx;
- for (int32_t x = 0; x < 16; x++, sx++)
+ for (s32 x = 0; x < 16; x++, sx++)
{
if (sx < cliprect.min_x || sy < cliprect.min_y || sx > cliprect.max_x || sy > cliprect.max_y) continue;
- int32_t pxl;
+ s32 pxl;
- if (mosaicsol) {
+ if (mosaicsol)
pxl = gfx[(((y ^ flipy) | mosaic) * 16) + ((x ^ flipx) | mosaic)];
- } else {
+ else
pxl = gfx[(((y ^ flipy) & ~mosaic) * 16) + ((x ^ flipx) & ~mosaic)];
- }
- if (pxl != 0x0f) {
- if (!(dest[x] & 0x8000)) {
+ if (pxl != 0x0f)
+ {
+ if (!(dest[x] & 0x8000))
+ {
dest[x] = (pxl+color) | (priority << 14);
-
dest[x] |= 0x8000;
}
}
@@ -446,36 +449,36 @@ void megasys1_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,co
partial_clear_sprite_bitmap(screen, bitmap, cliprect, m_sprite_flag&0x0f);
}
- int32_t color_mask = (m_sprite_flag & 0x100) ? 0x07 : 0x0f;
+ s32 color_mask = (m_sprite_flag & 0x100) ? 0x07 : 0x0f;
- uint16_t *objectram = (uint16_t*)m_buffer2_objectram.get();
- uint16_t *spriteram = (uint16_t*)m_buffer2_spriteram16.get();
+ u16 *objectram = (u16*)m_buffer2_objectram.get();
+ u16 *spriteram = (u16*)m_buffer2_spriteram16.get();
- for (int32_t offs = (0x800-8)/2; offs >= 0; offs -= 4)
+ for (s32 offs = (0x800-8)/2; offs >= 0; offs -= 4)
{
- for (int32_t sprite = 0; sprite < 4 ; sprite ++)
+ for (s32 sprite = 0; sprite < 4 ; sprite ++)
{
- uint16_t *objectdata = &objectram[offs + (0x800/2) * sprite];
- uint16_t *spritedata = &spriteram[(objectdata[0] & 0x7f) * 8];
+ u16 *objectdata = &objectram[offs + (0x800/2) * sprite];
+ u16 *spritedata = &spriteram[(objectdata[0] & 0x7f) * 8];
- int32_t attr = spritedata[4];
+ s32 attr = spritedata[4];
if (((attr & 0xc0) >> 6) != sprite) continue;
- int32_t sx = (spritedata[5] + objectdata[1]) & 0x1ff;
- int32_t sy = (spritedata[6] + objectdata[2]) & 0x1ff;
+ s32 sx = (spritedata[5] + objectdata[1]) & 0x1ff;
+ s32 sy = (spritedata[6] + objectdata[2]) & 0x1ff;
if (sx > 255) sx -= 512;
if (sy > 255) sy -= 512;
- int32_t code = spritedata[7] + objectdata[3];
- int32_t color = attr & color_mask;
+ s32 code = spritedata[7] + objectdata[3];
+ s32 color = attr & color_mask;
- int32_t flipx = attr & 0x40;
- int32_t flipy = attr & 0x80;
- //int32_t pri = (attr & 0x08) ? 0x0c : 0x0a;
- int32_t pri = (attr & 0x08)>>3;
- int32_t mosaic = (attr & 0x0f00)>>8;
- int32_t mossol = (attr & 0x1000)>>8;
+ s32 flipx = attr & 0x40;
+ s32 flipy = attr & 0x80;
+ //s32 pri = (attr & 0x08) ? 0x0c : 0x0a;
+ s32 pri = (attr & 0x08)>>3;
+ s32 mosaic = (attr & 0x0f00)>>8;
+ s32 mossol = (attr & 0x1000)>>8;
code = (code & 0xfff) + ((m_sprite_bank & 1) << 12);
@@ -493,13 +496,13 @@ void megasys1_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,co
} /* non Z hw */
else
{
- uint16_t *spriteram16 = m_spriteram;
+ u16 *spriteram16 = m_spriteram;
/* MS1-Z just draws Sprite Data, and in reverse order */
for (sprite = 0x80-1;sprite >= 0;sprite--)
{
- uint16_t *spritedata = &spriteram16[ sprite * 0x10/2];
+ u16 *spritedata = &spriteram16[ sprite * 0x10/2];
attr = spritedata[ 8/2 ];
@@ -613,7 +616,7 @@ struct priority
*/
void megasys1_state::priority_create()
{
- const uint8_t *color_prom = memregion("proms")->base();
+ const u8 *color_prom = memregion("proms")->base();
int pri_code, offset, i, order;
/* convert PROM to something we can use */
@@ -766,7 +769,7 @@ void megasys1_state::megasys1_palette(palette_device &palette)
***************************************************************************/
-uint32_t megasys1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+u32 megasys1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i, flag, pri, primask;
int active_layers;