Move interrupt checking code in a separate function.

This commit is contained in:
Jean-Philip Desjardins 2017-04-22 21:15:31 -04:00
parent 184a25c09c
commit 00fc68d96e
2 changed files with 14 additions and 7 deletions

View File

@ -241,6 +241,17 @@ uint32 CSubSystem::WriteIoRegister(uint32 address, uint32 value)
return 0;
}
void CSubSystem::CheckPendingInterrupts()
{
if(!m_cpu.m_State.nHasException)
{
if(m_intc.HasPendingInterrupt())
{
m_bios->HandleInterrupt();
}
}
}
bool CSubSystem::IsCpuIdle()
{
if(m_bios->IsIdle())
@ -290,13 +301,7 @@ void CSubSystem::CountTicks(int ticks)
int CSubSystem::ExecuteCpu(int quota)
{
int executed = 0;
if(!m_cpu.m_State.nHasException)
{
if(m_intc.HasPendingInterrupt())
{
m_bios->HandleInterrupt();
}
}
CheckPendingInterrupts();
if(!m_cpu.m_State.nHasException)
{
executed = (quota - m_executor.Execute(quota));

View File

@ -65,6 +65,8 @@ namespace Iop
uint32 ReadIoRegister(uint32);
uint32 WriteIoRegister(uint32, uint32);
void CheckPendingInterrupts();
int m_dmaUpdateTicks;
};
}