diff options
author | 2019-07-18 13:20:00 +0700 | |
---|---|---|
committer | 2019-07-18 13:20:00 +0700 | |
commit | 533320c8407c5219cfbdbac605a1a30c18f9db03 (patch) | |
tree | 841918244d4ed85c105aab5403778ded54530f7c /src/devices/cpu/mips/mips1.cpp | |
parent | 5468cb6f3a7d3a81d4b0b96fd45873be355b433d (diff) |
mips1: add bus error line (nw)
Diffstat (limited to 'src/devices/cpu/mips/mips1.cpp')
-rw-r--r-- | src/devices/cpu/mips/mips1.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/devices/cpu/mips/mips1.cpp b/src/devices/cpu/mips/mips1.cpp index a5f99fcc993..eb379a225d0 100644 --- a/src/devices/cpu/mips/mips1.cpp +++ b/src/devices/cpu/mips/mips1.cpp @@ -207,6 +207,7 @@ void mips1core_device_base::device_reset() m_cop0[COP0_Status] = SR_BEV | SR_TS; m_data_spacenum = 0; + m_bus_error = false; } void mips1core_device_base::execute_run() @@ -1069,12 +1070,18 @@ template <typename T, typename U> std::enable_if_t<std::is_convertible<U, std::f { if (memory_translate(m_data_spacenum, TRANSLATE_READ, address)) { - switch (sizeof(T)) + T const data + = (sizeof(T) == 1) ? space(m_data_spacenum).read_byte(address) + : (sizeof(T) == 2) ? space(m_data_spacenum).read_word(address) + : space(m_data_spacenum).read_dword(address); + + if (m_bus_error) { - case 1: apply(T(space(m_data_spacenum).read_byte(address))); break; - case 2: apply(T(space(m_data_spacenum).read_word(address))); break; - case 4: apply(T(space(m_data_spacenum).read_dword(address))); break; + m_bus_error = false; + generate_exception(EXCEPTION_BUSDATA); } + else + apply(data); } } @@ -1095,8 +1102,17 @@ bool mips1core_device_base::fetch(u32 address, std::function<void(u32)> &&apply) { if (memory_translate(0, TRANSLATE_FETCH, address)) { - apply(space(0).read_dword(address)); + u32 const data = space(0).read_dword(address); + + if (m_bus_error) + { + m_bus_error = false; + generate_exception(EXCEPTION_BUSINST); + + return false; + } + apply(data); return true; } else |