diff --git a/source/Debug.cpp b/source/Debug.cpp index b85bea40..02314718 100644 --- a/source/Debug.cpp +++ b/source/Debug.cpp @@ -41,14 +41,16 @@ 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,4,15); + const int DEBUGGER_VERSION = MAKE_VERSION(2,5,6,7); // Public _________________________________________________________________________________________ // Bookmarks __________________________________________________________________ - vector g_aBookmarks; +// vector g_aBookmarks; + int g_nBookmarks; + Bookmark_t g_aBookmarks[ MAX_BOOKMARKS ]; // Breakpoints ________________________________________________________________ @@ -128,22 +130,32 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Command_t g_aCommands[] = { // CPU (Main) + {TEXT(".") , CmdCursorJumpPC , CMD_CURSOR_JUMP_PC , "Locate the cursor in the disasm window" }, // centered + {TEXT("=") , CmdCursorSetPC , CMD_CURSOR_SET_PC , "Sets the PC to the current instruction" }, {TEXT("A") , CmdAssemble , CMD_ASSEMBLE , "Assemble instructions" }, - {TEXT("U") , CmdUnassemble , CMD_UNASSEMBLE , "Disassemble instructions" }, {TEXT("BRK") , CmdBreakInvalid , CMD_BREAK_INVALID , "Enter debugger on BRK or INVALID" }, {TEXT("BRKOP") , CmdBreakOpcode , CMD_BREAK_OPCODE , "Enter debugger on opcode" }, - {TEXT("CALC") , CmdCalculator , CMD_CALC , "Display mini calc result" }, - {TEXT("GOTO") , CmdGo , CMD_GO , "Run [until PC = address]" }, - {TEXT("I") , CmdInput , CMD_INPUT , "Input from IO $C0xx" }, - {TEXT("KEY") , CmdFeedKey , CMD_INPUT_KEY , "Feed key into emulator" }, + {TEXT("GO") , CmdGo , CMD_GO , "Run [until PC = address]" }, + {TEXT("IN") , CmdIn , CMD_IN , "Input byte from IO $C0xx" }, + {TEXT("KEY") , CmdKey , CMD_INPUT_KEY , "Feed key into emulator" }, {TEXT("JSR") , CmdJSR , CMD_JSR , "Call sub-routine" }, - {TEXT("O") , CmdOutput , CMD_OUTPUT , "Output from io $C0xx" }, {TEXT("NOP") , CmdNOP , CMD_NOP , "Zap the current instruction with a NOP" }, + {TEXT("OUT") , CmdOut , CMD_OUT , "Output byte to IO $C0xx" }, {TEXT("P") , CmdStepOver , CMD_STEP_OVER , "Step current instruction" }, +// {TEXT("PRINTF") , CmdPrintf {TEXT("RTS") , CmdStepOut , CMD_STEP_OUT , "Step out of subroutine" }, {TEXT("T") , CmdTrace , CMD_TRACE , "Trace current instruction" }, {TEXT("TF") , CmdTraceFile , CMD_TRACE_FILE , "Save trace to filename" }, {TEXT("TL") , CmdTraceLine , CMD_TRACE_LINE , "Trace (with cycle counting)" }, + {TEXT("U") , CmdUnassemble , CMD_UNASSEMBLE , "Disassemble instructions" }, +// {TEXT("WAIT") , CmdWait , CMD_WAIT , "Run until + // Bookmarks + {TEXT("BM") , CmdBookmarkMenu , CMD_BOOKMARK_MENU , "Save/Load Bookmarks" }, + {TEXT("BMA") , CmdBookmarkAdd , CMD_BOOKMARK_ADD , "Sets/Shows Bookmarks" }, + {TEXT("BMC") , CmdBookmarkClear , CMD_BOOKMARK_CLEAR , "Clear bookmark" }, + {TEXT("BML") , CmdBookmarkList , CMD_BOOKMARK_LIST , "Lists bookmarks" }, + {TEXT("BMLOAD") , CmdBookmarkLoad , CMD_BOOKMARK_LOAD , "Load bookmarks" }, + {TEXT("BMSAVE") , CmdBookmarkSave , CMD_BOOKMARK_SAVE , "Save bookmarks" }, // Breakpoints {TEXT("BP") , CmdBreakpointMenu , CMD_BREAKPOINT , "Save/Load Breakpoints" }, {TEXT("BPA") , CmdBreakpointAddSmart, CMD_BREAKPOINT_ADD_SMART , "Add (smart) breakpoint" }, @@ -152,6 +164,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {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" }, // SoftICE {TEXT("BD") , CmdBreakpointDisable , CMD_BREAKPOINT_DISABLE , "Disable breakpoint # or *" }, // SoftICE {TEXT("BPE") , CmdBreakpointEdit , CMD_BREAKPOINT_EDIT , "Edit breakpoint" }, // SoftICE @@ -167,16 +180,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {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/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" }, {TEXT("LOAD") , CmdConfigLoad , CMD_CONFIG_LOAD , "Load debugger configuration" }, {TEXT("MONO") , CmdConfigColorMono , CMD_CONFIG_MONOCHROME , "Sets/Shows RGB for monochrome scheme" }, - {TEXT("RUN") , CmdConfigRun , CMD_CONFIG_RUN , "Run script file of debugger commands" }, {TEXT("SAVE") , CmdConfigSave , CMD_CONFIG_SAVE , "Save debugger configuration" }, // Cursor - {TEXT(".") , CmdCursorJumpPC , CMD_CURSOR_JUMP_PC , "Locate the cursor in the disasm window" }, // centered - {TEXT("=") , CmdCursorSetPC , CMD_CURSOR_SET_PC , "Sets the PC to the current instruction" }, {TEXT("RET") , CmdCursorJumpRetAddr , CMD_CURSOR_JUMP_RET_ADDR , "Sets the cursor to the sub-routine caller" }, {TEXT( "^") , NULL , CMD_CURSOR_LINE_UP }, // \x2191 = Up Arrow (Unicode) {TEXT("Shift ^") , NULL , CMD_CURSOR_LINE_UP_1 }, @@ -219,7 +228,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {TEXT("HELP") , CmdHelpSpecific , CMD_HELP_SPECIFIC , "Help on specific command" }, {TEXT("VERSION") , CmdVersion , CMD_VERSION , "Displays version of emulator/debugger" }, {TEXT("MOTD") , CmdMOTD , CMD_MOTD }, - // Memory {TEXT("MC") , CmdMemoryCompare , CMD_MEMORY_COMPARE }, @@ -250,6 +258,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {TEXT("ST") , CmdMemorySearchApple , CMD_MEMORY_SEARCH_APPLE , "Search Apple text (hi-bit)" }, // Search Apple Text {TEXT("SH") , CmdMemorySearchHex , CMD_MEMORY_SEARCH_HEX }, // Search Hex {TEXT("F") , CmdMemoryFill , CMD_MEMORY_FILL }, + // Output / Scripts + {TEXT("CALC") , CmdOutputCalc , CMD_OUTPUT_CALC , "Display mini calc result" }, + {TEXT("ECHO") , CmdOutputEcho , CMD_OUTPUT_ECHO , "Echo string to console" }, // or toggle command echoing" + {TEXT("PRINT") , CmdOutputPrint , CMD_OUTPUT_PRINT , "Display string and/or hex values" }, + {TEXT("PRINTF") , CmdOutputPrintf , CMD_OUTPUT_PRINTF , "Display formatted string" }, + {TEXT("RUN") , CmdOutputRun , CMD_OUTPUT_RUN , "Run script file of debugger commands" }, // Registers {TEXT("R") , CmdRegisterSet , CMD_REGISTER_SET }, // TODO: Set/Clear flags // Source Level Debugging @@ -328,7 +342,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {TEXT("->") , NULL , CMD_CURSOR_JUMP_PC }, {TEXT("Ctrl ->" ) , NULL , CMD_CURSOR_SET_PC }, {TEXT("Shift ->") , NULL , CMD_CURSOR_JUMP_PC }, // at top - {TEXT("INPUT") , CmdInput , CMD_INPUT }, + {TEXT("INPUT") , CmdIn , CMD_IN }, // Flags - Clear {TEXT("RC") , CmdFlagClear , CMD_FLAG_CLR_C , "Clear Flag Carry" }, // 0 // Legacy {TEXT("RZ") , CmdFlagClear , CMD_FLAG_CLR_Z , "Clear Flag Zero" }, // 1 @@ -530,7 +544,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA int MAX_DISPLAY_CONSOLE_LINES = 0; // MAX_DISPLAY_DISASM_LINES + MIN_DISPLAY_CONSOLE_LINES; // 23 -// Disassembly +// Config _____________________________________________________________________ + +// Config - Disassembly bool g_bConfigDisasmAddressColon = true; bool g_bConfigDisasmOpcodesView = true; bool g_bConfigDisasmOpcodeSpaces = true; @@ -538,6 +554,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA int g_iConfigDisasmBranchType = DISASM_BRANCH_FANCY; int g_bConfigDisasmImmediateChar = DISASM_IMMED_BOTH; int g_iConfigDisasmScroll = 3; // favor 3 byte opcodes +// Config - Info + bool g_bConfigInfoTargetPointer = false; // Display ____________________________________________________________________ @@ -599,6 +617,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {TEXT("BRANCH") , NULL, PARAM_CONFIG_BRANCH }, {TEXT("COLON") , NULL, PARAM_CONFIG_COLON }, {TEXT("OPCODE") , NULL, PARAM_CONFIG_OPCODE }, + {TEXT("POINTER") , NULL, PARAM_CONFIG_POINTER }, {TEXT("SPACES") , NULL, PARAM_CONFIG_SPACES }, {TEXT("TARGET") , NULL, PARAM_CONFIG_TARGET }, // Disk @@ -621,12 +640,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA {TEXT("STOP") , NULL, PARAM_STOP }, // benchmark // Help Categories {TEXT("*") , NULL, PARAM_WILDSTAR }, + {TEXT("BOOKMARKS") , NULL, PARAM_CAT_BOOKMARKS }, {TEXT("BREAKPOINTS"), NULL, PARAM_CAT_BREAKPOINTS }, {TEXT("CONFIG") , NULL, PARAM_CAT_CONFIG }, {TEXT("CPU") , NULL, PARAM_CAT_CPU }, {TEXT("FLAGS") , NULL, PARAM_CAT_FLAGS }, + {TEXT("HELP") , NULL, PARAM_CAT_HELP }, {TEXT("MEMORY") , NULL, PARAM_CAT_MEMORY }, {TEXT("MEM") , NULL, PARAM_CAT_MEMORY }, // alias // SOURCE [SYMBOLS] [MEMORY] filename + {TEXT("OUTPUT") , NULL, PARAM_CAT_OUTPUT }, + {TEXT("REGISTERS") , NULL, PARAM_CAT_REGISTERS }, {TEXT("SYMBOLS") , NULL, PARAM_CAT_SYMBOLS }, {TEXT("WATCHES") , NULL, PARAM_CAT_WATCHES }, {TEXT("WINDOW") , NULL, PARAM_CAT_WINDOW }, @@ -744,10 +767,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Misc. __________________________________________________________________________________________ - TCHAR g_FileNameConfig [] = TEXT("Debug.cfg"); // CONFIGSAVE - TCHAR g_FileNameSymbolsMain[] = TEXT("APPLE2E.SYM"); + TCHAR g_FileNameConfig [] = TEXT("AWDebug.cfg"); // CONFIGSAVE + TCHAR g_FileNameSymbolsMain[] = TEXT("APPLE2E.SYM"); TCHAR g_FileNameSymbolsUser[ MAX_PATH ] = TEXT(""); - TCHAR g_FileNameTrace [] = TEXT("Trace.txt"); + TCHAR g_FileNameTrace [] = TEXT("Trace.txt"); bool g_bBenchmarking = false; @@ -768,27 +791,36 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA DWORD extbench = 0; bool g_bDebuggerViewingAppleOutput = false; - bool g_bIgnoreNextKey = false; + bool g_bIgnoreNextKey = false; // Private ________________________________________________________________________________________ // Prototypes _______________________________________________________________ -static int ParseInput ( LPTSTR pConsoleInput, bool bCook = true ); -static Update_t ExecuteCommand ( int nArgs ); + static int ParseInput ( LPTSTR pConsoleInput, bool bCook = true ); + static Update_t ExecuteCommand ( int nArgs ); + +// Breakpoints + void _ListBreakWatchZero( Breakpoint_t * aBreakWatchZero, int iBWZ, bool bZeroBased = true ); + +// bool CheckBreakpoint (WORD address, BOOL memory); + bool CheckBreakpointsIO (); + bool CheckBreakpointsReg (); + bool _CmdBreakpointAddReg ( Breakpoint_t *pBP, BreakpointSource_t iSrc, BreakpointOperator_t iCmp, WORD nAddress, int nLen ); + bool _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, BreakpointOperator_t iCmp ); // Colors -static void _ConfigColorsReset(); + static void _ConfigColorsReset(); // Drawing -static bool DebuggerSetColor ( const int iScheme, const int iColor, const COLORREF nColor ); -static void _CmdColorGet ( const int iScheme, const int iColor ); + static bool DebuggerSetColor ( const int iScheme, const int iColor, const COLORREF nColor ); + static void _CmdColorGet ( const int iScheme, const int iColor ); // Font -static void _UpdateWindowFontHeights(int nFontHeight); - + static void _UpdateWindowFontHeights(int nFontHeight); +// Symbols Update_t _CmdSymbolsClear ( Symbols_e eSymbolTable ); Update_t _CmdSymbolsCommon ( int nArgs, int bSymbolTables ); Update_t _CmdSymbolsListTables (int nArgs, int bSymbolTables ); @@ -798,8 +830,8 @@ static void _UpdateWindowFontHeights(int nFontHeight); bool _CmdSymbolList_Symbol2Address( LPCTSTR pSymbol, int bSymbolTables ); // Source Level Debugging -static bool BufferAssemblyListing ( TCHAR * pFileName ); -static bool ParseAssemblyListing ( bool bBytesToMemory, bool bAddSymbols ); + static bool BufferAssemblyListing ( TCHAR * pFileName ); + static bool ParseAssemblyListing ( bool bBytesToMemory, bool bAddSymbols ); // Window @@ -826,11 +858,6 @@ static bool ParseAssemblyListing ( bool bBytesToMemory, bool bAddSymbols ); char FormatCharTxtHigh ( const BYTE b, bool *pWasHi_ ); char FormatChar4Font ( const BYTE b, bool *pWasHi_, bool *pWasLo_ ); -// bool CheckBreakpoint (WORD address, BOOL memory); - bool CheckBreakpointsIO (); - bool CheckBreakpointsReg (); - bool _CmdBreakpointAddReg ( Breakpoint_t *pBP, BreakpointSource_t iSrc, BreakpointOperator_t iCmp, WORD nAddress, int nLen ); - bool _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, BreakpointOperator_t iCmp ); void _CursorMoveDownAligned( int nDelta ); void _CursorMoveUpAligned( int nDelta ); @@ -868,7 +895,10 @@ bool _Bookmark_Add( const int iBookmark, const WORD nAddress ) if (iBookmark < MAX_BOOKMARKS) { // g_aBookmarks.push_back( nAddress ); - g_aBookmarks.at( iBookmark ) = nAddress; +// g_aBookmarks.at( iBookmark ) = nAddress; + g_aBookmarks[ iBookmark ].nAddress = nAddress; + g_aBookmarks[ iBookmark ].bSet = true; + g_nBookmarks++; return true; } @@ -880,13 +910,15 @@ bool _Bookmark_Add( const int iBookmark, const WORD nAddress ) bool _Bookmark_Del( const WORD nAddress ) { bool bDeleted = false; - int nSize = g_aBookmarks.size(); + +// int nSize = g_aBookmarks.size(); int iBookmark; - for (iBookmark = 0; iBookmark < nSize; iBookmark++ ) + for (iBookmark = 0; iBookmark < MAX_BOOKMARKS; iBookmark++ ) { - if (g_aBookmarks.at( iBookmark ) == nAddress) + if (g_aBookmarks[ iBookmark ].nAddress == nAddress) { - g_aBookmarks.at( iBookmark ) = NO_6502_TARGET; +// g_aBookmarks.at( iBookmark ) = NO_6502_TARGET; + g_aBookmarks[ iBookmark ].bSet = false; bDeleted = true; } } @@ -896,13 +928,14 @@ bool _Bookmark_Del( const WORD nAddress ) bool Bookmark_Find( const WORD nAddress ) { // Ugh, linear search - int nSize = g_aBookmarks.size(); +// int nSize = g_aBookmarks.size(); int iBookmark; - for (iBookmark = 0; iBookmark < nSize; iBookmark++ ) + for (iBookmark = 0; iBookmark < MAX_BOOKMARKS; iBookmark++ ) { - if (g_aBookmarks.at( iBookmark ) == nAddress) + if (g_aBookmarks[ iBookmark ].nAddress == nAddress) { - return true; + if (g_aBookmarks[ iBookmark ].bSet) + return true; } } return false; @@ -912,13 +945,13 @@ bool Bookmark_Find( const WORD nAddress ) //=========================================================================== bool _Bookmark_Get( const int iBookmark, WORD & nAddress ) { - int nSize = g_aBookmarks.size(); - if (iBookmark >= nSize) +// int nSize = g_aBookmarks.size(); + if (iBookmark >= MAX_BOOKMARKS) return false; - if (g_aBookmarks.at( iBookmark ) != NO_6502_TARGET) + if (g_aBookmarks[ iBookmark ].bSet) { - nAddress = g_aBookmarks.at( iBookmark ); + nAddress = g_aBookmarks[ iBookmark ].nAddress; return true; } @@ -929,24 +962,111 @@ bool _Bookmark_Get( const int iBookmark, WORD & nAddress ) //=========================================================================== void _Bookmark_Reset() { - g_aBookmarks.reserve( MAX_BOOKMARKS ); - g_aBookmarks.insert( g_aBookmarks.begin(), MAX_BOOKMARKS, NO_6502_TARGET ); +// g_aBookmarks.reserve( MAX_BOOKMARKS ); +// g_aBookmarks.insert( g_aBookma int iBookmark = 0; + int iBookmark = 0; + for (iBookmark = 0; iBookmark < MAX_BOOKMARKS; iBookmark++ ) + { + g_aBookmarks[ iBookmark ].bSet = false; + } } //=========================================================================== int _Bookmark_Size() { - int nTotal = 0; - int nSize = g_aBookmarks.size(); + int g_nBookmarks = 0; + int iBookmark; - for (iBookmark = 0; iBookmark < nSize; iBookmark++ ) + for (iBookmark = 0; iBookmark < MAX_BOOKMARKS; iBookmark++ ) { - if (g_aBookmarks.at( iBookmark ) != NO_6502_TARGET) - nTotal++; + if (g_aBookmarks[ iBookmark ].bSet) + g_nBookmarks++; } - return nTotal; + return g_nBookmarks; +} + + +//=========================================================================== +Update_t _CmdBookmarkAdd ( const int & iBookmark, const WORD & nAddress ) +{ + _Bookmark_Add( iBookmark, nAddress ); + return UPDATE_DISASM; +} + + +//=========================================================================== +Update_t CmdBookmarkAdd (int nArgs ) +{ + int iBookmark; + WORD nAddress; + int iArg; + + for (iArg = 1; iArg <= nArgs; iArg++ ) + { + iBookmark = g_aArgs[ iArg ].nValue; + + iArg++; + if (iArg <= nArgs) + { + nAddress = g_aArgs[ iArg ].nValue; + _CmdBookmarkAdd( iBookmark, nAddress ); + } + else + return Help_Arg_1( CMD_BOOKMARK_ADD ); + } + + return UPDATE_DISASM; +} + + +//=========================================================================== +Update_t CmdBookmarkMenu (int nArgs) +{ + int iBookmark = 0; + + if (! nArgs) + { + return CmdBookmarkList(0); + } + else + { + // LOAD + // RESET + // SAVE + } + + return ConsoleUpdate(); +} + + +//=========================================================================== +Update_t CmdBookmarkClear (int nArgs) +{ + int iBookmark = 0; + + bool bClearAll = false; + + int iArg; + for (iArg = 1; iArg <= nArgs; iArg++ ) + { + if (! _tcscmp(g_aArgs[nArgs].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName)) + { + for (iBookmark = 0; iBookmark < MAX_BOOKMARKS; iBookmark++ ) + { + if (g_aBookmarks[ iBookmark ].bSet) + g_aBookmarks[ iBookmark ].bSet = false; + } + break; + } + + iBookmark = g_aArgs[ iArg ].nValue; + if (g_aBookmarks[ iBookmark ].bSet) + g_aBookmarks[ iBookmark ].bSet = false; + } + + return UPDATE_DISASM; } @@ -967,15 +1087,44 @@ Update_t CmdBookmarkGoto ( int nArgs ) //=========================================================================== -Update_t CmdBookmarkAdd( int nArgs ) +Update_t CmdBookmarkList (int nArgs) { - int iBookmark = nArgs; - WORD nAddress = g_nDisasmCurAddress; - _Bookmark_Add( iBookmark, nAddress ); - - return UPDATE_DISASM; + if (! g_nBookmarks) + { + TCHAR sText[ CONSOLE_WIDTH ]; + wsprintf( sText, TEXT(" There are no current bookmarks. (Max: %d)"), MAX_BOOKMARKS ); + ConsoleBufferPush( sText ); + } + else + { + int iBookmark = 0; + while (iBookmark < MAX_BOOKMARKS) + { + if (g_aBookmarks[ iBookmark ].bSet) + { + _ListBreakWatchZero( g_aBookmarks, iBookmark, false ); + } + iBookmark++; + } + } + return ConsoleUpdate(); } + +//=========================================================================== +Update_t CmdBookmarkLoad (int nArgs) +{ + return UPDATE_CONSOLE_DISPLAY; +} + + +//=========================================================================== +Update_t CmdBookmarkSave (int nArgs) +{ + return UPDATE_CONSOLE_DISPLAY; +} + + // Breakpoints ____________________________________________________________________________________ @@ -1297,6 +1446,7 @@ bool CheckBreakpointsReg () return bStatus; } + //=========================================================================== BOOL CheckJump (WORD targetaddress) { @@ -1308,12 +1458,10 @@ BOOL CheckJump (WORD targetaddress) } - - - // Commands _______________________________________________________________________________________ +//=========================================================================== Update_t _CmdAssemble( WORD nAddress, int iArg, int nArgs ) { bool bHaveLabel = false; @@ -1365,10 +1513,13 @@ Update_t CmdAssemble (int nArgs) g_nAssemblerAddress = g_aArgs[1].nValue; - if (nArgs == 1) + if (nArgs == 1) // g_nArgRaw { + int iArg = 1; + // undocumented ASM * - if (_tcscmp( g_aArgs[ 1 ].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName ) == 0) + 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 )) ) { _CmdAssembleHashDump(); } @@ -1412,55 +1563,7 @@ Update_t CmdUnassemble (int nArgs) //=========================================================================== -Update_t CmdCalculator (int nArgs) -{ - const int nBits = 8; - - if (! nArgs) - return Help_Arg_1( CMD_CALC ); - - WORD nAddress = g_aArgs[1].nValue; - TCHAR sText [ CONSOLE_WIDTH ]; - - bool bHi = false; - bool bLo = false; - char c = FormatChar4Font( (BYTE) nAddress, &bHi, &bLo ); - bool bParen = bHi || bLo; - - int nBit = 0; - int iBit = 0; - for( iBit = 0; iBit < nBits; iBit++ ) - { - bool bSet = (nAddress >> iBit) & 1; - if (bSet) - nBit |= (1 << (iBit * 4)); // 4 bits per hex digit - } - - wsprintf( sText, TEXT("$%04X 0z%08X %5d '%c' "), - nAddress, nBit, nAddress, c ); - - if (bParen) - _tcscat( sText, TEXT("(") ); - - if (bHi & bLo) - _tcscat( sText, TEXT("High Ctrl") ); - else - if (bHi) - _tcscat( sText, TEXT("High") ); - else - if (bLo) - _tcscat( sText, TEXT("Ctrl") ); - - if (bParen) - _tcscat( sText, TEXT(")") ); - - ConsoleBufferPush( sText ); - return ConsoleUpdate(); -} - - -//=========================================================================== -Update_t CmdFeedKey (int nArgs) +Update_t CmdKey (int nArgs) { KeybQueueKeypress( nArgs ? g_aArgs[1].nValue ? g_aArgs[1].nValue : g_aArgs[1].sArg[0] : TEXT(' '), 1); // FIXME!!! @@ -1468,10 +1571,10 @@ Update_t CmdFeedKey (int nArgs) } //=========================================================================== -Update_t CmdInput (int nArgs) +Update_t CmdIn (int nArgs) { if (!nArgs) - return Help_Arg_1( CMD_INPUT ); + return Help_Arg_1( CMD_IN ); WORD nAddress = g_aArgs[1].nValue; @@ -1526,14 +1629,14 @@ Update_t CmdNOP (int nArgs) } //=========================================================================== -Update_t CmdOutput (int nArgs) +Update_t CmdOut (int nArgs) { // if ((!nArgs) || // ((g_aArgs[1].sArg[0] != TEXT('0')) && (!g_aArgs[1].nValue) && (!GetAddress(g_aArgs[1].sArg)))) // return DisplayHelp(CmdInput); if (!nArgs) - Help_Arg_1( CMD_OUTPUT ); + Help_Arg_1( CMD_OUT ); WORD nAddress = g_aArgs[1].nValue; @@ -2114,7 +2217,7 @@ Update_t CmdBreakpointEnable (int nArgs) { } -void _ListBreakWatchZero( Breakpoint_t * aBreakWatchZero, int iBWZ ) +void _ListBreakWatchZero( Breakpoint_t * aBreakWatchZero, int iBWZ, bool bZeroBased ) { static TCHAR sText[ CONSOLE_WIDTH ]; static const TCHAR sFlags[] = "-*"; @@ -2129,7 +2232,7 @@ void _ListBreakWatchZero( Breakpoint_t * aBreakWatchZero, int iBWZ ) } wsprintf( sText, " #%d %c %04X %s", - iBWZ + 1, + (bZeroBased ? iBWZ + 1 : iBWZ), sFlags[ (int) aBreakWatchZero[ iBWZ ].bEnabled ], aBreakWatchZero[ iBWZ ].nAddress, pSymbol @@ -2156,7 +2259,9 @@ Update_t CmdBreakpointList (int nArgs) if (! g_nBreakpoints) { - ConsoleBufferPush( TEXT(" There are no current breakpoints." ) ); + TCHAR sText[ CONSOLE_WIDTH ]; + wsprintf( sText, TEXT(" There are no current breakpoints. (Max: %d)"), MAX_BREAKPOINTS ); + ConsoleBufferPush( sText ); } else { @@ -2187,29 +2292,9 @@ Update_t CmdBreakpointSave (int nArgs) } + // Config _________________________________________________________________________________________ -//=========================================================================== -Update_t CmdConfigEcho (int nArgs) -{ - TCHAR sText[ CONSOLE_WIDTH ] = TEXT(""); - - if (g_aArgs[1].bType & TYPE_QUOTED_2) - { - ConsoleDisplayPush( g_aArgs[1].sArg ); - } - else - { - const TCHAR *pText = g_pConsoleFirstArg; // ConsoleInputPeek(); - if (pText) - { - ConsoleDisplayPush( pText ); - } - } - - return ConsoleUpdate(); -} - //=========================================================================== Update_t CmdConfigMenu (int nArgs) @@ -2230,8 +2315,6 @@ Update_t CmdConfigMenu (int nArgs) nArgs = _Arg_Shift( iArg, nArgs ); return CmdConfigLoad( nArgs ); break; - - default: { TCHAR sText[ CONSOLE_WIDTH ]; @@ -2264,60 +2347,6 @@ Update_t CmdConfigLoad (int nArgs) } -//=========================================================================== -Update_t CmdConfigRun (int nArgs) -{ - if (! nArgs) - return Help_Arg_1( CMD_CONFIG_RUN ); - - if (nArgs != 1) - return Help_Arg_1( CMD_CONFIG_RUN ); - - // Read in script - // could be made global, to cache last run. - // Opens up the possibility of: - // CHEAT [ON | OFF] -> re-run script - // with conditional logic - // IF @ON .... - MemoryTextFile_t script; - - TCHAR * pFileName = g_aArgs[ 1 ].sArg; - - TCHAR sFileName[ MAX_PATH ]; - TCHAR sMiniFileName[ CONSOLE_WIDTH ]; - -// if (g_aArgs[1].bType & TYPE_QUOTED_2) - - strcpy( sMiniFileName, pFileName ); -// strcat( sMiniFileName, ".aws" ); // HACK: MAGIC STRING - - _tcscpy(sFileName, g_sProgramDir); - _tcscat(sFileName, sMiniFileName); - - if (script.Read( sFileName )) - { - int iLine = 0; - int nLine = script.GetNumLines(); - - Update_t bUpdateDisplay = UPDATE_NOTHING; - - for( int iLine = 0; iLine < nLine; iLine++ ) - { - script.GetLine( iLine, g_pConsoleInput, CONSOLE_WIDTH-2 ); - g_nConsoleInputChars = strlen( g_pConsoleInput ); - bUpdateDisplay |= DebuggerProcessCommand( false ); - } - } - else - { - TCHAR sText[ CONSOLE_WIDTH ]; - wsprintf( sText, "Couldn't load filename: %s", sFileName ); - ConsoleBufferPush( sText ); - } - - return ConsoleUpdate(); -} - // Save Debugger Settings //=========================================================================== @@ -2375,11 +2404,10 @@ Update_t CmdConfigDisasm( int nArgs ) bool bDisplayCurrentSettings = false; -// if (_tcscmp( g_aArgs[ 1 ].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName ) == 0) - +// if (! _tcscmp( g_aArgs[ 1 ].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName )) if (! nArgs) { - bDisplayCurrentSettings = true; + bDisplayCurrentSettings = true; nArgs = PARAM_CONFIG_NUM; } else @@ -2441,13 +2469,28 @@ Update_t CmdConfigDisasm( int nArgs ) } else { - int iState = g_bConfigDisasmOpcodeSpaces ? PARAM_ON : PARAM_OFF; + int iState = g_bConfigDisasmOpcodesView ? PARAM_ON : PARAM_OFF; wsprintf( sText, TEXT( "Opcodes: %s" ), g_aParameters[ iState ].m_sName ); ConsoleBufferPush( sText ); ConsoleBufferToDisplay(); } break; + case PARAM_CONFIG_POINTER: + if ((nArgs > 1) && (! bDisplayCurrentSettings)) // set + { + iArg++; + g_bConfigInfoTargetPointer = (g_aArgs[ iArg ].nValue) ? true : false; + } + else + { + int iState = g_bConfigInfoTargetPointer ? PARAM_ON : PARAM_OFF; + wsprintf( sText, TEXT( "Info Target Pointer: %s" ), g_aParameters[ iState ].m_sName ); + ConsoleBufferPush( sText ); + ConsoleBufferToDisplay(); + } + break; + case PARAM_CONFIG_SPACES: if ((nArgs > 1) && (! bDisplayCurrentSettings)) // set { @@ -2534,24 +2577,22 @@ Update_t CmdConfigFont (int nArgs) if (! nArgs) return CmdConfigGetFont( nArgs ); else - if (nArgs <= 2) + if (g_nArgRaw <= 2) // nArgs { iArg = 1; - if (nArgs == 1) + // FONT * is undocumented, like VERSION * + 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 )) ) { - // FONT * is undocumented, like VERSION * - if (_tcscmp( g_aArgs[ iArg ].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName ) == 0) - { - TCHAR sText[ CONSOLE_WIDTH ]; - wsprintf( sText, "Lines: %d Font Px: %d Line Px: %d" - , g_nTotalLines - , g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontHeight - , g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight ); - ConsoleBufferPush( sText ); - ConsoleBufferToDisplay(); - return UPDATE_CONSOLE_DISPLAY; - } + TCHAR sText[ CONSOLE_WIDTH ]; + wsprintf( sText, "Lines: %d Font Px: %d Line Px: %d" + , g_nTotalLines + , g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontHeight + , g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight ); + ConsoleBufferPush( sText ); + ConsoleBufferToDisplay(); + return UPDATE_CONSOLE_DISPLAY; } int iFound; @@ -4593,6 +4634,371 @@ Update_t CmdRegisterSet (int nArgs) } +// Output _________________________________________________________________________________________ + + +//=========================================================================== +Update_t CmdOutputCalc (int nArgs) +{ + const int nBits = 8; + + if (! nArgs) + return Help_Arg_1( CMD_OUTPUT_CALC ); + + WORD nAddress = g_aArgs[1].nValue; + TCHAR sText [ CONSOLE_WIDTH ]; + + bool bHi = false; + bool bLo = false; + char c = FormatChar4Font( (BYTE) nAddress, &bHi, &bLo ); + bool bParen = bHi || bLo; + + int nBit = 0; + int iBit = 0; + for( iBit = 0; iBit < nBits; iBit++ ) + { + bool bSet = (nAddress >> iBit) & 1; + if (bSet) + nBit |= (1 << (iBit * 4)); // 4 bits per hex digit + } + + wsprintf( sText, TEXT("$%04X 0z%08X %5d '%c' "), + nAddress, nBit, nAddress, c ); + + if (bParen) + _tcscat( sText, TEXT("(") ); + + if (bHi & bLo) + _tcscat( sText, TEXT("High Ctrl") ); + else + if (bHi) + _tcscat( sText, TEXT("High") ); + else + if (bLo) + _tcscat( sText, TEXT("Ctrl") ); + + if (bParen) + _tcscat( sText, TEXT(")") ); + + ConsoleBufferPush( sText ); + return ConsoleUpdate(); +} + + +//=========================================================================== +Update_t CmdOutputEcho (int nArgs) +{ + TCHAR sText[ CONSOLE_WIDTH ] = TEXT(""); + + if (g_aArgs[1].bType & TYPE_QUOTED_2) + { + ConsoleDisplayPush( g_aArgs[1].sArg ); + } + else + { + const TCHAR *pText = g_pConsoleFirstArg; // ConsoleInputPeek(); + if (pText) + { + ConsoleDisplayPush( pText ); + } + } + + return ConsoleUpdate(); +} + + +enum PrintState_e +{ PS_LITERAL + , PS_TYPE + , PS_ESCAPE + , PS_NEXT_ARG_BIN + , PS_NEXT_ARG_HEX + , PS_NEXT_ARG_DEC + , PS_NEXT_ARG_CHR +}; + +struct PrintFormat_t +{ + int nValue; + int eType; +}; + + +//=========================================================================== +Update_t CmdOutputPrint (int nArgs) +{ + // PRINT "A:",A," X:",X + // Removed: PRINT "A:%d",A," X: %d",X + TCHAR sText[ CONSOLE_WIDTH ] = TEXT(""); + int nLen = 0; + + int nValue; + + if (! nArgs) + goto _Help; + + int iArg; + for (iArg = 1; iArg <= nArgs; iArg++ ) + { + if (g_aArgs[ iArg ].bType & TYPE_QUOTED_2) + { + int iChar; + int nChar = _tcslen( g_aArgs[ iArg ].sArg ); + for( iChar = 0; iChar < nChar; iChar++ ) + { + TCHAR c = g_aArgs[ iArg ].sArg[ iChar ]; + sText[ nLen++ ] = c; + } + + iArg++; + if (iArg > nArgs) + goto _Help; + if (iArg <= nArgs) + if (g_aArgs[ iArg ].eToken != TOKEN_COMMA) + goto _Help; + } + else + { + nValue = g_aArgs[ iArg ].nValue; + sprintf( &sText[ nLen ], "%04X", nValue ); + + while (sText[ nLen ]) + nLen++; + + iArg++; + if (iArg <= nArgs) + if (g_aArgs[ iArg ].eToken != TOKEN_COMMA) + goto _Help; + } +#if 0 + sprintf( &sText[ nLen ], "%04X", nValue ); + sprintf( &sText[ nLen ], "%d", nValue ); + sprintf( &sText[ nLen ], "%c", nValue ); +#endif + } + + if (nLen) + ConsoleBufferPush( sText ); + + return ConsoleUpdate(); + +_Help: + return Help_Arg_1( CMD_OUTPUT_PRINT ); +} + + +//=========================================================================== +Update_t CmdOutputPrintf (int nArgs) +{ + // PRINTF "A:%d X:%d",A,X + // PRINTF "Hex:%x Dec:%d Bin:%z",A,A,A + + TCHAR sText[ CONSOLE_WIDTH ] = TEXT(""); + +// vector aValues; +// PrintFormat_t entry; + vector aValues; + Arg_t entry; + int iValue = 0; + int nValue = 0; + + if (! nArgs) + goto _Help; + + int nLen = 0; + + PrintState_e eThis = PS_LITERAL; +// PrintState_e eNext = PS_NEXT_ARG_HEX; // PS_LITERAL; + + int nWidth = 0; + + int iArg; + for (iArg = 1; iArg <= nArgs; iArg++ ) + { + if (g_aArgs[ iArg ].bType & TYPE_QUOTED_2) + continue; + else + if (g_aArgs[ iArg ].eToken == TOKEN_COMMA) + continue; + else + { +// entry.eType = PS_LITERAL; + entry.nValue = g_aArgs[ iArg ].nValue; + aValues.push_back( entry ); +// nValue = g_aArgs[ iArg ].nValue; +// aValues.push_back( nValue ); + } + } + const int nParamValues = (int) aValues.size(); + + for (iArg = 1; iArg <= nArgs; iArg++ ) + { + if (g_aArgs[ iArg ].bType & TYPE_QUOTED_2) + { + int iChar; + int nChar = _tcslen( g_aArgs[ iArg ].sArg ); + for( iChar = 0; iChar < nChar; iChar++ ) + { + TCHAR c = g_aArgs[ iArg ].sArg[ iChar ]; + switch ( eThis ) + { + case PS_LITERAL: + switch( c ) + { + case '\\': + eThis = PS_ESCAPE; + case '%': + eThis = PS_TYPE; + break; + default: + sText[ nLen++ ] = c; + break; + } + break; + case PS_ESCAPE: + switch( c ) + { + case 'n': + case 'r': + eThis = PS_LITERAL; + sText[ nLen++ ] = '\n'; + break; + } + break; + case PS_TYPE: + if (iValue >= nParamValues) + { + wsprintf( sText, TEXT("Error: Missing value arg: %d"), iValue + 1 ); + ConsoleBufferPush( sText ); + return ConsoleUpdate(); + } + switch( c ) + { + case 'X': + case 'x': // PS_NEXT_ARG_HEX + nValue = aValues[ iValue ].nValue; + sprintf( &sText[ nLen ], "%04X", nValue ); + iValue++; + break; + case 'D': + case 'd': // PS_NEXT_ARG_DEC + nValue = aValues[ iValue ].nValue; + sprintf( &sText[ nLen ], "%d", nValue ); + iValue++; + break; + break; + case 'Z': + case 'z': + { + nValue = aValues[ iValue ].nValue; + if (!nWidth) + nWidth = 8; + int nBits = nWidth; + while (nBits-- > 0) + { + if ((nValue >> nBits) & 1) + sText[ nLen++ ] = '1'; + else + sText[ nLen++ ] = '0'; + } + iValue++; + break; + } + case 'c': // PS_NEXT_ARG_CHR; + nValue = aValues[ iValue ].nValue; + sprintf( &sText[ nLen ], "%c", nValue ); + iValue++; + break; + case '%': + default: + sText[ nLen++ ] = c; + break; + } + while (sText[ nLen ]) + nLen++; + eThis = PS_LITERAL; + break; + default: + break; + } + } + } + else + if (g_aArgs[ iArg ].eToken == TOKEN_COMMA) + { + iArg++; + if (iArg > nArgs) + goto _Help; + } + else + goto _Help; + } + + if (nLen) + ConsoleBufferPush( sText ); + + return ConsoleUpdate(); + +_Help: + return Help_Arg_1( CMD_OUTPUT_PRINTF ); +} + + +//=========================================================================== +Update_t CmdOutputRun (int nArgs) +{ + if (! nArgs) + return Help_Arg_1( CMD_OUTPUT_RUN ); + + if (nArgs != 1) + return Help_Arg_1( CMD_OUTPUT_RUN ); + + // Read in script + // could be made global, to cache last run. + // Opens up the possibility of: + // CHEAT [ON | OFF] -> re-run script + // with conditional logic + // IF @ON .... + MemoryTextFile_t script; + + TCHAR * pFileName = g_aArgs[ 1 ].sArg; + + TCHAR sFileName[ MAX_PATH ]; + TCHAR sMiniFileName[ CONSOLE_WIDTH ]; + +// if (g_aArgs[1].bType & TYPE_QUOTED_2) + + strcpy( sMiniFileName, pFileName ); +// strcat( sMiniFileName, ".aws" ); // HACK: MAGIC STRING + + _tcscpy(sFileName, g_sCurrentDir); // + _tcscat(sFileName, sMiniFileName); + + if (script.Read( sFileName )) + { + int iLine = 0; + int nLine = script.GetNumLines(); + + Update_t bUpdateDisplay = UPDATE_NOTHING; + + for( int iLine = 0; iLine < nLine; iLine++ ) + { + script.GetLine( iLine, g_pConsoleInput, CONSOLE_WIDTH-2 ); + g_nConsoleInputChars = strlen( g_pConsoleInput ); + bUpdateDisplay |= DebuggerProcessCommand( false ); + } + } + else + { + TCHAR sText[ CONSOLE_WIDTH ]; + wsprintf( sText, "Couldn't load filename: %s", sFileName ); + ConsoleBufferPush( sText ); + } + + return ConsoleUpdate(); +} + + // Source Level Debugging _________________________________________________________________________ //=========================================================================== @@ -5782,42 +6188,47 @@ Update_t CmdTraceLine (int nArgs) //=========================================================================== Update_t CmdWatchAdd (int nArgs) { - if (!nArgs) - return Help_Arg_1( CMD_WATCH_ADD ); - - bool bAdded = false; int iArg = 0; - while (iArg++ < nArgs) + if (!nArgs) { - WORD nAddress = g_aArgs[iArg].nValue; + return CmdWatchList( 0 ); + } + else + { + bool bAdded = false; + while (iArg++ < nArgs) { - // FIND A FREE SLOT FOR THIS NEW WATCH - int iWatch = 0; - while ((iWatch < MAX_WATCHES) && (g_aWatches[iWatch].bSet)) - iWatch++; - if ((iWatch >= MAX_WATCHES) && !bAdded) - return ConsoleDisplayError(TEXT("All watches slots are currently in use.")); + WORD nAddress = g_aArgs[iArg].nValue; + { + // FIND A FREE SLOT FOR THIS NEW WATCH + int iWatch = 0; + while ((iWatch < MAX_WATCHES) && (g_aWatches[iWatch].bSet)) + iWatch++; + if ((iWatch >= MAX_WATCHES) && !bAdded) + return ConsoleDisplayError(TEXT("All watch slots are currently in use.")); - // VERIFY THAT THE WATCH IS NOT ON AN I/O LOCATION - if ((nAddress >= _6502_IO_BEGIN) && (nAddress <= _6502_IO_END)) - return ConsoleDisplayError(TEXT("You may not watch an I/O location.")); + // VERIFY THAT THE WATCH IS NOT ON AN I/O LOCATION + if ((nAddress >= _6502_IO_BEGIN) && (nAddress <= _6502_IO_END)) + return ConsoleDisplayError(TEXT("You may not watch an I/O location.")); - // ADD THE WATCH - if (iWatch < MAX_WATCHES) { - g_aWatches[iWatch].bSet = true; - g_aWatches[iWatch].bEnabled = true; - g_aWatches[iWatch].nAddress = nAddress; - bAdded = true; - g_nWatches++; + // ADD THE WATCH + if (iWatch < MAX_WATCHES) + { + g_aWatches[iWatch].bSet = true; + g_aWatches[iWatch].bEnabled = true; + g_aWatches[iWatch].nAddress = nAddress; + bAdded = true; + g_nWatches++; + } } } + + if (!bAdded) + return Help_Arg_1( CMD_WATCH_ADD ); } - - if (!bAdded) - return Help_Arg_1( CMD_WATCH_ADD ); - - return UPDATE_WATCH; // 1; + + return UPDATE_WATCH; // 1; } //=========================================================================== @@ -5871,14 +6282,23 @@ Update_t CmdWatchEnable (int nArgs) //=========================================================================== Update_t CmdWatchList (int nArgs) { - int iWatch = 0; - while (iWatch < MAX_WATCHES) + if (! g_nWatches) { - if (g_aWatches[ iWatch ].bSet) + TCHAR sText[ CONSOLE_WIDTH ]; + wsprintf( sText, TEXT(" There are no current watches. (Max: %d)"), MAX_WATCHES ); + ConsoleBufferPush( sText ); + } + else + { + int iWatch = 0; + while (iWatch < MAX_WATCHES) { - _ListBreakWatchZero( g_aWatches, iWatch ); + if (g_aWatches[ iWatch ].bSet) + { + _ListBreakWatchZero( g_aWatches, iWatch, true ); + } + iWatch++; } - iWatch++; } return ConsoleUpdate(); } @@ -6121,13 +6541,13 @@ void WindowUpdateConsoleDisplayedSize() { g_nConsoleDisplayHeight = MIN_DISPLAY_CONSOLE_LINES; g_nConsoleDisplayWidth = (CONSOLE_WIDTH / 2) + 8; - g_bConsoleFullWidth = false; +// g_bConsoleFullWidth = false; if (g_iWindowThis == WINDOW_CONSOLE) { g_nConsoleDisplayHeight = MAX_DISPLAY_CONSOLE_LINES; g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1; - g_bConsoleFullWidth = true; +// g_bConsoleFullWidth = true; } } @@ -6421,38 +6841,44 @@ Update_t CmdZeroPage (int nArgs) //=========================================================================== Update_t CmdZeroPageAdd (int nArgs) { - if (!nArgs) - return Help_Arg_1( CMD_ZEROPAGE_POINTER_ADD ); - - bool bAdded = false; - int iArg = 0; - while (iArg++ < nArgs) +// if (!nArgs) +// return Help_Arg_1( CMD_ZEROPAGE_POINTER_ADD ); + if (! nArgs) { - WORD nAddress = g_aArgs[iArg].nValue; + return CmdZeroPageList( 0 ); + } + else + { + bool bAdded = false; + int iArg = 0; + while (iArg++ < nArgs) { - int iZP = 0; - while ((iZP < MAX_ZEROPAGE_POINTERS) && (g_aZeroPagePointers[iZP].bSet)) + WORD nAddress = g_aArgs[iArg].nValue; { - iZP++; - } - if ((iZP >= MAX_ZEROPAGE_POINTERS) && !bAdded) - return ConsoleDisplayError(TEXT("All (ZP) pointers are currently in use.")); + int iZP = 0; + while ((iZP < MAX_ZEROPAGE_POINTERS) && (g_aZeroPagePointers[iZP].bSet)) + { + iZP++; + } + if ((iZP >= MAX_ZEROPAGE_POINTERS) && !bAdded) + return ConsoleDisplayError(TEXT("All (ZP) pointers are currently in use.")); - if (iZP < MAX_ZEROPAGE_POINTERS) - { - g_aZeroPagePointers[iZP].bSet = true; - g_aZeroPagePointers[iZP].bEnabled = true; - g_aZeroPagePointers[iZP].nAddress = (BYTE) nAddress; - bAdded = true; - g_nZeroPagePointers++; + if (iZP < MAX_ZEROPAGE_POINTERS) + { + g_aZeroPagePointers[iZP].bSet = true; + g_aZeroPagePointers[iZP].bEnabled = true; + g_aZeroPagePointers[iZP].nAddress = (BYTE) nAddress; + bAdded = true; + g_nZeroPagePointers++; + } } } + + if (!bAdded) + return Help_Arg_1( CMD_ZEROPAGE_POINTER_ADD ); } - - if (!bAdded) - return Help_Arg_1( CMD_ZEROPAGE_POINTER_ADD ); - - return UPDATE_ZERO_PAGE; + + return UPDATE_ZERO_PAGE | ConsoleUpdate(); } //=========================================================================== @@ -6506,14 +6932,23 @@ Update_t CmdZeroPageEnable (int nArgs) //=========================================================================== Update_t CmdZeroPageList (int nArgs) { - int iZP = 0; - while (iZP < MAX_ZEROPAGE_POINTERS) + if (! g_nZeroPagePointers) { - if (g_aZeroPagePointers[ iZP ].bEnabled) + TCHAR sText[ CONSOLE_WIDTH ]; + wsprintf( sText, TEXT(" There are no current ZeroPage pointers. (Max: %d)"), MAX_ZEROPAGE_POINTERS ); + ConsoleBufferPush( sText ); + } + else + { + int iZP = 0; + while (iZP < MAX_ZEROPAGE_POINTERS) { - _ListBreakWatchZero( g_aZeroPagePointers, iZP ); + if (g_aZeroPagePointers[ iZP ].bEnabled) + { + _ListBreakWatchZero( g_aZeroPagePointers, iZP ); + } + iZP++; } - iZP++; } return ConsoleUpdate(); } @@ -6749,7 +7184,7 @@ Update_t ExecuteCommand (int nArgs) g_nAppMode = MODE_RUNNING; // exit the debugger nFound = 1; - g_iCommand = CMD_CONFIG_ECHO; // hack: don't cook args + g_iCommand = CMD_OUTPUT_ECHO; // hack: don't cook args } // ####L -> Unassemble $address @@ -6821,13 +7256,16 @@ Update_t ExecuteCommand (int nArgs) if (nFound) { bool bCook = true; - if (g_iCommand == CMD_CONFIG_ECHO) + if (g_iCommand == CMD_OUTPUT_ECHO) bCook = false; int nArgsCooked = nArgs; if (bCook) nArgsCooked = ArgsCook( nArgs, nCookMask ); // Cook them + if (nArgsCooked == ARG_SYNTAX_ERROR) + return ConsoleDisplayError(TEXT("Syntax Error")); + if (pFunction) return pFunction( nArgsCooked ); // Eat them @@ -7456,6 +7894,8 @@ void _ConfigColorsReset() //=========================================================================== void DebugInitialize () { + AssemblerOff(); // update prompt + ZeroMemory( g_aConsoleDisplay, sizeof( g_aConsoleDisplay ) ); // CONSOLE_WIDTH * CONSOLE_HEIGHT ); ConsoleInputReset(); @@ -8090,7 +8530,7 @@ void DebuggerProcessKey( int keycode ) int iBookmark = keycode - '0'; if (KeybGetCtrlStatus() && KeybGetShiftStatus()) { - bUpdateDisplay |= CmdBookmarkAdd( iBookmark ); + bUpdateDisplay |= _CmdBookmarkAdd( iBookmark, g_nDisasmCurAddress ); g_bIgnoreNextKey = true; } else diff --git a/source/Debug.h b/source/Debug.h index 573e711e..2387a442 100644 --- a/source/Debug.h +++ b/source/Debug.h @@ -18,6 +18,11 @@ using namespace std; // Benchmarking extern DWORD extbench; +// Bookmarks + extern int g_nBookmarks; + extern Bookmark_t g_aBookmarks[ MAX_BOOKMARKS ]; +// extern vector g_aBookmarks; + // Breakpoints extern int g_nBreakpoints; extern Breakpoint_t g_aBreakpoints[ MAX_BREAKPOINTS ]; @@ -50,13 +55,15 @@ using namespace std; extern const int WINDOW_DATA_BYTES_PER_LINE; -// Disassembly +// Config - Disassembly extern bool g_bConfigDisasmAddressColon ; extern bool g_bConfigDisasmOpcodesView ; extern bool g_bConfigDisasmOpcodeSpaces ; extern int g_iConfigDisasmTargets ; extern int g_iConfigDisasmBranchType ; extern int g_bConfigDisasmImmediateChar; +// Config - Info + extern bool g_bConfigInfoTargetPointer ; // Display extern bool g_bDebuggerViewingAppleOutput; diff --git a/source/Debugger_Assembler.cpp b/source/Debugger_Assembler.cpp index 808dce73..95b0ab74 100644 --- a/source/Debugger_Assembler.cpp +++ b/source/Debugger_Assembler.cpp @@ -520,7 +520,7 @@ bool _6502_GetTargets ( WORD nAddress, int *pTargetPartial_, int *pTargetPointer case AM_NZY: // Indirect (Zeropage) Indexed, Y *pTargetPartial_ = nTarget8; - *pTargetPointer_ = (*(LPWORD)(mem + nTarget8)) + regs.y; + *pTargetPointer_ = ((*(LPWORD)(mem + nTarget8)) + regs.y) & _6502_MEM_END; // Bugfix: if (pTargetBytes_) *pTargetBytes_ = 1; break; diff --git a/source/Debugger_Console.cpp b/source/Debugger_Console.cpp index b43a7472..184d8ea4 100644 --- a/source/Debugger_Console.cpp +++ b/source/Debugger_Console.cpp @@ -54,7 +54,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Display TCHAR g_aConsolePrompt[] = TEXT(">!"); // input, assembler // NUM_PROMPTS TCHAR g_sConsolePrompt[] = TEXT(">"); // No, NOT Integer Basic! The nostalgic '*' "Monitor" doesn't look as good, IMHO. :-( - bool g_bConsoleFullWidth = false; + bool g_bConsoleFullWidth = true; // false int g_iConsoleDisplayStart = 0; // to allow scrolling int g_nConsoleDisplayTotal = 0; // number of lines added to console diff --git a/source/Debugger_Display.cpp b/source/Debugger_Display.cpp index 575fb3eb..cfb141ff 100644 --- a/source/Debugger_Display.cpp +++ b/source/Debugger_Display.cpp @@ -35,6 +35,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // NEW UI debugging // #define DEBUG_FORCE_DISPLAY 1 + #define DISPLAY_MEMORY_TITLE 1 +// #define DISPLAY_BREAKPOINT_TITLE 1 +// #define DISPLAY_WATCH_TITLE 1 // Public _________________________________________________________________________________________ @@ -69,7 +72,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA const int DISPLAY_WIDTH = 560; #define SCREENSPLIT1 356 // Horizontal Column (pixels?) of Stack & Regs // #define SCREENSPLIT2 456 // Horizontal Column (pixels?) of BPs, Watches & Mem - const int SCREENSPLIT2 = 456-7; // moved left one "char" to show PC in breakpoint: +// const int SCREENSPLIT2 = 456-7; // moved left one "char" to show PC in breakpoint: + const int SCREENSPLIT2 = SCREENSPLIT1 + (12 * 7); // moved left 3 chars to show B. prefix in breakpoint #, W. prefix in watch # const int DISPLAY_BP_COLUMN = SCREENSPLIT2; const int DISPLAY_MINI_CONSOLE = SCREENSPLIT1 - 6; // - 1 chars @@ -82,7 +86,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA const int DISPLAY_WATCHES_COLUMN = SCREENSPLIT2; const int DISPLAY_ZEROPAGE_COLUMN= SCREENSPLIT1; - const int MAX_DISPLAY_STACK_LINES = 8; + int MAX_DISPLAY_REGS_LINES = 6; + int MAX_DISPLAY_STACK_LINES = 8; + int MAX_DISPLAY_BREAKPOINTS_LINES = 6; // 5 + int MAX_DISPLAY_WATCHES_LINES = 6; // 5 + int MAX_DISPLAY_MEMORY_LINES_1 = 4; + int MAX_DISPLAY_MEMORY_LINES_2 = 2; + int MAX_DISPLAY_ZEROPAGE_LINES = 5; + int g_nDisplayMemoryLines; // Height // const int DISPLAY_LINES = 24; // FIXME: Should be pixels @@ -556,11 +567,15 @@ void DrawBreakpoints (HDC dc, int line) const int MAX_BP_LEN = 16; TCHAR sText[16] = TEXT("Breakpoints"); // TODO: Move to BP1 +#if DISPLAY_BREAKPOINT_TITLE SetBkColor(dc, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA SetTextColor(dc, DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC DebugDrawText( sText, rect ); rect.top += g_nFontHeight; rect.bottom += g_nFontHeight; +#endif + + int nBreakpointsDisplayed = 0; int iBreakpoint; for (iBreakpoint = 0; iBreakpoint < MAX_BREAKPOINTS; iBreakpoint++ ) @@ -578,12 +593,25 @@ void DrawBreakpoints (HDC dc, int line) WORD nAddress1 = pBP->nAddress; WORD nAddress2 = nAddress1 + nLength - 1; +#if DEBUG_FORCE_DISPLAY + if (iBreakpoint < MAX_DISPLAY_BREAKPOINTS_LINES) + bSet = true; +#endif if (! bSet) continue; + + nBreakpointsDisplayed++; + if (nBreakpointsDisplayed > MAX_DISPLAY_BREAKPOINTS_LINES) + break; RECT rect2; rect2 = rect; + SetBkColor( dc, DebuggerGetColor( BG_INFO )); + SetTextColor( dc, DebuggerGetColor( FG_INFO_TITLE ) ); + wsprintf( sText, TEXT("B.") ); + DebugDrawTextFixed( sText, rect2 ); + SetBkColor( dc, DebuggerGetColor( BG_INFO )); SetTextColor( dc, DebuggerGetColor( FG_INFO_BULLET ) ); wsprintf( sText, TEXT("%d"), iBreakpoint+1 ); @@ -688,14 +716,14 @@ void DrawBreakpoints (HDC dc, int line) DebugDrawTextFixed( sText, rect2 ); } - // Bugfix: Rest of line is still breakpoint background color + // Windows HACK: Bugfix: Rest of line is still breakpoint background color SetBkColor(dc, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA SetTextColor(dc, DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC DebugDrawTextHorz( TEXT(" "), rect2 ); + rect.top += g_nFontHeight; + rect.bottom += g_nFontHeight; } - rect.top += g_nFontHeight; - rect.bottom += g_nFontHeight; } } @@ -1292,6 +1320,8 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) rect.right = DISPLAY_WIDTH; rect.bottom = rect.top + g_nFontHeight; + RECT rect2; + rect2 = rect; const int MAX_MEM_VIEW_TXT = 16; TCHAR sText[ MAX_MEM_VIEW_TXT * 2 ]; @@ -1303,6 +1333,7 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) int iForeground = FG_INFO_OPCODE; int iBackground = BG_INFO; +#if DISPLAY_MEMORY_TITLE if (eDevice == DEV_SY6522) { // wsprintf(sData,TEXT("Mem at SY#%d"), nAddr); @@ -1326,8 +1357,6 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) wsprintf( sType, TEXT("TEXT") ); } - RECT rect2; - rect2 = rect; SetTextColor( hDC, DebuggerGetColor( FG_INFO_TITLE )); SetBkColor( hDC, DebuggerGetColor( BG_INFO )); @@ -1338,6 +1367,7 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) SetTextColor( hDC, DebuggerGetColor( FG_INFO_ADDRESS )); DebugDrawTextLine( sAddress, rect2 ); +#endif rect.top = rect2.top; rect.bottom = rect2.bottom; @@ -1346,25 +1376,26 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) WORD iAddress = nAddr; - if( (eDevice == DEV_SY6522) || (eDevice == DEV_AY8910) ) - { - iAddress = 0; - } - - int nLines = 4; + int nLines = g_nDisplayMemoryLines; int nCols = 4; if (iView != MEM_VIEW_HEX) { nCols = MAX_MEM_VIEW_TXT; } - rect.right = DISPLAY_WIDTH; + + if( (eDevice == DEV_SY6522) || (eDevice == DEV_AY8910) ) + { + iAddress = 0; + nCols = 6; + } + + rect.right = DISPLAY_WIDTH - 1; SetTextColor( hDC, DebuggerGetColor( FG_INFO_OPCODE )); for (int iLine = 0; iLine < nLines; iLine++ ) { - RECT rect2; rect2 = rect; if (iView == MEM_VIEW_HEX) @@ -1393,12 +1424,20 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) // else if (eDevice == DEV_SY6522) { - wsprintf( sText, TEXT("%02X "), (unsigned) ((BYTE*)&SS_MB.Unit[nAddr & 1].RegsSY6522)[iAddress] ); + wsprintf( sText, TEXT("%02X"), (unsigned) ((BYTE*)&SS_MB.Unit[nAddr & 1].RegsSY6522)[iAddress] ); + if (iCol & 1) + SetTextColor( hDC, DebuggerGetColor( iForeground )); + else + SetTextColor( hDC, DebuggerGetColor( FG_INFO_ADDRESS )); } else if (eDevice == DEV_AY8910) { - wsprintf( sText, TEXT("%02X "), (unsigned)SS_MB.Unit[nAddr & 1].RegsAY8910[iAddress] ); + wsprintf( sText, TEXT("%02X"), (unsigned)SS_MB.Unit[nAddr & 1].RegsAY8910[iAddress] ); + if (iCol & 1) + SetTextColor( hDC, DebuggerGetColor( iForeground )); + else + SetTextColor( hDC, DebuggerGetColor( FG_INFO_ADDRESS )); } else { @@ -1425,11 +1464,15 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) } } int nChars = DebugDrawTextFixed( sText, rect2 ); // DebugDrawTextFixed() - iAddress++; } - rect.top += g_nFontHeight; // TODO/FIXME: g_nFontHeight; - rect.bottom += g_nFontHeight; // TODO/FIXME: g_nFontHeight; + // Windows HACK: Bugfix: Rest of line is still background color +// SetBkColor( hDC, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA +// SetTextColor(hDC, DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC +// DebugDrawTextHorz( TEXT(" "), rect2 ); + + rect.top += g_nFontHeight; + rect.bottom += g_nFontHeight; sData[0] = 0; } } @@ -1557,7 +1600,9 @@ void DrawStack (HDC dc, int line) nAddress = 0x100; #endif - int iStack = 0; + int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; + + int iStack = 0; while (iStack < MAX_DISPLAY_STACK_LINES) { nAddress++; @@ -1565,30 +1610,33 @@ void DrawStack (HDC dc, int line) RECT rect; rect.left = DISPLAY_STACK_COLUMN; rect.top = (iStack+line) * g_nFontHeight; - rect.right = DISPLAY_STACK_COLUMN + 40; // TODO/FIXME/HACK MAGIC #: g_nFontWidthAvg * +// rect.right = DISPLAY_STACK_COLUMN + 40; +// rect.right = SCREENSPLIT2; + rect.right = rect.left + (10 * nFontWidth) + 1; rect.bottom = rect.top + g_nFontHeight; SetTextColor(dc, DebuggerGetColor( FG_INFO_TITLE )); // [COLOR_STATIC - SetBkColor(dc, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA + // BG_SOURCE_2 = grey + SetBkColor(dc, DebuggerGetColor( BG_DATA_1 )); // BG_INFO TCHAR sText[8] = TEXT(""); if (nAddress <= _6502_STACK_END) { - wsprintf(sText,TEXT("%04X"),nAddress); + wsprintf(sText,TEXT("%04X: "),nAddress); } - DebugDrawText( sText, rect ); + DebugDrawTextFixed( sText, rect ); - rect.left = DISPLAY_STACK_COLUMN + 40; // TODO/FIXME/HACK MAGIC #: g_nFontWidthAvg * - rect.right = SCREENSPLIT2; +// rect.left = DISPLAY_STACK_COLUMN + 40; // TODO/FIXME/HACK MAGIC #: g_nFontWidthAvg * +// rect.right = SCREENSPLIT2; SetTextColor(dc, DebuggerGetColor( FG_INFO_OPCODE )); // COLOR_FG_DATA_TEXT if (nAddress <= _6502_STACK_END) { - wsprintf(sText,TEXT("%02X"),(unsigned)*(LPBYTE)(mem+nAddress)); + wsprintf(sText,TEXT(" %02X"),(unsigned)*(LPBYTE)(mem+nAddress)); } - DebugDrawText( sText, rect ); - iStack++; + DebugDrawTextFixed( sText, rect ); + iStack++; } } @@ -1603,6 +1651,7 @@ void DrawTargets (HDC dc, int line) _6502_GetTargets( regs.pc, &aTarget[0],&aTarget[1], NULL ); RECT rect; + int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; int iAddress = 2; while (iAddress--) @@ -1611,7 +1660,7 @@ void DrawTargets (HDC dc, int line) // if ((aTarget[iAddress] >= _6502_IO_BEGIN) && (aTarget[iAddress] <= _6502_IO_END)) // aTarget[iAddress] = NO_6502_TARGET; - TCHAR sAddress[8] = TEXT(""); + TCHAR sAddress[8] = TEXT("-none-"); TCHAR sData[8] = TEXT(""); #if DEBUG_FORCE_DISPLAY @@ -1629,7 +1678,8 @@ void DrawTargets (HDC dc, int line) rect.left = DISPLAY_TARGETS_COLUMN; rect.top = (line+iAddress) * g_nFontHeight; - int nColumn = DISPLAY_TARGETS_COLUMN + 40; // TODO/FIXME/HACK MAGIC #: g_nFontWidthAvg * +// int nColumn = DISPLAY_TARGETS_COLUMN + 40; // TODO/FIXME/HACK MAGIC #: g_nFontWidthAvg * + int nColumn = rect.left + (7 * nFontWidth); rect.right = nColumn; rect.bottom = rect.top + g_nFontHeight; @@ -1641,7 +1691,7 @@ void DrawTargets (HDC dc, int line) SetBkColor(dc, DebuggerGetColor( BG_INFO )); DebugDrawText( sAddress, rect ); - rect.left = nColumn; // SCREENSPLIT1+40; // + 40 + rect.left = nColumn; rect.right = SCREENSPLIT2; if (iAddress == 0) @@ -1666,9 +1716,13 @@ void DrawWatches (HDC dc, int line) rect.bottom = rect.top + g_nFontHeight; TCHAR sText[16] = TEXT("Watches"); + + SetBkColor(dc, DebuggerGetColor( BG_DATA_1 )); // BG_INFO + +#if DISPLAY_WATCH_TITLE SetTextColor(dc, DebuggerGetColor( FG_INFO_TITLE )); - SetBkColor(dc, DebuggerGetColor( BG_INFO )); DebugDrawTextLine( sText, rect ); +#endif int iWatch; for (iWatch = 0; iWatch < MAX_WATCHES; iWatch++ ) @@ -1681,7 +1735,12 @@ void DrawWatches (HDC dc, int line) { RECT rect2 = rect; - wsprintf( sText,TEXT("%d"),iWatch+1 ); +// SetBkColor( dc, DebuggerGetColor( BG_INFO )); + SetTextColor( dc, DebuggerGetColor( FG_INFO_TITLE ) ); + wsprintf( sText, TEXT("W.") ); + DebugDrawTextFixed( sText, rect2 ); + + wsprintf( sText,TEXT("%d"),iWatch+1 ); SetTextColor( dc, DebuggerGetColor( FG_INFO_BULLET )); DebugDrawTextFixed( sText, rect2 ); @@ -1689,13 +1748,19 @@ void DrawWatches (HDC dc, int line) SetTextColor( dc, DebuggerGetColor( FG_INFO_OPERATOR )); DebugDrawTextFixed( sText, rect2 ); - wsprintf( sText,TEXT(" %04X"), g_aWatches[iWatch].nAddress ); - SetTextColor( dc, DebuggerGetColor( FG_INFO_ADDRESS )); + wsprintf( sText,TEXT("%04X"), g_aWatches[iWatch].nAddress ); + SetTextColor( dc, DebuggerGetColor( FG_DISASM_ADDRESS )); DebugDrawTextFixed( sText, rect2 ); - wsprintf(sText,TEXT(" %02X"),(unsigned)*(LPBYTE)(mem+g_aWatches[iWatch].nAddress)); + BYTE nTarget8 = (unsigned)*(LPBYTE)(mem+g_aWatches[iWatch].nAddress); + wsprintf(sText,TEXT(" %02X"), nTarget8 ); SetTextColor(dc, DebuggerGetColor( FG_INFO_OPCODE )); DebugDrawTextFixed( sText, rect2 ); + + WORD nTarget16 = (unsigned)*(LPWORD)(mem+g_aWatches[iWatch].nAddress); + wsprintf( sText,TEXT(" %04X"), nTarget16 ); + SetTextColor( dc, DebuggerGetColor( FG_INFO_ADDRESS )); + DebugDrawTextFixed( sText, rect2 ); } rect.top += g_nFontHeight; // HACK: @@ -1944,15 +2009,26 @@ void DrawSubWindow_Info( int iWindow ) const TCHAR **sReg = g_aBreakpointSource; - DrawStack(g_hDC,0); - DrawTargets(g_hDC,9); - DrawRegister(g_hDC,12, sReg[ BP_SRC_REG_A ] , 1, regs.a , PARAM_REG_A ); - DrawRegister(g_hDC,13, sReg[ BP_SRC_REG_X ] , 1, regs.x , PARAM_REG_X ); - DrawRegister(g_hDC,14, sReg[ BP_SRC_REG_Y ] , 1, regs.y , PARAM_REG_Y ); - DrawRegister(g_hDC,15, sReg[ BP_SRC_REG_PC] , 2, regs.pc, PARAM_REG_PC ); - DrawRegister(g_hDC,16, sReg[ BP_SRC_REG_S ] , 2, regs.sp, PARAM_REG_SP ); - DrawFlags(g_hDC,17,regs.ps,NULL); - DrawZeroPagePointers(g_hDC,19); + int yRegs = 0; // 12 + int yStack = yRegs + MAX_DISPLAY_REGS_LINES + 0; // 0 + int yTarget = yStack + MAX_DISPLAY_STACK_LINES - 2; // 9 + int yZeroPage = yStack + MAX_DISPLAY_STACK_LINES + 0; // 19 + + DrawRegister( g_hDC,yRegs++, sReg[ BP_SRC_REG_A ] , 1, regs.a , PARAM_REG_A ); + DrawRegister( g_hDC,yRegs++, sReg[ BP_SRC_REG_X ] , 1, regs.x , PARAM_REG_X ); + DrawRegister( g_hDC,yRegs++, sReg[ BP_SRC_REG_Y ] , 1, regs.y , PARAM_REG_Y ); + DrawRegister( g_hDC,yRegs++, sReg[ BP_SRC_REG_PC] , 2, regs.pc, PARAM_REG_PC ); + DrawRegister( g_hDC,yRegs++, sReg[ BP_SRC_REG_S ] , 2, regs.sp, PARAM_REG_SP ); + DrawFlags ( g_hDC,yRegs++, regs.ps, NULL); + + DrawStack(g_hDC, yStack); + + if (g_bConfigInfoTargetPointer) + { + DrawTargets(g_hDC,yTarget); + } + + DrawZeroPagePointers( g_hDC, yZeroPage ); #if defined(SUPPORT_Z80_EMU) && defined(OUTPUT_Z80_REGS) DrawRegister(g_hDC,19,TEXT("AF"),2,*(WORD*)(membank+REG_AF)); @@ -1962,33 +2038,46 @@ void DrawSubWindow_Info( int iWindow ) DrawRegister(g_hDC,23,TEXT("IX"),2,*(WORD*)(membank+REG_IX)); #endif + // Right Side + int yBreakpoints = 0; + int yWatches = yBreakpoints + MAX_DISPLAY_BREAKPOINTS_LINES; // 7 + int yMemory = yWatches + MAX_DISPLAY_WATCHES_LINES ; // 14 + + if ((MAX_DISPLAY_BREAKPOINTS_LINES + MAX_DISPLAY_WATCHES_LINES) < 12) + yWatches++; + #if DEBUG_FORCE_DISPLAY if (true) #else if (g_nBreakpoints) #endif - DrawBreakpoints(g_hDC,0); + DrawBreakpoints( g_hDC, yBreakpoints ); #if DEBUG_FORCE_DISPLAY if (true) #else if (g_nWatches) #endif - DrawWatches(g_hDC,7); + DrawWatches(g_hDC, yWatches ); + + g_nDisplayMemoryLines = MAX_DISPLAY_MEMORY_LINES_1; #if DEBUG_FORCE_DISPLAY if (true) #else if (g_aMemDump[0].bActive) #endif - DrawMemory(g_hDC, 14, 0 ); // g_aMemDump[0].nAddress, g_aMemDump[0].eDevice); + DrawMemory(g_hDC, yMemory, 0 ); // g_aMemDump[0].nAddress, g_aMemDump[0].eDevice); + + yMemory += (g_nDisplayMemoryLines + 1); + g_nDisplayMemoryLines = MAX_DISPLAY_MEMORY_LINES_2; #if DEBUG_FORCE_DISPLAY if (true) #else if (g_aMemDump[1].bActive) #endif - DrawMemory(g_hDC, 19, 1 ); // g_aMemDump[1].nAddress, g_aMemDump[1].eDevice); + DrawMemory(g_hDC, yMemory, 1 ); // g_aMemDump[1].nAddress, g_aMemDump[1].eDevice); } @@ -2182,7 +2271,7 @@ void DrawWindowBackground_Info( int g_iWindowThis ) RECT viewportrect; viewportrect.top = 0; viewportrect.left = SCREENSPLIT1 - 6; // 14 // HACK: MAGIC #: 14 -> (g_nFontWidthAvg-1) - viewportrect.right = 560; + viewportrect.right = DISPLAY_WIDTH; viewportrect.bottom = DISPLAY_HEIGHT; //g_nFontHeight * MAX_DISPLAY_INFO_LINES; // 384 SetBkColor(g_hDC, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA diff --git a/source/Debugger_Help.cpp b/source/Debugger_Help.cpp index 7860aba0..a66e1969 100644 --- a/source/Debugger_Help.cpp +++ b/source/Debugger_Help.cpp @@ -161,11 +161,11 @@ Update_t CmdHelpSpecific (int nArgs) { // ConsoleBufferPush( TEXT(" [] = optional, {} = mandatory. Categories are: ") ); - _tcscpy( sText, TEXT("Usage: [{ ") ); + _tcscpy( sText, TEXT("Usage: [< ") ); for (int iCategory = _PARAM_HELPCATEGORIES_BEGIN ; iCategory < _PARAM_HELPCATEGORIES_END; iCategory++) { - TCHAR *pName = g_aParameters[ iCategory ].m_sName; - if (! TestStringCat( sText, pName, g_nConsoleDisplayWidth - 3 )) // CONSOLE_WIDTH + TCHAR *pName = g_aParameters[ iCategory ].m_sName; + if (! TestStringCat( sText, pName, CONSOLE_WIDTH - 2 )) // CONSOLE_WIDTH // g_nConsoleDisplayWidth - 3 { ConsoleBufferPush( sText ); _tcscpy( sText, TEXT(" ") ); @@ -177,10 +177,10 @@ Update_t CmdHelpSpecific (int nArgs) StringCat( sText, TEXT(" | "), CONSOLE_WIDTH ); } } - StringCat( sText, TEXT(" }]"), CONSOLE_WIDTH ); + StringCat( sText, TEXT(" >]"), CONSOLE_WIDTH ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT("Note: [] = optional, {} = mandatory"), CONSOLE_WIDTH ); + wsprintf( sText, TEXT("Note: [] = optional, <> = mandatory"), CONSOLE_WIDTH ); ConsoleBufferPush( sText ); } @@ -188,7 +188,8 @@ Update_t CmdHelpSpecific (int nArgs) bool bAllCommands = false; bool bCategory = false; - if (! _tcscmp( g_aArgs[1].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName)) + 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; @@ -202,26 +203,30 @@ Update_t CmdHelpSpecific (int nArgs) int nNewArgs = 0; int iCmdBegin = 0; int iCmdEnd = 0; - for (iArg = 1; iArg <= nArgs; iArg++ ) + + if (! bAllCommands) { -// 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 ); - switch( iParam ) + for (iArg = 1; iArg <= nArgs; iArg++ ) { - case PARAM_CAT_BREAKPOINTS: iCmdBegin = CMD_BREAKPOINT ; iCmdEnd = CMD_BREAKPOINT_SAVE + 1; break; - case PARAM_CAT_CONFIG : iCmdBegin = CMD_CONFIG_COLOR ; iCmdEnd = CMD_CONFIG_SAVE + 1; break; - case PARAM_CAT_CPU : iCmdBegin = CMD_ASSEMBLE ; iCmdEnd = CMD_TRACE_LINE + 1; break; - case PARAM_CAT_FLAGS : iCmdBegin = CMD_FLAG_CLEAR ; iCmdEnd = CMD_FLAG_SET_N + 1; break; - case PARAM_CAT_MEMORY : iCmdBegin = CMD_MEMORY_COMPARE ; iCmdEnd = CMD_MEMORY_FILL + 1; break; - case PARAM_CAT_SYMBOLS : iCmdBegin = CMD_SYMBOLS_LOOKUP ; iCmdEnd = CMD_SYMBOLS_LIST + 1; break; - case PARAM_CAT_WATCHES : iCmdBegin = CMD_WATCH_ADD ; iCmdEnd = CMD_WATCH_LIST + 1; break; - case PARAM_CAT_WINDOW : iCmdBegin = CMD_WINDOW ; iCmdEnd = CMD_WINDOW_OUTPUT + 1; break; - case PARAM_CAT_ZEROPAGE : iCmdBegin = CMD_ZEROPAGE_POINTER; iCmdEnd = CMD_ZEROPAGE_POINTER_SAVE+1;break; - default: break; + // 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 ); + switch( iParam ) + { + case PARAM_CAT_BREAKPOINTS: iCmdBegin = CMD_BREAKPOINT ; iCmdEnd = CMD_BREAKPOINT_SAVE + 1; break; + case PARAM_CAT_CONFIG : iCmdBegin = CMD_CONFIG_COLOR ; iCmdEnd = CMD_CONFIG_SAVE + 1; break; + case PARAM_CAT_CPU : iCmdBegin = CMD_ASSEMBLE ; iCmdEnd = CMD_TRACE_LINE + 1; break; + case PARAM_CAT_FLAGS : iCmdBegin = CMD_FLAG_CLEAR ; iCmdEnd = CMD_FLAG_SET_N + 1; break; + case PARAM_CAT_MEMORY : iCmdBegin = CMD_MEMORY_COMPARE ; iCmdEnd = CMD_MEMORY_FILL + 1; break; + case PARAM_CAT_SYMBOLS : iCmdBegin = CMD_SYMBOLS_LOOKUP ; iCmdEnd = CMD_SYMBOLS_LIST + 1; break; + case PARAM_CAT_WATCHES : iCmdBegin = CMD_WATCH_ADD ; iCmdEnd = CMD_WATCH_LIST + 1; break; + case PARAM_CAT_WINDOW : iCmdBegin = CMD_WINDOW ; iCmdEnd = CMD_WINDOW_OUTPUT + 1; break; + case PARAM_CAT_ZEROPAGE : iCmdBegin = CMD_ZEROPAGE_POINTER; iCmdEnd = CMD_ZEROPAGE_POINTER_SAVE+1;break; + default: break; + } + nNewArgs = (iCmdEnd - iCmdBegin); + if (nNewArgs > 0) + break; } - nNewArgs = (iCmdEnd - iCmdBegin); - if (nNewArgs > 0) - break; } if (nNewArgs > 0) @@ -254,14 +259,15 @@ Update_t CmdHelpSpecific (int nArgs) nFound = 1; } else - nFound = FindCommand( g_aArgs[iArg].sArg, pFunction, & iCommand ); - 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) { @@ -380,13 +386,6 @@ Update_t CmdHelpSpecific (int nArgs) ConsoleBufferPush( TEXT(" Usage: {address | symbol}") ); ConsoleBufferPush( TEXT(" Disassembles memory.") ); break; - case CMD_CALC: - ConsoleBufferPush( TEXT(" Usage: {address | symbol | + | - }" ) ); - ConsoleBufferPush( TEXT(" Output order is: Hex Bin Dec Char" ) ); - ConsoleBufferPush( TEXT(" Note: symbols take piority." ) ); - ConsoleBufferPush( TEXT("i.e. #A (if you don't want accum. val)" ) ); - ConsoleBufferPush( TEXT("i.e. #F (if you don't want flags val)" ) ); - break; case CMD_GO: ConsoleBufferPush( TEXT(" Usage: address | symbol [Skip,Length]]") ); ConsoleBufferPush( TEXT(" addres | symbol [Start:End]") ); @@ -399,13 +398,17 @@ Update_t CmdHelpSpecific (int nArgs) ConsoleBufferPush( TEXT(" G C600 FA00,600" ) ); ConsoleBufferPush( TEXT(" G C600 F000:FFFF" ) ); break; - case CMD_NOP: - ConsoleBufferPush( TEXT(" Puts a NOP opcode at current instruction") ); - break; case CMD_JSR: ConsoleBufferPush( TEXT(" Usage: {symbol | address}") ); ConsoleBufferPush( TEXT(" Pushes PC on stack; calls the named subroutine.") ); break; + case CMD_NOP: + ConsoleBufferPush( TEXT(" Puts a NOP opcode at current instruction") ); + break; + case CMD_OUT: + ConsoleBufferPush( TEXT(" Usage: {address8 | address16 | symbol} ## [##]") ); + ConsoleBufferPush( TEXT(" Ouput a byte or word to the IO address $C0xx" ) ); + break; case CMD_PROFILE: wsprintf( sText, TEXT(" Usage: [%s | %s | %s]") , g_aParameters[ PARAM_RESET ].m_sName @@ -513,10 +516,6 @@ Update_t CmdHelpSpecific (int nArgs) ConsoleBufferPush( TEXT(" 1 param : dumps R G B for scheme 'monochrome'") ); ConsoleBufferPush( TEXT(" 4 params: sets R G B for scheme 'monochrome'" ) ); break; - case CMD_OUTPUT: - ConsoleBufferPush( TEXT(" Usage: {address8 | address16 | symbol} ## [##]") ); - ConsoleBufferPush( TEXT(" Ouput a byte or word to the IO address $C0xx" ) ); - break; // Config - Diasm case CMD_CONFIG_DISASM: { @@ -628,24 +627,55 @@ Update_t CmdHelpSpecific (int nArgs) case CMD_MEMORY_LOAD: // BLOAD "Filename" addr[,len] - ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],address[,length]" ) ); - ConsoleBufferPush( TEXT(" If no filename specified, defaults to the last filename (if possible)" ) ); - ConsoleBufferPush( TEXT(" Examples:" ) ); - ConsoleBufferPush( TEXT(" BSAVE \"test\",FF00,100" ) ); - ConsoleBufferPush( TEXT(" BLOAD \"test\",2000" ) ); - break; - case CMD_MEMORY_SAVE: // BSAVE ["Filename"] addr,len - ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],address[,length]" ) ); - ConsoleBufferPush( TEXT(" If no filename specified, defaults to:" ) ); - ConsoleBufferPush( TEXT(" '####.####.bin' with the form" ) ); - ConsoleBufferPush( TEXT(" {address}.{length}.bin" ) ); + + if (iCommand == CMD_MEMORY_LOAD) + { + ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],address[,length]" ) ); + ConsoleBufferPush( TEXT(" If no filename specified, defaults to the last filename (if possible)" ) ); + } + if (iCommand == CMD_MEMORY_SAVE) + { + ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],address[,length]" ) ); + ConsoleBufferPush( TEXT(" If no filename specified, defaults to:" ) ); + ConsoleBufferPush( TEXT(" '####.####.bin' with the form" ) ); + ConsoleBufferPush( TEXT(" {address}.{length}.bin" ) ); + } + ConsoleBufferPush( TEXT(" Examples:" ) ); ConsoleBufferPush( TEXT(" BSAVE \"test\",FF00,100" ) ); ConsoleBufferPush( TEXT(" BLOAD \"test\",2000" ) ); break; - + // Output + case CMD_OUTPUT_CALC: + ConsoleBufferPush( TEXT(" Usage:
" ) ); + ConsoleBufferPush( TEXT(" Expression is one of: + - * / % ^ ~" ) ); + ConsoleBufferPush( TEXT(" Output order is: Hex Bin Dec Char" ) ); + ConsoleBufferPush( TEXT(" Note: symbols take piority." ) ); + ConsoleBufferPush( TEXT("i.e. #A (if you don't want accum. val)" ) ); + ConsoleBufferPush( TEXT("i.e. #F (if you don't want flags val)" ) ); + break; + case CMD_OUTPUT_ECHO: + ConsoleBufferPush( TEXT(" Usage: string" ) ); + ConsoleBufferPush( TEXT(" Examples:" ) ); + wsprintf( sText, TEXT(" %s Checkpoint"), pCommand->m_sName ); ConsoleBufferPush( sText ); + wsprintf( sText, TEXT(" %s PC" ), pCommand->m_sName ); ConsoleBufferPush( sText ); +// ConsoleBufferPush( TEXT(" Echo the string to the console" ) ); + break; + case CMD_OUTPUT_PRINT: + ConsoleBufferPush( TEXT(" Usage: [, string | expression" ) ); + ConsoleBufferPush( TEXT(" Examples:") ); + wsprintf( sText, TEXT(" %s \"A:\",A,\" X:\",X"), pCommand->m_sName ); ConsoleBufferPush( sText ); + wsprintf( sText, TEXT(" %s PC" ), pCommand->m_sName ); ConsoleBufferPush( sText ); + break; + case CMD_OUTPUT_PRINTF: + ConsoleBufferPush( TEXT(" Usage: \"\" | expression [,]" ) ); + ConsoleBufferPush( TEXT(" Text may contain formatting flags: %d %x %z" ) ); + ConsoleBufferPush( TEXT(" %d DEC, %x HEX, %z BIN" ) ); + ConsoleBufferPush( TEXT(" Examples:") ); + ConsoleBufferPush( TEXT(" PRINTF \"A Dec: %d\",A,\" Hex: %x\",A,\" Bin: %z\",A" ) ); + break; // Symbols case CMD_SYMBOLS_MAIN: case CMD_SYMBOLS_USER: @@ -784,9 +814,11 @@ Update_t CmdVersion (int nArgs) if (nArgs) { - for (int iArg = 1; iArg <= nArgs; iArg++ ) + for (int iArg = 1; iArg <= g_nArgRaw; iArg++ ) { - if (_tcscmp( g_aArgs[ iArg ].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName ) == 0) + // * 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 )) ) { wsprintf( sText, " Arg: %d bytes * %d = %d bytes", sizeof(Arg_t), MAX_ARGS, sizeof(g_aArgs) ); diff --git a/source/Debugger_Parser.cpp b/source/Debugger_Parser.cpp index 526c153a..3ed97c38 100644 --- a/source/Debugger_Parser.cpp +++ b/source/Debugger_Parser.cpp @@ -72,8 +72,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA { TOKEN_QUOTE_DOUBLE, TYPE_QUOTED_2, TEXT('"') }, // for strings { TOKEN_RIGHT_PAREN , TYPE_OPERATOR, TEXT(')') }, { TOKEN_SEMI , TYPE_STRING , TEXT(';') }, - { TOKEN_SPACE , TYPE_STRING , TEXT(' ') } // space is also a delimiter between tokens/args -// { TOKEN_STAR , TYPE_OPERATOR, TEXT('*') }, // Not a token 1) wildcard needs to stay together with other chars + { TOKEN_SPACE , TYPE_STRING , TEXT(' ') }, // space is also a delimiter between tokens/args + { TOKEN_STAR , TYPE_OPERATOR, TEXT('*') } // Not a token 1) wildcard needs to stay together with other chars // { TOKEN_TAB , TYPE_STRING , TEXT('\t') } // { TOKEN_TILDE , TYPE_OPERATOR, TEXT('~') }, // C/C++: Not. Used for console. }; @@ -496,6 +496,10 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) pPrev = pArg - 1; + // Pass wildstar '*' to commands if only arg + if ((pArg->eToken == TOKEN_STAR) && (nArg == 1)) + ; + else if (nArgsLeft > 0) // These ops take at least 1 argument { pNext = pArg + 1; @@ -604,6 +608,18 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) nParamLen = 2; } + if (bProcessMask & (1 << TOKEN_STAR)) + if (pArg->eToken == TOKEN_STAR) // STAR * delta + { + if (! ArgsGetImmediateValue( pNext, & nAddressRHS )) + { + ArgsGetRegisterValue( pNext, & nAddressRHS ); + } + pPrev->nValue *= nAddressRHS; + pPrev->bType |= TYPE_VALUE; // signal already up to date + nParamLen = 2; + } + if (bProcessMask & (1 << TOKEN_FSLASH)) if (pArg->eToken == TOKEN_FSLASH) // FORWARD SLASH / delta { diff --git a/source/Debugger_Types.h b/source/Debugger_Types.h index 3014dcce..f67a848f 100644 --- a/source/Debugger_Types.h +++ b/source/Debugger_Types.h @@ -141,14 +141,10 @@ MAX_BOOKMARKS = 10 }; - extern vector g_aBookmarks; - - // Breakpoints ____________________________________________________________________________________ enum { -// NUMBREAKPOINTS = 15 MAX_BREAKPOINTS = 15 }; @@ -203,9 +199,9 @@ BP_OP_NOT_EQUAL , // ! REG BP_OP_GREATER_THAN , // > REG BP_OP_GREATER_EQUAL, // >= REG - BP_OP_READ , // ? MEM - BP_OP_WRITE , // @ MEM - BP_OP_READ_WRITE , // * MEM + BP_OP_READ , // @ MEM @ ? * + BP_OP_WRITE , // * MEM @ ? * + BP_OP_READ_WRITE , // ? MEM @ ? * NUM_BREAKPOINT_OPERATORS }; @@ -219,6 +215,7 @@ bool bEnabled; }; + typedef Breakpoint_t Bookmark_t; typedef Breakpoint_t Watches_t; typedef Breakpoint_t ZeroPagePointers_t; @@ -399,22 +396,30 @@ enum Commands_e { // Main / CPU - CMD_ASSEMBLE - , CMD_UNASSEMBLE + CMD_CURSOR_JUMP_PC // Shift + , CMD_CURSOR_SET_PC // Ctrl + , CMD_ASSEMBLE , CMD_BREAK_INVALID , CMD_BREAK_OPCODE - , CMD_CALC , CMD_GO - , CMD_INPUT + , CMD_IN , CMD_INPUT_KEY , CMD_JSR - , CMD_OUTPUT , CMD_NOP + , CMD_OUT , CMD_STEP_OVER , CMD_STEP_OUT , CMD_TRACE , CMD_TRACE_FILE , CMD_TRACE_LINE + , CMD_UNASSEMBLE +// Bookmarks + , CMD_BOOKMARK_MENU + , CMD_BOOKMARK_ADD + , CMD_BOOKMARK_CLEAR + , CMD_BOOKMARK_LIST + , CMD_BOOKMARK_LOAD + , CMD_BOOKMARK_SAVE // Breakpoints , CMD_BREAKPOINT , CMD_BREAKPOINT_ADD_SMART // smart breakpoint @@ -424,6 +429,7 @@ // , CMD_BREAKPOINT_EXEC = CMD_BREAKPOINT_ADD_ADDR // alias , CMD_BREAKPOINT_ADD_IO // break on: [$C000-$C7FF] Load/Store , CMD_BREAKPOINT_ADD_MEM // break on: [$0000-$FFFF], excluding IO + , CMD_BREAKPOINT_CLEAR // , CMD_BREAKPOINT_REMOVE = CMD_BREAKPOINT_CLEAR // alias , CMD_BREAKPOINT_DISABLE @@ -450,17 +456,13 @@ // , CMD_CONFIG_DISASM_OPCODE // , CMD_CONFIG_DISASM_SPACES - , CMD_CONFIG_ECHO , CMD_CONFIG_FONT // , CMD_CONFIG_FONT2 // PARAM_FONT_DISASM PARAM_FONT_INFO PARAM_FONT_SOURCE , CMD_CONFIG_HCOLOR // TODO Video :: SETFRAMECOLOR(#,R,G,B) , CMD_CONFIG_LOAD , CMD_CONFIG_MONOCHROME // MONO # rr gg bb - , CMD_CONFIG_RUN , CMD_CONFIG_SAVE // Cursor - , CMD_CURSOR_JUMP_PC // Shift - , CMD_CURSOR_SET_PC // Ctrl , CMD_CURSOR_JUMP_RET_ADDR , CMD_CURSOR_LINE_UP // Smart Line Up , CMD_CURSOR_LINE_UP_1 // Shift @@ -510,7 +512,7 @@ , CMD_MEM_MINI_DUMP_HEX_1 , CMD_MEM_MINI_DUMP_HEX_2 , _CMD_MEM_MINI_DUMP_HEX_1_3 // alias M1 - , _CMD_MEM_MINI_DUMP_HEX_2_1 // alias M2 + , _CMD_MEM_MINI_DUMP_HEX_2_1 // alias M2 , CMD_MEM_MINI_DUMP_ASCII_1 // ASCII , CMD_MEM_MINI_DUMP_ASCII_2 @@ -533,6 +535,12 @@ , CMD_MEMORY_SEARCH_APPLE // Flashing Chars, Hi-Bit Set , CMD_MEMORY_SEARCH_HEX , CMD_MEMORY_FILL +// Output + , CMD_OUTPUT_CALC + , CMD_OUTPUT_ECHO + , CMD_OUTPUT_PRINT + , CMD_OUTPUT_PRINTF + , CMD_OUTPUT_RUN // Registers - CPU , CMD_REGISTER_SET // Source Level Debugging @@ -615,23 +623,30 @@ // CPU + Update_t CmdCursorJumpPC(int nArgs); + Update_t CmdCursorSetPC (int nArgs); Update_t CmdAssemble (int nArgs); - Update_t CmdUnassemble (int nArgs); // code dump, aka, Unassemble Update_t CmdBreakInvalid(int nArgs); // Breakpoint IFF Full-speed! Update_t CmdBreakOpcode (int nArgs); // Breakpoint IFF Full-speed! - Update_t CmdCalculator (int nArgs); Update_t CmdGo (int nArgs); - Update_t CmdInput (int nArgs); + Update_t CmdIn (int nArgs); + Update_t CmdKey (int nArgs); Update_t CmdJSR (int nArgs); Update_t CmdNOP (int nArgs); - Update_t CmdOutput (int nArgs); - Update_t CmdFeedKey (int nArgs); - Update_t CmdStepOut (int nArgs); + Update_t CmdOut (int nArgs); Update_t CmdStepOver (int nArgs); + Update_t CmdStepOut (int nArgs); Update_t CmdTrace (int nArgs); // alias for CmdStepIn Update_t CmdTraceFile (int nArgs); Update_t CmdTraceLine (int nArgs); - + Update_t CmdUnassemble (int nArgs); // code dump, aka, Unassemble +// Bookmarks + Update_t CmdBookmarkMenu (int nArgs); + Update_t CmdBookmarkAdd (int nArgs); + Update_t CmdBookmarkClear (int nArgs); + Update_t CmdBookmarkList (int nArgs); + Update_t CmdBookmarkLoad (int nArgs); + Update_t CmdBookmarkSave (int nArgs); // Breakpoints Update_t CmdBreakpointMenu (int nArgs); Update_t CmdBreakpointAddSmart(int nArgs); @@ -660,11 +675,9 @@ Update_t CmdConfigBaseDec (int nArgs); Update_t CmdConfigColorMono (int nArgs); Update_t CmdConfigDisasm (int nArgs); - Update_t CmdConfigEcho (int nArgs); Update_t CmdConfigFont (int nArgs); Update_t CmdConfigHColor (int nArgs); Update_t CmdConfigLoad (int nArgs); - Update_t CmdConfigRun (int nArgs); Update_t CmdConfigSave (int nArgs); Update_t CmdConfigSetFont (int nArgs); Update_t CmdConfigGetFont (int nArgs); @@ -672,10 +685,8 @@ Update_t CmdCursorFollowTarget(int nArgs); Update_t CmdCursorLineDown (int nArgs); Update_t CmdCursorLineUp (int nArgs); - Update_t CmdCursorJumpPC (int nArgs); Update_t CmdCursorJumpRetAddr (int nArgs); Update_t CmdCursorRunUntil (int nArgs); - Update_t CmdCursorSetPC (int nArgs); Update_t CmdCursorPageDown (int nArgs); Update_t CmdCursorPageDown256 (int nArgs); Update_t CmdCursorPageDown4K (int nArgs); @@ -689,7 +700,6 @@ Update_t CmdHelpSpecific (int Argss); Update_t CmdVersion (int nArgs); Update_t CmdMOTD (int nArgs); - // Flags Update_t CmdFlag (int nArgs); Update_t CmdFlagClear (int nArgs); @@ -715,6 +725,12 @@ Update_t CmdMemorySearchAscii (int nArgs); Update_t CmdMemorySearchApple (int nArgs); Update_t CmdMemorySearchHex (int nArgs); +// Output/Scripts + Update_t CmdOutputCalc (int nArgs); + Update_t CmdOutputEcho (int nArgs); + Update_t CmdOutputPrint (int nArgs); + Update_t CmdOutputPrintf (int nArgs); + Update_t CmdOutputRun (int nArgs); // Registers Update_t CmdRegisterSet (int nArgs); // Source Level Debugging @@ -1087,6 +1103,7 @@ , TOKEN_RIGHT_PAREN // ) , TOKEN_SEMI // ; Command Seperator , TOKEN_SPACE // Token Delimiter + , TOKEN_STAR // * // , TOKEN_TAB // '\t' , NUM_TOKENS // signal none, or bad @@ -1179,10 +1196,11 @@ // Disasm , _PARAM_CONFIG_BEGIN = _PARAM_REGS_END // Daisy Chain , PARAM_CONFIG_BRANCH = _PARAM_CONFIG_BEGIN // g_iConfigDisasmBranchType [0|1|2] - , PARAM_CONFIG_COLON // g_bConfigDisasmAddressColon [0|1] - , PARAM_CONFIG_OPCODE // g_bConfigDisasmOpcodesView [0|1] - , PARAM_CONFIG_SPACES // g_bConfigDisasmOpcodeSpaces [0|1] - , PARAM_CONFIG_TARGET // g_iConfigDisasmTargets [0 | 1 | 2] + , PARAM_CONFIG_COLON // g_bConfigDisasmAddressColon [0|1] + , PARAM_CONFIG_OPCODE // g_bConfigDisasmOpcodesView [0|1] + , PARAM_CONFIG_POINTER // g_bConfigInfoTargetPointer [0|1] + , PARAM_CONFIG_SPACES // g_bConfigDisasmOpcodeSpaces [0|1] + , PARAM_CONFIG_TARGET // g_iConfigDisasmTargets [0|1|2] , _PARAM_CONFIG_END , PARAM_CONFIG_NUM = _PARAM_CONFIG_END - _PARAM_CONFIG_BEGIN @@ -1216,12 +1234,16 @@ , _PARAM_HELPCATEGORIES_BEGIN = _PARAM_GENERAL_END // Daisy Chain , PARAM_WILDSTAR = _PARAM_HELPCATEGORIES_BEGIN + , PARAM_CAT_BOOKMARKS , PARAM_CAT_BREAKPOINTS , PARAM_CAT_CONFIG , PARAM_CAT_CPU , PARAM_CAT_FLAGS + , PARAM_CAT_HELP , PARAM_CAT_MEMORY ,_PARAM_CAT_MEM // alias MEM = MEMORY + , PARAM_CAT_OUTPUT + , PARAM_CAT_REGISTERS , PARAM_CAT_SYMBOLS , PARAM_CAT_WATCHES , PARAM_CAT_WINDOW @@ -1323,7 +1345,7 @@ enum { - MAX_WATCHES = 5 + MAX_WATCHES = 6 }; @@ -1356,6 +1378,6 @@ enum { - MAX_ZEROPAGE_POINTERS = 5 + MAX_ZEROPAGE_POINTERS = 6 };