diff --git a/source/Debug.cpp b/source/Debug.cpp index 54bb9809..9cce4a44 100644 --- a/source/Debug.cpp +++ b/source/Debug.cpp @@ -43,7 +43,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // TODO: COLOR LOAD ["filename"] // See Debugger_Changelong.txt for full details - const int DEBUGGER_VERSION = MAKE_VERSION(2,5,0,16); + const int DEBUGGER_VERSION = MAKE_VERSION(2,5,0,23); // Public _________________________________________________________________________________________ @@ -234,10 +234,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {TEXT("E") , CmdMemoryEnterByte , CMD_MEMORY_ENTER_BYTE }, {TEXT("EW") , CmdMemoryEnterWord , CMD_MEMORY_ENTER_WORD }, {TEXT("M") , CmdMemoryMove , CMD_MEMORY_MOVE }, - {TEXT("S") , CmdMemorySearch , CMD_MEMORY_SEARCH }, - {TEXT("SA") , CmdMemorySearchText , CMD_MEMORY_SEARCH_ASCII }, // Search Ascii - {TEXT("SAL") , CmdMemorySearchLowBit, CMD_MEMORY_SEARCH_TXT_LO }, // Search Ascii Low - {TEXT("SAH") , CmdMemorySearchHiBit , CMD_MEMORY_SEARCH_TXT_HI }, // Search "Ascii" High + {TEXT("S") , CmdMemorySearch , CMD_MEMORY_SEARCH , "Search for text for hex values" }, + {TEXT("SA") , CmdMemorySearchAscii, CMD_MEMORY_SEARCH_ASCII , "Search ASCII text" }, // Search ASCII + {TEXT("ST") , CmdMemorySearchApple , CMD_MEMORY_SEARCH_APPLE , "Search Apple text (hi-bit)" }, // Search Apple Text {TEXT("SH") , CmdMemorySearchHex , CMD_MEMORY_SEARCH_HEX }, // Search Hex {TEXT("F") , CmdMemoryFill , CMD_MEMORY_FILL }, // Registers @@ -539,6 +538,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA MemoryDump_t g_aMemDump[ NUM_MEM_DUMPS ]; + // Made global so operator @# can be used with other commands. + MemorySearchResults_t g_vMemorySearchResults; + // Parameters _____________________________________________________________________________________ @@ -934,7 +936,7 @@ bool CheckBreakpointsIO () int iTarget; int nAddress; - Get6502Targets( &aTarget[0], &aTarget[1], &nBytes ); + Get6502Targets( regs.pc, &aTarget[0], &aTarget[1], &nBytes ); if (nBytes) { @@ -1896,7 +1898,7 @@ Update_t CmdConfigEcho (int nArgs) { TCHAR sText[ CONSOLE_WIDTH ] = TEXT(""); - if (g_aArgs[1].bType & TYPE_QUOTED) + if (g_aArgs[1].bType & TYPE_QUOTED_2) { ConsoleDisplayPush( g_aArgs[1].sArg ); } @@ -1986,7 +1988,7 @@ Update_t CmdConfigRun (int nArgs) TCHAR sFileName[ MAX_PATH ]; TCHAR sMiniFileName[ CONSOLE_WIDTH ]; -// if (g_aArgs[1].bType & TYPE_QUOTED) +// if (g_aArgs[1].bType & TYPE_QUOTED_2) strcpy( sMiniFileName, pFileName ); // strcat( sMiniFileName, ".aws" ); // HACK: MAGIC STRING @@ -2346,7 +2348,7 @@ Update_t CmdConfigSetFont (int nArgs) case PARAM_INFO : iFontTarget = FONT_INFO ; iFontPitch = FIXED_PITCH | FF_MODERN ; bHaveTarget = true; break; case PARAM_CONSOLE: iFontTarget = FONT_CONSOLE ; iFontPitch = DEFAULT_PITCH | FF_DECORATIVE; bHaveTarget = true; break; default: - if (g_aArgs[2].bType != TOKEN_QUOTED) + if (g_aArgs[2].bType != TOKEN_QUOTE_DOUBLE) return Help_Arg_1( CMD_CONFIG_FONT ); break; } @@ -3261,133 +3263,30 @@ Update_t CmdMemoryMove (int nArgs) return UPDATE_CONSOLE_DISPLAY; } -//=========================================================================== -Update_t CmdMemorySearch (int nArgs) -{ - if (nArgs < 2) - return Help_Arg_1( CMD_MEMORY_SEARCH ); - - if (g_aArgs[2].sArg[0] == TEXT('\"')) - CmdMemorySearchText( nArgs ); - else - CmdMemorySearchHex( nArgs ); - - return UPDATE_CONSOLE_DISPLAY; -} - -// Search for Ascii Hi-Bit set -//=========================================================================== -Update_t CmdMemorySearchHiBit (int nArgs) -{ - return UPDATE_CONSOLE_DISPLAY; -} - -//=========================================================================== -Update_t CmdMemorySearchLowBit (int nArgs) -{ - return UPDATE_CONSOLE_DISPLAY; -} //=========================================================================== bool _GetStartEnd( WORD & nAddressStart_, WORD & nAddressEnd_ ) { nAddressStart_ = g_aArgs[1].nVal1; - nAddressEnd_ = nAddressStart_ + g_aArgs[1].nVal2; + int nEnd = nAddressStart_ + g_aArgs[1].nVal2; + + // .17 Bug Fix: D000,FFFF -> D000,CFFF (nothing searched!) + if (nEnd > _6502_END_MEM_ADDRESS) + nEnd = _6502_END_MEM_ADDRESS; + + nAddressEnd_ = nEnd; return true; } + //=========================================================================== -Update_t CmdMemorySearchHex (int nArgs) +int _SearchMemoryFind( + MemorySearchValues_t vMemorySearchValues, + WORD nAddressStart, + WORD nAddressEnd ) { - if (nArgs < 2) - return HelpLastCommand(); - - WORD nAddressStart; - WORD nAddressEnd; - _GetStartEnd( nAddressStart, nAddressEnd ); - - // S start,len # - int nMinLen = nArgs - 2; - - bool bHaveWildCards = false; - int iArg; - - vector vMemorySearch; - MemorySearch_e tLastType = MEM_SEARCH_BYTE_N_WILD; - - vector vMatches; - - // Get search "string" - Arg_t *pArg = & g_aArgs[ 2 ]; - - WORD nTarget; - for (iArg = 2; iArg <= nArgs; iArg++, pArg++ ) - { - MemorySearch_t ms; - - nTarget = pArg->nVal1; - ms.m_nValue = nTarget & 0xFF; - ms.m_iType = MEM_SEARCH_BYTE_EXACT; - - if (nTarget > 0xFF) // searching for 16-bit address - { - vMemorySearch.push_back( ms ); - ms.m_nValue = (nTarget >> 8); - - tLastType = ms.m_iType; - } - else - { - TCHAR *pByte = pArg->sArg; - - if (pArg->nArgLen > 2) - goto _Help; - - if (pArg->nArgLen == 1) - { - if (pByte[0] == g_aParameters[ PARAM_MEM_SEARCH_WILD ].m_sName[0]) - { - ms.m_iType = MEM_SEARCH_BYTE_1_WILD; - } - } - else - { - if (pByte[0] == g_aParameters[ PARAM_MEM_SEARCH_WILD ].m_sName[0]) - { - ms.m_iType = MEM_SEARCH_NIB_LOW_EXACT; - ms.m_nValue = pArg->nVal1 & 0x0F; - } - - if (pByte[1] == g_aParameters[ PARAM_MEM_SEARCH_WILD ].m_sName[0]) - { - if (ms.m_iType == MEM_SEARCH_NIB_LOW_EXACT) - { - ms.m_iType = MEM_SEARCH_BYTE_N_WILD; - } - else - { - ms.m_iType = MEM_SEARCH_NIB_HIGH_EXACT; - ms.m_nValue = (pArg->nVal1 << 4) & 0xF0; - } - } - } - } - - // skip over multiple byte_wild, since they are redundent - // xx ?? ?? xx - // ^ - // redundant - if ((tLastType == MEM_SEARCH_BYTE_N_WILD) && (ms.m_iType == MEM_SEARCH_BYTE_N_WILD)) - continue; - - vMemorySearch.push_back( ms ); - tLastType = ms.m_iType; - } - - TCHAR sMatches[ CONSOLE_WIDTH ] = TEXT(""); - int nMatches = 0; // string length, for word-wrap - int nFound = 0; + g_vMemorySearchResults.erase( g_vMemorySearchResults.begin(), g_vMemorySearchResults.end() ); WORD nAddress; for( nAddress = nAddressStart; nAddress < nAddressEnd; nAddress++ ) @@ -3396,10 +3295,10 @@ Update_t CmdMemorySearchHex (int nArgs) WORD nAddress2 = nAddress; - int nMemBlocks = vMemorySearch.size(); + int nMemBlocks = vMemorySearchValues.size(); for (int iBlock = 0; iBlock < nMemBlocks; iBlock++, nAddress2++ ) { - MemorySearch_t ms = vMemorySearch.at( iBlock ); + MemorySearch_t ms = vMemorySearchValues.at( iBlock ); ms.m_bFound = false; if ((ms.m_iType == MEM_SEARCH_BYTE_EXACT ) || @@ -3437,7 +3336,7 @@ Update_t CmdMemorySearchHex (int nArgs) if ((iBlock + 1) == nMemBlocks) // there is no next block, hence we match continue; - MemorySearch_t ms2 = vMemorySearch.at( iBlock + 1 ); + MemorySearch_t ms2 = vMemorySearchValues.at( iBlock + 1 ); WORD nAddress3 = nAddress2; for (nAddress3 = nAddress2; nAddress3 < nAddressEnd; nAddress3++ ) @@ -3474,51 +3373,244 @@ Update_t CmdMemorySearchHex (int nArgs) { nFound++; - TCHAR sText[ CONSOLE_WIDTH ]; - wsprintf( sText, "%2d:$%04X ", nFound, nAddress ); + // Save the search result + g_vMemorySearchResults.push_back( nAddress ); + } + } + + return nFound; +} + + +//=========================================================================== +Update_t _SearchMemoryDisplay() +{ + int nFound = g_vMemorySearchResults.size(); + + TCHAR sMatches[ CONSOLE_WIDTH ] = TEXT(""); + int nThisLineLen = 0; // string length of matches for this line, for word-wrap + + if (nFound) + { + TCHAR sText[ CONSOLE_WIDTH ]; + + int iFound = 0; + while (iFound < nFound) + { + WORD nAddress = g_vMemorySearchResults.at( iFound ); + + wsprintf( sText, "%2d:$%04X ", iFound, nAddress ); int nLen = _tcslen( sText ); // Fit on same line? - if ((nMatches + nLen) > (g_nConsoleDisplayWidth)) // CONSOLE_WIDTH + if ((nThisLineLen + nLen) > (g_nConsoleDisplayWidth)) // CONSOLE_WIDTH { ConsoleDisplayPush( sMatches ); _tcscpy( sMatches, sText ); - nMatches = nLen; + nThisLineLen = nLen; } else { _tcscat( sMatches, sText ); - nMatches += nLen; + nThisLineLen += nLen; } + + iFound++; } + ConsoleDisplayPush( sMatches ); } - ConsoleDisplayPush( sMatches ); wsprintf( sMatches, "Total: %d (#$%04X)", nFound, nFound ); ConsoleDisplayPush( sMatches ); - vMemorySearch.erase( vMemorySearch.begin(), vMemorySearch.end() ); + // g_vMemorySearchResults is cleared in DebugEnd() + return UPDATE_CONSOLE_DISPLAY; +} -_Help: - vMemorySearch.erase( vMemorySearch.begin(), vMemorySearch.end() ); - return HelpLastCommand(); +//=========================================================================== +Update_t _CmdMemorySearch (int nArgs, bool bTextIsAscii = true ) +{ + WORD nAddressStart; + WORD nAddressEnd; + _GetStartEnd( nAddressStart, nAddressEnd ); + + // S start,len # + int nMinLen = nArgs - 2; + + bool bHaveWildCards = false; + int iArg; + + MemorySearchValues_t vMemorySearchValues; + MemorySearch_e tLastType = MEM_SEARCH_BYTE_N_WILD; + + // Get search "string" + Arg_t *pArg = & g_aArgs[ 2 ]; + + WORD nTarget; + for (iArg = 2; iArg <= nArgs; iArg++, pArg++ ) + { + MemorySearch_t ms; + + nTarget = pArg->nVal1; + ms.m_nValue = nTarget & 0xFF; + ms.m_iType = MEM_SEARCH_BYTE_EXACT; + + if (nTarget > 0xFF) // searching for 16-bit address + { + vMemorySearchValues.push_back( ms ); + ms.m_nValue = (nTarget >> 8); + + tLastType = ms.m_iType; + } + else + { + TCHAR *pByte = pArg->sArg; + + + if (pArg->bType & TYPE_QUOTED_1) + { + ms.m_iType = MEM_SEARCH_BYTE_EXACT; + ms.m_bFound = false; + ms.m_nValue = pArg->sArg[ 0 ]; + + if (! bTextIsAscii) // NOTE: Single quote chars is opposite hi-bit !!! + ms.m_nValue &= 0x7F; + else + ms.m_nValue |= 0x80; + } + else + if (pArg->bType & TYPE_QUOTED_2) + { + // Convert string to hex byte(s) + int iChar = 0; + int nChars = pArg->nArgLen; + + if (nChars) + { + ms.m_iType = MEM_SEARCH_BYTE_EXACT; + ms.m_bFound = false; + + nChars--; // last char is handle in common case below + while (iChar < nChars) + { + ms.m_nValue = pArg->sArg[ iChar ]; + + // Ascii (Low-Bit) + // Apple (High-Bit) + if (bTextIsAscii) + ms.m_nValue &= 0x7F; + else + ms.m_nValue |= 0x80; + + vMemorySearchValues.push_back( ms ); + iChar++; + } + + ms.m_nValue = pArg->sArg[ iChar ]; + } + } + else + { + // must be numeric .. make sure not too big + if (pArg->nArgLen > 2) + { + vMemorySearchValues.erase( vMemorySearchValues.begin(), vMemorySearchValues.end() ); + return HelpLastCommand(); + } + + if (pArg->nArgLen == 1) + { + if (pByte[0] == g_aParameters[ PARAM_MEM_SEARCH_WILD ].m_sName[0]) // Hack: hard-coded one char token + { + ms.m_iType = MEM_SEARCH_BYTE_1_WILD; + } + } + else + { + if (pByte[0] == g_aParameters[ PARAM_MEM_SEARCH_WILD ].m_sName[0]) // Hack: hard-coded one char token + { + ms.m_iType = MEM_SEARCH_NIB_LOW_EXACT; + ms.m_nValue = pArg->nVal1 & 0x0F; + } + + if (pByte[1] == g_aParameters[ PARAM_MEM_SEARCH_WILD ].m_sName[0]) // Hack: hard-coded one char token + { + if (ms.m_iType == MEM_SEARCH_NIB_LOW_EXACT) + { + ms.m_iType = MEM_SEARCH_BYTE_N_WILD; + } + else + { + ms.m_iType = MEM_SEARCH_NIB_HIGH_EXACT; + ms.m_nValue = (pArg->nVal1 << 4) & 0xF0; + } + } + } + } + } + + // skip over multiple byte_wild, since they are redundent + // xx ?? ?? xx + // ^ + // redundant + if ((tLastType == MEM_SEARCH_BYTE_N_WILD) && (ms.m_iType == MEM_SEARCH_BYTE_N_WILD)) + continue; + + vMemorySearchValues.push_back( ms ); + tLastType = ms.m_iType; + } + + _SearchMemoryFind( vMemorySearchValues, nAddressStart, nAddressEnd ); + vMemorySearchValues.erase( vMemorySearchValues.begin(), vMemorySearchValues.end() ); + + return _SearchMemoryDisplay(); +} + + +//=========================================================================== +Update_t CmdMemorySearch (int nArgs) +{ + if (nArgs < 2) + return HelpLastCommand(); + + return _CmdMemorySearch( nArgs, true ); + + return UPDATE_CONSOLE_DISPLAY; +} + + +// Search for ASCII text (no Hi-Bit set) +//=========================================================================== +Update_t CmdMemorySearchAscii (int nArgs) +{ + if (nArgs < 2) + return HelpLastCommand(); + + return _CmdMemorySearch( nArgs, true ); +} + +// Search for Apple text (Hi-Bit set) +//=========================================================================== +Update_t CmdMemorySearchApple (int nArgs) +{ + if (nArgs < 2) + return HelpLastCommand(); + + return _CmdMemorySearch( nArgs, false ); } //=========================================================================== -Update_t CmdMemorySearchText (int nArgs) +Update_t CmdMemorySearchHex (int nArgs) { - WORD nAddrStart; - WORD nAddrEnd; - _GetStartEnd( nAddrStart, nAddrEnd ); + if (nArgs < 2) + return HelpLastCommand(); - return UPDATE_CONSOLE_DISPLAY; + return _CmdMemorySearch( nArgs, true ); } - - // Registers ______________________________________________________________________________________ @@ -5773,28 +5865,28 @@ Update_t ExecuteCommand (int nArgs) // ________________________________________________________________________________________________ //=========================================================================== -bool Get6502Targets (int *pTemp_, int *pFinal_, int * pBytes_) +bool Get6502Targets ( WORD nAddress, int *pTargetPartial_, int *pTargetPointer_, int * pBytes_) { bool bStatus = false; - if (! pTemp_) + if (! pTargetPartial_) return bStatus; - if (! pFinal_) + if (! pTargetPointer_) return bStatus; // if (! pBytes_) // return bStatus; - *pTemp_ = NO_6502_TARGET; - *pFinal_ = NO_6502_TARGET; + *pTargetPartial_ = NO_6502_TARGET; + *pTargetPointer_ = NO_6502_TARGET; if (pBytes_) *pBytes_ = 0; bStatus = true; - WORD nAddress = regs.pc; +// WORD nAddress = regs.pc; BYTE nOpcode = *(LPBYTE)(mem + nAddress ); BYTE nTarget8 = *(LPBYTE)(mem + nAddress + 1); WORD nTarget16 = *(LPWORD)(mem + nAddress + 1); @@ -5803,77 +5895,77 @@ bool Get6502Targets (int *pTemp_, int *pFinal_, int * pBytes_) switch (eMode) { - case ADDR_ABS: - *pFinal_ = nTarget16; + case AM_A: // $Absolute + *pTargetPointer_ = nTarget16; if (pBytes_) *pBytes_ = 2; break; - case ADDR_ABSIINDX: + case AM_IAX: // Indexed (Absolute) Indirect nTarget16 += regs.x; - *pTemp_ = nTarget16; - *pFinal_ = *(LPWORD)(mem + nTarget16); + *pTargetPartial_ = nTarget16; + *pTargetPointer_ = *(LPWORD)(mem + nTarget16); if (pBytes_) *pBytes_ = 2; break; - case ADDR_ABSX: + case AM_AX: // Absolute, X nTarget16 += regs.x; - *pFinal_ = nTarget16; + *pTargetPointer_ = nTarget16; if (pBytes_) *pBytes_ = 2; break; - case ADDR_ABSY: + case AM_AY: // Absolute, Y nTarget16 += regs.y; - *pFinal_ = nTarget16; + *pTargetPointer_ = nTarget16; if (pBytes_) *pBytes_ = 2; break; - case ADDR_IABS: - *pTemp_ = nTarget16; - *pFinal_ = *(LPWORD)(mem + nTarget16); + case AM_NA: // Indirect (Absolute) i.e. JMP + *pTargetPartial_ = nTarget16; + *pTargetPointer_ = *(LPWORD)(mem + nTarget16); if (pBytes_) *pBytes_ = 2; break; - case ADDR_INDX: + case AM_IZX: // Indexed (Zeropage Indirect, X) nTarget8 += regs.x; - *pTemp_ = nTarget8; - *pFinal_ = *(LPWORD)(mem + nTarget8); + *pTargetPartial_ = nTarget8; + *pTargetPointer_ = *(LPWORD)(mem + nTarget8); if (pBytes_) *pBytes_ = 2; break; - case ADDR_INDY: - *pTemp_ = nTarget8; - *pFinal_ = (*(LPWORD)(mem + nTarget8)) + regs.y; + case AM_NZY: // Indirect (Zeropage) Indexed, Y + *pTargetPartial_ = nTarget8; + *pTargetPointer_ = (*(LPWORD)(mem + nTarget8)) + regs.y; if (pBytes_) *pBytes_ = 1; break; - case ADDR_IZPG: - *pTemp_ = nTarget8; - *pFinal_ = *(LPWORD)(mem + nTarget8); + case AM_NZ: // Indirect (Zeropage) + *pTargetPartial_ = nTarget8; + *pTargetPointer_ = *(LPWORD)(mem + nTarget8); if (pBytes_) *pBytes_ = 2; break; - case ADDR_ZP: - *pFinal_ = nTarget8; + case AM_Z: // Zeropage + *pTargetPointer_ = nTarget8; if (pBytes_) *pBytes_ = 1; break; - case ADDR_ZP_X: - *pFinal_ = nTarget8 + regs.x; // shouldn't this wrap around? + case AM_ZX: // Zeropage, X + *pTargetPointer_ = (nTarget8 + regs.x) & 0xFF; // .21 Bugfix: shouldn't this wrap around? Yes. if (pBytes_) *pBytes_ = 1; break; - case ADDR_ZP_Y: - *pFinal_ = nTarget8 + regs.y; // shouldn't this wrap around? + case AM_ZY: // Zeropage, Y + *pTargetPointer_ = (nTarget8 + regs.y) & 0xFF; // .21 Bugfix: shouldn't this wrap around? Yes. if (pBytes_) *pBytes_ = 1; break; @@ -5891,19 +5983,20 @@ bool Get6502Targets (int *pTemp_, int *pFinal_, int * pBytes_) // (!_tcscmp(g_aOpcodes[*(mem+regs.pc)].mnemonic,TEXT("JSR"))))) // If 6502 is jumping, don't show byte [nAddressTarget] - if ((*pFinal_ >= 0) && - ((nOpcode == OPCODE_JSR ) || // 0x20 - (nOpcode == OPCODE_JMP_ABS ) || // 0x4C - (nOpcode == OPCODE_JMP_IABS ) || // 0x6C - (nOpcode == OPCODE_JMP_ABSINDX))) // 0x7C + if ((*pTargetPointer_ >= 0) && + ((nOpcode == OPCODE_JSR ) || // 0x20 + (nOpcode == OPCODE_JMP_A ))) // 0x4C +// (nOpcode == OPCODE_JMP_NA ) || // 0x6C +// (nOpcode == OPCODE_JMP_IAX))) // 0x7C { - *pFinal_ = NO_6502_TARGET; + *pTargetPointer_ = NO_6502_TARGET; if (pBytes_) *pBytes_ = 0; } return bStatus; } + //=========================================================================== bool InternalSingleStep () { @@ -6295,10 +6388,10 @@ void DebugBegin () if (apple2e) g_aOpcodes = & g_aOpcodes65C02[ 0 ]; // Enhanced Apple //e else - g_aOpcodes = & g_aOpcodes6502[ 0 ]; // Original Apple ][ + g_aOpcodes = & g_aOpcodes6502[ 0 ]; // Original Apple ][ ][+ - g_aOpmodes[ ADDR_INVALID2 ].m_nBytes = apple2e ? 2 : 1; - g_aOpmodes[ ADDR_INVALID3 ].m_nBytes = apple2e ? 3 : 1; + g_aOpmodes[ AM_2 ].m_nBytes = apple2e ? 2 : 1; + g_aOpmodes[ AM_3 ].m_nBytes = apple2e ? 3 : 1; g_nDisasmCurAddress = regs.pc; DisasmCalcTopBotAddress(); @@ -6432,6 +6525,9 @@ void DebugEnd () fclose(g_hTraceFile); g_hTraceFile = NULL; } + + + g_vMemorySearchResults.erase( g_vMemorySearchResults.begin(), g_vMemorySearchResults.end() ); } diff --git a/source/Debug.h b/source/Debug.h index 02759790..e0006bb5 100644 --- a/source/Debug.h +++ b/source/Debug.h @@ -62,6 +62,9 @@ using namespace std; // Memory extern MemoryDump_t g_aMemDump[ NUM_MEM_DUMPS ]; +// extern MemorySearchArray_t g_vMemSearchMatches; + extern vector g_vMemorySearchResults; + // Source Level Debugging extern TCHAR g_aSourceFileName[ MAX_PATH ]; extern MemoryTextFile_t g_AssemblerSourceBuffer; @@ -106,7 +109,7 @@ using namespace std; LPCTSTR FindSymbolFromAddress (WORD nAdress, int * iTable_ = NULL ); LPCTSTR GetSymbol (WORD nAddress, int nBytes); - bool Get6502Targets (int *pTemp_, int *pFinal_, int *pBytes_ ); + bool Get6502Targets ( WORD nAddress, int *pTemp_, int *pFinal_, int *pBytes_ ); Update_t DebuggerProcessCommand( const bool bEchoConsoleInput ); diff --git a/source/Debugger_Display.cpp b/source/Debugger_Display.cpp index bf61afd2..05007e1b 100644 --- a/source/Debugger_Display.cpp +++ b/source/Debugger_Display.cpp @@ -101,8 +101,10 @@ static char ColorizeSpecialChar( HDC hDC, TCHAR * sText, BYTE nData, const Memor const int iLowBackground = BG_INFO_CHAR, const int iLowForeground = FG_INFO_CHAR_LO ); char FormatCharTxtAsci ( const BYTE b, bool * pWasAsci_ ); - int FormatDisassemblyLine( WORD nOffset, int iMode, int nOpBytes, - char *sAddress_, char *sOpCodes_, char *sTarget_, char *sTargetOffset_, int & nTargetOffset_, char * sImmediate_, char & nImmediate_, char *sBranch_ ); + int FormatDisassemblyLine( WORD nOffset, int iOpcode, int iOpmode, int nOpbytes, + char *sAddress_, char *sOpCodes_, + char *sTarget_, char *sTargetOffset_, int & nTargetOffset_, char *sTargetValue_, + char * sImmediate_, char & nImmediate_, char *sBranch_ ); @@ -252,9 +254,13 @@ char FormatChar4Font ( const BYTE b, bool *pWasHi_, bool *pWasLo_ ) // Disassembly formatting flags returned +// @parama sTargetValue_ indirect/indexed final value //=========================================================================== -int FormatDisassemblyLine( WORD nBaseAddress, int iMode, int nOpBytes, - char *sAddress_, char *sOpCodes_, char *sTarget_, char *sTargetOffset_, int & nTargetOffset_, char * sImmediate_, char & nImmediate_, char *sBranch_ ) +int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpBytes, + char *sAddress_, char *sOpCodes_, + char *sTarget_, char *sTargetOffset_, int & nTargetOffset_, + char *sTargetPointer_, char *sTargetValue_, + char *sImmediate_, char & nImmediate_, char *sBranch_ ) { const int nMaxOpcodes = 3; unsigned int nMinBytesLen = (nMaxOpcodes * (2 + g_bConfigDisasmOpcodeSpaces)); // 2 char for byte (or 3 with space) @@ -266,16 +272,16 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iMode, int nOpBytes, nTargetOffset_ = 0; // if (g_aOpmodes[ iMode ]._sFormat[0]) - if ((iMode != AM_IMPLIED) && - (iMode != AM_1) && - (iMode != AM_2) && - (iMode != AM_3)) + if ((iOpmode != AM_IMPLIED) && + (iOpmode != AM_1) && + (iOpmode != AM_2) && + (iOpmode != AM_3)) { nTarget = *(LPWORD)(mem+nBaseAddress+1); if (nOpBytes == 2) nTarget &= 0xFF; - if (iMode == AM_R) // Relative ADDR_REL) + if (iOpmode == AM_R) // Relative ADDR_REL) { nTarget = nBaseAddress+2+(int)(signed char)nTarget; @@ -298,21 +304,20 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iMode, int nOpBytes, } } -// if (_tcsstr(g_aOpmodes[ iMode ]._sFormat,TEXT("%s"))) -// if ((iMode >= ADDR_ABS) && (iMode <= ADDR_IABS)) - if ((iMode == ADDR_ABS ) || - (iMode == ADDR_ZP ) || - (iMode == ADDR_ABSX) || - (iMode == ADDR_ABSY) || - (iMode == ADDR_ZP_X) || - (iMode == ADDR_ZP_Y) || - (iMode == ADDR_REL ) || - (iMode == ADDR_INDX) || - (iMode == ADDR_ABSIINDX) || - (iMode == ADDR_INDY) || - (iMode == ADDR_ABS ) || - (iMode == ADDR_IZPG) || - (iMode == ADDR_IABS)) +// if (_tcsstr(g_aOpmodes[ iOpmode ]._sFormat,TEXT("%s"))) +// if ((iOpmode >= ADDR_ABS) && (iOpmode <= ADDR_IABS)) + if ((iOpmode == AM_A ) || // Absolute + (iOpmode == AM_Z ) || // Zeropage + (iOpmode == AM_AX ) || // Absolute, X + (iOpmode == AM_AY ) || // Absolute, Y + (iOpmode == AM_ZX ) || // Zeropage, X + (iOpmode == AM_ZY ) || // Zeropage, Y + (iOpmode == AM_R ) || // Relative + (iOpmode == AM_IZX) || // Indexed (Zeropage Indirect, X) + (iOpmode == AM_IAX) || // Indexed (Absolute Indirect, X) + (iOpmode == AM_NZY) || // Indirect (Zeropage) Index, Y + (iOpmode == AM_NZ ) || // Indirect (Zeropage) + (iOpmode == AM_NA )) // Indirect Absolute { LPCTSTR pTarget = NULL; LPCTSTR pSymbol = FindSymbolFromAddress( nTarget ); @@ -351,21 +356,59 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iMode, int nOpBytes, pTarget = FormatAddress( nTarget, nOpBytes ); } -// wsprintf( sTarget, g_aOpmodes[ iMode ]._sFormat, pTarget ); +// wsprintf( sTarget, g_aOpmodes[ iOpmode ]._sFormat, pTarget ); if (bDisasmFormatFlags & DISASM_TARGET_OFFSET) { int nAbsTargetOffset = (nTargetOffset_ > 0) ? nTargetOffset_ : -nTargetOffset_; wsprintf( sTargetOffset_, "%d", nAbsTargetOffset ); } wsprintf( sTarget_, "%s", pTarget ); + + + // Indirect / Indexed + int nTargetPartial; + int nTargetPointer; + WORD nTargetValue = 0; // de-ref + int nTargetBytes; + Get6502Targets( nBaseAddress, &nTargetPartial, &nTargetPointer, &nTargetBytes ); + + if (nTargetPointer != NO_6502_TARGET) + { + bDisasmFormatFlags |= DISASM_TARGET_POINTER; + + nTargetValue = *(LPWORD)(mem+nTargetPointer); + +// if (((iOpmode >= AM_A) && (iOpmode <= AM_NZ)) && (iOpmode != AM_R)) + // nTargetBytes refers to size of pointer, not size of value +// wsprintf( sTargetValue_, "%04X", nTargetValue ); // & 0xFFFF + + wsprintf( sTargetPointer_, "%04X", nTargetPointer & 0xFFFF ); + + if (iOpmode != AM_NA ) // Indirect Absolute + { + bDisasmFormatFlags |= DISASM_TARGET_VALUE; + + wsprintf( sTargetValue_, "%02X", nTargetValue & 0xFF ); + + bDisasmFormatFlags |= DISASM_IMMEDIATE_CHAR; + nImmediate_ = (BYTE) nTargetValue; + wsprintf( sImmediate_, "%c", FormatCharTxtCtrl( FormatCharTxtHigh( nImmediate_, NULL ), NULL ) ); + } + +// if (iOpmode == AM_NA ) // Indirect Absolute +// wsprintf( sTargetValue_, "%04X", nTargetPointer & 0xFFFF ); +// else +// // wsprintf( sTargetValue_, "%02X", nTargetValue & 0xFF ); +// wsprintf( sTargetValue_, "%04X:%02X", nTargetPointer & 0xFFFF, nTargetValue & 0xFF ); + } } else - if (iMode == AM_M) + if (iOpmode == AM_M) { -// wsprintf( sTarget, g_aOpmodes[ iMode ]._sFormat, (unsigned)nTarget ); +// wsprintf( sTarget, g_aOpmodes[ iOpmode ]._sFormat, (unsigned)nTarget ); wsprintf( sTarget_, "%02X", (unsigned)nTarget ); - if (iMode == ADDR_IMM) + if (iOpmode == AM_M) { bDisasmFormatFlags |= DISASM_IMMEDIATE_CHAR; nImmediate_ = (BYTE) nTarget; @@ -737,30 +780,41 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) int nOpbytes; iOpcode = _6502GetOpmodeOpbytes( nBaseAddress, iOpmode, nOpbytes ); - TCHAR sAddress [ 5]; + const int CHARS_FOR_ADDRESS = 8; // 4 digits plus null + + TCHAR sAddress [ CHARS_FOR_ADDRESS ]; TCHAR sOpcodes [(nMaxOpcodes*3)+1] = TEXT(""); TCHAR sTarget [nMaxAddressLen] = TEXT(""); - TCHAR sTargetOffset[ 4 ] = TEXT(""); // +/- 255, realistically +/-1 + + TCHAR sTargetOffset[ CHARS_FOR_ADDRESS ] = TEXT(""); // +/- 255, realistically +/-1 int nTargetOffset; + + TCHAR sTargetPointer[ CHARS_FOR_ADDRESS ] = TEXT(""); + TCHAR sTargetValue [ CHARS_FOR_ADDRESS ] = TEXT(""); + char nImmediate = 0; TCHAR sImmediate[ 4 ]; // 'c' TCHAR sBranch [ 4 ]; // ^ bool bTargetIndirect = false; - bool bTargetX = false; - bool bTargetY = false; + bool bTargetX = false; + bool bTargetY = false; // need to dislay ",Y" + bool bTargetValue = false; - if ((iOpmode >= ADDR_INDX) && (iOpmode <= ADDR_IABS)) + if ((iOpmode >= AM_IZX) && (iOpmode <= AM_NA)) bTargetIndirect = true; - if ((iOpmode == ADDR_ABSX) || (iOpmode == ADDR_ZP_X) || (iOpmode == ADDR_INDX) || (iOpmode == ADDR_ABSIINDX)) + if (((iOpmode >= AM_A) && (iOpmode <= AM_ZY)) || bTargetIndirect) + bTargetValue = true; + + if ((iOpmode == AM_AX) || (iOpmode == AM_ZX) || (iOpmode == AM_IZX) || (iOpmode == AM_IAX)) bTargetX = true; - if ((iOpmode == ADDR_ABSY) || (iOpmode == ADDR_ZP_Y)) + if ((iOpmode == AM_AY) || (iOpmode == AM_ZY)) // Note: AM_NZY is checked and triggered by bTargetIndirect bTargetY = true; - int bDisasmFormatFlags = FormatDisassemblyLine( nBaseAddress, iOpmode, nOpbytes, - sAddress, sOpcodes, sTarget, sTargetOffset, nTargetOffset, sImmediate, nImmediate, sBranch ); + int bDisasmFormatFlags = FormatDisassemblyLine( nBaseAddress, iOpcode, iOpmode, nOpbytes, + sAddress, sOpcodes, sTarget, sTargetOffset, nTargetOffset, sTargetPointer, sTargetValue, sImmediate, nImmediate, sBranch ); //> Address Seperator Opcodes Label Mnemonic Target [Immediate] [Branch] // @@ -770,8 +824,8 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) const int nDefaultFontWidth = 7; // g_aFontConfig[FONT_DISASM_DEFAULT]._nFontWidth or g_nFontWidthAvg int X_OPCODE = 6 * nDefaultFontWidth; int X_LABEL = 17 * nDefaultFontWidth; - int X_INSTRUCTION = 27 * nDefaultFontWidth; - int X_IMMEDIATE = 41 * nDefaultFontWidth; + int X_INSTRUCTION = 26 * nDefaultFontWidth; // 27 + int X_IMMEDIATE = 40 * nDefaultFontWidth; // 41 int X_BRANCH = 46 * nDefaultFontWidth; const int DISASM_SYMBOL_LEN = 9; @@ -908,7 +962,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) DebugDrawTextHorz( TEXT(" "), linerect ); // Target - if (iOpmode == ADDR_IMM) + if (iOpmode == AM_M) { if (! bCursorLine) SetTextColor( dc, DebuggerGetColor( FG_DISASM_OPERATOR )); @@ -939,7 +993,8 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) } else { - if (bDisasmFormatFlags & DISASM_IMMEDIATE_CHAR) + if (iOpmode == AM_M) +// if (bDisasmFormatFlags & DISASM_IMMEDIATE_CHAR) { SetTextColor( dc, DebuggerGetColor( FG_DISASM_OPCODE ) ); } @@ -984,19 +1039,48 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) if (bTargetIndirect) DebugDrawTextHorz( TEXT(")"), linerect ); - if (iOpmode == ADDR_INDY) + if (iOpmode == AM_NZY) DebugDrawTextHorz( TEXT(",Y"), linerect ); } // Immediate Char linerect.left = X_IMMEDIATE; + // Memory Pointer and Value + if (bDisasmFormatFlags & DISASM_TARGET_POINTER) // (bTargetValue) + { +// DebugDrawTextHorz( TEXT(" "), linerect ); + + // FG_DISASM_TARGET + // FG_DISASM_OPERATOR + // FG_DISASM_OPCODE + if (! bCursorLine) + SetTextColor( dc, DebuggerGetColor( FG_DISASM_ADDRESS )); + + DebugDrawTextHorz( sTargetPointer, linerect ); + + if (bDisasmFormatFlags & DISASM_TARGET_VALUE) + { + if (! bCursorLine) + SetTextColor( dc, DebuggerGetColor( FG_DISASM_OPERATOR )); + DebugDrawTextHorz( TEXT(":"), linerect ); + + if (! bCursorLine) + SetTextColor( dc, DebuggerGetColor( FG_DISASM_OPCODE )); + + DebugDrawTextHorz( sTargetValue, linerect ); + DebugDrawTextHorz( TEXT(" "), linerect ); + } + } + if (bDisasmFormatFlags & DISASM_IMMEDIATE_CHAR) { if (! bCursorLine) { SetTextColor( dc, DebuggerGetColor( FG_DISASM_OPERATOR ) ); } + + if (! (bDisasmFormatFlags & DISASM_TARGET_POINTER)) DebugDrawTextHorz( TEXT("'"), linerect ); // TEXT(" '") if (! bCursorLine) @@ -1011,8 +1095,15 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) { SetTextColor( dc, DebuggerGetColor( FG_DISASM_OPERATOR ) ); } + + if (! (bDisasmFormatFlags & DISASM_TARGET_POINTER)) DebugDrawTextHorz( TEXT("'"), linerect ); } +// else +// if (bTargetIndirect) +// { +// // Follow indirect targets +// } // Branch Indicator linerect.left = X_BRANCH; @@ -1436,7 +1527,7 @@ void DrawTargets (HDC dc, int line) return; int aTarget[2]; - Get6502Targets( &aTarget[0],&aTarget[1], NULL ); + Get6502Targets( regs.pc, &aTarget[0],&aTarget[1], NULL ); RECT rect; diff --git a/source/Debugger_Parser.cpp b/source/Debugger_Parser.cpp index ebfdf022..efff135b 100644 --- a/source/Debugger_Parser.cpp +++ b/source/Debugger_Parser.cpp @@ -39,16 +39,18 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA const TCHAR TCHAR_CR = TEXT('\x0A'); const TCHAR TCHAR_SPACE = TEXT(' '); const TCHAR TCHAR_TAB = TEXT('\t'); - const TCHAR TCHAR_QUOTED = TEXT('"'); +// const TCHAR TCHAR_QUOTED = TEXT('"'); + const TCHAR TCHAR_QUOTE_DOUBLE = TEXT('"'); + const TCHAR TCHAR_QUOTE_SINGLE = TEXT('\''); const TCHAR TCHAR_ESCAPE = TEXT('\x1B'); - // NOTE: Token_e and g_aTokens must match! + // NOTE: ArgToken_e and g_aTokens must match! const TokenTable_t g_aTokens[ NUM_TOKENS ] = { // Input { TOKEN_ALPHANUMERIC, TYPE_STRING , 0 }, // Default, if doen't match anything else { TOKEN_AMPERSAND , TYPE_OPERATOR, TEXT('&') }, // bit-and -// { TOKEN_AT , TYPE_OPERATOR, TEXT('@') }, // force Register? or PointerDeref? + { TOKEN_AT , TYPE_OPERATOR, TEXT('@') }, // reference results { TOKEN_BSLASH , TYPE_OPERATOR, TEXT('\\') }, { TOKEN_CARET , TYPE_OPERATOR, TEXT('^') }, // bit-eor, C/C++: xor, Math: POWER { TOKEN_COLON , TYPE_OPERATOR, TEXT(':') }, @@ -66,7 +68,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA { TOKEN_PIPE , TYPE_OPERATOR, TEXT('|') }, // bit-or { TOKEN_PLUS , TYPE_OPERATOR, TEXT('+') }, // add // { TOKEN_QUESTION , TYPE_OPERATOR, TEXT('?') }, // Not a token 1) wildcard needs to stay together with other chars - { TOKEN_QUOTED , TYPE_QUOTED , TEXT('"') }, + { TOKEN_QUOTE_SINGLE, TYPE_QUOTED_1, TEXT('\'') }, + { TOKEN_QUOTE_DOUBLE, TYPE_QUOTED_2, TEXT('"') }, // for strings { TOKEN_RIGHT_PAREN , TYPE_OPERATOR, TEXT(')') }, { TOKEN_SEMI , TYPE_STRING , TEXT(';') }, { TOKEN_SPACE , TYPE_STRING , TEXT(' ') } // space is also a delimiter between tokens/args @@ -240,10 +243,16 @@ int ArgsGet ( TCHAR * pInput ) // TODO - command seperator, must handle non-quoted though! } - if (iTokenSrc == TOKEN_QUOTED) + if (iTokenSrc == TOKEN_QUOTE_DOUBLE) { pSrc++; // Don't store start of quote - pEnd = SkipUntilChar( pSrc, CHAR_QUOTED ); + pEnd = SkipUntilChar( pSrc, CHAR_QUOTE_DOUBLE ); + } + else + if (iTokenSrc == TOKEN_QUOTE_SINGLE) + { + pSrc++; // Don't store start of quote + pEnd = SkipUntilChar( pSrc, CHAR_QUOTE_SINGLE ); } if (pEnd) @@ -260,10 +269,20 @@ int ArgsGet ( TCHAR * pInput ) pArg->eToken = iTokenSrc; pArg->bType = iType; - if (iTokenSrc == TOKEN_QUOTED) + if (iTokenSrc == TOKEN_QUOTE_DOUBLE) { pEnd++; } + else + if (iTokenSrc == TOKEN_QUOTE_SINGLE) + { + if (nLen > 1) + { + // Technically, chars aren't allowed to be multi-char + } + + pEnd++; + } pSrc = pEnd; iArg++; @@ -588,12 +607,29 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) nParamLen = 0; // need token for Smart BreakPoints } - if (bProcessMask & (1 << TOKEN_HASH)) - if (pArg->eToken == TOKEN_HASH) // HASH # immediate + if (bProcessMask & (1 << TOKEN_AT)) + if (pArg->eToken == TOKEN_AT) // AT @ pointer de-reference { + nParamLen = 1; _Arg_Shift( iArg + nParamLen, nArgs, iArg ); nArg--; + pArg->nVal1 = 0; // nAddressRHS; + pArg->bSymbol = false; + + int nPointers = g_vMemorySearchResults.size(); + if ((nPointers) && + (nAddressRHS < nPointers)) + { + pArg->nVal1 = g_vMemorySearchResults.at( nAddressRHS ); + pArg->bType = TYPE_VALUE | TYPE_ADDRESS | TYPE_NO_REG | TYPE_NO_SYM; + } + nParamLen = 0; + } + + if (bProcessMask & (1 << TOKEN_HASH)) + if (pArg->eToken == TOKEN_HASH) // HASH # immediate + { pArg->nVal1 = nAddressRHS; pArg->bSymbol = false; pArg->bType = TYPE_VALUE | TYPE_ADDRESS | TYPE_NO_REG | TYPE_NO_SYM; diff --git a/source/Debugger_Parser.h b/source/Debugger_Parser.h index 43546018..b30b6141 100644 --- a/source/Debugger_Parser.h +++ b/source/Debugger_Parser.h @@ -5,7 +5,8 @@ #define CHAR_CR '\x0A' #define CHAR_SPACE ' ' #define CHAR_TAB '\t' - #define CHAR_QUOTED '"' + #define CHAR_QUOTE_DOUBLE '"' + #define CHAR_QUOTE_SINGLE '\'' #define CHAR_ESCAPE '\x1B' // Globals __________________________________________________________________ @@ -22,7 +23,8 @@ extern const TCHAR TCHAR_CR ;//= 0x0A; extern const TCHAR TCHAR_SPACE ;//= TEXT(' '); extern const TCHAR TCHAR_TAB ;//= TEXT('\t'); - extern const TCHAR TCHAR_QUOTED;//= TEXT('"' ); + extern const TCHAR TCHAR_QUOTE_DOUBLE; + extern const TCHAR TCHAR_QUOTE_SINGLE; // Prototypes _______________________________________________________________ diff --git a/source/Debugger_Types.h b/source/Debugger_Types.h index 774a16a0..fe7bbbcc 100644 --- a/source/Debugger_Types.h +++ b/source/Debugger_Types.h @@ -103,22 +103,24 @@ , AM_I = NUM_ADDRESSING_MODES, // for assemler // Deprecated + /* ADDR_INVALID1 = 1, ADDR_INVALID2 = 2, ADDR_INVALID3 = 3, ADDR_IMM = 4, // Immediate ADDR_ABS = 5, // Absolute - ADDR_ZP = 6, // Zeropage // ADDR_ZPG + ADDR_ZP = 6, // Zeropage ADDR_ABSX = 7, // Absolute + X ADDR_ABSY = 8, // Absolute + Y - ADDR_ZP_X = 9, // Zeropage + X // ADDR_ZPGX - ADDR_ZP_Y = 10, // Zeropage + Y // ADDR_ZPGY + ADDR_ZP_X = 9, // Zeropage + X + ADDR_ZP_Y = 10, // Zeropage + Y ADDR_REL = 11, // Relative ADDR_INDX = 12, // Indexed (Zeropage) Indirect ADDR_ABSIINDX = 13, // Indexed (Absolute) Indirect ADDR_INDY = 14, // Indirect (Zeropage) Indexed ADDR_IZPG = 15, // Indirect (Zeropage) ADDR_IABS = 16, // Indirect Absolute (i.e. JMP) + */ }; @@ -503,8 +505,7 @@ , CMD_MEMORY_MOVE , CMD_MEMORY_SEARCH , CMD_MEMORY_SEARCH_ASCII // Ascii Text - , CMD_MEMORY_SEARCH_TXT_LO // Control Chars - , CMD_MEMORY_SEARCH_TXT_HI // Flashing Chars, Hi-Bit Set + , CMD_MEMORY_SEARCH_APPLE // Flashing Chars, Hi-Bit Set , CMD_MEMORY_SEARCH_HEX , CMD_MEMORY_FILL // Registers - CPU @@ -678,10 +679,11 @@ Update_t CmdMemoryFill (int nArgs); Update_t CmdMemoryMove (int nArgs); Update_t CmdMemorySearch (int nArgs); - Update_t CmdMemorySearchLowBit (int nArgs); - Update_t CmdMemorySearchHiBit (int nArgs); +// Update_t CmdMemorySearchLowBit (int nArgs); +// Update_t CmdMemorySearchHiBit (int nArgs); + Update_t CmdMemorySearchAscii (int nArgs); + Update_t CmdMemorySearchApple (int nArgs); Update_t CmdMemorySearchHex (int nArgs); - Update_t CmdMemorySearchText (int nArgs); // Registers Update_t CmdRegisterSet (int nArgs); // Source Level Debugging @@ -775,6 +777,8 @@ DISASM_TARGET_SYMBOL = (1 << 1), DISASM_TARGET_OFFSET = (1 << 2), DISASM_BRANCH_INDICATOR = (1 << 3), + DISASM_TARGET_POINTER = (1 << 4), + DISASM_TARGET_VALUE = (1 << 5), }; enum DisasmBranch_e @@ -873,12 +877,12 @@ enum Opcode_e { - OPCODE_BRA = 0x80, + OPCODE_BRA = 0x80, - OPCODE_JSR = 0x20, - OPCODE_JMP_ABS = 0x4C, - OPCODE_JMP_IABS = 0x6C, - OPCODE_JMP_ABSINDX = 0x7C, + OPCODE_JSR = 0x20, + OPCODE_JMP_A = 0x4C, // Absolute + OPCODE_JMP_NA = 0x6C, // Indirect Absolute + OPCODE_JMP_IAX = 0x7C, // Indexed (Absolute Indirect, X) }; // Note: "int" causes overflow when profiling for any amount of time. @@ -988,11 +992,14 @@ struct MemorySearch_t { - BYTE m_nValue; - MemorySearch_e m_iType; - bool m_bFound; + BYTE m_nValue ; // search value + MemorySearch_e m_iType ; // + bool m_bFound ; // }; + typedef vector MemorySearchValues_t; + typedef vector MemorySearchResults_t; + // Parameters _____________________________________________________________________________________ /* i.e. @@ -1004,7 +1011,7 @@ { TOKEN_ALPHANUMERIC // , TOKEN_AMPERSAND // & -// , TOKEN_AT // @ TODO: pointer reference. i.e. U @3F0 + , TOKEN_AT // @ results dereference. i.e. S 0,FFFF C030; L @1 , TOKEN_BSLASH // \xx Hex Literal , TOKEN_CARET // ^ // , TOKEN_CHAR @@ -1023,7 +1030,8 @@ , TOKEN_PERCENT // % , TOKEN_PIPE // | , TOKEN_PLUS // + Delta Argument1 += Argument2 - , TOKEN_QUOTED // " + , TOKEN_QUOTE_SINGLE // ' + , TOKEN_QUOTE_DOUBLE // " , TOKEN_RIGHT_PAREN // ) , TOKEN_SEMI // ; Command Seperator , TOKEN_SPACE // Token Delimiter @@ -1041,13 +1049,14 @@ { TYPE_ADDRESS = (1 << 0) // $#### or $symbolname , TYPE_OPERATOR = (1 << 1) - , TYPE_QUOTED = (1 << 2) // "..." - , TYPE_STRING = (1 << 3) // LOAD - , TYPE_RANGE = (1 << 4) - , TYPE_LENGTH = (1 << 5) - , TYPE_VALUE = (1 << 6) - , TYPE_NO_REG = (1 << 7) // Don't do register value -> Argument.nValue - , TYPE_NO_SYM = (1 << 8) // Don't do symbol lookup -> Argument.nValue + , TYPE_QUOTED_1 = (1 << 2) + , TYPE_QUOTED_2 = (1 << 3) // "..." + , TYPE_STRING = (1 << 4) // LOAD + , TYPE_RANGE = (1 << 5) + , TYPE_LENGTH = (1 << 6) + , TYPE_VALUE = (1 << 7) + , TYPE_NO_REG = (1 << 8) // Don't do register value -> Argument.nValue + , TYPE_NO_SYM = (1 << 9) // Don't do symbol lookup -> Argument.nValue }; struct TokenTable_t