Skip to content

Commit

Permalink
Debugger: Lua - Fixed memory callbacks for SPC
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil committed Jun 19, 2023
1 parent 6b6dff8 commit a4d3d30
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Core/SNES/Debugger/SpcDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ void SpcDebugger::ProcessInstruction()
uint8_t value = _spc->DebugRead(addr);
AddressInfo addressInfo = _spc->GetAbsoluteAddress(addr);
MemoryOperationInfo operation(addr, value, MemoryOperationType::ExecOpCode, MemoryType::SpcMemory);
InstructionProgress.LastMemOperation = operation;
InstructionProgress.StartCycle = state.Cycle;

_disassembler->BuildCache(addressInfo, 0, CpuType::Spc);

Expand Down Expand Up @@ -109,10 +111,12 @@ void SpcDebugger::ProcessInstruction()
template<MemoryAccessFlags flags>
void SpcDebugger::ProcessRead(uint32_t addr, uint8_t value, MemoryOperationType type)
{
MemoryOperationInfo operation(addr, value, type, MemoryType::SpcMemory);
InstructionProgress.LastMemOperation = operation;

if constexpr(flags == MemoryAccessFlags::None) {
//SPC read
AddressInfo addressInfo = _spc->GetAbsoluteAddress(addr);
MemoryOperationInfo operation(addr, value, type, MemoryType::SpcMemory);

if(type == MemoryOperationType::ExecOpCode) {
if(_traceLogger->IsEnabled()) {
Expand All @@ -138,7 +142,6 @@ void SpcDebugger::ProcessRead(uint32_t addr, uint8_t value, MemoryOperationType
//DSP read
if(!_ignoreDspReadWrites) {
AddressInfo addressInfo { (int32_t)addr, MemoryType::SpcRam }; //DSP reads never read from the IPL ROM
MemoryOperationInfo operation(addr, value, type, MemoryType::SpcMemory);

_memoryAccessCounter->ProcessMemoryRead(addressInfo, _memoryManager->GetMasterClock());
_debugger->ProcessBreakConditions(CpuType::Spc, *_step.get(), _breakpointManager.get(), operation, addressInfo);
Expand All @@ -151,6 +154,7 @@ void SpcDebugger::ProcessWrite(uint32_t addr, uint8_t value, MemoryOperationType
{
AddressInfo addressInfo { (int32_t)addr, MemoryType::SpcRam }; //Writes never affect the IPL ROM
MemoryOperationInfo operation(addr, value, type, MemoryType::SpcMemory);
InstructionProgress.LastMemOperation = operation;

//Always invalidate cache, even if DSP writes are ignored
_disassembler->InvalidateCache(addressInfo, CpuType::Spc);
Expand Down

0 comments on commit a4d3d30

Please sign in to comment.