From 7c4855e6313d084e4878947faf65c79f46d3d03a Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Wed, 5 Jan 2022 15:42:34 -0800 Subject: [PATCH] Debugger: Cleanup DISASM_DISPLAY_ enums --- source/Debugger/Debugger_Disassembler.cpp | 12 +++++------ source/Debugger/Debugger_Display.cpp | 4 ++-- source/Debugger/Debugger_Symbols.cpp | 2 +- source/Debugger/Debugger_Types.h | 25 +++++++++++------------ 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/source/Debugger/Debugger_Disassembler.cpp b/source/Debugger/Debugger_Disassembler.cpp index 52da8652..7f737212 100644 --- a/source/Debugger/Debugger_Disassembler.cpp +++ b/source/Debugger/Debugger_Disassembler.cpp @@ -205,7 +205,7 @@ int GetDisassemblyLine(WORD nBaseAddress, DisasmLine_t& line_) if ((iOpmode == AM_AY) || (iOpmode == AM_ZY) || (iOpmode == AM_NZY)) line_.bTargetY = true; // ,Y - unsigned int nMinBytesLen = (MAX_OPCODES * (2 + g_bConfigDisasmOpcodeSpaces)); // 2 char for byte (or 3 with space) + unsigned int nMinBytesLen = (DISASM_DISPLAY_MAX_OPCODES * (2 + g_bConfigDisasmOpcodeSpaces)); // 2 char for byte (or 3 with space) int bDisasmFormatFlags = 0; @@ -448,8 +448,8 @@ void FormatOpcodeBytes(WORD nBaseAddress, DisasmLine_t& line_) char* pDst = line_.sOpCodes; int nMaxOpBytes = nOpbyte; - if (nMaxOpBytes > MAX_OPCODES) // 2.8.0.0 fix // TODO: FIX: show max 8 bytes for HEX - nMaxOpBytes = MAX_OPCODES; + if (nMaxOpBytes > DISASM_DISPLAY_MAX_OPCODES) // 2.8.0.0 fix // TODO: FIX: show max 8 bytes for HEX + nMaxOpBytes = DISASM_DISPLAY_MAX_OPCODES; for (int iByte = 0; iByte < nMaxOpBytes; iByte++) { @@ -522,10 +522,10 @@ void FormatNopcodeBytes(WORD nBaseAddress, DisasmLine_t& line_) iByte = line_.nOpbyte; // handle all bytes of text pSrc = (const char*)mem + nStartAddress; - if (len > (MAX_IMMEDIATE_LEN - 2)) // does "text" fit? + if (len > (DISASM_DISPLAY_MAX_IMMEDIATE_LEN - 2)) // does "text" fit? { - if (len > MAX_IMMEDIATE_LEN) // no; need extra characters for ellipsis? - len = (MAX_IMMEDIATE_LEN - 3); // ellipsis = true + if (len > DISASM_DISPLAY_MAX_IMMEDIATE_LEN) // no; need extra characters for ellipsis? + len = (DISASM_DISPLAY_MAX_IMMEDIATE_LEN - 3); // ellipsis = true // DISPLAY: text_longer_18... FormatCharCopy(pDst, pSrc, len); // BUG: #251 v2.8.0.7: ASC #:# with null byte doesn't mark up properly diff --git a/source/Debugger/Debugger_Display.cpp b/source/Debugger/Debugger_Display.cpp index eee3d5c0..8d2a02a1 100644 --- a/source/Debugger/Debugger_Display.cpp +++ b/source/Debugger/Debugger_Display.cpp @@ -1638,13 +1638,13 @@ WORD DrawDisassemblyLine ( int iLine, const WORD nBaseAddress ) // SYM COPY.FAC.TO.ARG.ROUNDED = EB63 // If opcodes aren't showing then length can be longer! // FormatOpcodeBytes() uses 3 chars/MAX_OPCODES. i.e. "## " - int nMaxLen = MAX_TARGET_LEN; + int nMaxLen = DISASM_DISPLAY_MAX_TARGET_LEN; // 2.8.0.8: Bug #227: AppleSoft symbol: COPY.FAC.TO.ARG.ROUNDED overflows into registers if ( !g_bConfigDisasmAddressView ) nMaxLen += 4; if ( !g_bConfigDisasmOpcodesView ) - nMaxLen += (MAX_OPCODES*3); + nMaxLen += (DISASM_DISPLAY_MAX_OPCODES*3); // 2.9.0.9 Continuation of 2.8.0.8: Fix overflowing disassembly pane for long symbols int nOverflow = 0; diff --git a/source/Debugger/Debugger_Symbols.cpp b/source/Debugger/Debugger_Symbols.cpp index 5466f727..a5f53145 100644 --- a/source/Debugger/Debugger_Symbols.cpp +++ b/source/Debugger/Debugger_Symbols.cpp @@ -563,7 +563,7 @@ int ParseSymbolTable(const std::string & pPathFileName, SymbolTable_Index_e eSym char sText[ CONSOLE_WIDTH * 3 ]; bool bFileDisplayed = false; - const int nMaxLen = MIN(MAX_TARGET_LEN,MAX_SYMBOLS_LEN); + const int nMaxLen = MIN(DISASM_DISPLAY_MAX_TARGET_LEN, MAX_SYMBOLS_LEN); int nSymbolsLoaded = 0; diff --git a/source/Debugger/Debugger_Types.h b/source/Debugger/Debugger_Types.h index 90a2a60e..391e2ba4 100644 --- a/source/Debugger/Debugger_Types.h +++ b/source/Debugger/Debugger_Types.h @@ -929,13 +929,13 @@ , NUM_DISASM_TARGET_TYPES }; - enum DisasmDisplay_e // TODO: Prefix enums with DISASM_DISPLAY_ + enum DisasmDisplay_e { - MAX_ADDRESS_LEN = 40, - MAX_OPCODES = 3, // only display 3 opcode bytes -- See FormatOpcodeBytes() // TODO: FIX when showing data hex - CHARS_FOR_ADDRESS = 8, // 4 digits + end-of-string + padding - MAX_IMMEDIATE_LEN = 20, // Data Disassembly - MAX_TARGET_LEN = MAX_IMMEDIATE_LEN, // Debugger Display: pTarget = line.sTarget + DISASM_DISPLAY_MAX_ADDRESS_LEN = 40, + DISASM_DISPLAY_MAX_OPCODES = 3, // only display 3 opcode bytes -- See FormatOpcodeBytes() // TODO: FIX when showing data hex + DISASM_DISPLAY_CHARS_FOR_ADDRESS = 8, // 4 digits + end-of-string + padding + DISASM_DISPLAY_MAX_IMMEDIATE_LEN = 20, // Data Disassembly + DISASM_DISPLAY_MAX_TARGET_LEN = DISASM_DISPLAY_MAX_IMMEDIATE_LEN, // Debugger Display: pTarget = line.sTarget }; struct DisasmLine_t @@ -944,8 +944,8 @@ short iOpmode; int nOpbyte; - char sAddress [ CHARS_FOR_ADDRESS ]; - char sOpCodes [(MAX_OPCODES*3)+1]; + char sAddress [ DISASM_DISPLAY_CHARS_FOR_ADDRESS ]; + char sOpCodes [(DISASM_DISPLAY_MAX_OPCODES*3)+1]; // Added for Data Disassembler char sLabel [ MAX_SYMBOLS_LEN+1 ]; // label is a symbol @@ -959,14 +959,13 @@ const DisasmData_t* pDisasmData; // If != NULL then bytes are marked up as data // int nTarget; // address -> string - char sTarget [ MAX_ADDRESS_LEN ]; + char sTarget [ DISASM_DISPLAY_MAX_ADDRESS_LEN ]; - char sTargetOffset[ CHARS_FOR_ADDRESS ]; // +/- 255, realistically +/-1 + char sTargetOffset[ DISASM_DISPLAY_CHARS_FOR_ADDRESS ]; // +/- 255, realistically +/-1 int nTargetOffset; - char sTargetPointer[ CHARS_FOR_ADDRESS ]; - char sTargetValue [ CHARS_FOR_ADDRESS ]; -// char sTargetAddress[ CHARS_FOR_ADDRESS ]; + char sTargetPointer[ DISASM_DISPLAY_CHARS_FOR_ADDRESS ]; + char sTargetValue [ DISASM_DISPLAY_CHARS_FOR_ADDRESS ]; int iTargetTable; // Which symbol table this appears in if any. See: SYMBOLS_USER_2, DrawDisassemblyLine(), GetDisassemblyLine(), FindSymbolFromAddress()