2.7.0.15 Fixed: Memory Dump was over-writing watches.

This commit is contained in:
mpohoreski
2011-02-20 23:29:00 +00:00
parent 817261d0e8
commit aa8691579b
2 changed files with 102 additions and 77 deletions

View File

@@ -2268,6 +2268,12 @@ void DrawMemory ( int line, int iMemDump )
return; return;
MemoryDump_t* pMD = &g_aMemDump[ iMemDump ]; MemoryDump_t* pMD = &g_aMemDump[ iMemDump ];
bool bActive = pMD->bActive;
#if DEBUG_FORCE_DISPLAY
bActive = true;
#endif
if( !bActive )
return;
USHORT nAddr = pMD->nAddress; USHORT nAddr = pMD->nAddress;
DEVICE_e eDevice = pMD->eDevice; DEVICE_e eDevice = pMD->eDevice;
@@ -2418,7 +2424,17 @@ void DrawMemory ( int line, int iMemDump )
{ {
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_IO_BYTE )); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_IO_BYTE ));
} }
sprintf(sText, "%02X ", nData );
if (nCols == 6)
{
if ((iCol & 1) == 1)
DebuggerSetColorBG( DebuggerGetColor( WATCH_ZERO_BG )); // BG_DATA_2
else
DebuggerSetColorBG( DebuggerGetColor( BG_DATA_2 ));
sprintf(sText, "%02X", nData );
} else
sprintf(sText, "%02X ", nData );
} }
else else
{ {
@@ -2531,6 +2547,20 @@ void DrawRegister ( int line, LPCTSTR name, const int nBytes, const WORD nValue,
PrintText( sValue, rect ); PrintText( sValue, rect );
} }
//===========================================================================
void DrawRegisters ( int line )
{
const char **sReg = g_aBreakpointSource;
DrawRegister( line++, sReg[ BP_SRC_REG_A ] , 1, regs.a , PARAM_REG_A );
DrawRegister( line++, sReg[ BP_SRC_REG_X ] , 1, regs.x , PARAM_REG_X );
DrawRegister( line++, sReg[ BP_SRC_REG_Y ] , 1, regs.y , PARAM_REG_Y );
DrawRegister( line++, sReg[ BP_SRC_REG_PC] , 2, regs.pc, PARAM_REG_PC );
DrawFlags ( line , regs.ps, NULL);
line += 2;
DrawRegister( line++, sReg[ BP_SRC_REG_S ] , 2, regs.sp, PARAM_REG_SP );
}
// 2.7.0.7 Cleaned up display of soft-switches to show address. // 2.7.0.7 Cleaned up display of soft-switches to show address.
//=========================================================================== //===========================================================================
void _DrawSoftSwitch( RECT & rect, int nAddress, bool bSet, char *sPrefix, char *sOn, char *sOff, const char *sSuffix = NULL ) void _DrawSoftSwitch( RECT & rect, int nAddress, bool bSet, char *sPrefix, char *sOn, char *sOff, const char *sSuffix = NULL )
@@ -2718,7 +2748,7 @@ void DrawStack ( int line)
return; return;
unsigned nAddress = regs.sp; unsigned nAddress = regs.sp;
#if DEBUG_FORCE_DISPLAY #if DEBUG_FORCE_DISPLAY // Stack
nAddress = 0x100; nAddress = 0x100;
#endif #endif
@@ -2780,7 +2810,7 @@ void DrawTargets ( int line)
char sAddress[8] = "-none-"; char sAddress[8] = "-none-";
char sData[8] = ""; char sData[8] = "";
#if DEBUG_FORCE_DISPLAY #if DEBUG_FORCE_DISPLAY // Targets
if (aTarget[iAddress] == NO_6502_TARGET) if (aTarget[iAddress] == NO_6502_TARGET)
aTarget[iAddress] = 0; aTarget[iAddress] = 0;
#endif #endif
@@ -2816,7 +2846,7 @@ void DrawTargets ( int line)
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); // Target Bytes DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); // Target Bytes
PrintText( sData, rect ); PrintText( sData, rect );
} }
} }
//=========================================================================== //===========================================================================
@@ -2843,7 +2873,7 @@ void DrawWatches (int line)
int iWatch; int iWatch;
for (iWatch = 0; iWatch < MAX_WATCHES; iWatch++ ) for (iWatch = 0; iWatch < MAX_WATCHES; iWatch++ )
{ {
#if DEBUG_FORCE_DISPLAY #if DEBUG_FORCE_DISPLAY // Watch
if (true) if (true)
#else #else
if (g_aWatches[iWatch].bEnabled) if (g_aWatches[iWatch].bEnabled)
@@ -2851,7 +2881,7 @@ void DrawWatches (int line)
{ {
RECT rect2 = rect; RECT rect2 = rect;
// DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); DebuggerSetColorBG( DebuggerGetColor( WATCH_ZERO_BG )); // BG_INFO
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) ); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) );
PrintTextCursorX( "W", rect2 ); PrintTextCursorX( "W", rect2 );
@@ -2909,18 +2939,19 @@ void DrawWatches (int line)
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE ));
for( int iByte = 0; iByte < 8; iByte++ ) for( int iByte = 0; iByte < 8; iByte++ )
{ {
BYTE nValue8 = (unsigned)*(LPBYTE)(mem + nTarget16 + iByte ); if ((iByte & 3) == 0) {
sprintf(sText,"%02X", nValue8 );
if ((iByte & 1) == 1)
DebuggerSetColorBG( DebuggerGetColor( BG_DATA_2 ));
else
DebuggerSetColorBG( DebuggerGetColor( WATCH_ZERO_BG )); // BG_DATA_2
PrintTextCursorX( sText, rect2 );
if ((iByte & 3) == 3) {
DebuggerSetColorBG( DebuggerGetColor( WATCH_ZERO_BG )); // BG_INFO DebuggerSetColorBG( DebuggerGetColor( WATCH_ZERO_BG )); // BG_INFO
PrintTextCursorX( " ", rect2 ); PrintTextCursorX( " ", rect2 );
} }
if ((iByte & 1) == 1)
DebuggerSetColorBG( DebuggerGetColor( WATCH_ZERO_BG )); // BG_DATA_2
else
DebuggerSetColorBG( DebuggerGetColor( BG_DATA_2 ));
BYTE nValue8 = (unsigned)*(LPBYTE)(mem + nTarget16 + iByte );
sprintf(sText,"%02X", nValue8 );
PrintTextCursorX( sText, rect2 );
} }
} }
rect.top += g_nFontHeight; rect.top += g_nFontHeight;
@@ -2955,7 +2986,7 @@ void DrawZeroPagePointers ( int line )
Breakpoint_t *pZP = &g_aZeroPagePointers[iZP]; Breakpoint_t *pZP = &g_aZeroPagePointers[iZP];
bool bEnabled = pZP->bEnabled; bool bEnabled = pZP->bEnabled;
#if DEBUG_FORCE_DISPLAY #if DEBUG_FORCE_DISPLAY // Zero-Page
bEnabled = true; bEnabled = true;
#endif #endif
if (bEnabled) if (bEnabled)
@@ -3233,78 +3264,72 @@ void DrawSubWindow_Data (Update_t bUpdate)
} }
} }
// DrawRegisters();
//=========================================================================== //===========================================================================
void DrawSubWindow_Info( int iWindow ) void DrawSubWindow_Info ( Update_t bUpdate, int iWindow )
{ {
if (g_iWindowThis == WINDOW_CONSOLE) if (g_iWindowThis == WINDOW_CONSOLE)
return; return;
const char **sReg = g_aBreakpointSource; // Left Side
int yRegs = 0; // 12
int yStack = yRegs + MAX_DISPLAY_REGS_LINES + 0; // 0
int yTarget = yStack + MAX_DISPLAY_STACK_LINES - 1; // 9
int yZeroPage = 16; // yTarget
int ySoft = yZeroPage + (2 * MAX_DISPLAY_ZEROPAGE_LINES) + 1;
int yRegs = 0; // 12 if ((bUpdate & UPDATE_REGS) || (bUpdate & UPDATE_FLAGS))
int yStack = yRegs + MAX_DISPLAY_REGS_LINES + 0; // 0 DrawRegisters( yRegs );
int yTarget = yStack + MAX_DISPLAY_STACK_LINES - 1; // 9
int yZeroPage = 16; // yTarget
int ySoft = yZeroPage + (2 * MAX_DISPLAY_ZEROPAGE_LINES) + 1;
DrawRegister( yRegs++, sReg[ BP_SRC_REG_A ] , 1, regs.a , PARAM_REG_A ); if (bUpdate & UPDATE_STACK)
DrawRegister( yRegs++, sReg[ BP_SRC_REG_X ] , 1, regs.x , PARAM_REG_X ); DrawStack( yStack );
DrawRegister( yRegs++, sReg[ BP_SRC_REG_Y ] , 1, regs.y , PARAM_REG_Y );
DrawRegister( yRegs++, sReg[ BP_SRC_REG_PC] , 2, regs.pc, PARAM_REG_PC );
DrawFlags ( yRegs , regs.ps, NULL);
yRegs += 2;
DrawRegister( yRegs++, sReg[ BP_SRC_REG_S ] , 2, regs.sp, PARAM_REG_SP );
DrawStack( yStack ); // 2.7.0.2 Fixed: Debug build of debugger force display all CPU info window wasn't calling DrawTargets()
bool bForceDisplayTargetPtr = DEBUG_FORCE_DISPLAY || (g_bConfigInfoTargetPointer);
if (bForceDisplayTargetPtr || (bUpdate & UPDATE_TARGETS))
DrawTargets( yTarget );
if (bUpdate & UPDATE_ZERO_PAGE)
DrawZeroPagePointers( yZeroPage );
// 2.7.0.2 Fixed: Debug build of debugger force display all CPU info window wasn't calling DrawTargets() bool bForceDisplaySoftSwitches = DEBUG_FORCE_DISPLAY || (bUpdate & UPDATE_SOFTSWITCHES);
bool bForceDisplayTargetPtr = DEBUG_FORCE_DISPLAY ? DEBUG_FORCE_DISPLAY : g_bConfigInfoTargetPointer; DrawSoftSwitches( ySoft );
if (bForceDisplayTargetPtr)
DrawTargets( yTarget );
DrawZeroPagePointers( yZeroPage );
// bool bForceDisplaySoftSwitches = DEBUG_FORCE_DISPLAY ? DEBUG_FORCE_DISPLAY : true; #if defined(SUPPORT_Z80_EMU) && defined(OUTPUT_Z80_REGS)
DrawSoftSwitches( ySoft ); DrawRegister( 19,"AF",2,*(WORD*)(membank+REG_AF));
DrawRegister( 20,"BC",2,*(WORD*)(membank+REG_BC));
#if defined(SUPPORT_Z80_EMU) && defined(OUTPUT_Z80_REGS) DrawRegister( 21,"DE",2,*(WORD*)(membank+REG_DE));
DrawRegister( 19,"AF",2,*(WORD*)(membank+REG_AF)); DrawRegister( 22,"HL",2,*(WORD*)(membank+REG_HL));
DrawRegister( 20,"BC",2,*(WORD*)(membank+REG_BC)); DrawRegister( 23,"IX",2,*(WORD*)(membank+REG_IX));
DrawRegister( 21,"DE",2,*(WORD*)(membank+REG_DE)); #endif
DrawRegister( 22,"HL",2,*(WORD*)(membank+REG_HL));
DrawRegister( 23,"IX",2,*(WORD*)(membank+REG_IX));
#endif
// Right Side // Right Side
int yBreakpoints = 0; int yBreakpoints = 0;
int yWatches = yBreakpoints + MAX_BREAKPOINTS; // MAX_DISPLAY_BREAKPOINTS_LINES; // 7 int yWatches = yBreakpoints + MAX_BREAKPOINTS; // MAX_DISPLAY_BREAKPOINTS_LINES; // 7
int yMemory = yWatches + MAX_WATCHES ; // MAX_DISPLAY_WATCHES_LINES ; // 14 int yMemory = yWatches + (MAX_WATCHES*2); // MAX_DISPLAY_WATCHES_LINES ; // 14 // 2.7.0.15 Fixed: Memory Dump was over-writing watches
// if ((MAX_DISPLAY_BREAKPOINTS_LINES + MAX_DISPLAY_WATCHES_LINES) < 12) // if ((MAX_DISPLAY_BREAKPOINTS_LINES + MAX_DISPLAY_WATCHES_LINES) < 12)
// yWatches++; // yWatches++;
bool bForceDisplayBreakpoints = DEBUG_FORCE_DISPLAY ? DEBUG_FORCE_DISPLAY : g_nBreakpoints > 0; // 2.7.0.11 Fixed: Breakpoints and Watches no longer disappear. bool bForceDisplayBreakpoints = DEBUG_FORCE_DISPLAY || (g_nBreakpoints > 0); // 2.7.0.11 Fixed: Breakpoints and Watches no longer disappear.
if ( bForceDisplayBreakpoints ) if ( bForceDisplayBreakpoints || (bUpdate & UPDATE_BREAKPOINTS))
DrawBreakpoints( yBreakpoints ); DrawBreakpoints( yBreakpoints );
bool bForceDisplayWatches = DEBUG_FORCE_DISPLAY ? DEBUG_FORCE_DISPLAY : g_nWatches > 0; // 2.7.0.11 Fixed: Breakpoints and Watches no longer disappear. bool bForceDisplayWatches = DEBUG_FORCE_DISPLAY || (g_nWatches > 0); // 2.7.0.11 Fixed: Breakpoints and Watches no longer disappear.
if ( bForceDisplayWatches ) if ( bForceDisplayWatches || (bUpdate & UPDATE_WATCH))
DrawWatches( yWatches ); DrawWatches( yWatches );
g_nDisplayMemoryLines = MAX_DISPLAY_MEMORY_LINES_1; g_nDisplayMemoryLines = MAX_DISPLAY_MEMORY_LINES_1;
bool bForceDisplayMemory1 = DEBUG_FORCE_DISPLAY ? DEBUG_FORCE_DISPLAY : g_aMemDump[0].bActive; bool bForceDisplayMemory1 = DEBUG_FORCE_DISPLAY || (g_aMemDump[0].bActive);
if ( bForceDisplayMemory1 ) if (bForceDisplayMemory1 || (bUpdate & UPDATE_MEM_DUMP))
DrawMemory( yMemory, 0 ); // g_aMemDump[0].nAddress, g_aMemDump[0].eDevice); DrawMemory( yMemory, 0 ); // g_aMemDump[0].nAddress, g_aMemDump[0].eDevice);
yMemory += (g_nDisplayMemoryLines + 1); yMemory += (g_nDisplayMemoryLines + 1);
g_nDisplayMemoryLines = MAX_DISPLAY_MEMORY_LINES_2; g_nDisplayMemoryLines = MAX_DISPLAY_MEMORY_LINES_2;
bool bForceDisplayMemory2 = DEBUG_FORCE_DISPLAY ? DEBUG_FORCE_DISPLAY : g_aMemDump[1].bActive; bool bForceDisplayMemory2 = DEBUG_FORCE_DISPLAY || (g_aMemDump[1].bActive);
if ( bForceDisplayMemory2 ) if (bForceDisplayMemory2 || (bUpdate & UPDATE_MEM_DUMP))
DrawMemory( yMemory, 1 ); // g_aMemDump[1].nAddress, g_aMemDump[1].eDevice); DrawMemory( yMemory, 1 ); // g_aMemDump[1].nAddress, g_aMemDump[1].eDevice);
} }
//=========================================================================== //===========================================================================
@@ -3413,7 +3438,7 @@ void DrawWindow_Code( Update_t bUpdate )
// DrawWindowTop( g_iWindowThis ); // DrawWindowTop( g_iWindowThis );
DrawWindowBottom( bUpdate, g_iWindowThis ); DrawWindowBottom( bUpdate, g_iWindowThis );
DrawSubWindow_Info( g_iWindowThis ); DrawSubWindow_Info( bUpdate, g_iWindowThis );
} }
// Full Screen console // Full Screen console
@@ -3431,34 +3456,34 @@ void DrawWindow_Console( Update_t bUpdate )
void DrawWindow_Data( Update_t bUpdate ) void DrawWindow_Data( Update_t bUpdate )
{ {
DrawSubWindow_Data( g_iWindowThis ); DrawSubWindow_Data( g_iWindowThis );
DrawSubWindow_Info( g_iWindowThis ); DrawSubWindow_Info( bUpdate, g_iWindowThis );
} }
//=========================================================================== //===========================================================================
void DrawWindow_IO( Update_t bUpdate ) void DrawWindow_IO( Update_t bUpdate )
{ {
DrawSubWindow_IO( g_iWindowThis ); DrawSubWindow_IO( g_iWindowThis );
DrawSubWindow_Info( g_iWindowThis ); DrawSubWindow_Info( bUpdate, g_iWindowThis );
} }
//=========================================================================== //===========================================================================
void DrawWindow_Source( Update_t bUpdate ) void DrawWindow_Source( Update_t bUpdate )
{ {
DrawSubWindow_Source( g_iWindowThis ); DrawSubWindow_Source( g_iWindowThis );
DrawSubWindow_Info( g_iWindowThis ); DrawSubWindow_Info( bUpdate, g_iWindowThis );
} }
//=========================================================================== //===========================================================================
void DrawWindow_Symbols( Update_t bUpdate ) void DrawWindow_Symbols( Update_t bUpdate )
{ {
DrawSubWindow_Symbols( g_iWindowThis ); DrawSubWindow_Symbols( g_iWindowThis );
DrawSubWindow_Info( g_iWindowThis ); DrawSubWindow_Info( bUpdate, g_iWindowThis );
} }
void DrawWindow_ZeroPage( Update_t bUpdate ) void DrawWindow_ZeroPage( Update_t bUpdate )
{ {
DrawSubWindow_ZeroPage( g_iWindowThis ); DrawSubWindow_ZeroPage( g_iWindowThis );
DrawSubWindow_Info( g_iWindowThis ); DrawSubWindow_Info( bUpdate, g_iWindowThis );
} }
//=========================================================================== //===========================================================================
@@ -3531,7 +3556,7 @@ void UpdateDisplay (Update_t bUpdate)
SetTextAlign( g_hFrameDC, TA_TOP | TA_LEFT); SetTextAlign( g_hFrameDC, TA_TOP | TA_LEFT);
if ((bUpdate & UPDATE_BREAKPOINTS) if ((bUpdate & UPDATE_BREAKPOINTS)
|| (bUpdate & UPDATE_DISASM) // || (bUpdate & UPDATE_DISASM)
|| (bUpdate & UPDATE_FLAGS) || (bUpdate & UPDATE_FLAGS)
|| (bUpdate & UPDATE_MEM_DUMP) || (bUpdate & UPDATE_MEM_DUMP)
|| (bUpdate & UPDATE_REGS) || (bUpdate & UPDATE_REGS)

View File

@@ -244,7 +244,7 @@
UPDATE_TARGETS = (1 << 10), UPDATE_TARGETS = (1 << 10),
UPDATE_WATCH = (1 << 11), UPDATE_WATCH = (1 << 11),
UPDATE_ZERO_PAGE = (1 << 12), UPDATE_ZERO_PAGE = (1 << 12),
UPDATE_SOFTSWITCHES = (1 << 13),
UPDATE_ALL = -1 UPDATE_ALL = -1
}; };