fastfred.cpp, mermaid.cpp, rollrace.cpp: Replace MCFG_CPU_VBLANK_INT with line callbacks (nw)

This commit is contained in:
AJR 2018-03-28 20:17:35 -04:00
parent ead9bc470a
commit 95dcb83844
7 changed files with 299 additions and 286 deletions

View File

@ -180,6 +180,8 @@ READ8_MEMBER(fastfred_state::imago_sprites_offset_r)
WRITE_LINE_MEMBER(fastfred_state::nmi_mask_w)
{
m_nmi_mask = state;
if (!m_nmi_mask)
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
WRITE8_MEMBER(fastfred_state::sound_nmi_mask_w)
@ -618,10 +620,10 @@ static GFXDECODE_START( imago )
GFXDECODE_ENTRY( "gfx4", 0, imago_char_1bpp, 0x140, 1 )
GFXDECODE_END
INTERRUPT_GEN_MEMBER(fastfred_state::vblank_irq)
WRITE_LINE_MEMBER(fastfred_state::vblank_irq)
{
if(m_nmi_mask)
device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
if (state && m_nmi_mask)
m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
INTERRUPT_GEN_MEMBER(fastfred_state::sound_timer_irq)
@ -635,7 +637,6 @@ MACHINE_CONFIG_START(fastfred_state::fastfred)
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, XTAL(12'432'000)/4) /* 3.108 MHz; xtal from pcb pics, divider not verified */
MCFG_CPU_PROGRAM_MAP(fastfred_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", fastfred_state, vblank_irq)
MCFG_CPU_ADD("audiocpu", Z80, XTAL(12'432'000)/8) /* 1.554 MHz; xtal from pcb pics, divider not verified */
MCFG_CPU_PROGRAM_MAP(sound_map)
@ -660,6 +661,7 @@ MACHINE_CONFIG_START(fastfred_state::fastfred)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(fastfred_state, screen_update_fastfred)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(fastfred_state, vblank_irq))
MCFG_GFXDECODE_ADD("gfxdecode", "palette", fastfred)

View File

@ -153,6 +153,8 @@ WRITE_LINE_MEMBER(mermaid_state::ay2_enable_w)
WRITE_LINE_MEMBER(mermaid_state::nmi_mask_w)
{
m_nmi_mask = state;
if (!m_nmi_mask)
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
/* Memory Map */
@ -420,8 +422,6 @@ WRITE_LINE_MEMBER(mermaid_state::rougien_adpcm_int)
INTERRUPT_GEN_MEMBER(mermaid_state::vblank_irq)
{
if(m_nmi_mask)
device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
}
MACHINE_CONFIG_START(mermaid_state::mermaid)

View File

@ -47,6 +47,8 @@ WRITE8_MEMBER(rollrace_state::fake_d800_w)
WRITE_LINE_MEMBER(rollrace_state::nmi_mask_w)
{
m_nmi_mask = state;
if (!m_nmi_mask)
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
WRITE8_MEMBER(rollrace_state::sound_nmi_mask_w)
@ -235,10 +237,10 @@ static GFXDECODE_START( rollrace )
GFXDECODE_ENTRY( "gfx5", 0x0000, spritelayout, 0, 32 )
GFXDECODE_END
INTERRUPT_GEN_MEMBER(rollrace_state::vblank_irq)
WRITE_LINE_MEMBER(rollrace_state::vblank_irq)
{
if(m_nmi_mask)
device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
if (state && m_nmi_mask)
m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
INTERRUPT_GEN_MEMBER(rollrace_state::sound_timer_irq)
@ -252,7 +254,6 @@ MACHINE_CONFIG_START(rollrace_state::rollrace)
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80,XTAL(24'000'000)/8) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(rollrace_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", rollrace_state, vblank_irq)
MCFG_CPU_ADD("audiocpu", Z80,XTAL(24'000'000)/16) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(rollrace_sound_map)
@ -275,6 +276,7 @@ MACHINE_CONFIG_START(rollrace_state::rollrace)
MCFG_SCREEN_VISIBLE_AREA(0,256-1,16, 255-16)
MCFG_SCREEN_UPDATE_DRIVER(rollrace_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(rollrace_state, vblank_irq))
MCFG_GFXDECODE_ADD("gfxdecode", "palette", rollrace)
MCFG_PALETTE_ADD("palette", 256)

View File

@ -74,7 +74,7 @@ public:
TILE_GET_INFO_MEMBER(imago_get_tile_info_fg);
TILE_GET_INFO_MEMBER(imago_get_tile_info_web);
INTERRUPT_GEN_MEMBER(vblank_irq);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
INTERRUPT_GEN_MEMBER(sound_timer_irq);
virtual void machine_start() override;

View File

@ -101,6 +101,7 @@ public:
INTERRUPT_GEN_MEMBER(vblank_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
uint8_t collision_check( rectangle& rect );
void collision_update();
DECLARE_WRITE_LINE_MEMBER(rougien_adpcm_int);
void rougien(machine_config &config);
void mermaid(machine_config &config);

View File

@ -58,7 +58,7 @@ public:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
INTERRUPT_GEN_MEMBER(sound_timer_irq);
void rollace2(machine_config &config);
void rollrace(machine_config &config);

View File

@ -244,285 +244,293 @@ uint8_t mermaid_state::collision_check( rectangle& rect )
return data;
}
void mermaid_state::collision_update()
{
const rectangle &visarea = m_screen->visible_area();
uint8_t *spriteram = m_spriteram;
int offs, offs2;
m_coll_bit0 = 0;
m_coll_bit1 = 0;
m_coll_bit2 = 0;
m_coll_bit3 = 0;
m_coll_bit6 = 0;
// check for bit 0 (sprite-sprite), 1 (sprite-foreground), 2 (sprite-background)
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{
int attr = spriteram[offs + 2];
int bank = (attr & 0x30) >> 4;
int coll = (attr & 0xc0) >> 6;
int code = (spriteram[offs] & 0x3f) | (bank << 6);
int flipx = spriteram[offs] & 0x40;
int flipy = spriteram[offs] & 0x80;
int sx = spriteram[offs + 3] + 1;
int sy = 240 - spriteram[offs + 1];
rectangle rect;
if (coll != 1) continue;
code |= m_rougien_gfxbank1 * 0x2800;
code |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx = !flipx;
sx = 240 - sx;
}
if (flip_screen_y())
{
flipy = !flipy;
sy = 240 - sy;
}
rect.min_x = sx;
rect.min_y = sy;
rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1;
rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1;
rect &= visarea;
// check collision sprite - background
m_helper.fill(0, rect);
m_helper2.fill(0, rect);
m_bg_tilemap->draw(*m_screen, m_helper, rect, 0, 0);
m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit2 |= collision_check(rect);
// check collision sprite - foreground
m_helper.fill(0, rect);
m_helper2.fill(0, rect);
m_fg_tilemap->draw(*m_screen, m_helper, rect, 0, 0);
m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit1 |= collision_check(rect);
// check collision sprite - sprite
m_helper.fill(0, rect);
m_helper2.fill(0, rect);
for (offs2 = m_spriteram.bytes() - 4; offs2 >= 0; offs2 -= 4)
if (offs != offs2)
{
int attr2 = spriteram[offs2 + 2];
int bank2 = (attr2 & 0x30) >> 4;
int coll2 = (attr2 & 0xc0) >> 6;
int code2 = (spriteram[offs2] & 0x3f) | (bank2 << 6);
int flipx2 = spriteram[offs2] & 0x40;
int flipy2 = spriteram[offs2] & 0x80;
int sx2 = spriteram[offs2 + 3] + 1;
int sy2 = 240 - spriteram[offs2 + 1];
if (coll2 != 0) continue;
code2 |= m_rougien_gfxbank1 * 0x2800;
code2 |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx2 = !flipx2;
sx2 = 240 - sx2;
}
if (flip_screen_y())
{
flipy2 = !flipy2;
sy2 = 240 - sy2;
}
m_gfxdecode->gfx(1)->transpen(m_helper,rect, code2, 0, flipx2, flipy2, sx2, sy2, 0);
}
m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit0 |= collision_check(rect);
}
// check for bit 3 (sprite-sprite)
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{
int attr = spriteram[offs + 2];
int bank = (attr & 0x30) >> 4;
int coll = (attr & 0xc0) >> 6;
int code = (spriteram[offs] & 0x3f) | (bank << 6);
int flipx = spriteram[offs] & 0x40;
int flipy = spriteram[offs] & 0x80;
int sx = spriteram[offs + 3] + 1;
int sy = 240 - spriteram[offs + 1];
rectangle rect;
if (coll != 2) continue;
code |= m_rougien_gfxbank1 * 0x2800;
code |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx = !flipx;
sx = 240 - sx;
}
if (flip_screen_y())
{
flipy = !flipy;
sy = 240 - sy;
}
rect.min_x = sx;
rect.min_y = sy;
rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1;
rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1;
rect &= visarea;
// check collision sprite - sprite
m_helper.fill(0, rect);
m_helper2.fill(0, rect);
for (offs2 = m_spriteram.bytes() - 4; offs2 >= 0; offs2 -= 4)
if (offs != offs2)
{
int attr2 = spriteram[offs2 + 2];
int bank2 = (attr2 & 0x30) >> 4;
int coll2 = (attr2 & 0xc0) >> 6;
int code2 = (spriteram[offs2] & 0x3f) | (bank2 << 6);
int flipx2 = spriteram[offs2] & 0x40;
int flipy2 = spriteram[offs2] & 0x80;
int sx2 = spriteram[offs2 + 3] + 1;
int sy2 = 240 - spriteram[offs2 + 1];
if (coll2 != 0) continue;
code2 |= m_rougien_gfxbank1 * 0x2800;
code2 |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx2 = !flipx2;
sx2 = 240 - sx2;
}
if (flip_screen_y())
{
flipy2 = !flipy2;
sy2 = 240 - sy2;
}
m_gfxdecode->gfx(1)->transpen(m_helper,rect, code2, 0, flipx2, flipy2, sx2, sy2, 0);
}
m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit3 |= collision_check(rect);
}
// check for bit 6
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{
int attr = spriteram[offs + 2];
int bank = (attr & 0x30) >> 4;
int coll = (attr & 0xc0) >> 6;
int code = (spriteram[offs] & 0x3f) | (bank << 6);
int flipx = spriteram[offs] & 0x40;
int flipy = spriteram[offs] & 0x80;
int sx = spriteram[offs + 3] + 1;
int sy = 240 - spriteram[offs + 1];
rectangle rect;
if (coll != 1) continue;
code |= m_rougien_gfxbank1 * 0x2800;
code |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx = !flipx;
sx = 240 - sx;
}
if (flip_screen_y())
{
flipy = !flipy;
sy = 240 - sy;
}
rect.min_x = sx;
rect.min_y = sy;
rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1;
rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1;
rect &= visarea;
// check collision sprite - sprite
m_helper.fill(0, rect);
m_helper2.fill(0, rect);
for (offs2 = m_spriteram.bytes() - 4; offs2 >= 0; offs2 -= 4)
if (offs != offs2)
{
int attr2 = spriteram[offs2 + 2];
int bank2 = (attr2 & 0x30) >> 4;
int coll2 = (attr2 & 0xc0) >> 6;
int code2 = (spriteram[offs2] & 0x3f) | (bank2 << 6);
int flipx2 = spriteram[offs2] & 0x40;
int flipy2 = spriteram[offs2] & 0x80;
int sx2 = spriteram[offs2 + 3] + 1;
int sy2 = 240 - spriteram[offs2 + 1];
if (coll2 != 2) continue;
code2 |= m_rougien_gfxbank1 * 0x2800;
code2 |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx2 = !flipx2;
sx2 = 240 - sx2;
}
if (flip_screen_y())
{
flipy2 = !flipy2;
sy2 = 240 - sy2;
}
m_gfxdecode->gfx(1)->transpen(m_helper,rect, code2, 0, flipx2, flipy2, sx2, sy2, 0);
}
m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit6 |= collision_check(rect);
}
}
WRITE_LINE_MEMBER(mermaid_state::screen_vblank_mermaid)
{
// rising edge
if (state)
{
const rectangle &visarea = m_screen->visible_area();
uint8_t *spriteram = m_spriteram;
collision_update();
int offs, offs2;
m_coll_bit0 = 0;
m_coll_bit1 = 0;
m_coll_bit2 = 0;
m_coll_bit3 = 0;
m_coll_bit6 = 0;
// check for bit 0 (sprite-sprite), 1 (sprite-foreground), 2 (sprite-background)
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{
int attr = spriteram[offs + 2];
int bank = (attr & 0x30) >> 4;
int coll = (attr & 0xc0) >> 6;
int code = (spriteram[offs] & 0x3f) | (bank << 6);
int flipx = spriteram[offs] & 0x40;
int flipy = spriteram[offs] & 0x80;
int sx = spriteram[offs + 3] + 1;
int sy = 240 - spriteram[offs + 1];
rectangle rect;
if (coll != 1) continue;
code |= m_rougien_gfxbank1 * 0x2800;
code |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx = !flipx;
sx = 240 - sx;
}
if (flip_screen_y())
{
flipy = !flipy;
sy = 240 - sy;
}
rect.min_x = sx;
rect.min_y = sy;
rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1;
rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1;
rect &= visarea;
// check collision sprite - background
m_helper.fill(0, rect);
m_helper2.fill(0, rect);
m_bg_tilemap->draw(*m_screen, m_helper, rect, 0, 0);
m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit2 |= collision_check(rect);
// check collision sprite - foreground
m_helper.fill(0, rect);
m_helper2.fill(0, rect);
m_fg_tilemap->draw(*m_screen, m_helper, rect, 0, 0);
m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit1 |= collision_check(rect);
// check collision sprite - sprite
m_helper.fill(0, rect);
m_helper2.fill(0, rect);
for (offs2 = m_spriteram.bytes() - 4; offs2 >= 0; offs2 -= 4)
if (offs != offs2)
{
int attr2 = spriteram[offs2 + 2];
int bank2 = (attr2 & 0x30) >> 4;
int coll2 = (attr2 & 0xc0) >> 6;
int code2 = (spriteram[offs2] & 0x3f) | (bank2 << 6);
int flipx2 = spriteram[offs2] & 0x40;
int flipy2 = spriteram[offs2] & 0x80;
int sx2 = spriteram[offs2 + 3] + 1;
int sy2 = 240 - spriteram[offs2 + 1];
if (coll2 != 0) continue;
code2 |= m_rougien_gfxbank1 * 0x2800;
code2 |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx2 = !flipx2;
sx2 = 240 - sx2;
}
if (flip_screen_y())
{
flipy2 = !flipy2;
sy2 = 240 - sy2;
}
m_gfxdecode->gfx(1)->transpen(m_helper,rect, code2, 0, flipx2, flipy2, sx2, sy2, 0);
}
m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit0 |= collision_check(rect);
}
// check for bit 3 (sprite-sprite)
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{
int attr = spriteram[offs + 2];
int bank = (attr & 0x30) >> 4;
int coll = (attr & 0xc0) >> 6;
int code = (spriteram[offs] & 0x3f) | (bank << 6);
int flipx = spriteram[offs] & 0x40;
int flipy = spriteram[offs] & 0x80;
int sx = spriteram[offs + 3] + 1;
int sy = 240 - spriteram[offs + 1];
rectangle rect;
if (coll != 2) continue;
code |= m_rougien_gfxbank1 * 0x2800;
code |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx = !flipx;
sx = 240 - sx;
}
if (flip_screen_y())
{
flipy = !flipy;
sy = 240 - sy;
}
rect.min_x = sx;
rect.min_y = sy;
rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1;
rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1;
rect &= visarea;
// check collision sprite - sprite
m_helper.fill(0, rect);
m_helper2.fill(0, rect);
for (offs2 = m_spriteram.bytes() - 4; offs2 >= 0; offs2 -= 4)
if (offs != offs2)
{
int attr2 = spriteram[offs2 + 2];
int bank2 = (attr2 & 0x30) >> 4;
int coll2 = (attr2 & 0xc0) >> 6;
int code2 = (spriteram[offs2] & 0x3f) | (bank2 << 6);
int flipx2 = spriteram[offs2] & 0x40;
int flipy2 = spriteram[offs2] & 0x80;
int sx2 = spriteram[offs2 + 3] + 1;
int sy2 = 240 - spriteram[offs2 + 1];
if (coll2 != 0) continue;
code2 |= m_rougien_gfxbank1 * 0x2800;
code2 |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx2 = !flipx2;
sx2 = 240 - sx2;
}
if (flip_screen_y())
{
flipy2 = !flipy2;
sy2 = 240 - sy2;
}
m_gfxdecode->gfx(1)->transpen(m_helper,rect, code2, 0, flipx2, flipy2, sx2, sy2, 0);
}
m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit3 |= collision_check(rect);
}
// check for bit 6
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{
int attr = spriteram[offs + 2];
int bank = (attr & 0x30) >> 4;
int coll = (attr & 0xc0) >> 6;
int code = (spriteram[offs] & 0x3f) | (bank << 6);
int flipx = spriteram[offs] & 0x40;
int flipy = spriteram[offs] & 0x80;
int sx = spriteram[offs + 3] + 1;
int sy = 240 - spriteram[offs + 1];
rectangle rect;
if (coll != 1) continue;
code |= m_rougien_gfxbank1 * 0x2800;
code |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx = !flipx;
sx = 240 - sx;
}
if (flip_screen_y())
{
flipy = !flipy;
sy = 240 - sy;
}
rect.min_x = sx;
rect.min_y = sy;
rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1;
rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1;
rect &= visarea;
// check collision sprite - sprite
m_helper.fill(0, rect);
m_helper2.fill(0, rect);
for (offs2 = m_spriteram.bytes() - 4; offs2 >= 0; offs2 -= 4)
if (offs != offs2)
{
int attr2 = spriteram[offs2 + 2];
int bank2 = (attr2 & 0x30) >> 4;
int coll2 = (attr2 & 0xc0) >> 6;
int code2 = (spriteram[offs2] & 0x3f) | (bank2 << 6);
int flipx2 = spriteram[offs2] & 0x40;
int flipy2 = spriteram[offs2] & 0x80;
int sx2 = spriteram[offs2 + 3] + 1;
int sy2 = 240 - spriteram[offs2 + 1];
if (coll2 != 2) continue;
code2 |= m_rougien_gfxbank1 * 0x2800;
code2 |= m_rougien_gfxbank2 * 0x2400;
if (flip_screen_x())
{
flipx2 = !flipx2;
sx2 = 240 - sx2;
}
if (flip_screen_y())
{
flipy2 = !flipy2;
sy2 = 240 - sy2;
}
m_gfxdecode->gfx(1)->transpen(m_helper,rect, code2, 0, flipx2, flipy2, sx2, sy2, 0);
}
m_gfxdecode->gfx(1)->transpen(m_helper2,rect, code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit6 |= collision_check(rect);
}
if (m_nmi_mask)
m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
}