Updated help, BPA, BLOAD/BSAVE

This commit is contained in:
mpohoreski 2006-06-25 03:43:49 +00:00
parent 18b78ae9d5
commit 1b748bd169
5 changed files with 173 additions and 93 deletions

View File

@ -33,8 +33,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#pragma hdrstop
// NEW UI debugging
// #define DEBUG_FORCE_DISPLAY 1
// #define DEBUG_COMMAND_HELP 1
// #define DEBUG_ASM_HASH 1
@ -43,7 +41,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// TODO: COLOR LOAD ["filename"]
// See Debugger_Changelong.txt for full details
const int DEBUGGER_VERSION = MAKE_VERSION(2,5,3,8);
const int DEBUGGER_VERSION = MAKE_VERSION(2,5,3,14);
// Public _________________________________________________________________________________________
@ -144,17 +142,17 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
{TEXT("TF") , CmdTraceFile , CMD_TRACE_FILE , "Save trace to filename" },
{TEXT("TL") , CmdTraceLine , CMD_TRACE_LINE , "Trace (with cycle counting)" },
// Breakpoints
{TEXT("BP") , CmdBreakpointMenu , CMD_BREAKPOINT , "Access breakpoint options" },
{TEXT("BP") , CmdBreakpointMenu , CMD_BREAKPOINT , "Save/Load Breakpoints" },
{TEXT("BPA") , CmdBreakpointAddSmart, CMD_BREAKPOINT_ADD_SMART , "Add (smart) breakpoint" },
// {TEXT("BPP") , CmdBreakpointAddFlag , CMD_BREAKPOINT_ADD_FLAG , "Add breakpoint on flags" },
{TEXT("BPR") , CmdBreakpointAddReg , CMD_BREAKPOINT_ADD_REG , "Add breakpoint on register value" }, // NOTE! Different from SoftICE !!!!
{TEXT("BPX") , CmdBreakpointAddPC , CMD_BREAKPOINT_ADD_PC , "Add breakpoint at current instruction" },
{TEXT("BPIO") , CmdBreakpointAddIO , CMD_BREAKPOINT_ADD_IO , "Add breakpoint for IO address $C0xx" },
{TEXT("BPM") , CmdBreakpointAddMem , CMD_BREAKPOINT_ADD_MEM , "Add breakpoint on memory access" }, // SoftICE
{TEXT("BC") , CmdBreakpointClear , CMD_BREAKPOINT_CLEAR , "Clear breakpoint # or *" }, // SoftICE
{TEXT("BC") , CmdBreakpointClear , CMD_BREAKPOINT_CLEAR , "Clear breakpoint" }, // SoftICE
{TEXT("BD") , CmdBreakpointDisable , CMD_BREAKPOINT_DISABLE , "Disable breakpoint # or *" }, // SoftICE
{TEXT("BPE") , CmdBreakpointEdit , CMD_BREAKPOINT_EDIT , "Edit breakpoint # or *" }, // SoftICE
{TEXT("BE") , CmdBreakpointEnable , CMD_BREAKPOINT_ENABLE , "Enable breakpoint # or *" }, // SoftICE
{TEXT("BPE") , CmdBreakpointEdit , CMD_BREAKPOINT_EDIT , "Edit breakpoint" }, // SoftICE
{TEXT("BE") , CmdBreakpointEnable , CMD_BREAKPOINT_ENABLE , "Enable breakpoint" }, // SoftICE
{TEXT("BL") , CmdBreakpointList , CMD_BREAKPOINT_LIST , "List breakpoints" }, // SoftICE
{TEXT("BPLOAD") , CmdBreakpointLoad , CMD_BREAKPOINT_LOAD , "Loads breakpoints" },
{TEXT("BPSAVE") , CmdBreakpointSave , CMD_BREAKPOINT_SAVE , "Saves breakpoints" },
@ -165,7 +163,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
{TEXT("BW") , CmdConfigColorMono , CMD_CONFIG_BW , "Sets/Shows RGB for Black & White scheme" },
{TEXT("COLOR") , CmdConfigColorMono , CMD_CONFIG_COLOR , "Sets/Shows RGB for color scheme" },
{TEXT("CONFIG") , CmdConfigMenu , CMD_CONFIG_MENU , "Access config options" },
{TEXT("DISASM") , CmdConfigDisasm , CMD_CONFIG_DISASM , "Sets disassembly view options." },
{TEXT("DISASM") , CmdConfigDisasm , CMD_CONFIG_DISASM , "Sets/Shows disassembly view options." },
{TEXT("ECHO") , CmdConfigEcho , CMD_CONFIG_ECHO , "Echo string, or toggle command echoing" },
{TEXT("FONT") , CmdConfigFont , CMD_CONFIG_FONT , "Shows current font or sets new one" },
{TEXT("HCOLOR") , CmdConfigHColor , CMD_CONFIG_HCOLOR , "Sets/Shows colors mapped to Apple HGR" },
@ -243,7 +241,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
{TEXT("EW") , CmdMemoryEnterWord , CMD_MEMORY_ENTER_WORD },
{TEXT("BLOAD") , CmdMemoryLoad , CMD_MEMORY_LOAD , "Load a region of memory" },
{TEXT("M") , CmdMemoryMove , CMD_MEMORY_MOVE },
{TEXT("BSAVE") , CmdMemorySave , CMD_MEMORY_SAVE , "Save a region of memory\n" },
{TEXT("BSAVE") , CmdMemorySave , CMD_MEMORY_SAVE , "Save a region of memory" },
{TEXT("S") , CmdMemorySearch , CMD_MEMORY_SEARCH , "Search for text for hex values" },
{TEXT("SA") , CmdMemorySearchAscii, CMD_MEMORY_SEARCH_ASCII , "Search ASCII text" }, // Search ASCII
{TEXT("ST") , CmdMemorySearchApple , CMD_MEMORY_SEARCH_APPLE , "Search Apple text (hi-bit)" }, // Search Apple Text
@ -546,8 +544,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
const unsigned int _6502_STACK_END = 0x01FF;
const unsigned int _6502_IO_BEGIN = 0xC000;
const unsigned int _6502_IO_END = 0xC0FF;
const unsigned int _6502_BEG_MEM_ADDRESS = 0x0000;
const unsigned int _6502_END_MEM_ADDRESS = 0xFFFF;
const unsigned int _6502_MEM_BEGIN = 0x0000;
const unsigned int _6502_MEM_END = 0xFFFF;
MemoryDump_t g_aMemDump[ NUM_MEM_DUMPS ];
@ -806,7 +804,7 @@ static bool ParseAssemblyListing ( bool bBytesToMemory, bool bAddSymbols );
Update_t _CmdWindowViewCommon (int iNewWindow);
// Utility
bool _GetStartEnd( WORD & nAddressStart_, WORD & nAddressEnd_ );
bool _GetStartEnd( WORD & nAddressStart_, WORD & nAddressEnd_, const int iArg = 1 );
bool StringCat( TCHAR * pDst, LPCSTR pSrc, const int nDstSize );
bool TestStringCat ( TCHAR * pDst, LPCSTR pSrc, const int nDstSize );
@ -1362,7 +1360,7 @@ Update_t CmdJSR (int nArgs)
if (! nArgs)
return Help_Arg_1( CMD_JSR );
WORD nAddress = g_aArgs[1].nVal1 & _6502_END_MEM_ADDRESS;
WORD nAddress = g_aArgs[1].nVal1 & _6502_MEM_END;
// Mark Stack Page as dirty
*(memdirty+(regs.sp >> 8)) = 1;
@ -1584,8 +1582,8 @@ Update_t CmdBreakpointAddSmart (int nArgs)
if (! nArgs)
{
// return Help_Arg_1( CMD_BREAKPOINT_ADD_SMART );
g_aArgs[1].nVal1 = g_nDisasmCurAddress;
nArgs = 1;
g_aArgs[ nArgs ].nVal1 = g_nDisasmCurAddress;
}
if ((nAddress >= _6502_IO_BEGIN) && (nAddress <= _6502_IO_END))
@ -1730,7 +1728,7 @@ bool _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, B
else
{
// Clamp Length so it stays within the 6502 memory address
int nSlack = (_6502_END_MEM_ADDRESS + 1) - nAddress;
int nSlack = (_6502_MEM_END + 1) - nAddress;
int nWantedLength = g_aArgs[iArg].nVal2;
nLen = MIN( nSlack, nWantedLength );
}
@ -2155,7 +2153,7 @@ Update_t CmdConfigRun (int nArgs)
strcpy( sMiniFileName, pFileName );
// strcat( sMiniFileName, ".aws" ); // HACK: MAGIC STRING
_tcscpy(sFileName, progdir);
_tcscpy(sFileName, g_sProgramDir);
_tcscat(sFileName, sMiniFileName);
if (script.Read( sFileName ))
@ -2188,7 +2186,7 @@ Update_t CmdConfigRun (int nArgs)
Update_t CmdConfigSave (int nArgs)
{
TCHAR filename[ MAX_PATH ];
_tcscpy(filename, progdir);
_tcscpy(filename, g_sProgramDir);
_tcscat(filename, g_FileNameConfig );
HANDLE hFile = CreateFile(filename,
@ -3003,7 +3001,7 @@ void _CursorMoveDownAligned( int nDelta )
if (g_aMemDump[0].eDevice == DEV_MEMORY)
{
g_aMemDump[0].nAddress += nDelta;
g_aMemDump[0].nAddress &= _6502_END_MEM_ADDRESS;
g_aMemDump[0].nAddress &= _6502_MEM_END;
}
}
}
@ -3016,7 +3014,7 @@ void _CursorMoveDownAligned( int nDelta )
else
nNewAddress += (nDelta - (nNewAddress & (nDelta-1))); // .22 Fixed: Shift-PageUp Shift-PageDown Ctrl-PageUp Ctrl-PageDown -> _CursorMoveUpAligned() & _CursorMoveDownAligned()
g_nDisasmTopAddress = nNewAddress & _6502_END_MEM_ADDRESS; // .21 Fixed: _CursorMoveUpAligned() & _CursorMoveDownAligned() not wrapping around past FF00 to 0, and wrapping around past 0 to FF00
g_nDisasmTopAddress = nNewAddress & _6502_MEM_END; // .21 Fixed: _CursorMoveUpAligned() & _CursorMoveDownAligned() not wrapping around past FF00 to 0, and wrapping around past 0 to FF00
}
}
@ -3031,7 +3029,7 @@ void _CursorMoveUpAligned( int nDelta )
if (g_aMemDump[0].eDevice == DEV_MEMORY)
{
g_aMemDump[0].nAddress -= nDelta;
g_aMemDump[0].nAddress &= _6502_END_MEM_ADDRESS;
g_aMemDump[0].nAddress &= _6502_MEM_END;
}
}
}
@ -3044,7 +3042,7 @@ void _CursorMoveUpAligned( int nDelta )
else
nNewAddress -= (nNewAddress & (nDelta-1)); // .22 Fixed: Shift-PageUp Shift-PageDown Ctrl-PageUp Ctrl-PageDown -> _CursorMoveUpAligned() & _CursorMoveDownAligned()
g_nDisasmTopAddress = nNewAddress & _6502_END_MEM_ADDRESS; // .21 Fixed: _CursorMoveUpAligned() & _CursorMoveDownAligned() not wrapping around past FF00 to 0, and wrapping around past 0 to FF00
g_nDisasmTopAddress = nNewAddress & _6502_MEM_END; // .21 Fixed: _CursorMoveUpAligned() & _CursorMoveDownAligned() not wrapping around past FF00 to 0, and wrapping around past 0 to FF00
}
}
@ -3542,7 +3540,7 @@ Update_t CmdMemoryFill (int nArgs)
//===========================================================================
Update_t CmdMemoryLoad (int nArgs)
{
// BLOAD addr[,len] "Filename"
// BLOAD ["Filename"] addr[,len]
if (nArgs != 2)
return Help_Arg_1( CMD_MEMORY_LOAD );
@ -3550,17 +3548,17 @@ Update_t CmdMemoryLoad (int nArgs)
{
WORD nAddressStart;
WORD nAddressEnd;
if (_GetStartEnd( nAddressStart, nAddressEnd ))
if (_GetStartEnd( nAddressStart, nAddressEnd, 2 ))
{
WORD nAddressLen = nAddressEnd - nAddressStart;
BYTE *pMemory = new BYTE [ _6502_END_MEM_ADDRESS + 1 ]; // default 64K buffer
BYTE *pMemory = new BYTE [ _6502_MEM_END + 1 ]; // default 64K buffer
BYTE *pDst = mem + nAddressStart;
BYTE *pSrc = pMemory;
TCHAR sFilePath[ MAX_PATH ];
_tcscpy( sFilePath,progdir );
_tcscat( sFilePath, g_aArgs[ 2 ].sArg );
_tcscpy( sFilePath,g_sProgramDir );
_tcscat( sFilePath, g_aArgs[ 1 ].sArg );
FILE *hFile = fopen( sFilePath, "rb" );
if (hFile)
@ -3569,8 +3567,8 @@ Update_t CmdMemoryLoad (int nArgs)
int nFileBytes = ftell( hFile );
fseek( hFile, 0, SEEK_SET );
if (nFileBytes > _6502_END_MEM_ADDRESS)
nFileBytes = _6502_END_MEM_ADDRESS + 1; // Bank-switched RAMR/ROM is only 16-bit
if (nFileBytes > _6502_MEM_END)
nFileBytes = _6502_MEM_END + 1; // Bank-switched RAMR/ROM is only 16-bit
// Caller didnt' specify how many bytes to read, default to them all
if (nAddressLen == 0)
@ -3586,20 +3584,20 @@ Update_t CmdMemoryLoad (int nArgs)
{
*pDst++ = *pSrc++;
}
ConsoleBufferPush( TEXT( "Loaded.\n" ) );
ConsoleBufferPush( TEXT( "Loaded." ) );
}
fclose( hFile );
}
else
{
ConsoleBufferPush( TEXT( "Error: Bad filename.\n" ) );
ConsoleBufferPush( TEXT( "Error: Bad filename." ) );
}
delete [] pMemory;
}
}
return UPDATE_CONSOLE_DISPLAY;
return ConsoleUpdate();
}
@ -3629,7 +3627,7 @@ Update_t CmdMemorySave (int nArgs)
static TCHAR sFileName[ MAX_PATH ];
TCHAR sFilePath[ MAX_PATH ];
_tcscpy( sFilePath, progdir );
_tcscpy( sFilePath, g_sProgramDir );
if (! nArgs)
{
@ -3641,23 +3639,23 @@ Update_t CmdMemorySave (int nArgs)
}
else
{
wsprintf( sLast, TEXT( "Last saved: none\n" ) );
wsprintf( sLast, TEXT( "Last saved: none" ) );
}
ConsoleBufferPush( sLast );
}
else
{
if (_GetStartEnd( nAddressStart, nAddressEnd ))
if (_GetStartEnd( nAddressStart, nAddressEnd, nArgs ))
{
nAddressLen = nAddressEnd - nAddressStart;
if ((nAddressLen) && (nAddressLen < _6502_END_MEM_ADDRESS))
if ((nAddressLen) && (nAddressLen < _6502_MEM_END))
{
// BSAVE addr,len "Filename"
// BSAVE ["Filename"] addr,len
if (nArgs == 1)
{
sprintf( g_aArgs[ 2 ].sArg, "%04X.%04X.bin", nAddressStart, nAddressLen ); // nAddressEnd );
nArgs++;;
sprintf( g_aArgs[ 1 ].sArg, "%04X.%04X.bin", nAddressStart, nAddressLen ); // nAddressEnd );
nArgs++;
}
if (nArgs == 2)
@ -3672,13 +3670,13 @@ Update_t CmdMemorySave (int nArgs)
*pDst++ = *pSrc++;
}
_tcscpy( sFileName, g_aArgs[ 2 ].sArg );
_tcscpy( sFileName, g_aArgs[ 1 ].sArg );
_tcscat( sFilePath, sFileName );
FILE *hFile = fopen( sFilePath, "rb" );
if (hFile)
{
ConsoleBufferPush( TEXT( "Warning: File already exists. Overwriting.\n" ) );
ConsoleBufferPush( TEXT( "Warning: File already exists. Overwriting." ) );
fclose( hFile );
}
@ -3688,11 +3686,11 @@ Update_t CmdMemorySave (int nArgs)
size_t nWrote = fwrite( pMemory, nAddressLen, 1, hFile );
if (nWrote == 1) // (size_t)nAddressLen)
{
ConsoleBufferPush( TEXT( "Saved.\n" ) );
ConsoleBufferPush( TEXT( "Saved." ) );
}
else
{
ConsoleBufferPush( TEXT( "Error saving.\n" ) );
ConsoleBufferPush( TEXT( "Error saving." ) );
}
fclose( hFile );
}
@ -3703,19 +3701,19 @@ Update_t CmdMemorySave (int nArgs)
}
}
return UPDATE_CONSOLE_DISPLAY;
return ConsoleUpdate();
}
//===========================================================================
bool _GetStartEnd( WORD & nAddressStart_, WORD & nAddressEnd_ )
bool _GetStartEnd( WORD & nAddressStart_, WORD & nAddressEnd_, const int iArg )
{
nAddressStart_ = g_aArgs[1].nVal1;
int nEnd = nAddressStart_ + g_aArgs[1].nVal2;
nAddressStart_ = g_aArgs[ iArg ].nVal1;
int nEnd = nAddressStart_ + g_aArgs[ iArg ].nVal2;
// .17 Bug Fix: D000,FFFF -> D000,CFFF (nothing searched!)
if (nEnd > _6502_END_MEM_ADDRESS)
nEnd = _6502_END_MEM_ADDRESS;
if (nEnd > _6502_MEM_END)
nEnd = _6502_MEM_END;
nAddressEnd_ = nEnd;
return true;
@ -4199,7 +4197,7 @@ bool ParseAssemblyListing( bool bBytesToMemory, bool bAddSymbols )
g_nSourceAssembleBytes = 0;
g_nSourceAssemblySymbols = 0;
const DWORD INVALID_ADDRESS = _6502_END_MEM_ADDRESS + 1;
const DWORD INVALID_ADDRESS = _6502_MEM_END + 1;
bool bPrevSymbol = false;
bool bFourBytes = false;
@ -4346,7 +4344,7 @@ Update_t CmdSource (int nArgs)
else
{
TCHAR sFileName[MAX_PATH];
_tcscpy(sFileName,progdir);
_tcscpy(sFileName,g_sProgramDir);
_tcscat(sFileName, pFileName);
const int MAX_MINI_FILENAME = 20;
@ -4776,7 +4774,7 @@ int ParseSymbolTable( TCHAR *pFileName, Symbols_e eWhichTableToLoad )
Update_t CmdSymbolsLoad (int nArgs)
{
TCHAR sFileName[MAX_PATH];
_tcscpy(sFileName,progdir);
_tcscpy(sFileName,g_sProgramDir);
int iWhichTable = (g_iCommand - CMD_SYMBOLS_MAIN);
if ((iWhichTable < 0) || (iWhichTable >= NUM_SYMBOL_TABLES))
@ -4809,7 +4807,7 @@ Update_t CmdSymbolsLoad (int nArgs)
{
TCHAR *pFileName = g_aArgs[ iArg ].sArg;
_tcscpy(sFileName,progdir);
_tcscpy(sFileName,g_sProgramDir);
_tcscat(sFileName, pFileName);
// Remember File ame of symbols loaded
@ -5130,7 +5128,7 @@ Update_t CmdGo (int nArgs)
g_nDebugSkipStart = g_aArgs[ iArg ].nVal1;
WORD nAddress = g_aArgs[ iArg ].nVal2;
// int nSlack = (_6502_END_MEM_ADDRESS + 1) - nAddress;
// int nSlack = (_6502_MEM_END + 1) - nAddress;
// int nWantedLength = g_aArgs[iArg].nVal2;
// g_nDebugSkipLen = MIN( nSlack, nWantedLength );
int nEnd = nAddress - g_nDebugSkipStart;
@ -5139,7 +5137,7 @@ Update_t CmdGo (int nArgs)
else
g_nDebugSkipLen = nAddress - g_nDebugSkipStart;
g_nDebugSkipLen &= _6502_END_MEM_ADDRESS;
g_nDebugSkipLen &= _6502_MEM_END;
}
// WORD nAddressSymbol = 0;
@ -5220,7 +5218,7 @@ Update_t CmdTraceFile (int nArgs) {
fclose(g_hTraceFile);
TCHAR filename[MAX_PATH];
_tcscpy(filename,progdir);
_tcscpy(filename,g_sProgramDir);
_tcscat(filename,(nArgs && g_aArgs[1].sArg[0]) ? g_aArgs[1].sArg : g_FileNameTrace );
g_hTraceFile = fopen(filename,TEXT("wt"));
@ -6780,7 +6778,7 @@ bool ProfileSave()
bool bStatus = false;
TCHAR filename[MAX_PATH];
_tcscpy(filename,progdir);
_tcscpy(filename,g_sProgramDir);
_tcscat(filename,g_FileNameProfile ); // TEXT("Profile.txt")); // =PATCH MJP
FILE *hFile = fopen(filename,TEXT("wt"));
@ -6828,13 +6826,13 @@ void DebugBegin ()
g_nAppMode = MODE_DEBUG;
FrameRefreshStatus(DRAW_TITLE);
if (apple2e)
if (g_bApple2e)
g_aOpcodes = & g_aOpcodes65C02[ 0 ]; // Enhanced Apple //e
else
g_aOpcodes = & g_aOpcodes6502[ 0 ]; // Original Apple ][ ][+
g_aOpmodes[ AM_2 ].m_nBytes = apple2e ? 2 : 1;
g_aOpmodes[ AM_3 ].m_nBytes = apple2e ? 3 : 1;
g_aOpmodes[ AM_2 ].m_nBytes = g_bApple2e ? 2 : 1;
g_aOpmodes[ AM_3 ].m_nBytes = g_bApple2e ? 3 : 1;
g_nDisasmCurAddress = regs.pc;
DisasmCalcTopBotAddress();
@ -7525,11 +7523,11 @@ void DebuggerProcessKey( int keycode )
else
{
// If you really want $000 at the top of the screen...
// g_nDisasmTopAddress = _6502_BEG_MEM_ADDRESS;
// g_nDisasmTopAddress = _6502_MEM_BEGIN;
// DisasmCalcCurFromTopAddress();
// DisasmCalcBotFromTopAddress();
g_nDisasmCurAddress = _6502_BEG_MEM_ADDRESS;
g_nDisasmCurAddress = _6502_MEM_BEGIN;
DisasmCalcTopBotAddress();
}
bUpdateDisplay |= UPDATE_DISASM;
@ -7555,11 +7553,11 @@ void DebuggerProcessKey( int keycode )
else
{
// If you really want $8000 at the top of the screen...
// g_nDisasmTopAddress = (_6502_END_MEM_ADDRESS / 2) + 1;
// g_nDisasmTopAddress = (_6502_MEM_END / 2) + 1;
// DisasmCalcCurFromTopAddress();
// DisasmCalcTopBotAddress();
g_nDisasmCurAddress = (_6502_END_MEM_ADDRESS / 2) + 1;
g_nDisasmCurAddress = (_6502_MEM_END / 2) + 1;
DisasmCalcTopBotAddress();
}
bUpdateDisplay |= UPDATE_DISASM;

View File

@ -32,6 +32,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <assert.h>
// NEW UI debugging
// #define DEBUG_FORCE_DISPLAY 1
// Public _________________________________________________________________________________________
@ -632,6 +635,8 @@ void DrawBreakpoints (HDC dc, int line)
SetTextColor( dc, DebuggerGetColor( iForeground ) );
#if DEBUG_FORCE_DISPLAY
extern COLORREF gaColorPalette[ NUM_PALETTE ];
int iColor = R8 + (iBreakpoint*2);
COLORREF nColor = gaColorPalette[ iColor ];
if (iBreakpoint >= 4)

View File

@ -195,12 +195,15 @@ Update_t CmdHelpSpecific (int nArgs)
}
// 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;
for (iArg = 1; iArg <= nArgs; iArg++ )
{
int iParam;
int nFoundCategory = FindParam( g_aArgs[ iArg ].sArg, MATCH_EXACT, iParam, _PARAM_HELPCATEGORIES_BEGIN, _PARAM_HELPCATEGORIES_END );
switch( iParam )
{
@ -270,7 +273,7 @@ Update_t CmdHelpSpecific (int nArgs)
pCommand = NULL;
}
if (nFound && (! bAllCommands))
if (nFound && (! bAllCommands) && (! bCategory))
{
TCHAR sCategory[ CONSOLE_WIDTH ];
int iCmd = g_aCommands[ iCommand ].iCommand; // Unaliased command
@ -409,13 +412,13 @@ Update_t CmdHelpSpecific (int nArgs)
break;
case CMD_STEP_OUT:
ConsoleBufferPush( TEXT(" Steps out of current subroutine") );
ConsoleBufferPush( TEXT(" Hotkey: Ctrl-Space" ) );
ConsoleBufferPush( TEXT(" Hotkey: Ctrl-Space" ) ); // TODO: FIXME
break;
case CMD_STEP_OVER: // Bad name? FIXME/TODO: do we need to rename?
ConsoleBufferPush( TEXT(" Usage: [#]") );
ConsoleBufferPush( TEXT(" Steps, # times, thru current instruction") );
ConsoleBufferPush( TEXT(" JSR will be stepped into AND out of.") );
ConsoleBufferPush( TEXT(" Hotkey: Ctrl-Space" ) );
ConsoleBufferPush( TEXT(" Hotkey: Ctrl-Space" ) ); // TODO: FIXME
break;
case CMD_TRACE:
ConsoleBufferPush( TEXT(" Usage: [#]") );
@ -432,28 +435,58 @@ Update_t CmdHelpSpecific (int nArgs)
break;
// Breakpoints
case CMD_BREAKPOINT:
wsprintf( sText, " Maximum breakpoints are: %d", NUM_BREAKPOINTS );
wsprintf( sText, " Maximum breakpoints: %d", NUM_BREAKPOINTS );
ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" Usage: [%s | %s | %s]")
, g_aParameters[ PARAM_LOAD ].m_sName
, g_aParameters[ PARAM_SAVE ].m_sName
, g_aParameters[ PARAM_RESET ].m_sName );
ConsoleBufferPush( sText );
ConsoleBufferPush( TEXT(" Set breakpoint at PC if no args.") );
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") );
break;
case CMD_BREAKPOINT_ADD_SMART:
ConsoleBufferPush( TEXT(" Usage: [address | register]") );
ConsoleBufferPush( TEXT(" If address, sets two breakpoints" ) );
ConsoleBufferPush( TEXT(" 1. one memory access at address" ) );
ConsoleBufferPush( TEXT(" 2. if PC reaches address" ) );
// "Sets a breakpoint at the current PC or specified address." ) );
ConsoleBufferPush( TEXT(" If an IO address, sets breakpoint on IO access.") );
ConsoleBufferPush( TEXT(" If register, sets a breakpoint on memory access at address of register.") );
break;
case CMD_BREAKPOINT_ADD_PC:
ConsoleBufferPush( TEXT(" Usage: [address]") );
ConsoleBufferPush( TEXT(" Sets a breakpoint at the current PC") );
ConsoleBufferPush( TEXT(" or at the specified address.") );
ConsoleBufferPush( TEXT(" Sets a breakpoint at the current PC or at the specified address.") );
break;
case CMD_BREAKPOINT_CLEAR:
ConsoleBufferPush( TEXT(" Usage: [# | *]") );
ConsoleBufferPush( TEXT(" Clears specified breakpoint, or all.") );
wsprintf( sText, TEXT(" i.e. %s 1" ), pCommand->m_sName );
ConsoleBufferPush( sText );
break;
case CMD_BREAKPOINT_DISABLE:
ConsoleBufferPush( TEXT(" Usage: [# [,#] | *]") );
ConsoleBufferPush( TEXT(" Disable breakpoint previously set, or all.") );
wsprintf( sText, TEXT(" i.e. %s 1" ), pCommand->m_sName );
ConsoleBufferPush( sText );
break;
case CMD_BREAKPOINT_ENABLE:
ConsoleBufferPush( TEXT(" Usage: [# [,#] | *]") );
ConsoleBufferPush( TEXT(" Re-enables breakpoint previously set, or all.") );
wsprintf( sText, TEXT(" i.e. %s 1" ), pCommand->m_sName );
ConsoleBufferPush( sText );
break;
case CMD_BREAKPOINT_LIST:
break;
// Config - Color
case CMD_CONFIG_MENU:
ConsoleBufferPush( TEXT(" Load/Save configuration, or change disasm view options.\n" ) );
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 );
wsprintf( sText, TEXT(" %s" ": Saves config to \"filename\"" ), g_aParameters[ PARAM_LOAD ].m_sName ); ConsoleBufferPush( sText );
break;
case CMD_CONFIG_COLOR:
@ -474,38 +507,60 @@ Update_t CmdHelpSpecific (int nArgs)
break;
// Config - Diasm
case CMD_CONFIG_DISASM:
ConsoleBufferPush( TEXT("Note: All commands effect the disassembly view" ) );
{
ConsoleBufferPush( TEXT(" Note: All arguments effect the disassembly view" ) );
wsprintf( sText, TEXT(" Usage: %s [#]" ), g_aParameters[ PARAM_CONFIG_BRANCH ].m_sName );
wsprintf( sText, TEXT(" Usage: [%s | %s | %s | %s | %s]")
, g_aParameters[ PARAM_CONFIG_BRANCH ].m_sName
, g_aParameters[ PARAM_CONFIG_COLON ].m_sName
, g_aParameters[ PARAM_CONFIG_OPCODE ].m_sName
, g_aParameters[ PARAM_CONFIG_SPACES ].m_sName
, g_aParameters[ PARAM_CONFIG_TARGET ].m_sName );
ConsoleBufferPush( sText );
ConsoleBufferPush( TEXT(" Display current settings if no args." ) );
iParam = PARAM_CONFIG_BRANCH;
wsprintf( sText, TEXT(" Usage: %s [#]" ), g_aParameters[ iParam ].m_sName );
ConsoleBufferPush( sText );
ConsoleBufferPush( TEXT(" Set the type of branch character:" ) );
wsprintf( sText, TEXT(" %d off, %d plain, %d fancy" ),
DISASM_BRANCH_OFF, DISASM_BRANCH_PLAIN, DISASM_BRANCH_FANCY );
ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" i.e. %s %s 1" ), pCommand->m_sName, g_aParameters[ iParam ].m_sName );
ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ PARAM_CONFIG_COLON ].m_sName );
iParam = PARAM_CONFIG_COLON;
wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ iParam ].m_sName );
ConsoleBufferPush( sText );
ConsoleBufferPush( TEXT(" Display a colon after the address" ) );
wsprintf( sText, TEXT(" i.e. %s %s 0" ), pCommand->m_sName, g_aParameters[ iParam ].m_sName );
ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ PARAM_CONFIG_OPCODE ].m_sName );
iParam = PARAM_CONFIG_OPCODE;
wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ iParam ].m_sName );
ConsoleBufferPush( sText );
ConsoleBufferPush( TEXT(" Display opcode(s) after colon" ) );
wsprintf( sText, TEXT(" i.e. %s %s 1" ), pCommand->m_sName, g_aParameters[ iParam ].m_sName );
ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ PARAM_CONFIG_SPACES ].m_sName );
iParam = PARAM_CONFIG_SPACES;
wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ iParam ].m_sName );
ConsoleBufferPush( sText );
ConsoleBufferPush( TEXT(" Display spaces between opcodes" ) );
wsprintf( sText, TEXT(" i.e. %s %s 0" ), pCommand->m_sName, g_aParameters[ iParam ].m_sName );
ConsoleBufferPush( sText );
wsprintf( sText, TEXT(" Usage: %s [#]" ), g_aParameters[ PARAM_CONFIG_TARGET ].m_sName );
iParam = PARAM_CONFIG_TARGET;
wsprintf( sText, TEXT(" Usage: %s [#]" ), g_aParameters[ iParam ].m_sName );
ConsoleBufferPush( sText );
ConsoleBufferPush( TEXT(" Set the type of target address/value displayed:" ) );
wsprintf( sText, TEXT(" %d off, %d value only, %d address only, %d both" ),
DISASM_TARGET_OFF, DISASM_TARGET_VAL, DISASM_TARGET_ADDR, DISASM_TARGET_BOTH );
ConsoleBufferPush( sText );
// ZZZ - CHAR
wsprintf( sText, TEXT(" i.e. %s %s %d" ), pCommand->m_sName, g_aParameters[ iParam ].m_sName, DISASM_TARGET_VAL );
ConsoleBufferPush( sText );
break;
}
// Config - Font
case CMD_CONFIG_FONT:
wsprintf( sText, TEXT(" Usage: [%s | %s] \"FontName\" [Height]" ),
@ -519,6 +574,7 @@ Update_t CmdHelpSpecific (int nArgs)
FONT_SPACING_CLASSIC, FONT_SPACING_CLEAN, FONT_SPACING_COMPRESSED );
ConsoleBufferPush( sText );
break;
// Memory
case CMD_MEMORY_ENTER_BYTE:
ConsoleBufferPush( TEXT(" Usage: {address | symbol} ## [## ... ##]") );
@ -557,6 +613,22 @@ Update_t CmdHelpSpecific (int nArgs)
// ConsoleBufferPush( TEXT(" Displays text in the Memory Mini-Dump area") );
// ConsoleBufferPush( TEXT(" ASCII chars with the hi-bit set, is inverse") );
break;
case CMD_MEMORY_LOAD:
// BLOAD "Filename" addr[,len]
ConsoleBufferPush( TEXT(" Usage: [\"Filename\"] address[,length]" ) );
ConsoleBufferPush( TEXT(" If no filename specified, defaults" ) );
ConsoleBufferPush( TEXT(" to the last filename (if possible)" ) );
break;
case CMD_MEMORY_SAVE:
// BSAVE ["Filename"] addr,len
ConsoleBufferPush( TEXT(" Usage: [\"Filename\"] address,length" ) );
ConsoleBufferPush( TEXT(" If no filename specified, defaults to" ) );
ConsoleBufferPush( TEXT(" '####.####.bin' with the form" ) );
ConsoleBufferPush( TEXT(" {address}.{length}.bin" ) );
break;
// Symbols
case CMD_SYMBOLS_MAIN:
case CMD_SYMBOLS_USER:
@ -595,16 +667,21 @@ Update_t CmdHelpSpecific (int nArgs)
default:
if (bAllCommands)
break;
//#if DEBUG_COMMAND_HELP
#if _DEBUG
wsprintf( sText, "Command help not done yet: %s", g_aCommands[ iCommand ].m_sName );
ConsoleBufferPush( sText );
#endif
if ((! nFound) || (! pCommand))
{
wsprintf( sText, " Invalid command." );
ConsoleBufferPush( sText );
}
else
{
//#if DEBUG_COMMAND_HELP
#if _DEBUG
wsprintf( sText, "Command help not done yet: %s", g_aCommands[ iCommand ].m_sName );
ConsoleBufferPush( sText );
#endif
}
break;
}

