Debugger: Fixed display issues in disassembly view for SA-1 debugger
Effective addresses and their values were incorrect
This commit is contained in:
parent
f5fbc87928
commit
28443f84d6
13 changed files with 70 additions and 42 deletions
14
Core/Cpu.cpp
14
Core/Cpu.cpp
|
@ -9,12 +9,14 @@
|
||||||
#include "Cpu.Instructions.h"
|
#include "Cpu.Instructions.h"
|
||||||
#include "Cpu.Shared.h"
|
#include "Cpu.Shared.h"
|
||||||
|
|
||||||
|
#ifndef DUMMYCPU
|
||||||
Cpu::Cpu(Console *console)
|
Cpu::Cpu(Console *console)
|
||||||
{
|
{
|
||||||
_console = console;
|
_console = console;
|
||||||
_memoryManager = console->GetMemoryManager().get();
|
_memoryManager = console->GetMemoryManager().get();
|
||||||
_dmaController = console->GetDmaController().get();
|
_dmaController = console->GetDmaController().get();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Cpu::~Cpu()
|
Cpu::~Cpu()
|
||||||
{
|
{
|
||||||
|
@ -86,32 +88,24 @@ void Cpu::ProcessCpuCycle()
|
||||||
_state.IrqLock = _dmaController->ProcessPendingTransfers();
|
_state.IrqLock = _dmaController->ProcessPendingTransfers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DUMMYCPU
|
||||||
uint8_t Cpu::Read(uint32_t addr, MemoryOperationType type)
|
uint8_t Cpu::Read(uint32_t addr, MemoryOperationType type)
|
||||||
{
|
{
|
||||||
#ifdef DUMMYCPU
|
|
||||||
uint8_t value = _memoryManager->Peek(addr);
|
|
||||||
LogRead(addr, value);
|
|
||||||
return value;
|
|
||||||
#else
|
|
||||||
_memoryManager->SetCpuSpeed(_memoryManager->GetCpuSpeed(addr));
|
_memoryManager->SetCpuSpeed(_memoryManager->GetCpuSpeed(addr));
|
||||||
ProcessCpuCycle();
|
ProcessCpuCycle();
|
||||||
uint8_t value = _memoryManager->Read(addr, type);
|
uint8_t value = _memoryManager->Read(addr, type);
|
||||||
UpdateIrqNmiFlags();
|
UpdateIrqNmiFlags();
|
||||||
return value;
|
return value;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cpu::Write(uint32_t addr, uint8_t value, MemoryOperationType type)
|
void Cpu::Write(uint32_t addr, uint8_t value, MemoryOperationType type)
|
||||||
{
|
{
|
||||||
#ifdef DUMMYCPU
|
|
||||||
LogWrite(addr, value);
|
|
||||||
#else
|
|
||||||
_memoryManager->SetCpuSpeed(_memoryManager->GetCpuSpeed(addr));
|
_memoryManager->SetCpuSpeed(_memoryManager->GetCpuSpeed(addr));
|
||||||
ProcessCpuCycle();
|
ProcessCpuCycle();
|
||||||
_memoryManager->Write(addr, value, type);
|
_memoryManager->Write(addr, value, type);
|
||||||
UpdateIrqNmiFlags();
|
UpdateIrqNmiFlags();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint16_t Cpu::GetResetVector()
|
uint16_t Cpu::GetResetVector()
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "CpuTypes.h"
|
#include "CpuTypes.h"
|
||||||
#include "../Utilities/ISerializable.h"
|
#include "../Utilities/ISerializable.h"
|
||||||
|
|
||||||
|
class MemoryMappings;
|
||||||
class MemoryManager;
|
class MemoryManager;
|
||||||
class DmaController;
|
class DmaController;
|
||||||
class Console;
|
class Console;
|
||||||
|
@ -313,7 +314,12 @@ private:
|
||||||
void RunOp();
|
void RunOp();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
#ifndef DUMMYCPU
|
||||||
Cpu(Console *console);
|
Cpu(Console *console);
|
||||||
|
#else
|
||||||
|
DummyCpu(Console* console, CpuType type);
|
||||||
|
#endif
|
||||||
|
|
||||||
virtual ~Cpu();
|
virtual ~Cpu();
|
||||||
|
|
||||||
void PowerOn();
|
void PowerOn();
|
||||||
|
@ -339,6 +345,7 @@ public:
|
||||||
|
|
||||||
#ifdef DUMMYCPU
|
#ifdef DUMMYCPU
|
||||||
private:
|
private:
|
||||||
|
MemoryMappings* _memoryMappings;
|
||||||
uint32_t _writeCounter = 0;
|
uint32_t _writeCounter = 0;
|
||||||
uint32_t _writeAddresses[10];
|
uint32_t _writeAddresses[10];
|
||||||
uint8_t _writeValue[10];
|
uint8_t _writeValue[10];
|
||||||
|
|
|
@ -104,10 +104,10 @@ uint32_t CpuDisUtils::GetOperandAddress(DisassemblyInfo &info, uint32_t memoryAd
|
||||||
return opAddr;
|
return opAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CpuDisUtils::GetEffectiveAddress(DisassemblyInfo &info, Console *console, CpuState &state)
|
int32_t CpuDisUtils::GetEffectiveAddress(DisassemblyInfo &info, Console *console, CpuState &state, CpuType type)
|
||||||
{
|
{
|
||||||
if(HasEffectiveAddress(CpuDisUtils::OpMode[info.GetOpCode()])) {
|
if(HasEffectiveAddress(CpuDisUtils::OpMode[info.GetOpCode()])) {
|
||||||
DummyCpu cpu(console);
|
DummyCpu cpu(console, type);
|
||||||
state.PS &= ~(ProcFlags::IndexMode8 | ProcFlags::MemoryMode8);
|
state.PS &= ~(ProcFlags::IndexMode8 | ProcFlags::MemoryMode8);
|
||||||
state.PS |= info.GetFlags();
|
state.PS |= info.GetFlags();
|
||||||
cpu.SetDummyState(state);
|
cpu.SetDummyState(state);
|
||||||
|
|
|
@ -6,6 +6,7 @@ class Console;
|
||||||
class LabelManager;
|
class LabelManager;
|
||||||
class EmuSettings;
|
class EmuSettings;
|
||||||
struct CpuState;
|
struct CpuState;
|
||||||
|
enum class CpuType : uint8_t;
|
||||||
enum class AddrMode : uint8_t;
|
enum class AddrMode : uint8_t;
|
||||||
|
|
||||||
class CpuDisUtils
|
class CpuDisUtils
|
||||||
|
@ -23,7 +24,7 @@ public:
|
||||||
|
|
||||||
static void GetDisassembly(DisassemblyInfo &info, string &out, uint32_t memoryAddr, LabelManager* labelManager, EmuSettings* settings);
|
static void GetDisassembly(DisassemblyInfo &info, string &out, uint32_t memoryAddr, LabelManager* labelManager, EmuSettings* settings);
|
||||||
static uint8_t GetOpSize(uint8_t opCode, uint8_t flags);
|
static uint8_t GetOpSize(uint8_t opCode, uint8_t flags);
|
||||||
static int32_t GetEffectiveAddress(DisassemblyInfo &info, Console* console, CpuState &state);
|
static int32_t GetEffectiveAddress(DisassemblyInfo &info, Console* console, CpuState &state, CpuType type);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class AddrMode : uint8_t
|
enum class AddrMode : uint8_t
|
||||||
|
|
|
@ -547,6 +547,7 @@ void Debugger::GetCdlData(uint32_t offset, uint32_t length, SnesMemoryType memor
|
||||||
MemoryMappings* mappings = nullptr;
|
MemoryMappings* mappings = nullptr;
|
||||||
switch(memoryType) {
|
switch(memoryType) {
|
||||||
case SnesMemoryType::CpuMemory: mappings = _memoryManager->GetMemoryMappings(); break;
|
case SnesMemoryType::CpuMemory: mappings = _memoryManager->GetMemoryMappings(); break;
|
||||||
|
case SnesMemoryType::Sa1Memory: mappings = _cart->GetSa1()->GetMemoryMappings(); break;
|
||||||
case SnesMemoryType::GsuMemory: mappings = _cart->GetGsu()->GetMemoryMappings(); break;
|
case SnesMemoryType::GsuMemory: mappings = _cart->GetGsu()->GetMemoryMappings(); break;
|
||||||
case SnesMemoryType::Cx4Memory: mappings = _cart->GetCx4()->GetMemoryMappings(); break;
|
case SnesMemoryType::Cx4Memory: mappings = _cart->GetCx4()->GetMemoryMappings(); break;
|
||||||
default: throw std::runtime_error("GetCdlData - Unsupported memory type");
|
default: throw std::runtime_error("GetCdlData - Unsupported memory type");
|
||||||
|
|
|
@ -33,8 +33,10 @@ Disassembler::Disassembler(shared_ptr<Console> console, shared_ptr<CodeDataLogge
|
||||||
_debugger = debugger;
|
_debugger = debugger;
|
||||||
_labelManager = debugger->GetLabelManager();
|
_labelManager = debugger->GetLabelManager();
|
||||||
_console = console.get();
|
_console = console.get();
|
||||||
|
_cpu = console->GetCpu().get();
|
||||||
_spc = console->GetSpc().get();
|
_spc = console->GetSpc().get();
|
||||||
_gsu = cart->GetGsu();
|
_gsu = cart->GetGsu();
|
||||||
|
_sa1 = cart->GetSa1();
|
||||||
_settings = console->GetSettings().get();
|
_settings = console->GetSettings().get();
|
||||||
_memoryDumper = _debugger->GetMemoryDumper().get();
|
_memoryDumper = _debugger->GetMemoryDumper().get();
|
||||||
_memoryManager = console->GetMemoryManager().get();
|
_memoryManager = console->GetMemoryManager().get();
|
||||||
|
@ -510,18 +512,18 @@ bool Disassembler::GetLineData(CpuType type, uint32_t lineIndex, CodeLineData &d
|
||||||
switch(lineCpuType) {
|
switch(lineCpuType) {
|
||||||
case CpuType::Cpu:
|
case CpuType::Cpu:
|
||||||
case CpuType::Sa1: {
|
case CpuType::Sa1: {
|
||||||
CpuState state = _console->GetCpu()->GetState();
|
CpuState state = type == CpuType::Sa1 ? _sa1->GetCpuState() : _cpu->GetState();
|
||||||
state.PC = (uint16_t)result.CpuAddress;
|
state.PC = (uint16_t)result.CpuAddress;
|
||||||
state.K = (result.CpuAddress >> 16);
|
state.K = (result.CpuAddress >> 16);
|
||||||
|
|
||||||
if(!disInfo.IsInitialized()) {
|
if(!disInfo.IsInitialized()) {
|
||||||
disInfo = DisassemblyInfo(src.Data + result.Address.Address, state.PS, CpuType::Cpu);
|
disInfo = DisassemblyInfo(src.Data + result.Address.Address, state.PS, type);
|
||||||
} else {
|
} else {
|
||||||
data.Flags |= (result.Address.Type != SnesMemoryType::PrgRom || _cdl->IsCode(data.AbsoluteAddress)) ? LineFlags::VerifiedCode : LineFlags::UnexecutedCode;
|
data.Flags |= (result.Address.Type != SnesMemoryType::PrgRom || _cdl->IsCode(data.AbsoluteAddress)) ? LineFlags::VerifiedCode : LineFlags::UnexecutedCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.OpSize = disInfo.GetOpSize();
|
data.OpSize = disInfo.GetOpSize();
|
||||||
data.EffectiveAddress = disInfo.GetEffectiveAddress(_console, &state);
|
data.EffectiveAddress = disInfo.GetEffectiveAddress(_console, &state, type);
|
||||||
|
|
||||||
if(data.EffectiveAddress >= 0) {
|
if(data.EffectiveAddress >= 0) {
|
||||||
data.Value = disInfo.GetMemoryValue(data.EffectiveAddress, _memoryDumper, memType, data.ValueSize);
|
data.Value = disInfo.GetMemoryValue(data.EffectiveAddress, _memoryDumper, memType, data.ValueSize);
|
||||||
|
@ -542,7 +544,7 @@ bool Disassembler::GetLineData(CpuType type, uint32_t lineIndex, CodeLineData &d
|
||||||
}
|
}
|
||||||
|
|
||||||
data.OpSize = disInfo.GetOpSize();
|
data.OpSize = disInfo.GetOpSize();
|
||||||
data.EffectiveAddress = disInfo.GetEffectiveAddress(_console, &state);
|
data.EffectiveAddress = disInfo.GetEffectiveAddress(_console, &state, lineCpuType);
|
||||||
if(data.EffectiveAddress >= 0) {
|
if(data.EffectiveAddress >= 0) {
|
||||||
data.Value = disInfo.GetMemoryValue(data.EffectiveAddress, _memoryDumper, memType, data.ValueSize);
|
data.Value = disInfo.GetMemoryValue(data.EffectiveAddress, _memoryDumper, memType, data.ValueSize);
|
||||||
data.ValueSize = 1;
|
data.ValueSize = 1;
|
||||||
|
@ -561,7 +563,7 @@ bool Disassembler::GetLineData(CpuType type, uint32_t lineIndex, CodeLineData &d
|
||||||
}
|
}
|
||||||
|
|
||||||
data.OpSize = disInfo.GetOpSize();
|
data.OpSize = disInfo.GetOpSize();
|
||||||
data.EffectiveAddress = disInfo.GetEffectiveAddress(_console, &state);
|
data.EffectiveAddress = disInfo.GetEffectiveAddress(_console, &state, lineCpuType);
|
||||||
if(data.EffectiveAddress >= 0) {
|
if(data.EffectiveAddress >= 0) {
|
||||||
data.Value = disInfo.GetMemoryValue(data.EffectiveAddress, _memoryDumper, memType, data.ValueSize);
|
data.Value = disInfo.GetMemoryValue(data.EffectiveAddress, _memoryDumper, memType, data.ValueSize);
|
||||||
data.ValueSize = 2;
|
data.ValueSize = 2;
|
||||||
|
@ -574,7 +576,7 @@ bool Disassembler::GetLineData(CpuType type, uint32_t lineIndex, CodeLineData &d
|
||||||
case CpuType::NecDsp:
|
case CpuType::NecDsp:
|
||||||
case CpuType::Cx4:
|
case CpuType::Cx4:
|
||||||
if(!disInfo.IsInitialized()) {
|
if(!disInfo.IsInitialized()) {
|
||||||
disInfo = DisassemblyInfo(src.Data + result.Address.Address, 0, lineCpuType);
|
disInfo = DisassemblyInfo(src.Data + result.Address.Address, 0, type);
|
||||||
} else {
|
} else {
|
||||||
data.Flags |= LineFlags::VerifiedCode;
|
data.Flags |= LineFlags::VerifiedCode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,10 @@
|
||||||
|
|
||||||
class MemoryManager;
|
class MemoryManager;
|
||||||
class Console;
|
class Console;
|
||||||
|
class Cpu;
|
||||||
class Spc;
|
class Spc;
|
||||||
class Gsu;
|
class Gsu;
|
||||||
|
class Sa1;
|
||||||
class Debugger;
|
class Debugger;
|
||||||
class LabelManager;
|
class LabelManager;
|
||||||
class CodeDataLogger;
|
class CodeDataLogger;
|
||||||
|
@ -29,8 +31,10 @@ class Disassembler
|
||||||
private:
|
private:
|
||||||
MemoryManager *_memoryManager;
|
MemoryManager *_memoryManager;
|
||||||
Console *_console;
|
Console *_console;
|
||||||
|
Cpu* _cpu;
|
||||||
Spc* _spc;
|
Spc* _spc;
|
||||||
Gsu* _gsu;
|
Gsu* _gsu;
|
||||||
|
Sa1* _sa1;
|
||||||
EmuSettings* _settings;
|
EmuSettings* _settings;
|
||||||
Debugger *_debugger;
|
Debugger *_debugger;
|
||||||
shared_ptr<CodeDataLogger> _cdl;
|
shared_ptr<CodeDataLogger> _cdl;
|
||||||
|
|
|
@ -61,12 +61,12 @@ void DisassemblyInfo::GetDisassembly(string &out, uint32_t memoryAddr, LabelMana
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t DisassemblyInfo::GetEffectiveAddress(Console *console, void *cpuState)
|
int32_t DisassemblyInfo::GetEffectiveAddress(Console *console, void *cpuState, CpuType cpuType)
|
||||||
{
|
{
|
||||||
switch(_cpuType) {
|
switch(_cpuType) {
|
||||||
case CpuType::Sa1:
|
case CpuType::Sa1:
|
||||||
case CpuType::Cpu:
|
case CpuType::Cpu:
|
||||||
return CpuDisUtils::GetEffectiveAddress(*this, console, *(CpuState*)cpuState);
|
return CpuDisUtils::GetEffectiveAddress(*this, console, *(CpuState*)cpuState, cpuType);
|
||||||
|
|
||||||
case CpuType::Spc: return SpcDisUtils::GetEffectiveAddress(*this, console, *(SpcState*)cpuState);
|
case CpuType::Spc: return SpcDisUtils::GetEffectiveAddress(*this, console, *(SpcState*)cpuState);
|
||||||
case CpuType::Gsu: return GsuDisUtils::GetEffectiveAddress(*this, console, *(GsuState*)cpuState);
|
case CpuType::Gsu: return GsuDisUtils::GetEffectiveAddress(*this, console, *(GsuState*)cpuState);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
|
|
||||||
bool UpdateCpuFlags(uint8_t & cpuFlags);
|
bool UpdateCpuFlags(uint8_t & cpuFlags);
|
||||||
|
|
||||||
int32_t GetEffectiveAddress(Console *console, void *cpuState);
|
int32_t GetEffectiveAddress(Console *console, void *cpuState, CpuType type);
|
||||||
uint16_t GetMemoryValue(uint32_t effectiveAddress, MemoryDumper *memoryDumper, SnesMemoryType memType, uint8_t &valueSize);
|
uint16_t GetMemoryValue(uint32_t effectiveAddress, MemoryDumper *memoryDumper, SnesMemoryType memType, uint8_t &valueSize);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include "MemoryMappings.h"
|
||||||
|
#include "DebugTypes.h"
|
||||||
|
#include "BaseCartridge.h"
|
||||||
|
#include "Sa1.h"
|
||||||
|
|
||||||
#define DUMMYCPU
|
#define DUMMYCPU
|
||||||
#define Cpu DummyCpu
|
#define Cpu DummyCpu
|
||||||
|
@ -9,6 +13,26 @@
|
||||||
#undef Cpu
|
#undef Cpu
|
||||||
#undef DUMMYCPU
|
#undef DUMMYCPU
|
||||||
|
|
||||||
|
DummyCpu::DummyCpu(Console* console, CpuType type)
|
||||||
|
{
|
||||||
|
_console = console;
|
||||||
|
_memoryMappings = type == CpuType::Cpu ? console->GetMemoryManager()->GetMemoryMappings() : console->GetCartridge()->GetSa1()->GetMemoryMappings();
|
||||||
|
_dmaController = nullptr;
|
||||||
|
_memoryManager = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t DummyCpu::Read(uint32_t addr, MemoryOperationType type)
|
||||||
|
{
|
||||||
|
uint8_t value = _memoryMappings->Peek(addr);
|
||||||
|
LogRead(addr, value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DummyCpu::Write(uint32_t addr, uint8_t value, MemoryOperationType type)
|
||||||
|
{
|
||||||
|
LogWrite(addr, value);
|
||||||
|
}
|
||||||
|
|
||||||
void DummyCpu::SetDummyState(CpuState &state)
|
void DummyCpu::SetDummyState(CpuState &state)
|
||||||
{
|
{
|
||||||
_state = state;
|
_state = state;
|
||||||
|
|
|
@ -255,9 +255,9 @@ void TraceLogger::WriteDisassembly(DisassemblyInfo &info, RowPart &rowPart, uint
|
||||||
WriteValue(output, code, rowPart);
|
WriteValue(output, code, rowPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraceLogger::WriteEffectiveAddress(DisassemblyInfo &info, RowPart &rowPart, void *cpuState, string &output, SnesMemoryType cpuMemoryType)
|
void TraceLogger::WriteEffectiveAddress(DisassemblyInfo &info, RowPart &rowPart, void *cpuState, string &output, SnesMemoryType cpuMemoryType, CpuType cpuType)
|
||||||
{
|
{
|
||||||
int32_t effectiveAddress = info.GetEffectiveAddress(_console, cpuState);
|
int32_t effectiveAddress = info.GetEffectiveAddress(_console, cpuState, cpuType);
|
||||||
if(effectiveAddress >= 0) {
|
if(effectiveAddress >= 0) {
|
||||||
if(_options.UseLabels) {
|
if(_options.UseLabels) {
|
||||||
AddressInfo addr { effectiveAddress, cpuMemoryType };
|
AddressInfo addr { effectiveAddress, cpuMemoryType };
|
||||||
|
@ -271,9 +271,9 @@ void TraceLogger::WriteEffectiveAddress(DisassemblyInfo &info, RowPart &rowPart,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraceLogger::WriteMemoryValue(DisassemblyInfo &info, RowPart &rowPart, void *cpuState, string &output, SnesMemoryType memType)
|
void TraceLogger::WriteMemoryValue(DisassemblyInfo &info, RowPart &rowPart, void *cpuState, string &output, SnesMemoryType memType, CpuType cpuType)
|
||||||
{
|
{
|
||||||
int32_t address = info.GetEffectiveAddress(_console, cpuState);
|
int32_t address = info.GetEffectiveAddress(_console, cpuState, cpuType);
|
||||||
if(address >= 0) {
|
if(address >= 0) {
|
||||||
uint8_t valueSize;
|
uint8_t valueSize;
|
||||||
uint16_t value = info.GetMemoryValue(address, _memoryDumper, memType, valueSize);
|
uint16_t value = info.GetMemoryValue(address, _memoryDumper, memType, valueSize);
|
||||||
|
@ -297,7 +297,7 @@ void TraceLogger::WriteAlign(int originalSize, RowPart &rowPart, string &output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraceLogger::GetTraceRow(string &output, CpuState &cpuState, PpuState &ppuState, DisassemblyInfo &disassemblyInfo, SnesMemoryType memType)
|
void TraceLogger::GetTraceRow(string &output, CpuState &cpuState, PpuState &ppuState, DisassemblyInfo &disassemblyInfo, SnesMemoryType memType, CpuType cpuType)
|
||||||
{
|
{
|
||||||
int originalSize = (int)output.size();
|
int originalSize = (int)output.size();
|
||||||
uint32_t pcAddress = (cpuState.K << 16) | cpuState.PC;
|
uint32_t pcAddress = (cpuState.K << 16) | cpuState.PC;
|
||||||
|
@ -306,8 +306,8 @@ void TraceLogger::GetTraceRow(string &output, CpuState &cpuState, PpuState &ppuS
|
||||||
case RowDataType::Text: output += rowPart.Text; break;
|
case RowDataType::Text: output += rowPart.Text; break;
|
||||||
case RowDataType::ByteCode: WriteByteCode(disassemblyInfo, rowPart, output); break;
|
case RowDataType::ByteCode: WriteByteCode(disassemblyInfo, rowPart, output); break;
|
||||||
case RowDataType::Disassembly: WriteDisassembly(disassemblyInfo, rowPart, (uint8_t)cpuState.SP, pcAddress, output); break;
|
case RowDataType::Disassembly: WriteDisassembly(disassemblyInfo, rowPart, (uint8_t)cpuState.SP, pcAddress, output); break;
|
||||||
case RowDataType::EffectiveAddress: WriteEffectiveAddress(disassemblyInfo, rowPart, &cpuState, output, memType); break;
|
case RowDataType::EffectiveAddress: WriteEffectiveAddress(disassemblyInfo, rowPart, &cpuState, output, memType, cpuType); break;
|
||||||
case RowDataType::MemoryValue: WriteMemoryValue(disassemblyInfo, rowPart, &cpuState, output, memType); break;
|
case RowDataType::MemoryValue: WriteMemoryValue(disassemblyInfo, rowPart, &cpuState, output, memType, cpuType); break;
|
||||||
case RowDataType::Align: WriteAlign(originalSize, rowPart, output); break;
|
case RowDataType::Align: WriteAlign(originalSize, rowPart, output); break;
|
||||||
|
|
||||||
case RowDataType::PC: WriteValue(output, HexUtilities::ToHex24(pcAddress), rowPart); break;
|
case RowDataType::PC: WriteValue(output, HexUtilities::ToHex24(pcAddress), rowPart); break;
|
||||||
|
@ -337,8 +337,8 @@ void TraceLogger::GetTraceRow(string &output, SpcState &cpuState, PpuState &ppuS
|
||||||
case RowDataType::Text: output += rowPart.Text; break;
|
case RowDataType::Text: output += rowPart.Text; break;
|
||||||
case RowDataType::ByteCode: WriteByteCode(disassemblyInfo, rowPart, output); break;
|
case RowDataType::ByteCode: WriteByteCode(disassemblyInfo, rowPart, output); break;
|
||||||
case RowDataType::Disassembly: WriteDisassembly(disassemblyInfo, rowPart, cpuState.SP, pcAddress, output); break;
|
case RowDataType::Disassembly: WriteDisassembly(disassemblyInfo, rowPart, cpuState.SP, pcAddress, output); break;
|
||||||
case RowDataType::EffectiveAddress: WriteEffectiveAddress(disassemblyInfo, rowPart, &cpuState, output, SnesMemoryType::SpcMemory); break;
|
case RowDataType::EffectiveAddress: WriteEffectiveAddress(disassemblyInfo, rowPart, &cpuState, output, SnesMemoryType::SpcMemory, CpuType::Spc); break;
|
||||||
case RowDataType::MemoryValue: WriteMemoryValue(disassemblyInfo, rowPart, &cpuState, output, SnesMemoryType::SpcMemory); break;
|
case RowDataType::MemoryValue: WriteMemoryValue(disassemblyInfo, rowPart, &cpuState, output, SnesMemoryType::SpcMemory, CpuType::Spc); break;
|
||||||
case RowDataType::Align: WriteAlign(originalSize, rowPart, output); break;
|
case RowDataType::Align: WriteAlign(originalSize, rowPart, output); break;
|
||||||
|
|
||||||
case RowDataType::PC: WriteValue(output, HexUtilities::ToHex((uint16_t)pcAddress), rowPart); break;
|
case RowDataType::PC: WriteValue(output, HexUtilities::ToHex((uint16_t)pcAddress), rowPart); break;
|
||||||
|
@ -489,10 +489,10 @@ bool TraceLogger::ConditionMatches(DebugState &state, DisassemblyInfo &disassemb
|
||||||
void TraceLogger::GetTraceRow(string &output, CpuType cpuType, DisassemblyInfo &disassemblyInfo, DebugState &state)
|
void TraceLogger::GetTraceRow(string &output, CpuType cpuType, DisassemblyInfo &disassemblyInfo, DebugState &state)
|
||||||
{
|
{
|
||||||
switch(cpuType) {
|
switch(cpuType) {
|
||||||
case CpuType::Cpu: GetTraceRow(output, state.Cpu, state.Ppu, disassemblyInfo, SnesMemoryType::CpuMemory); break;
|
case CpuType::Cpu: GetTraceRow(output, state.Cpu, state.Ppu, disassemblyInfo, SnesMemoryType::CpuMemory, cpuType); break;
|
||||||
case CpuType::Spc: GetTraceRow(output, state.Spc, state.Ppu, disassemblyInfo); break;
|
case CpuType::Spc: GetTraceRow(output, state.Spc, state.Ppu, disassemblyInfo); break;
|
||||||
case CpuType::NecDsp: GetTraceRow(output, state.NecDsp, state.Ppu, disassemblyInfo); break;
|
case CpuType::NecDsp: GetTraceRow(output, state.NecDsp, state.Ppu, disassemblyInfo); break;
|
||||||
case CpuType::Sa1: GetTraceRow(output, state.Sa1, state.Ppu, disassemblyInfo, SnesMemoryType::Sa1Memory); break;
|
case CpuType::Sa1: GetTraceRow(output, state.Sa1, state.Ppu, disassemblyInfo, SnesMemoryType::Sa1Memory, cpuType); break;
|
||||||
case CpuType::Gsu: GetTraceRow(output, state.Gsu, state.Ppu, disassemblyInfo); break;
|
case CpuType::Gsu: GetTraceRow(output, state.Gsu, state.Ppu, disassemblyInfo); break;
|
||||||
case CpuType::Cx4: GetTraceRow(output, state.Cx4, state.Ppu, disassemblyInfo); break;
|
case CpuType::Cx4: GetTraceRow(output, state.Cx4, state.Ppu, disassemblyInfo); break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,8 +111,8 @@ private:
|
||||||
|
|
||||||
void WriteByteCode(DisassemblyInfo &info, RowPart &rowPart, string &output);
|
void WriteByteCode(DisassemblyInfo &info, RowPart &rowPart, string &output);
|
||||||
void WriteDisassembly(DisassemblyInfo &info, RowPart &rowPart, uint8_t sp, uint32_t pc, string &output);
|
void WriteDisassembly(DisassemblyInfo &info, RowPart &rowPart, uint8_t sp, uint32_t pc, string &output);
|
||||||
void WriteEffectiveAddress(DisassemblyInfo &info, RowPart &rowPart, void *cpuState, string &output, SnesMemoryType cpuMemoryType);
|
void WriteEffectiveAddress(DisassemblyInfo &info, RowPart &rowPart, void *cpuState, string &output, SnesMemoryType cpuMemoryType, CpuType cpuType);
|
||||||
void WriteMemoryValue(DisassemblyInfo &info, RowPart &rowPart, void *cpuState, string &output, SnesMemoryType memType);
|
void WriteMemoryValue(DisassemblyInfo &info, RowPart &rowPart, void *cpuState, string &output, SnesMemoryType memType, CpuType cpuType);
|
||||||
void WriteAlign(int originalSize, RowPart &rowPart, string &output);
|
void WriteAlign(int originalSize, RowPart &rowPart, string &output);
|
||||||
void AddRow(CpuType cpuType, DisassemblyInfo &disassemblyInfo, DebugState &state);
|
void AddRow(CpuType cpuType, DisassemblyInfo &disassemblyInfo, DebugState &state);
|
||||||
//bool ConditionMatches(DebugState &state, DisassemblyInfo &disassemblyInfo, OperationInfo &operationInfo);
|
//bool ConditionMatches(DebugState &state, DisassemblyInfo &disassemblyInfo, OperationInfo &operationInfo);
|
||||||
|
@ -120,7 +120,7 @@ private:
|
||||||
void ParseFormatString(vector<RowPart> &rowParts, string format);
|
void ParseFormatString(vector<RowPart> &rowParts, string format);
|
||||||
|
|
||||||
void GetTraceRow(string &output, CpuType cpuType, DisassemblyInfo &disassemblyInfo, DebugState &state);
|
void GetTraceRow(string &output, CpuType cpuType, DisassemblyInfo &disassemblyInfo, DebugState &state);
|
||||||
void GetTraceRow(string &output, CpuState &cpuState, PpuState &ppuState, DisassemblyInfo &disassemblyInfo, SnesMemoryType memType);
|
void GetTraceRow(string &output, CpuState &cpuState, PpuState &ppuState, DisassemblyInfo &disassemblyInfo, SnesMemoryType memType, CpuType cpuType);
|
||||||
void GetTraceRow(string &output, SpcState &cpuState, PpuState &ppuState, DisassemblyInfo &disassemblyInfo);
|
void GetTraceRow(string &output, SpcState &cpuState, PpuState &ppuState, DisassemblyInfo &disassemblyInfo);
|
||||||
void GetTraceRow(string &output, NecDspState &cpuState, PpuState &ppuState, DisassemblyInfo &disassemblyInfo);
|
void GetTraceRow(string &output, NecDspState &cpuState, PpuState &ppuState, DisassemblyInfo &disassemblyInfo);
|
||||||
void GetTraceRow(string &output, GsuState &gsuState, PpuState &ppuState, DisassemblyInfo &disassemblyInfo);
|
void GetTraceRow(string &output, GsuState &gsuState, PpuState &ppuState, DisassemblyInfo &disassemblyInfo);
|
||||||
|
|
|
@ -458,12 +458,7 @@ namespace Mesen.GUI.Debugger.Controls
|
||||||
Type = _manager.RelativeMemoryType
|
Type = _manager.RelativeMemoryType
|
||||||
};
|
};
|
||||||
|
|
||||||
AddressInfo absAddress = DebugApi.GetAbsoluteAddress(relAddress);
|
DebugWindowManager.OpenMemoryViewer(relAddress);
|
||||||
if(absAddress.Address >= 0) {
|
|
||||||
DebugWindowManager.OpenMemoryViewer(absAddress);
|
|
||||||
} else {
|
|
||||||
DebugWindowManager.OpenMemoryViewer(relAddress);
|
|
||||||
}
|
|
||||||
} else if(location.Label != null) {
|
} else if(location.Label != null) {
|
||||||
DebugWindowManager.OpenMemoryViewer(location.Label.GetAbsoluteAddress());
|
DebugWindowManager.OpenMemoryViewer(location.Label.GetAbsoluteAddress());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue