diff --git a/src/mame/drivers/overdriv.c b/src/mame/drivers/overdriv.c index 935a8085f05..12c41e26f43 100644 --- a/src/mame/drivers/overdriv.c +++ b/src/mame/drivers/overdriv.c @@ -5,6 +5,7 @@ driver by Nicola Salmoria Notes: + - irq source for main CPU aren't understood, needs HW tests. - Missing road (two unemulated K053250) - Visible area and relative placement of sprites and tiles is most likely wrong. - Test mode doesn't work well with 3 IRQ5 per frame, the ROM check doesn't work @@ -20,7 +21,6 @@ #include "emu.h" #include "cpu/m68000/m68000.h" -#include "deprecat.h" #include "video/konicdev.h" #include "machine/eeprom.h" #include "cpu/m6809/m6809.h" @@ -72,13 +72,16 @@ static WRITE16_HANDLER( eeprom_w ) } } - -static INTERRUPT_GEN( cpuA_interrupt ) +static TIMER_DEVICE_CALLBACK( overdriv_cpuA_scanline ) { - if (cpu_getiloops(device)) - device_set_input_line(device, 5, HOLD_LINE); - else - device_set_input_line(device, 4, HOLD_LINE); + int scanline = param; + + /* TODO: irqs routines are TOO slow right now, it ends up firing spurious irqs for whatever reason (shared ram fighting?) */ + /* this is a temporary solution to get rid of deprecat.h and the crashes, but also makes the game timer to be too slow */ + if(scanline == 256 && timer.machine().primary_screen->frame_number() & 1) // vblank-out irq + cputag_set_input_line(timer.machine(), "maincpu", 4, HOLD_LINE); + else if((scanline % 128) == 0) // timer irq + cputag_set_input_line(timer.machine(), "maincpu", 5, HOLD_LINE); } static INTERRUPT_GEN( cpuB_interrupt ) @@ -155,7 +158,6 @@ static WRITE16_HANDLER( overdriv_cpuB_irq6_w ) device_set_input_line(state->m_subcpu, 6, HOLD_LINE); } - static ADDRESS_MAP_START( overdriv_master_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x040000, 0x043fff) AM_RAM /* work RAM */ @@ -164,7 +166,7 @@ static ADDRESS_MAP_START( overdriv_master_map, AS_PROGRAM, 16 ) AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("SYSTEM") AM_RANGE(0x0e0000, 0x0e0001) AM_WRITENOP /* unknown (always 0x30) */ AM_RANGE(0x100000, 0x10001f) AM_WRITENOP /* 053252? (LSB) */ - AM_RANGE(0x140000, 0x140001) AM_WRITE(watchdog_reset16_w) + AM_RANGE(0x140000, 0x140001) AM_WRITENOP //watchdog reset? AM_RANGE(0x180000, 0x180001) AM_READ_PORT("PADDLE") AM_RANGE(0x1c0000, 0x1c001f) AM_DEVWRITE8("k051316_1", k051316_ctrl_w, 0xff00) AM_RANGE(0x1c8000, 0x1c801f) AM_DEVWRITE8("k051316_2", k051316_ctrl_w, 0xff00) @@ -329,22 +331,24 @@ static MACHINE_RESET( overdriv ) cputag_set_input_line(machine, "sub", INPUT_LINE_RESET, ASSERT_LINE); } + + static MACHINE_CONFIG_START( overdriv, overdriv_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000,24000000/2) /* 12 MHz */ MCFG_CPU_PROGRAM_MAP(overdriv_master_map) - MCFG_CPU_VBLANK_INT_HACK(cpuA_interrupt,4) /* ??? IRQ 4 is vblank, IRQ 5 of unknown origin */ + MCFG_TIMER_ADD_SCANLINE("scantimer", overdriv_cpuA_scanline, "screen", 0, 1) MCFG_CPU_ADD("sub", M68000,24000000/2) /* 12 MHz */ MCFG_CPU_PROGRAM_MAP(overdriv_slave_map) MCFG_CPU_VBLANK_INT("screen", cpuB_interrupt) /* IRQ 5 and 6 are generated by the main CPU. */ - /* IRQ 5 is used only in test mode, to request the checksums of the gfx ROMs. */ - MCFG_CPU_ADD("audiocpu", M6809,3579545/2) /* 1.789 MHz?? This might be the right speed, but ROM testing */ - /* takes a little too much (the counter wraps from 0000 to 9999). */ - /* This might just mean that the video refresh rate is less than */ - /* 60 fps, that's how I fixed it for now. */ - MCFG_CPU_PROGRAM_MAP(overdriv_sound_map) + /* IRQ 5 is used only in test mode, to request the checksums of the gfx ROMs. */ + + MCFG_CPU_ADD("audiocpu", M6809,3579545) /* 1.789 MHz?? This might be the right speed, but ROM testing */ + MCFG_CPU_PROGRAM_MAP(overdriv_sound_map) /* takes a little too much (the counter wraps from 0000 to 9999). */ + /* This might just mean that the video refresh rate is less than */ + /* 60 fps, that's how I fixed it for now. */ MCFG_QUANTUM_TIME(attotime::from_hz(12000)) @@ -359,9 +363,9 @@ static MACHINE_CONFIG_START( overdriv, overdriv_state ) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(59) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MCFG_SCREEN_SIZE(64*8, 32*8) + MCFG_SCREEN_SIZE(64*8, 40*8) MCFG_SCREEN_VISIBLE_AREA(13*8, (64-13)*8-1, 0*8, 32*8-1 ) MCFG_SCREEN_UPDATE(overdriv)