--- nono/vm/interrupt.cpp 2026/04/29 17:05:17 1.1.1.7 +++ nono/vm/interrupt.cpp 2026/04/29 17:05:20 1.1.1.8 @@ -37,6 +37,7 @@ #include "mpu680x0.h" #include "newsctlr.h" #include "nmi.h" +#include "rtl8019as.h" #include "scc.h" #include "sio.h" #include "spc.h" @@ -105,6 +106,18 @@ InterruptDevice::NegateINT(Device *sourc } } +// 割り込み信号線の状態を取得 +bool +InterruptDevice::GetINT(const Device *source) const +{ + uint32 srcmap; + + srcmap = GetIntmap(source); + + return (intmap & srcmap); +} + + // // 仮想割り込みコントローラ (m680x0 共通部) // @@ -162,7 +175,7 @@ M680x0Interrupt::ChangeInterrupt() X68030Interrupt::X68030Interrupt() { monitor.func = ToMonitorCallback(&X68030Interrupt::MonitorUpdate); - monitor.SetSize(40, 11); + monitor.SetSize(41, 13); monitor.Regist(ID_MONITOR_INTERRUPT); } @@ -181,6 +194,10 @@ X68030Interrupt::Init() dmac = GetDMACDevice(); mfp = GetMFPDevice(); + // Nereid は拡張ボードなので存在しない可能性がある + for (int i = 0; i < 2; i++) { + net[i] = gMainApp.FindObject(OBJ_ETHERNET(i)); + } nmi = GetNMIDevice(); pedec = GetPEDECDevice(); scc = GetSCCDevice(); @@ -190,7 +207,7 @@ X68030Interrupt::Init() // デバイスから Intmap 値を引く uint32 -X68030Interrupt::GetIntmap(Device *source) const +X68030Interrupt::GetIntmap(const Device *source) const { if (__predict_true(source == mfp)) { return IntmapMFP; @@ -198,6 +215,12 @@ X68030Interrupt::GetIntmap(Device *sourc if (__predict_true(source == scc)) { return IntmapSCC; } + if (__predict_true(source == net[0])) { + return IntmapNereid0; + } + if (__predict_true(source == net[1])) { + return IntmapNereid1; + } if (__predict_true(source == dmac)) { return IntmapDMAC; } @@ -224,6 +247,14 @@ X68030Interrupt::InterruptAcknowledge(in case 5: return scc->InterruptAcknowledge(); + case 4: + for (int i = 0; i < 2; i++) { + if (net[i]) { + return net[i]->InterruptAcknowledge(); + } + } + break; + case 3: return dmac->InterruptAcknowledge(); @@ -244,11 +275,13 @@ X68030Interrupt::MonitorUpdate(Monitor * const char *name; uint32 map; } table[] = { - { "NMI", IntmapNMI }, - { "MFP", IntmapMFP }, - { "SCC", IntmapSCC }, - { "DMAC", IntmapDMAC }, - { "PEDEC", IntmapPEDEC }, + { "NMI", IntmapNMI }, + { "MFP", IntmapMFP }, + { "SCC", IntmapSCC }, + { "Nereid0", IntmapNereid0 }, + { "Nereid1", IntmapNereid1 }, + { "DMAC", IntmapDMAC }, + { "PEDEC", IntmapPEDEC }, }; // CPU の割り込み可否は本当は関係ないけど、便宜的に一緒に表示したい @@ -259,24 +292,30 @@ X68030Interrupt::MonitorUpdate(Monitor * // 0 1 2 3 4 // 01234567890123456789012345678901234567890 - // Lv Device IM=7 Count - // 1 PEDEC 01234567890123456789012345 - // SPC Mask + // Lv Device IM=7 Count + // 1 Nereid0 01234567890123456789012345 + // SPC Mask y = 0; - screen.Print(0, y, "Lv Device IM=%d", intr_mask); - screen.Puts(35, y, "Count"); + screen.Print(0, y, "Lv Device IM=%d", intr_mask); + screen.Puts(36, y, "Count"); y++; for (int i = 0; i < countof(table); i++) { uint32 map = table[i].map; int clz = __builtin_clz(map); int lv = (31 - clz) / 4; screen.Print(0, y, "%d", lv); - screen.Print(3, y, TA::OnOff(intmap & map), "%s", table[i].name); + if ((map == IntmapNereid0 && net[0] == NULL) || + (map == IntmapNereid1 && net[1] == NULL)) + { + screen.Puts(3, y, TA::Disable, table[i].name); + } else { + screen.Puts(3, y, TA::OnOff(intmap & map), table[i].name); + } if (lv <= intr_mask) { - screen.Puts(10, y, "Mask"); + screen.Puts(11, y, "Mask"); } - screen.Print(14, y, "%26s", format_number(counter[clz]).c_str()); + screen.Print(15, y, "%26s", format_number(counter[clz]).c_str()); y++; } @@ -321,7 +360,7 @@ LunaInterrupt::Init() // デバイスから Intmap 値を引く uint32 -LunaInterrupt::GetIntmap(Device *source) const +LunaInterrupt::GetIntmap(const Device *source) const { if (__predict_true(source == sio)) { return IntmapSIO; @@ -436,7 +475,7 @@ NewsInterrupt::Init() // デバイスから Intmap 値を引く uint32 -NewsInterrupt::GetIntmap(Device *source) const +NewsInterrupt::GetIntmap(const Device *source) const { if (__predict_true(source == newsctlr)) { return IntmapTimer;