View File

@ -167,7 +167,7 @@ bool ArgsGetValue ( Arg_t *pArg, WORD * pAddressValue_, const int nBase )
if (pArg && pAddressValue_)
{
*pAddressValue_ = (WORD)(_tcstoul( pSrc, &pEnd, nBase) & _6502_END_MEM_ADDRESS);
*pAddressValue_ = (WORD)(_tcstoul( pSrc, &pEnd, nBase) & _6502_MEM_END);
return true;
}
return false;
@ -373,7 +373,7 @@ void ArgsRawParse ( void )
{
pSrc = & (pArg->sArg[ 0 ]);
nAddressArg = (WORD)(_tcstoul( pSrc, &pEnd, BASE) & _6502_END_MEM_ADDRESS);
nAddressArg = (WORD)(_tcstoul( pSrc, &pEnd, BASE) & _6502_MEM_END);
nAddressValue = nAddressArg;
bool bFound = false;
@ -675,7 +675,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
}
else // not an operator, try (1) address, (2) symbol lookup
{
nAddressArg = (WORD)(_tcstoul( pSrc, &pEnd2, BASE) & _6502_END_MEM_ADDRESS);
nAddressArg = (WORD)(_tcstoul( pSrc, &pEnd2, BASE) & _6502_MEM_END);
if (! (pArg->bType & TYPE_NO_REG))
{

View File

@ -965,8 +965,8 @@
extern const unsigned int _6502_STACK_END ;//= 0x01FF;
extern const unsigned int _6502_IO_BEGIN ;//= 0xC000;
extern const unsigned int _6502_IO_END ;//= 0xC0FF;
extern const unsigned int _6502_BEG_MEM_ADDRESS ;//= 0x0000;
extern const unsigned int _6502_END_MEM_ADDRESS ;//= 0xFFFF;
extern const unsigned int _6502_MEM_BEGIN ;//= 0x0000;
extern const unsigned int _6502_MEM_END ;//= 0xFFFF;
enum DEVICE_e