2010-06-11 15:38:22 +00:00
/*
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
2014-08-28 18:13:02 +00:00
Copyright ( C ) 2006 - 2014 , Tom Charlesworth , Michael Pohoreski
2010-06-11 15:38:22 +00:00
AppleWin is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
AppleWin is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with AppleWin ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
*/
/* Description: Debugger
*
2010-12-18 15:00:04 +00:00
* Author : Copyright ( C ) 2006 - 2010 Michael Pohoreski
2010-06-11 15:38:22 +00:00
*/
# include "StdAfx.h"
2016-09-10 12:46:09 +00:00
# include <cstdarg>
2014-08-13 20:30:35 +00:00
# include "Debug.h"
2020-11-26 21:50:06 +00:00
# include "../Core.h"
2014-08-13 20:30:35 +00:00
2010-06-11 15:38:22 +00:00
# define DEBUG_COLOR_CONSOLE 0
// Utility ________________________________________________________________________________________
/*
String types :
http : //www.codeproject.com/cpp/unicode.asp
TEXT ( ) _tcsrev
_UNICODE Unicode _wcsrev
_MBCS Multi - byte _mbsrev
n / a ASCII strrev
*/
// Help ___________________________________________________________________________________________
//===========================================================================
Update_t HelpLastCommand ( )
{
return Help_Arg_1 ( g_iCommand ) ;
}
// Loads the arguments with the command to get help on and call display help.
//===========================================================================
Update_t Help_Arg_1 ( int iCommandHelp )
{
_Arg_1 ( iCommandHelp ) ;
2022-02-26 17:54:06 +00:00
strncpy_s ( g_aArgs [ 1 ] . sArg , g_aCommands [ iCommandHelp ] . m_sName , _TRUNCATE ) ; // .3 Fixed: Help_Arg_1() now copies command name into arg.name
2010-06-11 15:38:22 +00:00
return CmdHelpSpecific ( 1 ) ;
}
//===========================================================================
void Help_Categories ( )
{
2022-02-17 22:12:04 +00:00
// TODO/FIXME: Colorize( sText, ... )
// Colorize("Usage:")
2022-06-05 18:47:40 +00:00
std : : string sText = CHC_USAGE " Usage " CHC_DEFAULT " : " CHC_ARG_OPT " [ " CHC_ARG_MAND " < " ;
2010-06-11 15:38:22 +00:00
2022-02-17 22:12:04 +00:00
for ( int iCategory = _PARAM_HELPCATEGORIES_BEGIN ; iCategory < _PARAM_HELPCATEGORIES_END ; iCategory + + )
{
2022-06-05 18:47:40 +00:00
const char * pName = g_aParameters [ iCategory ] . m_sName ;
2010-06-11 15:38:22 +00:00
2022-06-05 18:47:40 +00:00
if ( sText . length ( ) + strlen ( pName ) > = ( CONSOLE_WIDTH - 1 ) )
2010-06-11 15:38:22 +00:00
{
2022-06-05 18:47:40 +00:00
ConsolePrint ( sText . c_str ( ) ) ;
sText = " " ; // indent
2022-02-17 22:12:04 +00:00
}
2022-06-05 18:47:40 +00:00
sText + = CHC_COMMAND ;
sText + = pName ;
2010-06-11 15:38:22 +00:00
2022-02-17 22:12:04 +00:00
if ( iCategory < ( _PARAM_HELPCATEGORIES_END - 1 ) )
{
2022-06-05 18:47:40 +00:00
const char sSep [ ] = " | " ;
2022-02-17 22:12:04 +00:00
2022-06-05 18:47:40 +00:00
if ( sText . length ( ) + strlen ( sSep ) > = ( CONSOLE_WIDTH - 1 ) )
2010-06-11 15:38:22 +00:00
{
2022-06-05 18:47:40 +00:00
ConsolePrint ( sText . c_str ( ) ) ;
sText = " " ; // indent
2010-06-11 15:38:22 +00:00
}
2022-06-05 18:47:40 +00:00
sText + = CHC_ARG_SEP ;
sText + = sSep ;
2010-06-11 15:38:22 +00:00
}
2022-02-17 22:12:04 +00:00
}
2010-06-11 15:38:22 +00:00
2022-06-05 18:47:40 +00:00
sText + = CHC_ARG_MAND " > " CHC_ARG_OPT " ] " ;
2010-06-11 15:38:22 +00:00
2022-06-05 18:47:40 +00:00
// ConsoleBufferPush( sText.c_str() );
ConsolePrint ( sText . c_str ( ) ) ; // Transcode colored text to native console color text
2010-06-11 15:38:22 +00:00
2022-06-05 18:47:40 +00:00
ConsolePrintFormat ( CHC_USAGE " Notes " CHC_DEFAULT " : "
CHC_ARG_MAND " <> " CHC_DEFAULT " = mandatory, "
CHC_ARG_OPT " [] " CHC_DEFAULT " = optional, "
CHC_ARG_SEP " | " CHC_DEFAULT " argument option " ) ;
// ConsoleBufferPush( sText.c_str() );
2010-06-11 15:38:22 +00:00
}
void Help_Examples ( )
{
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %sExamples%s:%s "
2010-06-11 15:38:22 +00:00
, CHC_USAGE
2017-08-24 19:36:46 +00:00
, CHC_ARG_SEP
2010-06-11 15:38:22 +00:00
, CHC_DEFAULT
) ;
}
//===========================================================================
void Help_Range ( )
{
ConsoleBufferPush ( " Where <range> is of the form: " ) ;
ConsoleBufferPush ( " address , length [address,address+length) " ) ;
ConsoleBufferPush ( " address : end [address,end] " ) ;
}
//===========================================================================
void Help_Operators ( )
{
2022-02-17 22:12:04 +00:00
// ConsolePrintFormat( " %sOperators%s:" , CHC_USAGE, CHC_DEFAULT );
// ConsolePrintFormat( " Operators: (Math)" );
ConsolePrintFormat ( " Operators: (%sMath%s) " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s+%s Addition " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s-%s Subtraction " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s*%s Multiplication " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s/%s Division " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s%%%s Modulas or Remainder " , CHC_USAGE , CHC_DEFAULT ) ;
// ConsoleBufferPush( " Operators: (Bit Wise)" );
ConsolePrintFormat ( " Operators: (%sBit Wise%s) " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s&%s Bit-wise and (AND) " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s|%s Bit-wise or (OR ) " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s^%s Bit-wise exclusive-or (EOR/XOR) " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s!%s Bit-wise negation (NOT) " , CHC_USAGE , CHC_DEFAULT ) ;
// ConsoleBufferPush( " Operators: (Input)" );
ConsolePrintFormat ( " Operators: (%sInput%s) " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s@%s next number refers to search results " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s \" %s Designate string in ASCII format " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s \' %s Desginate string in High-Bit apple format " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s$%s Designate number/symbol " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s#%s Designate number in hex " , CHC_USAGE , CHC_DEFAULT ) ;
// ConsoleBufferPush( " Operators: (Range)" );
ConsolePrintFormat ( " Operators: (%sRange%s) " , CHC_USAGE , CHC_DEFAULT ) ;
2022-03-25 20:11:33 +00:00
ConsolePrintFormat ( " %s,%s range separator (2nd address is relative) " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s:%s range separator (2nd address is absolute) " , CHC_USAGE , CHC_DEFAULT ) ;
2022-02-17 22:12:04 +00:00
// ConsolePrintFormat( " Operators: (Misc)" );
ConsolePrintFormat ( " Operators: (%sMisc%s) " , CHC_USAGE , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s//%s comment until end of line " , CHC_USAGE , CHC_DEFAULT ) ;
// ConsoleBufferPush( " Operators: (Breakpoint)" );
ConsolePrintFormat ( " Operators: (%sBreakpoint%s) " , CHC_USAGE , CHC_DEFAULT ) ;
2022-06-05 18:47:40 +00:00
std : : string sText = " " CHC_USAGE ;
for ( int iBreakOp = 0 ; iBreakOp < NUM_BREAKPOINT_OPERATORS ; iBreakOp + + )
2010-06-11 15:38:22 +00:00
{
if ( ( iBreakOp > = PARAM_BP_LESS_EQUAL ) & &
( iBreakOp < = PARAM_BP_GREATER_EQUAL ) )
{
2022-06-05 18:47:40 +00:00
sText + = g_aBreakpointSymbols [ iBreakOp ] ;
sText + = ' ' ;
2010-06-11 15:38:22 +00:00
}
2023-03-26 18:31:15 +00:00
}
2022-06-05 18:47:40 +00:00
sText + = CHC_DEFAULT ;
ConsolePrint ( sText . c_str ( ) ) ;
2010-06-11 15:38:22 +00:00
}
void Help_KeyboardShortcuts ( )
{
ConsoleBufferPush ( " Scrolling: " ) ;
ConsoleBufferPush ( " Up Arrow " ) ;
ConsoleBufferPush ( " Down Arrow " ) ;
ConsoleBufferPush ( " Shift + Up Arrow " ) ;
ConsoleBufferPush ( " Shift + Down Arrow " ) ;
ConsoleBufferPush ( " Page Up " ) ;
ConsoleBufferPush ( " Page Down " ) ;
ConsoleBufferPush ( " Shift + Page Up " ) ;
ConsoleBufferPush ( " Shift + Page Down " ) ;
ConsoleBufferPush ( " Bookmarks: " ) ;
ConsoleBufferPush ( " Ctrl-Shift-# " ) ;
ConsoleBufferPush ( " Ctrl-# " ) ;
}
void _ColorizeHeader (
char * & pDst , const char * & pSrc ,
const char * pHeader , const int nHeaderLen )
{
int nLen ;
nLen = strlen ( CHC_USAGE ) ;
strcpy ( pDst , CHC_USAGE ) ;
pDst + = nLen ;
nLen = nHeaderLen - 1 ;
strncpy ( pDst , pHeader , nLen ) ;
pDst + = nLen ;
pSrc + = nHeaderLen ;
nLen = strlen ( CHC_ARG_SEP ) ;
strcpy ( pDst , CHC_ARG_SEP ) ;
pDst + = nLen ;
* pDst = ' : ' ;
pDst + + ;
nLen = strlen ( CHC_DEFAULT ) ;
strcpy ( pDst , CHC_DEFAULT ) ;
pDst + = nLen ;
}
2017-08-24 19:36:46 +00:00
void _ColorizeString (
char * & pDst ,
const char * pSrc , const size_t nLen )
{
strcpy ( pDst , pSrc ) ;
pDst + = nLen ;
}
// pOperator is one of CHC_*
2010-06-11 15:38:22 +00:00
void _ColorizeOperator (
char * & pDst , const char * & pSrc ,
2021-02-10 21:05:00 +00:00
const char * pOperator )
2010-06-11 15:38:22 +00:00
{
int nLen ;
nLen = strlen ( pOperator ) ;
strcpy ( pDst , pOperator ) ;
pDst + = nLen ;
* pDst = * pSrc ;
pDst + + ;
nLen = strlen ( CHC_DEFAULT ) ;
strcpy ( pDst , CHC_DEFAULT ) ;
pDst + = nLen ;
pSrc + + ;
}
2017-08-24 19:36:46 +00:00
bool isHexDigit ( char c )
{
if ( ( c > = ' 0 ' ) & & ( c < = ' 9 ' ) ) return true ;
if ( ( c > = ' A ' ) & & ( c < = ' F ' ) ) return true ;
if ( ( c > = ' a ' ) & & ( c < = ' f ' ) ) return true ;
return false ;
}
2022-02-17 22:12:04 +00:00
// TODO: Use nDstSz to prevent buffer overflow.
// Alternatively, Colorize() may simply return a std::string.
bool Colorize ( char * pDst , size_t /*nDstSz*/ , const char * pSrc )
2010-06-11 15:38:22 +00:00
{
if ( ! pSrc )
return false ;
if ( ! pDst )
return false ;
const char sNote [ ] = " Note: " ;
const int nNote = sizeof ( sNote ) - 1 ;
const char sSeeAlso [ ] = " See also: " ;
const char nSeeAlso = sizeof ( sSeeAlso ) - 1 ;
const char sUsage [ ] = " Usage: " ;
const int nUsage = sizeof ( sUsage ) - 1 ;
const char sTotal [ ] = " Total: " ;
const int nTotal = sizeof ( sTotal ) - 1 ;
2017-08-24 19:36:46 +00:00
const char sExamples [ ] = " Examples: " ;
const int nExamples = sizeof ( sExamples ) - 1 ;
2010-06-11 15:38:22 +00:00
while ( * pSrc )
{
if ( strncmp ( sUsage , pSrc , nUsage ) = = 0 )
{
_ColorizeHeader ( pDst , pSrc , sUsage , nUsage ) ;
}
else
if ( strncmp ( sSeeAlso , pSrc , nSeeAlso ) = = 0 )
{
_ColorizeHeader ( pDst , pSrc , sSeeAlso , nSeeAlso ) ;
}
else
if ( strncmp ( sNote , pSrc , nNote ) = = 0 )
{
_ColorizeHeader ( pDst , pSrc , sNote , nNote ) ;
}
else
if ( strncmp ( sTotal , pSrc , nNote ) = = 0 )
{
_ColorizeHeader ( pDst , pSrc , sTotal , nTotal ) ;
}
else
2017-08-24 19:36:46 +00:00
if ( strncmp ( sExamples , pSrc , nExamples ) = = 0 )
{
_ColorizeHeader ( pDst , pSrc , sExamples , nExamples ) ;
}
else
2010-06-11 15:38:22 +00:00
if ( * pSrc = = ' [ ' )
{
_ColorizeOperator ( pDst , pSrc , CHC_ARG_OPT ) ;
}
else
if ( * pSrc = = ' ] ' )
{
_ColorizeOperator ( pDst , pSrc , CHC_ARG_OPT ) ;
}
else
if ( * pSrc = = ' < ' )
{
_ColorizeOperator ( pDst , pSrc , CHC_ARG_MAND ) ;
}
else
if ( * pSrc = = ' > ' )
{
_ColorizeOperator ( pDst , pSrc , CHC_ARG_MAND ) ;
}
else
if ( * pSrc = = ' | ' )
{
_ColorizeOperator ( pDst , pSrc , CHC_ARG_SEP ) ;
}
else
if ( * pSrc = = ' \' ' )
{
_ColorizeOperator ( pDst , pSrc , CHC_ARG_SEP ) ;
}
else
2017-08-24 19:36:46 +00:00
if ( ( * pSrc = = ' $ ' ) & & isHexDigit ( pSrc [ 1 ] ) ) // Hex Number
{
_ColorizeOperator ( pDst , pSrc , CHC_ARG_SEP ) ;
const char * start = pSrc ;
const char * end = pSrc ;
2022-03-27 19:48:26 +00:00
while ( isHexDigit ( * end ) )
2017-08-24 19:36:46 +00:00
end + + ;
size_t nDigits = end - start ;
_ColorizeString ( pDst , CHC_NUM_HEX , strlen ( CHC_NUM_HEX ) ) ;
_ColorizeString ( pDst , start , nDigits ) ;
_ColorizeString ( pDst , CHC_DEFAULT , strlen ( CHC_DEFAULT ) ) ;
pSrc + = nDigits ;
}
else
2010-06-11 15:38:22 +00:00
{
* pDst = * pSrc ;
pDst + + ;
2023-03-26 18:31:15 +00:00
pSrc + + ;
2010-06-11 15:38:22 +00:00
}
}
* pDst = 0 ;
return true ;
}
2022-02-17 22:12:04 +00:00
template < size_t _DstSz >
inline bool Colorize ( char ( & szDst ) [ _DstSz ] , const char * pSrc )
2016-09-10 12:46:09 +00:00
{
2022-02-17 22:12:04 +00:00
return Colorize ( szDst , _DstSz , pSrc ) ;
2016-09-10 12:46:09 +00:00
}
2022-02-17 22:12:04 +00:00
// NOTE: This appends a new line
inline bool ConsoleColorizePrint ( const char * pText )
2016-09-10 12:46:09 +00:00
{
2022-02-17 22:12:04 +00:00
char colorizeBuf [ CONSOLE_WIDTH * 2 ] ;
if ( ! Colorize ( colorizeBuf , pText ) ) return false ;
ConsolePrint ( colorizeBuf ) ;
return true ;
2016-09-10 12:46:09 +00:00
}
2022-02-17 22:12:04 +00:00
inline bool ConsoleColorizePrintVa ( const char * format , va_list va )
2016-09-10 12:46:09 +00:00
{
2022-02-17 22:12:04 +00:00
std : : string strText = StrFormatV ( format , va ) ;
return ConsoleColorizePrint ( strText . c_str ( ) ) ;
2016-09-10 12:46:09 +00:00
}
2022-02-26 17:15:09 +00:00
inline bool ConsoleColorizePrintFormat ( const char * format , . . . ) ATTRIBUTE_FORMAT_PRINTF ( 1 , 2 ) ;
inline bool ConsoleColorizePrintFormat ( const char * format , . . . )
2016-09-10 12:46:09 +00:00
{
2022-02-17 22:12:04 +00:00
va_list va ;
va_start ( va , format ) ;
bool const r = ConsoleColorizePrintVa ( format , va ) ;
va_end ( va ) ;
return r ;
2016-09-10 12:46:09 +00:00
}
2010-06-11 15:38:22 +00:00
//===========================================================================
2012-12-29 14:53:52 +00:00
Update_t CmdMOTD ( int nArgs ) // Message Of The Day
2010-06-11 15:38:22 +00:00
{
# if DEBUG_COLOR_CONSOLE
ConsolePrint ( " ` " ) ;
ConsolePrint ( " `A " ) ;
ConsolePrint ( " `2`A " ) ;
# endif
2022-02-17 22:12:04 +00:00
ConsolePrint ( " `9`A`7 Apple `9][ ][+ //e `7Emulator for Windows (TM) `9`@ " ) ;
2010-06-11 15:38:22 +00:00
CmdVersion ( 0 ) ;
CmdSymbols ( 0 ) ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " '%sCtrl ~'%s console, '%s%s'%s (specific), '%s%s'%s (all) "
2010-06-11 15:38:22 +00:00
, CHC_KEY
, CHC_DEFAULT
, CHC_COMMAND
, g_aCommands [ CMD_HELP_SPECIFIC ] . m_sName
, CHC_DEFAULT
// , g_aCommands[ CMD_HELP_SPECIFIC ].pHelpSummary
, CHC_COMMAND
, g_aCommands [ CMD_HELP_LIST ] . m_sName
, CHC_DEFAULT
// , g_aCommands[ CMD_HELP_LIST ].pHelpSummary
) ;
ConsoleUpdate ( ) ;
return UPDATE_ALL ;
}
// Help on specific command
//===========================================================================
Update_t CmdHelpSpecific ( int nArgs )
{
int iArg ;
if ( ! nArgs )
{
Help_Categories ( ) ;
return ConsoleUpdate ( ) ;
}
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 ) ) )
{
bAllCommands = true ;
nArgs = NUM_COMMANDS ;
}
// If Help on category, push command name as arg
// Mame has categories:
// General, Memory, Execution, Breakpoints, Watchpoints, Expressions, Comments
int iParam = 0 ;
int nNewArgs = 0 ;
int iCmdBegin = 0 ;
int iCmdEnd = 0 ;
int nFound = 0 ;
int iCommand = 0 ;
if ( ! bAllCommands )
{
for ( iArg = 1 ; iArg < = nArgs ; iArg + + )
{
// 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 ) ;
2022-03-27 19:48:26 +00:00
if ( nFoundCategory )
2011-02-20 23:29:30 +00:00
bCategory = true ;
else
bCategory = false ;
2022-03-27 19:48:26 +00:00
switch ( iParam )
2010-06-11 15:38:22 +00:00
{
case PARAM_CAT_BOOKMARKS : iCmdBegin = CMD_BOOKMARK ; iCmdEnd = CMD_BOOKMARK_SAVE ; break ;
2023-03-20 13:25:25 +00:00
case PARAM_CAT_BREAKPOINTS : iCmdBegin = CMD_BREAK_INVALID ; iCmdEnd = CMD_BREAKPOINT_CHANGE ; break ;
2017-02-25 22:32:46 +00:00
case PARAM_CAT_CONFIG : iCmdBegin = CMD_BENCHMARK ; iCmdEnd = CMD_CONFIG_SET_DEBUG_DIR ; break ;
2010-06-11 15:38:22 +00:00
case PARAM_CAT_CPU : iCmdBegin = CMD_ASSEMBLE ; iCmdEnd = CMD_UNASSEMBLE ; break ;
case PARAM_CAT_FLAGS :
2011-02-20 23:29:30 +00:00
nFound = FindCommand ( g_aArgs [ iArg ] . sArg , pFunction , & iCommand ) ; // check if we have an exact command match first
if ( nFound ) // && (iCommand != CMD_MEMORY_FILL))
bCategory = false ;
else if ( nFoundCategory )
2010-06-11 15:38:22 +00:00
{
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_KEYBOARD :
2011-02-20 23:29:30 +00:00
nFound = FindCommand ( g_aArgs [ iArg ] . sArg , pFunction , & iCommand ) ; // check if we have an exact command match first
2010-06-11 15:38:22 +00:00
if ( ( ! nFound ) | | ( iCommand ! = CMD_INPUT_KEY ) )
{
nArgs = 0 ;
Help_KeyboardShortcuts ( ) ;
}
bCategory = false ;
break ;
case PARAM_CAT_MEMORY :
2011-02-20 23:29:30 +00:00
nFound = FindCommand ( g_aArgs [ iArg ] . sArg , pFunction , & iCommand ) ; // check if we have an exact command match first
if ( nFound ) // && (iCommand != CMD_MEMORY_MOVE))
bCategory = false ;
else if ( nFoundCategory )
2010-06-11 15:38:22 +00:00
{
2011-02-20 23:29:30 +00:00
iCmdBegin = CMD_MEMORY_COMPARE ; iCmdEnd = CMD_MEMORY_FILL ;
2010-06-11 15:38:22 +00:00
}
break ;
case PARAM_CAT_OUTPUT :
2011-02-20 23:29:30 +00:00
nFound = FindCommand ( g_aArgs [ iArg ] . sArg , pFunction , & iCommand ) ; // check if we have an exact command match first
if ( nFound ) // && (iCommand != CMD_OUT))
bCategory = false ;
else if ( nFoundCategory )
2010-06-11 15:38:22 +00:00
{
2011-02-20 23:29:30 +00:00
iCmdBegin = CMD_OUTPUT_CALC ; iCmdEnd = CMD_OUTPUT_RUN ;
2010-06-11 15:38:22 +00:00
}
break ;
case PARAM_CAT_SYMBOLS :
2011-02-20 23:29:30 +00:00
nFound = FindCommand ( g_aArgs [ iArg ] . sArg , pFunction , & iCommand ) ; // check if we have an exact command match first
if ( nFound ) // && (iCommand != CMD_SYMBOLS_LOOKUP) && (iCommand != CMD_MEMORY_SEARCH))
bCategory = false ;
else if ( nFoundCategory )
2010-06-11 15:38:22 +00:00
{
2011-02-20 23:29:30 +00:00
iCmdBegin = CMD_SYMBOLS_LOOKUP ; iCmdEnd = CMD_SYMBOLS_LIST ;
2010-06-11 15:38:22 +00:00
}
break ;
case PARAM_CAT_VIEW :
{
2011-02-20 23:29:30 +00:00
iCmdBegin = CMD_VIEW_TEXT4X ; iCmdEnd = CMD_VIEW_DHGR2 ;
2010-06-11 15:38:22 +00:00
}
break ;
case PARAM_CAT_WATCHES :
2011-02-20 23:29:30 +00:00
nFound = FindCommand ( g_aArgs [ iArg ] . sArg , pFunction , & iCommand ) ; // check if we have an exact command match first
if ( nFound ) {
bCategory = false ;
2011-02-20 23:30:04 +00:00
} else // 2.7.0.17: HELP <category> wasn't displaying when category was one of: FLAGS, OUTPUT, WATCHES
2022-03-27 19:48:26 +00:00
if ( nFoundCategory )
2011-02-20 23:29:30 +00:00
{
iCmdBegin = CMD_WATCH_ADD ; iCmdEnd = CMD_WATCH_LIST ;
}
2010-06-11 15:38:22 +00:00
break ;
case PARAM_CAT_WINDOW : iCmdBegin = CMD_WINDOW ; iCmdEnd = CMD_WINDOW_OUTPUT ; break ;
2011-02-20 23:29:30 +00:00
case PARAM_CAT_ZEROPAGE : iCmdBegin = CMD_ZEROPAGE_POINTER ; iCmdEnd = CMD_ZEROPAGE_POINTER_SAVE ; break ;
2010-06-11 15:38:22 +00:00
// 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 + + ;
nNewArgs = ( iCmdEnd - iCmdBegin ) ;
if ( nNewArgs > 0 )
break ;
}
}
if ( nNewArgs > 0 )
{
nArgs = nNewArgs ;
for ( iArg = 1 ; iArg < = nArgs ; iArg + + )
{
# if DEBUG_VAL_2
g_aArgs [ iArg ] . nVal2 = iCmdBegin + iArg - 1 ;
# endif
g_aArgs [ iArg ] . nValue = iCmdBegin + iArg - 1 ;
}
}
for ( iArg = 1 ; iArg < = nArgs ; iArg + + )
2023-03-26 18:31:15 +00:00
{
2010-06-11 15:38:22 +00:00
iCommand = 0 ;
nFound = 0 ;
if ( bCategory )
{
# if DEBUG_VAL_2
iCommand = g_aArgs [ iArg ] . nVal2 ;
# endif
iCommand = g_aArgs [ iArg ] . nValue ;
nFound = 1 ;
}
else
if ( bAllCommands )
{
iCommand = iArg ;
if ( iCommand = = NUM_COMMANDS ) // skip: Internal Consistency Check __COMMANDS_VERIFY_TXT__
continue ;
nFound = 1 ;
}
else
nFound = FindCommand ( g_aArgs [ iArg ] . sArg , pFunction , & iCommand ) ;
if ( nFound > 1 )
{
DisplayAmbigiousCommands ( nFound ) ;
}
if ( iCommand > NUM_COMMANDS )
continue ;
if ( ( nArgs = = 1 ) & & ( ! nFound ) )
iCommand = g_aArgs [ iArg ] . nValue ;
Command_t * pCommand = & g_aCommands [ iCommand ] ;
if ( ! nFound )
{
iCommand = NUM_COMMANDS ;
pCommand = NULL ;
}
// if (nFound && (! bAllCommands) && (! bCategory))
if ( nFound & & ( ! bAllCommands ) & & bDisplayCategory )
{
2022-03-29 18:53:51 +00:00
const char * pCategory = " " ;
2010-06-11 15:38:22 +00:00
int iCmd = g_aCommands [ iCommand ] . iCommand ; // Unaliased command
// HACK: Major kludge to display category!!!
if ( iCmd < = CMD_UNASSEMBLE )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_CPU ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_BOOKMARK_SAVE )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_BOOKMARKS ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_BREAKPOINT_SAVE )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_BREAKPOINTS ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
2017-02-25 22:32:46 +00:00
if ( iCmd < = CMD_CONFIG_SET_DEBUG_DIR )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_CONFIG ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_CURSOR_PAGE_DOWN_4K )
2022-03-29 18:53:51 +00:00
pCategory = " Scrolling " ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_FLAG_SET_N )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_FLAGS ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_MOTD )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_HELP ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_MEMORY_FILL )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_MEMORY ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_OUTPUT_RUN )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_OUTPUT ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_SYNC )
2022-03-29 18:53:51 +00:00
pCategory = " Source " ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_SYMBOLS_LIST )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_SYMBOLS ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_VIEW_DHGR2 )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_VIEW ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_WATCH_SAVE )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_WATCHES ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_WINDOW_OUTPUT )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_WINDOW ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
if ( iCmd < = CMD_ZEROPAGE_POINTER_SAVE )
2022-03-29 18:53:51 +00:00
pCategory = g_aParameters [ PARAM_CAT_ZEROPAGE ] . m_sName ;
2010-06-11 15:38:22 +00:00
else
2022-03-29 18:53:51 +00:00
pCategory = " Unknown! " ;
2010-06-11 15:38:22 +00:00
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %sCategory%s: %s%s "
2010-06-11 15:38:22 +00:00
, CHC_USAGE
, CHC_DEFAULT
, CHC_CATEGORY
2022-03-29 18:53:51 +00:00
, pCategory ) ;
2010-06-11 15:38:22 +00:00
if ( bCategory )
2022-02-26 17:54:06 +00:00
bDisplayCategory = false ;
2010-06-11 15:38:22 +00:00
}
if ( pCommand )
{
2022-02-26 17:54:06 +00:00
const char * const pHelp = pCommand - > pHelpSummary ;
2010-06-11 15:38:22 +00:00
if ( pHelp )
{
2022-03-14 20:50:21 +00:00
std : : string strText = StrFormat ( ( bCategory ) ? " %s%8s%s, %s%s "
: " %s%s%s, %s%s " ,
2022-02-26 17:54:06 +00:00
CHC_COMMAND , pCommand - > m_sName , CHC_ARG_SEP ,
CHC_DEFAULT , pHelp ) ;
//ConsoleBufferPush( strText.c_str() );
ConsolePrint ( strText . c_str ( ) ) ;
2010-06-11 15:38:22 +00:00
}
else
{
# if _DEBUG
2022-02-17 22:12:04 +00:00
ConsoleBufferPushFormat ( " %s <-- Missing " , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
# if DEBUG_COMMAND_HELP
if ( ! bAllCommands ) // Release version doesn't display message
2023-03-26 18:31:15 +00:00
{
2022-02-17 22:12:04 +00:00
ConsoleBufferPushFormat ( " Missing Summary Help: %s " , g_aCommands [ iCommand ] . aName ) ;
2010-06-11 15:38:22 +00:00
}
# endif
# endif
}
if ( bCategory )
continue ;
2023-03-26 18:31:15 +00:00
}
2010-06-11 15:38:22 +00:00
// MASTER HELP
switch ( iCommand )
2023-03-26 18:31:15 +00:00
{
2010-06-11 15:38:22 +00:00
// CPU / General
case CMD_ASSEMBLE :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [address | symbol] " ) ;
2020-10-11 16:14:03 +00:00
ConsoleBufferPush ( " Enter mini-assembler mode [starting at optional address or symbol]. " ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_UNASSEMBLE :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [address | symbol] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Disassembles memory. " ) ;
break ;
2017-02-25 22:32:46 +00:00
case CMD_GO_NORMAL_SPEED :
case CMD_GO_FULL_SPEED :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: address | symbol [Skip,Length] " ) ;
ConsoleColorizePrint ( " Usage: address | symbol [Start:End] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Skip : Start address to skip stepping " ) ;
ConsoleBufferPush ( " Length: Range of bytes past start address to skip stepping " ) ;
ConsoleBufferPush ( " End : Inclusive end address to skip stepping " ) ;
ConsoleBufferPush ( " If the Program Counter is outside the skip range, resumes single-stepping. " ) ;
ConsoleBufferPush ( " Can be used to skip ROM/OS/user code. " ) ;
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s G[G] C600 FA00,600 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s G[G] C600 F000:FFFF " , CHC_EXAMPLE ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_JSR :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [symbol | address] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Pushes PC on stack; calls the named subroutine. " ) ;
break ;
case CMD_NOP :
2022-02-17 22:12:04 +00:00
ConsoleBufferPush ( " Puts a NOP opcode at current instruction " ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_OUT :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [address8 | address16 | symbol] ## [##] " ) ;
ConsoleBufferPush ( " Output a byte or word to the IO address $C0xx " ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_PROFILE :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " Usage: [%s | %s | %s] "
2010-06-11 15:38:22 +00:00
, g_aParameters [ PARAM_RESET ] . m_sName
, g_aParameters [ PARAM_SAVE ] . m_sName
, g_aParameters [ PARAM_LIST ] . m_sName
) ;
ConsoleBufferPush ( " No arguments resets the profile. " ) ;
break ;
// Registers
case CMD_REGISTER_SET :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <reg> <value | expression | symbol> " ) ;
2023-06-04 02:03:11 +00:00
ConsoleBufferPush ( " Where <reg> is one of: A X Y P PC SP " ) ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " See also: %s%s "
2010-06-11 15:38:22 +00:00
, CHC_CATEGORY
, g_aParameters [ PARAM_CAT_OPERATORS ] . m_sName ) ;
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s R PC RESET + 1 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s R PC $FC58 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s R A A1 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s R A $A1 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s R A #A1 " , CHC_EXAMPLE ) ;
2023-06-04 02:03:11 +00:00
ConsolePrintFormat ( " %s R P 0 " , CHC_EXAMPLE ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_SOURCE :
2022-02-17 22:12:04 +00:00
// ConsoleBufferPush( " Reads assembler source file." );
ConsoleColorizePrintFormat ( " Usage: [ %s | %s ] \" filename \" " , g_aParameters [ PARAM_SRC_MEMORY ] . m_sName , g_aParameters [ PARAM_SRC_SYMBOLS ] . m_sName ) ;
ConsoleBufferPushFormat ( " %s: read source bytes into memory. " , g_aParameters [ PARAM_SRC_MEMORY ] . m_sName ) ;
ConsoleBufferPushFormat ( " %s: read symbols into Source symbol table. " , g_aParameters [ PARAM_SRC_SYMBOLS ] . m_sName ) ;
ConsoleBufferPushFormat ( " Supports: %s. " , g_aParameters [ PARAM_SRC_MERLIN ] . m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_STEP_OUT :
ConsoleBufferPush ( " Steps out of current subroutine " ) ;
ConsoleBufferPush ( " Hotkey: Ctrl-Space " ) ; // TODO: FIXME
break ;
case CMD_STEP_OVER : // Bad name? FIXME/TODO: do we need to rename?
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [#] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Steps, # times, thru current instruction " ) ;
ConsoleBufferPush ( " JSR will be stepped into AND out of. " ) ;
ConsoleBufferPush ( " Hotkey: Ctrl-Space " ) ; // TODO: FIXME
break ;
case CMD_TRACE :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [#] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Traces, # times, current instruction(s) " ) ;
ConsoleBufferPush ( " JSR will be stepped into " ) ;
ConsoleBufferPush ( " Hotkey: Shift-Space " ) ;
2016-09-10 12:46:09 +00:00
break ;
2010-06-11 15:38:22 +00:00
case CMD_TRACE_FILE :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: \" [filename] \" [v] " ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_TRACE_LINE :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [#] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Traces into current instruction " ) ;
ConsoleBufferPush ( " with cycle counting. " ) ;
break ;
// Bookmarks
case CMD_BOOKMARK :
case CMD_BOOKMARK_ADD :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [address | symbol] " ) ;
ConsoleColorizePrint ( " Usage: # <address | symbol> " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " If no address or symbol is specified, lists the current bookmarks. " ) ;
ConsoleBufferPush ( " Updates the specified bookmark (#) " ) ;
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s RESET " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s 1 HOME " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_BOOKMARK_CLEAR :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [# | *] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Clears specified bookmark, or all. " ) ;
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s 1 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_BOOKMARK_LIST :
// case CMD_BOOKMARK_LOAD:
case CMD_BOOKMARK_SAVE :
break ;
// Breakpoints
2011-02-21 23:54:09 +00:00
case CMD_BREAK_INVALID :
2022-03-14 20:50:21 +00:00
ConsoleColorizePrintFormat ( " Usage: [%s%s | %s%s] "
2011-02-21 23:54:09 +00:00
, CHC_COMMAND
2022-03-14 20:50:21 +00:00
, g_aParameters [ PARAM_ON ] . m_sName
2011-02-21 23:54:09 +00:00
, CHC_COMMAND
2022-03-14 20:50:21 +00:00
, g_aParameters [ PARAM_OFF ] . m_sName
) ;
ConsoleColorizePrintFormat ( " Usage: [# | # %s%s | # %s%s] "
2011-02-21 23:54:09 +00:00
, CHC_COMMAND
2022-03-14 20:50:21 +00:00
, g_aParameters [ PARAM_ON ] . m_sName
2011-02-21 23:54:09 +00:00
, CHC_COMMAND
2022-03-14 20:50:21 +00:00
, g_aParameters [ PARAM_OFF ] . m_sName
2011-02-21 23:54:09 +00:00
) ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " Usage: [%s%s %s%s | %s%s %s%s] "
2021-12-11 13:41:34 +00:00
, CHC_COMMAND
, g_aParameters [ PARAM_ALL ] . m_sName
, CHC_COMMAND
, g_aParameters [ PARAM_ON ] . m_sName
, CHC_COMMAND
, g_aParameters [ PARAM_ALL ] . m_sName
, CHC_COMMAND
, g_aParameters [ PARAM_OFF ] . m_sName
) ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Where: # is 0=BRK, 1=Invalid Opcode_1, 2=Invalid Opcode_2, 3=Invalid Opcode_3 " ) ;
2011-02-21 23:54:09 +00:00
break ;
// case CMD_BREAK_OPCODE:
2010-06-11 15:38:22 +00:00
case CMD_BREAKPOINT :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " Usage: [%s%s | %s%s | %s%s] "
2010-06-11 15:38:22 +00:00
, CHC_COMMAND
, g_aParameters [ PARAM_LOAD ] . m_sName
, CHC_COMMAND
, g_aParameters [ PARAM_SAVE ] . m_sName
, CHC_COMMAND
, g_aParameters [ PARAM_RESET ] . m_sName ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " Maximum breakpoints: %s%d " , CHC_NUM_DEC , MAX_BREAKPOINTS ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Set breakpoint at PC if no args. " ) ;
ConsoleBufferPush ( " Loading/Saving not yet implemented. " ) ;
break ;
case CMD_BREAKPOINT_ADD_REG :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [A|X|Y|PC|S] [op] <range | value> " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Set breakpoint when reg is [op] value " ) ;
ConsoleBufferPush ( " Default operator is '=' " ) ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " See also: %s%s "
2010-06-11 15:38:22 +00:00
, CHC_CATEGORY
, g_aParameters [ PARAM_CAT_OPERATORS ] . m_sName ) ;
// ConsoleBufferPush( " Examples:" );
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s PC < D000 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s PC = F000:FFFF PC < D000,1000 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s A <= D5 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s A != 01:FF " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s X = A5 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_BREAKPOINT_ADD_SMART :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [address | register] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " If address, sets two breakpoints " ) ;
ConsoleBufferPush ( " 1. one memory access at address " ) ;
ConsoleBufferPush ( " 2. if PC reaches address " ) ;
// "Sets a breakpoint at the current PC or specified address." );
ConsoleBufferPush ( " If an IO address, sets breakpoint on IO access. " ) ;
ConsoleBufferPush ( " If register, sets a breakpoint on memory access at address of register. " ) ;
break ;
case CMD_BREAKPOINT_ADD_PC :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [address] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Sets a breakpoint at the current PC or at the specified address. " ) ;
break ;
case CMD_BREAKPOINT_CLEAR :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [# | *] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Clears specified breakpoint, or all. " ) ;
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s 1 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_BREAKPOINT_DISABLE :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [# [,#] | *] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Disable breakpoint previously set, or all. " ) ;
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s 1 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_BREAKPOINT_ENABLE :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [# [,#] | *] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Re-enables breakpoint previously set, or all. " ) ;
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s 1 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_BREAKPOINT_LIST :
break ;
2019-10-22 20:31:53 +00:00
case CMD_BREAKPOINT_ADD_MEM :
case CMD_BREAKPOINT_ADD_MEMR :
case CMD_BREAKPOINT_ADD_MEMW :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <range> " ) ;
2019-10-22 20:31:53 +00:00
Help_Range ( ) ;
break ;
2022-10-08 18:17:47 +00:00
case CMD_BREAKPOINT_ADD_VIDEO :
ConsoleColorizePrint ( " Usage: <vpos[,length]> " ) ;
break ;
// Config - Load / Save
2010-06-11 15:38:22 +00:00
case CMD_CONFIG_LOAD :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [ \" filename \" ] " ) ;
ConsoleBufferPushFormat ( " Load debugger configuration from '%s', or the specificed file. " , g_sFileNameConfig . c_str ( ) ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_CONFIG_SAVE :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [ \" filename \" ] " ) ;
ConsoleBufferPushFormat ( " Save debugger configuration to '%s', or the specificed file. " , g_sFileNameConfig . c_str ( ) ) ;
2010-06-11 15:38:22 +00:00
break ;
// Config - Color
case CMD_CONFIG_COLOR :
2022-02-17 22:12:04 +00:00
ConsoleBufferPush ( " Usage: [<#> | <# RR GG BB>] " ) ;
ConsoleBufferPush ( " 0 params: switch to 'color' scheme " ) ;
ConsoleBufferPush ( " 1 param : dumps R G B for scheme 'color' " ) ;
ConsoleBufferPush ( " 4 params: sets R G B for scheme 'color' " ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_CONFIG_MONOCHROME :
2022-02-17 22:12:04 +00:00
ConsoleBufferPush ( " Usage: [<#> | <# RR GG BB>] " ) ;
ConsoleBufferPush ( " 0 params: switch to 'monochrome' scheme " ) ;
ConsoleBufferPush ( " 1 param : dumps R G B for scheme 'monochrome' " ) ;
ConsoleBufferPush ( " 4 params: sets R G B for scheme 'monochrome' " ) ;
2010-06-11 15:38:22 +00:00
break ;
// Config - Diasm
case CMD_CONFIG_DISASM :
{
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Note: All arguments effect the disassembly view " ) ;
2010-06-11 15:38:22 +00:00
2022-02-26 17:15:09 +00:00
ConsoleColorizePrintFormat ( " Usage: [%s%s | %s%s | %s%s | %s%s | %s%s | %s%s] "
2010-06-11 15:38:22 +00:00
, CHC_COMMAND
, g_aParameters [ PARAM_CONFIG_BRANCH ] . m_sName
, CHC_COMMAND
2017-08-25 14:36:31 +00:00
, g_aParameters [ PARAM_CONFIG_CLICK ] . m_sName
, CHC_COMMAND
2010-06-11 15:38:22 +00:00
, g_aParameters [ PARAM_CONFIG_COLON ] . m_sName
, CHC_COMMAND
, g_aParameters [ PARAM_CONFIG_OPCODE ] . m_sName
, CHC_COMMAND
, g_aParameters [ PARAM_CONFIG_SPACES ] . m_sName
, CHC_COMMAND
, g_aParameters [ PARAM_CONFIG_TARGET ] . m_sName ) ;
ConsoleBufferPush ( " Display current settings if no args. " ) ;
iParam = PARAM_CONFIG_BRANCH ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " Usage: %s [#] " , g_aParameters [ iParam ] . m_sName ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Set the type of branch character: " ) ;
2022-02-17 22:12:04 +00:00
ConsoleBufferPushFormat ( " %d off, %d plain, %d fancy " ,
DISASM_BRANCH_OFF , DISASM_BRANCH_PLAIN , DISASM_BRANCH_FANCY ) ;
ConsolePrintFormat ( " i.e. %s%s %s 1 " , CHC_EXAMPLE , pCommand - > m_sName , g_aParameters [ iParam ] . m_sName ) ;
2010-06-11 15:38:22 +00:00
2017-08-25 14:36:31 +00:00
iParam = PARAM_CONFIG_CLICK ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " Usage: %s [#] " , g_aParameters [ iParam ] . m_sName ) ;
2017-08-25 14:36:31 +00:00
ConsoleBufferPush ( " Set required key combo. (Alt, Control, or Shift) when left clicking " ) ;
2022-02-17 22:12:04 +00:00
ConsoleBufferPush ( " 0 Left-Click (no Alt, Ctrl, Shift) " ) ;
ConsoleBufferPush ( " 1 Alt Left-click " ) ;
ConsoleBufferPush ( " 2 Ctrl Left-click " ) ;
ConsoleBufferPush ( " 3 Alt+Ctrl Left-click " ) ;
ConsoleBufferPush ( " 4 Shift Left-click " ) ;
ConsoleBufferPush ( " 5 Shift+Alt Left-click " ) ;
ConsoleBufferPush ( " 6 Shift+Ctrl Left-click " ) ;
ConsoleBufferPush ( " 7 Shift+Ctrl+Alt Left-click " ) ;
2017-08-25 14:36:31 +00:00
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s%s %s 0 // Plain Left-click " , CHC_EXAMPLE , pCommand - > m_sName , g_aParameters [ iParam ] . m_sName ) ;
ConsolePrintFormat ( " %s%s %s 1 // Require Alt Left-click " , CHC_EXAMPLE , pCommand - > m_sName , g_aParameters [ iParam ] . m_sName ) ;
ConsolePrintFormat ( " %s%s %s 2 // Require Ctrl Left-click " , CHC_EXAMPLE , pCommand - > m_sName , g_aParameters [ iParam ] . m_sName ) ;
ConsolePrintFormat ( " %s%s %s 3 // Require Alt+Ctrl Left-click " , CHC_EXAMPLE , pCommand - > m_sName , g_aParameters [ iParam ] . m_sName ) ;
2017-08-25 14:36:31 +00:00
2010-06-11 15:38:22 +00:00
iParam = PARAM_CONFIG_COLON ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " Usage: %s [0|1] " , g_aParameters [ iParam ] . m_sName ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Display a colon after the address " ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " i.e. %s%s %s 0 " , CHC_EXAMPLE , pCommand - > m_sName , g_aParameters [ iParam ] . m_sName ) ;
2010-06-11 15:38:22 +00:00
iParam = PARAM_CONFIG_OPCODE ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " Usage: %s [0|1] " , g_aParameters [ iParam ] . m_sName ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Display opcode(s) after colon " ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " i.e. %s%s %s 1 " , CHC_EXAMPLE , pCommand - > m_sName , g_aParameters [ iParam ] . m_sName ) ;
2010-06-11 15:38:22 +00:00
iParam = PARAM_CONFIG_SPACES ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " Usage: %s [0|1] " , g_aParameters [ iParam ] . m_sName ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Display spaces between opcodes " ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " i.e. %s%s %s 0 " , CHC_EXAMPLE , pCommand - > m_sName , g_aParameters [ iParam ] . m_sName ) ;
2010-06-11 15:38:22 +00:00
iParam = PARAM_CONFIG_TARGET ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " Usage: %s [#] " , g_aParameters [ iParam ] . m_sName ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Set the type of target address/value displayed: " ) ;
2022-02-17 22:12:04 +00:00
ConsoleBufferPushFormat ( " %d off, %d value only, %d address only, %d both " ,
2010-06-11 15:38:22 +00:00
DISASM_TARGET_OFF , DISASM_TARGET_VAL , DISASM_TARGET_ADDR , DISASM_TARGET_BOTH ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " i.e. %s%s %s %d " , CHC_EXAMPLE , pCommand - > m_sName , g_aParameters [ iParam ] . m_sName , DISASM_TARGET_VAL ) ;
2010-06-11 15:38:22 +00:00
break ;
}
// Config - Font
case CMD_CONFIG_FONT :
2016-09-10 12:46:09 +00:00
ConsolePrint ( " No longer applicable with new debugger font " ) ;
2010-06-11 15:38:22 +00:00
/*
2022-02-17 22:12:04 +00:00
ConsoleBufferPushFormat ( " Usage: [%s | %s] \" FontName \" [Height] " ,
2010-06-11 15:38:22 +00:00
g_aParameters [ PARAM_FONT_MODE ] . m_sName , g_aParameters [ PARAM_DISASM ] . m_sName ) ;
2022-02-17 22:12:04 +00:00
ConsoleBufferPush ( " i.e. FONT \" Courier \" 12 " ) ;
ConsoleBufferPush ( " i.e. FONT \" Lucida Console \" 12 " ) ;
ConsoleBufferPushFormat ( " %s Controls line spacing. " , g_aParameters [ PARAM_FONT_MODE ] . m_sName ) ;
ConsoleBufferPushFormat ( " Valid values are: %d, %d, %d. " ,
2010-06-11 15:38:22 +00:00
FONT_SPACING_CLASSIC , FONT_SPACING_CLEAN , FONT_SPACING_COMPRESSED ) ;
*/
break ;
2014-08-28 18:13:02 +00:00
// Disasm
case CMD_DEFINE_DATA_BYTE1 :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " Usage: %s <address> | <symbol address> | <symbol range> " , pCommand - > m_sName ) ;
2014-08-28 18:13:02 +00:00
2022-02-17 22:12:04 +00:00
ConsoleBufferPush ( " Tell the diassembler to treat the BYTES as data instead of code. " ) ;
2014-08-28 18:13:02 +00:00
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s WNDTOP 22 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s WNDBTM 23 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s WNDTOP // treat as code again " , CHC_EXAMPLE , g_aCommands [ CMD_DISASM_CODE ] . m_sName ) ;
ConsolePrintFormat ( " %s %s // list all addresses viewed as data " , CHC_EXAMPLE , g_aCommands [ CMD_DISASM_LIST ] . m_sName ) ;
2014-08-28 18:13:02 +00:00
break ;
case CMD_DEFINE_DATA_WORD1 :
// DW // use current debug line
// DW symbol
// DW symbol address
// DW symbol range:range
// DW address
2022-02-17 22:12:04 +00:00
ConsoleColorizePrintFormat ( " Usage: %s <address> | <symbol address> | <symbol range> " , pCommand - > m_sName ) ;
2014-08-28 18:13:02 +00:00
2022-02-17 22:12:04 +00:00
ConsoleBufferPush ( " Tell the diassembler to treat the WORDS as data instead of code. " ) ;
2014-08-28 18:13:02 +00:00
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " The data is a range of 2-byte pointer data. " ) ;
2014-08-28 18:13:02 +00:00
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s NEXT1 801 // AppleSoft Basic Line#1 Pointer to Next line " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s LINE1 803 // Applesoft Basic Line#1 Line Number " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s NEXT1 // treat as code again " , CHC_EXAMPLE , g_aCommands [ CMD_DISASM_CODE ] . m_sName ) ;
ConsolePrintFormat ( " %s %s // list all addresses viewed as data " , CHC_EXAMPLE , g_aCommands [ CMD_DISASM_LIST ] . m_sName ) ;
2014-08-28 18:13:02 +00:00
break ;
2010-06-11 15:38:22 +00:00
// Memory
case CMD_MEMORY_ENTER_BYTE :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <address | symbol> ## [## ... ##] " ) ;
ConsoleBufferPush ( " Sets memory to the specified 8-Bit Values (bytes) " ) ;
2010-06-11 15:38:22 +00:00
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s 00 4C FF69 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s 00:4C FF69 " , CHC_EXAMPLE ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_MEMORY_ENTER_WORD :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <address | symbol> #### [#### ... ####] " ) ;
ConsoleBufferPush ( " Sets memory to the specified 16-Bit Values (words) " ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_MEMORY_FILL :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <address | symbol> <address | symbol> ## " ) ;
ConsoleBufferPush ( " Fills the memory range with the specified byte " ) ;
ConsoleColorizePrintFormat ( " Note: Can't fill IO addresses %s$%sC0xx " , CHC_ARG_SEP , CHC_ADDRESS ) ;
2010-06-11 15:38:22 +00:00
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s 2000:3FFF 00 // Clear HGR page 1 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s 4000,2000 00 // Clear HGR page 2 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s 2000 3FFF 00 // Clear HGR page 1 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_MEMORY_MOVE :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: destination range " ) ;
ConsoleBufferPush ( " Copies bytes specified by the range to the destination starting address. " ) ;
2010-06-11 15:38:22 +00:00
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s 4000 2000:3FFF // move HGR page 1 to page 2 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s 2001 2000:3FFF // clear $2000-$3FFF with the byte at $2000 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s 2001<2000:3FFFM " , CHC_EXAMPLE ) ;
2010-06-11 15:38:22 +00:00
break ;
// case CMD_MEM_MINI_DUMP_ASC_1:
// case CMD_MEM_MINI_DUMP_ASC_2:
case CMD_MEM_MINI_DUMP_ASCII_1 :
case CMD_MEM_MINI_DUMP_ASCII_2 :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <address | symbol> " ) ;
ConsoleBufferPush ( " Displays ASCII text in the Mini-Memory area " ) ;
ConsoleBufferPush ( " ASCII control chars are hilighted " ) ;
ConsoleBufferPush ( " ASCII hi-bit chars are normal " ) ;
2010-06-11 15:38:22 +00:00
// break;
// case CMD_MEM_MINI_DUMP_TXT_LO_1:
// case CMD_MEM_MINI_DUMP_TXT_LO_2:
case CMD_MEM_MINI_DUMP_APPLE_1 :
case CMD_MEM_MINI_DUMP_APPLE_2 :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <address | symbol> " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Displays APPLE text in the Mini-Memory area " ) ;
ConsoleBufferPush ( " APPLE control chars are inverse " ) ;
ConsoleBufferPush ( " APPLE hi-bit chars are normal " ) ;
break ;
// case CMD_MEM_MINI_DUMP_TXT_HI_1:
// case CMD_MEM_MINI_DUMP_TXT_HI_2:
2022-02-17 22:12:04 +00:00
// ConsoleBufferPush( " Usage: <address | symbol>" );
// ConsoleBufferPush( " Displays text in the Memory Mini-Dump area" );
// ConsoleBufferPush( " ASCII chars with the hi-bit set, is inverse" );
2010-06-11 15:38:22 +00:00
break ;
case CMD_MEMORY_LOAD :
case CMD_MEMORY_SAVE :
if ( iCommand = = CMD_MEMORY_LOAD )
{
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [ \" Filename \" ],[bank:]address[,length] " ) ;
ConsoleColorizePrint ( " Usage: [ \" Filename \" ],[bank:]range " ) ;
2010-06-11 15:38:22 +00:00
Help_Range ( ) ;
ConsoleBufferPush ( " Notes: If no filename specified, defaults to the last filename (if possible) " ) ;
}
if ( iCommand = = CMD_MEMORY_SAVE )
2023-03-26 18:31:15 +00:00
{
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [ \" Filename \" ],[bank:]address,length " ) ;
ConsoleColorizePrint ( " Usage: [ \" Filename \" ],[bank:]range " ) ;
2010-06-11 15:38:22 +00:00
Help_Range ( ) ;
2013-09-14 21:46:39 +00:00
ConsoleBufferPush ( " Notes: If no filename specified, defaults to: '####.####.[bank##].bin' " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Where the form is <address>.<length>.bin " ) ;
}
2022-02-17 22:12:04 +00:00
// ConsoleBufferPush( " Examples:" );
2010-06-11 15:38:22 +00:00
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s BSAVE \" test \" ,FF00,100 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s BLOAD \" test \" ,2000:2010 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s BSAVE \" test \" ,F000:FFFF " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s BLOAD \" test \" ,4000 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s BLOAD \" main.bin \" ,0:2000 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s BSAVE \" aux2.bin \" ,1:2000 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s BSAVE \" main.bin \" ,0:2000,2000 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s BSAVE \" aux2.bin \" ,1:2000:3FFF " , CHC_EXAMPLE ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_MEMORY_SEARCH :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: range < \" ASCII text \" | 'apple text' | hex> " ) ;
2010-06-11 15:38:22 +00:00
Help_Range ( ) ;
ConsoleBufferPush ( " Where text is of the form: " ) ;
ConsoleBufferPush ( " \" ... \" designate ASCII text " ) ;
ConsoleBufferPush ( " '...' designate Apple High-Bit text " ) ;
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s F000,1000 'Apple' // search High-Bit " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s MT1 @2 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s %s D000:FFFF \" FLAS \" // search ASCII " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s MA1 @1 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s %s D000,4000 \" EN \" 'D' // Mixed text " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s MT1 @1 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s %s D000,4000 'Apple' ? ']' " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_MEMORY_SEARCH_HEX :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: range [text | byte1 [byte2 ...]] " ) ;
2010-06-11 15:38:22 +00:00
Help_Range ( ) ;
ConsoleBufferPush ( " Where <byte> is of the form: " ) ;
ConsoleBufferPush ( " ## match specific byte " ) ;
ConsoleBufferPush ( " #### match specific 16-bit value " ) ;
ConsoleBufferPush ( " ? match any byte " ) ;
ConsoleBufferPush ( " ?# match any high nibble, match low nibble to specific number " ) ;
ConsoleBufferPush ( " #? match specific high nibble, match any low nibble " ) ;
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s F000,1000 AD ? C0 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s U @1 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s %s F000,1000 ?1 C0 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s F000,1000 5? C0 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s F000,1000 10 C? " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s U @2 - 1 " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s %s F000:FFFF C030 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s U @1 - 1 " , CHC_EXAMPLE ) ;
2010-06-11 15:38:22 +00:00
break ;
// case CMD_MEMORY_SEARCH_APPLE:
2022-02-17 22:12:04 +00:00
// ConsoleBufferPushFormat( "Deprecated. Use: %s", g_aCommands[ CMD_MEMORY_SEARCH ].m_sName );
2010-06-11 15:38:22 +00:00
// break;
// case CMD_MEMORY_SEARCH_ASCII:
2022-02-17 22:12:04 +00:00
// ConsoleBufferPushFormat( "Deprecated. Use: %s", g_aCommands[ CMD_MEMORY_SEARCH ].m_sName );
2010-06-11 15:38:22 +00:00
// break;
// Output
case CMD_OUTPUT_CALC :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <address | symbol | expression > " ) ;
2018-04-17 16:33:56 +00:00
ConsoleBufferPush ( " Operator is one of: + - * / % ^ ~ " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Output order is: Hex Bin Dec Char " ) ;
2018-04-17 16:30:59 +00:00
ConsoleBufferPush ( " Note: symbols take priority. " ) ;
2018-04-17 16:32:11 +00:00
ConsoleBufferPush ( " Note: #A (if you don't want the accumulator value) " ) ;
ConsoleBufferPush ( " Note: #F (if you don't want the flags value) " ) ;
2010-06-11 15:38:22 +00:00
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s CALC 5 + #A " , CHC_EXAMPLE ) ;
ConsolePrintFormat ( " %s CALC 80 * 2 " , CHC_EXAMPLE ) ;
ConsoleColorizePrint ( " See also: " CHC_COMMAND " HELP OP " ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_OUTPUT_ECHO :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: string " ) ;
2010-06-11 15:38:22 +00:00
// ConsoleBufferPush( TEXT(" Examples:" ) );
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s Checkpoint " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s PC " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
// ConsoleBufferPush( TEXT(" Echo the string to the console" ) );
break ;
case CMD_OUTPUT_PRINT :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <string | expression> [, string | expression]* " ) ;
ConsoleColorizePrint ( " Note: To print Register values, they must be in upper case " ) ;
2010-06-11 15:38:22 +00:00
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s \" A: \" ,A, \" X: \" ,X " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s A, \" \" ,X, \" \" ,Y " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s PC " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_OUTPUT_PRINTF :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <string> [, expression, ...] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " The string may contain c-style printf formatting flags: %d %x %z %c " ) ;
ConsoleBufferPush ( " Where: %d decimal, %x hex, %z binary, %c char, %% percent " ) ;
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s \" Dec: %%d Hex: %%x Bin: %%z Char: %%c \" ,A,A,A,A " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s \" %%x %%x %%x \" ,A,X,Y " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
// Symbols
case CMD_SYMBOLS_LOOKUP :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: symbol [= <address>] " ) ;
ConsolePrintFormat ( " %s \" %ssymbol%s \" = %saddress "
2017-08-24 19:36:46 +00:00
, CHC_ARG_MAND
, CHC_SYMBOL
, CHC_ARG_MAND
, CHC_ADDRESS
) ;
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Note: Valid characters are any characters above ASCII space ($20). " ) ;
ConsolePrintFormat ( " You %sMUST%s double-quote names containing special characters to be recognized. "
2017-08-24 19:36:46 +00:00
, CHC_WARNING
, CHC_DEFAULT
) ;
2010-06-11 15:38:22 +00:00
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s HOME " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s LIFE = 2000 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s LIFE " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s \" PR# \" = FE95 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s \" PR# \" " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_SYMBOLS_ROM :
case CMD_SYMBOLS_APPLESOFT :
case CMD_SYMBOLS_ASSEMBLY :
case CMD_SYMBOLS_USER_1 :
case CMD_SYMBOLS_USER_2 :
case CMD_SYMBOLS_SRC_1 :
case CMD_SYMBOLS_SRC_2 :
2022-02-17 22:12:04 +00:00
// ConsoleBufferPush( " Usage: [ ON | OFF | symbol | address ]" );
// ConsoleBufferPush( " Usage: [ LOAD [\"filename\"] | SAVE \"filename\"]" );
// ConsoleBufferPush( " ON : Turns symbols on in the disasm window" );
// ConsoleBufferPush( " OFF : Turns symbols off in the disasm window" );
// ConsoleBufferPush( " LOAD: Loads symbols from last/default filename" );
// ConsoleBufferPush( " SAVE: Saves symbol table to file" );
// ConsoleBufferPush( " CLEAR: Clears the symbol table" );
ConsoleColorizePrint ( " Usage: [ <cmd> | symbol | address ] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Where <cmd> is one of: " ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s%-5s%s: Turns symbols on in the disasm window " , CHC_STRING , g_aParameters [ PARAM_ON ] . m_sName , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s%-5s%s: Turns symbols off in the disasm window " , CHC_STRING , g_aParameters [ PARAM_OFF ] . m_sName , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s%-5s%s: Loads symbols from last/default \" filename \" " , CHC_STRING , g_aParameters [ PARAM_LOAD ] . m_sName , CHC_DEFAULT ) ; // 2.6.2.14 Fixed: Save/Load Param help was swapped.
ConsolePrintFormat ( " %s%-5s%s: Saves symbol table to \" filename \" " , CHC_STRING , g_aParameters [ PARAM_SAVE ] . m_sName , CHC_DEFAULT ) ; // 2.6.2.14 Fixed: Save/Load Param help was swapped.
ConsolePrintFormat ( " %s%-5s%s: Clears the symbol table " , CHC_STRING , g_aParameters [ PARAM_CLEAR ] . m_sName , CHC_DEFAULT ) ;
ConsolePrintFormat ( " %s%-5s%s: Remove symbol " , CHC_STRING , g_aTokens [ TOKEN_EXCLAMATION ] . sToken , CHC_DEFAULT ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_SYMBOLS_LIST :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: symbol " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Looks up symbol in all 3 symbol tables: main, user, source " ) ;
break ;
2023-03-26 18:31:15 +00:00
// Cycles
2020-01-11 17:38:00 +00:00
case CMD_CYCLES_INFO :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <abs|rel|part> " ) ;
2020-01-11 17:38:00 +00:00
ConsoleBufferPush ( " Where: " ) ;
2020-05-23 17:40:12 +00:00
ConsoleBufferPush ( " abs = absolute number of cycles since power-on " ) ;
ConsoleBufferPush ( " rel = number of cycles since last step or breakpoint " ) ;
ConsoleBufferPush ( " part= number of cycles relative to current instruction " ) ;
break ;
case CMD_CYCLES_RESET :
ConsoleBufferPush ( " Use in conjunctioned with 'cycles part' to reset to current instruction " ) ;
2020-01-11 17:38:00 +00:00
break ;
2023-03-26 18:31:15 +00:00
// Video-Scanner
2019-09-22 15:53:38 +00:00
case CMD_VIDEO_SCANNER_INFO :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <dec|hex|real|apple> " ) ;
2019-09-22 15:53:38 +00:00
ConsoleBufferPush ( " Where: " ) ;
ConsoleBufferPush ( " <dec|hex> changes output to dec/hex " ) ;
ConsoleBufferPush ( " <real|apple> alters horz value to hbl-l,visible,hbl-r or hbl-r+l,visible " ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %sYellow%s=invisible (hbl or vbl active) / %sGreen%s=visible "
, CHC_INFO , CHC_DEFAULT // yellow
, CHC_COMMAND , CHC_DEFAULT // green
) ;
2019-09-22 15:53:38 +00:00
break ;
2023-03-26 18:31:15 +00:00
// View
2010-06-11 15:38:22 +00:00
case CMD_VIEW_TEXT4X :
case CMD_VIEW_TEXT41 :
case CMD_VIEW_TEXT42 :
case CMD_VIEW_TEXT8X :
case CMD_VIEW_TEXT81 :
case CMD_VIEW_TEXT82 :
case CMD_VIEW_GRX :
case CMD_VIEW_GR1 :
case CMD_VIEW_GR2 :
case CMD_VIEW_DGRX :
case CMD_VIEW_DGR1 :
case CMD_VIEW_DGR2 :
case CMD_VIEW_HGRX :
case CMD_VIEW_HGR1 :
case CMD_VIEW_HGR2 :
case CMD_VIEW_DHGRX :
case CMD_VIEW_DHGR1 :
case CMD_VIEW_DHGR2 :
2016-09-10 12:46:09 +00:00
ConsolePrint ( " Show the video output in the specified format. " ) ;
2010-06-11 15:38:22 +00:00
break ;
// Watches
case CMD_WATCH_ADD :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <address | symbol> " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Adds the specified memory location to the watch window. " ) ;
break ;
// Window
case CMD_WINDOW_CODE : // summary is good enough
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 :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: <address | symbol> " ) ;
ConsoleColorizePrint ( " Usage: # <address | symbol> [address...] " ) ;
2010-06-11 15:38:22 +00:00
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 " ) ;
Help_Examples ( ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " %s %s CH " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s 0 CV " , CHC_EXAMPLE , pCommand - > m_sName ) ;
ConsolePrintFormat ( " %s %s 0 CV CH " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
break ;
case CMD_ZEROPAGE_POINTER_CLEAR :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [# | *] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " Clears specified zero page pointer, or all. " ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " i.e. %s%s 1 " , CHC_EXAMPLE , pCommand - > m_sName ) ;
2010-06-11 15:38:22 +00:00
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 :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [<address | symbol>] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " If no address specified, will remove watching the zero page pointer. " ) ;
break ;
// Misc
case CMD_VERSION :
2022-02-17 22:12:04 +00:00
ConsoleColorizePrint ( " Usage: [*] " ) ;
2010-06-11 15:38:22 +00:00
ConsoleBufferPush ( " * Display extra internal stats " ) ;
break ;
default :
if ( bAllCommands )
break ;
if ( ( ! nFound ) | | ( ! pCommand ) )
{
2016-09-10 12:46:09 +00:00
ConsoleBufferPush ( " Invalid command. " ) ;
2010-06-11 15:38:22 +00:00
}
else
{
//#if DEBUG_COMMAND_HELP
# if _DEBUG
2022-02-17 22:12:04 +00:00
ConsoleBufferPushFormat ( " Command help not done yet!: %s " , g_aCommands [ iCommand ] . m_sName ) ;
2010-06-11 15:38:22 +00:00
# endif
}
break ;
}
}
return ConsoleUpdate ( ) ;
}
//===========================================================================
Update_t CmdHelpList ( int nArgs )
{
2022-06-05 18:47:40 +00:00
const size_t nMaxWidth = g_nConsoleDisplayWidth - 1 ;
2010-06-11 15:38:22 +00:00
2014-08-14 19:29:01 +00:00
extern std : : vector < Command_t > g_vSortedCommands ;
2010-06-11 15:38:22 +00:00
if ( ! g_vSortedCommands . size ( ) )
{
2022-06-05 18:47:40 +00:00
for ( int iCommand = 0 ; iCommand < NUM_COMMANDS_WITH_ALIASES ; iCommand + + )
2010-06-11 15:38:22 +00:00
{
g_vSortedCommands . push_back ( g_aCommands [ iCommand ] ) ;
}
std : : sort ( g_vSortedCommands . begin ( ) , g_vSortedCommands . end ( ) , commands_functor_compare ( ) ) ;
}
2022-06-05 18:47:40 +00:00
//Colorize( sText, "Commands: " );
std : : string sText = CHC_USAGE " Commands " CHC_DEFAULT " : " ;
2010-06-11 15:38:22 +00:00
2022-06-05 18:47:40 +00:00
for ( int iCommand = 0 ; iCommand < NUM_COMMANDS_WITH_ALIASES ; iCommand + + ) // aliases are not printed
2010-06-11 15:38:22 +00:00
{
Command_t * pCommand = & g_vSortedCommands . at ( iCommand ) ;
// Command_t *pCommand = & g_aCommands[ iCommand ];
char * pName = pCommand - > m_sName ;
if ( ! pCommand - > pFunction )
continue ; // not implemented function
2022-06-05 18:47:40 +00:00
if ( ( sText . length ( ) + strlen ( pName ) ) < nMaxWidth )
2010-06-11 15:38:22 +00:00
{
2022-06-05 18:47:40 +00:00
sText + = CHC_COMMAND ;
2010-06-11 15:38:22 +00:00
}
else
{
2022-06-05 18:47:40 +00:00
ConsolePrint ( sText . c_str ( ) ) ;
sText = " " CHC_COMMAND ;
2010-06-11 15:38:22 +00:00
}
2022-06-05 18:47:40 +00:00
sText + = pName ;
2010-06-11 15:38:22 +00:00
2022-06-05 18:47:40 +00:00
sText + = ' ' ;
2010-06-11 15:38:22 +00:00
}
2022-06-05 18:47:40 +00:00
//ConsoleBufferPush( sText.c_str() );
ConsolePrint ( sText . c_str ( ) ) ;
2010-06-11 15:38:22 +00:00
ConsoleUpdate ( ) ;
return UPDATE_CONSOLE_DISPLAY ;
}
2023-03-26 18:31:15 +00:00
2010-06-11 15:38:22 +00:00
//===========================================================================
Update_t CmdVersion ( int nArgs )
{
unsigned int nVersion = DEBUGGER_VERSION ;
int nMajor ;
int nMinor ;
int nFixMajor ;
int nFixMinor ;
UnpackVersion ( nVersion , nMajor , nMinor , nFixMajor , nFixMinor ) ;
2022-02-17 22:12:04 +00:00
ConsolePrintFormat ( " Emulator: %s%s%s Debugger: %s%d.%d.%d.%d%s "
2010-06-11 15:38:22 +00:00
, CHC_SYMBOL
2022-02-15 18:48:20 +00:00
, g_VERSIONSTRING . c_str ( )
2010-06-11 15:38:22 +00:00
, CHC_DEFAULT
, CHC_SYMBOL
, nMajor , nMinor , nFixMajor , nFixMinor
, CHC_DEFAULT
) ;
if ( nArgs )
{
for ( int iArg = 1 ; iArg < = g_nArgRaw ; iArg + + )
{
// * PARAM_WILDSTAR -> ? PARAM_MEM_SEARCH_WILD
if ( ( ! _tcscmp ( g_aArgs [ iArg ] . sArg , g_aParameters [ PARAM_WILDSTAR ] . m_sName ) ) | |
( ! _tcscmp ( g_aArgs [ iArg ] . sArg , g_aParameters [ PARAM_MEM_SEARCH_WILD ] . m_sName ) ) )
{
2022-02-26 17:15:09 +00:00
ConsoleBufferPushFormat ( " Arg: % " SIZE_T_FMT " bytes * %d = % " SIZE_T_FMT " bytes " ,
2010-06-11 15:38:22 +00:00
sizeof ( Arg_t ) , MAX_ARGS , sizeof ( g_aArgs ) ) ;
2022-02-26 17:15:09 +00:00
ConsoleBufferPushFormat ( " Console: % " SIZE_T_FMT " bytes * %d height = % " SIZE_T_FMT " bytes " ,
2010-06-11 15:38:22 +00:00
sizeof ( g_aConsoleDisplay [ 0 ] ) , CONSOLE_HEIGHT , sizeof ( g_aConsoleDisplay ) ) ;
2022-02-17 22:12:04 +00:00
ConsoleBufferPushFormat ( " Commands: %d (Aliased: %d) Params: %d " ,
2010-06-11 15:38:22 +00:00
NUM_COMMANDS , NUM_COMMANDS_WITH_ALIASES , NUM_PARAMS ) ;
2022-02-17 22:12:04 +00:00
ConsoleBufferPushFormat ( " Cursor(%d) T: %04X C: %04X B: %04X %c D: %02X " , // Top, Cur, Bot, Delta
2010-06-11 15:38:22 +00:00
g_nDisasmCurLine , g_nDisasmTopAddress , g_nDisasmCurAddress , g_nDisasmBotAddress ,
g_bDisasmCurBad ? TEXT ( ' * ' ) : TEXT ( ' ' )
, g_nDisasmBotAddress - g_nDisasmTopAddress
) ;
CmdConfigGetFont ( 0 ) ;
break ;
}
else
return Help_Arg_1 ( CMD_VERSION ) ;
}
}
return ConsoleUpdate ( ) ;
}