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

Function ExecuteCommand

source/Debugger/Debug.cpp:8238–8463  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

8236
8237//===========================================================================
8238Update_t ExecuteCommand (int nArgs)
8239{
8240 Arg_t * pArg = & g_aArgs[ 0 ];
8241 char * pCommand = & pArg->sArg[0];
8242
8243 CmdFuncPtr_t pFunction = NULL;
8244 int nFound = FindCommand( pCommand, pFunction );
8245
8246// int nCookMask = (1 << NUM_TOKENS) - 1; // ArgToken_e used as bit mask!
8247
8248 // BUGFIX: commands that are also valid hex addresses
8249 // ####:# [#]
8250 // #<#.#M
8251 int nLen = pArg->nArgLen;
8252
8253 if ((! nFound) || (nLen < 6))
8254 {
8255 // 2.7.0.36 Fixed: empty command was re-triggering previous command. Example: DW 6062, // test
8256 if ( nLen > 0 )
8257 {
8258 // verify pCommand[ 0 .. (nLen-1) ] are hex digits
8259 bool bIsHex = false;
8260 char *pChar = pCommand;
8261 for (int iChar = 0; iChar < (nLen - 1); iChar++, pChar++ )
8262 {
8263 bIsHex = IsHexDigit( *pChar );
8264 if ( !bIsHex )
8265 {
8266 break;
8267 }
8268 }
8269
8270 if (bIsHex)
8271 {
8272 // Support Apple Monitor commands
8273
8274 WORD nAddress = 0;
8275
8276 // ####G -> JMP $address (exit debugger)
8277 // NB. AppleWin 'g','gg' commands handled via pFunction below
8278 if ((pCommand[nLen-1] == 'G') ||
8279 (pCommand[nLen-1] == 'g'))
8280 {
8281 pCommand[nLen-1] = 0;
8282 ArgsGetValue( pArg, & nAddress );
8283
8284 regs.pc = nAddress;
8285
8286 g_nAppMode = MODE_RUNNING; // exit the debugger
8287
8288 nFound = 1;
8289 g_iCommand = CMD_OUTPUT_ECHO; // hack: don't cook args
8290 }
8291 else
8292 // ####L -> Unassemble $address
8293 if (((pCommand[nLen-1] == 'L') ||
8294 (pCommand[nLen-1] == 'l'))&&
8295 (_stricmp("cl", pCommand) != 0)) // workaround for ambiguous "cl": must be handled by "clear flag" command

Callers 1

DebuggerProcessCommandFunction · 0.85

Calls 8

FindCommandFunction · 0.85
IsHexDigitFunction · 0.85
ConsolePrintFormatFunction · 0.85
DisplayAmbigiousCommandsFunction · 0.85
ArgsCookFunction · 0.85
ConsoleDisplayErrorFunction · 0.85
ArgsGetValueFunction · 0.70
ConsoleUpdateFunction · 0.70

Tested by

no test coverage detected