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

Function CmdOutputCalc

source/Debugger/Debug.cpp:6413–6465  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

6411
6412//===========================================================================
6413Update_t CmdOutputCalc (int nArgs)
6414{
6415 const int nBits = 8;
6416
6417 if (! nArgs)
6418 return Help_Arg_1( CMD_OUTPUT_CALC );
6419
6420 WORD nAddress = g_aArgs[1].nValue;
6421
6422 bool bHi = false;
6423 bool bLo = false;
6424 char c = FormatChar4Font( (BYTE) nAddress, &bHi, &bLo );
6425 bool bParen = bHi || bLo;
6426
6427 int nBit = 0;
6428 int iBit = 0;
6429 for ( iBit = 0; iBit < nBits; iBit++ )
6430 {
6431 bool bSet = (nAddress >> iBit) & 1;
6432 if (bSet)
6433 nBit |= (1 << (iBit * 4)); // 4 bits per hex digit
6434 }
6435
6436 // TODO: Colorize output
6437 // CHC_NUM_HEX
6438 // CHC_NUM_BIN -- doesn't exist, use CHC_INFO
6439 // CHC_NUM_DEC
6440 // CHC_ARG_
6441 // CHC_STRING
6442 std::string sText = StrFormat( "$%04X 0z%08X %5d '%c' ", nAddress, nBit, nAddress, c );
6443
6444 if (bParen)
6445 sText += '(';
6446
6447 if (bHi && bLo)
6448 sText += "High Ctrl";
6449 else
6450 if (bHi)
6451 sText += "High";
6452 else
6453 if (bLo)
6454 sText += "Ctrl";
6455
6456 if (bParen)
6457 sText += ')';
6458
6459 ConsoleBufferPush( sText.c_str() );
6460
6461// If we colorize then w must also guard against character ouput $60
6462// ConsolePrint( sText.c_str() );
6463
6464 return ConsoleUpdate();
6465}
6466
6467
6468//===========================================================================

Callers

nothing calls this directly

Calls 5

Help_Arg_1Function · 0.85
FormatChar4FontFunction · 0.85
StrFormatFunction · 0.85
ConsoleBufferPushFunction · 0.70
ConsoleUpdateFunction · 0.70

Tested by

no test coverage detected