.13 Fixed BSAVE syntax parsing

BSAVE ["Filename"], addr, len 
.12 Fixed BLOAD syntax parsing
	BLOAD ["Filename"], addr[, len] 
.11 Fixed Go syntax parsing
	G StopAddress [SkipAddress,Length]
.10 Changed internal parsing of comma operator.
	It is now left in the command arguments.
This commit is contained in:
mpohoreski 2006-06-27 02:32:57 +00:00
parent 71c5f5616f
commit 78baf063e0
4 changed files with 82 additions and 32 deletions

View File

@ -230,7 +230,16 @@ Update_t CmdHelpSpecific (int nArgs)
nArgs = nNewArgs;
for (iArg = 1; iArg <= nArgs; iArg++ )
{
#if DEBUG_VAL_2
g_aArgs[ iArg ].nVal2 = iCmdBegin + iArg - 1;
#endif
// insert: ,#
_Args_Insert( iArg, nArgs, 2 );
g_aArgs[ iArg + 1 ].eToken = TOKEN_COMMA;
g_aArgs[ iArg + 2 ].nValue = iCmdBegin + iArg - 1;
nArgs += 2;
iArg += 2;
}
}
@ -243,7 +252,14 @@ Update_t CmdHelpSpecific (int nArgs)
if (bCategory)
{
if (g_aArgs[ iArg + 1 ].eToken == TOKEN_COMMA)
{
if ((iArg + 2) <= nArgs)
iCommand = g_aArgs[ iArg + 2 ].nValue;
}
#if DEBUG_VAL_2
iCommand = g_aArgs[iArg].nVal2;
#endif
nFound = 1;
}
@ -263,7 +279,7 @@ Update_t CmdHelpSpecific (int nArgs)
continue;
if ((nArgs == 1) && (! nFound))
iCommand = g_aArgs[iArg].nVal1;
iCommand = g_aArgs[iArg].nValue;
Command_t *pCommand = & g_aCommands[ iCommand ];
@ -379,13 +395,16 @@ Update_t CmdHelpSpecific (int nArgs)
ConsoleBufferPush( TEXT("i.e. #F (if you don't want flags val)" ) );
break;
case CMD_GO:
ConsoleBufferPush( TEXT(" Usage: [address | symbol [Skip,End]]") );
ConsoleBufferPush( TEXT(" Skip: Start address to skip stepping" ) );
ConsoleBufferPush( TEXT(" End : End address to skip stepping" ) );
ConsoleBufferPush( TEXT(" If the Program Counter is outside the" ) );
ConsoleBufferPush( TEXT(" skip range, resumes single-stepping." ) );
ConsoleBufferPush( TEXT(" Usage: address | symbol [Skip,Length]]") );
ConsoleBufferPush( TEXT(" addres | symbol [Start:End]") );
ConsoleBufferPush( TEXT(" Skip : Start address to skip stepping" ) );
ConsoleBufferPush( TEXT(" Length: Range of bytes past start address to skip stepping" ) );
ConsoleBufferPush( TEXT(" End : Inclusive end address to skip stepping" ) );
ConsoleBufferPush( TEXT(" If the Program Counter is outside the skip range, resumes single-stepping." ) );
ConsoleBufferPush( TEXT(" Can be used to skip ROM/OS/user code." ));
ConsoleBufferPush( TEXT(" i.e. G C600 F000,FFFF" ) );
ConsoleBufferPush( TEXT(" Examples:" ) );
ConsoleBufferPush( TEXT(" G C600 FA00,600" ) );
ConsoleBufferPush( TEXT(" G C600 F000:FFFF" ) );
break;
case CMD_NOP:
ConsoleBufferPush( TEXT(" Puts a NOP opcode at current instruction") );
@ -616,17 +635,22 @@ Update_t CmdHelpSpecific (int nArgs)
case CMD_MEMORY_LOAD:
// BLOAD "Filename" addr[,len]
ConsoleBufferPush( TEXT(" Usage: [\"Filename\"] address[,length]" ) );
ConsoleBufferPush( TEXT(" If no filename specified, defaults" ) );
ConsoleBufferPush( TEXT(" to the last filename (if possible)" ) );
ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],address[,length]" ) );
ConsoleBufferPush( TEXT(" If no filename specified, defaults to the last filename (if possible)" ) );
ConsoleBufferPush( TEXT(" Examples:" ) );
ConsoleBufferPush( TEXT(" BSAVE \"test\",FF00,100" ) );
ConsoleBufferPush( TEXT(" BLOAD \"test\",2000" ) );
break;
case CMD_MEMORY_SAVE:
// BSAVE ["Filename"] addr,len
ConsoleBufferPush( TEXT(" Usage: [\"Filename\"] address,length" ) );
ConsoleBufferPush( TEXT(" If no filename specified, defaults to" ) );
ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],address[,length]" ) );
ConsoleBufferPush( TEXT(" If no filename specified, defaults to:" ) );
ConsoleBufferPush( TEXT(" '####.####.bin' with the form" ) );
ConsoleBufferPush( TEXT(" {address}.{length}.bin" ) );
ConsoleBufferPush( TEXT(" Examples:" ) );
ConsoleBufferPush( TEXT(" BSAVE \"test\",FF00,100" ) );
ConsoleBufferPush( TEXT(" BLOAD \"test\",2000" ) );
break;
// Symbols

