From 0dd4dbb2a285ab071a6285871af88c3a15cdbdd0 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Mon, 8 Aug 2011 14:36:07 +0000 Subject: [PATCH] Port from MESS, nw --- src/mame/drivers/saturn.c | 6 ++---- src/mame/includes/stv.h | 2 -- src/mame/machine/stvcd.c | 7 +++++++ src/mame/machine/stvcd.h | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/saturn.c b/src/mame/drivers/saturn.c index 131409a8445..1e4bc702fd8 100644 --- a/src/mame/drivers/saturn.c +++ b/src/mame/drivers/saturn.c @@ -1999,14 +1999,13 @@ static MACHINE_CONFIG_START( saturn, saturn_state ) MCFG_CPU_ADD("audiocpu", M68000, 11289600) //11.2896 MHz MCFG_CPU_PROGRAM_MAP(sound_mem) - MCFG_TIMER_ADD_PERIODIC("sh1_cmd", stv_sh1_sim, attotime::from_hz(16667)) - MCFG_MACHINE_START(saturn) MCFG_MACHINE_RESET(saturn) MCFG_NVRAM_HANDLER(saturn) MCFG_TIMER_ADD("sector_timer", stv_sector_cb) + MCFG_TIMER_ADD("sh1_cmd", stv_sh1_sim) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2051,14 +2050,13 @@ static MACHINE_CONFIG_START( stv, saturn_state ) MCFG_CPU_ADD("audiocpu", M68000, 11289600) //11.2896 MHz MCFG_CPU_PROGRAM_MAP(sound_mem) - MCFG_TIMER_ADD_PERIODIC("sh1_cmd", stv_sh1_sim, attotime::from_hz(16667)) - MCFG_MACHINE_START(stv) MCFG_MACHINE_RESET(stv) MCFG_EEPROM_93C46_ADD("eeprom") /* Actually 93c45 */ MCFG_TIMER_ADD("sector_timer", stv_sector_cb) + MCFG_TIMER_ADD("sh1_cmd", stv_sh1_sim) /* video hardware */ MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h index 3700597bef1..7350f7a526c 100644 --- a/src/mame/includes/stv.h +++ b/src/mame/includes/stv.h @@ -209,5 +209,3 @@ WRITE32_HANDLER ( saturn_vdp2_regs_w ); VIDEO_START ( stv_vdp2 ); SCREEN_UPDATE( stv_vdp2 ); - -TIMER_DEVICE_CALLBACK( stv_sh1_sim ); diff --git a/src/mame/machine/stvcd.c b/src/mame/machine/stvcd.c index 20f401753cb..e7393c22caf 100644 --- a/src/mame/machine/stvcd.c +++ b/src/mame/machine/stvcd.c @@ -106,6 +106,7 @@ typedef enum // local variables static timer_device *sector_timer; +static timer_device *sh1_timer; static partitionT partitions[MAX_FILTERS]; static partitionT *transpart; @@ -1196,6 +1197,8 @@ static void cd_exec_command(running_machine &machine) TIMER_DEVICE_CALLBACK( stv_sh1_sim ) { + sh1_timer->adjust(attotime::from_hz(16667)); + if(cmd_pending) { cd_exec_command(timer.machine()); @@ -1301,6 +1304,8 @@ void stvcd_reset(running_machine &machine) sector_timer = machine.device("sector_timer"); sector_timer->adjust(attotime::from_hz(150)); // 150 sectors / second = 300kBytes/second + sh1_timer = machine.device("sh1_cmd"); + sh1_timer->adjust(attotime::from_hz(16667)); } static blockT *cd_alloc_block(UINT8 *blknum) @@ -1626,6 +1631,8 @@ static void cd_writeWord(running_machine &machine, UINT32 addr, UINT16 data) case 0x0026: // CDROM_LOG(("WW CR4: %04x\n", data)) cr4 = data; + sh1_timer->reset(); + sh1_timer->adjust(attotime::from_hz(16667)); break; default: CDROM_LOG(("CD: WW %08x %04x\n", addr, data)) diff --git a/src/mame/machine/stvcd.h b/src/mame/machine/stvcd.h index d987a3599cb..f890b911d28 100644 --- a/src/mame/machine/stvcd.h +++ b/src/mame/machine/stvcd.h @@ -13,6 +13,7 @@ void stvcd_reset(running_machine& machine); void stvcd_exit(running_machine& machine); TIMER_DEVICE_CALLBACK( stv_sector_cb ); +TIMER_DEVICE_CALLBACK( stv_sh1_sim ); READ32_HANDLER( stvcd_r ); WRITE32_HANDLER( stvcd_w );