Too many fixes,changes,additions to mention...

Check debugger changelog details: 2.5.6.19 -> 2.5.6.41
This commit is contained in:
mpohoreski 2006-07-01 06:45:50 +00:00
parent dc0c89502e
commit eb168d6169
7 changed files with 1931 additions and 1354 deletions

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,9 @@ using namespace std;
extern Command_t g_aCommands[];
extern Command_t g_aParameters[];
// Config - FileName
extern char g_sFileNameConfig[];
// Cursor
extern WORD g_nDisasmTopAddress ;
extern WORD g_nDisasmBotAddress ;

View File

@ -934,7 +934,7 @@ bool AssemblerGetArgs( int iArg, int nArgs, WORD nBaseAddress )
m_nAsmBytes = 2;
}
else
if (iToken == TOKEN_LEFT_PAREN)
if (iToken == TOKEN_PAREN_L)
{
if (TestFlag( AF_HaveLeftParen ))
{
@ -947,7 +947,7 @@ bool AssemblerGetArgs( int iArg, int nArgs, WORD nBaseAddress )
m_iAsmAddressMode = AM_I;
}
else
if (iToken == TOKEN_RIGHT_PAREN)
if (iToken == TOKEN_PAREN_R)
{
if (TestFlag( AF_HaveRightParen ))
{

View File

@ -88,11 +88,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
int MAX_DISPLAY_REGS_LINES = 6;
int MAX_DISPLAY_STACK_LINES = 8;
int MAX_DISPLAY_BREAKPOINTS_LINES = 6; // 5
int MAX_DISPLAY_WATCHES_LINES = 6; // 5
int MAX_DISPLAY_MEMORY_LINES_1 = 4;
int MAX_DISPLAY_MEMORY_LINES_2 = 2;
int MAX_DISPLAY_ZEROPAGE_LINES = 5;
int MAX_DISPLAY_BREAKPOINTS_LINES = 7; // 6 // 5
int MAX_DISPLAY_WATCHES_LINES = 8; // 6 // 5
int MAX_DISPLAY_MEMORY_LINES_1 = 4; // 4
int MAX_DISPLAY_MEMORY_LINES_2 = 4; // 4 // 2
int MAX_DISPLAY_ZEROPAGE_LINES = 8;
int g_nDisplayMemoryLines;
// Height
@ -150,6 +150,11 @@ bool CanDrawDebugger()
//===========================================================================
int DebugDrawText ( LPCTSTR pText, RECT & rRect )
{
#if _DEBUG
if (! pText)
MessageBox( NULL, "pText = NULL!", "DrawText()", MB_OK );
#endif
int nLen = _tcslen( pText );
ExtTextOut( g_hDC,
rRect.left, rRect.top,
@ -164,10 +169,14 @@ int DebugDrawText ( LPCTSTR pText, RECT & rRect )
//===========================================================================
int DebugDrawTextFixed ( LPCTSTR pText, RECT & rRect )
{
int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg;
int nChars = 0;
if (pText)
{
int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg;
int nChars = DebugDrawText( pText, rRect );
rRect.left += (nFontWidth * nChars);
nChars = DebugDrawText( pText, rRect );
rRect.left += (nFontWidth * nChars);
}
return nChars;
}
@ -249,7 +258,7 @@ char FormatCharTxtHigh ( const BYTE b, bool *pWasHi_ )
{
if (pWasHi_)
{
*pWasHi_ = true;
*pWasHi_ = true;
}
c = (b & 0x7F);
}
@ -628,7 +637,7 @@ void DrawBreakpoints (HDC dc, int line)
int nRegLen = DebugDrawTextFixed( g_aBreakpointSource[ pBP->eSource ], rect2 );
// Pad to 2 chars
if (nRegLen < 2) // (g_aBreakpointSource[ pBP->eSource ][1] == 0) // HACK: Avoid strlen()
if (nRegLen < 2)
rect2.left += g_aFontConfig[ FONT_INFO ]._nFontWidthAvg;
SetBkColor( dc, DebuggerGetColor( BG_INFO ));
@ -636,8 +645,8 @@ void DrawBreakpoints (HDC dc, int line)
#if DEBUG_FORCE_DISPLAY
if (iBreakpoint < 3)
pBP->eOperator = (BreakpointOperator_t)(iBreakpoint * 2);
else
pBP->eOperator = (BreakpointOperator_t)(iBreakpoint-3 + BP_OP_READ);
// else
// pBP->eOperator = (BreakpointOperator_t)(iBreakpoint-3 + BP_OP_READ);
#endif
DebugDrawTextFixed( g_aBreakpointSymbols [ pBP->eOperator ], rect2 );
@ -692,7 +701,7 @@ void DrawBreakpoints (HDC dc, int line)
// rect2.left += g_nFontWidthAvg;
// }
DebugDrawTextFixed( TEXT("-"), rect2 );
DebugDrawTextFixed( TEXT(":"), rect2 );
// rect2.left += g_nFontWidthAvg;
// if (g_bConfigDisasmOpcodeSpaces) // TODO: Might have to remove spaces, for BPIO... addr-addr xx
// {
@ -919,7 +928,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text)
RECT linerect;
linerect.left = 0;
linerect.top = iLine * nFontHeight;
linerect.right = DISPLAY_DISASM_RIGHT; // HACK: MAGIC #: 14 -> g_nFontWidthAvg
linerect.right = DISPLAY_DISASM_RIGHT;
linerect.bottom = linerect.top + nFontHeight;
// BOOL bp = g_nBreakpoints && CheckBreakpoint(nBaseAddress,nBaseAddress == regs.pc);
@ -1241,11 +1250,20 @@ void DrawFlags (HDC dc, int line, WORD nRegFlags, LPTSTR pFlagNames_)
TCHAR sText[2] = TEXT("?");
RECT rect;
int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg;
// Regs are 10 chars across
// Flags are 8 chars across -- scale "up"
int nSpacerWidth = nFontWidth;
if (nFontWidth)
nSpacerWidth = (10 * nFontWidth) / 8;
nSpacerWidth++;
if (dc)
{
rect.left = DISPLAY_FLAG_COLUMN;
rect.top = line * g_nFontHeight;
rect.right = rect.left + 9;
rect.right = rect.left + (10 * nFontWidth);// nSpacerWidth; // nFontWidth = 80's look; // HACK: 9
rect.bottom = rect.top + g_nFontHeight;
SetBkColor(dc, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA
}
@ -1271,9 +1289,11 @@ void DrawFlags (HDC dc, int line, WORD nRegFlags, LPTSTR pFlagNames_)
SetBkColor(dc, DebuggerGetColor( BG_INFO ));
SetTextColor( dc, DebuggerGetColor( FG_INFO_TITLE ));
}
rect.left = DISPLAY_FLAG_COLUMN - ((_6502_NUM_FLAGS - 1 - nFlag) * nSpacerWidth);
rect.right = rect.left + nSpacerWidth;
DebugDrawText( sText, rect );
rect.left -= 9; // HACK: Font Width
rect.right -= 9; // HACK: Font Width
}
if (pFlagNames_)
@ -1483,10 +1503,12 @@ void DrawRegister (HDC dc, int line, LPCTSTR name, const int nBytes, const WORD
if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA))))
return;
int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg;
RECT rect;
rect.left = DISPLAY_REGS_COLUMN;
rect.top = line * g_nFontHeight;
rect.right = rect.left + 40; // TODO:FIXME: g_nFontWidthAvg *
rect.right = rect.left + (10 * nFontWidth) + 1;
rect.bottom = rect.top + g_nFontHeight;
if ((PARAM_REG_A == iSource) ||
@ -1501,7 +1523,11 @@ void DrawRegister (HDC dc, int line, LPCTSTR name, const int nBytes, const WORD
{
SetTextColor(dc, DebuggerGetColor( FG_INFO_TITLE ));
}
SetBkColor(dc, DebuggerGetColor( BG_INFO ));
// 2.6.0.0 Alpha - Regs not "boxed"
int iBackground = BG_DATA_1; // BG_INFO
SetBkColor(dc, DebuggerGetColor( iBackground ));
DebugDrawText( name, rect );
unsigned int nData = nValue;
@ -1527,16 +1553,17 @@ void DrawRegister (HDC dc, int line, LPCTSTR name, const int nBytes, const WORD
}
else
{
rect.left = DISPLAY_REGS_COLUMN + 21; // HACK: MAGIC #: 21 // +3 chars
rect.right = SCREENSPLIT2;
rect.left = DISPLAY_REGS_COLUMN + (3 * nFontWidth);
// rect.right = SCREENSPLIT2;
SetTextColor(dc, DebuggerGetColor( FG_INFO_OPERATOR ));
DebugDrawTextFixed( TEXT("'"), rect ); // DebugDrawTextFixed
ColorizeSpecialChar( dc, sValue, nData, MEM_VIEW_ASCII ); // MEM_VIEW_APPLE for inverse background little hard on the eyes
SetBkColor(dc, DebuggerGetColor( iBackground ));
DebugDrawTextFixed( sValue, rect ); // DebugDrawTextFixed()
SetBkColor(dc, DebuggerGetColor( BG_INFO ));
SetTextColor(dc, DebuggerGetColor( FG_INFO_OPERATOR ));
DebugDrawTextFixed( TEXT("'"), rect ); // DebugDrawTextFixed()
@ -1544,8 +1571,8 @@ void DrawRegister (HDC dc, int line, LPCTSTR name, const int nBytes, const WORD
}
// Needs to be far enough over, since 4 chars of ZeroPage symbol also calls us
rect.left = DISPLAY_REGS_COLUMN + (nOffset * g_aFontConfig[ FONT_INFO ]._nFontWidthAvg); // HACK: MAGIC #: 40
rect.right = SCREENSPLIT2;
rect.left = DISPLAY_REGS_COLUMN + (nOffset * nFontWidth);
// rect.right = SCREENSPLIT2;
if ((PARAM_REG_PC == iSource) || (PARAM_REG_SP == iSource)) // Stack Pointer is target address, but doesn't look as good.
{
@ -1610,14 +1637,12 @@ void DrawStack (HDC dc, int line)
RECT rect;
rect.left = DISPLAY_STACK_COLUMN;
rect.top = (iStack+line) * g_nFontHeight;
// rect.right = DISPLAY_STACK_COLUMN + 40;
// rect.right = SCREENSPLIT2;
rect.right = rect.left + (10 * nFontWidth) + 1;
rect.bottom = rect.top + g_nFontHeight;
SetTextColor(dc, DebuggerGetColor( FG_INFO_TITLE )); // [COLOR_STATIC
// BG_SOURCE_2 = grey
SetBkColor(dc, DebuggerGetColor( BG_DATA_1 )); // BG_INFO
// 2.6.0.0 Alpha - Stack was dark cyan BG_DATA_1
SetBkColor(dc, DebuggerGetColor( BG_INFO )); // BG_INFO
TCHAR sText[8] = TEXT("");
if (nAddress <= _6502_STACK_END)
@ -1627,8 +1652,6 @@ void DrawStack (HDC dc, int line)
DebugDrawTextFixed( sText, rect );
// rect.left = DISPLAY_STACK_COLUMN + 40; // TODO/FIXME/HACK MAGIC #: g_nFontWidthAvg *
// rect.right = SCREENSPLIT2;
SetTextColor(dc, DebuggerGetColor( FG_INFO_OPCODE )); // COLOR_FG_DATA_TEXT
if (nAddress <= _6502_STACK_END)
@ -1678,7 +1701,6 @@ void DrawTargets (HDC dc, int line)
rect.left = DISPLAY_TARGETS_COLUMN;
rect.top = (line+iAddress) * g_nFontHeight;
// int nColumn = DISPLAY_TARGETS_COLUMN + 40; // TODO/FIXME/HACK MAGIC #: g_nFontWidthAvg *
int nColumn = rect.left + (7 * nFontWidth);
rect.right = nColumn;
rect.bottom = rect.top + g_nFontHeight;
@ -1763,8 +1785,8 @@ void DrawWatches (HDC dc, int line)
DebugDrawTextFixed( sText, rect2 );
}
rect.top += g_nFontHeight; // HACK:
rect.bottom += g_nFontHeight; // HACK:
rect.top += g_nFontHeight;
rect.bottom += g_nFontHeight;
}
}
@ -2251,18 +2273,20 @@ void DrawWindow_ZeroPage( Update_t bUpdate )
//===========================================================================
void DrawWindowBackground_Main( int g_iWindowThis )
{
RECT viewportrect;
viewportrect.left = 0;
viewportrect.top = 0;
viewportrect.right = SCREENSPLIT1 - 6; // HACK: MAGIC #: 14 -> 6 -> (g_nFonWidthAvg-1)
viewportrect.bottom = DISPLAY_HEIGHT - DEFAULT_HEIGHT; // 368 = 23 lines // TODO/FIXME
int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg;
RECT viewportrect;
viewportrect.left = 0;
viewportrect.top = 0;
viewportrect.right = SCREENSPLIT1 - nFontWidth; // HACK: MAGIC #: 14 -> 6 -> (g_nFonWidthAvg-1)
viewportrect.bottom = DISPLAY_HEIGHT - DEFAULT_HEIGHT; // 368 = 23 lines // TODO/FIXME
// g_nFontHeight * g_nDisasmWinHeight; // 304
// TODO/FIXME: COLOR_BG_CODE -> g_iWindowThis, once all tab backgrounds are listed first in g_aColors !
SetBkColor(g_hDC, DebuggerGetColor( BG_DISASM_1 )); // COLOR_BG_CODE
SetBkColor(g_hDC, DebuggerGetColor( BG_DISASM_1 )); // COLOR_BG_CODE
// Can't use DebugDrawText, since we don't need CLIPPED
ExtTextOut(g_hDC,0,0,ETO_OPAQUE,&viewportrect,TEXT(""),0,NULL);
ExtTextOut(g_hDC,0,0,ETO_OPAQUE,&viewportrect,TEXT(""),0,NULL);
}
//===========================================================================

View File

@ -54,7 +54,7 @@ bool TestStringCat ( TCHAR * pDst, LPCSTR pSrc, const int nDstSize )
int nSpcDst = nDstSize - nLenDst;
int nChars = MIN( nLenSrc, nSpcDst );
bool bOverflow = (nSpcDst < nLenSrc);
bool bOverflow = (nSpcDst <= nLenSrc); // 2.5.6.25 BUGFIX
if (bOverflow)
{
return false;
@ -126,6 +126,61 @@ Update_t Help_Arg_1( int iCommandHelp )
}
//===========================================================================
void Help_Range()
{
ConsoleBufferPush( TEXT(" Where <range> is of the form:" ) );
ConsoleBufferPush( TEXT(" address , length [address,address+length)" ) );
ConsoleBufferPush( TEXT(" address : end [address,end]" ) );
}
//===========================================================================
void Help_Operators()
{
ConsoleBufferPush( TEXT(" Operators: (Math)" ) );
ConsoleBufferPush( TEXT(" + Addition" ) );
ConsoleBufferPush( TEXT(" - Subtraction" ) );
ConsoleBufferPush( TEXT(" * Multiplication" ) );
ConsoleBufferPush( TEXT(" / Division" ) );
ConsoleBufferPush( TEXT(" % Modulas / Remainder" ) );
ConsoleBufferPush( TEXT(" Operators: (Bit Wise)" ) );
ConsoleBufferPush( TEXT(" & Bit-wise and (AND)" ) );
ConsoleBufferPush( TEXT(" | Bit-wise or (OR )" ) );
ConsoleBufferPush( TEXT(" ^ Bit-wise exclusive-or (EOR/XOR)" ) );
ConsoleBufferPush( TEXT(" ! Bit-wise negation (NOT)" ) );
ConsoleBufferPush( TEXT(" Operators: (Input)" ) );
ConsoleBufferPush( TEXT(" @ next number refers to search results" ) );
ConsoleBufferPush( TEXT(" \" Designate string in ASCII format" ) );
ConsoleBufferPush( TEXT(" \' Desginate string in High-Bit apple format" ) );
ConsoleBufferPush( TEXT(" $ Designate number/symbol" ) );
ConsoleBufferPush( TEXT(" # Designate number in hex" ) );
ConsoleBufferPush( TEXT(" Operators: (Range)" ) );
ConsoleBufferPush( TEXT(" , range seperator (2nd address is relative)" ) );
ConsoleBufferPush( TEXT(" : range seperator (2nd address is absolute)" ) );
ConsoleBufferPush( TEXT(" Operators: (Misc)" ) );
ConsoleBufferPush( TEXT(" // comment until end of line" ) );
ConsoleBufferPush( TEXT(" Operators: (Breakpoint)" ) );
TCHAR sText[ CONSOLE_WIDTH ];
_tcscpy( sText, " " );
int iBreakOp = 0;
for( iBreakOp = 0; iBreakOp < NUM_BREAKPOINT_OPERATORS; iBreakOp++ )
{
// if (iBreakOp == PARAM_BP_LESS_EQUAL)
// continue;
// if (iBreakOp == PARAM_BP_GREATER_EQUAL)
// continue;
if ((iBreakOp >= PARAM_BP_LESS_EQUAL) &&
(iBreakOp <= PARAM_BP_GREATER_EQUAL))
{
_tcscat( sText, g_aBreakpointSymbols[ iBreakOp ] );
_tcscat( sText, " " );
}
}
ConsoleBufferPush( sText );
}
//===========================================================================
Update_t CmdMOTD( int nArgs )
@ -164,8 +219,15 @@ Update_t CmdHelpSpecific (int nArgs)
_tcscpy( sText, TEXT("Usage: [< ") );
for (int iCategory = _PARAM_HELPCATEGORIES_BEGIN ; iCategory < _PARAM_HELPCATEGORIES_END; iCategory++)
{
#if _DEBUG
// if (iCategory == (PARAM_CAT_ZEROPAGE - 1))
// {
// int nLen = _tcslen( sText );
// bool bStop = true;
// }
#endif
TCHAR *pName = g_aParameters[ iCategory ].m_sName;
if (! TestStringCat( sText, pName, CONSOLE_WIDTH - 2 )) // CONSOLE_WIDTH // g_nConsoleDisplayWidth - 3
if (! TestStringCat( sText, pName, CONSOLE_WIDTH - 4 )) // CONSOLE_WIDTH // g_nConsoleDisplayWidth - 3
{
ConsoleBufferPush( sText );
_tcscpy( sText, TEXT(" ") );
@ -174,19 +236,20 @@ Update_t CmdHelpSpecific (int nArgs)
StringCat( sText, pName, CONSOLE_WIDTH );
if (iCategory < (_PARAM_HELPCATEGORIES_END - 1))
{
StringCat( sText, TEXT(" | "), CONSOLE_WIDTH );
StringCat( sText, TEXT(" | "), CONSOLE_WIDTH - 1 );
}
}
StringCat( sText, TEXT(" >]"), CONSOLE_WIDTH );
StringCat( sText, TEXT(" >]"), CONSOLE_WIDTH - 3 );
ConsoleBufferPush( sText );
wsprintf( sText, TEXT("Note: [] = optional, <> = mandatory"), CONSOLE_WIDTH );
ConsoleBufferPush( sText );
}
CmdFuncPtr_t pFunction = NULL;
bool bAllCommands = false;
bool bCategory = false;
bool bDisplayCategory = true;
if ((! _tcscmp( g_aArgs[1].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName)) ||
(! _tcscmp( g_aArgs[1].sArg, g_aParameters[ PARAM_MEM_SEARCH_WILD ].m_sName)) )
@ -203,6 +266,8 @@ Update_t CmdHelpSpecific (int nArgs)
int nNewArgs = 0;
int iCmdBegin = 0;
int iCmdEnd = 0;
int nFound = 0;
int iCommand = 0;
if (! bAllCommands)
{
@ -210,22 +275,48 @@ Update_t CmdHelpSpecific (int nArgs)
{
// int nFoundCategory = FindParam( g_aArgs[ iArg ].sArg, MATCH_EXACT, iParam, _PARAM_HELPCATEGORIES_BEGIN, _PARAM_HELPCATEGORIES_END );
int nFoundCategory = FindParam( g_aArgs[ iArg ].sArg, MATCH_FUZZY, iParam, _PARAM_HELPCATEGORIES_BEGIN, _PARAM_HELPCATEGORIES_END );
bCategory = true;
switch( iParam )
{
case PARAM_CAT_BOOKMARKS : iCmdBegin = CMD_BOOKMARK_MENU ; iCmdEnd = CMD_BOOKMARK_SAVE ; break;
case PARAM_CAT_BOOKMARKS : iCmdBegin = CMD_BOOKMARK ; iCmdEnd = CMD_BOOKMARK_SAVE ; break;
case PARAM_CAT_BREAKPOINTS: iCmdBegin = CMD_BREAKPOINT ; iCmdEnd = CMD_BREAKPOINT_SAVE ; break;
case PARAM_CAT_CONFIG : iCmdBegin = CMD_CONFIG_COLOR ; iCmdEnd = CMD_CONFIG_SAVE ; break;
case PARAM_CAT_CONFIG : iCmdBegin = CMD_BENCHMARK ; iCmdEnd = CMD_CONFIG_SAVE ; break;
case PARAM_CAT_CPU : iCmdBegin = CMD_ASSEMBLE ; iCmdEnd = CMD_UNASSEMBLE ; break;
case PARAM_CAT_FLAGS : iCmdBegin = CMD_FLAG_CLEAR ; iCmdEnd = CMD_FLAG_SET_N ; break;
case PARAM_CAT_HELP : iCmdBegin = CMD_HELP_LIST ; iCmdEnd = CMD_MOTD ; break;
case PARAM_CAT_MEMORY : iCmdBegin = CMD_MEMORY_COMPARE ; iCmdEnd = CMD_MEMORY_FILL ; break;
case PARAM_CAT_OUTPUT : iCmdBegin = CMD_OUTPUT_CALC ; iCmdEnd = CMD_OUTPUT_RUN ; break;
case PARAM_CAT_REGISTERS : iCmdBegin = CMD_REGISTER_SET ; iCmdEnd = CMD_REGISTER_SET ; break;
case PARAM_CAT_SYMBOLS : iCmdBegin = CMD_SYMBOLS_LOOKUP ; iCmdEnd = CMD_SYMBOLS_LIST ; break;
case PARAM_CAT_SYMBOLS :
// HACK: check if we have an exact command match first
nFound = FindCommand( g_aArgs[iArg].sArg, pFunction, & iCommand );
if (nFound && (iCommand != CMD_SYMBOLS_LOOKUP) && (iCommand != CMD_MEMORY_SEARCH))
{
iCmdBegin = CMD_SYMBOLS_LOOKUP ; iCmdEnd = CMD_SYMBOLS_LIST ; break;
bCategory = true;
}
else
bCategory = false;
break;
case PARAM_CAT_WATCHES : iCmdBegin = CMD_WATCH_ADD ; iCmdEnd = CMD_WATCH_LIST ; break;
case PARAM_CAT_WINDOW : iCmdBegin = CMD_WINDOW ; iCmdEnd = CMD_WINDOW_OUTPUT ; break;
case PARAM_CAT_ZEROPAGE : iCmdBegin = CMD_ZEROPAGE_POINTER; iCmdEnd = CMD_ZEROPAGE_POINTER_SAVE;break;
default: break;
// case PARAM_CAT_EXPRESSION : // fall-through
case PARAM_CAT_OPERATORS : nArgs = 0; Help_Operators(); break;
case PARAM_CAT_RANGE :
// HACK: check if we have an exact command match first
nFound = FindCommand( g_aArgs[iArg].sArg, pFunction, & iCommand );
if ((!nFound) || (iCommand != CMD_REGISTER_SET))
{
nArgs = 0;
Help_Range();
}
bCategory = false;
break;
default:
bCategory = false;
break;
}
if (iCmdEnd)
iCmdEnd++;
@ -237,8 +328,6 @@ Update_t CmdHelpSpecific (int nArgs)
if (nNewArgs > 0)
{
bCategory = true;
nArgs = nNewArgs;
for (iArg = 1; iArg <= nArgs; iArg++ )
{
@ -249,12 +338,10 @@ Update_t CmdHelpSpecific (int nArgs)
}
}
CmdFuncPtr_t pFunction;
for (iArg = 1; iArg <= nArgs; iArg++ )
{
int iCommand = 0;
int nFound = 0;
iCommand = 0;
nFound = 0;
if (bCategory)
{
@ -294,67 +381,63 @@ Update_t CmdHelpSpecific (int nArgs)
pCommand = NULL;
}
if (nFound && (! bAllCommands) && (! bCategory))
// if (nFound && (! bAllCommands) && (! bCategory))
if (nFound && (! bAllCommands) && bDisplayCategory)
{
TCHAR sCategory[ CONSOLE_WIDTH ];
int iCmd = g_aCommands[ iCommand ].iCommand; // Unaliased command
// HACK: Major kludge to display category!!!
if (iCmd <= CMD_UNASSEMBLE)
wsprintf( sCategory, "Main" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_CPU ].m_sName );
else
if (iCmd <= CMD_BOOKMARK_SAVE)
wsprintf( sCategory, "Bookmark" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_BOOKMARKS ].m_sName );
else
if (iCmd <= CMD_BREAKPOINT_SAVE)
wsprintf( sCategory, "Breakpoint" );
else
if (iCmd <= CMD_PROFILE)
wsprintf( sCategory, "Profile" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_BREAKPOINTS ].m_sName );
else
if (iCmd <= CMD_CONFIG_SAVE)
wsprintf( sCategory, "Config" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_CONFIG ].m_sName );
else
if (iCmd <= CMD_CURSOR_PAGE_DOWN_4K)
wsprintf( sCategory, "Scrolling" );
else
if (iCmd <= CMD_FLAG_SET_N)
wsprintf( sCategory, "Flags" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_FLAGS ].m_sName );
else
if (iCmd <= CMD_MOTD)
wsprintf( sCategory, "Help" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_HELP ].m_sName );
else
if (iCmd <= CMD_MEMORY_FILL)
wsprintf( sCategory, "Memory" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_MEMORY ].m_sName );
else
if (iCmd <= CMD_OUTPUT_RUN)
wsprintf( sCategory, "Output" );
else
if (iCmd <= CMD_REGISTER_SET)
wsprintf( sCategory, "Registers" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_OUTPUT ].m_sName );
else
if (iCmd <= CMD_SYNC)
wsprintf( sCategory, "Source" );
else
if (iCmd <= CMD_STACK_PUSH)
wsprintf( sCategory, "Stack" );
else
if (iCmd <= CMD_SYMBOLS_LIST)
wsprintf( sCategory, "Symbols" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_SYMBOLS ].m_sName );
else
if (iCmd <= CMD_WATCH_SAVE)
wsprintf( sCategory, "Watch" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_WATCHES ].m_sName );
else
if (iCmd <= CMD_WINDOW_OUTPUT)
wsprintf( sCategory, "Window" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_WINDOW ].m_sName );
else
if (iCmd <= CMD_ZEROPAGE_POINTER_SAVE)
wsprintf( sCategory, "Zero Page" );
wsprintf( sCategory, g_aParameters[ PARAM_CAT_ZEROPAGE ].m_sName );
else
wsprintf( sCategory, "Unknown!" );
wsprintf( sText, "Category: %s", sCategory );
ConsoleBufferPush( sText );
if (bCategory)
if (bDisplayCategory)
bDisplayCategory = false;
}
if (pCommand)
@ -362,10 +445,13 @@ Update_t CmdHelpSpecific (int nArgs)
char *pHelp = pCommand->pHelpSummary;
if (pHelp)
{
wsprintf( sText, "%s, ", pCommand->m_sName );
if (bCategory)
wsprintf( sText, "%8s, ", pCommand->m_sName );
else
wsprintf( sText, "%s, ", pCommand->m_sName );
if (! TryStringCat( sText, pHelp, g_nConsoleDisplayWidth ))
{
if (! TryStringCat( sText, pHelp, CONSOLE_WIDTH ))
if (! TryStringCat( sText, pHelp, CONSOLE_WIDTH-1 ))
{
StringCat( sText, pHelp, CONSOLE_WIDTH );
ConsoleBufferPush( sText );
@ -375,7 +461,8 @@ Update_t CmdHelpSpecific (int nArgs)
}
else
{
wsprintf( sText, "%s", pCommand->m_sName );
#if _DEBUG
wsprintf( sText, "%s <-- Missing", pCommand->m_sName );
ConsoleBufferPush( sText );
#if DEBUG_COMMAND_HELP
if (! bAllCommands) // Release version doesn't display message
@ -384,7 +471,11 @@ Update_t CmdHelpSpecific (int nArgs)
ConsoleBufferPush( sText );
}
#endif
#endif
}
if (bCategory)
continue;
}
// MASTER HELP
@ -430,8 +521,20 @@ Update_t CmdHelpSpecific (int nArgs)
ConsoleBufferPush( sText );
ConsoleBufferPush( TEXT(" No arguments resets the profile.") );
break;
// Registers
case CMD_REGISTER_SET:
wsprintf( sText, TEXT(" Usage: <reg> <value | expression | symbol>" ) ); ConsoleBufferPush( sText );
ConsoleBufferPush( TEXT(" Where <reg> is one of: A X Y PC SP ") );
wsprintf( sText, TEXT(" See also: %s" ), g_aParameters[ PARAM_CAT_OPERATORS ].m_sName ); ConsoleBufferPush( sText );
ConsoleBufferPush( TEXT(" Examples:") );
ConsoleBufferPush( TEXT(" R PC RESET + 1") );
ConsoleBufferPush( TEXT(" R PC $FC58") );
ConsoleBufferPush( TEXT(" R A A1") );
ConsoleBufferPush( TEXT(" R A $A1") );
ConsoleBufferPush( TEXT(" R A #A1") );
break;
case CMD_SOURCE:
ConsoleBufferPush( TEXT(" Reads assembler source file." ) );
// ConsoleBufferPush( TEXT(" Reads assembler source file." ) );
wsprintf( sText, TEXT(" Usage: [ %s | %s ] \"filename\"" ), g_aParameters[ PARAM_SRC_MEMORY ].m_sName, g_aParameters[ PARAM_SRC_SYMBOLS ].m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" %s: read source bytes into memory." ), g_aParameters[ PARAM_SRC_MEMORY ].m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" %s: read symbols into Source symbol table."), g_aParameters[ PARAM_SRC_SYMBOLS ].m_sName ); ConsoleBufferPush( sText );
@ -461,11 +564,15 @@ Update_t CmdHelpSpecific (int nArgs)
ConsoleBufferPush( TEXT(" with cycle counting." ) );
break;
// Bookmarks
case CMD_BOOKMARK_MENU:
case CMD_BOOKMARK:
case CMD_BOOKMARK_ADD:
ConsoleBufferPush( TEXT(" Usage: # <address | symbol>") );
ConsoleBufferPush( TEXT(" Add specified bookmark.") );
wsprintf( sText, TEXT(" i.e. %s 1 RESET" ), pCommand->m_sName );
ConsoleBufferPush(" Usage: [address | symbol]" );
ConsoleBufferPush(" Usage: # <address | symbol>" );
ConsoleBufferPush(" If no address or symbol is specified, lists the current bookmarks." );
ConsoleBufferPush(" Updates the specified bookmark (#)" );
wsprintf( sText, TEXT(" i.e. %s RESET" ), pCommand->m_sName );
ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" i.e. %s 1 HOME" ), pCommand->m_sName );
ConsoleBufferPush( sText );
break;
case CMD_BOOKMARK_CLEAR:
@ -475,7 +582,7 @@ Update_t CmdHelpSpecific (int nArgs)
ConsoleBufferPush( sText );
break;
case CMD_BOOKMARK_LIST:
case CMD_BOOKMARK_LOAD:
// case CMD_BOOKMARK_LOAD:
case CMD_BOOKMARK_SAVE:
break;
// Breakpoints
@ -491,8 +598,16 @@ Update_t CmdHelpSpecific (int nArgs)
ConsoleBufferPush( TEXT(" Loading/Saving not yet implemented.") );
break;
case CMD_BREAKPOINT_ADD_REG:
ConsoleBufferPush( TEXT(" Usage: [A|X|Y|PC|S] [<,=,>] value") );
ConsoleBufferPush( TEXT(" Set breakpoint when reg is [op] value") );
ConsoleBufferPush( " Usage: [A|X|Y|PC|S] [op] <range | value>" );
ConsoleBufferPush( " Set breakpoint when reg is [op] value" );
ConsoleBufferPush( " Default operator is '='" );
wsprintf( sText, " See also: %s", g_aParameters[ PARAM_CAT_OPERATORS ].m_sName ); ConsoleBufferPush( sText );
ConsoleBufferPush( " Examples:" );
wsprintf( sText, " %s PC < D000", pCommand->m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, " %s PC = F000:FFFF PC < D000,1000", pCommand->m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, " %s A <= D5" , pCommand->m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, " %s A != 01:FF" , pCommand->m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, " %s X = A5" , pCommand->m_sName ); ConsoleBufferPush( sText );
break;
case CMD_BREAKPOINT_ADD_SMART:
ConsoleBufferPush( TEXT(" Usage: [address | register]") );
@ -527,13 +642,16 @@ Update_t CmdHelpSpecific (int nArgs)
break;
case CMD_BREAKPOINT_LIST:
break;
// Config - Color
case CMD_CONFIG_MENU:
ConsoleBufferPush( TEXT(" Load/Save configuration, or change disasm view options." ) );
wsprintf( sText, TEXT(" %s" ": Loads config from last/default \"filename\"" ), g_aParameters[ PARAM_SAVE ].m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" %s" ": Saves config to \"filename\"" ), g_aParameters[ PARAM_LOAD ].m_sName ); ConsoleBufferPush( sText );
// Config - Load / Save
case CMD_CONFIG_LOAD:
ConsoleBufferPush( TEXT(" Usage: [\"filename\"]" ) );
wsprintf( sText, TEXT(" Load debugger configuration from '%s', or the specificed file." ), g_sFileNameConfig ); ConsoleBufferPush( sText );
break;
case CMD_CONFIG_SAVE:
ConsoleBufferPush( TEXT(" Usage: [\"filename\"]" ) );
wsprintf( sText, TEXT(" Save debugger configuration to '%s', or the specificed file." ), g_sFileNameConfig ); ConsoleBufferPush( sText );
break;
// Config - Color
case CMD_CONFIG_COLOR:
ConsoleBufferPush( TEXT(" Usage: [<#> | <# RR GG BB>]" ) );
ConsoleBufferPush( TEXT(" 0 params: switch to 'color' scheme" ) );
@ -656,34 +774,35 @@ Update_t CmdHelpSpecific (int nArgs)
break;
case CMD_MEMORY_LOAD:
// BLOAD "Filename" addr[,len]
case CMD_MEMORY_SAVE:
// BSAVE ["Filename"] addr,len
if (iCommand == CMD_MEMORY_LOAD)
{
ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],address[,length]" ) );
ConsoleBufferPush( TEXT(" If no filename specified, defaults to the last filename (if possible)" ) );
ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],range" ) );
Help_Range();
ConsoleBufferPush( TEXT(" Notes: If no filename specified, defaults to the last filename (if possible)" ) );
}
if (iCommand == CMD_MEMORY_SAVE)
{
ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],address[,length]" ) );
ConsoleBufferPush( TEXT(" If no filename specified, defaults to: '####.####.bin'" ) );
ConsoleBufferPush( TEXT(" Where the form is <address>.<length>.bin" ) );
ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],address,length" ) );
ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],range" ) );
Help_Range();
ConsoleBufferPush( TEXT(" Notes: If no filename specified, defaults to: '####.####.bin'" ) );
ConsoleBufferPush( TEXT(" Where the form is <address>.<length>.bin" ) );
}
ConsoleBufferPush( TEXT(" Examples:" ) );
ConsoleBufferPush( TEXT(" BSAVE \"test\",FF00,100" ) );
ConsoleBufferPush( TEXT(" BLOAD \"test\",2000" ) );
ConsoleBufferPush( TEXT(" BLOAD \"test\",2000:2010" ) );
ConsoleBufferPush( TEXT(" BSAVE \"test\",F000:FFFF" ) );
ConsoleBufferPush( TEXT(" BLOAD \"test\",4000" ) );
break;
case CMD_MEMORY_SEARCH:
ConsoleBufferPush( TEXT(" Usage: range <\"ASCII text\" | 'apple text' | hex>" ) );
ConsoleBufferPush( TEXT(" Where <range> is of the form:" ) );
ConsoleBufferPush( TEXT(" address,length" ) );
ConsoleBufferPush( TEXT(" start : end" ) );
Help_Range();
ConsoleBufferPush( TEXT(" Where text is of the form:") );
ConsoleBufferPush( TEXT(" \"...\" designate ASCII text") );
ConsoleBufferPush( TEXT(" '...' designate Apple High-Bit text") );
ConsoleBufferPush( TEXT(" \"...\" designate ASCII text") );
ConsoleBufferPush( TEXT(" '...' designate Apple High-Bit text") );
ConsoleBufferPush( TEXT(" Examples: (Text)" ) );
wsprintf( sText, TEXT(" %s F000,1000 'Apple' // search High-Bit" ), pCommand->m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" MT1 @2" ), pCommand->m_sName ); ConsoleBufferPush( sText );
@ -695,15 +814,13 @@ Update_t CmdHelpSpecific (int nArgs)
break;
case CMD_MEMORY_SEARCH_HEX:
ConsoleBufferPush( TEXT(" Usage: range [text | byte1 [byte2 ...]]" ) );
ConsoleBufferPush( TEXT(" Where <range> is of the form:" ) );
ConsoleBufferPush( TEXT(" address , length" ) );
ConsoleBufferPush( TEXT(" address : end" ) );
Help_Range();
ConsoleBufferPush( TEXT(" Where <byte> is of the form:") );
ConsoleBufferPush( TEXT(" ## match specific byte") );
ConsoleBufferPush( TEXT(" #### match specific 16-bit value") );
ConsoleBufferPush( TEXT(" ? match any byte") );
ConsoleBufferPush( TEXT(" ?# match any high nibble, match low nibble to specific number") );
ConsoleBufferPush( TEXT(" #? match specific high nibble, match any low nibble") );
ConsoleBufferPush( TEXT(" ## match specific byte") );
ConsoleBufferPush( TEXT(" #### match specific 16-bit value") );
ConsoleBufferPush( TEXT(" ? match any byte") );
ConsoleBufferPush( TEXT(" ?# match any high nibble, match low nibble to specific number") );
ConsoleBufferPush( TEXT(" #? match specific high nibble, match any low nibble") );
ConsoleBufferPush( TEXT(" Examples: (Hex)" ) );
wsprintf( sText, TEXT(" %s F000,1000 AD ? C0" ), pCommand->m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" U @1" ), pCommand->m_sName ); ConsoleBufferPush( sText );
@ -714,13 +831,12 @@ Update_t CmdHelpSpecific (int nArgs)
wsprintf( sText, TEXT(" %s F000:FFFF C030" ), pCommand->m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" U @1 - 1" ), pCommand->m_sName ); ConsoleBufferPush( sText );
break;
case CMD_MEMORY_SEARCH_APPLE:
wsprintf( sText, TEXT("Deprecated. Use: %s" ), g_aCommands[ CMD_MEMORY_SEARCH ].m_sName ); ConsoleBufferPush( sText );
break;
case CMD_MEMORY_SEARCH_ASCII:
wsprintf( sText, TEXT("Deprecated. Use: %s" ), g_aCommands[ CMD_MEMORY_SEARCH ].m_sName ); ConsoleBufferPush( sText );
break;
// case CMD_MEMORY_SEARCH_APPLE:
// wsprintf( sText, TEXT("Deprecated. Use: %s" ), g_aCommands[ CMD_MEMORY_SEARCH ].m_sName ); ConsoleBufferPush( sText );
// break;
// case CMD_MEMORY_SEARCH_ASCII:
// wsprintf( sText, TEXT("Deprecated. Use: %s" ), g_aCommands[ CMD_MEMORY_SEARCH ].m_sName ); ConsoleBufferPush( sText );
// break;
// Output
case CMD_OUTPUT_CALC:
ConsoleBufferPush( TEXT(" Usage: <address | symbol | expression >" ) );
@ -739,6 +855,7 @@ Update_t CmdHelpSpecific (int nArgs)
break;
case CMD_OUTPUT_PRINT:
ConsoleBufferPush( TEXT(" Usage: <string | expression> [, string | expression]*" ) );
ConsoleBufferPush( TEXT(" Note: To print Register values, they must be in upper case" ) );
ConsoleBufferPush( TEXT(" Examples:") );
wsprintf( sText, TEXT(" %s \"A:\",A,\" X:\",X"), pCommand->m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" %s A,\" \",X,\" \",Y" ), pCommand->m_sName ); ConsoleBufferPush( sText );
@ -754,6 +871,13 @@ Update_t CmdHelpSpecific (int nArgs)
break;
// Symbols
case CMD_SYMBOLS_LOOKUP:
ConsoleBufferPush( TEXT(" Usage: symbol [= <address>]" ) );
ConsoleBufferPush( TEXT(" Examples:" ) );
wsprintf( sText, TEXT(" %s HOME" ),pCommand->m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" %s LIFE = 2000" ),pCommand->m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" %s LIFE" ),pCommand->m_sName ); ConsoleBufferPush( sText );
break;
case CMD_SYMBOLS_MAIN:
case CMD_SYMBOLS_USER:
case CMD_SYMBOLS_SRC :
@ -764,14 +888,18 @@ Update_t CmdHelpSpecific (int nArgs)
// ConsoleBufferPush( TEXT(" LOAD: Loads symbols from last/default filename" ) );
// ConsoleBufferPush( TEXT(" SAVE: Saves symbol table to file" ) );
// ConsoleBufferPush( TEXT(" CLEAR: Clears the symbol table" ) );
ConsoleBufferPush( TEXT(" Usage: [ ... | symbol | address ]") );
ConsoleBufferPush( TEXT(" Where ... is one of:" ) );
ConsoleBufferPush( TEXT(" Usage: [ <cmd> | symbol | address ]") );
ConsoleBufferPush( TEXT(" Where <cmd> is one of:" ) );
wsprintf( sText, TEXT(" %s " ": Turns symbols on in the disasm window" ), g_aParameters[ PARAM_ON ].m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" %s " ": Turns symbols off in the disasm window" ), g_aParameters[ PARAM_OFF ].m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" %s" ": Loads symbols from last/default \"filename\"" ), g_aParameters[ PARAM_SAVE ].m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" %s" ": Saves symbol table to \"filename\"" ), g_aParameters[ PARAM_LOAD ].m_sName ); ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" %s" ": Clears the symbol table" ), g_aParameters[ PARAM_CLEAR ].m_sName ); ConsoleBufferPush( sText );
break;
case CMD_SYMBOLS_LIST :
ConsoleBufferPush( TEXT(" Usage: symbol" ) );
ConsoleBufferPush( TEXT(" Looks up symbol in all 3 symbol tables: main, user, source" ) );
break;
// Watches
case CMD_WATCH_ADD:
ConsoleBufferPush( TEXT(" Usage: <address | symbol>" ) );
@ -782,6 +910,39 @@ Update_t CmdHelpSpecific (int nArgs)
case CMD_WINDOW_CODE_2 : // summary is good enough
case CMD_WINDOW_SOURCE_2: // summary is good enough
break;
// Zero Page pointers
case CMD_ZEROPAGE_POINTER:
case CMD_ZEROPAGE_POINTER_ADD:
ConsoleBufferPush(" Usage: <address | symbol>" );
ConsoleBufferPush(" Usage: # <address | symbol> [address...]" );
ConsoleBufferPush(" Adds the specified memory location to the zero page pointer window." );
ConsoleBufferPush(" Update the specified zero page pointer (#) with the address." );
ConsoleBufferPush(" Note: Displayed as symbol name (if possible) and the 16-bit target pointer" );
ConsoleBufferPush(" Examples:" );
wsprintf( sText, " %s CH", pCommand->m_sName );
ConsoleBufferPush( sText );
wsprintf( sText, " %s 0 CV", pCommand->m_sName );
ConsoleBufferPush( sText );
wsprintf( sText, " %s 0 CV CH", pCommand->m_sName );
ConsoleBufferPush( sText );
break;
case CMD_ZEROPAGE_POINTER_CLEAR:
ConsoleBufferPush( TEXT(" Usage: [# | *]") );
ConsoleBufferPush( TEXT(" Clears specified zero page pointer, or all.") );
wsprintf( sText, TEXT(" i.e. %s 1" ), pCommand->m_sName );
ConsoleBufferPush( sText );
break;
case CMD_ZEROPAGE_POINTER_0:
case CMD_ZEROPAGE_POINTER_1:
case CMD_ZEROPAGE_POINTER_2:
case CMD_ZEROPAGE_POINTER_3:
case CMD_ZEROPAGE_POINTER_4:
case CMD_ZEROPAGE_POINTER_5:
case CMD_ZEROPAGE_POINTER_6:
case CMD_ZEROPAGE_POINTER_7:
ConsoleBufferPush( TEXT(" Usage: [<address | symbol>]" ) );
ConsoleBufferPush( TEXT(" If no address specified, will remove watching the zero page pointer." ) );
break;
// Misc
case CMD_VERSION:

