mirror of
https://github.com/holub/mame
synced 2025-04-26 10:13:37 +03:00
allow rp5c01 without battery (mame core still writes a 0-byte file tho)
This commit is contained in:
parent
35d214ebf3
commit
5015b8bb9d
@ -66,10 +66,6 @@ static const int register_write_mask[2][16] =
|
||||
};
|
||||
|
||||
|
||||
// days per month
|
||||
//static const int DAYS_PER_MONTH[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
|
||||
// modes
|
||||
enum
|
||||
{
|
||||
@ -179,6 +175,7 @@ rp5c01_device::rp5c01_device(const machine_config &mconfig, const char *tag, dev
|
||||
device_rtc_interface(mconfig, *this),
|
||||
device_nvram_interface(mconfig, *this),
|
||||
m_out_alarm_cb(*this),
|
||||
m_battery_backed(true),
|
||||
m_mode(0),
|
||||
m_reset(0),
|
||||
m_alarm(1),
|
||||
@ -231,7 +228,7 @@ void rp5c01_device::device_reset()
|
||||
// 24 hour mode
|
||||
m_reg[MODE01][REGISTER_12_24_SELECT] = 1;
|
||||
|
||||
if (clock() > 0)
|
||||
if (m_battery_backed && clock() > 0)
|
||||
set_current_time(machine());
|
||||
}
|
||||
|
||||
@ -299,7 +296,8 @@ void rp5c01_device::nvram_default()
|
||||
|
||||
void rp5c01_device::nvram_read(emu_file &file)
|
||||
{
|
||||
file.read(m_ram, RAM_SIZE);
|
||||
if (m_battery_backed)
|
||||
file.read(m_ram, RAM_SIZE);
|
||||
}
|
||||
|
||||
|
||||
@ -310,7 +308,8 @@ void rp5c01_device::nvram_read(emu_file &file)
|
||||
|
||||
void rp5c01_device::nvram_write(emu_file &file)
|
||||
{
|
||||
file.write(m_ram, RAM_SIZE);
|
||||
if (m_battery_backed)
|
||||
file.write(m_ram, RAM_SIZE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,6 +37,10 @@
|
||||
#define MCFG_RP5C01_OUT_ALARM_CB(_devcb) \
|
||||
devcb = &rp5c01_device::set_out_alarm_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
// include this macro if the chip is not battery backed
|
||||
#define MCFG_RP5C01_REMOVE_BATTERY() \
|
||||
rp5c01_device::remove_battery(*device);
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
@ -53,6 +57,7 @@ public:
|
||||
rp5c01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
template<class _Object> static devcb_base &set_out_alarm_callback(device_t &device, _Object object) { return downcast<rp5c01_device &>(device).m_out_alarm_cb.set_callback(object); }
|
||||
static void remove_battery(device_t &device) { downcast<rp5c01_device &>(device).m_battery_backed = false; }
|
||||
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
@ -83,7 +88,8 @@ private:
|
||||
static const device_timer_id TIMER_CLOCK = 0;
|
||||
static const device_timer_id TIMER_16HZ = 1;
|
||||
|
||||
devcb_write_line m_out_alarm_cb;
|
||||
devcb_write_line m_out_alarm_cb;
|
||||
bool m_battery_backed;
|
||||
|
||||
UINT8 m_reg[2][13]; // clock registers
|
||||
UINT8 m_ram[13]; // RAM
|
||||
|
@ -12,7 +12,6 @@ driver by Nicola Salmoria
|
||||
TODO:
|
||||
- add useless driver config to choose between pink and white color proms
|
||||
- video raw params - pixel clock is derived from 20.16mhz xtal
|
||||
- spnchout rtc doesn't have a battery
|
||||
- money bag placement might not be 100% correct in Arm Wrestling
|
||||
|
||||
|
||||
@ -681,6 +680,7 @@ static MACHINE_CONFIG_DERIVED( spnchout, punchout )
|
||||
MCFG_CPU_IO_MAP(spnchout_io_map)
|
||||
|
||||
MCFG_DEVICE_ADD("rtc", RP5C01, 0) // OSCIN -> Vcc
|
||||
MCFG_RP5C01_REMOVE_BATTERY()
|
||||
MCFG_RP5H01_ADD("rp5h01")
|
||||
|
||||
MCFG_MACHINE_RESET_OVERRIDE(punchout_state, spnchout)
|
||||
|
Loading…
Reference in New Issue
Block a user