View File

@ -91,7 +91,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//===========================================================================
int _Arg_1( int nValue )
{
g_aArgs[1].nVal1 = nValue;
g_aArgs[1].nValue = nValue;
return 1;
}
@ -139,6 +139,28 @@ int _Arg_Shift( int iSrc, int iEnd, int iDst )
return nArgs;
}
//===========================================================================
int _Args_Insert( int iSrc, int iEnd, int nLen )
{
iSrc += nLen;
int iDst = iEnd + nLen;
if (iDst > MAX_ARGS)
return ARG_SYNTAX_ERROR;
if (iSrc > MAX_ARGS)
return ARG_SYNTAX_ERROR;
while (nLen--)
{
g_aArgs[iDst] = g_aArgs[iSrc];
iSrc--;
iDst--;
}
return 0;
}
//===========================================================================
void ArgsClear ()
@ -151,8 +173,10 @@ void ArgsClear ()
pArg->eDevice = NUM_DEVICES; // none
pArg->eToken = NO_TOKEN ; // none
pArg->bType = TYPE_STRING;
pArg->nVal1 = 0;
pArg->nValue = 0;
#if DEBUG_VAL_2
pArg->nVal2 = 0;
#endif
pArg->sArg[0] = 0;
pArg++;
@ -388,7 +412,7 @@ void ArgsRawParse ( void )
}
if (! (pArg->bType & TYPE_VALUE)) // already up to date?
pArg->nVal1 = nAddressValue;
pArg->nValue = nAddressValue;
pArg->bType |= TYPE_ADDRESS;
@ -487,7 +511,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
nAddressVal = nAddressSym;
pArg->bSymbol = true;
}
/*
if (bProcessMask & (1 << TOKEN_COMMA))
if (pArg->eToken == TOKEN_COMMA) // COMMMA , length
{
@ -507,7 +531,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
pPrev->bType |= TYPE_RANGE;
nParamLen = 2;
}
*/
if (bProcessMask & (1 << TOKEN_AMPERSAND))
if (pArg->eToken == TOKEN_AMPERSAND) // AND & delta
{
@ -515,7 +539,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
{
ArgsGetRegisterValue( pNext, & nAddressRHS );
}
pPrev->nVal1 &= nAddressRHS;
pPrev->nValue &= nAddressRHS;
pPrev->bType |= TYPE_VALUE; // signal already up to date
nParamLen = 2;
}
@ -527,7 +551,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
{
ArgsGetRegisterValue( pNext, & nAddressRHS );
}
pPrev->nVal1 |= nAddressRHS;
pPrev->nValue |= nAddressRHS;
pPrev->bType |= TYPE_VALUE; // signal already up to date
nParamLen = 2;
}
@ -539,7 +563,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
{
ArgsGetRegisterValue( pNext, & nAddressRHS );
}
pPrev->nVal1 ^= nAddressRHS;
pPrev->nValue ^= nAddressRHS;
pPrev->bType |= TYPE_VALUE; // signal already up to date
nParamLen = 2;
}
@ -551,7 +575,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
{
ArgsGetRegisterValue( pNext, & nAddressRHS );
}
pPrev->nVal1 += nAddressRHS;
pPrev->nValue += nAddressRHS;
pPrev->bType |= TYPE_VALUE; // signal already up to date
nParamLen = 2;
}
@ -563,7 +587,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
{
ArgsGetRegisterValue( pNext, & nAddressRHS );
}
pPrev->nVal1 -= nAddressRHS;
pPrev->nValue -= nAddressRHS;
pPrev->bType |= TYPE_VALUE; // signal already up to date
nParamLen = 2;
}
@ -575,7 +599,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
{
ArgsGetRegisterValue( pNext, & nAddressRHS );
}
pPrev->nVal1 %= nAddressRHS;
pPrev->nValue %= nAddressRHS;
pPrev->bType |= TYPE_VALUE; // signal already up to date
nParamLen = 2;
}
@ -594,7 +618,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
}
if (! nAddressRHS)
nAddressRHS = 1; // divide by zero bug
pPrev->nVal1 /= nAddressRHS;
pPrev->nValue /= nAddressRHS;
pPrev->bType |= TYPE_VALUE; // signal already up to date
nParamLen = 2;
}
@ -602,7 +626,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
if (bProcessMask & (1 << TOKEN_EQUAL))
if (pArg->eToken == TOKEN_EQUAL) // EQUAL = assign
{
pPrev->nVal1 = nAddressRHS;
pPrev->nValue = nAddressRHS;
pPrev->bType |= TYPE_VALUE; // signal already up to date
nParamLen = 0; // need token for Smart BreakPoints
}
@ -614,14 +638,14 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
_Arg_Shift( iArg + nParamLen, nArgs, iArg );
nArg--;
pArg->nVal1 = 0; // nAddressRHS;
pArg->nValue = 0; // nAddressRHS;
pArg->bSymbol = false;
int nPointers = g_vMemorySearchResults.size();
if ((nPointers) &&
(nAddressRHS < nPointers))
{
pArg->nVal1 = g_vMemorySearchResults.at( nAddressRHS );
pArg->nValue = g_vMemorySearchResults.at( nAddressRHS );
pArg->bType = TYPE_VALUE | TYPE_ADDRESS | TYPE_NO_REG | TYPE_NO_SYM;
}
nParamLen = 0;
@ -630,7 +654,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
if (bProcessMask & (1 << TOKEN_HASH))
if (pArg->eToken == TOKEN_HASH) // HASH # immediate
{
pArg->nVal1 = nAddressRHS;
pArg->nValue = nAddressRHS;
pArg->bSymbol = false;
pArg->bType = TYPE_VALUE | TYPE_ADDRESS | TYPE_NO_REG | TYPE_NO_SYM;
nParamLen = 0;
@ -658,7 +682,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
nAddressRHS = nAddressVal;
}
}
pArg->nVal1 = ~nAddressRHS;
pArg->nValue = ~nAddressRHS;
pArg->bType |= TYPE_VALUE; // signal already up to date
// Don't remove, since "SYM ! symbol" needs token to remove symbol
}
@ -696,7 +720,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
}
if (! (pArg->bType & TYPE_VALUE)) // already up to date?
pArg->nVal1 = nAddressVal;
pArg->nValue = nAddressVal;
pArg->bType |= TYPE_ADDRESS;
}

View File

@ -33,6 +33,7 @@
int _Arg_1 ( int nValue );
int _Arg_1 ( LPTSTR pName );
int _Arg_Shift ( int iSrc, int iEnd, int iDst = 0 );
int _Args_Insert( int iSrc, int iEnd, int nLen );
void ArgsClear ();
bool ArgsGetValue ( Arg_t *pArg, WORD * pAddressValue_, const int nBase = 16 );

View File

@ -1122,8 +1122,9 @@
{
TCHAR sArg[ MAX_ARG_LEN ]; // Array chars comes first, for alignment
int nArgLen; // Needed for TextSearch "ABC\x00"
WORD nVal1 ; // 2
WORD nVal2 ; // 2 If we have a Len (,)
WORD nValue ; // 2
// WORD nVal1 ; // 2
// WORD nVal2 ; // 2 If we have a Len (,)
// Enums and Bools should come last for alignment
ArgToken_e eToken ; // 1/2/4
int bType ; // 1/2/4 // Flags of ArgType_e