mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-06-06 18:29:30 +00:00
Debugger: Cleanup FormatNopcodeBytes()
This commit is contained in:
parent
7c4855e631
commit
32ee96fb8b
|
@ -473,85 +473,89 @@ void FormatNopcodeBytes(WORD nBaseAddress, DisasmLine_t& line_)
|
|||
char* pDst = line_.sTarget;
|
||||
const char* pSrc = 0;
|
||||
DWORD nStartAddress = line_.pDisasmData->nStartAddress;
|
||||
DWORD nEndAddress = line_.pDisasmData->nEndAddress;
|
||||
DWORD nEndAddress = line_.pDisasmData->nEndAddress;
|
||||
// int nDataLen = nEndAddress - nStartAddress + 1 ;
|
||||
int nDisplayLen = nEndAddress - nBaseAddress + 1; // *inclusive* KEEP IN SYNC: _CmdDefineByteRange() CmdDisasmDataList() _6502_GetOpmodeOpbyte() FormatNopcodeBytes()
|
||||
int len = nDisplayLen;
|
||||
|
||||
for (int iByte = 0; iByte < line_.nOpbyte; )
|
||||
{
|
||||
BYTE nTarget8 = *(LPBYTE)(mem + nBaseAddress + iByte);
|
||||
BYTE nTarget8 = *(LPBYTE)(mem + nBaseAddress + iByte);
|
||||
WORD nTarget16 = *(LPWORD)(mem + nBaseAddress + iByte);
|
||||
|
||||
switch (line_.iNoptype)
|
||||
{
|
||||
case NOP_BYTE_1:
|
||||
case NOP_BYTE_2:
|
||||
case NOP_BYTE_4:
|
||||
case NOP_BYTE_8:
|
||||
sprintf(pDst, "%02X", nTarget8); // sBytes+strlen(sBytes)
|
||||
pDst += 2;
|
||||
iByte++;
|
||||
if (line_.iNoptype == NOP_BYTE_1)
|
||||
case NOP_BYTE_1:
|
||||
case NOP_BYTE_2:
|
||||
case NOP_BYTE_4:
|
||||
case NOP_BYTE_8:
|
||||
sprintf(pDst, "%02X", nTarget8); // sBytes+strlen(sBytes)
|
||||
pDst += 2;
|
||||
iByte++;
|
||||
if (line_.iNoptype == NOP_BYTE_1)
|
||||
if (iByte < line_.nOpbyte)
|
||||
{
|
||||
*pDst++ = ',';
|
||||
}
|
||||
break;
|
||||
|
||||
case NOP_WORD_1:
|
||||
case NOP_WORD_2:
|
||||
case NOP_WORD_4:
|
||||
sprintf(pDst, "%04X", nTarget16); // sBytes+strlen(sBytes)
|
||||
pDst += 4;
|
||||
iByte += 2;
|
||||
if (iByte < line_.nOpbyte)
|
||||
{
|
||||
*pDst++ = ',';
|
||||
}
|
||||
break;
|
||||
case NOP_WORD_1:
|
||||
case NOP_WORD_2:
|
||||
case NOP_WORD_4:
|
||||
sprintf(pDst, "%04X", nTarget16); // sBytes+strlen(sBytes)
|
||||
pDst += 4;
|
||||
iByte += 2;
|
||||
if (iByte < line_.nOpbyte)
|
||||
{
|
||||
*pDst++ = ',';
|
||||
}
|
||||
break;
|
||||
case NOP_ADDRESS:
|
||||
// Nothing to do, already handled :-)
|
||||
iByte += 2;
|
||||
break;
|
||||
case NOP_STRING_APPLESOFT:
|
||||
iByte = line_.nOpbyte;
|
||||
strncpy(pDst, (const char*)(mem + nBaseAddress), iByte);
|
||||
pDst += iByte;
|
||||
*pDst = 0;
|
||||
case NOP_STRING_APPLE:
|
||||
iByte = line_.nOpbyte; // handle all bytes of text
|
||||
pSrc = (const char*)mem + nStartAddress;
|
||||
break;
|
||||
|
||||
if (len > (DISASM_DISPLAY_MAX_IMMEDIATE_LEN - 2)) // does "text" fit?
|
||||
{
|
||||
if (len > DISASM_DISPLAY_MAX_IMMEDIATE_LEN) // no; need extra characters for ellipsis?
|
||||
len = (DISASM_DISPLAY_MAX_IMMEDIATE_LEN - 3); // ellipsis = true
|
||||
case NOP_ADDRESS:
|
||||
// Nothing to do, already handled :-)
|
||||
iByte += 2;
|
||||
break;
|
||||
|
||||
// DISPLAY: text_longer_18...
|
||||
FormatCharCopy(pDst, pSrc, len); // BUG: #251 v2.8.0.7: ASC #:# with null byte doesn't mark up properly
|
||||
case NOP_STRING_APPLESOFT:
|
||||
iByte = line_.nOpbyte;
|
||||
strncpy(pDst, (const char*)(mem + nBaseAddress), iByte);
|
||||
pDst += iByte;
|
||||
*pDst = 0;
|
||||
case NOP_STRING_APPLE:
|
||||
iByte = line_.nOpbyte; // handle all bytes of text
|
||||
pSrc = (const char*)mem + nStartAddress;
|
||||
|
||||
if (nDisplayLen > len) // ellipsis
|
||||
if (len > (DISASM_DISPLAY_MAX_IMMEDIATE_LEN - 2)) // does "text" fit?
|
||||
{
|
||||
*pDst++ = '.';
|
||||
*pDst++ = '.';
|
||||
*pDst++ = '.';
|
||||
}
|
||||
}
|
||||
else { // DISPLAY: "max_18_char"
|
||||
*pDst++ = '"';
|
||||
pDst = FormatCharCopy(pDst, pSrc, len); // BUG: #251 v2.8.0.7: ASC #:# with null byte doesn't mark up properly
|
||||
*pDst++ = '"';
|
||||
}
|
||||
if (len > DISASM_DISPLAY_MAX_IMMEDIATE_LEN) // no; need extra characters for ellipsis?
|
||||
len = (DISASM_DISPLAY_MAX_IMMEDIATE_LEN - 3); // ellipsis = true
|
||||
|
||||
*pDst = 0;
|
||||
break;
|
||||
default:
|
||||
#if _DEBUG // Unhandled data disassembly!
|
||||
int* FATAL = 0;
|
||||
*FATAL = 0xDEADC0DE;
|
||||
#endif
|
||||
iByte++;
|
||||
break;
|
||||
// DISPLAY: text_longer_18...
|
||||
FormatCharCopy(pDst, pSrc, len); // BUG: #251 v2.8.0.7: ASC #:# with null byte doesn't mark up properly
|
||||
|
||||
if (nDisplayLen > len) // ellipsis
|
||||
{
|
||||
*pDst++ = '.';
|
||||
*pDst++ = '.';
|
||||
*pDst++ = '.';
|
||||
}
|
||||
}
|
||||
else { // DISPLAY: "max_18_char"
|
||||
*pDst++ = '"';
|
||||
pDst = FormatCharCopy(pDst, pSrc, len); // BUG: #251 v2.8.0.7: ASC #:# with null byte doesn't mark up properly
|
||||
*pDst++ = '"';
|
||||
}
|
||||
|
||||
*pDst = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
#if _DEBUG // Unhandled data disassembly!
|
||||
int* FATAL = 0;
|
||||
*FATAL = 0xDEADC0DE;
|
||||
#endif
|
||||
iByte++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user