From 8aea6d8cd3310149d6f9132774e3758d1df56784 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Tue, 19 Oct 2010 17:52:26 +0000 Subject: [PATCH] Reworked 1942 interrupts by not using cpu_getiloops() function [Angelo Salese] --- src/mame/drivers/1942.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/mame/drivers/1942.c b/src/mame/drivers/1942.c index b8ebff15512..1534f6b7323 100644 --- a/src/mame/drivers/1942.c +++ b/src/mame/drivers/1942.c @@ -65,7 +65,6 @@ correctly. #include "emu.h" #include "cpu/z80/z80.h" -#include "deprecat.h" #include "sound/ay8910.h" #include "includes/1942.h" @@ -75,12 +74,15 @@ static WRITE8_HANDLER( c1942_bankswitch_w ) memory_set_bank(space->machine, "bank1", data & 0x03); } -static INTERRUPT_GEN( c1942_interrupt ) +static TIMER_DEVICE_CALLBACK( c1942_scanline ) { - if (cpu_getiloops(device) != 0) - cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0xcf); /* RST 08h */ - else - cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0xd7); /* RST 10h - vblank */ + int scanline = param; + + if(scanline == 240) // vblank-out irq + cputag_set_input_line_and_vector(timer.machine, "maincpu", 0, HOLD_LINE, 0xd7); /* RST 10h - vblank */ + + if(scanline == 0) // unknown irq event, presumably vblank-in or a periodic one (writes to the soundlatch and drives freeze dip-switch) + cputag_set_input_line_and_vector(timer.machine, "maincpu", 0, HOLD_LINE, 0xcf); /* RST 08h */ } @@ -258,11 +260,11 @@ static MACHINE_CONFIG_START( 1942, _1942_state ) /* basic machine hardware */ MDRV_CPU_ADD("maincpu", Z80, MAIN_CPU_CLOCK) /* 4 MHz ??? */ MDRV_CPU_PROGRAM_MAP(c1942_map) - MDRV_CPU_VBLANK_INT_HACK(c1942_interrupt,2) + MDRV_TIMER_ADD_SCANLINE("scantimer", c1942_scanline, "screen", 0, 1) MDRV_CPU_ADD("audiocpu", Z80, SOUND_CPU_CLOCK) /* 3 MHz ??? */ MDRV_CPU_PROGRAM_MAP(sound_map) - MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4) + MDRV_CPU_PERIODIC_INT(irq0_line_hold,4*60) MDRV_MACHINE_START(1942) MDRV_MACHINE_RESET(1942)