From 0a7b50a0054aa8aa7218c5542f00cd4b6ec723dc Mon Sep 17 00:00:00 2001 From: Jonathan Gevaryahu Date: Tue, 23 Oct 2012 07:27:04 +0000 Subject: [PATCH] Cleaned up mustache boy vblank interrupts: Got rid of the nasty long-int hack in mustache boy in favor of the same 'vblank in+vblank out' int scheme the other similar seibu games of this era used (panicrd, darkmist). This seems much more likely to be what the actual pcb used, and works just fine. [Lord Nightmare] --- src/mame/drivers/mustache.c | 36 ++++++++++++++---------------------- src/mame/includes/mustache.h | 7 +++---- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/mame/drivers/mustache.c b/src/mame/drivers/mustache.c index 3901d1097ad..9818ac88802 100644 --- a/src/mame/drivers/mustache.c +++ b/src/mame/drivers/mustache.c @@ -157,37 +157,29 @@ static GFXDECODE_START( mustache ) GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0x80, 8 ) GFXDECODE_END -TIMER_CALLBACK_MEMBER(mustache_state::clear_irq_cb) -{ - machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); -} - -INTERRUPT_GEN_MEMBER(mustache_state::assert_irq) -{ - device.execute().set_input_line(0, ASSERT_LINE); - m_clear_irq_timer->adjust(downcast(&device)->cycles_to_attotime(14288)); - /* Timing here is an educated GUESS, Z80 /INT must stay high so the irq - fires no less than TWICE per frame, else game doesn't work right. - 6000000 / 56.747 = 105732.4616 cycles per frame, we'll call it A - screen size is 256x256, though less is visible. - lets assume we have 256 lines L and 40 'lines' (really line-times) - of vblank V: - So (A/(L+V))*V = the number of cycles spent in vblank. - (105732.4616 / (256+40)) * 40 = 14288.17049 z80 clocks in vblank - */ -} - void mustache_state::machine_start() { - m_clear_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mustache_state::clear_irq_cb),this)); + // do nothing, not even sure why this is here anymore. } +TIMER_DEVICE_CALLBACK_MEMBER(mustache_state::mustache_scanline) +{ + int scanline = param; + + if(scanline == 240) // vblank-out irq + machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE,0x10); /* RST 10h */ + + if(scanline == 0) // vblank-in irq + machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE,0x08); /* RST 08h */ +} + + static MACHINE_CONFIG_START( mustache, mustache_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, CPU_CLOCK) MCFG_CPU_PROGRAM_MAP(memmap) - MCFG_CPU_VBLANK_INT_DRIVER("screen", mustache_state, assert_irq) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", mustache_state, mustache_scanline, "screen", 0, 1) MCFG_CPU_ADD(CPUTAG_T5182,Z80, T5182_CLOCK) MCFG_CPU_PROGRAM_MAP(t5182_map) diff --git a/src/mame/includes/mustache.h b/src/mame/includes/mustache.h index a0e9d9751d5..b436f4fb220 100644 --- a/src/mame/includes/mustache.h +++ b/src/mame/includes/mustache.h @@ -7,7 +7,7 @@ public: m_spriteram(*this, "spriteram"){ } required_shared_ptr m_videoram; - emu_timer *m_clear_irq_timer; + emu_timer *m_clear_irq_timer; tilemap_t *m_bg_tilemap; int m_control_byte; required_shared_ptr m_spriteram; @@ -16,10 +16,9 @@ public: DECLARE_WRITE8_MEMBER(mustache_scroll_w); DECLARE_DRIVER_INIT(mustache); TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_start(); + virtual void machine_start(); virtual void video_start(); virtual void palette_init(); UINT32 screen_update_mustache(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(assert_irq); - TIMER_CALLBACK_MEMBER(clear_irq_cb); + TIMER_DEVICE_CALLBACK_MEMBER(mustache_scanline); };