diff --git a/docs/Debugger_Changelog.txt b/docs/Debugger_Changelog.txt index 631c4e14..b2ca5a72 100644 --- a/docs/Debugger_Changelog.txt +++ b/docs/Debugger_Changelog.txt @@ -1,4 +1,11 @@ /* + + +2.9.1.0 Added: Bookmarks now have their own indicator (a number with a box around it) and replace the ":" seperator. Updated Debug_Font.bmp + +.18 Fixed: Resetting bookmarks wasn't setting the total bookmarks back to zero. +.17 Fixed: If all bookmarks were used then setting a new one wouldn't update an existing one to the new address. +.16 Fixed: Replacing an existing bookmark incorrectly increased the total bookmark count. .15 Cleanup: HELP CALC examples and See also. .14 Fixed: HELP JSR wasn't color-coding syntax. .13 Added: PROFILE LIST now shows how many clock cycles were executed. diff --git a/resource/Debug_Font.bmp b/resource/Debug_Font.bmp index 95baedb5..bff94b66 100644 Binary files a/resource/Debug_Font.bmp and b/resource/Debug_Font.bmp differ diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index 851cf0bd..4e78252b 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -50,7 +50,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #define ALLOW_INPUT_LOWERCASE 1 // See /docs/Debugger_Changelog.txt for full details - const int DEBUGGER_VERSION = MAKE_VERSION(2,9,0,15); + const int DEBUGGER_VERSION = MAKE_VERSION(2,9,1,0); // Public _________________________________________________________________________________________ @@ -484,13 +484,17 @@ bool _Bookmark_Del( const WORD nAddress ) { // g_aBookmarks.at( iBookmark ) = NO_6502_TARGET; g_aBookmarks[ iBookmark ].bSet = false; + g_nBookmarks--; bDeleted = true; } } return bDeleted; } -bool Bookmark_Find( const WORD nAddress ) +// Returns: +// 0 if address does not have a bookmark set +// N+1 if there is an existing bookmark that has this address +int Bookmark_Find( const WORD nAddress ) { // Ugh, linear search // int nSize = g_aBookmarks.size(); @@ -500,10 +504,10 @@ bool Bookmark_Find( const WORD nAddress ) if (g_aBookmarks[ iBookmark ].nAddress == nAddress) { if (g_aBookmarks[ iBookmark ].bSet) - return true; + return iBookmark + 1; } } - return false; + return 0; } @@ -534,6 +538,8 @@ void _Bookmark_Reset() { g_aBookmarks[ iBookmark ].bSet = false; } + + g_nBookmarks = 0; } @@ -598,15 +604,26 @@ Update_t CmdBookmarkAdd (int nArgs ) ConsoleDisplayPush( sText ); return ConsoleUpdate(); } - - if ((iBookmark < MAX_BOOKMARKS) && (g_nBookmarks < MAX_BOOKMARKS)) + + // 2.9.0.16 Fixed: Replacing an existing bookmark incorrectly increased the total bookmark count. + int nOldBookmark = Bookmark_Find( nAddress ); + if (nOldBookmark) { - g_aBookmarks[iBookmark].bSet = true; - g_aBookmarks[iBookmark].nAddress = nAddress; - bAdded = true; - g_nBookmarks++; - iBookmark++; + _Bookmark_Del( nAddress ); } + + // 2.9.0.17 Fixed: If all bookmarks were used then setting a new one wouldn't update an existing one to the new address. + if (g_aBookmarks[ iBookmark ].bSet) + { + g_aBookmarks[ iBookmark ].nAddress = nAddress; + bAdded = true; + } + else + if (g_nBookmarks < MAX_BOOKMARKS) + { + bAdded = _Bookmark_Add( iBookmark, nAddress ); + iBookmark++; + } } if (!bAdded) @@ -632,11 +649,7 @@ Update_t CmdBookmarkClear (int nArgs) { 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; - } + _Bookmark_Reset(); break; } diff --git a/source/Debugger/Debug.h b/source/Debugger/Debug.h index 70d1327b..91ac7d5c 100644 --- a/source/Debugger/Debug.h +++ b/source/Debugger/Debug.h @@ -135,7 +135,7 @@ // Prototypes _______________________________________________________________ // Bookmarks - bool Bookmark_Find( const WORD nAddress ); + int Bookmark_Find( const WORD nAddress ); // Breakpoints int CheckBreakpointsIO (); diff --git a/source/Debugger/Debugger_Display.cpp b/source/Debugger/Debugger_Display.cpp index 261bb49d..cd16dc73 100644 --- a/source/Debugger/Debugger_Display.cpp +++ b/source/Debugger/Debugger_Display.cpp @@ -622,7 +622,7 @@ void DebuggerSetColorBG( COLORREF nRGB, bool bTransparent ) // @param glyph Specifies a native glyph from the 16x16 chars Apple Font Texture. //=========================================================================== -void PrintGlyph( const int x, const int y, const char glyph ) +void PrintGlyph( const int x, const int y, const int glyph ) { HDC hDstDC = GetDebuggerMemDC(); @@ -1935,7 +1935,7 @@ WORD DrawDisassemblyLine ( int iLine, const WORD nBaseAddress ) bool bBreakpointEnable; GetBreakpointInfo( nBaseAddress, bBreakpointActive, bBreakpointEnable ); bool bAddressAtPC = (nBaseAddress == regs.pc); - bool bAddressIsBookmark = Bookmark_Find( nBaseAddress ); + int bAddressIsBookmark = Bookmark_Find( nBaseAddress ); DebugColors_e iBackground = BG_DISASM_1; DebugColors_e iForeground = FG_DISASM_MNEMONIC; // FG_DISASM_TEXT; @@ -2005,16 +2005,8 @@ WORD DrawDisassemblyLine ( int iLine, const WORD nBaseAddress ) } } - if (bAddressIsBookmark) - { - DebuggerSetColorBG( DebuggerGetColor( BG_DISASM_BOOKMARK ) ); - DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_BOOKMARK ) ); - } - else - { - DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); - DebuggerSetColorFG( DebuggerGetColor( iForeground ) ); - } + DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); + DebuggerSetColorFG( DebuggerGetColor( iForeground ) ); // Address if (! bCursorLine) @@ -2030,18 +2022,31 @@ WORD DrawDisassemblyLine ( int iLine, const WORD nBaseAddress ) PrintTextCursorX( (LPCTSTR) line.sAddress, linerect ); } - if (bAddressIsBookmark) - { - DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); - DebuggerSetColorFG( DebuggerGetColor( iForeground ) ); - } // Address Seperator if (! bCursorLine) DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ) ); if (g_bConfigDisasmAddressColon) - PrintTextCursorX( ":", linerect ); + { + if (bAddressIsBookmark) + { + DebuggerSetColorBG( DebuggerGetColor( BG_DISASM_BOOKMARK ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_BOOKMARK ) ); + + // Can't use PrintTextCursorX() as that clamps chars > 0x7F to Mouse Text + // char bookmark_text[2] = { 0x7F + bAddressIsBookmark, 0 }; + // PrintTextCursorX( bookmark_text, linerect ); + FillRect( GetDebuggerMemDC(), &linerect, g_hConsoleBrushBG ); + PrintGlyph( linerect.left, linerect.top, 0x7F + bAddressIsBookmark ); // Glyphs 0x80 .. 0x89 = Unicode U+24EA, U+2460 .. U+2468 + linerect.left += g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontWidthAvg; + + DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); + DebuggerSetColorFG( DebuggerGetColor( iForeground ) ); + } + else + PrintTextCursorX( ":", linerect ); + } else PrintTextCursorX( " ", linerect ); // bugfix, not showing "addr:" doesn't alternate color lines