Previous 199869 Revisions Next

r31545 Thursday 7th August, 2014 at 12:14:33 UTC by hap
allow rp5c01 without battery (mame core still writes a 0-byte file tho)
[src/emu/machine]rp5c01.c rp5c01.h
[src/mame/drivers]punchout.c

trunk/src/emu/machine/rp5c01.c
r31544r31545
6666};
6767
6868
69// days per month
70//static const int DAYS_PER_MONTH[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
71
72
7369// modes
7470enum
7571{
r31544r31545
179175      device_rtc_interface(mconfig, *this),
180176      device_nvram_interface(mconfig, *this),
181177      m_out_alarm_cb(*this),
178      m_battery_backed(true),
182179      m_mode(0),
183180      m_reset(0),
184181      m_alarm(1),
r31544r31545
231228   // 24 hour mode
232229   m_reg[MODE01][REGISTER_12_24_SELECT] = 1;
233230
234   if (clock() > 0)
231   if (m_battery_backed && clock() > 0)
235232      set_current_time(machine());
236233}
237234
r31544r31545
299296
300297void rp5c01_device::nvram_read(emu_file &file)
301298{
302   file.read(m_ram, RAM_SIZE);
299   if (m_battery_backed)
300      file.read(m_ram, RAM_SIZE);
303301}
304302
305303
r31544r31545
310308
311309void rp5c01_device::nvram_write(emu_file &file)
312310{
313   file.write(m_ram, RAM_SIZE);
311   if (m_battery_backed)
312      file.write(m_ram, RAM_SIZE);
314313}
315314
316315
trunk/src/emu/machine/rp5c01.h
r31544r31545
3737#define MCFG_RP5C01_OUT_ALARM_CB(_devcb) \
3838   devcb = &rp5c01_device::set_out_alarm_callback(*device, DEVCB_##_devcb);
3939
40// include this macro if the chip is not battery backed
41#define MCFG_RP5C01_REMOVE_BATTERY() \
42   rp5c01_device::remove_battery(*device);
4043
44
4145//**************************************************************************
4246//  TYPE DEFINITIONS
4347//**************************************************************************
r31544r31545
5357   rp5c01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
5458
5559   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); }
60   static void remove_battery(device_t &device) { downcast<rp5c01_device &>(device).m_battery_backed = false; }
5661
5762   DECLARE_READ8_MEMBER( read );
5863   DECLARE_WRITE8_MEMBER( write );
r31544r31545
8388   static const device_timer_id TIMER_CLOCK = 0;
8489   static const device_timer_id TIMER_16HZ = 1;
8590
86   devcb_write_line        m_out_alarm_cb;
91   devcb_write_line m_out_alarm_cb;
92   bool m_battery_backed;
8793
8894   UINT8 m_reg[2][13];         // clock registers
8995   UINT8 m_ram[13];            // RAM
trunk/src/mame/drivers/punchout.c
r31544r31545
1212TODO:
1313- add useless driver config to choose between pink and white color proms
1414- video raw params - pixel clock is derived from 20.16mhz xtal
15- spnchout rtc doesn't have a battery
1615- money bag placement might not be 100% correct in Arm Wrestling
1716
1817
r31544r31545
681680   MCFG_CPU_IO_MAP(spnchout_io_map)
682681
683682   MCFG_DEVICE_ADD("rtc", RP5C01, 0) // OSCIN -> Vcc
683   MCFG_RP5C01_REMOVE_BATTERY()
684684   MCFG_RP5H01_ADD("rp5h01")
685685   
686686   MCFG_MACHINE_RESET_OVERRIDE(punchout_state, spnchout)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team