--- nono/vm/mpu680x0.cpp 2026/04/29 17:04:55 1.1.1.9 +++ nono/vm/mpu680x0.cpp 2026/04/29 17:04:59 1.1.1.10 @@ -8,8 +8,10 @@ #include "mpu680x0.h" #include "config.h" +#include "m68030bus.h" #include "m68030excep.h" #include "mainapp.h" +#include "uimessage.h" #include "vm.h" #include @@ -69,6 +71,9 @@ MPU680x0Device::Init() } } + cpu->halt_callback = &MPU680x0Device::HaltCallback; + cpu->halt_arg = NULL; + return true; } @@ -152,12 +157,75 @@ MPU680x0Device::SetFLineCallback(bool (* cpu->fline_arg = arg; } -// ダブルバスフォールトのコールバックを指定。 -void -MPU680x0Device::SetHaltCallback(void (*callback)(void *), void *arg) +// MPU ホールト時の MPU からのコールバック関数 +/*static*/ void +MPU680x0Device::HaltCallback(void *arg) +{ + UIMessage::Post(UIMessage::HALT); +} + +// MPU からのアクセスをエミュレート +uint64 +MPU680x0Device::Read8(uint32 addr) +{ + try { + return m68030_read_8(cpu, addr); + } catch (...) { + return (uint64)-1; + } +} + +uint64 +MPU680x0Device::Read16(uint32 addr) +{ + try { + return m68030_read_16(cpu, addr); + } catch (...) { + return (uint64)-1; + } +} + +uint64 +MPU680x0Device::Read32(uint32 addr) { - cpu->halt_callback = callback; - cpu->halt_arg = arg; + try { + return m68030_read_32(cpu, addr); + } catch (...) { + return (uint64)-1; + } +} + +uint64 +MPU680x0Device::Write8(uint32 addr, uint32 data) +{ + try { + m68030_write_8(cpu, addr, data); + return 0; + } catch (...) { + return (uint64)-1; + } +} + +uint64 +MPU680x0Device::Write16(uint32 addr, uint32 data) +{ + try { + m68030_write_16(cpu, addr, data); + return 0; + } catch (...) { + return (uint64)-1; + } +} + +uint64 +MPU680x0Device::Write32(uint32 addr, uint32 data) +{ + try { + m68030_write_32(cpu, addr, data); + return 0; + } catch (...) { + return (uint64)-1; + } } // モニター更新 (レジスタウィンドウ)