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