From fb200e5c93fbc104199fb9dfe870d7292e4bc9c9 Mon Sep 17 00:00:00 2001 From: mpohoreski Date: Fri, 17 Dec 2010 05:59:43 +0000 Subject: [PATCH] 2.6.2.11 Added: Command line now accepts Indirect mode via ( ) Example: U (BRKV) --- AppleWin/source/Debugger/Debugger_Parser.cpp | 50 +++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/AppleWin/source/Debugger/Debugger_Parser.cpp b/AppleWin/source/Debugger/Debugger_Parser.cpp index 5edcfc52..4a925a30 100644 --- a/AppleWin/source/Debugger/Debugger_Parser.cpp +++ b/AppleWin/source/Debugger/Debugger_Parser.cpp @@ -4,7 +4,7 @@ AppleWin : An Apple //e emulator for Windows Copyright (C) 1994-1996, Michael O'Brien Copyright (C) 1999-2001, Oliver Schmidt Copyright (C) 2002-2005, Tom Charlesworth -Copyright (C) 2006-2007, Tom Charlesworth, Michael Pohoreski +Copyright (C) 2006-2010, Tom Charlesworth, Michael Pohoreski AppleWin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -458,6 +458,9 @@ int ArgsCook ( const int nArgs ) //, const int bProcessMask ) int nParamLen = 0; int nArgsLeft = 0; + int nParenL = 0; + int nParenR = 0; + while (iArg <= nArg) { pArg = & (g_aArgs[ iArg ]); @@ -697,6 +700,51 @@ int ArgsCook ( const int nArgs ) //, const int bProcessMask ) // Don't remove, since "SYM ! symbol" needs token to remove symbol } + if (pArg->eToken == TOKEN_PAREN_L) + { + nParenL++; + + if (nArgsLeft >= 2) + { + nParamLen = 1; // eat '(' + _Arg_Shift( iArg + nParamLen, nArgs, iArg ); + + pNext = & (g_aArgs[ iArg + 1 ]); + if (pNext->eToken == TOKEN_PAREN_R) + { + nParenR++; + pArg->bSymbol = false; + + // This is static binding, instead of dynamic binding + // i.e. memdump (BRKV) -> memdump (3F0), but if 3F0 changes later + // the debugger won't know that it has + // TODO: TYPE_INDIRECT + // pArg->bType |= TYPE_INDIRECT; + // pArg->nValue = nAddressVal; + //nAddressVal = pNext->nValue; + pArg->nValue = * (WORD*) (mem + nAddressVal); + pArg->bType = TYPE_VALUE | TYPE_ADDRESS | TYPE_NO_REG; + + iArg++; // eat ')' + nArg -= 2; + nParamLen = 0; + } + else + return ARG_SYNTAX_ERROR; // ERROR: unbalanced/unmatched ( ) + } + } + + if (pArg->eToken == TOKEN_PAREN_R) + { + nParenR++; + if (nParenL == nParenR) + { + nParamLen = 1; + } + else + return ARG_SYNTAX_ERROR; + } + if (nParamLen) { _Arg_Shift( iArg + nParamLen, nArgs, iArg );