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

Function _SearchMemoryDisplay

source/Debugger/Debug.cpp:6108–6158  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

6106
6107//===========================================================================
6108Update_t _SearchMemoryDisplay (int nArgs)
6109{
6110 int const nFound = (int) (g_vMemorySearchResults.size() - 1);
6111
6112 if (nFound > 0)
6113 {
6114 std::string sMatches;
6115
6116 int iFound = 1;
6117 while (iFound <= nFound)
6118 {
6119 WORD const nAddress = g_vMemorySearchResults.at( iFound );
6120
6121 // 2.6.2.17 Search Results: The n'th result now using correct color (was command, now number decimal)
6122 // BUGFIX: 2.6.2.32 n'th Search results were being displayed in dec, yet parser takes hex numbers. i.e. SH D000:FFFF A9 00
6123 // Intentional default instead of CHC_ARG_SEP for better readability
6124 // 2.6.2.16 Fixed: Search Results: The hex specify for target address results now colorized properly
6125 // 2.6.2.15 Fixed: Search Results: Added space between results for better readability
6126
6127 // FIXME: Color is DEC whereas the format is "%X". What's the real intention?
6128 std::string sResult = StrFormat( CHC_NUM_DEC "%02X" CHC_DEFAULT ":" CHC_ARG_SEP "$" CHC_ADDRESS "%04X ",
6129 iFound, nAddress );
6130
6131 // Fit on same line?
6132 if ((sMatches.length() + sResult.length()) > (size_t(g_nConsoleDisplayWidth) - 1)) // CONSOLE_WIDTH
6133 {
6134 //ConsoleDisplayPush( sMatches.c_str() );
6135 ConsolePrint( sMatches.c_str() );
6136 sMatches = sResult;
6137 }
6138 else
6139 {
6140 sMatches += sResult;
6141 }
6142
6143 iFound++;
6144 }
6145
6146 ConsolePrint( sMatches.c_str() );
6147 }
6148
6149 //ConsoleDisplayPushFormat( "Total: %d (#$%04X)", nFound, nFound );
6150
6151 ConsolePrintFormat( CHC_USAGE "Total" CHC_DEFAULT ": " CHC_NUM_DEC "%d " CHC_ARG_SEP "(" CHC_ARG_SEP "#$" CHC_NUM_HEX "%04X" CHC_ARG_SEP ")",
6152 nFound /*dec*/, nFound /*hex*/ );
6153
6154 // g_vMemorySearchResults is cleared in DebugEnd()
6155
6156// return UPDATE_CONSOLE_DISPLAY;
6157 return ConsoleUpdate();
6158}
6159
6160
6161//===========================================================================

Callers 1

_CmdMemorySearchFunction · 0.85

Calls 4

StrFormatFunction · 0.85
ConsolePrintFunction · 0.85
ConsolePrintFormatFunction · 0.85
ConsoleUpdateFunction · 0.70

Tested by

no test coverage detected