Debugger: Cleanup DISASM_DISPLAY_ enums

This commit is contained in:
michaelangel007 2022-01-05 15:42:34 -08:00
parent ca1bea3b97
commit 7c4855e631
4 changed files with 21 additions and 22 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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()