コード例 #1
0
ファイル: CpuModule_Interrupts.c プロジェクト: ksherlock/mpw
void cpuSetUpInterrupt(ULO new_interrupt_level)
{
  UWO vector_offset = (UWO) (0x60 + new_interrupt_level*4);
  ULO vector_address = memoryReadLong(cpuGetVbr() + vector_offset);

  cpuActivateSSP(); // Switch to using ssp or msp. Loads a7 and preserves usp if we came from user-mode.

  cpuStackFrameGenerate(vector_offset, cpuGetPC()); // This will end up on msp if master is enabled, or on the ssp/isp if not.

  cpuSetSR(cpuGetSR() & 0x38ff);  // Clear interrupt level
  cpuSetSR(cpuGetSR() | 0x2000);  // Set supervisor mode
  cpuSetSR(cpuGetSR() | (UWO)(new_interrupt_level << 8)); // Set interrupt level

#ifdef CPU_INSTRUCTION_LOGGING
  cpuCallInterruptLoggingFunc(new_interrupt_level, vector_address);
#endif

  if (cpuGetModelMajor() >= 2 && cpuGetModelMajor() < 6)
  {
    if (cpuGetFlagMaster())
    { // If the cpu was in master mode, preserve msp, and switch to using ssp (isp) in a7.
      ULO oldA7 = cpuGetAReg(7);
      cpuSetMspDirect(oldA7);
      cpuSetAReg(7, cpuGetSspDirect());
      cpuFrame1(vector_offset, cpuGetPC());   // Make the throwaway frame on ssp/isp
      cpuSetSR(cpuGetSR() & 0xefff);  // Clear master bit
    }
  }
  cpuInitializeFromNewPC(vector_address);
  cpuSetStop(FALSE);
  cpuSetRaiseInterrupt(FALSE);
}
コード例 #2
0
ファイル: CpuModule_InternalState.c プロジェクト: clehner/mpw
UWO cpuGetNextWord(void)
{
  UWO tmp = cpu_prefetch_word;
  cpu_prefetch_word = cpuGetNextWordInternal();
  cpuSetPC(cpuGetPC() + 2);
  return tmp;
}
コード例 #3
0
ファイル: CpuModule_InternalState.c プロジェクト: clehner/mpw
ULO cpuGetNextLong(void)
{
  ULO tmp = cpu_prefetch_word << 16;
  ULO data = cpuGetNextLongInternal();
  cpu_prefetch_word = (UWO) data;
  cpuSetPC(cpuGetPC() + 4);
  return tmp | (data >> 16);
}
コード例 #4
0
ファイル: CpuModule_Exceptions.c プロジェクト: clehner/mpw
void cpuThrowAddressErrorException(void)
{
  cpuThrowException(0xc, cpuGetPC(), TRUE);
}
コード例 #5
0
ファイル: CpuModule_Exceptions.c プロジェクト: clehner/mpw
void cpuThrowTraceException(void)
{
  // The saved pc points to the next instruction, which is now in pc
  cpuThrowException(0x24, cpuGetPC(), FALSE);
}
コード例 #6
0
ファイル: CpuModule_Exceptions.c プロジェクト: clehner/mpw
void cpuThrowTrapException(ULO vector_no)
{
  // The saved pc points to the next instruction, which is now in pc
  cpuThrowException(0x80 + vector_no*4, cpuGetPC(), FALSE);
}
コード例 #7
0
ファイル: CpuModule_Exceptions.c プロジェクト: clehner/mpw
void cpuThrowDivisionByZeroException(BOOLE executejmp)
{
  // The saved pc points to the next instruction, which is now in pc
  cpuThrowException(0x14, cpuGetPC(), executejmp);
}
コード例 #8
0
ファイル: vm.c プロジェクト: lijnk/mysim
uint16_t vmPeekPC()
{
	return cpuGetPC(vm->cpu);
}
コード例 #9
0
ファイル: vm.c プロジェクト: lijnk/mysim
void vmTick()
{
	cpuRunCMD(vm->cpu, memROMRead(vm->mem, cpuGetPC(vm->cpu)));
}
コード例 #10
0
ファイル: CpuModule_InternalState.c プロジェクト: clehner/mpw
void cpuSkipNextLong(void)
{
  cpuSetPC(cpuGetPC() + 4);
  cpuInitializePrefetch();
}
コード例 #11
0
ファイル: CpuModule_InternalState.c プロジェクト: clehner/mpw
void cpuSkipNextWord(void)
{
  cpuSetPC(cpuGetPC() + 2);
  cpuInitializePrefetch();
}
コード例 #12
0
ファイル: CpuModule_InternalState.c プロジェクト: clehner/mpw
void cpuInitializePrefetch(void)
{
  cpu_prefetch_word = memoryReadWord(cpuGetPC());
}
コード例 #13
0
ファイル: CpuModule_InternalState.c プロジェクト: clehner/mpw
static ULO cpuGetNextLongInternal(void)
{
  ULO data = memoryReadLong(cpuGetPC() + 2);
  return data;
}
コード例 #14
0
ファイル: CpuModule_InternalState.c プロジェクト: clehner/mpw
static UWO cpuGetNextWordInternal(void)
{
  UWO data = memoryReadWord(cpuGetPC() + 2);
  return data;
}