mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
Merged watchdog back into running_machine.
Renamed driver overrides to MCFG_MACHINE/SOUND/VIDEO_START_OVERRIDE to explicitly indicate they are overriding the default behavior. Put liberatr back the way it used to be.
This commit is contained in:
parent
7d27b8c9ff
commit
332011b258
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -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
|
||||
|
@ -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(); }
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
//**************************************************************************
|
||||
|
@ -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"
|
||||
|
@ -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 \
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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); \
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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__ */
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -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 */)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/*************************************
|
||||
|
@ -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 =
|
||||
|
@ -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 )
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -361,7 +361,7 @@ WRITE8_MEMBER(zr107_state::sysreg_w)
|
||||
0x01 = AFE
|
||||
*/
|
||||
if (data & 0x01)
|
||||
watchdog_reset(machine());
|
||||
machine().watchdog_reset();
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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? */
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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]);
|
||||
|
Loading…
Reference in New Issue
Block a user