View File

@ -48,43 +48,45 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// NOTE: ArgToken_e and g_aTokens must match!
const TokenTable_t g_aTokens[ NUM_TOKENS ] =
{ // Input
{ TOKEN_ALPHANUMERIC, TYPE_STRING , 0 }, // Default, if doen't match anything else
{ TOKEN_AMPERSAND , TYPE_OPERATOR, TEXT('&') }, // bit-and
{ TOKEN_AT , TYPE_OPERATOR, TEXT('@') }, // reference results
{ TOKEN_BSLASH , TYPE_OPERATOR, TEXT('\\') },
{ TOKEN_CARET , TYPE_OPERATOR, TEXT('^') }, // bit-eor, C/C++: xor, Math: POWER
{ TOKEN_COLON , TYPE_OPERATOR, TEXT(':') },
{ TOKEN_COMMA , TYPE_OPERATOR, TEXT(',') },
{ TOKEN_DOLLAR , TYPE_STRING , TEXT('$') },
{ TOKEN_EQUAL , TYPE_OPERATOR, TEXT('=') },
{ TOKEN_EXCLAMATION , TYPE_OPERATOR, TEXT('!') }, // NOT
{ TOKEN_FSLASH , TYPE_OPERATOR, TEXT('/') }, // div
{ TOKEN_GREATER_THAN, TYPE_OPERATOR, TEXT('>') }, // TODO/FIXME: Parser will break up '>=' (needed for uber breakpoints)
{ TOKEN_HASH , TYPE_OPERATOR, TEXT('#') },
{ TOKEN_LEFT_PAREN , TYPE_OPERATOR, TEXT('(') },
{ TOKEN_LESS_THAN , TYPE_OPERATOR, TEXT('<') },
{ TOKEN_MINUS , TYPE_OPERATOR, TEXT('-') }, // sub
{ TOKEN_PERCENT , TYPE_OPERATOR, TEXT('%') }, // mod
{ TOKEN_PIPE , TYPE_OPERATOR, TEXT('|') }, // bit-or
{ TOKEN_PLUS , TYPE_OPERATOR, TEXT('+') }, // add
{ TOKEN_ALPHANUMERIC, TYPE_STRING , 0 }, // Default, if doen't match anything else
{ TOKEN_AMPERSAND , TYPE_OPERATOR, "&" }, // bit-and
{ TOKEN_AT , TYPE_OPERATOR, "@" }, // reference results
{ TOKEN_BRACE_L , TYPE_STRING , "{" },
{ TOKEN_BRACE_R , TYPE_STRING , "}" },
{ TOKEN_BRACKET_L , TYPE_STRING , "[" },
{ TOKEN_BRACKET_R , TYPE_STRING , "]" },
{ TOKEN_BSLASH , TYPE_OPERATOR, "\\" },
{ TOKEN_CARET , TYPE_OPERATOR, "^" }, // bit-eor, C/C++: xor, Math: POWER
{ TOKEN_COLON , TYPE_OPERATOR, ":" },
{ TOKEN_COMMA , TYPE_OPERATOR, "," },
{ TOKEN_DOLLAR , TYPE_STRING , "$" },
{ TOKEN_EQUAL , TYPE_OPERATOR, "=" },
{ TOKEN_EXCLAMATION , TYPE_OPERATOR, "!" }, // NOT
{ TOKEN_FSLASH , TYPE_OPERATOR, "/" }, // div
{ TOKEN_GREATER_THAN, TYPE_OPERATOR, ">" }, // TODO/FIXME: Parser will break up '>=' (needed for uber breakpoints)
{ TOKEN_HASH , TYPE_OPERATOR, "#" },
{ TOKEN_LESS_THAN , TYPE_OPERATOR, "<" },
{ TOKEN_MINUS , TYPE_OPERATOR, "-" }, // sub
{ TOKEN_PAREN_L , TYPE_OPERATOR, "(" },
{ TOKEN_PAREN_R , TYPE_OPERATOR, ")" },
{ TOKEN_PERCENT , TYPE_OPERATOR, "%" }, // mod
{ TOKEN_PIPE , TYPE_OPERATOR, "|" }, // bit-or
{ TOKEN_PLUS , TYPE_OPERATOR, "+" }, // add
// { TOKEN_QUESTION , TYPE_OPERATOR, TEXT('?') }, // Not a token 1) wildcard needs to stay together with other chars
{ TOKEN_QUOTE_SINGLE, TYPE_QUOTED_1, TEXT('\'') },
{ TOKEN_QUOTE_DOUBLE, TYPE_QUOTED_2, TEXT('"') }, // for strings
{ TOKEN_RIGHT_PAREN , TYPE_OPERATOR, TEXT(')') },
{ TOKEN_SEMI , TYPE_STRING , TEXT(';') },
{ TOKEN_SPACE , TYPE_STRING , TEXT(' ') }, // space is also a delimiter between tokens/args
{ TOKEN_STAR , TYPE_OPERATOR, TEXT('*') } // Not a token 1) wildcard needs to stay together with other chars
{ TOKEN_QUOTE_SINGLE, TYPE_QUOTED_1, "\'" },
{ TOKEN_QUOTE_DOUBLE, TYPE_QUOTED_2, "\"" }, // for strings
{ TOKEN_SEMI , TYPE_STRING , ";" },
{ TOKEN_SPACE , TYPE_STRING , " " }, // space is also a delimiter between tokens/args
{ TOKEN_STAR , TYPE_OPERATOR, "*" }, // Not a token 1) wildcard needs to stay together with other chars
// { TOKEN_TAB , TYPE_STRING , TEXT('\t') }
// { TOKEN_TILDE , TYPE_OPERATOR, TEXT('~') }, // C/C++: Not. Used for console.
{ TOKEN_TILDE , TYPE_OPERATOR, "~" }, // C/C++: Not. Used for console.
{ TOKEN_COMMENT_EOL , TYPE_STRING , "//" },
{ TOKEN_GREATER_EQUAL,TYPE_OPERATOR, ">=" },
{ TOKEN_LESS_EQUAL , TYPE_OPERATOR, "<=" },
{ TOKEN_NOT_EQUAL , TYPE_OPERATOR , "!=" }
};
// const TokenTable_t g_aTokens2[ ] =
// { // Input
// { TOKEN_GREATER_EQUAL,TYPE_OPERATOR, TEXT(">=\x00") }, // TODO/FIXME: Parser will break up '>=' (needed for uber breakpoints)
// { TOKEN_LESS_EQUAL , TYPE_OPERATOR, TEXT("<=\x00") }, // TODO/FIXME: Parser will break up '<=' (needed for uber breakpoints)
// }
// Arg ____________________________________________________________________________________________
@ -255,6 +257,9 @@ int ArgsGet ( TCHAR * pInput )
pEnd = SkipUntilToken( pSrc+1, g_aTokens, NUM_TOKENS, &iTokenEnd );
}
if (iTokenSrc == TOKEN_COMMENT_EOL)
break;
if (iTokenSrc == NO_TOKEN)
{
iTokenSrc = TOKEN_ALPHANUMERIC;
@ -288,7 +293,7 @@ int ArgsGet ( TCHAR * pInput )
{
nLen = MIN( nBuf, MAX_ARG_LEN-1 );
_tcsncpy( pArg->sArg, pSrc, nLen );
pArg->sArg[ nLen ] = 0;
pArg->sArg[ nLen ] = 0;
pArg->nArgLen = nLen;
pArg->eToken = iTokenSrc;
pArg->bType = iType;
@ -303,8 +308,9 @@ int ArgsGet ( TCHAR * pInput )
if (nLen > 1)
{
// Technically, chars aren't allowed to be multi-char
// But we've extended the syntax to allow the user
// to input High-Bit Apple Text
}
pEnd++;
}
@ -689,7 +695,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
}
if (bProcessMask & (1 << TOKEN_EXCLAMATION))
if (pArg->eToken == TOKEN_EXCLAMATION) // NOT_EQUAL !
if (pArg->eToken == TOKEN_EXCLAMATION) // NOT !
{
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
{
@ -755,18 +761,37 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
//===========================================================================
const char * ParserFindToken( const char *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e * pToken_ )
{
const TokenTable_t *pToken= aTokens;
const TCHAR *pName = NULL;
for (int iToken = 0; iToken < nTokens; iToken++ )
if (! pSrc)
return NULL;
const TCHAR *pName = NULL;
int iToken;
// Look-ahead for <=
// Look-ahead for >=
for (iToken = _TOKEN_FLAG_MULTI; iToken < NUM_TOKENS; iToken++ )
{
pName = & (pToken->sToken);
pName = & (g_aTokens[ iToken ].sToken[0]);
if ((pSrc[0] == pName[ 0 ]) &&
(pSrc[1] == pName[ 1 ]))
{
*pToken_ = g_aTokens[ iToken ].eToken;
return pSrc + 2;
}
}
const TokenTable_t *pToken = aTokens;
for (iToken = 0; iToken < _TOKEN_FLAG_MULTI; iToken++ )
{
pName = & (pToken->sToken[0]);
if (*pSrc == *pName)
{
if ( pToken_)
{
*pToken_ = (ArgToken_e) iToken;
}
return pSrc;
return pSrc + 1;
}
pToken++;
}
@ -792,9 +817,7 @@ const TCHAR * FindTokenOrAlphaNumeric ( const TCHAR *pSrc, const TokenTable_t *a
else
{
pEnd = ParserFindToken( pSrc, aTokens, nTokens, pToken_ );
if (pEnd)
pEnd = pSrc + 1; // _tcslen( pToken );
else
if (! pEnd)
pEnd = pSrc;
}
}

View File

@ -14,6 +14,13 @@
, _6502_NUM_FLAGS = 8
};
enum RangeType_t
{
RANGE_MISSING_ARG_2 = 0, // error
RANGE_HAS_LEN , // valid case 1
RANGE_HAS_END , // valid case 2
};
struct AddressingMode_t
{
TCHAR m_sFormat[ MAX_OPMODE_FORMAT ];
@ -196,7 +203,8 @@
BP_OP_LESS_EQUAL , // <= REG
BP_OP_LESS_THAN , // < REG
BP_OP_EQUAL , // = REG
BP_OP_NOT_EQUAL , // ! REG
BP_OP_NOT_EQUAL , // != REG
// BP_OP_NOT_EQUAL_1 , // ! REG
BP_OP_GREATER_THAN , // > REG
BP_OP_GREATER_EQUAL, // >= REG
BP_OP_READ , // @ MEM @ ? *
@ -345,7 +353,14 @@
, NUM_COLORS
};
// Config _________________________________________________________________________________________
enum ConfigSave_t
{
CONFIG_SAVE_FILE_CREATE,
CONFIG_SAVE_FILE_APPEND
};
// Commands _______________________________________________________________________________________
enum Update_e
@ -395,7 +410,7 @@
// NOTE: Commands_e and g_aCommands[] order _MUST_ match !!! Aliases are listed at the end
enum Commands_e
{
// Main / CPU
// CPU
CMD_CURSOR_JUMP_PC // Shift
, CMD_CURSOR_SET_PC // Ctrl
, CMD_ASSEMBLE
@ -407,18 +422,29 @@
, CMD_JSR
, CMD_NOP
, CMD_OUT
// CPU - Meta Info
, CMD_PROFILE
, CMD_REGISTER_SET
// CPU - Stack
// , CMD_STACK_LIST
, CMD_STACK_POP
, CMD_STACK_POP_PSEUDO
, CMD_STACK_PUSH
// , CMD_STACK_RETURN
, CMD_STEP_OVER
, CMD_STEP_OUT
// CPU - Meta Info
, CMD_TRACE
, CMD_TRACE_FILE
, CMD_TRACE_LINE
, CMD_UNASSEMBLE
// Bookmarks
, CMD_BOOKMARK_MENU
, CMD_BOOKMARK
, CMD_BOOKMARK_ADD
, CMD_BOOKMARK_CLEAR
, CMD_BOOKMARK_LIST
, CMD_BOOKMARK_LOAD
// , CMD_BOOKMARK_LOAD
, CMD_BOOKMARK_GOTO
, CMD_BOOKMARK_SAVE
// Breakpoints
, CMD_BREAKPOINT
@ -436,19 +462,17 @@
, CMD_BREAKPOINT_EDIT
, CMD_BREAKPOINT_ENABLE
, CMD_BREAKPOINT_LIST
, CMD_BREAKPOINT_LOAD
// , CMD_BREAKPOINT_LOAD
, CMD_BREAKPOINT_SAVE
// Benchmark / Timing
, CMD_BENCHMARK
// , CMD_BENCHMARK_START
// , CMD_BENCHMARK_STOP
, CMD_PROFILE
// , CMD_PROFILE_START
// , CMD_PROFILE_STOP
// Config (debugger settings)
, CMD_BENCHMARK
, CMD_CONFIG_BW // BW # rr gg bb
, CMD_CONFIG_COLOR // COLOR # rr gg bb
, CMD_CONFIG_MENU
, CMD_CONFIG_DISASM
// , CMD_CONFIG_DISASM_BRANCH
@ -531,8 +555,8 @@
, CMD_MEMORY_MOVE
, CMD_MEMORY_SAVE
, CMD_MEMORY_SEARCH
, CMD_MEMORY_SEARCH_ASCII // Ascii Text
, CMD_MEMORY_SEARCH_APPLE // Flashing Chars, Hi-Bit Set
// , CMD_MEMORY_SEARCH_ASCII // Ascii Text
// , CMD_MEMORY_SEARCH_APPLE // Flashing Chars, Hi-Bit Set
, CMD_MEMORY_SEARCH_HEX
, CMD_MEMORY_FILL
// Output
@ -541,17 +565,9 @@
, CMD_OUTPUT_PRINT
, CMD_OUTPUT_PRINTF
, CMD_OUTPUT_RUN
// Registers - CPU
, CMD_REGISTER_SET
// Source Level Debugging
, CMD_SOURCE
, CMD_SYNC
// Stack - CPU
// , CMD_STACK_LIST
, CMD_STACK_POP
, CMD_STACK_POP_PSEUDO
, CMD_STACK_PUSH
// , CMD_STACK_RETURN
// Symbols
, CMD_SYMBOLS_LOOKUP
// , CMD_SYMBOLS
@ -566,12 +582,13 @@
// , CMD_SYMBOLS_LOAD_2
// , CMD_SYMBOLS_SAVE
// Watch
, CMD_WATCH
, CMD_WATCH_ADD
, CMD_WATCH_CLEAR
, CMD_WATCH_DISABLE
, CMD_WATCH_ENABLE
, CMD_WATCH_LIST
, CMD_WATCH_LOAD
// , CMD_WATCH_LOAD
, CMD_WATCH_SAVE
// Window
// , CMD_WINDOW_COLOR_CUSTOM
@ -610,12 +627,15 @@
, CMD_ZEROPAGE_POINTER_2
, CMD_ZEROPAGE_POINTER_3
, CMD_ZEROPAGE_POINTER_4
, CMD_ZEROPAGE_POINTER_5
, CMD_ZEROPAGE_POINTER_6
, CMD_ZEROPAGE_POINTER_7
, CMD_ZEROPAGE_POINTER_ADD
, CMD_ZEROPAGE_POINTER_CLEAR
, CMD_ZEROPAGE_POINTER_DISABLE
, CMD_ZEROPAGE_POINTER_ENABLE
, CMD_ZEROPAGE_POINTER_LIST
, CMD_ZEROPAGE_POINTER_LOAD
// , CMD_ZEROPAGE_POINTER_LOAD
, CMD_ZEROPAGE_POINTER_SAVE
, NUM_COMMANDS
@ -641,14 +661,15 @@
Update_t CmdTraceLine (int nArgs);
Update_t CmdUnassemble (int nArgs); // code dump, aka, Unassemble
// Bookmarks
Update_t CmdBookmarkMenu (int nArgs);
Update_t CmdBookmark (int nArgs);
Update_t CmdBookmarkAdd (int nArgs);
Update_t CmdBookmarkClear (int nArgs);
Update_t CmdBookmarkList (int nArgs);
Update_t CmdBookmarkLoad (int nArgs);
Update_t CmdBookmarkGoto (int nArgs);
// Update_t CmdBookmarkLoad (int nArgs);
Update_t CmdBookmarkSave (int nArgs);
// Breakpoints
Update_t CmdBreakpointMenu (int nArgs);
Update_t CmdBreakpoint (int nArgs);
Update_t CmdBreakpointAddSmart(int nArgs);
Update_t CmdBreakpointAddReg (int nArgs);
Update_t CmdBreakpointAddPC (int nArgs);
@ -659,7 +680,7 @@
Update_t CmdBreakpointEdit (int nArgs);
Update_t CmdBreakpointEnable (int nArgs);
Update_t CmdBreakpointList (int nArgs);
Update_t CmdBreakpointLoad (int nArgs);
// Update_t CmdBreakpointLoad (int nArgs);
Update_t CmdBreakpointSave (int nArgs);
// Benchmark
Update_t CmdBenchmark (int nArgs);
@ -669,10 +690,10 @@
Update_t CmdProfileStart (int nArgs);
Update_t CmdProfileStop (int nArgs);
// Config
Update_t CmdConfigMenu (int nArgs);
Update_t CmdConfigBase (int nArgs);
Update_t CmdConfigBaseHex (int nArgs);
Update_t CmdConfigBaseDec (int nArgs);
// Update_t CmdConfigMenu (int nArgs);
// Update_t CmdConfigBase (int nArgs);
// Update_t CmdConfigBaseHex (int nArgs);
// Update_t CmdConfigBaseDec (int nArgs);
Update_t CmdConfigColorMono (int nArgs);
Update_t CmdConfigDisasm (int nArgs);
Update_t CmdConfigFont (int nArgs);
@ -752,12 +773,13 @@
Update_t CmdSymbolsSave (int nArgs);
Update_t CmdSymbolsSource (int nArgs);
// Watch
Update_t CmdWatch (int nArgs);
Update_t CmdWatchAdd (int nArgs);
Update_t CmdWatchClear (int nArgs);
Update_t CmdWatchDisable (int nArgs);
Update_t CmdWatchEnable (int nArgs);
Update_t CmdWatchList (int nArgs);
Update_t CmdWatchLoad (int nArgs);
// Update_t CmdWatchLoad (int nArgs);
Update_t CmdWatchSave (int nArgs);
// Window
Update_t CmdWindow (int nArgs);
@ -797,7 +819,7 @@
Update_t CmdZeroPageDisable (int nArgs);
Update_t CmdZeroPageEnable (int nArgs);
Update_t CmdZeroPageList (int nArgs);
Update_t CmdZeroPageLoad (int nArgs);
// Update_t CmdZeroPageLoad (int nArgs);
Update_t CmdZeroPageSave (int nArgs);
Update_t CmdZeroPagePointer (int nArgs);
@ -1077,14 +1099,19 @@
*/
enum ArgToken_e // Arg Token Type
{
// Single Char Tokens must come first
TOKEN_ALPHANUMERIC //
, TOKEN_AMPERSAND // &
, TOKEN_AT // @ results dereference. i.e. S 0,FFFF C030; L @1
, TOKEN_BRACE_L // {
, TOKEN_BRACE_R // }
, TOKEN_BRACKET_L // [
, TOKEN_BRACKET_R // ]
, TOKEN_BSLASH // \xx Hex Literal
, TOKEN_CARET // ^
// , TOKEN_CHAR
, TOKEN_COLON // : Range Argument1.n2 = Argument2
, TOKEN_COMMA // , Length Argument1.n2 = Argument2
, TOKEN_COLON // : Range
, TOKEN_COMMA // , Length
// , TOKEN_DIGIT
, TOKEN_DOLLAR // $ Address (symbol lookup forced)
, TOKEN_EQUAL // = Assign Argment.n2 = Argument2
@ -1092,26 +1119,32 @@
, TOKEN_FSLASH // /
, TOKEN_GREATER_THAN // >
, TOKEN_HASH // # Value no symbol lookup
, TOKEN_LEFT_PAREN // (
, TOKEN_LESS_THAN // <
, TOKEN_MINUS // - Delta Argument1 -= Argument2
, TOKEN_PAREN_L // (
, TOKEN_PAREN_R // )
, TOKEN_PERCENT // %
, TOKEN_PIPE // |
, TOKEN_PLUS // + Delta Argument1 += Argument2
, TOKEN_QUOTE_SINGLE // '
, TOKEN_QUOTE_DOUBLE // "
, TOKEN_RIGHT_PAREN // )
, TOKEN_SEMI // ; Command Seperator
, TOKEN_SPACE // Token Delimiter
, TOKEN_STAR // *
// , TOKEN_TAB // '\t'
, TOKEN_TILDE // ~
// Multi char tokens come last
, TOKEN_COMMENT_EOL // //
,_TOKEN_FLAG_MULTI = TOKEN_COMMENT_EOL
, TOKEN_GREATER_EQUAL// >=
, TOKEN_LESS_EQUAL // <=
, TOKEN_NOT_EQUAL // !=
// , TOKEN_COMMENT_1 // /*
// , TOKEN_COMMENT_2 // */
, NUM_TOKENS // signal none, or bad
, NO_TOKEN = NUM_TOKENS
// Merged tokens
, TOKEN_LESS_EQUAL //
, TOKEN_GREATER_EQUAL //
};
enum ArgType_e
@ -1132,7 +1165,7 @@
{
ArgToken_e eToken;
ArgType_e eType ;
TCHAR sToken; // char intentional
char sToken[4];
};
struct Arg_t
@ -1159,7 +1192,8 @@
, PARAM_BP_LESS_EQUAL = _PARAM_BREAKPOINT_BEGIN // <=
, PARAM_BP_LESS_THAN // <
, PARAM_BP_EQUAL // =
, PARAM_BP_NOT_EQUAL // !
, PARAM_BP_NOT_EQUAL // !=
, PARAM_BP_NOT_EQUAL_1 // !
, PARAM_BP_GREATER_THAN // >
, PARAM_BP_GREATER_EQUAL // >=
, PARAM_BP_READ // R
@ -1220,6 +1254,7 @@
, _PARAM_GENERAL_BEGIN = _PARAM_FONT_END // Daisy Chain
, PARAM_FIND = _PARAM_GENERAL_BEGIN
, PARAM_BRANCH
, PARAM_CATEGORY
, PARAM_CLEAR
, PARAM_LOAD
, PARAM_LIST
@ -1234,20 +1269,22 @@
, _PARAM_HELPCATEGORIES_BEGIN = _PARAM_GENERAL_END // Daisy Chain
, PARAM_WILDSTAR = _PARAM_HELPCATEGORIES_BEGIN
, PARAM_CAT_BOOKMARKS
, PARAM_CAT_BREAKPOINTS
, PARAM_CAT_CONFIG
, PARAM_CAT_CPU
, PARAM_CAT_FLAGS
, PARAM_CAT_HELP
, PARAM_CAT_MEMORY
,_PARAM_CAT_MEM // alias MEM = MEMORY
, PARAM_CAT_OUTPUT
, PARAM_CAT_REGISTERS
, PARAM_CAT_SYMBOLS
, PARAM_CAT_WATCHES
, PARAM_CAT_WINDOW
, PARAM_CAT_ZEROPAGE
, PARAM_CAT_BOOKMARKS
, PARAM_CAT_BREAKPOINTS
, PARAM_CAT_CONFIG
, PARAM_CAT_CPU
// , PARAM_CAT_EXPRESSION
, PARAM_CAT_FLAGS
, PARAM_CAT_HELP
, PARAM_CAT_MEMORY
, PARAM_CAT_OUTPUT
, PARAM_CAT_OPERATORS
, PARAM_CAT_RANGE
// , PARAM_CAT_REGISTERS
, PARAM_CAT_SYMBOLS
, PARAM_CAT_WATCHES
, PARAM_CAT_WINDOW
, PARAM_CAT_ZEROPAGE
, _PARAM_HELPCATEGORIES_END
, PARAM_HELPCATEGORIES_NUM = _PARAM_HELPCATEGORIES_END - _PARAM_HELPCATEGORIES_BEGIN
@ -1345,7 +1382,7 @@
enum
{
MAX_WATCHES = 6
MAX_WATCHES = 8
};
@ -1378,6 +1415,6 @@
enum
{
MAX_ZEROPAGE_POINTERS = 6
MAX_ZEROPAGE_POINTERS = 8
};