diff --git a/.gitattributes b/.gitattributes index ceec56348fd..69e9dc215e0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1410,8 +1410,6 @@ src/emu/video/vector.h svneol=native#text/plain src/emu/video/vooddefs.h svneol=native#text/plain src/emu/video/voodoo.c svneol=native#text/plain src/emu/video/voodoo.h svneol=native#text/plain -src/emu/watchdog.c svneol=native#text/plain -src/emu/watchdog.h svneol=native#text/plain src/ldplayer/layout/pr8210.lay svneol=native#text/plain src/ldplayer/ldplayer.c svneol=native#text/plain src/ldplayer/ldplayer.lst svneol=native#text/plain diff --git a/src/emu/driver.c b/src/emu/driver.c index 7b5922140ab..19761f6e0cc 100644 --- a/src/emu/driver.c +++ b/src/emu/driver.c @@ -422,24 +422,24 @@ INTERRUPT_GEN_MEMBER( driver_device::irq7_line_assert ) { device.execute().set_i // 8-bit reset read/write handlers //------------------------------------------------- -WRITE8_MEMBER( driver_device::watchdog_reset_w ) { watchdog_reset(machine()); } -READ8_MEMBER( driver_device::watchdog_reset_r ) { watchdog_reset(machine()); return space.unmap(); } +WRITE8_MEMBER( driver_device::watchdog_reset_w ) { machine().watchdog_reset(); } +READ8_MEMBER( driver_device::watchdog_reset_r ) { machine().watchdog_reset(); return space.unmap(); } //------------------------------------------------- // 16-bit reset read/write handlers //------------------------------------------------- -WRITE16_MEMBER( driver_device::watchdog_reset16_w ) { watchdog_reset(machine()); } -READ16_MEMBER( driver_device::watchdog_reset16_r ) { watchdog_reset(machine()); return space.unmap(); } +WRITE16_MEMBER( driver_device::watchdog_reset16_w ) { machine().watchdog_reset(); } +READ16_MEMBER( driver_device::watchdog_reset16_r ) { machine().watchdog_reset(); return space.unmap(); } //------------------------------------------------- // 32-bit reset read/write handlers //------------------------------------------------- -WRITE32_MEMBER( driver_device::watchdog_reset32_w ) { watchdog_reset(machine()); } -READ32_MEMBER( driver_device::watchdog_reset32_r ) { watchdog_reset(machine()); return space.unmap(); } +WRITE32_MEMBER( driver_device::watchdog_reset32_w ) { machine().watchdog_reset(); } +READ32_MEMBER( driver_device::watchdog_reset32_r ) { machine().watchdog_reset(); return space.unmap(); } diff --git a/src/emu/driver.h b/src/emu/driver.h index a421e1d424f..32bcbc1af47 100644 --- a/src/emu/driver.h +++ b/src/emu/driver.h @@ -47,6 +47,56 @@ #define __DRIVER_H__ +//************************************************************************** +// CONFIGURATION MACROS +//************************************************************************** + +// core machine callbacks +#define MCFG_MACHINE_START(_func) \ + driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_START, MACHINE_START_NAME(_func)); \ + +#define MCFG_MACHINE_START_OVERRIDE(_class, _func) \ + driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_START, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); + +#define MCFG_MACHINE_RESET(_func) \ + driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_RESET, MACHINE_RESET_NAME(_func)); \ + +#define MCFG_MACHINE_RESET_OVERRIDE(_class, _func) \ + driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_RESET, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); + + +// core sound callbacks +#define MCFG_SOUND_START(_func) \ + driver_device::static_set_callback(*owner, driver_device::CB_SOUND_START, SOUND_START_NAME(_func)); \ + +#define MCFG_SOUND_START_OVERRIDE(_class, _func) \ + driver_device::static_set_callback(*owner, driver_device::CB_SOUND_START, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); + +#define MCFG_SOUND_RESET(_func) \ + driver_device::static_set_callback(*owner, driver_device::CB_SOUND_RESET, SOUND_RESET_NAME(_func)); \ + +#define MCFG_SOUND_RESET_OVERRIDE(_class, _func) \ + driver_device::static_set_callback(*owner, driver_device::CB_SOUND_RESET, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); + + +// core video callbacks +#define MCFG_PALETTE_INIT(_func) \ + driver_device::static_set_palette_init(*owner, PALETTE_INIT_NAME(_func)); \ + +#define MCFG_VIDEO_START(_func) \ + driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_START, VIDEO_START_NAME(_func)); \ + +#define MCFG_VIDEO_START_OVERRIDE(_class, _func) \ + driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_START, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); + +#define MCFG_VIDEO_RESET(_func) \ + driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_RESET, VIDEO_RESET_NAME(_func)); \ + +#define MCFG_VIDEO_RESET_OVERRIDE(_class, _func) \ + driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_RESET, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); + + + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** diff --git a/src/emu/emu.h b/src/emu/emu.h index c976cce8d4a..e39935f2e9b 100644 --- a/src/emu/emu.h +++ b/src/emu/emu.h @@ -108,7 +108,6 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_ // timers, CPU and scheduling #include "devcpu.h" -#include "watchdog.h" // machine and driver configuration #include "mconfig.h" diff --git a/src/emu/emu.mak b/src/emu/emu.mak index 9c6383d7f9c..0f49ef864d4 100644 --- a/src/emu/emu.mak +++ b/src/emu/emu.mak @@ -110,7 +110,6 @@ EMUOBJS = \ $(EMUOBJ)/uimenu.o \ $(EMUOBJ)/validity.o \ $(EMUOBJ)/video.o \ - $(EMUOBJ)/watchdog.o \ $(EMUOBJ)/debug/debugcmd.o \ $(EMUOBJ)/debug/debugcon.o \ $(EMUOBJ)/debug/debugcpu.o \ diff --git a/src/emu/machine.c b/src/emu/machine.c index b2b20a3e46c..6a337643e45 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -67,7 +67,6 @@ - calls input_port_init() [inptport.c] to set up the input ports - calls rom_init() [romload.c] to load the game's ROMs - calls memory_init() [memory.c] to process the game's memory maps - - calls watchdog_init() [watchdog.c] to initialize the watchdog system - calls the driver's DRIVER_INIT callback - calls device_list_start() [devintrf.c] to start any devices - calls video_init() [video.c] to start the video system @@ -278,7 +277,9 @@ void running_machine::start() // these operations must proceed in this order rom_init(*this); m_memory = auto_alloc(*this, memory_manager(*this)); - watchdog_init(*this); + m_watchdog_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::watchdog_fired), this)); + save().save_item(NAME(m_watchdog_enabled)); + save().save_item(NAME(m_watchdog_counter)); // allocate the gfx elements prior to device initialization gfx_init(*this); @@ -846,6 +847,11 @@ void running_machine::soft_reset(void *ptr, INT32 param) // temporarily in the reset phase m_current_phase = MACHINE_PHASE_RESET; + // set up the watchdog timer; only start off enabled if explicitly configured + m_watchdog_enabled = (config().m_watchdog_vblank_count != 0 || config().m_watchdog_time != attotime::zero); + watchdog_reset(); + m_watchdog_enabled = true; + // call all registered reset callbacks call_notifiers(MACHINE_NOTIFY_RESET); @@ -854,6 +860,87 @@ void running_machine::soft_reset(void *ptr, INT32 param) } +//------------------------------------------------- +// watchdog_reset - reset the watchdog timer +//------------------------------------------------- + +void running_machine::watchdog_reset() +{ + // if we're not enabled, skip it + if (!m_watchdog_enabled) + m_watchdog_timer->adjust(attotime::never); + + // VBLANK-based watchdog? + else if (config().m_watchdog_vblank_count != 0) + { + // register a VBLANK callback for the primary screen + m_watchdog_counter = config().m_watchdog_vblank_count; + if (primary_screen != NULL) + primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(running_machine::watchdog_vblank), this)); + } + + // timer-based watchdog? + else if (config().m_watchdog_time != attotime::zero) + m_watchdog_timer->adjust(config().m_watchdog_time); + + // default to an obscene amount of time (3 seconds) + else + m_watchdog_timer->adjust(attotime::from_seconds(3)); +} + + +//------------------------------------------------- +// watchdog_enable - reset the watchdog timer +//------------------------------------------------- + +void running_machine::watchdog_enable(bool enable) +{ + // when re-enabled, we reset our state + if (m_watchdog_enabled != enable) + { + m_watchdog_enabled = enable; + watchdog_reset(); + } +} + + +//------------------------------------------------- +// watchdog_fired - watchdog timer callback +//------------------------------------------------- + +void running_machine::watchdog_fired(void *ptr, INT32 param) +{ + logerror("Reset caused by the watchdog!!!\n"); + + bool verbose = options().verbose(); +#ifdef MAME_DEBUG + verbose = true; +#endif + if (verbose) + popmessage("Reset caused by the watchdog!!!\n"); + + schedule_soft_reset(); +} + + +//------------------------------------------------- +// watchdog_vblank - VBLANK state callback for +// watchdog timers +//------------------------------------------------- + +void running_machine::watchdog_vblank(screen_device &screen, bool vblank_state) +{ + // VBLANK starting + if (vblank_state && m_watchdog_enabled) + { + // check the watchdog + if (config().m_watchdog_vblank_count != 0) + if (--m_watchdog_counter == 0) + watchdog_fired(); + } +} + + //------------------------------------------------- // logfile_callback - callback for logging to // logfile diff --git a/src/emu/machine.h b/src/emu/machine.h index 59cd2147dc8..6dfb0033b41 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -378,6 +378,10 @@ public: memory_region *region_alloc(const char *name, UINT32 length, UINT8 width, endianness_t endian); void region_free(const char *name); + // watchdog control + void watchdog_reset(); + void watchdog_enable(bool enable = true); + // misc void CLIB_DECL logerror(const char *format, ...); void CLIB_DECL vlogerror(const char *format, va_list args); @@ -419,6 +423,8 @@ private: void fill_systime(system_time &systime, time_t t); void handle_saveload(); void soft_reset(void *ptr = NULL, INT32 param = 0); + void watchdog_fired(void *ptr = NULL, INT32 param = 0); + void watchdog_vblank(screen_device &screen, bool vblank_state); // internal callbacks static void logfile_callback(running_machine &machine, const char *buffer); @@ -459,6 +465,11 @@ private: const game_driver * m_new_driver_pending; // pointer to the next pending driver emu_timer * m_soft_reset_timer; // timer used to schedule a soft reset + // watchdog state + bool m_watchdog_enabled; // is the watchdog enabled? + INT32 m_watchdog_counter; // counter for watchdog tracking + emu_timer * m_watchdog_timer; // timer for watchdog tracking + // misc state UINT32 m_rand_seed; // current random number seed bool m_ui_active; // ui active or not (useful for games / systems with keyboard inputs) diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h index 4cf1b22cad4..36816d0d105 100644 --- a/src/emu/mconfig.h +++ b/src/emu/mconfig.h @@ -228,13 +228,15 @@ ATTR_COLD device_t *MACHINE_CONFIG_NAME(_name)(machine_config &config, device_t MACHINE_CONFIG_NAME(_name)(config, owner); -// core parameters +// scheduling parameters #define MCFG_QUANTUM_TIME(_time) \ config.m_minimum_quantum = _time; \ #define MCFG_QUANTUM_PERFECT_CPU(_cputag) \ config.m_perfect_cpu_quantum = _cputag; \ + +// watchdog configuration #define MCFG_WATCHDOG_VBLANK_INIT(_count) \ config.m_watchdog_vblank_count = _count; \ @@ -252,6 +254,7 @@ ATTR_COLD device_t *MACHINE_CONFIG_NAME(_name)(machine_config &config, device_t #define MCFG_NVRAM_HANDLER_CLEAR() \ config.m_nvram_handler = NULL; \ + // core video parameters #define MCFG_VIDEO_ATTRIBUTES(_flags) \ config.m_video_attributes = _flags; \ @@ -266,51 +269,6 @@ ATTR_COLD device_t *MACHINE_CONFIG_NAME(_name)(machine_config &config, device_t config.m_default_layout = &(_layout)[0]; \ -// core machine functions -#define MCFG_MACHINE_START(_func) \ - driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_START, MACHINE_START_NAME(_func)); \ - -#define MCFG_MACHINE_START_DRIVER(_class, _func) \ - driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_START, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); - -#define MCFG_MACHINE_RESET(_func) \ - driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_RESET, MACHINE_RESET_NAME(_func)); \ - -#define MCFG_MACHINE_RESET_DRIVER(_class, _func) \ - driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_RESET, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); - - -// core sound functions -#define MCFG_SOUND_START(_func) \ - driver_device::static_set_callback(*owner, driver_device::CB_SOUND_START, SOUND_START_NAME(_func)); \ - -#define MCFG_SOUND_START_DRIVER(_class, _func) \ - driver_device::static_set_callback(*owner, driver_device::CB_SOUND_START, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); - -#define MCFG_SOUND_RESET(_func) \ - driver_device::static_set_callback(*owner, driver_device::CB_SOUND_RESET, SOUND_RESET_NAME(_func)); \ - -#define MCFG_SOUND_RESET_DRIVER(_class, _func) \ - driver_device::static_set_callback(*owner, driver_device::CB_SOUND_RESET, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); - - -// core video functions -#define MCFG_PALETTE_INIT(_func) \ - driver_device::static_set_palette_init(*owner, PALETTE_INIT_NAME(_func)); \ - -#define MCFG_VIDEO_START(_func) \ - driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_START, VIDEO_START_NAME(_func)); \ - -#define MCFG_VIDEO_START_DRIVER(_class, _func) \ - driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_START, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); - -#define MCFG_VIDEO_RESET(_func) \ - driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_RESET, VIDEO_RESET_NAME(_func)); \ - -#define MCFG_VIDEO_RESET_DRIVER(_class, _func) \ - driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_RESET, driver_callback_delegate(&_class::_func, #_class "::" #_func, downcast<_class *>(&config.root_device()))); - - // add/remove devices #define MCFG_DEVICE_ADD(_tag, _type, _clock) \ device = config.device_add(owner, _tag, _type, _clock); \ diff --git a/src/emu/watchdog.c b/src/emu/watchdog.c deleted file mode 100644 index c39b15c4640..00000000000 --- a/src/emu/watchdog.c +++ /dev/null @@ -1,150 +0,0 @@ -/*************************************************************************** - - watchdog.c - - Watchdog handling - - Copyright Nicola Salmoria and the MAME Team. - Visit http://mamedev.org for licensing and usage restrictions. - -***************************************************************************/ - -#include "emu.h" -#include "emuopts.h" - - - -/*************************************************************************** - GLOBAL VARIABLES -***************************************************************************/ - -static UINT8 watchdog_enabled; -static INT32 watchdog_counter; -static emu_timer *watchdog_timer; - - - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -static void watchdog_internal_reset(running_machine &machine); -static TIMER_CALLBACK( watchdog_callback ); - - - -/*------------------------------------------------- - watchdog_init - one time initialization --------------------------------------------------*/ - -void watchdog_init(running_machine &machine) -{ - /* allocate a timer for the watchdog */ - watchdog_timer = machine.scheduler().timer_alloc(FUNC(watchdog_callback)); - - machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(watchdog_internal_reset), &machine)); - - /* save some stuff in the default tag */ - machine.save().save_item(NAME(watchdog_enabled)); - machine.save().save_item(NAME(watchdog_counter)); -} - - -/*------------------------------------------------- - watchdog_internal_reset - reset the watchdog - system --------------------------------------------------*/ - -static void watchdog_internal_reset(running_machine &machine) -{ - /* set up the watchdog timer; only start off enabled if explicitly configured */ - watchdog_enabled = (machine.config().m_watchdog_vblank_count != 0 || machine.config().m_watchdog_time != attotime::zero); - watchdog_reset(machine); - watchdog_enabled = TRUE; -} - - -/*------------------------------------------------- - watchdog_callback - watchdog timer callback --------------------------------------------------*/ - -static TIMER_CALLBACK( watchdog_callback ) -{ - logerror("Reset caused by the watchdog!!!\n"); - - int verbose = machine.options().verbose(); -#ifdef MAME_DEBUG - verbose = 1; -#endif - if (verbose) - popmessage("Reset caused by the watchdog!!!\n"); - - machine.schedule_soft_reset(); -} - - -/*------------------------------------------------- - on_vblank - updates VBLANK based watchdog - timers --------------------------------------------------*/ - -static void on_vblank(running_machine &machine, screen_device &screen, bool vblank_state) -{ - /* VBLANK starting */ - if (vblank_state && watchdog_enabled) - { - /* check the watchdog */ - if (screen.machine().config().m_watchdog_vblank_count != 0) - { - watchdog_counter = watchdog_counter - 1; - - if (watchdog_counter == 0) - watchdog_callback(screen.machine(), NULL, 0); - } - } -} - - -/*------------------------------------------------- - watchdog_reset - reset the watchdog timer --------------------------------------------------*/ - -void watchdog_reset(running_machine &machine) -{ - /* if we're not enabled, skip it */ - if (!watchdog_enabled) - watchdog_timer->adjust(attotime::never); - - /* VBLANK-based watchdog? */ - else if (machine.config().m_watchdog_vblank_count != 0) - { - watchdog_counter = machine.config().m_watchdog_vblank_count; - - /* register a VBLANK callback for the primary screen */ - if (machine.primary_screen != NULL) - machine.primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(on_vblank), &machine)); - } - - /* timer-based watchdog? */ - else if (machine.config().m_watchdog_time != attotime::zero) - watchdog_timer->adjust(machine.config().m_watchdog_time); - - /* default to an obscene amount of time (3 seconds) */ - else - watchdog_timer->adjust(attotime::from_seconds(3)); -} - - -/*------------------------------------------------- - watchdog_enable - reset the watchdog timer --------------------------------------------------*/ - -void watchdog_enable(running_machine &machine, int enable) -{ - /* when re-enabled, we reset our state */ - if (watchdog_enabled != enable) - { - watchdog_enabled = enable; - watchdog_reset(machine); - } -} diff --git a/src/emu/watchdog.h b/src/emu/watchdog.h deleted file mode 100644 index 3787a729164..00000000000 --- a/src/emu/watchdog.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************** - - watchdog.h - - Watchdog handling - - Copyright Nicola Salmoria and the MAME Team. - Visit http://mamedev.org for licensing and usage restrictions. - -***************************************************************************/ - -#pragma once - -#ifndef __EMU_H__ -#error Dont include this file directly; include emu.h instead. -#endif - -#ifndef __WATCHDOG_H__ -#define __WATCHDOG_H__ - - -/* startup */ -void watchdog_init(running_machine &machine); - -/* reset the watchdog */ -void watchdog_reset(running_machine &machine); - -/* enable/disable the watchdog */ -void watchdog_enable(running_machine &machine, int enable); - - -#endif /* __WATCHDOG_H__ */ diff --git a/src/mame/drivers/ampoker2.c b/src/mame/drivers/ampoker2.c index d6fa57e44b0..2f3c8ecdce9 100644 --- a/src/mame/drivers/ampoker2.c +++ b/src/mame/drivers/ampoker2.c @@ -588,7 +588,7 @@ WRITE8_MEMBER(ampoker2_state::ampoker2_watchdog_reset_w) if (((data >> 3) & 0x01) == 0) /* check for refresh value (0x08) */ { - watchdog_reset(machine()); + machine().watchdog_reset(); // popmessage("%02x", data); } else diff --git a/src/mame/drivers/dragrace.c b/src/mame/drivers/dragrace.c index c436bfeb17f..14f39a09fef 100644 --- a/src/mame/drivers/dragrace.c +++ b/src/mame/drivers/dragrace.c @@ -29,7 +29,7 @@ static TIMER_DEVICE_CALLBACK( dragrace_frame_callback ) } /* watchdog is disabled during service mode */ - watchdog_enable(timer.machine(), input_port_read(timer.machine(), "IN0") & 0x20); + timer.machine().watchdog_enable(input_port_read(timer.machine(), "IN0") & 0x20); } diff --git a/src/mame/drivers/dribling.c b/src/mame/drivers/dribling.c index e081d820bc1..ae10a6ad1e5 100644 --- a/src/mame/drivers/dribling.c +++ b/src/mame/drivers/dribling.c @@ -136,7 +136,7 @@ static WRITE8_DEVICE_HANDLER( shr_w ) /* bit 3 = watchdog */ if (data & 0x08) - watchdog_reset(device->machine()); + device->machine().watchdog_reset(); /* bit 2-0 = SH0-2 */ state->m_sh = data & 0x07; diff --git a/src/mame/drivers/firetrk.c b/src/mame/drivers/firetrk.c index 6f0f50268db..2f6e71cda49 100644 --- a/src/mame/drivers/firetrk.c +++ b/src/mame/drivers/firetrk.c @@ -20,7 +20,7 @@ static void set_service_mode(running_machine &machine, int enable) state->m_in_service_mode = enable; /* watchdog is disabled during service mode */ - watchdog_enable(machine, !enable); + machine.watchdog_enable(!enable); /* change CPU clock speed according to service switch change */ machine.device("maincpu")->set_unscaled_clock(enable ? (MASTER_CLOCK/12) : (MASTER_CLOCK/16)); diff --git a/src/mame/drivers/fortecar.c b/src/mame/drivers/fortecar.c index caacf638372..14aec9ce7e8 100644 --- a/src/mame/drivers/fortecar.c +++ b/src/mame/drivers/fortecar.c @@ -508,7 +508,7 @@ Seems to work properly, but must be checked closely... */ if (((data >> 7) & 0x01) == 0) /* check for bit7 */ { - watchdog_reset(device->machine()); + device->machine().watchdog_reset(); } // logerror("AY port B write %02x\n",data); diff --git a/src/mame/drivers/galastrm.c b/src/mame/drivers/galastrm.c index a95705620f4..a3cdd4bfe39 100644 --- a/src/mame/drivers/galastrm.c +++ b/src/mame/drivers/galastrm.c @@ -116,7 +116,7 @@ popmessage(t); { if (ACCESSING_BITS_24_31) /* $400000 is watchdog */ { - watchdog_reset(machine()); + machine().watchdog_reset(); } if (ACCESSING_BITS_0_7) diff --git a/src/mame/drivers/grchamp.c b/src/mame/drivers/grchamp.c index 39f0bd95a4f..fa84165c739 100644 --- a/src/mame/drivers/grchamp.c +++ b/src/mame/drivers/grchamp.c @@ -184,7 +184,7 @@ WRITE8_MEMBER(grchamp_state::cpu0_outputs_w) break; case 0x0d: /* OUT13 */ - watchdog_reset(machine()); + machine().watchdog_reset(); break; case 0x0e: /* OUT14 */ diff --git a/src/mame/drivers/groundfx.c b/src/mame/drivers/groundfx.c index 8f855e9f3c3..4e5ccfcbcab 100644 --- a/src/mame/drivers/groundfx.c +++ b/src/mame/drivers/groundfx.c @@ -141,7 +141,7 @@ WRITE32_MEMBER(groundfx_state::groundfx_input_w) case 0x00: if (ACCESSING_BITS_24_31) /* $500000 is watchdog */ { - watchdog_reset(machine()); + machine().watchdog_reset(); } if (ACCESSING_BITS_0_7) diff --git a/src/mame/drivers/gunbustr.c b/src/mame/drivers/gunbustr.c index f2f48eefab3..d293742a28e 100644 --- a/src/mame/drivers/gunbustr.c +++ b/src/mame/drivers/gunbustr.c @@ -102,7 +102,7 @@ popmessage(t); { if (ACCESSING_BITS_24_31) /* $400000 is watchdog */ { - watchdog_reset(machine()); + machine().watchdog_reset(); } if (ACCESSING_BITS_0_7) diff --git a/src/mame/drivers/hornet.c b/src/mame/drivers/hornet.c index 61385f6cf81..c6c4dc209eb 100644 --- a/src/mame/drivers/hornet.c +++ b/src/mame/drivers/hornet.c @@ -567,7 +567,7 @@ WRITE8_MEMBER(hornet_state::sysreg_w) 0x80 = WDTCLK */ if (data & 0x80) - watchdog_reset(machine()); + machine().watchdog_reset(); break; case 7: /* CG Control Register */ diff --git a/src/mame/drivers/liberatr.c b/src/mame/drivers/liberatr.c index 2cca12600e6..e926cff2eba 100644 --- a/src/mame/drivers/liberatr.c +++ b/src/mame/drivers/liberatr.c @@ -140,7 +140,7 @@ #define MASTER_CLOCK 20000000 /* 20Mhz Main Clock Xtal */ -void liberatr_state::machine_start_liberatr() +void liberatr_state::machine_start() { atarigen_state::machine_start(); @@ -393,10 +393,7 @@ static MACHINE_CONFIG_START( liberatr, liberatr_state ) MCFG_ER2055_ADD("earom") - MCFG_MACHINE_START_DRIVER(liberatr_state, machine_start_liberatr) - /* video hardware */ - MCFG_VIDEO_START_DRIVER(liberatr_state, video_start_liberatr) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) diff --git a/src/mame/drivers/lockon.c b/src/mame/drivers/lockon.c index 156e2d03347..de77840c9d4 100644 --- a/src/mame/drivers/lockon.c +++ b/src/mame/drivers/lockon.c @@ -132,7 +132,7 @@ WRITE16_MEMBER(lockon_state::inten_w) WRITE16_MEMBER(lockon_state::emres_w) { - watchdog_reset(machine()); + machine().watchdog_reset(); m_main_inten = 0; } diff --git a/src/mame/drivers/missile.c b/src/mame/drivers/missile.c index 956454e27ea..4548cec788b 100644 --- a/src/mame/drivers/missile.c +++ b/src/mame/drivers/missile.c @@ -750,7 +750,7 @@ WRITE8_MEMBER(missile_state::missile_w) /* watchdog */ else if (offset >= 0x4c00 && offset < 0x4d00) - watchdog_reset(machine()); + machine().watchdog_reset(); /* interrupt ack */ else if (offset >= 0x4d00 && offset < 0x4e00) diff --git a/src/mame/drivers/onetwo.c b/src/mame/drivers/onetwo.c index 88069cc44f7..fef428045d1 100644 --- a/src/mame/drivers/onetwo.c +++ b/src/mame/drivers/onetwo.c @@ -125,7 +125,7 @@ WRITE8_MEMBER(onetwo_state::onetwo_cpubank_w) WRITE8_MEMBER(onetwo_state::onetwo_coin_counters_w) { - watchdog_reset(machine()); + machine().watchdog_reset(); coin_counter_w(machine(), 0, BIT(data, 1)); coin_counter_w(machine(), 1, BIT(data, 2)); } diff --git a/src/mame/drivers/sprint2.c b/src/mame/drivers/sprint2.c index 455fa59491b..0f5b450fea0 100644 --- a/src/mame/drivers/sprint2.c +++ b/src/mame/drivers/sprint2.c @@ -111,7 +111,7 @@ static INTERRUPT_GEN( sprint2 ) /* interrupts and watchdog are disabled during service mode */ - watchdog_enable(device->machine(), !service_mode(device->machine())); + device->machine().watchdog_enable(!service_mode(device->machine())); if (!service_mode(device->machine())) device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); diff --git a/src/mame/drivers/sprint4.c b/src/mame/drivers/sprint4.c index 4f1a2329d73..23191ff0291 100644 --- a/src/mame/drivers/sprint4.c +++ b/src/mame/drivers/sprint4.c @@ -99,7 +99,7 @@ static TIMER_CALLBACK( nmi_callback ) /* NMI and watchdog are disabled during service mode */ - watchdog_enable(machine, input_port_read(machine, "IN0") & 0x40); + machine.watchdog_enable(input_port_read(machine, "IN0") & 0x40); if (input_port_read(machine, "IN0") & 0x40) cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); diff --git a/src/mame/drivers/superchs.c b/src/mame/drivers/superchs.c index 99237dfc362..a3018397479 100644 --- a/src/mame/drivers/superchs.c +++ b/src/mame/drivers/superchs.c @@ -136,7 +136,7 @@ WRITE32_MEMBER(superchs_state::superchs_input_w) { if (ACCESSING_BITS_24_31) /* $300000 is watchdog */ { - watchdog_reset(machine()); + machine().watchdog_reset(); } if (ACCESSING_BITS_0_7) diff --git a/src/mame/drivers/taito_f3.c b/src/mame/drivers/taito_f3.c index c6dfb4d7756..85ad69a2f70 100644 --- a/src/mame/drivers/taito_f3.c +++ b/src/mame/drivers/taito_f3.c @@ -73,7 +73,7 @@ WRITE32_MEMBER(taito_f3_state::f3_control_w) switch (offset) { case 0x00: /* Watchdog */ - watchdog_reset(machine()); + machine().watchdog_reset(); return; case 0x01: /* Coin counters & lockouts */ diff --git a/src/mame/drivers/taito_o.c b/src/mame/drivers/taito_o.c index 5490a16bd97..60498c3f72d 100644 --- a/src/mame/drivers/taito_o.c +++ b/src/mame/drivers/taito_o.c @@ -41,7 +41,7 @@ WRITE16_MEMBER(taitoo_state::io_w) { switch(offset) { - case 2: watchdog_reset(machine()); break; + case 2: machine().watchdog_reset(); break; default: logerror("IO W %x %x %x\n", offset, data, mem_mask); } diff --git a/src/mame/drivers/tecmosys.c b/src/mame/drivers/tecmosys.c index c487f49d7dc..39c3e7396bb 100644 --- a/src/mame/drivers/tecmosys.c +++ b/src/mame/drivers/tecmosys.c @@ -238,7 +238,7 @@ WRITE16_MEMBER(tecmosys_state::unk880000_w) break; case 0x22/2: - watchdog_reset( machine() ); + machine().watchdog_reset(); //logerror( "watchdog_w( %06x, %04x ) @ %06x\n", (offset * 2)+0x880000, data, cpu_get_pc(&space.device()) ); break; diff --git a/src/mame/drivers/tempest.c b/src/mame/drivers/tempest.c index c00d0a247e5..84949cfe7aa 100644 --- a/src/mame/drivers/tempest.c +++ b/src/mame/drivers/tempest.c @@ -323,7 +323,7 @@ static MACHINE_START( tempest ) WRITE8_MEMBER(tempest_state::wdclr_w) { cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE); - watchdog_reset(machine()); + machine().watchdog_reset(); } /************************************* diff --git a/src/mame/drivers/tourtabl.c b/src/mame/drivers/tourtabl.c index b0f0daf9053..2c6fb6c9ce2 100644 --- a/src/mame/drivers/tourtabl.c +++ b/src/mame/drivers/tourtabl.c @@ -62,7 +62,7 @@ ADDRESS_MAP_END static WRITE8_DEVICE_HANDLER( watchdog_w ) { - watchdog_reset(device->machine()); + device->machine().watchdog_reset(); } static const riot6532_interface r6532_interface_0 = diff --git a/src/mame/drivers/truco.c b/src/mame/drivers/truco.c index 88381951f08..92d82954b84 100644 --- a/src/mame/drivers/truco.c +++ b/src/mame/drivers/truco.c @@ -231,7 +231,7 @@ static WRITE8_DEVICE_HANDLER( pia_ca2_w ) Legs 07 [OSC IN] and 08 [OSC SEL] aren't connected, setting 1.6 seconds as WD timeout. */ - watchdog_reset(device->machine()); + device->machine().watchdog_reset(); } static WRITE8_DEVICE_HANDLER( portb_w ) diff --git a/src/mame/drivers/ultratnk.c b/src/mame/drivers/ultratnk.c index f7860f61d2c..9fb36e528c4 100644 --- a/src/mame/drivers/ultratnk.c +++ b/src/mame/drivers/ultratnk.c @@ -50,7 +50,7 @@ static TIMER_CALLBACK( nmi_callback ) /* NMI and watchdog are disabled during service mode */ - watchdog_enable(machine, input_port_read(machine, "IN0") & 0x40); + machine.watchdog_enable(input_port_read(machine, "IN0") & 0x40); if (input_port_read(machine, "IN0") & 0x40) cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); diff --git a/src/mame/drivers/undrfire.c b/src/mame/drivers/undrfire.c index 9d2ee172d9b..d24c9cd51b5 100644 --- a/src/mame/drivers/undrfire.c +++ b/src/mame/drivers/undrfire.c @@ -282,7 +282,7 @@ WRITE32_MEMBER(undrfire_state::undrfire_input_w) { if (ACCESSING_BITS_24_31) /* $500000 is watchdog */ { - watchdog_reset(machine()); + machine().watchdog_reset(); } if (ACCESSING_BITS_0_7) diff --git a/src/mame/drivers/zr107.c b/src/mame/drivers/zr107.c index fff9be5c8ca..6dc98325402 100644 --- a/src/mame/drivers/zr107.c +++ b/src/mame/drivers/zr107.c @@ -361,7 +361,7 @@ WRITE8_MEMBER(zr107_state::sysreg_w) 0x01 = AFE */ if (data & 0x01) - watchdog_reset(machine()); + machine().watchdog_reset(); break; } diff --git a/src/mame/includes/liberatr.h b/src/mame/includes/liberatr.h index 7ca9a595f95..228d0efc75d 100644 --- a/src/mame/includes/liberatr.h +++ b/src/mame/includes/liberatr.h @@ -21,9 +21,6 @@ public: m_bitmapram(*this, "bitmapram"), m_colorram(*this, "colorram") { } - void machine_start_liberatr(); - void video_start_liberatr(); - DECLARE_WRITE8_MEMBER( led_w ); DECLARE_WRITE8_MEMBER( coin_counter_w ); @@ -37,6 +34,9 @@ public: UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); protected: + virtual void machine_start(); + virtual void video_start(); + struct planet; void init_planet(planet &liberatr_planet, UINT8 *planet_rom); diff --git a/src/mame/machine/mcr68.c b/src/mame/machine/mcr68.c index 00f21c801a4..2bd7ace1386 100644 --- a/src/mame/machine/mcr68.c +++ b/src/mame/machine/mcr68.c @@ -277,7 +277,7 @@ static TIMER_CALLBACK( mcr68_493_callback ) WRITE8_DEVICE_HANDLER( zwackery_pia0_w ) { /* bit 7 is the watchdog */ - if (!(data & 0x80)) watchdog_reset(device->machine()); + if (!(data & 0x80)) device->machine().watchdog_reset(); /* bits 5 and 6 control hflip/vflip */ /* bits 3 and 4 control coin counters? */ diff --git a/src/mame/machine/taitoio.c b/src/mame/machine/taitoio.c index 23b5d007ea9..f2326516cd8 100644 --- a/src/mame/machine/taitoio.c +++ b/src/mame/machine/taitoio.c @@ -127,7 +127,7 @@ WRITE8_DEVICE_HANDLER( tc0220ioc_w ) { case 0x00: - watchdog_reset(device->machine()); + device->machine().watchdog_reset(); break; case 0x04: /* coin counters and lockout, hi nibble irrelevant */ @@ -284,7 +284,7 @@ WRITE8_DEVICE_HANDLER( tc0510nio_w ) switch (offset) { case 0x00: - watchdog_reset(device->machine()); + device->machine().watchdog_reset(); break; case 0x04: /* coin counters and lockout */ @@ -435,7 +435,7 @@ WRITE8_DEVICE_HANDLER( tc0640fio_w ) { case 0x00: - watchdog_reset(device->machine()); + device->machine().watchdog_reset(); break; case 0x04: /* coin counters and lockout */ diff --git a/src/mame/video/canyon.c b/src/mame/video/canyon.c index df5634baaa6..eba833902ab 100644 --- a/src/mame/video/canyon.c +++ b/src/mame/video/canyon.c @@ -83,7 +83,7 @@ SCREEN_UPDATE_IND16( canyon ) draw_bombs(screen.machine(), bitmap, cliprect); /* watchdog is disabled during service mode */ - watchdog_enable(screen.machine(), !(input_port_read(screen.machine(), "IN2") & 0x10)); + screen.machine().watchdog_enable(!(input_port_read(screen.machine(), "IN2") & 0x10)); return 0; } diff --git a/src/mame/video/decocass.c b/src/mame/video/decocass.c index 3d8ff305c81..37a0aa2112f 100644 --- a/src/mame/video/decocass.c +++ b/src/mame/video/decocass.c @@ -530,9 +530,9 @@ SCREEN_UPDATE_IND16( decocass ) device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, ASSERT_LINE); if (0 == (state->m_watchdog_flip & 0x04)) - watchdog_reset(screen.machine()); + screen.machine().watchdog_reset(); else if (state->m_watchdog_count-- > 0) - watchdog_reset(screen.machine()); + screen.machine().watchdog_reset(); #ifdef MAME_DEBUG { diff --git a/src/mame/video/liberatr.c b/src/mame/video/liberatr.c index 9bc92c3c65f..8467edd48b4 100644 --- a/src/mame/video/liberatr.c +++ b/src/mame/video/liberatr.c @@ -209,7 +209,7 @@ void liberatr_state::init_planet(planet &liberatr_planet, UINT8 *planet_rom) ***************************************************************************/ -void liberatr_state::video_start_liberatr() +void liberatr_state::video_start() { // for each planet in the planet ROMs init_planet(m_planets[0], &machine().region("gfx1")->base()[0x2000]);