Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
2eec57ad1b
13 changed files with 683 additions and 573 deletions
|
@ -389,6 +389,14 @@
|
|||
RelativePath=".\source\Debugger\Debugger_Types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Debugger\Debugger_Win32.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Debugger\Debugger_Win32.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\source\Debugger\Util_MemoryTextFile.cpp"
|
||||
>
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
<ClInclude Include="source\Debugger\Debugger_Range.h" />
|
||||
<ClInclude Include="source\Debugger\Debugger_Symbols.h" />
|
||||
<ClInclude Include="source\Debugger\Debugger_Types.h" />
|
||||
<ClInclude Include="source\Debugger\Debugger_Win32.h" />
|
||||
<ClInclude Include="source\Debugger\Util_MemoryTextFile.h" />
|
||||
<ClInclude Include="source\Debugger\Util_Text.h" />
|
||||
<ClInclude Include="source\Disk.h" />
|
||||
|
@ -156,6 +157,7 @@
|
|||
<ClCompile Include="source\Core.cpp" />
|
||||
<ClCompile Include="source\CPU.cpp" />
|
||||
<ClCompile Include="source\Debugger\Debugger_Disassembler.cpp" />
|
||||
<ClCompile Include="source\Debugger\Debugger_Win32.cpp" />
|
||||
<ClCompile Include="source\Disk2CardManager.cpp" />
|
||||
<ClCompile Include="source\FrameBase.cpp" />
|
||||
<ClCompile Include="source\RGBMonitor.cpp" />
|
||||
|
|
|
@ -226,6 +226,9 @@
|
|||
<ClCompile Include="source\Debugger\Debugger_Disassembler.cpp">
|
||||
<Filter>Source Files\Debugger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\Debugger\Debugger_Win32.cpp">
|
||||
<Filter>Source Files\Debugger</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="source\CommonVICE\6510core.h">
|
||||
|
@ -534,6 +537,9 @@
|
|||
<ClInclude Include="source\Debugger\Debugger_Disassembler.h">
|
||||
<Filter>Source Files\Debugger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\Debugger\Debugger_Win32.h">
|
||||
<Filter>Source Files\Debugger</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="resource\Applewin.bmp">
|
||||
|
|
|
@ -9,7 +9,7 @@ https://github.com/AppleWin/AppleWin/issues/new
|
|||
Tom Charlesworth
|
||||
|
||||
|
||||
1.30.0.0 - 17 Apr 2021
|
||||
1.30.0.0 - 18 Apr 2021
|
||||
----------------------
|
||||
Note: This version only works under Windows XP and later.
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
|
||||
#include "Debug.h"
|
||||
#include "DebugDefs.h"
|
||||
#include "Debugger_Win32.h"
|
||||
|
||||
#include "../Windows/AppleWin.h"
|
||||
#include "../Core.h"
|
||||
|
@ -44,7 +45,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
#include "../Memory.h"
|
||||
#include "../NTSC.h"
|
||||
#include "../SoundCore.h" // SoundCore_SetFade()
|
||||
#include "../Windows/Win32Frame.h"
|
||||
|
||||
// #define DEBUG_COMMAND_HELP 1
|
||||
// #define DEBUG_ASM_HASH 1
|
||||
|
@ -340,9 +340,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
// Drawing
|
||||
static void _CmdColorGet ( const int iScheme, const int iColor );
|
||||
|
||||
// Font
|
||||
static void _UpdateWindowFontHeights (int nFontHeight);
|
||||
|
||||
// Source Level Debugging
|
||||
static bool BufferAssemblyListing ( const std::string & pFileName );
|
||||
static bool ParseAssemblyListing ( bool bBytesToMemory, bool bAddSymbols );
|
||||
|
@ -663,7 +660,7 @@ Update_t CmdBookmarkLoad (int nArgs)
|
|||
// strcat( sMiniFileName, ".aws" ); // HACK: MAGIC STRING
|
||||
|
||||
// _tcscpy(sFileName, g_sCurrentDir); //
|
||||
// _tcscat(sFileName, sMiniFileName);
|
||||
// strcat(sFileName, sMiniFileName);
|
||||
}
|
||||
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
|
@ -2622,327 +2619,6 @@ Update_t CmdConfigDisasm( int nArgs )
|
|||
return UPDATE_CONSOLE_DISPLAY | UPDATE_DISASM;
|
||||
}
|
||||
|
||||
// Config - Font __________________________________________________________________________________
|
||||
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigFontLoad( int nArgs )
|
||||
{
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigFontSave( int nArgs )
|
||||
{
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigFontMode( int nArgs )
|
||||
{
|
||||
if (nArgs != 2)
|
||||
return Help_Arg_1( CMD_CONFIG_FONT );
|
||||
|
||||
int nMode = g_aArgs[ 2 ].nValue;
|
||||
|
||||
if ((nMode < 0) || (nMode >= NUM_FONT_SPACING))
|
||||
return Help_Arg_1( CMD_CONFIG_FONT );
|
||||
|
||||
g_iFontSpacing = nMode;
|
||||
_UpdateWindowFontHeights( g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontHeight );
|
||||
|
||||
return UPDATE_CONSOLE_DISPLAY | UPDATE_DISASM;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigFont (int nArgs)
|
||||
{
|
||||
int iArg;
|
||||
|
||||
if (! nArgs)
|
||||
return CmdConfigGetFont( nArgs );
|
||||
else
|
||||
if (nArgs <= 2) // nArgs
|
||||
{
|
||||
iArg = 1;
|
||||
|
||||
// FONT * is undocumented, like VERSION *
|
||||
if ((! _tcscmp( g_aArgs[ iArg ].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName )) ||
|
||||
(! _tcscmp( g_aArgs[ iArg ].sArg, g_aParameters[ PARAM_MEM_SEARCH_WILD ].m_sName )) )
|
||||
{
|
||||
TCHAR sText[ CONSOLE_WIDTH ];
|
||||
ConsoleBufferPushFormat( sText, "Lines: %d Font Px: %d Line Px: %d"
|
||||
, g_nDisasmDisplayLines
|
||||
, g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontHeight
|
||||
, g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight );
|
||||
ConsoleBufferToDisplay();
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
}
|
||||
|
||||
int iFound;
|
||||
int nFound;
|
||||
|
||||
nFound = FindParam( g_aArgs[iArg].sArg, MATCH_EXACT, iFound, _PARAM_GENERAL_BEGIN, _PARAM_GENERAL_END );
|
||||
if (nFound)
|
||||
{
|
||||
switch( iFound )
|
||||
{
|
||||
case PARAM_LOAD:
|
||||
return CmdConfigFontLoad( nArgs );
|
||||
break;
|
||||
case PARAM_SAVE:
|
||||
return CmdConfigFontSave( nArgs );
|
||||
break;
|
||||
// TODO: FONT SIZE #
|
||||
// TODO: AA {ON|OFF}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nFound = FindParam( g_aArgs[iArg].sArg, MATCH_EXACT, iFound, _PARAM_FONT_BEGIN, _PARAM_FONT_END );
|
||||
if (nFound)
|
||||
{
|
||||
if (iFound == PARAM_FONT_MODE)
|
||||
return CmdConfigFontMode( nArgs );
|
||||
}
|
||||
|
||||
return CmdConfigSetFont( nArgs );
|
||||
}
|
||||
|
||||
return Help_Arg_1( CMD_CONFIG_FONT );
|
||||
}
|
||||
|
||||
|
||||
// Only for FONT_DISASM_DEFAULT !
|
||||
//===========================================================================
|
||||
void _UpdateWindowFontHeights( int nFontHeight )
|
||||
{
|
||||
if (nFontHeight)
|
||||
{
|
||||
int nConsoleTopY = GetConsoleTopPixels( g_nConsoleDisplayLines );
|
||||
|
||||
int nHeight = 0;
|
||||
|
||||
if (g_iFontSpacing == FONT_SPACING_CLASSIC)
|
||||
{
|
||||
nHeight = nFontHeight + 1;
|
||||
g_nDisasmDisplayLines = nConsoleTopY / nHeight;
|
||||
}
|
||||
else
|
||||
if (g_iFontSpacing == FONT_SPACING_CLEAN)
|
||||
{
|
||||
nHeight = nFontHeight;
|
||||
g_nDisasmDisplayLines = nConsoleTopY / nHeight;
|
||||
}
|
||||
else
|
||||
if (g_iFontSpacing == FONT_SPACING_COMPRESSED)
|
||||
{
|
||||
nHeight = nFontHeight - 1;
|
||||
g_nDisasmDisplayLines = (nConsoleTopY + nHeight) / nHeight; // Ceil()
|
||||
}
|
||||
|
||||
g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight = nHeight;
|
||||
|
||||
// int nHeightOptimal = (nHeight0 + nHeight1) / 2;
|
||||
// int nLinesOptimal = nConsoleTopY / nHeightOptimal;
|
||||
// g_nDisasmDisplayLines = nLinesOptimal;
|
||||
|
||||
WindowUpdateSizes();
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
bool _CmdConfigFont ( int iFont, LPCSTR pFontName, int iPitchFamily, int nFontHeight )
|
||||
{
|
||||
bool bStatus = false;
|
||||
HFONT hFont = (HFONT) 0;
|
||||
FontConfig_t *pFont = NULL;
|
||||
|
||||
if (iFont < NUM_FONTS)
|
||||
pFont = & g_aFontConfig[ iFont ];
|
||||
else
|
||||
return bStatus;
|
||||
|
||||
if (pFontName)
|
||||
{
|
||||
// int nFontHeight = g_nFontHeight - 1;
|
||||
|
||||
int bAntiAlias = (nFontHeight < 14) ? DEFAULT_QUALITY : ANTIALIASED_QUALITY;
|
||||
|
||||
// Try allow new font
|
||||
hFont = CreateFont(
|
||||
nFontHeight
|
||||
, 0 // Width
|
||||
, 0 // Escapement
|
||||
, 0 // Orientatin
|
||||
, FW_MEDIUM // Weight
|
||||
, 0 // Italic
|
||||
, 0 // Underline
|
||||
, 0 // Strike Out
|
||||
, DEFAULT_CHARSET // OEM_CHARSET
|
||||
, OUT_DEFAULT_PRECIS
|
||||
, CLIP_DEFAULT_PRECIS
|
||||
, bAntiAlias // ANTIALIASED_QUALITY // DEFAULT_QUALITY
|
||||
, iPitchFamily // HACK: MAGIC #: 4
|
||||
, pFontName );
|
||||
|
||||
if (hFont)
|
||||
{
|
||||
if (iFont == FONT_DISASM_DEFAULT)
|
||||
_UpdateWindowFontHeights( nFontHeight );
|
||||
|
||||
_tcsncpy( pFont->_sFontName, pFontName, MAX_FONT_NAME-1 );
|
||||
pFont->_sFontName[ MAX_FONT_NAME-1 ] = 0;
|
||||
|
||||
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
|
||||
|
||||
HDC hDC = win32Frame.FrameGetDC();
|
||||
|
||||
TEXTMETRIC tm;
|
||||
GetTextMetrics(hDC, &tm);
|
||||
|
||||
SIZE size;
|
||||
TCHAR sText[] = "W";
|
||||
int nLen = 1;
|
||||
|
||||
int nFontWidthAvg;
|
||||
int nFontWidthMax;
|
||||
|
||||
// if (! (tm.tmPitchAndFamily & TMPF_FIXED_PITCH)) // Windows has this bitflag reversed!
|
||||
// { // Proportional font?
|
||||
// bool bStop = true;
|
||||
// }
|
||||
|
||||
// GetCharWidth32() doesn't work with TrueType Fonts
|
||||
if (GetTextExtentPoint32( hDC, sText, nLen, &size ))
|
||||
{
|
||||
nFontWidthAvg = tm.tmAveCharWidth;
|
||||
nFontWidthMax = size.cx;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Font Name Avg Max "W"
|
||||
// Arial 7 8 11
|
||||
// Courier 5 32 11
|
||||
// Courier New 7 14
|
||||
nFontWidthAvg = tm.tmAveCharWidth;
|
||||
nFontWidthMax = tm.tmMaxCharWidth;
|
||||
}
|
||||
|
||||
if (! nFontWidthAvg)
|
||||
{
|
||||
nFontWidthAvg = 7;
|
||||
nFontWidthMax = 7;
|
||||
}
|
||||
|
||||
win32Frame.FrameReleaseDC();
|
||||
|
||||
// DeleteObject( g_hFontDisasm );
|
||||
// g_hFontDisasm = hFont;
|
||||
pFont->_hFont = hFont;
|
||||
|
||||
pFont->_nFontWidthAvg = nFontWidthAvg;
|
||||
pFont->_nFontWidthMax = nFontWidthMax;
|
||||
pFont->_nFontHeight = nFontHeight;
|
||||
|
||||
bStatus = true;
|
||||
}
|
||||
}
|
||||
return bStatus;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigSetFont (int nArgs)
|
||||
{
|
||||
#if OLD_FONT
|
||||
HFONT hFont = (HFONT) 0;
|
||||
TCHAR *pFontName = NULL;
|
||||
int nHeight = g_nFontHeight;
|
||||
int iFontTarget = FONT_DISASM_DEFAULT;
|
||||
int iFontPitch = FIXED_PITCH | FF_MODERN;
|
||||
// int iFontMode =
|
||||
bool bHaveTarget = false;
|
||||
bool bHaveFont = false;
|
||||
|
||||
if (! nArgs)
|
||||
{ // reset to defaut font
|
||||
pFontName = g_sFontNameDefault;
|
||||
}
|
||||
else
|
||||
if (nArgs <= 3)
|
||||
{
|
||||
int iArg = 1;
|
||||
pFontName = g_aArgs[1].sArg;
|
||||
|
||||
// [DISASM|INFO|CONSOLE] "FontName" [#]
|
||||
// "FontName" can be either arg 1 or 2
|
||||
|
||||
int iFound;
|
||||
int nFound = FindParam( g_aArgs[iArg].sArg, MATCH_EXACT, iFound, _PARAM_WINDOW_BEGIN, _PARAM_WINDOW_END );
|
||||
if (nFound)
|
||||
{
|
||||
switch( iFound )
|
||||
{
|
||||
case PARAM_DISASM : iFontTarget = FONT_DISASM_DEFAULT; iFontPitch = FIXED_PITCH | FF_MODERN ; bHaveTarget = true; break;
|
||||
case PARAM_INFO : iFontTarget = FONT_INFO ; iFontPitch = FIXED_PITCH | FF_MODERN ; bHaveTarget = true; break;
|
||||
case PARAM_CONSOLE: iFontTarget = FONT_CONSOLE ; iFontPitch = DEFAULT_PITCH | FF_DECORATIVE; bHaveTarget = true; break;
|
||||
default:
|
||||
if (g_aArgs[2].bType != TOKEN_QUOTE_DOUBLE)
|
||||
return Help_Arg_1( CMD_CONFIG_FONT );
|
||||
break;
|
||||
}
|
||||
if (bHaveTarget)
|
||||
{
|
||||
pFontName = g_aArgs[2].sArg;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (nArgs == 2)
|
||||
{
|
||||
nHeight = atoi(g_aArgs[2].sArg );
|
||||
if ((nHeight < 6) || (nHeight > 36))
|
||||
nHeight = g_nFontHeight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Help_Arg_1( CMD_CONFIG_FONT );
|
||||
}
|
||||
|
||||
if (! _CmdConfigFont( iFontTarget, pFontName, iFontPitch, nHeight ))
|
||||
{
|
||||
}
|
||||
#endif
|
||||
return UPDATE_ALL;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigGetFont (int nArgs)
|
||||
{
|
||||
if (! nArgs)
|
||||
{
|
||||
for (int iFont = 0; iFont < NUM_FONTS; iFont++ )
|
||||
{
|
||||
TCHAR sText[ CONSOLE_WIDTH ] = TEXT("");
|
||||
ConsoleBufferPushFormat( sText, " Font: %-20s A:%2d M:%2d",
|
||||
// g_sFontNameCustom, g_nFontWidthAvg, g_nFontWidthMax );
|
||||
g_aFontConfig[ iFont ]._sFontName,
|
||||
g_aFontConfig[ iFont ]._nFontWidthAvg,
|
||||
g_aFontConfig[ iFont ]._nFontWidthMax );
|
||||
}
|
||||
return ConsoleUpdate();
|
||||
}
|
||||
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Cursor _________________________________________________________________________________________
|
||||
|
||||
//===========================================================================
|
||||
|
@ -4002,7 +3678,6 @@ Update_t CmdConfigSetDebugDir (int nArgs)
|
|||
if ( nArgs == 0 )
|
||||
return CmdConfigGetDebugDir(0);
|
||||
|
||||
#if _WIN32
|
||||
// http://msdn.microsoft.com/en-us/library/aa365530(VS.85).aspx
|
||||
|
||||
// TODO: Support paths prefixed with "\\?\" (for long/unicode pathnames)
|
||||
|
@ -4034,9 +3709,6 @@ Update_t CmdConfigSetDebugDir (int nArgs)
|
|||
|
||||
if ( SetCurrentImageDir( sPath ) )
|
||||
nArgs = 0; // intentional fall into
|
||||
#else
|
||||
#error "Need chdir() implemented"
|
||||
#endif
|
||||
|
||||
return CmdConfigGetDebugDir(0); // Show the new PWD
|
||||
}
|
||||
|
@ -4117,7 +3789,7 @@ Update_t CmdMemoryLoad (int nArgs)
|
|||
{
|
||||
_tcscpy( g_sMemoryLoadSaveFileName, g_aArgs[ 1 ].sArg );
|
||||
}
|
||||
_tcscat( sLoadSaveFilePath, g_sMemoryLoadSaveFileName );
|
||||
strcat( sLoadSaveFilePath, g_sMemoryLoadSaveFileName );
|
||||
|
||||
FILE *hFile = fopen( sLoadSaveFilePath, "rb" );
|
||||
if (hFile)
|
||||
|
@ -4496,7 +4168,7 @@ Update_t CmdMemorySave (int nArgs)
|
|||
{
|
||||
_tcscpy( g_sMemoryLoadSaveFileName, g_aArgs[ 1 ].sArg );
|
||||
}
|
||||
_tcscat( sLoadSaveFilePath, g_sMemoryLoadSaveFileName );
|
||||
strcat( sLoadSaveFilePath, g_sMemoryLoadSaveFileName );
|
||||
|
||||
// if (nArgs == 2)
|
||||
{
|
||||
|
@ -4844,20 +4516,6 @@ size_t Util_GetTextScreen ( char* &pText_ )
|
|||
return g_nTextScreen;
|
||||
}
|
||||
|
||||
void Util_CopyTextToClipboard ( const size_t nSize, const char *pText )
|
||||
{
|
||||
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, nSize + 1 );
|
||||
memcpy( GlobalLock(hMem), pText, nSize + 1 );
|
||||
GlobalUnlock( hMem );
|
||||
|
||||
OpenClipboard(0);
|
||||
EmptyClipboard();
|
||||
SetClipboardData( CF_TEXT, hMem );
|
||||
CloseClipboard();
|
||||
|
||||
// GlobalFree() ??
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdNTSC (int nArgs)
|
||||
{
|
||||
|
@ -6020,19 +5678,19 @@ Update_t CmdOutputCalc (int nArgs)
|
|||
nAddress, nBit, nAddress, c );
|
||||
|
||||
if (bParen)
|
||||
_tcscat( sText, TEXT("(") );
|
||||
strcat( sText, TEXT("(") );
|
||||
|
||||
if (bHi & bLo)
|
||||
_tcscat( sText, TEXT("High Ctrl") );
|
||||
strcat( sText, TEXT("High Ctrl") );
|
||||
else
|
||||
if (bHi)
|
||||
_tcscat( sText, TEXT("High") );
|
||||
strcat( sText, TEXT("High") );
|
||||
else
|
||||
if (bLo)
|
||||
_tcscat( sText, TEXT("Ctrl") );
|
||||
strcat( sText, TEXT("Ctrl") );
|
||||
|
||||
if (bParen)
|
||||
_tcscat( sText, TEXT(")") );
|
||||
strcat( sText, TEXT(")") );
|
||||
|
||||
ConsoleBufferPush( sText );
|
||||
|
||||
|
@ -6322,7 +5980,7 @@ Update_t CmdOutputRun (int nArgs)
|
|||
// if (g_aArgs[1].bType & TYPE_QUOTED_2)
|
||||
|
||||
sMiniFileName = pFileName.substr(0, MIN(pFileName.size(), CONSOLE_WIDTH));
|
||||
// _tcscat( sMiniFileName, ".aws" ); // HACK: MAGIC STRING
|
||||
// strcat( sMiniFileName, ".aws" ); // HACK: MAGIC STRING
|
||||
|
||||
if (pFileName[0] == '\\' || pFileName[1] == ':') // NB. Any prefix quote has already been stripped
|
||||
{
|
||||
|
@ -8625,12 +8283,8 @@ void DebugStopStepping(void)
|
|||
void DebugDestroy ()
|
||||
{
|
||||
DebugEnd();
|
||||
FontsDestroy();
|
||||
|
||||
for (int iFont = 0; iFont < NUM_FONTS; iFont++ )
|
||||
{
|
||||
DeleteObject( g_aFontConfig[ iFont ]._hFont );
|
||||
g_aFontConfig[ iFont ]._hFont = NULL;
|
||||
}
|
||||
// DeleteObject(g_hFontDisasm );
|
||||
// DeleteObject(g_hFontDebugger);
|
||||
// DeleteObject(g_hFontWebDings);
|
||||
|
@ -8748,24 +8402,7 @@ void DebugInitialize ()
|
|||
int nArgs = _Arg_1( g_sFontNameDefault );
|
||||
#endif
|
||||
|
||||
for (int iFont = 0; iFont < NUM_FONTS; iFont++ )
|
||||
{
|
||||
g_aFontConfig[ iFont ]._hFont = NULL;
|
||||
#if USE_APPLE_FONT
|
||||
g_aFontConfig[ iFont ]._nFontHeight = CONSOLE_FONT_HEIGHT;
|
||||
g_aFontConfig[ iFont ]._nFontWidthAvg = CONSOLE_FONT_WIDTH;
|
||||
g_aFontConfig[ iFont ]._nFontWidthMax = CONSOLE_FONT_WIDTH;
|
||||
g_aFontConfig[ iFont ]._nLineHeight = CONSOLE_FONT_HEIGHT;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if OLD_FONT
|
||||
_CmdConfigFont( FONT_INFO , g_sFontNameInfo , FIXED_PITCH | FF_MODERN , g_nFontHeight ); // DEFAULT_CHARSET
|
||||
_CmdConfigFont( FONT_CONSOLE , g_sFontNameConsole, FIXED_PITCH | FF_MODERN , g_nFontHeight ); // DEFAULT_CHARSET
|
||||
_CmdConfigFont( FONT_DISASM_DEFAULT, g_sFontNameDisasm , FIXED_PITCH | FF_MODERN , g_nFontHeight ); // OEM_CHARSET
|
||||
_CmdConfigFont( FONT_DISASM_BRANCH , g_sFontNameBranch , DEFAULT_PITCH | FF_DECORATIVE, g_nFontHeight+3); // DEFAULT_CHARSET
|
||||
#endif
|
||||
_UpdateWindowFontHeights( g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontHeight );
|
||||
FontsInitialize();
|
||||
|
||||
int iColor;
|
||||
|
||||
|
@ -8920,65 +8557,7 @@ void DebuggerInputConsoleChar( TCHAR ch )
|
|||
else
|
||||
if (ch == 0x16) // HACK: Ctrl-V. WTF!?
|
||||
{
|
||||
// Support Clipboard (paste)
|
||||
if (!IsClipboardFormatAvailable(CF_TEXT))
|
||||
return;
|
||||
|
||||
if (!OpenClipboard(GetFrame().g_hFrameWindow ))
|
||||
return;
|
||||
|
||||
HGLOBAL hClipboard;
|
||||
LPTSTR pData;
|
||||
|
||||
hClipboard = GetClipboardData(CF_TEXT);
|
||||
if (hClipboard != NULL)
|
||||
{
|
||||
pData = (char*) GlobalLock(hClipboard);
|
||||
if (pData != NULL)
|
||||
{
|
||||
LPTSTR pSrc = pData;
|
||||
char c;
|
||||
|
||||
while (true)
|
||||
{
|
||||
c = *pSrc++;
|
||||
|
||||
if (! c)
|
||||
break;
|
||||
|
||||
if (c == CHAR_CR)
|
||||
{
|
||||
#if WIN32
|
||||
// Eat char
|
||||
#endif
|
||||
#if MACOSX
|
||||
#pragma error( "TODO: Mac port - handle CR/LF")
|
||||
#endif
|
||||
}
|
||||
else
|
||||
if (c == CHAR_LF)
|
||||
{
|
||||
#if WIN32
|
||||
DebuggerProcessCommand( true );
|
||||
#endif
|
||||
#if MACOSX
|
||||
#pragma error( "TODO: Mac port - handle CR/LF")
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we didn't want verbatim, we could do:
|
||||
// DebuggerInputConsoleChar( c );
|
||||
if ((c >= CHAR_SPACE) && (c <= 126)) // HACK MAGIC # 32 -> ' ', # 126
|
||||
ConsoleInputChar( c );
|
||||
}
|
||||
}
|
||||
GlobalUnlock(hClipboard);
|
||||
}
|
||||
}
|
||||
CloseClipboard();
|
||||
|
||||
UpdateDisplay( UPDATE_CONSOLE_DISPLAY );
|
||||
ProcessClipboardCommands();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9504,136 +9083,6 @@ void DebuggerCursorNext()
|
|||
//}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
void DebuggerMouseClick( int x, int y )
|
||||
{
|
||||
if (g_nAppMode != MODE_DEBUG)
|
||||
return;
|
||||
|
||||
KeybUpdateCtrlShiftStatus();
|
||||
int iAltCtrlShift = 0;
|
||||
iAltCtrlShift |= KeybGetAltStatus() ? 1<<0 : 0;
|
||||
iAltCtrlShift |= KeybGetCtrlStatus() ? 1<<1 : 0;
|
||||
iAltCtrlShift |= KeybGetShiftStatus() ? 1<<2 : 0;
|
||||
|
||||
// GH#462 disasm click #
|
||||
if (iAltCtrlShift != g_bConfigDisasmClick)
|
||||
return;
|
||||
|
||||
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
|
||||
|
||||
int nFontWidth = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontWidthAvg * win32Frame.GetViewportScale();
|
||||
int nFontHeight = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight * win32Frame.GetViewportScale();
|
||||
|
||||
// do picking
|
||||
|
||||
const int nOffsetX = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetX() : win32Frame.Get3DBorderWidth();
|
||||
const int nOffsetY = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetY() : win32Frame.Get3DBorderHeight();
|
||||
|
||||
const int nOffsetInScreenX = x - nOffsetX;
|
||||
const int nOffsetInScreenY = y - nOffsetY;
|
||||
|
||||
if (nOffsetInScreenX < 0 || nOffsetInScreenY < 0)
|
||||
return;
|
||||
|
||||
int cx = nOffsetInScreenX / nFontWidth;
|
||||
int cy = nOffsetInScreenY / nFontHeight;
|
||||
|
||||
#if _DEBUG
|
||||
char sText[ CONSOLE_WIDTH ];
|
||||
sprintf( sText, "x:%d y:%d cx:%d cy:%d", x, y, cx, cy );
|
||||
ConsoleDisplayPush( sText );
|
||||
DebugDisplay();
|
||||
#endif
|
||||
|
||||
if (g_iWindowThis == WINDOW_CODE)
|
||||
{
|
||||
// Display_AssemblyLine -- need Tabs
|
||||
|
||||
if( g_bConfigDisasmAddressView )
|
||||
{
|
||||
// HACK: hard-coded from DrawDisassemblyLine::aTabs[] !!!
|
||||
if( cx < 4) // ####
|
||||
{
|
||||
g_bConfigDisasmAddressView ^= true;
|
||||
DebugDisplay();
|
||||
}
|
||||
else
|
||||
if (cx == 4) // :
|
||||
{
|
||||
g_bConfigDisasmAddressColon ^= true;
|
||||
DebugDisplay();
|
||||
}
|
||||
else // AD 00 00
|
||||
if ((cx > 4) && (cx <= 13))
|
||||
{
|
||||
g_bConfigDisasmOpcodesView ^= true;
|
||||
DebugDisplay();
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
if( cx == 0 ) // :
|
||||
{
|
||||
// Three-way state
|
||||
// "addr:"
|
||||
// ":"
|
||||
// " "
|
||||
g_bConfigDisasmAddressColon ^= true;
|
||||
if( g_bConfigDisasmAddressColon )
|
||||
{
|
||||
g_bConfigDisasmAddressView ^= true;
|
||||
}
|
||||
DebugDisplay();
|
||||
}
|
||||
else
|
||||
if ((cx > 0) & (cx <= 13))
|
||||
{
|
||||
g_bConfigDisasmOpcodesView ^= true;
|
||||
DebugDisplay();
|
||||
}
|
||||
}
|
||||
// Click on PC inside reg window?
|
||||
if ((cx >= 51) && (cx <= 60))
|
||||
{
|
||||
if (cy == 3)
|
||||
{
|
||||
CmdCursorJumpPC( CURSOR_ALIGN_CENTER );
|
||||
DebugDisplay();
|
||||
}
|
||||
else
|
||||
if (cy == 4 || cy == 5)
|
||||
{
|
||||
int iFlag = -1;
|
||||
int nFlag = _6502_NUM_FLAGS;
|
||||
|
||||
while( nFlag --> 0 )
|
||||
{
|
||||
// TODO: magic number instead of DrawFlags() DISPLAY_FLAG_COLUMN, rect.left += ((2 + _6502_NUM_FLAGS) * nSpacerWidth);
|
||||
// BP_SRC_FLAG_C is 6, cx 60 --> 0
|
||||
// ...
|
||||
// BP_SRC_FLAG_N is 13, cx 53 --> 7
|
||||
if (cx == (53 + nFlag))
|
||||
{
|
||||
iFlag = 7 - nFlag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iFlag >= 0)
|
||||
{
|
||||
regs.ps ^= (1 << iFlag);
|
||||
DebugDisplay();
|
||||
}
|
||||
}
|
||||
else // Click on stack
|
||||
if( cy > 3)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
bool IsDebugSteppingAtFullSpeed(void)
|
||||
{
|
||||
|
|
|
@ -84,6 +84,8 @@
|
|||
|
||||
extern const int WINDOW_DATA_BYTES_PER_LINE;
|
||||
|
||||
extern int g_nDisasmDisplayLines;
|
||||
|
||||
// Config - Disassembly
|
||||
extern bool g_bConfigDisasmAddressView ;
|
||||
extern int g_bConfigDisasmClick ; // GH#462
|
||||
|
@ -135,6 +137,8 @@
|
|||
|
||||
// Prototypes _______________________________________________________________
|
||||
|
||||
void WindowUpdateSizes();
|
||||
|
||||
// Bookmarks
|
||||
int Bookmark_Find( const WORD nAddress );
|
||||
|
||||
|
|
|
@ -202,13 +202,13 @@ static void _SetupColorRamp(const int iPrimary, int & iColor_)
|
|||
g_aColorPalette[iColor_] = nColor;
|
||||
#if DEBUG_COLOR_RAMP
|
||||
wsprintf(sText, TEXT("RGB(%3d,%3d,%3d), "), nR, nG, nB);
|
||||
_tcscat(sRamp, sText);
|
||||
strcat(sRamp, sText);
|
||||
#endif
|
||||
iColor_++;
|
||||
}
|
||||
#if DEBUG_COLOR_RAMP
|
||||
wsprintf(sText, TEXT(" // %d%d%d\n"), bB, bG, bR);
|
||||
_tcscat(sRamp, sText);
|
||||
strcat(sRamp, sText);
|
||||
OutputDebugString(sRamp);
|
||||
sRamp[0] = 0;
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
|
||||
void FillBackground(long left, long top, long right, long bottom);
|
||||
|
||||
// Display ____________________________________________________________________
|
||||
void UpdateDisplay(Update_t bUpdate);
|
||||
|
||||
int PrintText ( const char * pText, RECT & rRect );
|
||||
int PrintTextCursorX( const char * pText, RECT & rRect );
|
||||
int PrintTextCursorY( const char * pText, RECT & rRect );
|
||||
|
|
|
@ -261,18 +261,18 @@ void Help_Operators()
|
|||
ConsolePrintFormat( sText," Operators: (%sBreakpoint%s)" , CHC_USAGE, CHC_DEFAULT );
|
||||
|
||||
_tcscpy( sText, " " );
|
||||
_tcscat( sText, CHC_USAGE );
|
||||
strcat( sText, CHC_USAGE );
|
||||
int iBreakOp = 0;
|
||||
for( iBreakOp = 0; iBreakOp < NUM_BREAKPOINT_OPERATORS; iBreakOp++ )
|
||||
{
|
||||
if ((iBreakOp >= PARAM_BP_LESS_EQUAL) &&
|
||||
(iBreakOp <= PARAM_BP_GREATER_EQUAL))
|
||||
{
|
||||
_tcscat( sText, g_aBreakpointSymbols[ iBreakOp ] );
|
||||
_tcscat( sText, " " );
|
||||
strcat( sText, g_aBreakpointSymbols[ iBreakOp ] );
|
||||
strcat( sText, " " );
|
||||
}
|
||||
}
|
||||
_tcscat( sText, CHC_DEFAULT );
|
||||
strcat( sText, CHC_DEFAULT );
|
||||
ConsolePrint( sText );
|
||||
}
|
||||
|
||||
|
|
583
source/Debugger/Debugger_Win32.cpp
Normal file
583
source/Debugger/Debugger_Win32.cpp
Normal file
|
@ -0,0 +1,583 @@
|
|||
/*
|
||||
AppleWin : An Apple //e emulator for Windows
|
||||
|
||||
Copyright (C) 1994-1996, Michael O'Brien
|
||||
Copyright (C) 1999-2001, Oliver Schmidt
|
||||
Copyright (C) 2002-2005, Tom Charlesworth
|
||||
Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski
|
||||
|
||||
AppleWin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
AppleWin is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with AppleWin; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Description: Debugger
|
||||
*
|
||||
* Author: Copyright (C) 2006-2010 Michael Pohoreski
|
||||
*/
|
||||
|
||||
// disable warning C4786: symbol greater than 255 character:
|
||||
//#pragma warning(disable: 4786)
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Debugger_Win32.h"
|
||||
#include "Debug.h"
|
||||
|
||||
#include "../Windows/Win32Frame.h"
|
||||
#include "../Interface.h"
|
||||
#include "../Keyboard.h"
|
||||
#include "../Core.h"
|
||||
#include "../CPU.h"
|
||||
|
||||
// Config - Font __________________________________________________________________________________
|
||||
// Font
|
||||
|
||||
//===========================================================================
|
||||
static Update_t CmdConfigFontLoad(int nArgs)
|
||||
{
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
static Update_t CmdConfigFontSave(int nArgs)
|
||||
{
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
}
|
||||
|
||||
// Only for FONT_DISASM_DEFAULT !
|
||||
static void _UpdateWindowFontHeights(int nFontHeight)
|
||||
{
|
||||
if (nFontHeight)
|
||||
{
|
||||
int nConsoleTopY = GetConsoleTopPixels(g_nConsoleDisplayLines);
|
||||
|
||||
int nHeight = 0;
|
||||
|
||||
if (g_iFontSpacing == FONT_SPACING_CLASSIC)
|
||||
{
|
||||
nHeight = nFontHeight + 1;
|
||||
g_nDisasmDisplayLines = nConsoleTopY / nHeight;
|
||||
}
|
||||
else
|
||||
if (g_iFontSpacing == FONT_SPACING_CLEAN)
|
||||
{
|
||||
nHeight = nFontHeight;
|
||||
g_nDisasmDisplayLines = nConsoleTopY / nHeight;
|
||||
}
|
||||
else
|
||||
if (g_iFontSpacing == FONT_SPACING_COMPRESSED)
|
||||
{
|
||||
nHeight = nFontHeight - 1;
|
||||
g_nDisasmDisplayLines = (nConsoleTopY + nHeight) / nHeight; // Ceil()
|
||||
}
|
||||
|
||||
g_aFontConfig[FONT_DISASM_DEFAULT]._nLineHeight = nHeight;
|
||||
|
||||
// int nHeightOptimal = (nHeight0 + nHeight1) / 2;
|
||||
// int nLinesOptimal = nConsoleTopY / nHeightOptimal;
|
||||
// g_nDisasmDisplayLines = nLinesOptimal;
|
||||
|
||||
WindowUpdateSizes();
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
static Update_t CmdConfigFontMode(int nArgs)
|
||||
{
|
||||
if (nArgs != 2)
|
||||
return Help_Arg_1(CMD_CONFIG_FONT);
|
||||
|
||||
int nMode = g_aArgs[2].nValue;
|
||||
|
||||
if ((nMode < 0) || (nMode >= NUM_FONT_SPACING))
|
||||
return Help_Arg_1(CMD_CONFIG_FONT);
|
||||
|
||||
g_iFontSpacing = nMode;
|
||||
_UpdateWindowFontHeights(g_aFontConfig[FONT_DISASM_DEFAULT]._nFontHeight);
|
||||
|
||||
return UPDATE_CONSOLE_DISPLAY | UPDATE_DISASM;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
bool _CmdConfigFont(int iFont, LPCSTR pFontName, int iPitchFamily, int nFontHeight)
|
||||
{
|
||||
bool bStatus = false;
|
||||
HFONT hFont = (HFONT)0;
|
||||
FontConfig_t* pFont = NULL;
|
||||
|
||||
if (iFont < NUM_FONTS)
|
||||
pFont = &g_aFontConfig[iFont];
|
||||
else
|
||||
return bStatus;
|
||||
|
||||
if (pFontName)
|
||||
{
|
||||
// int nFontHeight = g_nFontHeight - 1;
|
||||
|
||||
int bAntiAlias = (nFontHeight < 14) ? DEFAULT_QUALITY : ANTIALIASED_QUALITY;
|
||||
|
||||
// Try allow new font
|
||||
hFont = CreateFont(
|
||||
nFontHeight
|
||||
, 0 // Width
|
||||
, 0 // Escapement
|
||||
, 0 // Orientatin
|
||||
, FW_MEDIUM // Weight
|
||||
, 0 // Italic
|
||||
, 0 // Underline
|
||||
, 0 // Strike Out
|
||||
, DEFAULT_CHARSET // OEM_CHARSET
|
||||
, OUT_DEFAULT_PRECIS
|
||||
, CLIP_DEFAULT_PRECIS
|
||||
, bAntiAlias // ANTIALIASED_QUALITY // DEFAULT_QUALITY
|
||||
, iPitchFamily // HACK: MAGIC #: 4
|
||||
, pFontName);
|
||||
|
||||
if (hFont)
|
||||
{
|
||||
if (iFont == FONT_DISASM_DEFAULT)
|
||||
_UpdateWindowFontHeights(nFontHeight);
|
||||
|
||||
_tcsncpy(pFont->_sFontName, pFontName, MAX_FONT_NAME - 1);
|
||||
pFont->_sFontName[MAX_FONT_NAME - 1] = 0;
|
||||
|
||||
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
|
||||
|
||||
HDC hDC = win32Frame.FrameGetDC();
|
||||
|
||||
TEXTMETRIC tm;
|
||||
GetTextMetrics(hDC, &tm);
|
||||
|
||||
SIZE size;
|
||||
TCHAR sText[] = "W";
|
||||
int nLen = 1;
|
||||
|
||||
int nFontWidthAvg;
|
||||
int nFontWidthMax;
|
||||
|
||||
// if (! (tm.tmPitchAndFamily & TMPF_FIXED_PITCH)) // Windows has this bitflag reversed!
|
||||
// { // Proportional font?
|
||||
// bool bStop = true;
|
||||
// }
|
||||
|
||||
// GetCharWidth32() doesn't work with TrueType Fonts
|
||||
if (GetTextExtentPoint32(hDC, sText, nLen, &size))
|
||||
{
|
||||
nFontWidthAvg = tm.tmAveCharWidth;
|
||||
nFontWidthMax = size.cx;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Font Name Avg Max "W"
|
||||
// Arial 7 8 11
|
||||
// Courier 5 32 11
|
||||
// Courier New 7 14
|
||||
nFontWidthAvg = tm.tmAveCharWidth;
|
||||
nFontWidthMax = tm.tmMaxCharWidth;
|
||||
}
|
||||
|
||||
if (!nFontWidthAvg)
|
||||
{
|
||||
nFontWidthAvg = 7;
|
||||
nFontWidthMax = 7;
|
||||
}
|
||||
|
||||
win32Frame.FrameReleaseDC();
|
||||
|
||||
// DeleteObject( g_hFontDisasm );
|
||||
// g_hFontDisasm = hFont;
|
||||
pFont->_hFont = hFont;
|
||||
|
||||
pFont->_nFontWidthAvg = nFontWidthAvg;
|
||||
pFont->_nFontWidthMax = nFontWidthMax;
|
||||
pFont->_nFontHeight = nFontHeight;
|
||||
|
||||
bStatus = true;
|
||||
}
|
||||
}
|
||||
return bStatus;
|
||||
}
|
||||
|
||||
void FontsInitialize()
|
||||
{
|
||||
for (int iFont = 0; iFont < NUM_FONTS; iFont++ )
|
||||
{
|
||||
g_aFontConfig[ iFont ]._hFont = NULL;
|
||||
#if USE_APPLE_FONT
|
||||
g_aFontConfig[ iFont ]._nFontHeight = CONSOLE_FONT_HEIGHT;
|
||||
g_aFontConfig[ iFont ]._nFontWidthAvg = CONSOLE_FONT_WIDTH;
|
||||
g_aFontConfig[ iFont ]._nFontWidthMax = CONSOLE_FONT_WIDTH;
|
||||
g_aFontConfig[ iFont ]._nLineHeight = CONSOLE_FONT_HEIGHT;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if OLD_FONT
|
||||
_CmdConfigFont( FONT_INFO , g_sFontNameInfo , FIXED_PITCH | FF_MODERN , g_nFontHeight ); // DEFAULT_CHARSET
|
||||
_CmdConfigFont( FONT_CONSOLE , g_sFontNameConsole, FIXED_PITCH | FF_MODERN , g_nFontHeight ); // DEFAULT_CHARSET
|
||||
_CmdConfigFont( FONT_DISASM_DEFAULT, g_sFontNameDisasm , FIXED_PITCH | FF_MODERN , g_nFontHeight ); // OEM_CHARSET
|
||||
_CmdConfigFont( FONT_DISASM_BRANCH , g_sFontNameBranch , DEFAULT_PITCH | FF_DECORATIVE, g_nFontHeight+3); // DEFAULT_CHARSET
|
||||
#endif
|
||||
_UpdateWindowFontHeights( g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontHeight );
|
||||
}
|
||||
|
||||
void FontsDestroy()
|
||||
{
|
||||
for (int iFont = 0; iFont < NUM_FONTS; iFont++)
|
||||
{
|
||||
DeleteObject(g_aFontConfig[iFont]._hFont);
|
||||
g_aFontConfig[iFont]._hFont = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigGetFont(int nArgs)
|
||||
{
|
||||
if (!nArgs)
|
||||
{
|
||||
for (int iFont = 0; iFont < NUM_FONTS; iFont++)
|
||||
{
|
||||
TCHAR sText[CONSOLE_WIDTH] = TEXT("");
|
||||
ConsoleBufferPushFormat(sText, " Font: %-20s A:%2d M:%2d",
|
||||
// g_sFontNameCustom, g_nFontWidthAvg, g_nFontWidthMax );
|
||||
g_aFontConfig[iFont]._sFontName,
|
||||
g_aFontConfig[iFont]._nFontWidthAvg,
|
||||
g_aFontConfig[iFont]._nFontWidthMax);
|
||||
}
|
||||
return ConsoleUpdate();
|
||||
}
|
||||
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigFont(int nArgs)
|
||||
{
|
||||
int iArg;
|
||||
|
||||
if (!nArgs)
|
||||
return CmdConfigGetFont(nArgs);
|
||||
else
|
||||
if (nArgs <= 2) // nArgs
|
||||
{
|
||||
iArg = 1;
|
||||
|
||||
// FONT * is undocumented, like VERSION *
|
||||
if ((!_tcscmp(g_aArgs[iArg].sArg, g_aParameters[PARAM_WILDSTAR].m_sName)) ||
|
||||
(!_tcscmp(g_aArgs[iArg].sArg, g_aParameters[PARAM_MEM_SEARCH_WILD].m_sName)))
|
||||
{
|
||||
TCHAR sText[CONSOLE_WIDTH];
|
||||
ConsoleBufferPushFormat(sText, "Lines: %d Font Px: %d Line Px: %d"
|
||||
, g_nDisasmDisplayLines
|
||||
, g_aFontConfig[FONT_DISASM_DEFAULT]._nFontHeight
|
||||
, g_aFontConfig[FONT_DISASM_DEFAULT]._nLineHeight);
|
||||
ConsoleBufferToDisplay();
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
}
|
||||
|
||||
int iFound;
|
||||
int nFound;
|
||||
|
||||
nFound = FindParam(g_aArgs[iArg].sArg, MATCH_EXACT, iFound, _PARAM_GENERAL_BEGIN, _PARAM_GENERAL_END);
|
||||
if (nFound)
|
||||
{
|
||||
switch (iFound)
|
||||
{
|
||||
case PARAM_LOAD:
|
||||
return CmdConfigFontLoad(nArgs);
|
||||
break;
|
||||
case PARAM_SAVE:
|
||||
return CmdConfigFontSave(nArgs);
|
||||
break;
|
||||
// TODO: FONT SIZE #
|
||||
// TODO: AA {ON|OFF}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nFound = FindParam(g_aArgs[iArg].sArg, MATCH_EXACT, iFound, _PARAM_FONT_BEGIN, _PARAM_FONT_END);
|
||||
if (nFound)
|
||||
{
|
||||
if (iFound == PARAM_FONT_MODE)
|
||||
return CmdConfigFontMode(nArgs);
|
||||
}
|
||||
|
||||
return CmdConfigSetFont(nArgs);
|
||||
}
|
||||
|
||||
return Help_Arg_1(CMD_CONFIG_FONT);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void DebuggerMouseClick(int x, int y)
|
||||
{
|
||||
if (g_nAppMode != MODE_DEBUG)
|
||||
return;
|
||||
|
||||
KeybUpdateCtrlShiftStatus();
|
||||
int iAltCtrlShift = 0;
|
||||
iAltCtrlShift |= KeybGetAltStatus() ? 1 << 0 : 0;
|
||||
iAltCtrlShift |= KeybGetCtrlStatus() ? 1 << 1 : 0;
|
||||
iAltCtrlShift |= KeybGetShiftStatus() ? 1 << 2 : 0;
|
||||
|
||||
// GH#462 disasm click #
|
||||
if (iAltCtrlShift != g_bConfigDisasmClick)
|
||||
return;
|
||||
|
||||
Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
|
||||
|
||||
int nFontWidth = g_aFontConfig[FONT_DISASM_DEFAULT]._nFontWidthAvg * win32Frame.GetViewportScale();
|
||||
int nFontHeight = g_aFontConfig[FONT_DISASM_DEFAULT]._nLineHeight * win32Frame.GetViewportScale();
|
||||
|
||||
// do picking
|
||||
|
||||
const int nOffsetX = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetX() : win32Frame.Get3DBorderWidth();
|
||||
const int nOffsetY = win32Frame.IsFullScreen() ? win32Frame.GetFullScreenOffsetY() : win32Frame.Get3DBorderHeight();
|
||||
|
||||
const int nOffsetInScreenX = x - nOffsetX;
|
||||
const int nOffsetInScreenY = y - nOffsetY;
|
||||
|
||||
if (nOffsetInScreenX < 0 || nOffsetInScreenY < 0)
|
||||
return;
|
||||
|
||||
int cx = nOffsetInScreenX / nFontWidth;
|
||||
int cy = nOffsetInScreenY / nFontHeight;
|
||||
|
||||
#if _DEBUG
|
||||
char sText[CONSOLE_WIDTH];
|
||||
sprintf(sText, "x:%d y:%d cx:%d cy:%d", x, y, cx, cy);
|
||||
ConsoleDisplayPush(sText);
|
||||
DebugDisplay();
|
||||
#endif
|
||||
|
||||
if (g_iWindowThis == WINDOW_CODE)
|
||||
{
|
||||
// Display_AssemblyLine -- need Tabs
|
||||
|
||||
if (g_bConfigDisasmAddressView)
|
||||
{
|
||||
// HACK: hard-coded from DrawDisassemblyLine::aTabs[] !!!
|
||||
if (cx < 4) // ####
|
||||
{
|
||||
g_bConfigDisasmAddressView ^= true;
|
||||
DebugDisplay();
|
||||
}
|
||||
else
|
||||
if (cx == 4) // :
|
||||
{
|
||||
g_bConfigDisasmAddressColon ^= true;
|
||||
DebugDisplay();
|
||||
}
|
||||
else // AD 00 00
|
||||
if ((cx > 4) && (cx <= 13))
|
||||
{
|
||||
g_bConfigDisasmOpcodesView ^= true;
|
||||
DebugDisplay();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cx == 0) // :
|
||||
{
|
||||
// Three-way state
|
||||
// "addr:"
|
||||
// ":"
|
||||
// " "
|
||||
g_bConfigDisasmAddressColon ^= true;
|
||||
if (g_bConfigDisasmAddressColon)
|
||||
{
|
||||
g_bConfigDisasmAddressView ^= true;
|
||||
}
|
||||
DebugDisplay();
|
||||
}
|
||||
else
|
||||
if ((cx > 0) & (cx <= 13))
|
||||
{
|
||||
g_bConfigDisasmOpcodesView ^= true;
|
||||
DebugDisplay();
|
||||
}
|
||||
}
|
||||
// Click on PC inside reg window?
|
||||
if ((cx >= 51) && (cx <= 60))
|
||||
{
|
||||
if (cy == 3)
|
||||
{
|
||||
CmdCursorJumpPC(CURSOR_ALIGN_CENTER);
|
||||
DebugDisplay();
|
||||
}
|
||||
else
|
||||
if (cy == 4 || cy == 5)
|
||||
{
|
||||
int iFlag = -1;
|
||||
int nFlag = _6502_NUM_FLAGS;
|
||||
|
||||
while (nFlag-- > 0)
|
||||
{
|
||||
// TODO: magic number instead of DrawFlags() DISPLAY_FLAG_COLUMN, rect.left += ((2 + _6502_NUM_FLAGS) * nSpacerWidth);
|
||||
// BP_SRC_FLAG_C is 6, cx 60 --> 0
|
||||
// ...
|
||||
// BP_SRC_FLAG_N is 13, cx 53 --> 7
|
||||
if (cx == (53 + nFlag))
|
||||
{
|
||||
iFlag = 7 - nFlag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iFlag >= 0)
|
||||
{
|
||||
regs.ps ^= (1 << iFlag);
|
||||
DebugDisplay();
|
||||
}
|
||||
}
|
||||
else // Click on stack
|
||||
if (cy > 3)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdConfigSetFont(int nArgs)
|
||||
{
|
||||
#if OLD_FONT
|
||||
HFONT hFont = (HFONT)0;
|
||||
TCHAR* pFontName = NULL;
|
||||
int nHeight = g_nFontHeight;
|
||||
int iFontTarget = FONT_DISASM_DEFAULT;
|
||||
int iFontPitch = FIXED_PITCH | FF_MODERN;
|
||||
// int iFontMode =
|
||||
bool bHaveTarget = false;
|
||||
bool bHaveFont = false;
|
||||
|
||||
if (!nArgs)
|
||||
{ // reset to defaut font
|
||||
pFontName = g_sFontNameDefault;
|
||||
}
|
||||
else
|
||||
if (nArgs <= 3)
|
||||
{
|
||||
int iArg = 1;
|
||||
pFontName = g_aArgs[1].sArg;
|
||||
|
||||
// [DISASM|INFO|CONSOLE] "FontName" [#]
|
||||
// "FontName" can be either arg 1 or 2
|
||||
|
||||
int iFound;
|
||||
int nFound = FindParam(g_aArgs[iArg].sArg, MATCH_EXACT, iFound, _PARAM_WINDOW_BEGIN, _PARAM_WINDOW_END);
|
||||
if (nFound)
|
||||
{
|
||||
switch (iFound)
|
||||
{
|
||||
case PARAM_DISASM: iFontTarget = FONT_DISASM_DEFAULT; iFontPitch = FIXED_PITCH | FF_MODERN; bHaveTarget = true; break;
|
||||
case PARAM_INFO: iFontTarget = FONT_INFO; iFontPitch = FIXED_PITCH | FF_MODERN; bHaveTarget = true; break;
|
||||
case PARAM_CONSOLE: iFontTarget = FONT_CONSOLE; iFontPitch = DEFAULT_PITCH | FF_DECORATIVE; bHaveTarget = true; break;
|
||||
default:
|
||||
if (g_aArgs[2].bType != TOKEN_QUOTE_DOUBLE)
|
||||
return Help_Arg_1(CMD_CONFIG_FONT);
|
||||
break;
|
||||
}
|
||||
if (bHaveTarget)
|
||||
{
|
||||
pFontName = g_aArgs[2].sArg;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (nArgs == 2)
|
||||
{
|
||||
nHeight = atoi(g_aArgs[2].sArg);
|
||||
if ((nHeight < 6) || (nHeight > 36))
|
||||
nHeight = g_nFontHeight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Help_Arg_1(CMD_CONFIG_FONT);
|
||||
}
|
||||
|
||||
if (!_CmdConfigFont(iFontTarget, pFontName, iFontPitch, nHeight))
|
||||
{
|
||||
}
|
||||
#endif
|
||||
return UPDATE_ALL;
|
||||
}
|
||||
|
||||
void Util_CopyTextToClipboard(const size_t nSize, const char* pText)
|
||||
{
|
||||
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, nSize + 1);
|
||||
memcpy(GlobalLock(hMem), pText, nSize + 1);
|
||||
GlobalUnlock(hMem);
|
||||
|
||||
OpenClipboard(0);
|
||||
EmptyClipboard();
|
||||
SetClipboardData(CF_TEXT, hMem);
|
||||
CloseClipboard();
|
||||
|
||||
// GlobalFree() ??
|
||||
}
|
||||
|
||||
void ProcessClipboardCommands()
|
||||
{
|
||||
// Support Clipboard (paste)
|
||||
if (!IsClipboardFormatAvailable(CF_TEXT))
|
||||
return;
|
||||
|
||||
if (!OpenClipboard(GetFrame().g_hFrameWindow))
|
||||
return;
|
||||
|
||||
HGLOBAL hClipboard;
|
||||
LPTSTR pData;
|
||||
|
||||
hClipboard = GetClipboardData(CF_TEXT);
|
||||
if (hClipboard != NULL)
|
||||
{
|
||||
pData = (char*)GlobalLock(hClipboard);
|
||||
if (pData != NULL)
|
||||
{
|
||||
LPTSTR pSrc = pData;
|
||||
char c;
|
||||
|
||||
while (true)
|
||||
{
|
||||
c = *pSrc++;
|
||||
|
||||
if (!c)
|
||||
break;
|
||||
|
||||
if (c == CHAR_CR)
|
||||
{
|
||||
// Eat char
|
||||
}
|
||||
else
|
||||
if (c == CHAR_LF)
|
||||
{
|
||||
DebuggerProcessCommand(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we didn't want verbatim, we could do:
|
||||
// DebuggerInputConsoleChar( c );
|
||||
if ((c >= CHAR_SPACE) && (c <= 126)) // HACK MAGIC # 32 -> ' ', # 126
|
||||
ConsoleInputChar(c);
|
||||
}
|
||||
}
|
||||
GlobalUnlock(hClipboard);
|
||||
}
|
||||
}
|
||||
CloseClipboard();
|
||||
|
||||
UpdateDisplay(UPDATE_CONSOLE_DISPLAY);
|
||||
}
|
33
source/Debugger/Debugger_Win32.h
Normal file
33
source/Debugger/Debugger_Win32.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
AppleWin : An Apple //e emulator for Windows
|
||||
|
||||
Copyright (C) 1994-1996, Michael O'Brien
|
||||
Copyright (C) 1999-2001, Oliver Schmidt
|
||||
Copyright (C) 2002-2005, Tom Charlesworth
|
||||
Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski
|
||||
|
||||
AppleWin is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
AppleWin is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with AppleWin; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Description: Debugger
|
||||
*
|
||||
* Author: Copyright (C) 2006-2010 Michael Pohoreski
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
void FontsDestroy();
|
||||
void FontsInitialize();
|
||||
void ProcessClipboardCommands();
|
|
@ -728,6 +728,17 @@ static USHORT GetTimer2Counter(BYTE reg, USHORT counter)
|
|||
return counter - opcodeCycleAdjust;
|
||||
}
|
||||
|
||||
static bool IsTimer1Underflowed(BYTE reg, USHORT counter, USHORT latch, int timerIrqDelay)
|
||||
{
|
||||
const UINT opcodeCycleAdjust = GetOpcodeCyclesForRead(reg); // to compensate for the 4/5/6 cycle read opcode
|
||||
return CheckTimerUnderflow(counter, timerIrqDelay, opcodeCycleAdjust);
|
||||
}
|
||||
|
||||
static bool IsTimer2Underflowed(BYTE reg, USHORT counter)
|
||||
{
|
||||
return counter >= 0 && (short)GetTimer2Counter(reg, counter) < 0;
|
||||
}
|
||||
|
||||
static BYTE SY6522_Read(BYTE nDevice, BYTE nReg)
|
||||
{
|
||||
g_bMB_Active = true;
|
||||
|
@ -780,6 +791,10 @@ static BYTE SY6522_Read(BYTE nDevice, BYTE nReg)
|
|||
break;
|
||||
case 0x0d: // IFR
|
||||
nValue = pMB->sy6522.IFR;
|
||||
if (pMB->bTimer1Active && IsTimer1Underflowed(nReg, pMB->sy6522.TIMER1_COUNTER.w, pMB->sy6522.TIMER1_LATCH.w, pMB->sy6522.timer1IrqDelay))
|
||||
nValue |= IxR_TIMER1;
|
||||
if (pMB->bTimer2Active && IsTimer2Underflowed(nReg, pMB->sy6522.TIMER2_COUNTER.w))
|
||||
nValue |= IxR_TIMER2;
|
||||
break;
|
||||
case 0x0e: // IER
|
||||
nValue = 0x80 | pMB->sy6522.IER; // GH#567
|
||||
|
@ -1929,6 +1944,13 @@ static void LoadSnapshotSY6522(YamlLoadHelper& yamlLoadHelper, SY6522& sy6522, U
|
|||
sy6522.timer2IrqDelay = yamlLoadHelper.LoadUint(SS_YAML_KEY_SY6522_TIMER2_IRQ_DELAY);
|
||||
}
|
||||
|
||||
if (version < 7)
|
||||
{
|
||||
// Assume t1_latch was never written to (so had the old default of 0x0000) - this now results in failure of Mockingboard detection!
|
||||
if (sy6522.TIMER1_LATCH.w == 0x0000)
|
||||
sy6522.TIMER1_LATCH.w = 0xFFFF; // Allow Mockingboard detection to succeed
|
||||
}
|
||||
|
||||
yamlLoadHelper.PopMap();
|
||||
}
|
||||
|
||||
|
|
|
@ -361,8 +361,8 @@ void RegisterExtensions(void)
|
|||
TCHAR icon[MAX_PATH];
|
||||
wsprintf(icon,TEXT("%s,1"),(LPCTSTR)command);
|
||||
|
||||
_tcscat(command,TEXT(" \"%1\"")); // Append "%1"
|
||||
// _tcscat(command,TEXT("-d1 %1\"")); // Append "%1"
|
||||
strcat(command,TEXT(" \"%1\"")); // Append "%1"
|
||||
// strcat(command,TEXT("-d1 %1\"")); // Append "%1"
|
||||
// sprintf(command, "\"%s\" \"-d1 %%1\"", szCommandTmp); // Wrap path & filename in quotes & null terminate
|
||||
|
||||
// NB. Registry access to HKLM typically results in ErrorCode 5(ACCESS DENIED), as UAC requires elevated permissions (Run as administrator).
|
||||
|
|
Loading…
Add table
Reference in a new issue