Skip to content

Commit

Permalink
Debugger: add some more flags & switches.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
  • Loading branch information
audetto committed Jan 16, 2022
1 parent 586f094 commit 364cfcb
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 3 deletions.
59 changes: 57 additions & 2 deletions source/frontends/sdl/imgui/sdlsettings.cpp
Expand Up @@ -18,6 +18,8 @@
#include "Registry.h"
#include "Utilities.h"
#include "Memory.h"
#include "ParallelPrinter.h"
#include "SaveState.h"

#include "Debugger/Debugger_Types.h"

Expand Down Expand Up @@ -48,6 +50,18 @@ namespace
}
}

void printBoolean(const char * label, const bool value, const char * falseValue, const char * trueValue)
{
int elem = value;
const char * name = value ? trueValue : falseValue;
ImGui::SliderInt(label, &elem, 0, 1, name);
}

void printOnOff(const char * label, const bool value)
{
printBoolean(label, value, "OFF", "ON");
}

char getPrintableChar(const uint8_t x)
{
if (x >= 0x20 && x <= 0x7e)
Expand Down Expand Up @@ -233,6 +247,9 @@ namespace sa2
}
ImGui::LabelText("Clock", "%15.2f Hz", g_fCurrentCLK6502);

ImGui::Separator();
ImGui::LabelText("Printer", "%s", Printer_GetFilename().c_str());
ImGui::LabelText("Save state", "%s", Snapshot_GetPathname().c_str());
ImGui::Separator();

if (frame->HardwareChanged())
Expand Down Expand Up @@ -1013,6 +1030,40 @@ namespace sa2
}
}

void ImGuiSettings::drawAnnunciators()
{
ImGui::TextUnformatted("Annunciators");
ImGui::Separator();
ImGui::BeginDisabled();
for (UINT i = 0; i < 4; ++i)
{
char buffer[20];
sprintf(buffer, "Ann %d", i);
printOnOff(buffer, MemGetAnnunciator(i));
}
ImGui::EndDisabled();
}

void ImGuiSettings::drawSwitches()
{
Video & video = GetVideo();
ImGui::TextUnformatted("Switches C0xx");
ImGui::Separator();
ImGui::BeginDisabled();
printBoolean("50", video.VideoGetSWTEXT(), "GR", "TEXT");
printBoolean("52", video.VideoGetSWMIXED(), "FULL", "MIX");
printBoolean("54", video.VideoGetSWPAGE2(), "PAGE 1", "PAGE 2");
printBoolean("56", video.VideoGetSWHIRES(), "RES LO", "RES HI");
printBoolean("5E", !video.VideoGetSWDHIRES(), "DHGR", "HGR");
ImGui::Separator();
printBoolean("00", video.VideoGetSW80STORE(), "80sto 0", "80sto 1");
printBoolean("02", GetMemMode() & MF_AUXREAD, "R m", "R x");
printBoolean("02", GetMemMode() & MF_AUXWRITE, "W m", "R x");
printBoolean("0C", video.VideoGetSW80COL(), "Col 40", "Col 80");
printBoolean("0E", video.VideoGetSWAltCharSet(), "ASC", "MOUS");
ImGui::EndDisabled();
}

void ImGuiSettings::drawConsole()
{
const ImGuiTableFlags flags = ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_ScrollY;
Expand Down Expand Up @@ -1134,16 +1185,20 @@ namespace sa2
}

// this is about right to contain the fixed-size register child
const ImVec2 registerTextSize = ImGui::CalcTextSize("012345678901");
const ImVec2 registerTextSize = ImGui::CalcTextSize("Annunciators012345");

ImGui::BeginChild("Disasm", ImVec2(-registerTextSize.x, 0));
drawDisassemblyTable(frame);
ImGui::EndChild();

ImGui::SameLine();

ImGui::BeginChild("Registers");
ImGui::BeginChild("Flags");
drawRegisters();
ImGui::Dummy(ImVec2(0.0f, 20.0f));
drawAnnunciators();
ImGui::Dummy(ImVec2(0.0f, 20.0f));
drawSwitches();
ImGui::EndChild();

ImGui::EndTabItem();
Expand Down
4 changes: 3 additions & 1 deletion source/frontends/sdl/imgui/sdlsettings.h
Expand Up @@ -48,8 +48,10 @@ namespace sa2
void showAboutWindow();

void drawDisassemblyTable(SDLFrame * frame);
void drawRegisters();
void drawConsole();
void drawRegisters();
void drawAnnunciators();
void drawSwitches();

void debuggerCommand(SDLFrame * frame, const char * s);
};
Expand Down

0 comments on commit 364cfcb

Please sign in to comment.