mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-09-28 00:54:40 +00:00
fixups to build & run (mainly reinstating v1.20 Debug.cpp & Debug.h)
This commit is contained in:
parent
2daeebcb01
commit
c5cfc49da7
@ -1,6 +1,7 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AppleWin", "Applewin.vcproj", "{C4C93CFD-5B6C-41C5-BF90-17119186120F}"
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Applewin", "Applewin.vcxproj", "{C4C93CFD-5B6C-41C5-BF90-17119186120F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -42,6 +42,8 @@
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Users\Miyeong\Projects\AppleWin-Sheldon\source;C:\Users\Miyeong\Projects\AppleWin-Sheldon\source\CPU;C:\Users\Miyeong\Projects\AppleWin-Sheldon\source\Debugger;C:\Users\Miyeong\Projects\AppleWin-Sheldon\zip_lib;C:\Users\Miyeong\Projects\AppleWin-Sheldon\zlib;$(IncludePath)</IncludePath>
|
||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Users\Miyeong\Projects\AppleWin-Sheldon\source;C:\Users\Miyeong\Projects\AppleWin-Sheldon\source\CPU;C:\Users\Miyeong\Projects\AppleWin-Sheldon\source\Debugger;C:\Users\Miyeong\Projects\AppleWin-Sheldon\zip_lib;C:\Users\Miyeong\Projects\AppleWin-Sheldon\zlib;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
@ -137,6 +139,7 @@
|
||||
<ClCompile Include="source\AY8910.cpp" />
|
||||
<ClCompile Include="source\CPU.cpp" />
|
||||
<ClCompile Include="source\cs.cpp" />
|
||||
<ClCompile Include="source\Debugger\Debugger_Commands.cpp" />
|
||||
<ClCompile Include="source\Disk.cpp" />
|
||||
<ClCompile Include="source\DiskImage.cpp" />
|
||||
<ClCompile Include="source\DiskImageHelper.cpp" />
|
||||
|
@ -230,6 +230,9 @@
|
||||
<ClCompile Include="source\CPU.cpp">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\Debugger\Debugger_Commands.cpp">
|
||||
<Filter>Source\Debugger</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="source\6821.h">
|
||||
|
@ -36,7 +36,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,7,0,7);
|
||||
const int DEBUGGER_VERSION = MAKE_VERSION(2,7,0,21);
|
||||
|
||||
|
||||
// Public _________________________________________________________________________________________
|
||||
@ -46,15 +46,23 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
// Bookmarks __________________________________________________________________
|
||||
// vector<int> g_aBookmarks;
|
||||
int g_nBookmarks;
|
||||
int g_nBookmarks = 0;
|
||||
Bookmark_t g_aBookmarks[ MAX_BOOKMARKS ];
|
||||
|
||||
// Breakpoints ________________________________________________________________
|
||||
|
||||
// Full-Speed debugging
|
||||
int g_nDebugOnBreakInvalid = 0;
|
||||
int g_iDebugOnOpcode = 0;
|
||||
bool g_bDebugDelayBreakCheck = false;
|
||||
|
||||
// MODE_RUNNING // Normal Speed Breakpoints: Shift-F7 exit debugger, keep breakpoints active, enter run state at NORMAL speed
|
||||
bool g_bDebugNormalSpeedBreakpoints = 0;
|
||||
|
||||
// MODE_STEPPING // Full Speed Breakpoints
|
||||
|
||||
// Any Speed Breakpoints
|
||||
int g_nDebugBreakOnInvalid = 0; // Bit Flags of Invalid Opcode to break on: // iOpcodeType = AM_IMPLIED (BRK), AM_1, AM_2, AM_3
|
||||
int g_iDebugBreakOnOpcode = 0;
|
||||
|
||||
bool g_bDebugBreakDelayCheck = false; // If exiting the debugger, allow at least one instruction to execute so we don't trigger on the same invalid opcode
|
||||
int g_bDebugBreakpointHit = 0; // See: BreakpointHit_t
|
||||
|
||||
int g_nBreakpoints = 0;
|
||||
Breakpoint_t g_aBreakpoints[ MAX_BREAKPOINTS ];
|
||||
@ -111,12 +119,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
vector<Command_t> g_vSortedCommands;
|
||||
|
||||
// static const char g_aFlagNames[_6502_NUM_FLAGS+1] = TEXT("CZIDBRVN");// Reversed since arrays are from left-to-right
|
||||
#ifdef WS_VIDEO
|
||||
Command_t g_aCommands[NUM_COMMANDS];
|
||||
Command_t g_aParameters[NUM_COMMANDS];
|
||||
const int NUM_COMMANDS_WITH_ALIASES = sizeof(g_aCommands) / sizeof (Command_t); // Determined at compile-time ;-)
|
||||
void VerifyDebuggerCommandTable () {}
|
||||
#endif
|
||||
|
||||
|
||||
// Cursor (Console Input) _____________________________________________________
|
||||
|
||||
// char g_aInputCursor[] = "\|/-";
|
||||
@ -322,8 +326,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
void _BWZ_ListAll ( const Breakpoint_t * aBreakWatchZero, const int nMax );
|
||||
|
||||
// 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 bIsTempBreakpoint );
|
||||
int _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, BreakpointOperator_t iCmp, bool bIsTempBreakpoint=false );
|
||||
void _BWZ_Clear( Breakpoint_t * aBreakWatchZero, int iSlot );
|
||||
@ -465,7 +467,7 @@ void _Bookmark_Reset()
|
||||
//===========================================================================
|
||||
int _Bookmark_Size()
|
||||
{
|
||||
int g_nBookmarks = 0;
|
||||
g_nBookmarks = 0;
|
||||
|
||||
int iBookmark;
|
||||
for (iBookmark = 0; iBookmark < MAX_BOOKMARKS; iBookmark++ )
|
||||
@ -711,7 +713,7 @@ Update_t CmdBenchmarkStop (int nArgs)
|
||||
{
|
||||
g_bBenchmarking = false;
|
||||
DebugEnd();
|
||||
g_nAppMode = MODE_RUNNING;
|
||||
|
||||
FrameRefreshStatus(DRAW_TITLE);
|
||||
VideoRedrawScreen();
|
||||
DWORD currtime = GetTickCount();
|
||||
@ -811,13 +813,19 @@ _Help:
|
||||
//===========================================================================
|
||||
Update_t CmdBreakInvalid (int nArgs) // Breakpoint IFF Full-speed!
|
||||
{
|
||||
if ((nArgs > 2) || (nArgs == 0))
|
||||
if (nArgs > 2) // || (nArgs == 0))
|
||||
goto _Help;
|
||||
|
||||
int iType = 0; // default to BRK
|
||||
int iType = AM_IMPLIED; // default to BRK
|
||||
int nActive = 0;
|
||||
|
||||
// if (nArgs == 2)
|
||||
if (nArgs == 0)
|
||||
{
|
||||
nArgs = 1;
|
||||
g_aArgs[ 1 ].nValue = AM_IMPLIED;
|
||||
g_aArgs[ 1 ].sArg[0] = 0;
|
||||
}
|
||||
|
||||
iType = g_aArgs[ 1 ].nValue;
|
||||
|
||||
// Cases:
|
||||
@ -851,10 +859,10 @@ Update_t CmdBreakInvalid (int nArgs) // Breakpoint IFF Full-speed!
|
||||
{
|
||||
if (! nFound) // bValidParam) // case 1a or 1c
|
||||
{
|
||||
if ((iType < 0) || (iType > AM_3))
|
||||
if ((iType < AM_IMPLIED) || (iType > AM_3))
|
||||
goto _Help;
|
||||
|
||||
if (IsDebugBreakOnInvalid( iType ))
|
||||
if ( IsDebugBreakOnInvalid( iType ) )
|
||||
iParam = PARAM_ON;
|
||||
else
|
||||
iParam = PARAM_OFF;
|
||||
@ -914,31 +922,31 @@ Update_t CmdBreakOpcode (int nArgs) // Breakpoint IFF Full-speed!
|
||||
if (nArgs == 1)
|
||||
{
|
||||
int iOpcode = g_aArgs[ 1] .nValue;
|
||||
g_iDebugOnOpcode = iOpcode & 0xFF;
|
||||
g_iDebugBreakOnOpcode = iOpcode & 0xFF;
|
||||
|
||||
_tcscpy( sAction, TEXT("Setting") );
|
||||
|
||||
if (iOpcode >= NUM_OPCODES)
|
||||
{
|
||||
wsprintf( sText, TEXT("Warning: clamping opcode: %02X"), g_iDebugOnOpcode );
|
||||
wsprintf( sText, TEXT("Warning: clamping opcode: %02X"), g_iDebugBreakOnOpcode );
|
||||
ConsoleBufferPush( sText );
|
||||
return ConsoleUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
if (g_iDebugOnOpcode == 0)
|
||||
if (g_iDebugBreakOnOpcode == 0)
|
||||
// Show what the current break opcode is
|
||||
wsprintf( sText, TEXT("%s full speed Break on Opcode: None")
|
||||
, sAction
|
||||
, g_iDebugOnOpcode
|
||||
, g_aOpcodes65C02[ g_iDebugOnOpcode ].sMnemonic
|
||||
, g_iDebugBreakOnOpcode
|
||||
, g_aOpcodes65C02[ g_iDebugBreakOnOpcode ].sMnemonic
|
||||
);
|
||||
else
|
||||
// Show what the current break opcode is
|
||||
wsprintf( sText, TEXT("%s full speed Break on Opcode: %02X %s")
|
||||
, sAction
|
||||
, g_iDebugOnOpcode
|
||||
, g_aOpcodes65C02[ g_iDebugOnOpcode ].sMnemonic
|
||||
, g_iDebugBreakOnOpcode
|
||||
, g_aOpcodes65C02[ g_iDebugBreakOnOpcode ].sMnemonic
|
||||
);
|
||||
|
||||
ConsoleBufferPush( sText );
|
||||
@ -1035,7 +1043,7 @@ bool _CheckBreakpointValue( Breakpoint_t *pBP, int nVal )
|
||||
|
||||
|
||||
//===========================================================================
|
||||
bool CheckBreakpointsIO ()
|
||||
int CheckBreakpointsIO ()
|
||||
{
|
||||
const int NUM_TARGETS = 2;
|
||||
|
||||
@ -1045,7 +1053,7 @@ bool CheckBreakpointsIO ()
|
||||
NO_6502_TARGET
|
||||
};
|
||||
int nBytes;
|
||||
bool bStatus = false;
|
||||
bool bBreakpointHit = 0;
|
||||
|
||||
int iTarget;
|
||||
int nAddress;
|
||||
@ -1068,7 +1076,7 @@ bool CheckBreakpointsIO ()
|
||||
{
|
||||
if (_CheckBreakpointValue( pBP, nAddress ))
|
||||
{
|
||||
return true;
|
||||
return BP_HIT_MEM;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1076,14 +1084,14 @@ bool CheckBreakpointsIO ()
|
||||
}
|
||||
}
|
||||
}
|
||||
return bStatus;
|
||||
return bBreakpointHit;
|
||||
}
|
||||
|
||||
// Returns true if a register breakpoint is triggered
|
||||
//===========================================================================
|
||||
bool CheckBreakpointsReg ()
|
||||
int CheckBreakpointsReg ()
|
||||
{
|
||||
bool bStatus = false;
|
||||
int bBreakpointHit = 0;
|
||||
|
||||
for (int iBreakpoint = 0; iBreakpoint < MAX_BREAKPOINTS; iBreakpoint++)
|
||||
{
|
||||
@ -1095,29 +1103,30 @@ bool CheckBreakpointsReg ()
|
||||
switch (pBP->eSource)
|
||||
{
|
||||
case BP_SRC_REG_PC:
|
||||
bStatus = _CheckBreakpointValue( pBP, regs.pc );
|
||||
bBreakpointHit = _CheckBreakpointValue( pBP, regs.pc );
|
||||
break;
|
||||
case BP_SRC_REG_A:
|
||||
bStatus = _CheckBreakpointValue( pBP, regs.a );
|
||||
bBreakpointHit = _CheckBreakpointValue( pBP, regs.a );
|
||||
break;
|
||||
case BP_SRC_REG_X:
|
||||
bStatus = _CheckBreakpointValue( pBP, regs.x );
|
||||
bBreakpointHit = _CheckBreakpointValue( pBP, regs.x );
|
||||
break;
|
||||
case BP_SRC_REG_Y:
|
||||
bStatus = _CheckBreakpointValue( pBP, regs.y );
|
||||
bBreakpointHit = _CheckBreakpointValue( pBP, regs.y );
|
||||
break;
|
||||
case BP_SRC_REG_P:
|
||||
bStatus = _CheckBreakpointValue( pBP, regs.ps );
|
||||
bBreakpointHit = _CheckBreakpointValue( pBP, regs.ps );
|
||||
break;
|
||||
case BP_SRC_REG_S:
|
||||
bStatus = _CheckBreakpointValue( pBP, regs.sp );
|
||||
bBreakpointHit = _CheckBreakpointValue( pBP, regs.sp );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (bStatus)
|
||||
if (bBreakpointHit)
|
||||
{
|
||||
bBreakpointHit = BP_HIT_REG;
|
||||
if (pBP->bTemp)
|
||||
_BWZ_Clear(pBP, iBreakpoint);
|
||||
|
||||
@ -1125,7 +1134,7 @@ bool CheckBreakpointsReg ()
|
||||
}
|
||||
}
|
||||
|
||||
return bStatus;
|
||||
return bBreakpointHit;
|
||||
}
|
||||
|
||||
void ClearTempBreakpoints ()
|
||||
@ -1238,7 +1247,7 @@ Update_t CmdBreakpointAddReg (int nArgs)
|
||||
}
|
||||
}
|
||||
|
||||
if ((! bHaveSrc) && (! bHaveCmp))
|
||||
if ((! bHaveSrc) && (! bHaveCmp)) // Inverted/Convoluted logic: didn't find BOTH this pass, so we must have already found them.
|
||||
{
|
||||
int dArgs = _CmdBreakpointAddCommonArg( iArg, nArgs, iSrc, iCmp );
|
||||
if (!dArgs)
|
||||
@ -1393,7 +1402,8 @@ Update_t CmdBreakpointAddPC (int nArgs)
|
||||
//===========================================================================
|
||||
Update_t CmdBreakpointAddIO (int nArgs)
|
||||
{
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
return CmdBreakpointAddMem( nArgs );
|
||||
// return UPDATE_BREAKPOINTS | UPDATE_CONSOLE_DISPLAY;
|
||||
}
|
||||
|
||||
|
||||
@ -1590,7 +1600,7 @@ void _BWZ_List( const Breakpoint_t * aBreakWatchZero, const int iBWZ ) //, bool
|
||||
void _BWZ_ListAll( const Breakpoint_t * aBreakWatchZero, const int nMax )
|
||||
{
|
||||
int iBWZ = 0;
|
||||
while (iBWZ < MAX_BOOKMARKS)
|
||||
while (iBWZ < nMax) //
|
||||
{
|
||||
if (aBreakWatchZero[ iBWZ ].bSet)
|
||||
{
|
||||
@ -1944,7 +1954,7 @@ Update_t CmdTraceFile (int nArgs)
|
||||
|
||||
|
||||
char sFilePath[ MAX_PATH ];
|
||||
strcpy(sFilePath, g_sCurrentDir); // g_sProgramDir
|
||||
strcpy(sFilePath, g_sCurrentDir); // TODO: g_sDebugDir
|
||||
strcat(sFilePath, sFileName );
|
||||
|
||||
g_hTraceFile = fopen( sFilePath, "wt" );
|
||||
@ -2308,7 +2318,7 @@ void ConfigSave_PrepareHeader ( const Parameters_e eCategory, const Commands_e e
|
||||
Update_t CmdConfigSave (int nArgs)
|
||||
{
|
||||
TCHAR sFilename[ MAX_PATH ];
|
||||
_tcscpy( sFilename, g_sProgramDir ); // g_sCurrentDir
|
||||
_tcscpy( sFilename, g_sProgramDir ); // TODO: g_sDebugDir
|
||||
_tcscat( sFilename, g_sFileNameConfig );
|
||||
|
||||
/*
|
||||
@ -3787,7 +3797,7 @@ static Update_t _CmdMemoryDump (int nArgs, int iWhich, int iView )
|
||||
g_aMemDump[iWhich].bActive = true;
|
||||
g_aMemDump[iWhich].eView = (MemoryView_e) iView;
|
||||
|
||||
return UPDATE_ALL; // TODO: This really needed? Don't think we do any actual ouput
|
||||
return UPDATE_MEM_DUMP; // TODO: This really needed? Don't think we do any actual ouput
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@ -3981,6 +3991,22 @@ Update_t CmdMemoryFill (int nArgs)
|
||||
static TCHAR g_sMemoryLoadSaveFileName[ MAX_PATH ] = TEXT("");
|
||||
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigGetDebugDir (int nArgs)
|
||||
{
|
||||
TCHAR sPath[ MAX_PATH + 8 ] = "Path: ";
|
||||
_tcscat( sPath, g_sCurrentDir ); // TODO: debugger dir has no ` CONSOLE_COLOR_ESCAPE_CHAR ?!?!
|
||||
ConsoleBufferPush( sPath );
|
||||
|
||||
return ConsoleUpdate();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigSetDebugDir (int nArgs)
|
||||
{
|
||||
return ConsoleUpdate();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdMemoryLoad (int nArgs)
|
||||
{
|
||||
@ -4024,7 +4050,7 @@ Update_t CmdMemoryLoad (int nArgs)
|
||||
return Help_Arg_1( CMD_MEMORY_SAVE );
|
||||
|
||||
TCHAR sLoadSaveFilePath[ MAX_PATH ];
|
||||
_tcscpy( sLoadSaveFilePath, g_sCurrentDir ); // g_sProgramDir
|
||||
_tcscpy( sLoadSaveFilePath, g_sCurrentDir ); // TODO: g_sDebugDir
|
||||
|
||||
WORD nAddressStart;
|
||||
WORD nAddress2 = 0;
|
||||
@ -4088,9 +4114,9 @@ Update_t CmdMemoryLoad (int nArgs)
|
||||
else
|
||||
{
|
||||
ConsoleBufferPush( TEXT( "ERROR: Bad filename" ) );
|
||||
TCHAR sPath[ MAX_PATH + 8 ] = "Path: ";
|
||||
_tcscat( sPath, g_sCurrentDir );
|
||||
ConsoleBufferPush( sPath );
|
||||
|
||||
CmdConfigGetDebugDir( 0 );
|
||||
|
||||
TCHAR sFile[ MAX_PATH + 8 ] = "File: ";
|
||||
_tcscat( sFile, g_sMemoryLoadSaveFileName );
|
||||
ConsoleBufferPush( sFile );
|
||||
@ -5671,7 +5697,8 @@ Update_t CmdWatchList (int nArgs)
|
||||
}
|
||||
else
|
||||
{
|
||||
_BWZ_List( g_aWatches, MAX_WATCHES );
|
||||
// _BWZ_List( g_aWatches, MAX_WATCHES );
|
||||
_BWZ_ListAll( g_aWatches, MAX_WATCHES );
|
||||
}
|
||||
return ConsoleUpdate();
|
||||
}
|
||||
@ -7155,13 +7182,13 @@ void DebugContinueStepping ()
|
||||
{
|
||||
if ((regs.pc >= g_nDebugSkipStart) && (regs.pc < (g_nDebugSkipStart + g_nDebugSkipLen)))
|
||||
{
|
||||
// Enter turbo debugger g_nAppMode -- UI not updated, etc.
|
||||
// Enter turbo debugger mode -- UI not updated, etc.
|
||||
g_nDebugSteps = -1;
|
||||
g_nAppMode = MODE_STEPPING;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Enter normal debugger g_nAppMode -- UI updated every instruction, etc.
|
||||
// Enter normal debugger mode -- UI updated every instruction, etc.
|
||||
g_nDebugSteps = 1;
|
||||
g_nAppMode = MODE_STEPPING;
|
||||
}
|
||||
@ -7175,12 +7202,9 @@ void DebugContinueStepping ()
|
||||
|
||||
InternalSingleStep();
|
||||
|
||||
bool bBreak = CheckBreakpointsIO();
|
||||
_IsDebugBreakpointHit(); // Updates g_bDebugBreakpointHit
|
||||
|
||||
if (CheckBreakpointsReg())
|
||||
bBreak = true;
|
||||
|
||||
if ((regs.pc == g_nDebugStepUntil) || bBreak)
|
||||
if ((regs.pc == g_nDebugStepUntil) || g_bDebugBreakpointHit)
|
||||
g_nDebugSteps = 0;
|
||||
else if (g_nDebugSteps > 0)
|
||||
g_nDebugSteps--;
|
||||
@ -7190,7 +7214,7 @@ void DebugContinueStepping ()
|
||||
{
|
||||
if (!((++nStepsTaken) & 0xFFFF))
|
||||
{
|
||||
if (nStepsTaken == 0x10000)
|
||||
if (nStepsTaken == 0x10000) // HACK_MAGIC_NUM
|
||||
VideoRedrawScreen();
|
||||
else
|
||||
VideoRefreshScreen();
|
||||
@ -7202,32 +7226,11 @@ void DebugContinueStepping ()
|
||||
FrameRefreshStatus(DRAW_TITLE);
|
||||
// BUG: PageUp, Trace - doesn't center cursor
|
||||
|
||||
// if ((g_nDebugStepStart < regs.pc) && (g_nDebugStepStart+3 >= regs.pc))
|
||||
// Still within current disasm "window"?
|
||||
/*
|
||||
if ((regs.pc >= g_nDisasmTopAddress) && (regs.pc <= g_nDisasmBotAddress))
|
||||
{
|
||||
int eMode = g_aOpcodes[*(mem+g_nDisasmCurAddress)].addrmode;
|
||||
int nBytes = g_aOpmodes[ eMode ]._nBytes;
|
||||
g_nDisasmCurAddress += nBytes;
|
||||
// g_nDisasmTopAddress += nBytes;
|
||||
// g_nDisasmBotAddress += nBytes;
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
g_nDisasmCurAddress = regs.pc;
|
||||
}
|
||||
|
||||
DisasmCalcTopBotAddress();
|
||||
|
||||
// g_nDisasmCurAddress += g_aOpmodes[g_aOpcodes[*(mem+g_nDisasmCurAddress)].addrmode]._nBytes;
|
||||
// DisasmCalcTopBotAddress();
|
||||
|
||||
Update_t bUpdate = UPDATE_ALL;
|
||||
// if (nStepsTaken >= 0x10000) // HACK_MAGIC_NUM
|
||||
// bUpdate = UPDATE_ALL;
|
||||
|
||||
UpdateDisplay( bUpdate ); // nStepsTaken >= 0x10000);
|
||||
nStepsTaken = 0;
|
||||
}
|
||||
@ -7284,6 +7287,8 @@ void DebugEnd ()
|
||||
}
|
||||
|
||||
g_vMemorySearchResults.erase( g_vMemorySearchResults.begin(), g_vMemorySearchResults.end() );
|
||||
|
||||
g_nAppMode = MODE_RUNNING;
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,16 +30,33 @@ using namespace std;
|
||||
// extern vector<int> g_aBookmarks;
|
||||
|
||||
// Breakpoints
|
||||
enum BreakpointHit_t
|
||||
{
|
||||
BP_HIT_NONE = 0
|
||||
,BP_HIT_INVALID = (1 << 0)
|
||||
,BP_HIT_OPCODE = (1 << 1)
|
||||
,BP_HIT_REG = (1 << 2)
|
||||
,BP_HIT_MEM = (1 << 3)
|
||||
};
|
||||
|
||||
extern int g_nBreakpoints;
|
||||
extern Breakpoint_t g_aBreakpoints[ MAX_BREAKPOINTS ];
|
||||
|
||||
extern const char *g_aBreakpointSource [ NUM_BREAKPOINT_SOURCES ];
|
||||
extern const TCHAR *g_aBreakpointSymbols[ NUM_BREAKPOINT_OPERATORS ];
|
||||
|
||||
// Full-Speed debugging
|
||||
extern int g_nDebugOnBreakInvalid;
|
||||
extern int g_iDebugOnOpcode ;
|
||||
extern bool g_bDebugDelayBreakCheck;
|
||||
// MODE_RUNNING // Normal Speed Breakpoints
|
||||
extern bool g_bDebugNormalSpeedBreakpoints;
|
||||
|
||||
// MODE_STEPPING // Full Speed Breakpoints
|
||||
|
||||
// Any Speed Breakpoints
|
||||
extern int g_nDebugBreakOnInvalid ;
|
||||
extern int g_iDebugBreakOnOpcode ;
|
||||
|
||||
// Breakpoint Status
|
||||
extern bool g_bDebugBreakDelayCheck;
|
||||
extern int g_bDebugBreakpointHit ;
|
||||
|
||||
// Commands
|
||||
void VerifyDebuggerCommandTable();
|
||||
@ -133,24 +150,70 @@ using namespace std;
|
||||
bool Bookmark_Find( const WORD nAddress );
|
||||
|
||||
// Breakpoints
|
||||
int CheckBreakpointsIO ();
|
||||
int CheckBreakpointsReg ();
|
||||
|
||||
bool GetBreakpointInfo ( WORD nOffset, bool & bBreakpointActive_, bool & bBreakpointEnable_ );
|
||||
|
||||
// 0 = Brk, 1 = Invalid1, .. 3 = Invalid 3
|
||||
inline bool IsDebugBreakOnInvalid( int iOpcodeType )
|
||||
inline int _IsDebugBreakpointHit()
|
||||
{
|
||||
bool bActive = (g_nDebugOnBreakInvalid >> iOpcodeType) & 1;
|
||||
return bActive;
|
||||
g_bDebugBreakpointHit |= CheckBreakpointsIO() || CheckBreakpointsReg();
|
||||
return g_bDebugBreakpointHit;
|
||||
}
|
||||
|
||||
inline int _IsDebugBreakOnOpcode( int iOpcode )
|
||||
{
|
||||
if (g_iDebugBreakOnOpcode == iOpcode)
|
||||
g_bDebugBreakpointHit |= BP_HIT_OPCODE;
|
||||
return g_bDebugBreakpointHit;
|
||||
}
|
||||
|
||||
// iOpcodeType = AM_IMPLIED (BRK), AM_1, AM_2, AM_3
|
||||
inline int IsDebugBreakOnInvalid( int iOpcodeType )
|
||||
{
|
||||
g_bDebugBreakpointHit |= ((g_nDebugBreakOnInvalid >> iOpcodeType) & 1) ? BP_HIT_INVALID : 0;
|
||||
return g_bDebugBreakpointHit;
|
||||
}
|
||||
|
||||
// iOpcodeType = AM_IMPLIED (BRK), AM_1, AM_2, AM_3
|
||||
inline void SetDebugBreakOnInvalid( int iOpcodeType, int nValue )
|
||||
{
|
||||
if (iOpcodeType <= AM_3)
|
||||
{
|
||||
g_nDebugOnBreakInvalid &= ~ ( 1 << iOpcodeType);
|
||||
g_nDebugOnBreakInvalid |= ((nValue & 1) << iOpcodeType);
|
||||
g_nDebugBreakOnInvalid &= ~ ( 1 << iOpcodeType);
|
||||
g_nDebugBreakOnInvalid |= ((nValue & 1) << iOpcodeType);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CPU checks the Debugger breakpoints
|
||||
// a) at opcode fetch
|
||||
// b) after opcode execution
|
||||
//
|
||||
inline int IsDebugBreakOpcode( int iOpcode )
|
||||
{
|
||||
if (g_bDebugBreakDelayCheck)
|
||||
{
|
||||
g_bDebugBreakDelayCheck = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! iOpcode )
|
||||
IsDebugBreakOnInvalid( AM_IMPLIED );
|
||||
|
||||
if (g_iDebugBreakOnOpcode ) // User wants to enter debugger on specific opcode?
|
||||
_IsDebugBreakOnOpcode(iOpcode);
|
||||
|
||||
return g_bDebugBreakpointHit;
|
||||
}
|
||||
//
|
||||
inline int IsDebugBreakpointHit()
|
||||
{
|
||||
if ( !g_bDebugNormalSpeedBreakpoints )
|
||||
return false;
|
||||
return _IsDebugBreakpointHit();
|
||||
}
|
||||
|
||||
// Source Level Debugging
|
||||
int FindSourceLine( WORD nAddress );
|
||||
const char* FormatAddress( WORD nAddress, int nBytes );
|
||||
|
@ -1530,7 +1530,7 @@ void ProcessButtonClick (int button)
|
||||
else
|
||||
if (g_nAppMode == MODE_DEBUG)
|
||||
{
|
||||
g_bDebugDelayBreakCheck = true;
|
||||
//g_bDebugDelayBreakCheck = true;
|
||||
ProcessButtonClick(BTN_RUN);
|
||||
|
||||
// TODO: DD Full-Screen Palette
|
||||
|
Loading…
Reference in New Issue
Block a user