--- nono/vm/mpu64180.h 2026/04/29 17:05:29 1.1.1.3 +++ nono/vm/mpu64180.h 2026/04/29 17:06:01 1.1.1.7 @@ -12,11 +12,11 @@ #include "mpu.h" #include "branchhistory.h" -#include "event.h" #include "hd64180.h" #include "message.h" #include +class HD647180ASCIDevice; class PIO0Device; class SSGDevice; class XPbusDevice; @@ -48,6 +48,7 @@ class MPU64180Device : public MPUDevice, ~MPU64180Device() override; void putlogn(const char *fmt, ...) const override; + bool Create() override; bool Init() override; void ResetHard(bool poweron) override; @@ -69,6 +70,9 @@ class MPU64180Device : public MPUDevice, // (ネゲートはローカルで行う) void AssertINT0(); + // ASCI0/1 の割り込みをアサート/ネゲートする (ASCI から呼ばれる)。 + void ChangeASCIInt(uint n, bool req); + // ブランチ履歴 (例外履歴を含む) BranchHistory_hd64180 brhist { OBJ_XP_BRHIST }; // 例外履歴のみ @@ -81,13 +85,6 @@ class MPU64180Device : public MPUDevice, bool GetIEF1() const { return ief1; } bool GetIEF2() const { return ief2; } - // CPU からの論理メモリアクセス - // (MSXDOSDevice からも呼ぶので public にしてある) - uint32 Read1(uint32 addr); - uint32 Write1(uint32 addr, uint32 data); - uint32 Read2(uint32 addr); - void Write2(uint32 addr, uint32 data); - // アドレス変換 (デバッガ用) uint32 TranslatePeek(uint32) const; @@ -103,10 +100,10 @@ class MPU64180Device : public MPUDevice, void EnterNormal(); void EnterSleep(); void EnterWakeup(); - void ExecTrace(Event& ev); - void ExecNormal(Event& ev); - void ExecSleep(Event& ev); - void ExecWakeup(Event& ev); + void ExecTrace(Event *); + void ExecNormal(Event *); + void ExecSleep(Event *); + void ExecWakeup(Event *); void SetExec(EventCallback_t); // トレース設定。デバッガから呼び出される。 @@ -119,8 +116,14 @@ class MPU64180Device : public MPUDevice, uint32 GetWW(uint) const; void SetWW(uint, uint32); + // CPU からの論理メモリアクセス uint32 Fetch1(); uint32 Fetch2(); + uint32 Read1(uint32 addr); + uint32 Write1(uint32 addr, uint32 data); + uint32 Read2(uint32 addr); + void Write2(uint32 addr, uint32 data); + void Jump(uint16); void op_illegal(int pos); @@ -204,7 +207,7 @@ class MPU64180Device : public MPUDevice, // タイマー void EnableTimer(); void ChangeTimerInterrupt(); - void TimerCallback(Event& ev); + void TimerCallback(Event *); void MakeActiveTimer(); uint16 ppc {}; @@ -252,7 +255,7 @@ class MPU64180Device : public MPUDevice, // 直近の命令語 uint8 op {}; - uint64 clock_nsec {}; // MPU クロック [nsec] + uint64 clock_tsec {}; // MPU クロック [tsec] // 電源オンからの累積消費サイクル uint64 used_cycle {}; @@ -294,29 +297,31 @@ class MPU64180Device : public MPUDevice, void (*syscall_callback)(void *) = NULL; void *syscall_arg {}; + std::unique_ptr asci /*{}*/; + PIO0Device *pio0 {}; SSGDevice *ssg {}; XPbusDevice *xpbus {}; // モニター - DECLARE_MONITOR_CALLBACK(MonitorUpdateReg); - DECLARE_MONITOR_CALLBACK(MonitorUpdateIO); - DECLARE_MONITOR_CALLBACK(MonitorUpdateIntr); - Monitor reg_monitor { this }; - Monitor io_monitor { this }; - Monitor intr_monitor { this }; + DECLARE_MONITOR_SCREEN(MonitorScreenReg); + DECLARE_MONITOR_SCREEN(MonitorScreenIO); + DECLARE_MONITOR_SCREEN(MonitorScreenIntr); + Monitor *reg_monitor {}; + Monitor *io_monitor {}; + Monitor *intr_monitor {}; // 実行コールバック EventCallback_t exec_func {}; // イベント - Event timer_event { this }; + Event *timer_event {}; // 名前 static const char * const opmode_names[]; static std::vector ionames; }; -static inline MPU64180Device *GetMPU64180Device() { +inline MPU64180Device *GetMPU64180Device() { return Object::GetObject(OBJ_MPUXP); }