CPU: Improve timings for WAI instruction (?)
This commit is contained in:
parent
5279b3d47d
commit
ebfd42f5b6
3 changed files with 24 additions and 15 deletions
|
@ -224,11 +224,13 @@ bool Console::LoadRom(VirtualFile romFile, VirtualFile patchFile, bool stopRom)
|
|||
MessageManager::DisplayMessage("SPC", "spc700.rom not found, cannot launch game.");
|
||||
return false;
|
||||
}
|
||||
|
||||
_cart = cart;
|
||||
UpdateRegion();
|
||||
|
||||
_internalRegisters.reset(new InternalRegisters(shared_from_this()));
|
||||
_ppu.reset(new Ppu(shared_from_this()));
|
||||
_spc.reset(new Spc(shared_from_this(), spcRomData));
|
||||
_cart = cart;
|
||||
_controlManager.reset(new ControlManager(shared_from_this()));
|
||||
_memoryManager.reset(new MemoryManager());
|
||||
_dmaController.reset(new DmaController(_memoryManager.get()));
|
||||
|
@ -236,12 +238,7 @@ bool Console::LoadRom(VirtualFile romFile, VirtualFile patchFile, bool stopRom)
|
|||
_memoryManager->Initialize(shared_from_this());
|
||||
|
||||
_cpu.reset(new Cpu(this));
|
||||
|
||||
_rewindManager.reset(new RewindManager(shared_from_this()));
|
||||
_notificationManager->RegisterNotificationListener(_rewindManager);
|
||||
|
||||
_controlManager->UpdateControlDevices();
|
||||
|
||||
|
||||
if(_debugger) {
|
||||
//Reset debugger if it was running before
|
||||
auto lock = _debuggerLock.AcquireSafe();
|
||||
|
@ -249,10 +246,17 @@ bool Console::LoadRom(VirtualFile romFile, VirtualFile patchFile, bool stopRom)
|
|||
GetDebugger();
|
||||
_debugger->Step(1);
|
||||
}
|
||||
|
||||
UpdateRegion();
|
||||
|
||||
_cpu->PowerOn();
|
||||
_memoryManager->IncrementMasterClockValue<170>();
|
||||
|
||||
_rewindManager.reset(new RewindManager(shared_from_this()));
|
||||
_notificationManager->RegisterNotificationListener(_rewindManager);
|
||||
|
||||
_controlManager->UpdateControlDevices();
|
||||
|
||||
UpdateRegion();
|
||||
|
||||
_paused = false;
|
||||
_notificationManager->SendNotification(ConsoleNotificationType::GameLoaded);
|
||||
|
||||
|
|
15
Core/Cpu.cpp
15
Core/Cpu.cpp
|
@ -10,6 +10,14 @@ Cpu::Cpu(Console *console)
|
|||
{
|
||||
_console = console;
|
||||
_memoryManager = console->GetMemoryManager().get();
|
||||
}
|
||||
|
||||
Cpu::~Cpu()
|
||||
{
|
||||
}
|
||||
|
||||
void Cpu::PowerOn()
|
||||
{
|
||||
_state = {};
|
||||
_state.PC = ReadDataWord(Cpu::ResetVector);
|
||||
_state.SP = 0x1FF;
|
||||
|
@ -24,10 +32,6 @@ Cpu::Cpu(Console *console)
|
|||
SetFlags(ProcFlags::IndexMode8);
|
||||
}
|
||||
|
||||
Cpu::~Cpu()
|
||||
{
|
||||
}
|
||||
|
||||
void Cpu::Reset()
|
||||
{
|
||||
_state.EmulationMode = true;
|
||||
|
@ -57,9 +61,8 @@ void Cpu::Exec()
|
|||
//WAI
|
||||
if(!_state.IrqSource && !_state.NmiFlag) {
|
||||
#ifndef DUMMYCPU
|
||||
_memoryManager->IncrementMasterClockValue<4>();
|
||||
Idle();
|
||||
#endif
|
||||
return;
|
||||
} else {
|
||||
Idle();
|
||||
Idle();
|
||||
|
|
|
@ -291,6 +291,8 @@ public:
|
|||
Cpu(Console *console);
|
||||
~Cpu();
|
||||
|
||||
void PowerOn();
|
||||
|
||||
void Reset();
|
||||
void Exec();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue