Restructure

This commit is contained in:
CocoSimone
2022-12-22 22:33:43 +01:00
parent ba62db8f12
commit 4adb7a46f8
70 changed files with 554 additions and 582 deletions

View File

@@ -0,0 +1,59 @@
#include <core/mmio/Interrupt.hpp>
#include <core/mmio/MI.hpp>
#include <core/registers/Registers.hpp>
namespace n64 {
void InterruptRaise(MI &mi, Registers &regs, Interrupt intr) {
switch(intr) {
case Interrupt::VI:
mi.miIntr.vi = true;
break;
case Interrupt::SI:
mi.miIntr.si = true;
break;
case Interrupt::PI:
mi.miIntr.pi = true;
break;
case Interrupt::AI:
mi.miIntr.ai = true;
break;
case Interrupt::DP:
mi.miIntr.dp = true;
break;
case Interrupt::SP:
mi.miIntr.sp = true;
break;
}
UpdateInterrupt(mi, regs);
}
void InterruptLower(MI &mi, Registers &regs, Interrupt intr) {
switch(intr) {
case Interrupt::VI:
mi.miIntr.vi = false;
break;
case Interrupt::SI:
mi.miIntr.si = false;
break;
case Interrupt::PI:
mi.miIntr.pi = false;
break;
case Interrupt::AI:
mi.miIntr.ai = false;
break;
case Interrupt::DP:
mi.miIntr.dp = false;
break;
case Interrupt::SP:
mi.miIntr.sp = false;
break;
}
UpdateInterrupt(mi, regs);
}
void UpdateInterrupt(MI &mi, Registers &regs) {
bool interrupt = mi.miIntr.raw & mi.miIntrMask.raw;
regs.cop0.cause.ip2 = interrupt;
}
}