Add support for symbols.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2021-03-13 20:56:19 +00:00
parent dd6455ceb9
commit d99d35013d
3 changed files with 65 additions and 15 deletions

View file

@ -188,5 +188,10 @@ target_compile_options(appleii PUBLIC
-Wno-multichar
)
add_custom_command(
TARGET appleii POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/bin/*.SYM ${CMAKE_BINARY_DIR}
)
install(TARGETS appleii
DESTINATION lib)

View file

@ -234,11 +234,12 @@ namespace sa2
if (ImGui::BeginChild("CPU"))
{
const ImGuiTableFlags flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersOuter;
if (ImGui::BeginTable("CPU", 7, flags))
if (ImGui::BeginTable("CPU", 8, flags))
{
// weigths proportional to column width (including header)
ImGui::TableSetupColumn("Disassembly", 0, 30);
ImGui::TableSetupColumn("Target", 0, 6);
ImGui::TableSetupColumn("Symbol", 0, 20);
ImGui::TableSetupColumn("Target", 0, 20);
ImGui::TableSetupColumn("Offset", 0, 6);
ImGui::TableSetupColumn("Pointer", 0, 7);
ImGui::TableSetupColumn("Value", 0, 5);
@ -261,7 +262,6 @@ namespace sa2
IM_ASSERT(row == clipper.DisplayStart && "Clipper position mismatch");
for (; row < clipper.DisplayEnd; ++row)
{
ImGui::TableNextRow();
DisasmLine_t line;
const char* pSymbol = FindSymbolFromAddress(nAddress);
const int bDisasmFormatFlags = GetDisassemblyLine(nAddress, line);
@ -278,19 +278,31 @@ namespace sa2
ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, currentBgColor);
}
ImGui::TableSetColumnIndex(0);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Selectable(buffer, false, ImGuiSelectableFlags_SpanAllColumns);
ImGui::TableSetColumnIndex(1);
ImGui::TableNextColumn();
if (pSymbol)
{
ImGui::TextUnformatted(pSymbol);
}
ImGui::TableNextColumn();
ImGui::TextUnformatted(line.sTarget);
ImGui::TableSetColumnIndex(2);
ImGui::TableNextColumn();
ImGui::TextUnformatted(line.sTargetOffset);
ImGui::TableSetColumnIndex(3);
ImGui::TableNextColumn();
ImGui::TextUnformatted(line.sTargetPointer);
ImGui::TableSetColumnIndex(4);
ImGui::TableNextColumn();
ImGui::TextUnformatted(line.sTargetValue);
ImGui::TableSetColumnIndex(5);
ImGui::TableNextColumn();
ImGui::TextUnformatted(line.sImmediate);
ImGui::TableSetColumnIndex(6);
ImGui::TableNextColumn();
ImGui::TextUnformatted(line.sBranch);
}
}

View file

@ -7,11 +7,8 @@
#include "Core.h"
#include "Interface.h"
void InitDisasm()
{
g_nDisasmCurAddress = regs.pc;
DisasmCalcTopBotAddress();
}
const int MIN_DISPLAY_CONSOLE_LINES = 5; // doesn't include ConsoleInput
int g_iWindowThis = WINDOW_CODE; // TODO: FIXME! should be offset into WindowConfig!!!
void WindowUpdateDisasmSize()
{
@ -19,9 +16,45 @@ void WindowUpdateDisasmSize()
g_nDisasmCurLine = MAX(0, (g_nDisasmWinHeight - 1) / 2);
}
void WindowUpdateConsoleDisplayedSize()
{
g_nConsoleDisplayLines = MIN_DISPLAY_CONSOLE_LINES;
#if USE_APPLE_FONT
g_bConsoleFullWidth = true;
g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1;
if (g_iWindowThis == WINDOW_CONSOLE)
{
g_nConsoleDisplayLines = MAX_DISPLAY_LINES;
g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1;
g_bConsoleFullWidth = true;
}
#else
g_nConsoleDisplayWidth = (CONSOLE_WIDTH / 2) + 10;
g_bConsoleFullWidth = false;
// g_bConsoleFullWidth = false;
// g_nConsoleDisplayWidth = CONSOLE_WIDTH - 10;
if (g_iWindowThis == WINDOW_CONSOLE)
{
g_nConsoleDisplayLines = MAX_DISPLAY_LINES;
g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1;
g_bConsoleFullWidth = true;
}
#endif
}
void InitDisasm()
{
g_nDisasmCurAddress = regs.pc;
DisasmCalcTopBotAddress();
}
void DebugInitialize()
{
WindowUpdateDisasmSize();
WindowUpdateConsoleDisplayedSize();
extern bool g_bSymbolsDisplayMissingFile;
g_bSymbolsDisplayMissingFile = false;