* BP now backwards compatible
* Cleaned up Breakpoint code
This commit is contained in:
mpohoreski 2006-02-26 21:39:09 +00:00
parent 0bd18b1d4c
commit 00b1ca699a
6 changed files with 85 additions and 536 deletions

View File

@ -42,214 +42,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// TODO: COLOR SAVE ["filename"]
// TODO: COLOR LOAD ["filename"]
// TCHAR DEBUG_VERSION = "0.0.0.0"; // App Version
const int DEBUGGER_VERSION = MAKE_VERSION(2,5,0,1);
// .1 SH Address,Len Byte [Byte ..]
// 2.5 split Debugger files
// .21 Changed: Branch indicator now a little bigger +3 in DebugInitialize() (easier to read), indented ^,V to make the < stand out
// U 300
// E 300 D0 80 D0 FE D0 00
// .20 Added: BW is now a seperate color scheme
// .19 Added: ECHO CmdConfigEcho(), g_pConsoleFirstArg, and ArgsGet()
// .18 Changed: BPX now defaults to setting breakpoint at cursor.
// .17 Changed: BP now defaults to setting breakpoint at PC.
// Patch 22
// .16 fixed BPM. i.e. BPM C400,100. Boot: ulti4bo.dsk, breaks at: 81BC: STA ($88),Y $0088=$C480 ... C483: A0
// Patch 21
// .15 Fixed: CmdRegisterSet() equal sign is now optional. i.e. R A [=] Y
// .14 Optimized: ArgsCook()
// .13 Fixed: HELP "..." on ambigious command displays potential commands
// .12 Added: Token %, calculator mod
// .11 Added: Token /, calculator div
// .10 Added: Token ^, calculator bit-xor
// .9 Added: Token |, calculator bit-or
// .8 Added: Token &, calculator bit-and
// .7 Added: Mini-Assembler
// .6 Added: MOTD (Message of the Day) : Moved from DebugBegin()
// .5 Added: HELP SOURCE
// .4 Fixed: SYMMAIN SYMUSER SYMSRC to now only search their respective symbol tables
// .3 Added: _CmdSymbolList_Address2Symbol() _CmdSymbolList_Symbol2Address() now take bit-flags of which tables to search
// .2 Added: EB alias for E
// .1 Added: EW address value16 CmdMemoryEnterWord() to set memory with 16-Bit Values
// 2.4.2.0
// .14 Added: SYM ! name to remove (user) symbol. _CmdSymbolsUpdate()
// .13 Added: JSR address|symbol CmdJSR()
// .12 Fixed: SYM address|symbol now reports if address or symbol not found. CmdSymbolsList()
// .11 Fixed PageUp*, PagDn* not being recognized valid commands.
// Patch 20
// .10 Added: SYM2 symbolname = value
// .9 Added: Undocumented command: FONT *
// .8 Improved: FONT MODE # is now more accurate. i.e. U 301
// FONT MODE 0 Classic line spacing (19 lines: 301 .. 313)
// FONT MODE 1 Improved line spacing (20 lines: 301 .. 314)
// FONT MODE 2 Optimal line spacing (22 lines: 301 .. 316)
// .7 Fixed: ArgsCook() wasn't parsing #value properly. i.e. CALC #A+0A
// .6 Cleanup: DrawWatches()
// Patch 19
// .5 Fixed: ProfileSave() doesn't strip '%' percent signs anymore. Changed: fprintf() to fputs()
// Fixed: PROFILE RESET doesn't do dummy run of formatting profile data.
// .4 Fixed: Exporting Profile data is now Excel/OpenOffice friendly.
// Zero counts not listed on console. (They are when saved to file.)
// Patch 18
// .3 Fixed: Help_Arg_1() now copies command name into arg.name
// .2 Fixed: Temporarily removed extra windows that aren't done yet from showing up: WINDOW_IO WINDOW_SYMBOLS WINDOW_ZEROPAGE WINDOW_SOURCE
// .1 Added: PROFILE LIST -- can now view the profile data from witin the debugger!
// 2.4.1 Added: PROFILE SAVE -- now we can optimize (D0 BNE), and (10 BPL) sucking up the major of the emulator's time. WOOT!
// Added: _6502GetOpmodeOpbyte() and _6502GetOpcodeOpmode()
// .37 Fixed: Misc. commands not updating the console when processed
// Patch 17
// .36 Data window now shows text dump based on memory view set (ASCII or APPLE)
// MA1 D0D0; DATA;
// MT1 D0D0; DATA;
// D D0D0; DATA;
// .35 Renamed: ML1 ML2 to MT1 MT2 (Mem Text)
// .34 Removed: MH1 MH2 (redundant MEM_VIEW_APPLE_TEXT)
// .33 Fixed: Tweaking of Lo,Hi,Norm Ascii colors for Disasm Immediate & Memory Dumps
// ML1 D0D0; MH2 D0D0; U FA75
// .32 Changed: Lo now maps High Ascii to printable chars. i.e. ML1 D0D0
// .31 Ctrl-Tab, and Ctrl-Shift-Tab now cycle next/prev windows.
// .30 Added: Up,Down,PageUp,PageDown,Shift-PageUp,Shift-PageDown,Ctrl-PageUp,Ctrl-PageDown now scroll Data window
// .29 Added: DATA window now shows memory dump
// Patch 16
// .28 Fixed: MONO wasn't setting monochrome scheme
// .27 Changed: Registers now drawn in light blue for both DrawSubWindow_Info() [DrawRegisters()] and DrawBreakpoints()
// Reg names in DrawSubWindow_Info no longer hard-coded: using g_areakpointSource[]
// .26 Changed: DrawTargets() now shows Temp Address, and Final Address as orange (FG_INFO_ADDRESS)
// .25 Changed: Flag Clear "FC" to "CL" (like 6502 mnemonic)
// Changed: Flag Set "FS" to "SE" (like 6502 mnemonic)
// Added: Mirrored 6502 Mnemonics to clear/set flags as commands
// Moved: Legacy Flag Clear/Set commands "R?" "S?" to aliases
// .24 Fixed OPCODE 2F: AM_INVALID1 -> AM_INVALID3
// .23 Fixed OPCODE 0F: AM_INVALID1 -> AM_INVALID3
// .22 Fixed: Shift-PageUp Shift-PageDown Ctrl-PageUp Ctrl-PageDown -> _CursorMoveUpAligned() & _CursorMoveDownAligned()
// Bug: U F001, Ctrl-PageDown
// Was using current disasm cursor address instead of top disasm cursor
// .21 Fixed: _CursorMoveUpAligned() & _CursorMoveDownAligned() not wrapping around past FF00 to 0, and wrapping around past 0 to FF00
// .20 Fixed: DisasmCalcTopFromCurAddress() causing bogus g_bDisasmCurBad when disasm invalid opcodes.
// .19 g_aAddressingFormat[] -> g_aOpmodes[]
// .18 Reverted .17 Changed StackPointer Input/Output. 'SP' is now back to 'S' (to be consistent with 6502 mnemonics)
// Patch 15
// .17 Changed StackPointer Input/Output from 'S' to 'SP'
// .16 Fixed Go StopAddress [SkipAddress,Length] Trace() not working afterwards
// .15 Added Info Regs color - Foreground and Background (orange)
// Patch 14
// .14 Added: Stack register now shows stack depth
// .13 Bugfix: CmdBreakpointAddPC() operators now don't add extra breakpoints. i.e. BPX P < FA00
// .12 Bugfix: DrawMemory() should draw memory byte for IO address: ML1 C000
// Patch 13
// NightlyBuild
// .11 Disasm now looks up symbols +1,-1. i.e. U FA85, u FAAE
// .10 Fixed '~' full console height
// .9 Fixed: FindCommand() to update command found if not exact match
// .8 Moved: Flag names from g_aFlagNames[] to "inlined" g_aBreakpointSource[]
// .7 Extended: Calc to show binary values, and char is single-quoted
// Nightly Build
// .6 Bugfix: DrawTargets() should draw target byte for IO address: R PC FB33
// .5 Extended: FONT "FontName" [Height]
// .4 Extended: Go StopAddress [SkipAddress,Len]
// .3 Added BPR F // break on flag
// Added ! // new breakpoint operator: NOT_EQUAL
// Patch 12
// .2 Fixed: FindCommand() and FindParam() now returns 0 if name length is 0.
// .1 Fixed: CmdHelpSpecific() wasn't printing help for 1 argument set by other commands
// 2.4.0.0 added: uber breakpoints: BPR [A|X|Y|PC|SP] [<,<=,=,>,>=] address
// .2 fixed: parsing console input to detect immediate values on operators '+', '-'
// You can now do register arithmetic: CALC A+X+Y
// .1 added: mini-calculator 'CALC'
// 2.3.2 Rewrote parsing of console input
// You can now do stuff like:
// BPA INITAN+3
// FONT "Lucida Console"
// Patch 11
// .19 fixed disasm: new color for disasm target address (orange)
// U FF14 shouldn't colorize ',X'
// U FF16 shouldn't colorize ',Y'
// U FF21 shouldn't colorze 'symbol,Y'
// Addr should be purple or orange to verify is fixed
// .18 fixed disasm: all indirects to do symbol lookup, and colorized '('...')' as operators
// .17 added disasm: syntax coloring to immediate mode prefix '#$'
// .16 fixed disasm window to work with proportional fonts
// .15 fixed buffer-overun crash in TextConvertTabsToSpaces()
// Patch 10
// .14 fixed help CATEGORY & SPECIFIC not working properly
// .13 fixed bug of CODE not removing CODE window split
// .12 fixed split window bug of re-sizing console too large
// .11 removed hard-coded height of 16 for line height in various Draw*()
// .10 added alpha feature: SOURCE2 now shows source assembly listing in bottom half of window DrawSourceLine()
// .9 added P [#] to step number of times specified
// .8 added Up-Arrow, Down-Arrow to scroll console by one line in full screen console window
// .7 Added source level debugger to buffer complete assembly source listing file
// .6 Added help for MA#, ML#, MH#
// .5 added 3rd symbol table: SRC
// .4 Added: seperated console input color, console output color
// .3 SYM now prints which symbol table the symbol was found in.
// .2 Added "DFB" to add assembler variable to user symbol table
// .1 Fixed FindAddressFromSymbol() and FindSymbolFromAddress() to search user symbol table first
// 2.3.1 Renamed all globals to conform to coding standard
// .10 added TAB to move the cursor back to the PC, if there is no console input
// .9 fixed bug of setting reg, always moving the cursor back the PC
// .8 added detection if font is proportional. Still doesn't draw properly, but slowly getting there.
// .7 added colorized chars for regs, and memory ascii dump
// .6 fixed console buffering BUG: ~,~,VERSION *
// .5 added ~ to toggle full console on/off
// .4 Fixed BUG: 'G' DebugContinueStepping() disasm window cursor getting out of sync: R PC FA62; U FB40; G FB53
// .3 Fixed spelling of CmdWindowLast()
// .2 Added undocumented "VERSION *" to show the number of bytes in the disasm "window"
// .1 Fixed BUG: CmdTrace() disasm window cursor getting out of sync: Start, F7, PageUp, Space
// 2.3.0.0 Syntax coloring for the disassembler! Plus a fancy branch indicator to 'PR#6'! Rock on!
// 38 Fixed FindParam() bug of skipping every other parameter
// 37 Fixed _PARAM_*_BEGIN _PARAM_*_END _PARAM_*_NUM
// 36 Added Regs A,X,Y to show character
// 35 Added syntax coloring for DrawBreakpoints()
// 34 Fixed DrawMemory() viewing memory ASCII to map control-chars to a printable glyph
// 33 Fixed 0 addr not working in CmdMemoryCompare()
// 32 Added BG_INFO_INVERSE, FG_INFO_INVERSE for flag hilighting
// 31 Changed FG_INFO_OPCODE color to yellow
// 30 Fixed MDC 0, bug in CmdUnassemble()with garbage address, due to var not init, and symbol lookup failed
// 29 Fixed typos in help summary, A, and D
// 28 Fixed Scrolling with and without g_bDisasmCurBad
// 27 Found bug -- can't scroll up past $5FFF with Tom's Bug Sample .. CmdCursorLineUp() not checking for gbDisamBad;
// 26 Code cleanup: still have some '#define's to convert over to 'const'
// 25 Fixed disasm singularity not showing up in DrawDisassemblyLine()
// 24 Fixed an disasm singularity in DisasmCalcTopFromCurAddress() i.e. F7, G FB53, then Space (to trace) once.
// 23 Fixed bug Watches not being cleared: _ClearViaArgs()
// 22 Code Cleanup: Moved most ExtTextOut() to DebugDrawText()
// 21 Changed End to jump $8000, due to redundant funcationality of Home, and wrap-around.
// 20 Added: DisasmCalc*From*()
// 19 New colors Enum & Array
// 18 implemented RTS. fixed RET to use common stack return address logic.
// 17 fixed console PageUp PageDn not refreshing console
// .2 WINDOW_CONSOLE &
// Implemented commands: MemoryDumpAscii*(): MA1 MA2 ML1 ML2 MH1 MH2
// 16 removed BOOL Cmd*(), replaced with UPDATE_*
// 15 New Console Scrolling
// 14 extended FindParam() to specify [begin,end]
// 13 added split window infastructure, added Window_e
// 12 fixed PARAM aliases
// 11 fixed FindParam() to allow aliases
// 10 fixed SYM1 CLEAR, SYM2 CLEAR not actuall clearing
// 9 fixed BufferOuput() in DebugBegin() clobbering first buffered output line
// .1 since source level debugging is a minor feature
// 8 added command "VERSION *" to show internal debug info
// 7 fixed mem enter not refreshing screen
// 6 added source level debuggig back-end
// 5 fixed "SYM 0" bug
// See Debugger_Changelong.txt for full details
const int DEBUGGER_VERSION = MAKE_VERSION(2,5,0,3);
// Public _________________________________________________________________________________________
@ -258,7 +52,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Breakpoints ________________________________________________________________
int g_nBreakpoints = 0;
Breakpoint_t g_aBreakpoints[ MAX_BREAKPOINTS ];
Breakpoint_t g_aBreakpoints[ NUM_BREAKPOINTS ];
// NOTE: Breakpoint_Source_t and g_aBreakpointSource must match!
const TCHAR *g_aBreakpointSource[ NUM_BREAKPOINT_SOURCES ] =
@ -1074,7 +868,7 @@ bool IsHexString ( LPCSTR pText )
//===========================================================================
bool GetBreakpointInfo ( WORD nOffset, bool & bBreakpointActive_, bool & bBreakpointEnable_ )
{
for (int iBreakpoint = 0; iBreakpoint < MAX_BREAKPOINTS; iBreakpoint++)
for (int iBreakpoint = 0; iBreakpoint < NUM_BREAKPOINTS; iBreakpoint++)
{
Breakpoint_t *pBP = &g_aBreakpoints[ iBreakpoint ];
@ -1183,7 +977,7 @@ bool CheckBreakpointsIO ()
nAddress = aTarget[ iTarget ];
if (nAddress != NO_6502_TARGET)
{
for (int iBreakpoint = 0; iBreakpoint < MAX_BREAKPOINTS; iBreakpoint++)
for (int iBreakpoint = 0; iBreakpoint < NUM_BREAKPOINTS; iBreakpoint++)
{
Breakpoint_t *pBP = &g_aBreakpoints[iBreakpoint];
if (_BreakpointValid( pBP ))
@ -1209,7 +1003,7 @@ bool CheckBreakpointsReg ()
{
bool bStatus = false;
for (int iBreakpoint = 0; iBreakpoint < MAX_BREAKPOINTS; iBreakpoint++)
for (int iBreakpoint = 0; iBreakpoint < NUM_BREAKPOINTS; iBreakpoint++)
{
Breakpoint_t *pBP = &g_aBreakpoints[iBreakpoint];
@ -1629,6 +1423,26 @@ Update_t CmdBreakpointMenu (int nArgs)
g_aArgs[1].nVal1 = regs.pc;
CmdBreakpointAddPC( 1 );
}
else
{
int iParam;
int nFound = FindParam( g_aArgs[ 1 ].sArg, MATCH_EXACT, iParam, _PARAM_GENERAL_BEGIN, _PARAM_GENERAL_END );
if (! nFound)
{
CmdBreakpointAddPC( 1 );
}
if (iParam == PARAM_SAVE)
{
}
if (iParam == PARAM_LOAD)
{
}
if (iParam == PARAM_RESET)
{
}
}
return UPDATE_CONSOLE_DISPLAY;
}
@ -1764,13 +1578,13 @@ bool _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, B
int iBreakpoint = 0;
Breakpoint_t *pBP = & g_aBreakpoints[ iBreakpoint ];
while ((iBreakpoint < MAX_BREAKPOINTS) && g_aBreakpoints[iBreakpoint].nLength)
while ((iBreakpoint < NUM_BREAKPOINTS) && g_aBreakpoints[iBreakpoint].nLength)
{
iBreakpoint++;
pBP++;
}
if (iBreakpoint >= MAX_BREAKPOINTS)
if (iBreakpoint >= NUM_BREAKPOINTS)
{
ConsoleDisplayError(TEXT("All Breakpoints slots are currently in use."));
return bStatus;
@ -1900,45 +1714,54 @@ Update_t CmdBreakpointAddMem (int nArgs)
//===========================================================================
void _BreakpointClear( Breakpoint_t * aBreakWatchZero, int iBreakpoint )
void _BreakWatchZero_Clear( Breakpoint_t * aBreakWatchZero, int iSlot )
{
aBreakWatchZero[iBreakpoint].bSet = false;
aBreakWatchZero[iBreakpoint].bEnabled = false;
aBreakWatchZero[iBreakpoint].nLength = 0;
aBreakWatchZero[ iSlot ].bSet = false;
aBreakWatchZero[ iSlot ].bEnabled = false;
aBreakWatchZero[ iSlot ].nLength = 0;
}
void _BreakWatchZero_RemoveOne( Breakpoint_t *aBreakWatchZero, const int iSlot, int & nTotal )
{
if (aBreakWatchZero[iSlot].bSet)
{
_BreakWatchZero_Clear( aBreakWatchZero, iSlot );
nTotal--;
}
}
void _BreakWatchZero_RemoveAll( Breakpoint_t *aBreakWatchZero, const int nMax, int & nTotal )
{
int iSlot = nMax;
while (iSlot--)
{
_BreakWatchZero_RemoveOne( aBreakWatchZero, iSlot, nTotal );
}
}
// called by BreakpointsClear, WatchesClear, ZeroPagePointersClear
//===========================================================================
void _ClearViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const int nMax, int & gnBWZ )
void _ClearViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const int nMax, int & nTotal )
{
int iBWZ;
int iSlot = 0;
// CLEAR EACH BREAKPOINT IN THE LIST
// Clear specified breakpoints
while (nArgs)
{
iBWZ = g_aArgs[nArgs].nVal1;
iSlot = g_aArgs[nArgs].nVal1;
if (! _tcscmp(g_aArgs[nArgs].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName))
{
iBWZ = nMax;
while (iBWZ--)
{
if (aBreakWatchZero[iBWZ].bSet)
{
_BreakpointClear( aBreakWatchZero, iBWZ );
gnBWZ--;
}
}
_BreakWatchZero_RemoveAll( aBreakWatchZero, nMax, nTotal );
break;
}
else if ((iBWZ >= 1) && (iBWZ <= nMax))
else
if ((iSlot >= 1) && (iSlot <= nMax))
{
if (aBreakWatchZero[iBWZ-1].bSet)
{
_BreakpointClear( aBreakWatchZero, iBWZ - 1 );
gnBWZ--;
}
_BreakWatchZero_RemoveOne( aBreakWatchZero, iSlot - 1, nTotal );
}
nArgs--;
}
}
@ -1947,24 +1770,28 @@ void _ClearViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const int nMax, i
// called by BreakpointsDisable, WatchesDisable, ZeroPagePointersDisable
void _EnableDisableViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const int nMax, const bool bEnabled )
{
int iSlot = 0;
// Enable each breakpoint in the list
while (nArgs)
{
int iBWZ = g_aArgs[nArgs].nVal1;
iSlot = g_aArgs[nArgs].nVal1;
if (! _tcscmp(g_aArgs[nArgs].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName))
{
int iBWZ = nMax;
while (iBWZ--)
iSlot = nMax;
while (iSlot--)
{
aBreakWatchZero[iBWZ].bEnabled = bEnabled;
aBreakWatchZero[ iSlot ].bEnabled = bEnabled;
}
break;
}
else
if ((iBWZ >= 1) && (iBWZ <= nMax))
if ((iSlot >= 1) && (iSlot <= nMax))
{
aBreakWatchZero[iBWZ-1].bEnabled = bEnabled;
aBreakWatchZero[iSlot-1].bEnabled = bEnabled;
}
nArgs--;
}
}
@ -1975,32 +1802,16 @@ Update_t CmdBreakpointClear (int nArgs)
if (!g_nBreakpoints)
return ConsoleDisplayError(TEXT("There are no breakpoints defined."));
int iBreakpoint;
// CHECK FOR ERRORS
if (!nArgs)
{
iBreakpoint = MAX_BREAKPOINTS;
while (iBreakpoint--)
{
if ((g_aBreakpoints[iBreakpoint].bSet) &&
(g_aBreakpoints[iBreakpoint].nAddress == regs.pc)) // TODO: FIXME
{
_BreakpointClear( g_aBreakpoints, iBreakpoint );
g_nBreakpoints--;
_BreakWatchZero_RemoveAll( g_aBreakpoints, NUM_BREAKPOINTS, g_nBreakpoints );
}
}
// return DisplayHelp(CmdBreakpointClear);
else
{
_ClearViaArgs( nArgs, g_aBreakpoints, NUM_BREAKPOINTS, g_nBreakpoints );
}
_ClearViaArgs( nArgs, g_aBreakpoints, MAX_BREAKPOINTS, g_nBreakpoints );
if (! g_nBreakpoints)
{
return (UPDATE_DISASM | UPDATE_BREAKPOINTS);
}
return UPDATE_BREAKPOINTS | UPDATE_CONSOLE_DISPLAY; // 1;
return UPDATE_DISASM | UPDATE_BREAKPOINTS | UPDATE_CONSOLE_DISPLAY;
}
//===========================================================================
@ -2012,7 +1823,7 @@ Update_t CmdBreakpointDisable (int nArgs)
if (! nArgs)
return Help_Arg_1( CMD_BREAKPOINT_DISABLE );
_EnableDisableViaArgs( nArgs, g_aBreakpoints, MAX_BREAKPOINTS, false );
_EnableDisableViaArgs( nArgs, g_aBreakpoints, NUM_BREAKPOINTS, false );
return UPDATE_BREAKPOINTS;
}
@ -2033,7 +1844,7 @@ Update_t CmdBreakpointEnable (int nArgs) {
if (! nArgs)
return Help_Arg_1( CMD_BREAKPOINT_ENABLE );
_EnableDisableViaArgs( nArgs, g_aBreakpoints, MAX_BREAKPOINTS, true );
_EnableDisableViaArgs( nArgs, g_aBreakpoints, NUM_BREAKPOINTS, true );
return UPDATE_BREAKPOINTS;
}
@ -2068,7 +1879,7 @@ Update_t CmdBreakpointList (int nArgs)
{
// ConsoleBufferPush( );
// vector<int> vBreakpoints;
// int iBreakpoint = MAX_BREAKPOINTS;
// int iBreakpoint = NUM_BREAKPOINTS;
// while (iBreakpoint--)
// {
// if (g_aBreakpoints[iBreakpoint].enabled)
@ -2086,7 +1897,7 @@ Update_t CmdBreakpointList (int nArgs)
else
{
int iBreakpoint = 0;
while (iBreakpoint < MAX_BREAKPOINTS)
while (iBreakpoint < NUM_BREAKPOINTS)
{
if (g_aBreakpoints[ iBreakpoint ].bSet)
{
@ -6632,7 +6443,7 @@ void DebugInitialize ()
WindowUpdateConsoleDisplayedSize();
// CLEAR THE BREAKPOINT AND WATCH TABLES
ZeroMemory( g_aBreakpoints , MAX_BREAKPOINTS * sizeof(Breakpoint_t));
ZeroMemory( g_aBreakpoints , NUM_BREAKPOINTS * sizeof(Breakpoint_t));
ZeroMemory( g_aWatches , MAX_WATCHES * sizeof(Watches_t) );
ZeroMemory( g_aZeroPagePointers, MAX_ZEROPAGE_POINTERS * sizeof(ZeroPagePointers_t));

View File

@ -20,7 +20,7 @@ using namespace std;
// Breakpoints
extern int g_nBreakpoints;
extern Breakpoint_t g_aBreakpoints[ MAX_BREAKPOINTS ];
extern Breakpoint_t g_aBreakpoints[ NUM_BREAKPOINTS ];
extern const TCHAR *g_aBreakpointSource [ NUM_BREAKPOINT_SOURCES ];
extern const TCHAR *g_aBreakpointSymbols[ NUM_BREAKPOINT_OPERATORS ];

View File

@ -73,7 +73,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// 10 signed: BPL BGE
// B0 unsigned: BCS BGE
#define R_ MEM_R
#define _W MEM_W
#define RW MEM_R | MEM_W
@ -151,7 +150,7 @@ const Opcodes_t g_aOpcodes65C02[ NUM_OPCODES ] =
{"INX", 0 , 0}, {"SBC", AM_M , R_}, {"NOP", 0 , 0}, {"NOP", AM_1 , 0 }, // E8 .. EB
{"CPX", AM_A , R_}, {"SBC", AM_A , R_}, {"INC", AM_A , RW}, {"NOP", AM_1 , 0 }, // EC .. EF
{"BEQ", AM_R , 0}, {"SBC", AM_NZY, R_}, {"SBC", AM_NZ , 0}, {"NOP", AM_1 , 0 }, // F0 .. F3
{"NOP", AM_2 , 0}, {"SBC", AM_ZX , R_}, {"INC", AM_ZX , RW}, {"NOP", AM_1 , 0 }, // F4 .. F7
{"NOP", AM_2 , 0}, {"SBC", AM_ZX , R_}, {"INC", AM_ZX , RW}, {"???", AM_ZX , 0 }, // F4 .. F7
{"SED", 0 , 0}, {"SBC", AM_AY , R_}, {"PLX", 0 , 0}, {"NOP", AM_1 , 0 }, // F8 .. FB
{"NOP", AM_3 , 0}, {"SBC", AM_AX , R_}, {"INC", AM_AX , RW}, {"NOP", AM_1 , 0 } // FF .. FF
};
@ -274,272 +273,11 @@ Fx BEQ r SBC (d),Y sbc (d) --- --- SBC d,X INC d,X --- SED SBC a,Y
{"INX", 0 , 0}, {"SBC", AM_M , R_}, {"NOP", 0 , 0}, {"NOP", AM_1 , 0 }, // E8 .. EB
{"CPX", AM_A , R_}, {"SBC", AM_A , R_}, {"INC", AM_A , RW}, {"NOP", AM_1 , 0 }, // EC .. EF
{"BEQ", AM_R , 0}, {"SBC", AM_NZY, R_}, {"SBC", AM_NZ , 0}, {"NOP", AM_1 , 0 }, // F0 .. F3
{"NOP", AM_2 , 0}, {"SBC", AM_ZX , R_}, {"INC", AM_ZX , RW}, {"NOP", AM_1 , 0 }, // F4 .. F7
{"NOP", AM_2 , 0}, {"SBC", AM_ZX , R_}, {"INC", AM_ZX , RW}, {"???", AM_ZX , 0 }, // F4 .. F7
{"SED", 0 , 0}, {"SBC", AM_AY , R_}, {"PLX", 0 , 0}, {"NOP", AM_1 , 0 }, // F8 .. FB
{"NOP", AM_3 , 0}, {"SBC", AM_AX , R_}, {"INC", AM_AX , RW}, {"NOP", AM_1 , 0 } // FF .. FF
};
/*
// x3 x7 xB xF are never used
{TEXT("BRK"), 0 , 0 }, // 00h
{TEXT("ORA"), ADDR_INDX , R_ }, // 01h
{TEXT("NOP"), ADDR_INVALID2 , 0 }, // 02h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 03h
{TEXT("TSB"), ADDR_ZP , _W }, // 04h // 65C02
{TEXT("ORA"), ADDR_ZP , R_ }, // 05h
{TEXT("ASL"), ADDR_ZP , _W }, // 06h // MEM_R ?
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 07h
{TEXT("PHP"), 0 , SW }, // 08h
{TEXT("ORA"), ADDR_IMM , im }, // 09h
{TEXT("ASL"), 0 , 0 }, // 0Ah // MEM_IMPLICIT
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 0Bh
{TEXT("TSB"), ADDR_ABS , _W }, // 0Ch // 65C02
{TEXT("ORA"), ADDR_ABS , R_ }, // 0Dh
{TEXT("ASL"), ADDR_ABS , _W }, // 0Eh // MEM_R ?
{TEXT("NOP"), ADDR_INVALID3 , 0 }, // 0Fh
{TEXT("BPL"), ADDR_REL , 0 }, // 10h // signed: BGE @reference: http://www.6502.org/tutorials/compare_instructions.html
{TEXT("ORA"), ADDR_INDY , R_ }, // 11h
{TEXT("ORA"), ADDR_IZPG , R_ }, // 12h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 13h
{TEXT("TRB"), ADDR_ZP , _W }, // 14h
{TEXT("ORA"), ADDR_ZP_X , R_ }, // 15h
{TEXT("ASL"), ADDR_ZP_X , _W }, // 16h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 17h
{TEXT("CLC"), 0 , 0 }, // 18h
{TEXT("ORA"), ADDR_ABSY , R_ }, // 19h
{TEXT("INA"), 0 , 0 }, // 1Ah INC A
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 1Bh
{TEXT("TRB"), ADDR_ABS , _W }, // 1Ch
{TEXT("ORA"), ADDR_ABSX , R_ }, // 1Dh
{TEXT("ASL"), ADDR_ABSX }, // 1Eh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 1Fh
{TEXT("JSR"), ADDR_ABS }, // 20h
{TEXT("AND"), ADDR_INDX }, // 21h
{TEXT("NOP"), ADDR_INVALID2 , 0 }, // 22h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 23h
{TEXT("BIT"), ADDR_ZP }, // 24h
{TEXT("AND"), ADDR_ZP }, // 25h
{TEXT("ROL"), ADDR_ZP }, // 26h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 27h
{TEXT("PLP"), 0 }, // 28h
{TEXT("AND"), ADDR_IMM }, // 29h
{TEXT("ROL"), 0 }, // 2Ah
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 2Bh
{TEXT("BIT"), ADDR_ABS }, // 2Ch
{TEXT("AND"), ADDR_ABS }, // 2Dh
{TEXT("ROL"), ADDR_ABS }, // 2Eh
{TEXT("NOP"), ADDR_INVALID3 , 0 }, // 2Fh
{TEXT("BMI"), ADDR_REL }, // 30h
{TEXT("AND"), ADDR_INDY }, // 31h
{TEXT("AND"), ADDR_IZPG }, // 32h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 33h
{TEXT("BIT"), ADDR_ZP_X }, // 34h
{TEXT("AND"), ADDR_ZP_X }, // 35h
{TEXT("ROL"), ADDR_ZP_X }, // 36h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 37h
{TEXT("SEC"), 0 }, // 38h
{TEXT("AND"), ADDR_ABSY }, // 39h
{TEXT("DEA"), 0 }, // 3Ah
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 3Bh
{TEXT("BIT"), ADDR_ABSX }, // 3Ch
{TEXT("AND"), ADDR_ABSX }, // 3Dh
{TEXT("ROL"), ADDR_ABSX }, // 3Eh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 3Fh
{TEXT("RTI"), 0 , 0 }, // 40h
{TEXT("EOR"), ADDR_INDX }, // 41h
{TEXT("NOP"), ADDR_INVALID2 , 0 }, // 42h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 43h
{TEXT("NOP"), ADDR_INVALID2 , 0 }, // 44h
{TEXT("EOR"), ADDR_ZP }, // 45h
{TEXT("LSR"), ADDR_ZP , _W }, // 46h // MEM_R ?
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 47h
{TEXT("PHA"), 0 }, // 48h // MEM_WRITE_IMPLIED | MEM_STACK
{TEXT("EOR"), ADDR_IMM }, // 49h
{TEXT("LSR"), 0 }, // 4Ah
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 4Bh
{TEXT("JMP"), ADDR_ABS }, // 4Ch
{TEXT("EOR"), ADDR_ABS }, // 4Dh
{TEXT("LSR"), ADDR_ABS , _W }, // 4Eh // MEM_R ?
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 4Fh
{TEXT("BVC"), ADDR_REL }, // 50h
{TEXT("EOR"), ADDR_INDY }, // 51h
{TEXT("EOR"), ADDR_IZPG }, // 52h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 53h
{TEXT("NOP"), ADDR_INVALID2 , 0 }, // 54h
{TEXT("EOR"), ADDR_ZP_X }, // 55h
{TEXT("LSR"), ADDR_ZP_X , _W }, // 56h // MEM_R ?
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 57h
{TEXT("CLI"), 0 }, // 58h
{TEXT("EOR"), ADDR_ABSY }, // 59h
{TEXT("PHY"), 0 }, // 5Ah
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 5Bh
{TEXT("NOP"), ADDR_INVALID3 , 0 }, // 5Ch
{TEXT("EOR"), ADDR_ABSX }, // 5Dh
{TEXT("LSR"), ADDR_ABSX }, // 5Eh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 5Fh
{TEXT("RTS"), 0 , SR }, // 60h
{TEXT("ADC"), ADDR_INDX }, // 61h
{TEXT("NOP"), ADDR_INVALID2 , 0 }, // 62h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 63h
{TEXT("STZ"), ADDR_ZP }, // 64h
{TEXT("ADC"), ADDR_ZP }, // 65h
{TEXT("ROR"), ADDR_ZP }, // 66h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 67h
{TEXT("PLA"), 0 , SW }, // 68h
{TEXT("ADC"), ADDR_IMM }, // 69h
{TEXT("ROR"), 0 }, // 6Ah
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 6Bh
{TEXT("JMP"), ADDR_IABS }, // 6Ch
{TEXT("ADC"), ADDR_ABS }, // 6Dh
{TEXT("ROR"), ADDR_ABS }, // 6Eh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 6Fh
{TEXT("BVS"), ADDR_REL }, // 70h
{TEXT("ADC"), ADDR_INDY }, // 71h
{TEXT("ADC"), ADDR_IZPG }, // 72h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 73h
{TEXT("STZ"), ADDR_ZP_X }, // 74h
{TEXT("ADC"), ADDR_ZP_X }, // 75h
{TEXT("ROR"), ADDR_ZP_X }, // 76h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 77h
{TEXT("SEI"), 0 }, // 78h
{TEXT("ADC"), ADDR_ABSY }, // 79h
{TEXT("PLY"), 0 , SR }, // 7Ah
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 7Bh
{TEXT("JMP"), ADDR_ABSIINDX }, // 7Ch
{TEXT("ADC"), ADDR_ABSX }, // 7Dh
{TEXT("ROR"), ADDR_ABSX }, // 7Eh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 7Fh
{TEXT("BRA"), ADDR_REL }, // 80h
{TEXT("STA"), ADDR_INDX , _W }, // 81h
{TEXT("NOP"), ADDR_INVALID2 , 0 }, // 82h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 83h
{TEXT("STY"), ADDR_ZP , _W }, // 84h
{TEXT("STA"), ADDR_ZP , _W }, // 85h
{TEXT("STX"), ADDR_ZP , _W }, // 86h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 87h
{TEXT("DEY"), 0 , 0 }, // 88h // Explicit
{TEXT("BIT"), ADDR_IMM }, // 89h
{TEXT("TXA"), 0 , 0 }, // 8Ah // Explicit
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 8Bh
{TEXT("STY"), ADDR_ABS , _W }, // 8Ch
{TEXT("STA"), ADDR_ABS , _W }, // 8Dh
{TEXT("STX"), ADDR_ABS , _W }, // 8Eh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 8Fh
{TEXT("BCC"), ADDR_REL , 0 }, // 90h // MEM_IMMEDIATE
{TEXT("STA"), ADDR_INDY , _W }, // 91h
{TEXT("STA"), ADDR_IZPG , _W }, // 92h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 93h
{TEXT("STY"), ADDR_ZP_X , _W }, // 94h
{TEXT("STA"), ADDR_ZP_X , _W }, // 95h
{TEXT("STX"), ADDR_ZP_Y , _W }, // 96h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 97h
{TEXT("TYA"), 0 , 0 }, // 98h // Explicit
{TEXT("STA"), ADDR_ABSY , _W }, // 99h
{TEXT("TXS"), 0 , 0 }, // 9Ah // EXplicit
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 9Bh
{TEXT("STZ"), ADDR_ABS , _W }, // 9Ch
{TEXT("STA"), ADDR_ABSX , _W }, // 9Dh
{TEXT("STZ"), ADDR_ABSX , _W }, // 9Eh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // 9Fh
{TEXT("LDY"), ADDR_IMM , 0 }, // A0h // MEM_IMMEDIATE
{TEXT("LDA"), ADDR_INDX , R_ }, // A1h
{TEXT("LDX"), ADDR_IMM , 0 }, // A2h // MEM_IMMEDIATE
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // A3h
{TEXT("LDY"), ADDR_ZP , R_ }, // A4h
{TEXT("LDA"), ADDR_ZP , R_ }, // A5h
{TEXT("LDX"), ADDR_ZP , R_ }, // A6h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // A7h
{TEXT("TAY"), 0 , 0 }, // A8h // Explicit
{TEXT("LDA"), ADDR_IMM , 0 }, // A9h // MEM_IMMEDIATE
{TEXT("TAX"), 0 , 0 }, // AAh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // ABh
{TEXT("LDY"), ADDR_ABS , R_ }, // ACh
{TEXT("LDA"), ADDR_ABS , R_ }, // ADh
{TEXT("LDX"), ADDR_ABS , R_ }, // AEh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // AFh
{TEXT("BCS"), ADDR_REL , 0 }, // B0h // MEM_IMMEDIATE // unsigned: BGE
{TEXT("LDA"), ADDR_INDY , R_ }, // B1h
{TEXT("LDA"), ADDR_IZPG , R_ }, // B2h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // B3h
{TEXT("LDY"), ADDR_ZP_X , R_ }, // B4h
{TEXT("LDA"), ADDR_ZP_X , R_ }, // B5h
{TEXT("LDX"), ADDR_ZP_Y , R_ }, // B6h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // B7h
{TEXT("CLV"), 0 , 0 }, // B8h // Explicit
{TEXT("LDA"), ADDR_ABSY , R_ }, // B9h
{TEXT("TSX"), 0 , 0 }, // BAh // Explicit
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // BBh
{TEXT("LDY"), ADDR_ABSX , R_ }, // BCh
{TEXT("LDA"), ADDR_ABSX , R_ }, // BDh
{TEXT("LDX"), ADDR_ABSY , R_ }, // BEh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // BFh
{TEXT("CPY"), ADDR_IMM }, // C0h
{TEXT("CMP"), ADDR_INDX }, // C1h
{TEXT("NOP"), ADDR_INVALID2 , 0 }, // C2h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // C3h
{TEXT("CPY"), ADDR_ZP }, // C4h
{TEXT("CMP"), ADDR_ZP }, // C5h
{TEXT("DEC"), ADDR_ZP }, // C6h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // C7h
{TEXT("INY"), 0 }, // C8h
{TEXT("CMP"), ADDR_IMM }, // C9h
{TEXT("DEX"), 0 }, // CAh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // CBh
{TEXT("CPY"), ADDR_ABS }, // CCh
{TEXT("CMP"), ADDR_ABS }, // CDh
{TEXT("DEC"), ADDR_ABS }, // CEh
{TEXT("NOP"), ADDR_INVALID1 }, // CFh
{TEXT("BNE"), ADDR_REL }, // D0h
{TEXT("CMP"), ADDR_INDY }, // D1h
{TEXT("CMP"), ADDR_IZPG }, // D2h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // D3h
{TEXT("NOP"), ADDR_INVALID2 , 0 }, // D4h
{TEXT("CMP"), ADDR_ZP_X }, // D5h
{TEXT("DEC"), ADDR_ZP_X }, // D6h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // D7h
{TEXT("CLD"), 0 }, // D8h
{TEXT("CMP"), ADDR_ABSY }, // D9h
{TEXT("PHX"), 0 }, // DAh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // DBh
{TEXT("NOP"), ADDR_INVALID3 , 0 }, // DCh
{TEXT("CMP"), ADDR_ABSX }, // DDh
{TEXT("DEC"), ADDR_ABSX }, // DEh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // DFh
{TEXT("CPX"), ADDR_IMM }, // E0h
{TEXT("SBC"), ADDR_INDX }, // E1h
{TEXT("NOP"), ADDR_INVALID2 , 0 }, // E2h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // E3h
{TEXT("CPX"), ADDR_ZP }, // E4h
{TEXT("SBC"), ADDR_ZP }, // E5h
{TEXT("INC"), ADDR_ZP }, // E6h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // E7h
{TEXT("INX"), 0 }, // E8h
{TEXT("SBC"), ADDR_IMM }, // E9h
{TEXT("NOP"), 0 , 0 }, // EAh
{TEXT("NOP"), ADDR_INVALID1 }, // EBh
{TEXT("CPX"), ADDR_ABS }, // ECh
{TEXT("SBC"), ADDR_ABS }, // EDh
{TEXT("INC"), ADDR_ABS }, // EEh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // EFh
{TEXT("BEQ"), ADDR_REL }, // F0h
{TEXT("SBC"), ADDR_INDY }, // F1h
{TEXT("SBC"), ADDR_IZPG }, // F2h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // F3h
{TEXT("NOP"), ADDR_INVALID2 , 0 }, // F4h
{TEXT("SBC"), ADDR_ZP_X }, // F5h
{TEXT("INC"), ADDR_ZP_X }, // F6h
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // F7h
{TEXT("SED"), 0 }, // F8h
{TEXT("SBC"), ADDR_ABSY }, // F9h
{TEXT("PLX"), 0 }, // FAh
{TEXT("NOP"), ADDR_INVALID1 , 0 }, // FBh
{TEXT("NOP"), ADDR_INVALID3 , 0 }, // FCh
{TEXT("SBC"), ADDR_ABSX }, // FDh
{TEXT("INC"), ADDR_ABSX }, // FEh
{TEXT("NOP"), ADDR_INVALID1 , 0 } // FFh
};
*/
#undef R_
#undef _W
#undef RW

View File

@ -516,7 +516,7 @@ void DrawBreakpoints (HDC dc, int line)
rect.bottom += g_nFontHeight;
int iBreakpoint;
for (iBreakpoint = 0; iBreakpoint < MAX_BREAKPOINTS; iBreakpoint++ )
for (iBreakpoint = 0; iBreakpoint < NUM_BREAKPOINTS; iBreakpoint++ )
{
Breakpoint_t *pBP = &g_aBreakpoints[iBreakpoint];
WORD nLength = pBP->nLength;

View File

@ -431,7 +431,7 @@ Update_t CmdHelpSpecific (int nArgs)
break;
// Breakpoints
case CMD_BREAKPOINT:
wsprintf( sText, " Maximum breakpoints are: %d", MAX_BREAKPOINTS );
wsprintf( sText, " Maximum breakpoints are: %d", NUM_BREAKPOINTS );
ConsoleBufferPush( sText );
break;
case CMD_BREAKPOINT_ADD_REG:

View File

@ -136,7 +136,7 @@
enum
{
MAX_BREAKPOINTS = 5
NUM_BREAKPOINTS = 5
};
/*