Add cycle information to the Disassembly output.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2021-05-26 17:48:44 +01:00
parent 5c96069a3f
commit d8ebc8dc9f
5 changed files with 32 additions and 2 deletions

View file

@ -190,4 +190,10 @@ namespace sa2
SDLFrame::ProcessSingleEvent(event, quit);
}
void SDLImGuiFrame::ResetSpeed()
{
SDLFrame::ResetSpeed();
mySettings.resetDebuggerCycles();
}
}

View file

@ -22,6 +22,8 @@ namespace sa2
void UpdateTexture() override;
void RenderPresent() override;
void ResetSpeed() override;
protected:
void ProcessSingleEvent(const SDL_Event & event, bool & quit) override;

View file

@ -755,7 +755,7 @@ namespace sa2
void ImGuiSettings::drawDisassemblyTable(SDLFrame * frame)
{
const ImGuiTableFlags flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_ScrollY;
if (ImGui::BeginTable("Disassembly", 9, flags))
if (ImGui::BeginTable("Disassembly", 10, flags))
{
ImGui::PushStyleCompact();
// weigths proportional to column width (including header)
@ -769,6 +769,7 @@ namespace sa2
ImGui::TableSetupColumn("Value", 0, 6);
ImGui::TableSetupColumn("Immediate", 0, 9);
ImGui::TableSetupColumn("Branch", 0, 6);
ImGui::TableSetupColumn("Cycles", 0, 6);
ImGui::TableHeadersRow();
ImGuiListClipper clipper;
@ -882,6 +883,15 @@ namespace sa2
ImGui::TextUnformatted(line.sBranch);
}
ImGui::TableNextColumn();
if (g_nAppMode == MODE_DEBUG)
{
if (myAddressCycles.find(nAddress) != myAddressCycles.end())
{
ImGui::Text("%d", myAddressCycles[nAddress]);
}
}
nAddress += line.nOpbyte;
ImGui::PopID();
}
@ -949,8 +959,16 @@ namespace sa2
}
}
void ImGuiSettings::resetDebuggerCycles()
{
myAddressCycles.clear();
myBaseDebuggerCycles = g_nCumulativeCycles;
}
void ImGuiSettings::showDebugger(SDLFrame * frame)
{
myAddressCycles[regs.pc] = g_nCumulativeCycles - myBaseDebuggerCycles;
if (ImGui::Begin("Debugger", &myShowDebugger))
{
ImGui::BeginChild("Console", ImVec2(0, -ImGui::GetFrameHeightWithSpacing()));

View file

@ -15,6 +15,7 @@ namespace sa2
public:
void show(SDLFrame* frame);
float drawMenuBar(SDLFrame* frame);
void resetDebuggerCycles();
bool windowed = false;
@ -32,6 +33,9 @@ namespace sa2
int mySpeakerVolume;
int myMockingboardVolume;
uint64_t myBaseDebuggerCycles;
std::unordered_map<DWORD, uint64_t> myAddressCycles;
MemoryEditor myMainMemoryEditor;
MemoryEditor myAuxMemoryEditor;

View file

@ -30,7 +30,7 @@ namespace sa2
void Execute(const DWORD uCycles);
void ExecuteOneFrame(const size_t msNextFrame);
void ChangeMode(const AppMode_e mode);
void ResetSpeed();
virtual void ResetSpeed();
virtual void UpdateTexture() = 0;
virtual void RenderPresent() = 0;