Previous 199869 Revisions Next

r18672 Tuesday 23rd October, 2012 at 07:27:04 UTC by Jonathan Gevaryahu
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
[src/mame/includes]mustache.h

trunk/src/mame/includes/mustache.h
r18671r18672
77      m_spriteram(*this, "spriteram"){ }
88
99   required_shared_ptr<UINT8> m_videoram;
10   emu_timer *m_clear_irq_timer;
10    emu_timer *m_clear_irq_timer;
1111   tilemap_t *m_bg_tilemap;
1212   int m_control_byte;
1313   required_shared_ptr<UINT8> m_spriteram;
r18671r18672
1616   DECLARE_WRITE8_MEMBER(mustache_scroll_w);
1717   DECLARE_DRIVER_INIT(mustache);
1818   TILE_GET_INFO_MEMBER(get_bg_tile_info);
19   virtual void machine_start();
19    virtual void machine_start();
2020   virtual void video_start();
2121   virtual void palette_init();
2222   UINT32 screen_update_mustache(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
23   INTERRUPT_GEN_MEMBER(assert_irq);
24   TIMER_CALLBACK_MEMBER(clear_irq_cb);
23   TIMER_DEVICE_CALLBACK_MEMBER(mustache_scanline);
2524};
trunk/src/mame/drivers/mustache.c
r18671r18672
157157   GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0x80, 8 )
158158GFXDECODE_END
159159
160TIMER_CALLBACK_MEMBER(mustache_state::clear_irq_cb)
160void mustache_state::machine_start()
161161{
162   machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE);
162   // do nothing, not even sure why this is here anymore.
163163}
164164
165INTERRUPT_GEN_MEMBER(mustache_state::assert_irq)
165TIMER_DEVICE_CALLBACK_MEMBER(mustache_state::mustache_scanline)
166166{
167   device.execute().set_input_line(0, ASSERT_LINE);
168    m_clear_irq_timer->adjust(downcast<cpu_device *>(&device)->cycles_to_attotime(14288));
169       /* Timing here is an educated GUESS, Z80 /INT must stay high so the irq
170          fires no less than TWICE per frame, else game doesn't work right.
171      6000000 / 56.747 = 105732.4616 cycles per frame, we'll call it A
172      screen size is 256x256, though less is visible.
173          lets assume we have 256 lines L and 40 'lines' (really line-times)
174          of vblank V:
175      So (A/(L+V))*V = the number of cycles spent in vblank.
176      (105732.4616 / (256+40)) * 40 = 14288.17049 z80 clocks in vblank
177       */
178}
167   int scanline = param;
179168
180void mustache_state::machine_start()
181{
182   m_clear_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mustache_state::clear_irq_cb),this));
169   if(scanline == 240) // vblank-out irq
170      machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE,0x10); /* RST 10h */
171
172   if(scanline == 0) // vblank-in irq
173      machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE,0x08); /* RST 08h */
183174}
184175
176
185177static MACHINE_CONFIG_START( mustache, mustache_state )
186178
187179   /* basic machine hardware */
188180   MCFG_CPU_ADD("maincpu", Z80, CPU_CLOCK)
189181   MCFG_CPU_PROGRAM_MAP(memmap)
190   MCFG_CPU_VBLANK_INT_DRIVER("screen", mustache_state, assert_irq)
182   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", mustache_state, mustache_scanline, "screen", 0, 1)
191183
192184   MCFG_CPU_ADD(CPUTAG_T5182,Z80, T5182_CLOCK)
193185   MCFG_CPU_PROGRAM_MAP(t5182_map)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team