summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2019-02-23 01:17:16 +1100
committer Vas Crabb <vas@vastheman.com>2019-02-23 01:17:16 +1100
commit71d7a8ff686dc4ac45c773eaf18da141d90b88cb (patch)
tree1e5f249d16aa983a198a9b3b18462f5640bd1f50
parent10f2953b650279b5ab8fcbebc955782884708ee7 (diff)
magic numbers are bad, untested changes are worse (nw)
-rw-r--r--src/devices/machine/timekpr.cpp12
-rw-r--r--src/devices/machine/timekpr.h22
2 files changed, 14 insertions, 20 deletions
diff --git a/src/devices/machine/timekpr.cpp b/src/devices/machine/timekpr.cpp
index 66c83ab2046..614f071ade7 100644
--- a/src/devices/machine/timekpr.cpp
+++ b/src/devices/machine/timekpr.cpp
@@ -69,21 +69,15 @@ DEFINE_DEVICE_TYPE(MK48T12, mk48t12_device, "mk48t12", "MK48T12 Timekeeper")
INLINE FUNCTIONS
***************************************************************************/
-static void counter_to_ram(u8 *data, u32 offset, u8 counter)
+inline void counter_to_ram(u8 *data, s32 offset, u8 counter)
{
if (offset >= 0)
- {
data[offset] = counter;
- }
}
-static int counter_from_ram(u8 *data, u32 offset)
+inline int counter_from_ram(u8 const *data, s32 offset, u8 unmap = 0)
{
- if (offset >= 0)
- {
- return data[offset];
- }
- return 0;
+ return (offset >= 0) ? data[offset] : unmap;
}
//**************************************************************************
diff --git a/src/devices/machine/timekpr.h b/src/devices/machine/timekpr.h
index e4e1803b5a4..def60c02059 100644
--- a/src/devices/machine/timekpr.h
+++ b/src/devices/machine/timekpr.h
@@ -79,17 +79,17 @@ private:
attotime m_watchdog_delay;
protected:
u32 const m_size;
- u32 m_offset_watchdog;
- u32 m_offset_control;
- u32 m_offset_seconds;
- u32 m_offset_minutes;
- u32 m_offset_hours;
- u32 m_offset_day;
- u32 m_offset_date;
- u32 m_offset_month;
- u32 m_offset_year;
- u32 m_offset_century;
- u32 m_offset_flags;
+ s32 m_offset_watchdog;
+ s32 m_offset_control;
+ s32 m_offset_seconds;
+ s32 m_offset_minutes;
+ s32 m_offset_hours;
+ s32 m_offset_day;
+ s32 m_offset_date;
+ s32 m_offset_month;
+ s32 m_offset_year;
+ s32 m_offset_century;
+ s32 m_offset_flags;
};
class m48t02_device : public timekeeper_device