Beispiel #1
0
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);
}
Beispiel #2
0
UWO cpuGetNextWord(void)
{
  UWO tmp = cpu_prefetch_word;
  cpu_prefetch_word = cpuGetNextWordInternal();
  cpuSetPC(cpuGetPC() + 2);
  return tmp;
}
Beispiel #3
0
ULO cpuGetNextLong(void)
{
  ULO tmp = cpu_prefetch_word << 16;
  ULO data = cpuGetNextLongInternal();
  cpu_prefetch_word = (UWO) data;
  cpuSetPC(cpuGetPC() + 4);
  return tmp | (data >> 16);
}
Beispiel #4
0
void cpuThrowAddressErrorException(void)
{
  cpuThrowException(0xc, cpuGetPC(), TRUE);
}
Beispiel #5
0
void cpuThrowTraceException(void)
{
  // The saved pc points to the next instruction, which is now in pc
  cpuThrowException(0x24, cpuGetPC(), FALSE);
}
Beispiel #6
0
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);
}
Beispiel #7
0
void cpuThrowDivisionByZeroException(BOOLE executejmp)
{
  // The saved pc points to the next instruction, which is now in pc
  cpuThrowException(0x14, cpuGetPC(), executejmp);
}
Beispiel #8
0
Datei: vm.c Projekt: lijnk/mysim
uint16_t vmPeekPC()
{
	return cpuGetPC(vm->cpu);
}
Beispiel #9
0
Datei: vm.c Projekt: lijnk/mysim
void vmTick()
{
	cpuRunCMD(vm->cpu, memROMRead(vm->mem, cpuGetPC(vm->cpu)));
}
Beispiel #10
0
void cpuSkipNextLong(void)
{
  cpuSetPC(cpuGetPC() + 4);
  cpuInitializePrefetch();
}
Beispiel #11
0
void cpuSkipNextWord(void)
{
  cpuSetPC(cpuGetPC() + 2);
  cpuInitializePrefetch();
}
Beispiel #12
0
void cpuInitializePrefetch(void)
{
  cpu_prefetch_word = memoryReadWord(cpuGetPC());
}
Beispiel #13
0
static ULO cpuGetNextLongInternal(void)
{
  ULO data = memoryReadLong(cpuGetPC() + 2);
  return data;
}
Beispiel #14
0
static UWO cpuGetNextWordInternal(void)
{
  UWO data = memoryReadWord(cpuGetPC() + 2);
  return data;
}