From 5857dd9d2b763cd8211497a769055d73e7a503c2 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Sat, 1 Jan 2022 21:19:46 -0800 Subject: tmaster: work around game-crashing game bug [Peter Ferrie] fixes 3252 --- src/mame/drivers/tmaster.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/tmaster.cpp b/src/mame/drivers/tmaster.cpp index a44aed2b974..e22b3bb7a01 100644 --- a/src/mame/drivers/tmaster.cpp +++ b/src/mame/drivers/tmaster.cpp @@ -121,7 +121,8 @@ public: m_blitter(*this, "blitter"), m_oki(*this, "oki"), m_microtouch(*this,"microtouch"), - m_duart(*this, "duart68681") + m_duart(*this, "duart68681"), + m_oob_ram(*this, "oob_ram") { } void tm(machine_config &config); @@ -143,6 +144,9 @@ private: uint16_t rtc_r(offs_t offset); void rtc_w(offs_t offset, uint16_t data); + uint16_t oob_r(offs_t offset); + void oob_w(offs_t offset, uint16_t data); + void tmaster_map(address_map &map); void cpu_space_map(address_map &map); @@ -154,6 +158,8 @@ private: required_device m_microtouch; required_device m_duart; + required_shared_ptr m_oob_ram; + int m_okibank; uint8_t m_rtc_ram[8]; @@ -256,6 +262,21 @@ void tmaster_state::rtc_w(offs_t offset, uint16_t data) } } +uint16_t tmaster_state::oob_r(offs_t offset) +{ + if (m_maincpu->pc() > 0x500) + { + return 0; + } + + return m_oob_ram.target()[offset]; +} + +void tmaster_state::oob_w(offs_t offset, uint16_t data) +{ + m_oob_ram.target()[offset] = data; +} + /*************************************************************************** Memory Maps @@ -270,7 +291,13 @@ READ_LINE_MEMBER(tmaster_state::read_rand) void tmaster_state::tmaster_map(address_map &map) { map(0x000000, 0x1fffff).rom(); - map(0x200000, 0x27ffff).ram(); + map(0x200000, 0x211fff).ram(); + + // special case memory should RAZ after memtest completes, otherwise Solitaire games break + // looks like a game bug that is somehow handled by the hardware + map(0x212000, 0x212fff).ram().share("oob_ram").rw(FUNC(tmaster_state::oob_r), FUNC(tmaster_state::oob_w)); + + map(0x213000, 0x27ffff).ram(); map(0x280000, 0x28ffef).ram().share("nvram"); map(0x28fff0, 0x28ffff).rw(FUNC(tmaster_state::rtc_r), FUNC(tmaster_state::rtc_w)); -- cgit v1.2.3