MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / _CmdMemorySearch

Function _CmdMemorySearch

source/Debugger/Debug.cpp:6162–6317  ·  view source on GitHub ↗

===========================================================================

Source from the content-addressed store, hash-verified

6160
6161//===========================================================================
6162Update_t _CmdMemorySearch (int nArgs, bool bTextIsAscii = true )
6163{
6164 WORD nAddressStart = 0;
6165 WORD nAddress2 = 0;
6166 WORD nAddressEnd = 0;
6167 int nAddressLen = 0;
6168
6169 RangeType_t eRange = Range_Get( nAddressStart, nAddress2 );
6170
6171// if (eRange == RANGE_MISSING_ARG_2)
6172 if (! Range_CalcEndLen( eRange, nAddressStart, nAddress2, nAddressEnd, nAddressLen))
6173 return ConsoleDisplayError( "Error: Missing address separator (comma or colon)" );
6174
6175 int iArgFirstByte = 4;
6176 int iArg;
6177
6178 MemorySearchValues_t vMemorySearchValues;
6179 MemorySearch_e tLastType = MEM_SEARCH_BYTE_N_WILD;
6180
6181 // Get search "string"
6182 Arg_t *pArg = & g_aArgs[ iArgFirstByte ];
6183
6184 for (iArg = iArgFirstByte; iArg <= nArgs; iArg++, pArg++ )
6185 {
6186 WORD nTarget = pArg->nValue;
6187
6188 MemorySearch_t ms;
6189 ms.m_nValue = nTarget & 0xFF;
6190 ms.m_iType = MEM_SEARCH_BYTE_EXACT;
6191 ms.m_bFound = false;
6192
6193 if (nTarget > 0xFF) // searching for 16-bit address
6194 {
6195 vMemorySearchValues.push_back( ms );
6196 ms.m_nValue = (nTarget >> 8);
6197
6198 tLastType = ms.m_iType;
6199 }
6200 else
6201 {
6202 char *pByte = pArg->sArg;
6203
6204 if (pArg->bType & TYPE_QUOTED_1)
6205 {
6206 // Convert string to hex byte(s)
6207 int iChar = 0;
6208 int nChars = pArg->nArgLen;
6209
6210 if (nChars)
6211 {
6212 ms.m_iType = MEM_SEARCH_BYTE_EXACT;
6213 ms.m_bFound = false;
6214
6215 while (iChar < nChars)
6216 {
6217 ms.m_nValue = pArg->sArg[ iChar ];
6218
6219 // Ascii (Low-Bit)

Callers 4

CmdMemorySearchFunction · 0.85
CmdMemorySearchAsciiFunction · 0.85
CmdMemorySearchAppleFunction · 0.85
CmdMemorySearchHexFunction · 0.85

Calls 7

Range_GetFunction · 0.85
Range_CalcEndLenFunction · 0.85
ConsoleDisplayErrorFunction · 0.85
HelpLastCommandFunction · 0.85
_SearchMemoryFindFunction · 0.85
_SearchMemoryDisplayFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected