More clean-up, portability and another debugger fix (PR #847)

Fixed debugger main "data" window behaviour:
. When activating the main data display ("data" command) the cursor keys wouldn't work until the minidump ("md1") was also enabled. NB. The cursor keys should work in the main data window, independently of whether the minidump is active.
This commit is contained in:
ThorstenB 2020-10-25 18:27:59 +01:00 committed by GitHub
parent 43455eb4fe
commit 4543117f81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 29 additions and 58 deletions

View File

@ -1264,7 +1264,7 @@ Update_t CmdBreakpoint (int nArgs)
//=========================================================================== //===========================================================================
Update_t CmdBreakpointAddSmart (int nArgs) Update_t CmdBreakpointAddSmart (int nArgs)
{ {
int nAddress = g_aArgs[1].nValue; unsigned int nAddress = g_aArgs[1].nValue;
if (! nArgs) if (! nArgs)
{ {
@ -1368,7 +1368,7 @@ bool _CmdBreakpointAddReg( Breakpoint_t *pBP, BreakpointSource_t iSrc, Breakpoin
if (pBP) if (pBP)
{ {
_ASSERT(nLen <= _6502_MEM_LEN); _ASSERT(nLen <= _6502_MEM_LEN);
if (nLen > _6502_MEM_LEN) nLen = _6502_MEM_LEN; if (nLen > (int) _6502_MEM_LEN) nLen = (int) _6502_MEM_LEN;
pBP->eSource = iSrc; pBP->eSource = iSrc;
pBP->eOperator = iCmp; pBP->eOperator = iCmp;
@ -1944,7 +1944,7 @@ static Update_t CmdGo (int nArgs, const bool bFullSpeed)
{ {
nLen = g_aArgs[ iArg + 2 ].nValue; nLen = g_aArgs[ iArg + 2 ].nValue;
nEnd = g_nDebugSkipStart + nLen; nEnd = g_nDebugSkipStart + nLen;
if (nEnd > _6502_MEM_END) if (nEnd > (int) _6502_MEM_END)
nEnd = _6502_MEM_END + 1; nEnd = _6502_MEM_END + 1;
} }
else else
@ -3502,32 +3502,16 @@ Update_t CmdCursorRunUntil (int nArgs)
return CmdGo( nArgs, true ); return CmdGo( nArgs, true );
} }
//===========================================================================
WORD _ClampAddress( int nAddress )
{
if (nAddress < 0)
nAddress = 0;
if (nAddress > _6502_MEM_END)
nAddress = _6502_MEM_END;
return (WORD) nAddress;
}
// nDelta must be a power of 2 // nDelta must be a power of 2
//=========================================================================== //===========================================================================
void _CursorMoveDownAligned( int nDelta ) void _CursorMoveDownAligned( int nDelta )
{ {
if (g_iWindowThis == WINDOW_DATA) if (g_iWindowThis == WINDOW_DATA)
{ {
if (g_aMemDump[0].bActive) if (g_aMemDump[0].eDevice == DEV_MEMORY)
{ {
if (g_aMemDump[0].eDevice == DEV_MEMORY) g_aMemDump[0].nAddress += nDelta;
{ g_aMemDump[0].nAddress &= _6502_MEM_END;
g_aMemDump[0].nAddress += nDelta;
g_aMemDump[0].nAddress &= _6502_MEM_END;
}
} }
} }
else else
@ -3549,13 +3533,10 @@ void _CursorMoveUpAligned( int nDelta )
{ {
if (g_iWindowThis == WINDOW_DATA) if (g_iWindowThis == WINDOW_DATA)
{ {
if (g_aMemDump[0].bActive) if (g_aMemDump[0].eDevice == DEV_MEMORY)
{ {
if (g_aMemDump[0].eDevice == DEV_MEMORY) g_aMemDump[0].nAddress -= nDelta;
{ g_aMemDump[0].nAddress &= _6502_MEM_END;
g_aMemDump[0].nAddress -= nDelta;
g_aMemDump[0].nAddress &= _6502_MEM_END;
}
} }
} }
else else
@ -4533,7 +4514,7 @@ Update_t CmdMemoryLoad (int nArgs)
} }
else else
{ {
for (UINT i=(nAddressStart>>8); i!=((nAddressStart+nAddressLen)>>8); i++) for (WORD i=(nAddressStart>>8); i!=((nAddressStart+(WORD)nAddressLen)>>8); i++)
{ {
memdirty[i] = 0xff; memdirty[i] = 0xff;
} }
@ -7979,7 +7960,7 @@ Update_t ExecuteCommand (int nArgs)
// ####L -> Unassemble $address // ####L -> Unassemble $address
if (((pCommand[nLen-1] == 'L') || if (((pCommand[nLen-1] == 'L') ||
(pCommand[nLen-1] == 'l'))&& (pCommand[nLen-1] == 'l'))&&
(strcmp("cl", pCommand) != 0)) // workaround for ambiguous "cl": must be handled by "clear flag" command (_stricmp("cl", pCommand) != 0)) // workaround for ambiguous "cl": must be handled by "clear flag" command
{ {
pCommand[nLen-1] = 0; pCommand[nLen-1] = 0;
ArgsGetValue( pArg, & nAddress ); ArgsGetValue( pArg, & nAddress );

View File

@ -800,8 +800,8 @@ void DebuggerPrint ( int x, int y, const char *pText )
char c; char c;
const char *p = pText; const char *p = pText;
while (c = *p) while ((c = *p))
{ {
if (c == '\n') if (c == '\n')
{ {
@ -828,7 +828,7 @@ void DebuggerPrintColor( int x, int y, const conchar_t * pText )
if( !pText) if( !pText)
return; return;
while (g = (*pSrc)) while ((g = (*pSrc)))
{ {
if (g == '\n') if (g == '\n')
{ {
@ -2430,7 +2430,6 @@ static void DrawFlags ( int line, WORD nRegFlags )
if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA)))) if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA))))
return; return;
char sFlagNames[ _6502_NUM_FLAGS+1 ] = ""; // = "NVRBDIZC"; // copy from g_aFlagNames
char sText[4] = "?"; char sText[4] = "?";
RECT rect; RECT rect;
@ -2541,8 +2540,6 @@ void DrawMemory ( int line, int iMemDump )
if ((eDevice == DEV_SY6522) || (eDevice == DEV_AY8910)) if ((eDevice == DEV_SY6522) || (eDevice == DEV_AY8910))
MB_GetSnapshot_v1(&SS_MB, 4+(nAddr>>1)); // Slot4 or Slot5 MB_GetSnapshot_v1(&SS_MB, 4+(nAddr>>1)); // Slot4 or Slot5
int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg;
RECT rect; RECT rect;
rect.left = DISPLAY_MINIMEM_COLUMN; rect.left = DISPLAY_MINIMEM_COLUMN;
rect.top = (line * g_nFontHeight); rect.top = (line * g_nFontHeight);
@ -2685,7 +2682,7 @@ void DrawMemory ( int line, int iMemDump )
ColorizeSpecialChar( sText, nData, iView, iBackground ); ColorizeSpecialChar( sText, nData, iView, iBackground );
} }
} }
int nChars = PrintTextCursorX( sText, rect2 ); // PrintTextCursorX() PrintTextCursorX( sText, rect2 ); // PrintTextCursorX()
iAddress++; iAddress++;
} }
// Windows HACK: Bugfix: Rest of line is still background color // Windows HACK: Bugfix: Rest of line is still background color
@ -3619,7 +3616,7 @@ void DrawSubWindow_Data (Update_t bUpdate)
const int nMaxOpcodes = WINDOW_DATA_BYTES_PER_LINE; const int nMaxOpcodes = WINDOW_DATA_BYTES_PER_LINE;
char sAddress[ 5 ]; char sAddress[ 5 ];
assert( CONSOLE_WIDTH > WINDOW_DATA_BYTES_PER_LINE ); _ASSERT( CONSOLE_WIDTH > WINDOW_DATA_BYTES_PER_LINE );
char sOpcodes [ CONSOLE_WIDTH ] = ""; char sOpcodes [ CONSOLE_WIDTH ] = "";
char sImmediate[ 4 ]; // 'c' char sImmediate[ 4 ]; // 'c'
@ -3632,8 +3629,6 @@ void DrawSubWindow_Data (Update_t bUpdate)
MemoryDump_t* pMD = &g_aMemDump[ iMemDump ]; MemoryDump_t* pMD = &g_aMemDump[ iMemDump ];
USHORT nAddress = pMD->nAddress; USHORT nAddress = pMD->nAddress;
DEVICE_e eDevice = pMD->eDevice;
MemoryView_e iView = pMD->eView;
// if (!pMD->bActive) // if (!pMD->bActive)
// return; // return;
@ -3893,8 +3888,7 @@ void DrawSubWindow_Info ( Update_t bUpdate, int iWindow )
if (bUpdate & UPDATE_ZERO_PAGE) if (bUpdate & UPDATE_ZERO_PAGE)
DrawZeroPagePointers( yZeroPage ); DrawZeroPagePointers( yZeroPage );
bool bForceDisplaySoftSwitches = DEBUG_FORCE_DISPLAY || (bUpdate & UPDATE_SOFTSWITCHES); DrawSoftSwitches( ySoft );
DrawSoftSwitches( ySoft );
#if defined(SUPPORT_Z80_EMU) && defined(OUTPUT_Z80_REGS) #if defined(SUPPORT_Z80_EMU) && defined(OUTPUT_Z80_REGS)
DrawRegister( 19,"AF",2,*(WORD*)(membank+REG_AF)); DrawRegister( 19,"AF",2,*(WORD*)(membank+REG_AF));

View File

@ -176,7 +176,7 @@ static std::string driveTooltip;
// __ Prototypes __________________________________________________________________________________ // __ Prototypes __________________________________________________________________________________
void DrawCrosshairs (int x, int y); void DrawCrosshairs (int x, int y);
void UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY, int x=0, int y=0); void UpdateMouseInAppleViewport(int iOutOfBoundsX, int iOutOfBoundsY, int x=0, int y=0);
void ScreenWindowResize(const bool bCtrlKey); static void ScreenWindowResize(const bool bCtrlKey);
void FrameResizeWindow(int nNewScale); void FrameResizeWindow(int nNewScale);
@ -2484,7 +2484,7 @@ void SetNormalMode ()
} }
//=========================================================================== //===========================================================================
void SetUsingCursor (BOOL bNewValue) static void SetUsingCursor (BOOL bNewValue)
{ {
if (bNewValue == g_bUsingCursor) if (bNewValue == g_bUsingCursor)
return; return;

View File

@ -15,7 +15,6 @@
extern bool g_bFreshReset; extern bool g_bFreshReset;
extern std::string PathFilename[2]; extern std::string PathFilename[2];
extern bool g_bScrollLock_FullSpeed; extern bool g_bScrollLock_FullSpeed;
extern int g_nCharsetType;
// Prototypes // Prototypes

View File

@ -689,16 +689,16 @@ static BYTE __stdcall HD_IO_EMUL(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
g_nHD_UnitNum = d; g_nHD_UnitNum = d;
break; break;
case 0xF4: case 0xF4:
pHDD->hd_memblock = pHDD->hd_memblock & 0xFF00 | d; pHDD->hd_memblock = (pHDD->hd_memblock & 0xFF00) | d;
break; break;
case 0xF5: case 0xF5:
pHDD->hd_memblock = pHDD->hd_memblock & 0x00FF | (d << 8); pHDD->hd_memblock = (pHDD->hd_memblock & 0x00FF) | (d << 8);
break; break;
case 0xF6: case 0xF6:
pHDD->hd_diskblock = pHDD->hd_diskblock & 0xFF00 | d; pHDD->hd_diskblock = (pHDD->hd_diskblock & 0xFF00) | d;
break; break;
case 0xF7: case 0xF7:
pHDD->hd_diskblock = pHDD->hd_diskblock & 0x00FF | (d << 8); pHDD->hd_diskblock = (pHDD->hd_diskblock & 0x00FF) | (d << 8);
break; break;
default: default:
#if HD_LED #if HD_LED

View File

@ -118,7 +118,7 @@ BYTE KeybGetKeycode () // Used by IORead_C01x() and TapeRead() for Pravets8A
//=========================================================================== //===========================================================================
bool IsVirtualKeyAnAppleIIKey(WPARAM wparam); static bool IsVirtualKeyAnAppleIIKey(WPARAM wparam);
void KeybQueueKeypress (WPARAM key, Keystroke_e bASCII) void KeybQueueKeypress (WPARAM key, Keystroke_e bASCII)
{ {

View File

@ -54,8 +54,6 @@ extern LPBYTE memdirty;
#ifdef RAMWORKS #ifdef RAMWORKS
const UINT kMaxExMemoryBanks = 127; // 127 * aux mem(64K) + main mem(64K) = 8MB const UINT kMaxExMemoryBanks = 127; // 127 * aux mem(64K) + main mem(64K) = 8MB
extern UINT g_uMaxExPages; // user requested ram pages (from cmd line)
extern UINT g_uActiveBank;
#endif #endif
void RegisterIoHandler(UINT uSlot, iofunction IOReadC0, iofunction IOWriteC0, iofunction IOReadCx, iofunction IOWriteCx, LPVOID lpSlotParameter, BYTE* pExpansionRom); void RegisterIoHandler(UINT uSlot, iofunction IOReadC0, iofunction IOWriteC0, iofunction IOReadCx, iofunction IOWriteCx, LPVOID lpSlotParameter, BYTE* pExpansionRom);

View File

@ -1818,7 +1818,7 @@ static BYTE __stdcall MB_Write(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, UL
} }
} }
BYTE nMB = (nAddr>>8)&0xf - SLOT4; BYTE nMB = ((nAddr>>8)&0xf) - SLOT4;
BYTE nOffset = nAddr&0xff; BYTE nOffset = nAddr&0xff;
if(g_bPhasorEnable) if(g_bPhasorEnable)

View File

@ -44,7 +44,7 @@ Etc.
#include "SaveState_Structs_common.h" #include "SaveState_Structs_common.h"
#include "Common.h" #include "Common.h"
#include "AppleWin.h" // g_SynchronousEventMgr #include "Applewin.h" // g_SynchronousEventMgr
#include "CardManager.h" #include "CardManager.h"
#include "CPU.h" #include "CPU.h"
#include "Frame.h" // FrameSetCursorPosByMousePos() #include "Frame.h" // FrameSetCursorPosByMousePos()

View File

@ -71,7 +71,7 @@ static BYTE __stdcall IOWrite_SAM(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
// //
// SAM card WAV driver SAM WAV // SAM card WAV driver SAM WAV
// 0xFF 255 0x7f 127 _ FF 7F // 0xFF 255 0x7f 127 _ FF 7F
// 0x81 129 0x01 1 / \ // 0x81 129 0x01 1 / \ .
// 0x80 128 0x00 0 / \ /80 00 // 0x80 128 0x00 0 / \ /80 00
// 0x7f 127 0xFF -1 \_/ // 0x7f 127 0xFF -1 \_/
// 0x00 0 0x80 -128 00 80 // 0x00 0 0x80 -128 00 80

View File

@ -169,7 +169,6 @@ void Snapshot_UpdatePath(void)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static HANDLE m_hFile = INVALID_HANDLE_VALUE;
static CConfigNeedingRestart m_ConfigNew; static CConfigNeedingRestart m_ConfigNew;
static std::string GetSnapshotUnitApple2Name(void) static std::string GetSnapshotUnitApple2Name(void)

View File

@ -226,7 +226,7 @@ void SpkrInitialize ()
{ {
if(g_fh) if(g_fh)
{ {
fprintf(g_fh, "Spkr Config: soundtype = %d ",soundtype); fprintf(g_fh, "Spkr Config: soundtype = %d ", (int) soundtype);
switch(soundtype) switch(soundtype)
{ {
case SOUND_NONE: fprintf(g_fh, "(NONE)\n"); break; case SOUND_NONE: fprintf(g_fh, "(NONE)\n"); break;

View File

@ -41,7 +41,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "StdAfx.h" #include "StdAfx.h"
#include "AppleWin.h" #include "Applewin.h"
#include "SynchronousEventManager.h" #include "SynchronousEventManager.h"
void SynchronousEventManager::Insert(SyncEvent* pNewEvent) void SynchronousEventManager::Insert(SyncEvent* pNewEvent)