trunk/src/mame/includes/mustache.h
| r18671 | r18672 | |
| 7 | 7 | m_spriteram(*this, "spriteram"){ } |
| 8 | 8 | |
| 9 | 9 | required_shared_ptr<UINT8> m_videoram; |
| 10 | | emu_timer *m_clear_irq_timer; |
| 10 | emu_timer *m_clear_irq_timer; |
| 11 | 11 | tilemap_t *m_bg_tilemap; |
| 12 | 12 | int m_control_byte; |
| 13 | 13 | required_shared_ptr<UINT8> m_spriteram; |
| r18671 | r18672 | |
| 16 | 16 | DECLARE_WRITE8_MEMBER(mustache_scroll_w); |
| 17 | 17 | DECLARE_DRIVER_INIT(mustache); |
| 18 | 18 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 19 | | virtual void machine_start(); |
| 19 | virtual void machine_start(); |
| 20 | 20 | virtual void video_start(); |
| 21 | 21 | virtual void palette_init(); |
| 22 | 22 | 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); |
| 25 | 24 | }; |
trunk/src/mame/drivers/mustache.c
| r18671 | r18672 | |
| 157 | 157 | GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0x80, 8 ) |
| 158 | 158 | GFXDECODE_END |
| 159 | 159 | |
| 160 | | TIMER_CALLBACK_MEMBER(mustache_state::clear_irq_cb) |
| 160 | void mustache_state::machine_start() |
| 161 | 161 | { |
| 162 | | machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); |
| 162 | // do nothing, not even sure why this is here anymore. |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | | INTERRUPT_GEN_MEMBER(mustache_state::assert_irq) |
| 165 | TIMER_DEVICE_CALLBACK_MEMBER(mustache_state::mustache_scanline) |
| 166 | 166 | { |
| 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; |
| 179 | 168 | |
| 180 | | void 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 */ |
| 183 | 174 | } |
| 184 | 175 | |
| 176 | |
| 185 | 177 | static MACHINE_CONFIG_START( mustache, mustache_state ) |
| 186 | 178 | |
| 187 | 179 | /* basic machine hardware */ |
| 188 | 180 | MCFG_CPU_ADD("maincpu", Z80, CPU_CLOCK) |
| 189 | 181 | 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) |
| 191 | 183 | |
| 192 | 184 | MCFG_CPU_ADD(CPUTAG_T5182,Z80, T5182_CLOCK) |
| 193 | 185 | MCFG_CPU_PROGRAM_MAP(t5182_map) |