diff options
author | 2021-05-21 01:09:23 +0200 | |
---|---|---|
committer | 2021-05-20 19:09:23 -0400 | |
commit | 041c296dec8427e44faea876113a95b405d1734e (patch) | |
tree | 6b7afb2f51ee473da3a0cd68ea6caa7e6cd0a1cf | |
parent | c5860166ae539255dfdd6ca8b9b03c09b19f17ae (diff) |
c140.cpp: add sample status readback, fixes engine sound in suzuka 8 hours, final lap and four trax game series (#8080)
-rw-r--r-- | src/devices/sound/c140.cpp | 18 | ||||
-rw-r--r-- | src/devices/sound/c140.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/devices/sound/c140.cpp b/src/devices/sound/c140.cpp index 62e32707f6c..f8cfe01fa06 100644 --- a/src/devices/sound/c140.cpp +++ b/src/devices/sound/c140.cpp @@ -463,10 +463,23 @@ void c219_device::sound_stream_update(sound_stream &stream, std::vector<read_str } } +inline u8 c140_device::keyon_status_read(u16 offset) +{ + m_stream->update(); + C140_VOICE const &v = m_voi[offset >> 4]; + // suzuka 8 hours and final lap games reads from here, + // expecting bit 6 to be an inprogress sample flag. + // four trax also expects bit 4 high for some specific channels to make engine noises to work properly + // (sounds kinda bogus when player crashes in an object and jump spin, needs real HW verification) + return (v.key ? 0x40 : 0x00) | (v.mode & 0x3f); +} + u8 c140_device::c140_r(offs_t offset) { offset &= 0x1ff; + if ((offset & 0xf) == 0x5) + return keyon_status_read(offset); return m_REG[offset]; } @@ -540,6 +553,11 @@ void c140_device::c140_w(offs_t offset, u8 data) u8 c219_device::c219_r(offs_t offset) { offset &= 0x1ff; + // assume same as c140 + // TODO: what happens here on reading unmapped voice regs? + if ((offset & 0xf) == 0x5) + return keyon_status_read(offset); + return m_REG[offset]; } diff --git a/src/devices/sound/c140.h b/src/devices/sound/c140.h index 3008d964a9d..a29d77328fc 100644 --- a/src/devices/sound/c140.h +++ b/src/devices/sound/c140.h @@ -97,6 +97,8 @@ protected: C140_VOICE m_voi[MAX_VOICE]; emu_timer *m_int1_timer; + + u8 keyon_status_read(u16 offset); }; class c219_device : public c140_device |