diff options
author | Justin Kerk <dopefishjustin@gmail.com> | 2019-03-31 22:29:51 +0000 |
---|---|---|
committer | Justin Kerk <dopefishjustin@gmail.com> | 2019-03-31 22:35:10 +0000 |
commit | 293fb66d7f56897f587721254e47d855241d514d (patch) | |
tree | 693e9b89a4badbc5989a488de988b83bfb587fc8 | |
parent | 844245bcf2106bedc1b06ed81ee70a1b785bbab5 (diff) |
Prevent integer overflow in Z80 CTC device, which causes a runtime error on WebAssembly builds. [Justin Kerk]
(nw) The issue was introduced in fc20d899ab83925a1169eeac2c61c70561b59ffb
-rw-r--r-- | src/devices/machine/z80ctc.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/devices/machine/z80ctc.cpp b/src/devices/machine/z80ctc.cpp index 74adf998feb..307da7d534a 100644 --- a/src/devices/machine/z80ctc.cpp +++ b/src/devices/machine/z80ctc.cpp @@ -373,7 +373,10 @@ u8 z80ctc_channel_device::read() LOG("CTC clock %f\n", period.as_hz()); - return u8((m_timer->remaining().as_double() / period.as_double()) + 1.0); + if(!m_timer->remaining().is_never()) + return u8((m_timer->remaining().as_double() / period.as_double()) + 1.0); + else + return 0; } } |