Debugger fixes for 2.9.0.16 and 2.9.0.17

This commit is contained in:
michaelangel007 2020-05-19 08:28:44 -07:00
parent 2c268b18d1
commit 0c0e2f6bdd
2 changed files with 26 additions and 11 deletions

View File

@ -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;
}
@ -598,15 +602,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)

View File

@ -135,7 +135,7 @@
// Prototypes _______________________________________________________________
// Bookmarks
bool Bookmark_Find( const WORD nAddress );
int Bookmark_Find( const WORD nAddress );
// Breakpoints
int CheckBreakpointsIO ();