summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/timehelp.h
diff options
context:
space:
mode:
author mooglyguy <therealmogminer@gmail.com>2018-11-12 02:41:55 +0100
committer mooglyguy <therealmogminer@gmail.com>2018-11-12 02:42:19 +0100
commit1b08996e2b3b043bdd0b68868d7c6578b97cb484 (patch)
tree258df2f348363ef5ef12521ee3aa34e457e0ae04 /src/devices/machine/timehelp.h
parent208182c9c42d7c3836382ecac86c23cc7682ac77 (diff)
-dp8573.cpp: Added DP8573 Real-Time Clock emulation. [Ryan Holtz]
-indigo.cpp: Hooked up new DP8573 implementation. [Ryan Holtz]
Diffstat (limited to 'src/devices/machine/timehelp.h')
-rw-r--r--src/devices/machine/timehelp.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/devices/machine/timehelp.h b/src/devices/machine/timehelp.h
index 62626b3e25b..9e1e5efeefc 100644
--- a/src/devices/machine/timehelp.h
+++ b/src/devices/machine/timehelp.h
@@ -26,13 +26,15 @@ public:
return (((data >> 4) & 15) * 10) + (data & 15);
}
- static int inc_bcd(uint8_t *data, int mask, int min, int max)
+ static int inc_bcd(uint8_t *data, int mask, int min, int max, bool *tens_carry = nullptr)
{
int bcd = (*data + 1) & mask;
int carry = 0;
if ((bcd & 0x0f) > 9)
{
+ if (tens_carry)
+ *tens_carry = true;
bcd &= 0xf0;
bcd += 0x10;
if (bcd > max)
@@ -41,6 +43,10 @@ public:
carry = 1;
}
}
+ else if (tens_carry)
+ {
+ *tens_carry = false;
+ }
*data = (*data & ~mask) | (bcd & mask);
return carry;