Help is colorized
Rewrote color console for 2nd and last time.
This commit is contained in:
parent
2253938a55
commit
ecac78cccf
10 changed files with 1259 additions and 773 deletions
|
@ -43,7 +43,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
// TODO: COLOR LOAD ["filename"]
|
// TODO: COLOR LOAD ["filename"]
|
||||||
|
|
||||||
// See Debugger_Changelong.txt for full details
|
// See Debugger_Changelong.txt for full details
|
||||||
const int DEBUGGER_VERSION = MAKE_VERSION(2,5,7,2);
|
const int DEBUGGER_VERSION = MAKE_VERSION(2,5,7,5);
|
||||||
|
|
||||||
|
|
||||||
// Public _________________________________________________________________________________________
|
// Public _________________________________________________________________________________________
|
||||||
|
@ -65,30 +65,30 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
Breakpoint_t g_aBreakpoints[ MAX_BREAKPOINTS ];
|
Breakpoint_t g_aBreakpoints[ MAX_BREAKPOINTS ];
|
||||||
|
|
||||||
// NOTE: Breakpoint_Source_t and g_aBreakpointSource must match!
|
// NOTE: Breakpoint_Source_t and g_aBreakpointSource must match!
|
||||||
const TCHAR *g_aBreakpointSource[ NUM_BREAKPOINT_SOURCES ] =
|
const char *g_aBreakpointSource[ NUM_BREAKPOINT_SOURCES ] =
|
||||||
{ // Used to be one char, since ArgsCook also uses // TODO/FIXME: Parser use Param[] ?
|
{ // Used to be one char, since ArgsCook also uses // TODO/FIXME: Parser use Param[] ?
|
||||||
// Used for both Input & Output!
|
// Used for both Input & Output!
|
||||||
// Regs
|
// Regs
|
||||||
TEXT("A"), // Reg A
|
"A", // Reg A
|
||||||
TEXT("X"), // Reg X
|
"X", // Reg X
|
||||||
TEXT("Y"), // Reg Y
|
"Y", // Reg Y
|
||||||
// Special
|
// Special
|
||||||
TEXT("PC"), // Program Counter
|
"PC", // Program Counter
|
||||||
TEXT("S" ), // Stack Pointer
|
"S" , // Stack Pointer
|
||||||
// Flags -- .8 Moved: Flag names from g_aFlagNames[] to "inlined" g_aBreakpointSource[]
|
// Flags -- .8 Moved: Flag names from g_aFlagNames[] to "inlined" g_aBreakpointSource[]
|
||||||
TEXT("P"), // Processor Status
|
"P", // Processor Status
|
||||||
TEXT("C"), // ---- ---1 Carry
|
"C", // ---- ---1 Carry
|
||||||
TEXT("Z"), // ---- --1- Zero
|
"Z", // ---- --1- Zero
|
||||||
TEXT("I"), // ---- -1-- Interrupt
|
"I", // ---- -1-- Interrupt
|
||||||
TEXT("D"), // ---- 1--- Decimal
|
"D", // ---- 1--- Decimal
|
||||||
TEXT("B"), // ---1 ---- Break
|
"B", // ---1 ---- Break
|
||||||
TEXT("R"), // --1- ---- Reserved
|
"R", // --1- ---- Reserved
|
||||||
TEXT("V"), // -1-- ---- Overflow
|
"V", // -1-- ---- Overflow
|
||||||
TEXT("N"), // 1--- ---- Sign
|
"N", // 1--- ---- Sign
|
||||||
// Misc
|
// Misc
|
||||||
TEXT("OP"), // Opcode/Instruction/Mnemonic
|
"OP", // Opcode/Instruction/Mnemonic
|
||||||
// Memory
|
// Memory
|
||||||
TEXT("M") // Main
|
"M" // Main
|
||||||
};
|
};
|
||||||
|
|
||||||
// Note: BreakpointOperator_t, _PARAM_BREAKPOINT_, and g_aBreakpointSymbols must match!
|
// Note: BreakpointOperator_t, _PARAM_BREAKPOINT_, and g_aBreakpointSymbols must match!
|
||||||
|
@ -400,7 +400,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
{TEXT("MEMORY") , CmdMemoryMiniDumpHex , CMD_MEM_MINI_DUMP_HEX_1 }, // MemoryDumpByte // Did anyone actually use this??
|
{TEXT("MEMORY") , CmdMemoryMiniDumpHex , CMD_MEM_MINI_DUMP_HEX_1 }, // MemoryDumpByte // Did anyone actually use this??
|
||||||
};
|
};
|
||||||
|
|
||||||
// static const TCHAR g_aFlagNames[_6502_NUM_FLAGS+1] = TEXT("CZIDBRVN");// Reversed since arrays are from left-to-right
|
// static const char g_aFlagNames[_6502_NUM_FLAGS+1] = TEXT("CZIDBRVN");// Reversed since arrays are from left-to-right
|
||||||
|
|
||||||
const int NUM_COMMANDS_WITH_ALIASES = sizeof(g_aCommands) / sizeof (Command_t); // Determined at compile-time ;-)
|
const int NUM_COMMANDS_WITH_ALIASES = sizeof(g_aCommands) / sizeof (Command_t); // Determined at compile-time ;-)
|
||||||
|
|
||||||
|
@ -542,18 +542,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
int g_nDisasmWinHeight = 0;
|
int g_nDisasmWinHeight = 0;
|
||||||
|
|
||||||
// TCHAR g_aConfigDisasmAddressColon[] = TEXT(" :");
|
// char g_aConfigDisasmAddressColon[] = TEXT(" :");
|
||||||
|
|
||||||
extern const int WINDOW_DATA_BYTES_PER_LINE = 8;
|
extern const int WINDOW_DATA_BYTES_PER_LINE = 8;
|
||||||
|
|
||||||
|
#if OLD_FONT
|
||||||
// Font
|
// Font
|
||||||
TCHAR g_sFontNameDefault[ MAX_FONT_NAME ] = TEXT("Courier New");
|
TCHAR g_sFontNameDefault[ MAX_FONT_NAME ] = TEXT("Courier New");
|
||||||
TCHAR g_sFontNameConsole[ MAX_FONT_NAME ] = TEXT("Courier New");
|
TCHAR g_sFontNameConsole[ MAX_FONT_NAME ] = TEXT("Courier New");
|
||||||
TCHAR g_sFontNameDisasm [ MAX_FONT_NAME ] = TEXT("Courier New");
|
TCHAR g_sFontNameDisasm [ MAX_FONT_NAME ] = TEXT("Courier New");
|
||||||
TCHAR g_sFontNameInfo [ MAX_FONT_NAME ] = TEXT("Courier New");
|
TCHAR g_sFontNameInfo [ MAX_FONT_NAME ] = TEXT("Courier New");
|
||||||
TCHAR g_sFontNameBranch [ MAX_FONT_NAME ] = TEXT("Webdings");
|
TCHAR g_sFontNameBranch [ MAX_FONT_NAME ] = TEXT("Webdings");
|
||||||
int g_iFontSpacing = FONT_SPACING_CLEAN;
|
|
||||||
HFONT g_hFontWebDings = (HFONT)0;
|
HFONT g_hFontWebDings = (HFONT)0;
|
||||||
|
#endif
|
||||||
|
int g_iFontSpacing = FONT_SPACING_CLEAN;
|
||||||
|
|
||||||
// TODO: This really needs to be phased out, and use the ConfigFont[] settings
|
// TODO: This really needs to be phased out, and use the ConfigFont[] settings
|
||||||
#if USE_APPLE_FONT
|
#if USE_APPLE_FONT
|
||||||
|
@ -2196,9 +2198,9 @@ Update_t CmdBreakpointEnable (int nArgs) {
|
||||||
|
|
||||||
void _BWZ_List( const Breakpoint_t * aBreakWatchZero, const int iBWZ ) //, bool bZeroBased )
|
void _BWZ_List( const Breakpoint_t * aBreakWatchZero, const int iBWZ ) //, bool bZeroBased )
|
||||||
{
|
{
|
||||||
static TCHAR sText[ CONSOLE_WIDTH ];
|
static char sText[ CONSOLE_WIDTH ];
|
||||||
static const TCHAR sFlags[] = "-*";
|
static const char sFlags[] = "-*";
|
||||||
static TCHAR sName[ MAX_SYMBOLS_LEN+1 ];
|
static char sName[ MAX_SYMBOLS_LEN+1 ];
|
||||||
|
|
||||||
WORD nAddress = aBreakWatchZero[ iBWZ ].nAddress;
|
WORD nAddress = aBreakWatchZero[ iBWZ ].nAddress;
|
||||||
LPCTSTR pSymbol = GetSymbol( nAddress, 2 );
|
LPCTSTR pSymbol = GetSymbol( nAddress, 2 );
|
||||||
|
@ -2208,7 +2210,7 @@ void _BWZ_List( const Breakpoint_t * aBreakWatchZero, const int iBWZ ) //, bool
|
||||||
pSymbol = sName;
|
pSymbol = sName;
|
||||||
}
|
}
|
||||||
|
|
||||||
wsprintf( sText, " #%d %c %04X %s",
|
sprintf( sText, " #%d %c %04X %s",
|
||||||
// (bZeroBased ? iBWZ + 1 : iBWZ),
|
// (bZeroBased ? iBWZ + 1 : iBWZ),
|
||||||
iBWZ,
|
iBWZ,
|
||||||
sFlags[ (int) aBreakWatchZero[ iBWZ ].bEnabled ],
|
sFlags[ (int) aBreakWatchZero[ iBWZ ].bEnabled ],
|
||||||
|
@ -2739,6 +2741,14 @@ bool DebuggerSetColor( const int iScheme, const int iColor, const COLORREF nColo
|
||||||
g_aColors[ iScheme ][ iColor ] = nColor;
|
g_aColors[ iScheme ][ iColor ] = nColor;
|
||||||
bStatus = true;
|
bStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Propogate to console since it has its own copy of colors
|
||||||
|
if (iColor == FG_CONSOLE_OUTPUT)
|
||||||
|
{
|
||||||
|
COLORREF nConsole = DebuggerGetColor( FG_CONSOLE_OUTPUT );
|
||||||
|
g_anConsoleColor[ CONSOLE_COLOR_x ] = nConsole;
|
||||||
|
}
|
||||||
|
|
||||||
return bStatus;
|
return bStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3368,6 +3378,7 @@ bool _CmdConfigFont ( int iFont, LPCSTR pFontName, int iPitchFamily, int nFontHe
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
Update_t CmdConfigSetFont (int nArgs)
|
Update_t CmdConfigSetFont (int nArgs)
|
||||||
{
|
{
|
||||||
|
#if OLD_FONT
|
||||||
HFONT hFont = (HFONT) 0;
|
HFONT hFont = (HFONT) 0;
|
||||||
TCHAR *pFontName = NULL;
|
TCHAR *pFontName = NULL;
|
||||||
int nHeight = g_nFontHeight;
|
int nHeight = g_nFontHeight;
|
||||||
|
@ -3425,7 +3436,7 @@ Update_t CmdConfigSetFont (int nArgs)
|
||||||
if (! _CmdConfigFont( iFontTarget, pFontName, iFontPitch, nHeight ))
|
if (! _CmdConfigFont( iFontTarget, pFontName, iFontPitch, nHeight ))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return UPDATE_ALL;
|
return UPDATE_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5599,9 +5610,13 @@ Update_t CmdOutputRun (int nArgs)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TCHAR sText[ CONSOLE_WIDTH ];
|
char sText[ CONSOLE_WIDTH ];
|
||||||
wsprintf( sText, "Couldn't load filename: %s", sFileName );
|
sprintf( sText, "%sCouldn't load filename: %s%s"
|
||||||
ConsoleBufferPush( sText );
|
, CHC_ERROR
|
||||||
|
, CHC_STRING
|
||||||
|
, sFileName
|
||||||
|
);
|
||||||
|
ConsolePrint( sText );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConsoleUpdate();
|
return ConsoleUpdate();
|
||||||
|
@ -5953,7 +5968,7 @@ Update_t CmdSymbolsClear (int nArgs)
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
Update_t CmdSymbolsInfo (int nArgs)
|
Update_t CmdSymbolsInfo (int nArgs)
|
||||||
{
|
{
|
||||||
TCHAR sText[ CONSOLE_WIDTH ];
|
char sText[ CONSOLE_WIDTH ];
|
||||||
|
|
||||||
bool bDisplayMain = false;
|
bool bDisplayMain = false;
|
||||||
bool bDisplayUser = false;
|
bool bDisplayUser = false;
|
||||||
|
@ -5981,24 +5996,48 @@ Update_t CmdSymbolsInfo (int nArgs)
|
||||||
|
|
||||||
if (bDisplayMain && bDisplayUser && bDisplaySrc)
|
if (bDisplayMain && bDisplayUser && bDisplaySrc)
|
||||||
{
|
{
|
||||||
wsprintf( sText, " Symbols Main: %d User: %d Source: %d",
|
sprintf( sText, " Symbols Main: %s%d%s User: %s%d%s Source: %s%d%s"
|
||||||
nSymbolsMain, nSymbolsUser, nSymbolsSrc );
|
, CHC_NUMBER
|
||||||
ConsoleBufferPush( sText );
|
, nSymbolsMain
|
||||||
|
, CHC_DEFAULT
|
||||||
|
, CHC_NUMBER
|
||||||
|
, nSymbolsUser
|
||||||
|
, CHC_DEFAULT
|
||||||
|
, CHC_NUMBER
|
||||||
|
, nSymbolsSrc
|
||||||
|
, CHC_DEFAULT
|
||||||
|
);
|
||||||
|
ConsolePrint( sText );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (bDisplayMain)
|
if (bDisplayMain)
|
||||||
{
|
{
|
||||||
wsprintf( sText, " Main symbols: %d", nSymbolsMain ); ConsoleBufferPush( sText );
|
sprintf( sText, " Main symbols: %s%d%s"
|
||||||
|
, CHC_NUMBER
|
||||||
|
, nSymbolsMain
|
||||||
|
, CHC_DEFAULT
|
||||||
|
);
|
||||||
|
ConsolePrint( sText );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (bDisplayUser)
|
if (bDisplayUser)
|
||||||
{
|
{
|
||||||
wsprintf( sText, " User symbols: %d", nSymbolsUser ); ConsoleBufferPush( sText );
|
sprintf( sText, " User symbols: %s%d%s"
|
||||||
|
, CHC_NUMBER
|
||||||
|
, nSymbolsUser
|
||||||
|
, CHC_DEFAULT
|
||||||
|
);
|
||||||
|
ConsolePrint( sText );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (bDisplaySrc)
|
if (bDisplaySrc)
|
||||||
{
|
{
|
||||||
wsprintf( sText, " Source symbols: %d", nSymbolsSrc ); ConsoleBufferPush( sText );
|
sprintf( sText, " Source symbols: %s%d%s"
|
||||||
|
, CHC_NUMBER
|
||||||
|
, nSymbolsSrc
|
||||||
|
, CHC_DEFAULT
|
||||||
|
);
|
||||||
|
ConsolePrint( sText );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bDisplayMain || bDisplayUser || bDisplaySrc)
|
if (bDisplayMain || bDisplayUser || bDisplaySrc)
|
||||||
|
@ -6009,9 +6048,19 @@ Update_t CmdSymbolsInfo (int nArgs)
|
||||||
|
|
||||||
void _CmdPrintSymbol( LPCTSTR pSymbol, WORD nAddress, int iTable )
|
void _CmdPrintSymbol( LPCTSTR pSymbol, WORD nAddress, int iTable )
|
||||||
{
|
{
|
||||||
TCHAR sText[ CONSOLE_WIDTH ];
|
char sText[ CONSOLE_WIDTH ];
|
||||||
wsprintf( sText, " $%04X (%s) %s", nAddress, g_aSymbolTableNames[ iTable ], pSymbol );
|
sprintf( sText, " %s$%s%04X%s (%s%s%s) %s%s"
|
||||||
ConsoleBufferPush( sText );
|
, CHC_ARG_SEP
|
||||||
|
, CHC_ADDRESS
|
||||||
|
, nAddress
|
||||||
|
, CHC_DEFAULT
|
||||||
|
, CHC_USAGE
|
||||||
|
, g_aSymbolTableNames[ iTable ]
|
||||||
|
, CHC_DEFAULT
|
||||||
|
, CHC_SYMBOL
|
||||||
|
, pSymbol );
|
||||||
|
// ConsoleBufferPush( sText );
|
||||||
|
ConsolePrint( sText );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6097,12 +6146,12 @@ bool String2Address( LPCTSTR pText, WORD & nAddress_ )
|
||||||
{
|
{
|
||||||
TCHAR sHexApple[ CONSOLE_WIDTH ];
|
TCHAR sHexApple[ CONSOLE_WIDTH ];
|
||||||
|
|
||||||
if (pText[0] == TEXT('$'))
|
if (pText[0] == '$')
|
||||||
{
|
{
|
||||||
if (!TextIsHexString( pText+1))
|
if (!TextIsHexString( pText+1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_tcscpy( sHexApple, TEXT("0x") );
|
_tcscpy( sHexApple, "0x" );
|
||||||
_tcsncpy( sHexApple+2, pText+1, MAX_SYMBOLS_LEN - 3 );
|
_tcsncpy( sHexApple+2, pText+1, MAX_SYMBOLS_LEN - 3 );
|
||||||
pText = sHexApple;
|
pText = sHexApple;
|
||||||
}
|
}
|
||||||
|
@ -6268,7 +6317,7 @@ int ParseSymbolTable( TCHAR *pFileName, Symbols_e eWhichTableToLoad )
|
||||||
nSymbolsLoaded++;
|
nSymbolsLoaded++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hFile)
|
if (hFile)
|
||||||
fclose(hFile);
|
fclose(hFile);
|
||||||
|
|
||||||
return nSymbolsLoaded;
|
return nSymbolsLoaded;
|
||||||
|
@ -7453,27 +7502,36 @@ int FindCommand( LPTSTR pName, CmdFuncPtr_t & pFunction_, int * iCommand_ )
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void DisplayAmbigiousCommands( int nFound )
|
void DisplayAmbigiousCommands( int nFound )
|
||||||
{
|
{
|
||||||
TCHAR sText[ CONSOLE_WIDTH ];
|
char sText[ CONSOLE_WIDTH * 2 ];
|
||||||
wsprintf( sText, TEXT("Ambiguous %d Commands:"), g_vPotentialCommands.size() );
|
sprintf( sText, "Ambiguous %s%d%s Commands:"
|
||||||
ConsoleBufferPush( sText );
|
, CHC_NUMBER
|
||||||
|
, g_vPotentialCommands.size()
|
||||||
|
, CHC_DEFAULT
|
||||||
|
);
|
||||||
|
ConsolePrint( sText );
|
||||||
|
|
||||||
int iCommand = 0;
|
int iCommand = 0;
|
||||||
while (iCommand < nFound)
|
while (iCommand < nFound)
|
||||||
{
|
{
|
||||||
TCHAR sPotentialCommands[ CONSOLE_WIDTH ] = TEXT(" ");
|
char sPotentialCommands[ CONSOLE_WIDTH ];
|
||||||
int iWidth = _tcslen( sPotentialCommands );
|
sprintf( sPotentialCommands, "%s ", CHC_COMMAND );
|
||||||
|
|
||||||
|
int iWidth = strlen( sPotentialCommands );
|
||||||
while ((iCommand < nFound) && (iWidth < g_nConsoleDisplayWidth))
|
while ((iCommand < nFound) && (iWidth < g_nConsoleDisplayWidth))
|
||||||
{
|
{
|
||||||
int nCommand = g_vPotentialCommands[ iCommand ];
|
int nCommand = g_vPotentialCommands[ iCommand ];
|
||||||
TCHAR *pName = g_aCommands[ nCommand ].m_sName;
|
char *pName = g_aCommands[ nCommand ].m_sName;
|
||||||
int nLen = _tcslen( pName );
|
int nLen = strlen( pName );
|
||||||
|
|
||||||
wsprintf( sText, TEXT("%s "), pName );
|
if ((iWidth + nLen) >= (CONSOLE_WIDTH - 1))
|
||||||
_tcscat( sPotentialCommands, sText );
|
break;
|
||||||
|
|
||||||
|
sprintf( sText, "%s ", pName );
|
||||||
|
strcat( sPotentialCommands, sText );
|
||||||
iWidth += nLen + 1;
|
iWidth += nLen + 1;
|
||||||
iCommand++;
|
iCommand++;
|
||||||
}
|
}
|
||||||
ConsoleBufferPush( sPotentialCommands );
|
ConsolePrint( sPotentialCommands );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7481,16 +7539,16 @@ void DisplayAmbigiousCommands( int nFound )
|
||||||
Update_t ExecuteCommand (int nArgs)
|
Update_t ExecuteCommand (int nArgs)
|
||||||
{
|
{
|
||||||
Arg_t * pArg = & g_aArgs[ 0 ];
|
Arg_t * pArg = & g_aArgs[ 0 ];
|
||||||
TCHAR * pCommand = & pArg->sArg[0];
|
char * pCommand = & pArg->sArg[0];
|
||||||
|
|
||||||
CmdFuncPtr_t pFunction = NULL;
|
CmdFuncPtr_t pFunction = NULL;
|
||||||
int nFound = FindCommand( pCommand, pFunction );
|
int nFound = FindCommand( pCommand, pFunction );
|
||||||
|
|
||||||
int nCookMask = (1 << NUM_TOKENS) - 1; // ArgToken_e used as bit mask!
|
// int nCookMask = (1 << NUM_TOKENS) - 1; // ArgToken_e used as bit mask!
|
||||||
|
|
||||||
if (! nFound)
|
if (! nFound)
|
||||||
{
|
{
|
||||||
int nLen = _tcslen( pCommand);
|
int nLen = strlen( pCommand );
|
||||||
if (nLen < 6)
|
if (nLen < 6)
|
||||||
{
|
{
|
||||||
// verify pCommand[ 0 .. (nLen-1) ] is hex digit
|
// verify pCommand[ 0 .. (nLen-1) ] is hex digit
|
||||||
|
@ -7577,19 +7635,6 @@ Update_t ExecuteCommand (int nArgs)
|
||||||
// MDB memory display byte (is deprecated, so can be re-used)
|
// MDB memory display byte (is deprecated, so can be re-used)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// C++ // TOKEN_COMMENT_EOL
|
|
||||||
if (pArg->eToken == TOKEN_FSLASH)
|
|
||||||
{
|
|
||||||
pArg++;
|
|
||||||
if (pArg->eToken == TOKEN_FSLASH)
|
|
||||||
{
|
|
||||||
nFound = 1;
|
|
||||||
pFunction = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nFound > 1)
|
if (nFound > 1)
|
||||||
|
@ -7609,7 +7654,7 @@ Update_t ExecuteCommand (int nArgs)
|
||||||
|
|
||||||
int nArgsCooked = nArgs;
|
int nArgsCooked = nArgs;
|
||||||
if (bCook)
|
if (bCook)
|
||||||
nArgsCooked = ArgsCook( nArgs, nCookMask ); // Cook them
|
nArgsCooked = ArgsCook( nArgs ); // nCookMask
|
||||||
|
|
||||||
if (nArgsCooked == ARG_SYNTAX_ERROR)
|
if (nArgsCooked == ARG_SYNTAX_ERROR)
|
||||||
return ConsoleDisplayError(TEXT("Syntax Error"));
|
return ConsoleDisplayError(TEXT("Syntax Error"));
|
||||||
|
@ -7665,18 +7710,19 @@ bool InternalSingleStep ()
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void OutputTraceLine ()
|
void OutputTraceLine ()
|
||||||
{
|
{
|
||||||
// HACK: MAGIC #: 50 -> 64 chars for disassembly
|
char sDisassembly[ CONSOLE_WIDTH ]; DrawDisassemblyLine( 0,regs.pc, sDisassembly); // Get Disasm String
|
||||||
TCHAR sDisassembly[ 64 ] ; DrawDisassemblyLine( 0,regs.pc, sDisassembly); // Get Disasm String
|
char sFlags[ _6502_NUM_FLAGS + 1 ]; DrawFlags( 0, regs.ps, sFlags ); // Get Flags String
|
||||||
TCHAR sFlags[ _6502_NUM_FLAGS+1]; DrawFlags( 0, regs.ps, sFlags ); // Get Flags String
|
|
||||||
|
|
||||||
_ftprintf(g_hTraceFile,
|
// _ftprintf(g_hTraceFile,
|
||||||
TEXT("a=%02x x=%02x y=%02x sp=%03x ps=%s %s\n"),
|
fprintf( g_hTraceFile,
|
||||||
|
"a=%02x x=%02x y=%02x sp=%03x ps=%s %s\n",
|
||||||
(unsigned)regs.a,
|
(unsigned)regs.a,
|
||||||
(unsigned)regs.x,
|
(unsigned)regs.x,
|
||||||
(unsigned)regs.y,
|
(unsigned)regs.y,
|
||||||
(unsigned)regs.sp,
|
(unsigned)regs.sp,
|
||||||
(LPCTSTR) sFlags,
|
(char*) sFlags,
|
||||||
(LPCTSTR) sDisassembly);
|
(char*) sDisassembly
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -7696,9 +7742,6 @@ int ParseInput ( LPTSTR pConsoleInput, bool bCook )
|
||||||
g_aArgs[ iArg ] = g_aArgRaw[ iArg ];
|
g_aArgs[ iArg ] = g_aArgRaw[ iArg ];
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (bCook)
|
|
||||||
// nArg = ArgsCook( nArg ); // Cook them
|
|
||||||
|
|
||||||
return nArg;
|
return nArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7884,9 +7927,11 @@ void ProfileFormat( bool bExport, ProfileFormat_e eFormatMode )
|
||||||
, "\"Percent\"" DELIM "\"Count\"" DELIM DELIM DELIM "\"Addressing Mode\"\n"
|
, "\"Percent\"" DELIM "\"Count\"" DELIM DELIM DELIM "\"Addressing Mode\"\n"
|
||||||
, sSeperator7, sSeperator2, sSeperator2, sSeperator2 );
|
, sSeperator7, sSeperator2, sSeperator2, sSeperator2 );
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sprintf( pText
|
sprintf( pText
|
||||||
, "Percent" DELIM "Count" DELIM "Addressing Mode\n"
|
, "Percent" DELIM "Count" DELIM "Addressing Mode\n"
|
||||||
, sSeperator7, sSeperator2 );
|
, sSeperator7, sSeperator2 );
|
||||||
|
}
|
||||||
pText = ProfileLinePush();
|
pText = ProfileLinePush();
|
||||||
|
|
||||||
if (nOpmodeTotal < 1)
|
if (nOpmodeTotal < 1)
|
||||||
|
@ -8382,9 +8427,10 @@ void DebugInitialize ()
|
||||||
g_iCommand = CMD_SYMBOLS_MAIN;
|
g_iCommand = CMD_SYMBOLS_MAIN;
|
||||||
CmdSymbolsLoad(0);
|
CmdSymbolsLoad(0);
|
||||||
|
|
||||||
|
#if OLD_FONT
|
||||||
// CREATE A FONT FOR THE DEBUGGING SCREEN
|
// CREATE A FONT FOR THE DEBUGGING SCREEN
|
||||||
int nArgs = _Arg_1( g_sFontNameDefault );
|
int nArgs = _Arg_1( g_sFontNameDefault );
|
||||||
// CmdConfigSetFont( nArgs );
|
#endif
|
||||||
|
|
||||||
for (int iFont = 0; iFont < NUM_FONTS; iFont++ )
|
for (int iFont = 0; iFont < NUM_FONTS; iFont++ )
|
||||||
{
|
{
|
||||||
|
@ -8397,16 +8443,13 @@ void DebugInitialize ()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//#if USE_APPLE_FONT
|
#if OLD_FONT
|
||||||
// _UpdateWindowFontHeights( g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontHeight );
|
|
||||||
//#else
|
|
||||||
// TODO: g_aFontPitch
|
|
||||||
_CmdConfigFont( FONT_INFO , g_sFontNameInfo , FIXED_PITCH | FF_MODERN , g_nFontHeight ); // DEFAULT_CHARSET
|
_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_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_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
|
_CmdConfigFont( FONT_DISASM_BRANCH , g_sFontNameBranch , DEFAULT_PITCH | FF_DECORATIVE, g_nFontHeight+3); // DEFAULT_CHARSET
|
||||||
//#endif
|
#endif
|
||||||
// _UpdateWindowFontHeights( nFontHeight );
|
_UpdateWindowFontHeights( g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontHeight );
|
||||||
|
|
||||||
int iColor;
|
int iColor;
|
||||||
|
|
||||||
|
@ -8634,7 +8677,7 @@ Update_t DebuggerProcessCommand( const bool bEchoConsoleInput )
|
||||||
{
|
{
|
||||||
Update_t bUpdateDisplay = UPDATE_NOTHING;
|
Update_t bUpdateDisplay = UPDATE_NOTHING;
|
||||||
|
|
||||||
TCHAR sText[ CONSOLE_WIDTH ];
|
char sText[ CONSOLE_WIDTH ];
|
||||||
|
|
||||||
if (bEchoConsoleInput)
|
if (bEchoConsoleInput)
|
||||||
ConsoleDisplayPush( ConsoleInputPeek() );
|
ConsoleDisplayPush( ConsoleInputPeek() );
|
||||||
|
@ -8653,7 +8696,7 @@ Update_t DebuggerProcessCommand( const bool bEchoConsoleInput )
|
||||||
int nDelayedTargets = AssemblerDelayedTargetsSize();
|
int nDelayedTargets = AssemblerDelayedTargetsSize();
|
||||||
if (nDelayedTargets)
|
if (nDelayedTargets)
|
||||||
{
|
{
|
||||||
wsprintf( sText, " Asm: %d sym declared, not defined", nDelayedTargets );
|
sprintf( sText, " Asm: %d sym declared, not defined", nDelayedTargets );
|
||||||
ConsoleDisplayPush( sText );
|
ConsoleDisplayPush( sText );
|
||||||
bUpdateDisplay |= UPDATE_CONSOLE_DISPLAY;
|
bUpdateDisplay |= UPDATE_CONSOLE_DISPLAY;
|
||||||
}
|
}
|
||||||
|
@ -8671,7 +8714,7 @@ Update_t DebuggerProcessCommand( const bool bEchoConsoleInput )
|
||||||
int nArgs = ParseInput( g_pConsoleInput );
|
int nArgs = ParseInput( g_pConsoleInput );
|
||||||
if (nArgs == ARG_SYNTAX_ERROR)
|
if (nArgs == ARG_SYNTAX_ERROR)
|
||||||
{
|
{
|
||||||
wsprintf( sText, "Syntax error: %s", g_aArgs[0].sArg );
|
sprintf( sText, "Syntax error: %s", g_aArgs[0].sArg );
|
||||||
bUpdateDisplay |= ConsoleDisplayError( sText );
|
bUpdateDisplay |= ConsoleDisplayError( sText );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -27,7 +27,7 @@ using namespace std;
|
||||||
extern int g_nBreakpoints;
|
extern int g_nBreakpoints;
|
||||||
extern Breakpoint_t g_aBreakpoints[ MAX_BREAKPOINTS ];
|
extern Breakpoint_t g_aBreakpoints[ MAX_BREAKPOINTS ];
|
||||||
|
|
||||||
extern const TCHAR *g_aBreakpointSource [ NUM_BREAKPOINT_SOURCES ];
|
extern const char *g_aBreakpointSource [ NUM_BREAKPOINT_SOURCES ];
|
||||||
extern const TCHAR *g_aBreakpointSymbols[ NUM_BREAKPOINT_OPERATORS ];
|
extern const TCHAR *g_aBreakpointSymbols[ NUM_BREAKPOINT_OPERATORS ];
|
||||||
|
|
||||||
// Full-Speed debugging
|
// Full-Speed debugging
|
||||||
|
|
|
@ -76,7 +76,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
// Input Line
|
// Input Line
|
||||||
|
|
||||||
// Raw input Line (has prompt)
|
// Raw input Line (has prompt)
|
||||||
conchar_t * const g_aConsoleInput = g_aConsoleDisplay[0];
|
char g_aConsoleInput[ CONSOLE_WIDTH ]; // = g_aConsoleDisplay[0];
|
||||||
|
|
||||||
// Cooked input line (no prompt)
|
// Cooked input line (no prompt)
|
||||||
int g_nConsoleInputChars = 0;
|
int g_nConsoleInputChars = 0;
|
||||||
|
@ -89,6 +89,23 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
// Console ________________________________________________________________________________________
|
// Console ________________________________________________________________________________________
|
||||||
|
|
||||||
|
int ConsoleLineLength( const conchar_t * pText )
|
||||||
|
{
|
||||||
|
int nLen = 0;
|
||||||
|
const conchar_t *pSrc = pText;
|
||||||
|
|
||||||
|
if (pText )
|
||||||
|
{
|
||||||
|
while (*pSrc)
|
||||||
|
{
|
||||||
|
pSrc++;
|
||||||
|
}
|
||||||
|
nLen = pSrc - pText;
|
||||||
|
}
|
||||||
|
return nLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
const conchar_t* ConsoleBufferPeek ()
|
const conchar_t* ConsoleBufferPeek ()
|
||||||
{
|
{
|
||||||
|
@ -106,15 +123,19 @@ bool ConsolePrint ( const char * pText )
|
||||||
|
|
||||||
// Convert color string to native console color text
|
// Convert color string to native console color text
|
||||||
// Ignores g_nConsoleDisplayWidth
|
// Ignores g_nConsoleDisplayWidth
|
||||||
conchar_t c;
|
char c;
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
const char * pSrc = pText;
|
const char *pSrc = pText;
|
||||||
conchar_t *pDst = & g_aConsoleBuffer[ g_nConsoleBuffer ][ 0 ];
|
conchar_t *pDst = & g_aConsoleBuffer[ g_nConsoleBuffer ][ 0 ];
|
||||||
|
|
||||||
|
conchar_t g = 0;
|
||||||
|
bool bHaveColor = false;
|
||||||
|
char cColor = 0;
|
||||||
|
|
||||||
while ((x < CONSOLE_WIDTH) && (c = *pSrc))
|
while ((x < CONSOLE_WIDTH) && (c = *pSrc))
|
||||||
{
|
{
|
||||||
if ((c == '\n') || (x == (CONSOLE_WIDTH - 1)))
|
if ((c == '\n') || (x >= (CONSOLE_WIDTH - 1)))
|
||||||
{
|
{
|
||||||
*pDst = 0;
|
*pDst = 0;
|
||||||
x = 0;
|
x = 0;
|
||||||
|
@ -130,22 +151,102 @@ bool ConsolePrint ( const char * pText )
|
||||||
pDst = & g_aConsoleBuffer[ g_nConsoleBuffer ][ 0 ];
|
pDst = & g_aConsoleBuffer[ g_nConsoleBuffer ][ 0 ];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (ConsoleColor_IsCharMeta( c ))
|
|
||||||
{
|
{
|
||||||
pSrc++;
|
g = (c & _CONSOLE_COLOR_MASK);
|
||||||
c = *pSrc;
|
|
||||||
if (c)
|
// `# `A color encode mouse text
|
||||||
|
if (ConsoleColor_IsCharMeta( c ))
|
||||||
{
|
{
|
||||||
if (ConsoleColor_IsCharMeta( c ))
|
if (! pSrc[1])
|
||||||
*pDst = c;
|
break;
|
||||||
|
|
||||||
|
if (ConsoleColor_IsCharMeta( pSrc[1] )) // ` `
|
||||||
|
{
|
||||||
|
bHaveColor = false;
|
||||||
|
cColor = 0;
|
||||||
|
g = ConsoleColor_MakeColor( cColor, c );
|
||||||
|
*pDst = g;
|
||||||
|
x++;
|
||||||
|
pDst++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
*pDst = ConsoleColor_Make( c );
|
if (ConsoleColor_IsCharColor( pSrc[1] )) // ` #
|
||||||
x++;
|
{
|
||||||
|
cColor = pSrc[1];
|
||||||
|
bHaveColor = true;
|
||||||
|
}
|
||||||
|
else // ` @
|
||||||
|
{
|
||||||
|
c = ConsoleColor_MakeMouse( pSrc[1] );
|
||||||
|
g = ConsoleColor_MakeColor( cColor, c );
|
||||||
|
*pDst = g;
|
||||||
|
x++;
|
||||||
|
pDst++;
|
||||||
|
}
|
||||||
|
pSrc++;
|
||||||
pSrc++;
|
pSrc++;
|
||||||
pDst++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
{
|
||||||
|
if (bHaveColor)
|
||||||
|
{
|
||||||
|
g = ConsoleColor_MakeColor( cColor, c );
|
||||||
|
bHaveColor = false;
|
||||||
|
}
|
||||||
|
*pDst = g;
|
||||||
|
x++;
|
||||||
|
pDst++;
|
||||||
|
pSrc++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (ConsoleColor_IsCharMeta( c ))
|
||||||
|
{
|
||||||
|
// Convert mult-byte to packed char
|
||||||
|
// 0 1 2 Offset
|
||||||
|
// =====
|
||||||
|
// 1 ~ - null
|
||||||
|
// 2 ~ 0 - null - exit
|
||||||
|
// 3 ~ 0 x color (3 bytes packed into char16
|
||||||
|
// 4 ~ @ - mouse text
|
||||||
|
// 5 ~ @ x mouse Text
|
||||||
|
// 6 ~ ~ ~
|
||||||
|
// Legend:
|
||||||
|
// ~ Color escape
|
||||||
|
// x Any char
|
||||||
|
// - Null
|
||||||
|
if (pSrc[1])
|
||||||
|
{
|
||||||
|
if (ConsoleColor_IsCharMeta( pSrc[1] )) // 6
|
||||||
|
{
|
||||||
|
*pDst = c;
|
||||||
|
x++;
|
||||||
|
pSrc += 2;
|
||||||
|
pDst++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (ConsoleColor_IsCharColor( pSrc[1] ))
|
||||||
|
{
|
||||||
|
if (pSrc[2]) // 3
|
||||||
|
{
|
||||||
|
x++;
|
||||||
|
*pDst = ConsoleColor_MakeColor( pSrc[1], pSrc[2] );
|
||||||
|
pSrc += 3;
|
||||||
|
pDst++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break; // 2
|
||||||
|
}
|
||||||
|
else // 4 or 5
|
||||||
|
{
|
||||||
|
*pDst = ConsoleColor_MakeMeta( pSrc[1] );
|
||||||
|
x++;
|
||||||
|
pSrc += 2;
|
||||||
|
pDst++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break; // 1
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -154,6 +255,7 @@ bool ConsolePrint ( const char * pText )
|
||||||
pSrc++;
|
pSrc++;
|
||||||
pDst++;
|
pDst++;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
*pDst = 0;
|
*pDst = 0;
|
||||||
g_nConsoleBuffer++;
|
g_nConsoleBuffer++;
|
||||||
|
@ -175,7 +277,7 @@ bool ConsoleBufferPush ( const char * pText )
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
const char *pSrc = pText;
|
const char *pSrc = pText;
|
||||||
conchar_t *pDst = & g_aConsoleBuffer[ g_nConsoleBuffer ][ 0 ];
|
conchar_t *pDst = & g_aConsoleBuffer[ g_nConsoleBuffer ][ 0 ];
|
||||||
|
|
||||||
while ((x < CONSOLE_WIDTH) && (c = *pSrc))
|
while ((x < CONSOLE_WIDTH) && (c = *pSrc))
|
||||||
{
|
{
|
||||||
|
@ -215,7 +317,11 @@ void ConsoleBufferPop ()
|
||||||
int y = 0;
|
int y = 0;
|
||||||
while (y < g_nConsoleBuffer)
|
while (y < g_nConsoleBuffer)
|
||||||
{
|
{
|
||||||
strcpy( (char*)g_aConsoleBuffer[ y ], (char*)g_aConsoleBuffer[ y+1 ] );
|
memcpy(
|
||||||
|
g_aConsoleBuffer[ y ],
|
||||||
|
g_aConsoleBuffer[ y+1 ],
|
||||||
|
sizeof( conchar_t ) * CONSOLE_WIDTH
|
||||||
|
);
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,10 +334,26 @@ void ConsoleBufferPop ()
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void ConsoleBufferToDisplay ()
|
void ConsoleBufferToDisplay ()
|
||||||
{
|
{
|
||||||
ConsoleDisplayPush( (char*) ConsoleBufferPeek() );
|
ConsoleDisplayPush( ConsoleBufferPeek() );
|
||||||
ConsoleBufferPop();
|
ConsoleBufferPop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No mark-up. Straight ASCII conversion
|
||||||
|
//===========================================================================
|
||||||
|
void ConsoleConvertFromText ( conchar_t * sText, const char * pText )
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
const char *pSrc = pText;
|
||||||
|
conchar_t *pDst = sText;
|
||||||
|
while (pSrc && *pSrc)
|
||||||
|
{
|
||||||
|
*pDst = (conchar_t) (*pSrc & _CONSOLE_COLOR_MASK);
|
||||||
|
pSrc++;
|
||||||
|
pDst++;
|
||||||
|
}
|
||||||
|
*pDst = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
Update_t ConsoleDisplayError ( const char * pText)
|
Update_t ConsoleDisplayError ( const char * pText)
|
||||||
{
|
{
|
||||||
|
@ -239,27 +361,39 @@ Update_t ConsoleDisplayError ( const char * pText)
|
||||||
return ConsoleUpdate();
|
return ConsoleUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shifts the console display lines "up"
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void ConsoleDisplayPush ( const char * pText )
|
void ConsoleDisplayPush ( const char * pText )
|
||||||
|
{
|
||||||
|
conchar_t sText[ CONSOLE_WIDTH * 2 ];
|
||||||
|
ConsoleConvertFromText( sText, pText );
|
||||||
|
ConsoleDisplayPush( sText );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Shifts the console display lines "up"
|
||||||
|
//===========================================================================
|
||||||
|
void ConsoleDisplayPush ( const conchar_t * pText )
|
||||||
{
|
{
|
||||||
int nLen = MIN( g_nConsoleDisplayTotal, CONSOLE_HEIGHT - 1 - CONSOLE_FIRST_LINE);
|
int nLen = MIN( g_nConsoleDisplayTotal, CONSOLE_HEIGHT - 1 - CONSOLE_FIRST_LINE);
|
||||||
while (nLen--)
|
while (nLen--)
|
||||||
{
|
{
|
||||||
strcpy(
|
memcpy(
|
||||||
(char*) g_aConsoleDisplay[(nLen + 1 + CONSOLE_FIRST_LINE )]
|
(char*) g_aConsoleDisplay[(nLen + 1 + CONSOLE_FIRST_LINE )]
|
||||||
,(char*) g_aConsoleDisplay[nLen + CONSOLE_FIRST_LINE]
|
, (char*) g_aConsoleDisplay[nLen + CONSOLE_FIRST_LINE]
|
||||||
|
, sizeof(conchar_t) * CONSOLE_WIDTH
|
||||||
);
|
);
|
||||||
// , CONSOLE_WIDTH );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pText)
|
if (pText)
|
||||||
strcpy(
|
{
|
||||||
|
memcpy(
|
||||||
(char*) g_aConsoleDisplay[ CONSOLE_FIRST_LINE ]
|
(char*) g_aConsoleDisplay[ CONSOLE_FIRST_LINE ]
|
||||||
, pText
|
, pText
|
||||||
);
|
, sizeof(conchar_t) * CONSOLE_WIDTH
|
||||||
// , CONSOLE_WIDTH );
|
);
|
||||||
|
}
|
||||||
|
|
||||||
g_nConsoleDisplayTotal++;
|
g_nConsoleDisplayTotal++;
|
||||||
if (g_nConsoleDisplayTotal > (CONSOLE_HEIGHT - CONSOLE_FIRST_LINE))
|
if (g_nConsoleDisplayTotal > (CONSOLE_HEIGHT - CONSOLE_FIRST_LINE))
|
||||||
g_nConsoleDisplayTotal = (CONSOLE_HEIGHT - CONSOLE_FIRST_LINE);
|
g_nConsoleDisplayTotal = (CONSOLE_HEIGHT - CONSOLE_FIRST_LINE);
|
||||||
|
@ -272,11 +406,19 @@ void ConsoleDisplayPause ()
|
||||||
{
|
{
|
||||||
if (g_nConsoleBuffer)
|
if (g_nConsoleBuffer)
|
||||||
{
|
{
|
||||||
|
#if CONSOLE_INPUT_CHAR16
|
||||||
|
ConsoleConvertFromText(
|
||||||
|
g_aConsoleInput,
|
||||||
|
"...press SPACE continue, ESC skip..."
|
||||||
|
);
|
||||||
|
g_nConsolePromptLen = ConsoleLineLength( g_pConsoleInput ) + 1;
|
||||||
|
#else
|
||||||
strcpy(
|
strcpy(
|
||||||
(char*) g_aConsoleInput,
|
g_aConsoleInput,
|
||||||
"...press SPACE continue, ESC skip..."
|
"...press SPACE continue, ESC skip..."
|
||||||
);
|
);
|
||||||
g_nConsolePromptLen = strlen( g_pConsoleInput ) + 1;
|
g_nConsolePromptLen = strlen( g_pConsoleInput ) + 1;
|
||||||
|
#endif
|
||||||
g_nConsoleInputChars = 0;
|
g_nConsoleInputChars = 0;
|
||||||
g_bConsoleBufferPaused = true;
|
g_bConsoleBufferPaused = true;
|
||||||
}
|
}
|
||||||
|
@ -310,13 +452,9 @@ bool ConsoleInputBackSpace ()
|
||||||
bool ConsoleInputClear ()
|
bool ConsoleInputClear ()
|
||||||
{
|
{
|
||||||
ZeroMemory( g_aConsoleInput, CONSOLE_WIDTH );
|
ZeroMemory( g_aConsoleInput, CONSOLE_WIDTH );
|
||||||
// Note: Alternate console, with no NULL end of line terminator
|
|
||||||
// for( int x = 0; x < CONSOLE_WIDTH; x++ )
|
|
||||||
// g_aConsoleInput[ x ] = CHAR_SPACE;
|
|
||||||
|
|
||||||
if (g_nConsoleInputChars)
|
if (g_nConsoleInputChars)
|
||||||
{
|
{
|
||||||
// ZeroMemory( g_pConsoleInput, g_nConsoleDisplayWidth );
|
|
||||||
g_nConsoleInputChars = 0;
|
g_nConsoleInputChars = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +480,7 @@ void ConsoleUpdateCursor ( char ch )
|
||||||
g_sConsoleCursor[0] = ch;
|
g_sConsoleCursor[0] = ch;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ch = g_aConsoleInput[ g_nConsoleInputChars + g_nConsolePromptLen ];
|
ch = (char) g_aConsoleInput[ g_nConsoleInputChars + g_nConsolePromptLen ];
|
||||||
if (! ch)
|
if (! ch)
|
||||||
{
|
{
|
||||||
ch = CHAR_SPACE;
|
ch = CHAR_SPACE;
|
||||||
|
@ -355,7 +493,9 @@ void ConsoleUpdateCursor ( char ch )
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
const char * ConsoleInputPeek ()
|
const char * ConsoleInputPeek ()
|
||||||
{
|
{
|
||||||
return (char*) g_aConsoleDisplay[0];
|
// return g_aConsoleDisplay[0];
|
||||||
|
// return g_pConsoleInput;
|
||||||
|
return g_aConsoleInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -371,10 +511,14 @@ void ConsoleInputReset ()
|
||||||
g_aConsoleInput[0] = g_sConsolePrompt[0];
|
g_aConsoleInput[0] = g_sConsolePrompt[0];
|
||||||
g_nConsolePromptLen = 1;
|
g_nConsolePromptLen = 1;
|
||||||
|
|
||||||
// _tcscat( g_aConsoleInput, TEXT(" " ) );
|
// int nLen = strlen( g_aConsoleInput );
|
||||||
|
#if CONSOLE_INPUT_CHAR16
|
||||||
|
int nLen = ConsoleLineLength( g_aConsoleInput );
|
||||||
|
#else
|
||||||
|
int nLen = strlen( g_aConsoleInput );
|
||||||
|
#endif
|
||||||
|
|
||||||
int nLen = strlen( (char*) g_aConsoleInput );
|
g_pConsoleInput = &g_aConsoleInput[ g_nConsolePromptLen ];
|
||||||
g_pConsoleInput = (char*) &g_aConsoleInput[ g_nConsolePromptLen ]; // nLen];
|
|
||||||
g_nConsoleInputChars = 0;
|
g_nConsoleInputChars = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,63 +17,62 @@
|
||||||
|
|
||||||
// Color ____________________________________________________________________
|
// Color ____________________________________________________________________
|
||||||
|
|
||||||
//typedef short conchar_t;
|
// typedef unsigned char conchar_t;
|
||||||
typedef unsigned char conchar_t;
|
typedef short conchar_t;
|
||||||
|
|
||||||
enum ConsoleColors_e
|
enum ConsoleColors_e
|
||||||
{
|
{
|
||||||
CONSOLE_COLOR_K,
|
CONSOLE_COLOR_K, // 0
|
||||||
CONSOLE_COLOR_x = 0, // default console foreground
|
CONSOLE_COLOR_x = 0, // default console foreground
|
||||||
CONSOLE_COLOR_R,
|
CONSOLE_COLOR_R, // 1
|
||||||
CONSOLE_COLOR_G,
|
CONSOLE_COLOR_G, // 2
|
||||||
CONSOLE_COLOR_Y,
|
CONSOLE_COLOR_Y, // 3
|
||||||
CONSOLE_COLOR_B,
|
CONSOLE_COLOR_B, // 4
|
||||||
CONSOLE_COLOR_M,
|
CONSOLE_COLOR_M, // 5 Lite Blue
|
||||||
CONSOLE_COLOR_C,
|
CONSOLE_COLOR_C, // 6
|
||||||
CONSOLE_COLOR_W,
|
CONSOLE_COLOR_W, // 7
|
||||||
|
CONSOLE_COLOR_O, // 8
|
||||||
MAX_CONSOLE_COLORS
|
CONSOLE_COLOR_k, // 9 Grey
|
||||||
|
NUM_CONSOLE_COLORS
|
||||||
};
|
};
|
||||||
|
extern COLORREF g_anConsoleColor[ NUM_CONSOLE_COLORS ];
|
||||||
extern COLORREF g_anConsoleColor[ MAX_CONSOLE_COLORS ];
|
|
||||||
|
|
||||||
// Note: THe ` ~ key should always display ~ to prevent rendering errors
|
// Note: THe ` ~ key should always display ~ to prevent rendering errors
|
||||||
#define CONSOLE_COLOR_ESCAPE_CHAR '`'
|
#define CONSOLE_COLOR_ESCAPE_CHAR '`'
|
||||||
#define _CONSOLE_COLOR_MASK 0x7F
|
#define _CONSOLE_COLOR_MASK 0x7F
|
||||||
|
|
||||||
// Help Colors
|
/* Help Colors
|
||||||
/*
|
|
||||||
Types
|
|
||||||
Plain White
|
|
||||||
Header Yellow i.e. Usage
|
|
||||||
Operator Yellow
|
|
||||||
Command Green
|
|
||||||
Key Red
|
|
||||||
ArgMandatory Magenta < >
|
|
||||||
ArgOptional Blue [ ]
|
|
||||||
ArgSeperator White |
|
|
||||||
|
|
||||||
#define CON_COLOR_DEFAULT g_asConsoleColor[ CONSOLE_COLOR_x ]
|
|
||||||
#define CON_COLOR_DEFAULT "`0"
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#if 1 // USE_APPLE_FONT
|
#if 1 // USE_APPLE_FONT
|
||||||
#define CON_COLOR_DEFAULT "`0"
|
// Console Help Color
|
||||||
#define CON_COLOR_USAGE "`3"
|
#define CHC_DEFAULT "`0"
|
||||||
#define CON_COLOR_PARAM "`2"
|
#define CHC_USAGE "`3"
|
||||||
#define CON_COLOR_KEY "`1"
|
#define CHC_CATEGORY "`6"
|
||||||
#define CON_COLOR_ARG_MAND "`5"
|
#define CHC_COMMAND "`2"
|
||||||
#define CON_COLOR_ARG_OPT "`4"
|
#define CHC_KEY "`1"
|
||||||
#define CON_COLOR_ARG_SEP "`3"
|
#define CHC_ARG_MAND "`7" // < >
|
||||||
#define CON_COLOR_NUM "`2"
|
#define CHC_ARG_OPT "`4" // [ ]
|
||||||
|
#define CHC_ARG_SEP "`9" // | grey
|
||||||
|
#define CHC_NUMBER "`3"
|
||||||
|
#define CHC_SYMBOL "`2"
|
||||||
|
#define CHC_ADDRESS "`8"
|
||||||
|
#define CHC_ERROR "`1"
|
||||||
|
#define CHC_STRING "`6"
|
||||||
|
#define CHC_EXAMPLE "`5"
|
||||||
#else
|
#else
|
||||||
#define CON_COLOR_DEFAULT ""
|
#define CHC_DEFAULT ""
|
||||||
#define CON_COLOR_USAGE ""
|
#define CHC_USAGE ""
|
||||||
#define CON_COLOR_PARAM ""
|
#define CHC_COMMAND ""
|
||||||
#define CON_COLOR_KEY ""
|
#define CHC_KEY ""
|
||||||
#define CON_COLOR_ARG_MAND ""
|
#define CHC_ARG_MAND ""
|
||||||
#define CON_COLOR_ARG_OPT ""
|
#define CHC_ARG_OPT ""
|
||||||
#define CON_COLOR_ARG_SEP ""
|
#define CHC_ARG_SEP ""
|
||||||
|
#define CHC_NUMBER ""
|
||||||
|
#define CHC_SYMBOL ""
|
||||||
|
#define CHC_ADDRESS ""
|
||||||
|
#define CHC_ERROR ""
|
||||||
|
#define CHC_STRING ""
|
||||||
|
#define CHC_EXAMPLE ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ascii markup
|
// ascii markup
|
||||||
|
@ -86,52 +85,87 @@
|
||||||
|
|
||||||
inline bool ConsoleColor_IsCharColor( unsigned char c )
|
inline bool ConsoleColor_IsCharColor( unsigned char c )
|
||||||
{
|
{
|
||||||
if ((c >= '0') && (c <= '7'))
|
if ((c >= '0') && ((c - '0') < NUM_CONSOLE_COLORS))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// native char
|
// Console "Native" Chars
|
||||||
|
//
|
||||||
// There are a few different ways of encoding color chars & mouse text
|
// There are a few different ways of encoding color chars & mouse text
|
||||||
// 0x80 Console Color
|
// Simplist method is to use a user-defined ESCAPE char to shift
|
||||||
// 0xC0 Mouse Text
|
// into color mode, or mouse text mode. The other solution
|
||||||
// High Low
|
// is to use a wide-char, simulating unicode16.
|
||||||
// 1) xx n/a Extended ASCII (Multi-Byte to Single-Byte)
|
//
|
||||||
// 0..7 = Color
|
// C1C0 char16 of High Byte (c1) and Low Byte (c0)
|
||||||
// @..Z = Mouse Text
|
// 1) --?? Con: Colors chars take up extra chars.
|
||||||
// Con: Colors chars take up extra chars
|
// Con: String Length is complicated.
|
||||||
// 2) ccxx Color ASCII Con: need to provide char8 and char16 API
|
// Pro: simple to parse
|
||||||
// 3) xxcc ASCII Color Con: ""
|
//
|
||||||
// 4) fxx Flag ASCII Con: Colors chars take up extra chars
|
// <-- WE USE THIS
|
||||||
inline bool ConsoleColor_IsMeta( conchar_t g )
|
// 2) ccea Pro: Efficient packing of plain text and mouse text
|
||||||
|
// Pro: Color is optional (only record new color)
|
||||||
|
// Con: need to provide char8 and char16 API
|
||||||
|
// Con: little more difficult to parse/convert plain text
|
||||||
|
// i.e.
|
||||||
|
// ea = 0x20 - 0x7F ASCII
|
||||||
|
// 0x80 - 0xFF Mouse Text '@'-'Z' -> 0x00 - 0x1F
|
||||||
|
// cc = ASCII '0' - '9' (color)
|
||||||
|
// 3) ??cc Con: Colors chars take up extra chars
|
||||||
|
// 4) f?? Con: Colors chars take up extra chars
|
||||||
|
//
|
||||||
|
// Legend:
|
||||||
|
// f Flag
|
||||||
|
// -- Not Applicable (n/a)
|
||||||
|
// ?? ASCII (0x20 - 0x7F)
|
||||||
|
// ea Extended ASCII with High-Bit representing Mouse Text
|
||||||
|
// cc Encoded Color / Mouse Text
|
||||||
|
//
|
||||||
|
inline bool ConsoleColor_IsColorOrMouse( conchar_t g )
|
||||||
{
|
{
|
||||||
if (g > _CONSOLE_COLOR_MASK)
|
if (g > _CONSOLE_COLOR_MASK)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// inline bool ConsoleColor_IsCharColor( unsigned char c )
|
|
||||||
inline bool ConsoleColor_IsColor( conchar_t g )
|
inline bool ConsoleColor_IsColor( conchar_t g )
|
||||||
{
|
{
|
||||||
if (((g - '0') & _CONSOLE_COLOR_MASK) < MAX_CONSOLE_COLORS)
|
return ConsoleColor_IsCharColor (g >> 8);
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline COLORREF ConsoleColor_GetColor( conchar_t g )
|
inline COLORREF ConsoleColor_GetColor( conchar_t g )
|
||||||
{
|
{
|
||||||
const int iColor = g & (MAX_CONSOLE_COLORS - 1);
|
const int iColor = (g >> 8) - '0';
|
||||||
return g_anConsoleColor[ iColor ];
|
if (iColor < NUM_CONSOLE_COLORS)
|
||||||
|
return g_anConsoleColor[ iColor ];
|
||||||
|
|
||||||
|
return g_anConsoleColor[ 0 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline char ConsoleColor_GetChar( conchar_t g )
|
inline char ConsoleColor_GetMeta( conchar_t g )
|
||||||
|
{
|
||||||
|
return ((g >> 8) & _CONSOLE_COLOR_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline char ConsoleChar_GetChar( conchar_t g )
|
||||||
{
|
{
|
||||||
return (g & _CONSOLE_COLOR_MASK);
|
return (g & _CONSOLE_COLOR_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline conchar_t ConsoleColor_Make( unsigned char c )
|
inline char ConsoleColor_MakeMouse( unsigned char c )
|
||||||
{
|
{
|
||||||
conchar_t g = c | (_CONSOLE_COLOR_MASK + 1);
|
return ((c - '@') + (_CONSOLE_COLOR_MASK + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline conchar_t ConsoleColor_MakeMeta( unsigned char c )
|
||||||
|
{
|
||||||
|
conchar_t g = (ConsoleColor_MakeMouse(c) << 8);
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline conchar_t ConsoleColor_MakeColor( unsigned char color, unsigned char text )
|
||||||
|
{
|
||||||
|
conchar_t g = (color << 8) | text;
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,14 +199,15 @@
|
||||||
|
|
||||||
// Input Line
|
// Input Line
|
||||||
// Raw input Line (has prompt)
|
// Raw input Line (has prompt)
|
||||||
extern conchar_t * const g_aConsoleInput; // = g_aConsoleDisplay[0];
|
extern char g_aConsoleInput[ CONSOLE_WIDTH ];
|
||||||
|
|
||||||
// Cooked input line (no prompt)
|
// Cooked input line (no prompt)
|
||||||
extern int g_nConsoleInputChars ;
|
extern int g_nConsoleInputChars ;
|
||||||
extern char * g_pConsoleInput ;//= 0; // points to past prompt
|
extern char * g_pConsoleInput ; // points to past prompt
|
||||||
extern const char * g_pConsoleFirstArg ;//= 0; // points to first arg
|
extern const char * g_pConsoleFirstArg ; // points to first arg
|
||||||
extern bool g_bConsoleInputQuoted ;
|
extern bool g_bConsoleInputQuoted ;
|
||||||
extern char g_nConsoleInputSkip ;
|
|
||||||
|
extern char g_nConsoleInputSkip ;
|
||||||
|
|
||||||
|
|
||||||
// Prototypes _______________________________________________________________
|
// Prototypes _______________________________________________________________
|
||||||
|
@ -186,10 +221,13 @@
|
||||||
void ConsoleBufferPop ();
|
void ConsoleBufferPop ();
|
||||||
bool ConsoleBufferPush ( const char * pString );
|
bool ConsoleBufferPush ( const char * pString );
|
||||||
|
|
||||||
|
void ConsoleConvertFromText( conchar_t * sText, const char * pText );
|
||||||
|
|
||||||
// Display
|
// Display
|
||||||
Update_t ConsoleDisplayError ( const char * pTextError );
|
Update_t ConsoleDisplayError ( const char * pTextError );
|
||||||
void ConsoleDisplayPause ();
|
void ConsoleDisplayPause ();
|
||||||
void ConsoleDisplayPush ( const char * pText );
|
void ConsoleDisplayPush ( const char * pText );
|
||||||
|
void ConsoleDisplayPush ( const conchar_t * pText );
|
||||||
Update_t ConsoleUpdate ();
|
Update_t ConsoleUpdate ();
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
|
|
|
@ -70,39 +70,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
HBRUSH g_hConsoleBrushFG = NULL;
|
HBRUSH g_hConsoleBrushFG = NULL;
|
||||||
HBRUSH g_hConsoleBrushBG = NULL;
|
HBRUSH g_hConsoleBrushBG = NULL;
|
||||||
|
|
||||||
COLORREF g_anConsoleColor[ MAX_CONSOLE_COLORS ] =
|
COLORREF g_anConsoleColor[ NUM_CONSOLE_COLORS ] =
|
||||||
{
|
{
|
||||||
RGB( 0, 0, 0 ), // 0 000 K
|
RGB( 0, 0, 0 ), // 0 000 K
|
||||||
RGB( 255, 0, 0 ), // 1 001 R
|
RGB( 255, 32, 32 ), // 1 001 R
|
||||||
RGB( 0, 255, 0 ), // 2 010 G
|
RGB( 0, 255, 0 ), // 2 010 G
|
||||||
RGB( 255, 255, 0 ), // 3 011 Y
|
RGB( 255, 255, 0 ), // 3 011 Y
|
||||||
RGB( 0, 0, 255 ), // 4 100 B
|
RGB( 64, 64, 255 ), // 4 100 B
|
||||||
RGB( 255, 0, 255 ), // 5 101 M
|
// RGB( 255, 0, 255 ), // 5 101 M Purple/Magenta is useless
|
||||||
|
RGB( 80, 192, 255 ),
|
||||||
RGB( 0, 255, 255 ), // 6 110 C
|
RGB( 0, 255, 255 ), // 6 110 C
|
||||||
RGB( 255, 255, 255 ), // 7 111 W
|
RGB( 255, 255, 255 ), // 7 111 W
|
||||||
};
|
RGB( 255, 128, 0 ), // 8 Orange
|
||||||
|
RGB( 128, 128, 128 ) // 9 Grey
|
||||||
const char * g_asConsoleColor[ MAX_CONSOLE_COLORS ] =
|
|
||||||
{
|
|
||||||
#if USE_APPLE_FONT
|
|
||||||
"`0", // ConsoleColorMake( sColorW, CONSOLE_COLOR_W );
|
|
||||||
"`1",
|
|
||||||
"`2",
|
|
||||||
"`3",
|
|
||||||
"`4",
|
|
||||||
"`5",
|
|
||||||
"`6",
|
|
||||||
"`7"
|
|
||||||
#else
|
|
||||||
"", // K
|
|
||||||
"", // R
|
|
||||||
"", // G
|
|
||||||
"", // Y
|
|
||||||
"", // B
|
|
||||||
"", // M
|
|
||||||
"", // C
|
|
||||||
"" // W
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Disassembly
|
// Disassembly
|
||||||
|
@ -196,7 +176,7 @@ static void SetupColorsHiLoBits ( bool bHiBit, bool bLoBit,
|
||||||
const int iBackground, const int iForeground,
|
const int iBackground, const int iForeground,
|
||||||
const int iColorHiBG , /*const int iColorHiFG,
|
const int iColorHiBG , /*const int iColorHiFG,
|
||||||
const int iColorLoBG , */const int iColorLoFG );
|
const int iColorLoBG , */const int iColorLoFG );
|
||||||
static char ColorizeSpecialChar( TCHAR * sText, BYTE nData, const MemoryView_e iView,
|
static char ColorizeSpecialChar( char * sText, BYTE nData, const MemoryView_e iView,
|
||||||
const int iTxtBackground = BG_INFO , const int iTxtForeground = FG_DISASM_CHAR,
|
const int iTxtBackground = BG_INFO , const int iTxtForeground = FG_DISASM_CHAR,
|
||||||
const int iHighBackground = BG_INFO_CHAR, const int iHighForeground = FG_INFO_CHAR_HI,
|
const int iHighBackground = BG_INFO_CHAR, const int iHighForeground = FG_INFO_CHAR_HI,
|
||||||
const int iLowBackground = BG_INFO_CHAR, const int iLowForeground = FG_INFO_CHAR_LO );
|
const int iLowBackground = BG_INFO_CHAR, const int iLowForeground = FG_INFO_CHAR_LO );
|
||||||
|
@ -674,37 +654,36 @@ void DebuggerPrint ( int x, int y, const char *pText )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DebuggerPrintColor( int x, int y, const char * pText )
|
void DebuggerPrintColor( int x, int y, const conchar_t * pText )
|
||||||
{
|
{
|
||||||
int nLeft = x;
|
int nLeft = x;
|
||||||
|
|
||||||
char c;
|
conchar_t g;
|
||||||
const char *p = pText;
|
const conchar_t *pSrc = pText;
|
||||||
|
|
||||||
while (c = *p)
|
while (g = (*pSrc))
|
||||||
{
|
{
|
||||||
if (c == '\n')
|
if (g == '\n')
|
||||||
{
|
{
|
||||||
x = nLeft;
|
x = nLeft;
|
||||||
y += CONSOLE_FONT_HEIGHT;
|
y += CONSOLE_FONT_HEIGHT;
|
||||||
p++;
|
pSrc++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if (ConsoleColor_IsMeta( c ))
|
if (ConsoleColor_IsColorOrMouse( g ))
|
||||||
{
|
{
|
||||||
if (ConsoleColor_IsColor( c ))
|
if (ConsoleColor_IsColor( g ))
|
||||||
{
|
{
|
||||||
DebuggerSetColorFG( ConsoleColor_GetColor( c ) );
|
DebuggerSetColorFG( ConsoleColor_GetColor( g ) );
|
||||||
p++;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
c = ConsoleColor_GetChar( c );
|
g = ConsoleChar_GetChar( g );
|
||||||
}
|
}
|
||||||
PrintGlyph( x, y, c );
|
|
||||||
|
PrintGlyph( x, y, (char) (g & _CONSOLE_COLOR_MASK) );
|
||||||
x += CONSOLE_FONT_WIDTH;
|
x += CONSOLE_FONT_WIDTH;
|
||||||
p++;
|
pSrc++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,7 +723,7 @@ int PrintText ( const char * pText, RECT & rRect )
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void PrintTextColor ( const char *pText, RECT & rRect )
|
void PrintTextColor ( const conchar_t *pText, RECT & rRect )
|
||||||
{
|
{
|
||||||
#if !DEBUG_FONT_NO_BACKGROUND_TEXT
|
#if !DEBUG_FONT_NO_BACKGROUND_TEXT
|
||||||
FillRect( g_hFrameDC, &rRect, g_hConsoleBrushBG );
|
FillRect( g_hFrameDC, &rRect, g_hConsoleBrushBG );
|
||||||
|
@ -878,20 +857,20 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB
|
||||||
|
|
||||||
if (nTarget < nBaseAddress)
|
if (nTarget < nBaseAddress)
|
||||||
{
|
{
|
||||||
wsprintf( sBranch_, TEXT("%s"), g_sConfigBranchIndicatorUp[ g_iConfigDisasmBranchType ] );
|
sprintf( sBranch_, "%s", g_sConfigBranchIndicatorUp[ g_iConfigDisasmBranchType ] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (nTarget > nBaseAddress)
|
if (nTarget > nBaseAddress)
|
||||||
{
|
{
|
||||||
wsprintf( sBranch_, TEXT("%s"), g_sConfigBranchIndicatorDown[ g_iConfigDisasmBranchType ] );
|
sprintf( sBranch_, "%s", g_sConfigBranchIndicatorDown[ g_iConfigDisasmBranchType ] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wsprintf( sBranch_, TEXT("%s"), g_sConfigBranchIndicatorEqual[ g_iConfigDisasmBranchType ] );
|
sprintf( sBranch_, "%s", g_sConfigBranchIndicatorEqual[ g_iConfigDisasmBranchType ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (_tcsstr(g_aOpmodes[ iOpmode ]._sFormat,TEXT("%s")))
|
// if (strstr(g_aOpmodes[ iOpmode ]._sFormat,"%s"))
|
||||||
// if ((iOpmode >= ADDR_ABS) && (iOpmode <= ADDR_IABS))
|
// if ((iOpmode >= ADDR_ABS) && (iOpmode <= ADDR_IABS))
|
||||||
if ((iOpmode == AM_A ) || // Absolute
|
if ((iOpmode == AM_A ) || // Absolute
|
||||||
(iOpmode == AM_Z ) || // Zeropage
|
(iOpmode == AM_Z ) || // Zeropage
|
||||||
|
@ -943,13 +922,13 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB
|
||||||
pTarget = FormatAddress( nTarget, nOpBytes );
|
pTarget = FormatAddress( nTarget, nOpBytes );
|
||||||
}
|
}
|
||||||
|
|
||||||
// wsprintf( sTarget, g_aOpmodes[ iOpmode ]._sFormat, pTarget );
|
// sprintf( sTarget, g_aOpmodes[ iOpmode ]._sFormat, pTarget );
|
||||||
if (bDisasmFormatFlags & DISASM_FORMAT_OFFSET)
|
if (bDisasmFormatFlags & DISASM_FORMAT_OFFSET)
|
||||||
{
|
{
|
||||||
int nAbsTargetOffset = (nTargetOffset_ > 0) ? nTargetOffset_ : -nTargetOffset_;
|
int nAbsTargetOffset = (nTargetOffset_ > 0) ? nTargetOffset_ : -nTargetOffset_;
|
||||||
wsprintf( sTargetOffset_, "%d", nAbsTargetOffset );
|
sprintf( sTargetOffset_, "%d", nAbsTargetOffset );
|
||||||
}
|
}
|
||||||
wsprintf( sTarget_, "%s", pTarget );
|
sprintf( sTarget_, "%s", pTarget );
|
||||||
|
|
||||||
|
|
||||||
// Indirect / Indexed
|
// Indirect / Indexed
|
||||||
|
@ -967,16 +946,16 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB
|
||||||
|
|
||||||
// if (((iOpmode >= AM_A) && (iOpmode <= AM_NZ)) && (iOpmode != AM_R))
|
// if (((iOpmode >= AM_A) && (iOpmode <= AM_NZ)) && (iOpmode != AM_R))
|
||||||
// nTargetBytes refers to size of pointer, not size of value
|
// nTargetBytes refers to size of pointer, not size of value
|
||||||
// wsprintf( sTargetValue_, "%04X", nTargetValue ); // & 0xFFFF
|
// sprintf( sTargetValue_, "%04X", nTargetValue ); // & 0xFFFF
|
||||||
|
|
||||||
if (g_iConfigDisasmTargets & DISASM_TARGET_ADDR)
|
if (g_iConfigDisasmTargets & DISASM_TARGET_ADDR)
|
||||||
wsprintf( sTargetPointer_, "%04X", nTargetPointer & 0xFFFF );
|
sprintf( sTargetPointer_, "%04X", nTargetPointer & 0xFFFF );
|
||||||
|
|
||||||
if (iOpmode != AM_NA ) // Indirect Absolute
|
if (iOpmode != AM_NA ) // Indirect Absolute
|
||||||
{
|
{
|
||||||
bDisasmFormatFlags |= DISASM_FORMAT_TARGET_VALUE;
|
bDisasmFormatFlags |= DISASM_FORMAT_TARGET_VALUE;
|
||||||
if (g_iConfigDisasmTargets & DISASM_TARGET_VAL)
|
if (g_iConfigDisasmTargets & DISASM_TARGET_VAL)
|
||||||
wsprintf( sTargetValue_, "%02X", nTargetValue & 0xFF );
|
sprintf( sTargetValue_, "%02X", nTargetValue & 0xFF );
|
||||||
|
|
||||||
bDisasmFormatFlags |= DISASM_FORMAT_CHAR;
|
bDisasmFormatFlags |= DISASM_FORMAT_CHAR;
|
||||||
nImmediate_ = (BYTE) nTargetValue;
|
nImmediate_ = (BYTE) nTargetValue;
|
||||||
|
@ -989,22 +968,22 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB
|
||||||
if (ConsoleColorIsEscapeMeta( _char ))
|
if (ConsoleColorIsEscapeMeta( _char ))
|
||||||
sprintf( sImmediate_, "%c%c", _char, _char );
|
sprintf( sImmediate_, "%c%c", _char, _char );
|
||||||
else
|
else
|
||||||
wsprintf( sImmediate_, "%c", _char );
|
sprintf( sImmediate_, "%c", _char );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (iOpmode == AM_NA ) // Indirect Absolute
|
// if (iOpmode == AM_NA ) // Indirect Absolute
|
||||||
// wsprintf( sTargetValue_, "%04X", nTargetPointer & 0xFFFF );
|
// sprintf( sTargetValue_, "%04X", nTargetPointer & 0xFFFF );
|
||||||
// else
|
// else
|
||||||
// // wsprintf( sTargetValue_, "%02X", nTargetValue & 0xFF );
|
// // sprintf( sTargetValue_, "%02X", nTargetValue & 0xFF );
|
||||||
// wsprintf( sTargetValue_, "%04X:%02X", nTargetPointer & 0xFFFF, nTargetValue & 0xFF );
|
// sprintf( sTargetValue_, "%04X:%02X", nTargetPointer & 0xFFFF, nTargetValue & 0xFF );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (iOpmode == AM_M)
|
if (iOpmode == AM_M)
|
||||||
{
|
{
|
||||||
// wsprintf( sTarget, g_aOpmodes[ iOpmode ]._sFormat, (unsigned)nTarget );
|
// sprintf( sTarget, g_aOpmodes[ iOpmode ]._sFormat, (unsigned)nTarget );
|
||||||
wsprintf( sTarget_, "%02X", (unsigned)nTarget );
|
sprintf( sTarget_, "%02X", (unsigned)nTarget );
|
||||||
|
|
||||||
if (iOpmode == AM_M)
|
if (iOpmode == AM_M)
|
||||||
{
|
{
|
||||||
|
@ -1017,31 +996,31 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB
|
||||||
if (ConsoleColorIsEscapeMeta( _char ))
|
if (ConsoleColorIsEscapeMeta( _char ))
|
||||||
sprintf( sImmediate_, "%c%c", _char, _char );
|
sprintf( sImmediate_, "%c%c", _char, _char );
|
||||||
else
|
else
|
||||||
wsprintf( sImmediate_, "%c", _char );
|
sprintf( sImmediate_, "%c", _char );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wsprintf( sAddress_, "%04X", nBaseAddress );
|
sprintf( sAddress_, "%04X", nBaseAddress );
|
||||||
|
|
||||||
// Opcode Bytes
|
// Opcode Bytes
|
||||||
TCHAR *pDst = sOpCodes_;
|
char *pDst = sOpCodes_;
|
||||||
for( int iBytes = 0; iBytes < nOpBytes; iBytes++ )
|
for( int iBytes = 0; iBytes < nOpBytes; iBytes++ )
|
||||||
{
|
{
|
||||||
BYTE nMem = (unsigned)*(mem+nBaseAddress+iBytes);
|
BYTE nMem = (unsigned)*(mem+nBaseAddress+iBytes);
|
||||||
wsprintf( pDst, TEXT("%02X"), nMem ); // sBytes+_tcslen(sBytes)
|
sprintf( pDst, "%02X", nMem ); // sBytes+strlen(sBytes)
|
||||||
pDst += 2;
|
pDst += 2;
|
||||||
|
|
||||||
if (g_bConfigDisasmOpcodeSpaces)
|
if (g_bConfigDisasmOpcodeSpaces)
|
||||||
{
|
{
|
||||||
_tcscat( pDst, TEXT(" " ) );
|
strcat( pDst, " " );
|
||||||
pDst++; // 2.5.3.3 fix
|
pDst++; // 2.5.3.3 fix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (_tcslen(sOpCodes_) < nMinBytesLen)
|
while (strlen(sOpCodes_) < nMinBytesLen)
|
||||||
{
|
{
|
||||||
_tcscat( sOpCodes_, TEXT(" ") );
|
strcat( sOpCodes_, " " );
|
||||||
}
|
}
|
||||||
|
|
||||||
return bDisasmFormatFlags;
|
return bDisasmFormatFlags;
|
||||||
|
@ -1080,7 +1059,7 @@ void SetupColorsHiLoBits ( bool bHighBit, bool bCtrlBit,
|
||||||
|
|
||||||
// To flush out color bugs... swap: iAsciBackground & iHighBackground
|
// To flush out color bugs... swap: iAsciBackground & iHighBackground
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
char ColorizeSpecialChar( TCHAR * sText, BYTE nData, const MemoryView_e iView,
|
char ColorizeSpecialChar( char * sText, BYTE nData, const MemoryView_e iView,
|
||||||
const int iAsciBackground /*= 0 */, const int iTextForeground /*= FG_DISASM_CHAR */,
|
const int iAsciBackground /*= 0 */, const int iTextForeground /*= FG_DISASM_CHAR */,
|
||||||
const int iHighBackground /*= BG_INFO_CHAR*/, const int iHighForeground /*= FG_INFO_CHAR_HI*/,
|
const int iHighBackground /*= BG_INFO_CHAR*/, const int iHighForeground /*= FG_INFO_CHAR_HI*/,
|
||||||
const int iCtrlBackground /*= BG_INFO_CHAR*/, const int iCtrlForeground /*= FG_INFO_CHAR_LO*/ )
|
const int iCtrlBackground /*= BG_INFO_CHAR*/, const int iCtrlForeground /*= FG_INFO_CHAR_LO*/ )
|
||||||
|
@ -1166,7 +1145,7 @@ void DrawBreakpoints ( int line )
|
||||||
rect.bottom = rect.top + g_nFontHeight;
|
rect.bottom = rect.top + g_nFontHeight;
|
||||||
|
|
||||||
const int MAX_BP_LEN = 16;
|
const int MAX_BP_LEN = 16;
|
||||||
TCHAR sText[16] = TEXT("Breakpoints"); // TODO: Move to BP1
|
char sText[16] = "Breakpoints"; // TODO: Move to BP1
|
||||||
|
|
||||||
#if DISPLAY_BREAKPOINT_TITLE
|
#if DISPLAY_BREAKPOINT_TITLE
|
||||||
DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA
|
DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA
|
||||||
|
@ -1211,16 +1190,16 @@ void DrawBreakpoints ( int line )
|
||||||
|
|
||||||
DebuggerSetColorBG( DebuggerGetColor( BG_INFO ));
|
DebuggerSetColorBG( DebuggerGetColor( BG_INFO ));
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) );
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) );
|
||||||
wsprintf( sText, "B" );
|
sprintf( sText, "B" );
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
DebuggerSetColorBG( DebuggerGetColor( BG_INFO ));
|
DebuggerSetColorBG( DebuggerGetColor( BG_INFO ));
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET ) );
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET ) );
|
||||||
wsprintf( sText, "%X ", iBreakpoint );
|
sprintf( sText, "%X ", iBreakpoint );
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
// DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ) );
|
// DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ) );
|
||||||
// _tcscpy( sText, TEXT(".") );
|
// strcpy( sText, "." );
|
||||||
// PrintTextCursorX( sText, rect2 );
|
// PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
#if DEBUG_FORCE_DISPLAY
|
#if DEBUG_FORCE_DISPLAY
|
||||||
|
@ -1280,7 +1259,7 @@ void DrawBreakpoints ( int line )
|
||||||
DebuggerSetColorFG( nColor );
|
DebuggerSetColorFG( nColor );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wsprintf( sText, TEXT("%04X"), nAddress1 );
|
sprintf( sText, "%04X", nAddress1 );
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
if (nLength > 1)
|
if (nLength > 1)
|
||||||
|
@ -1290,7 +1269,7 @@ void DrawBreakpoints ( int line )
|
||||||
|
|
||||||
// if (g_bConfigDisasmOpcodeSpaces)
|
// if (g_bConfigDisasmOpcodeSpaces)
|
||||||
// {
|
// {
|
||||||
// PrintTextCursorX( TEXT(" "), rect2 );
|
// PrintTextCursorX( " ", rect2 );
|
||||||
// rect2.left += g_nFontWidthAvg;
|
// rect2.left += g_nFontWidthAvg;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -1313,7 +1292,7 @@ void DrawBreakpoints ( int line )
|
||||||
}
|
}
|
||||||
DebuggerSetColorFG( nColor );
|
DebuggerSetColorFG( nColor );
|
||||||
#endif
|
#endif
|
||||||
wsprintf( sText, TEXT("%04X"), nAddress2 );
|
sprintf( sText, "%04X", nAddress2 );
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1321,7 +1300,7 @@ void DrawBreakpoints ( int line )
|
||||||
// Windows HACK: Bugfix: Rest of line is still breakpoint background color
|
// Windows HACK: Bugfix: Rest of line is still breakpoint background color
|
||||||
DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA
|
DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC
|
||||||
PrintTextCursorX( TEXT(" "), rect2 );
|
PrintTextCursorX( " ", rect2 );
|
||||||
#endif
|
#endif
|
||||||
rect.top += g_nFontHeight;
|
rect.top += g_nFontHeight;
|
||||||
rect.bottom += g_nFontHeight;
|
rect.bottom += g_nFontHeight;
|
||||||
|
@ -1379,11 +1358,28 @@ void DrawConsoleCursor ()
|
||||||
rect.left = (g_nConsoleInputChars + g_nConsolePromptLen) * nWidth;
|
rect.left = (g_nConsoleInputChars + g_nConsolePromptLen) * nWidth;
|
||||||
rect.top = GetConsoleTopPixels( y );
|
rect.top = GetConsoleTopPixels( y );
|
||||||
rect.bottom = rect.top + nLineHeight; //g_nFontHeight;
|
rect.bottom = rect.top + nLineHeight; //g_nFontHeight;
|
||||||
rect.right = rect.left + nWidth;
|
rect.right = rect.left + nWidth;
|
||||||
|
|
||||||
PrintText( g_sConsoleCursor, rect );
|
PrintText( g_sConsoleCursor, rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
void GetConsoleRect( const int y, RECT & rect )
|
||||||
|
{
|
||||||
|
int nLineHeight = GetConsoleLineHeightPixels();
|
||||||
|
|
||||||
|
rect.left = 0;
|
||||||
|
rect.top = GetConsoleTopPixels( y );
|
||||||
|
rect.bottom = rect.top + nLineHeight; //g_nFontHeight;
|
||||||
|
|
||||||
|
// int nHeight = WindowGetHeight( g_iWindowThis );
|
||||||
|
|
||||||
|
int nFontWidth = g_aFontConfig[ FONT_CONSOLE ]._nFontWidthAvg;
|
||||||
|
int nMiniConsoleRight = g_nConsoleDisplayWidth * nFontWidth;
|
||||||
|
int nFullConsoleRight = DISPLAY_WIDTH;
|
||||||
|
int nRight = g_bConsoleFullWidth ? nFullConsoleRight : nMiniConsoleRight;
|
||||||
|
rect.right = nRight;
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void DrawConsoleLine( const conchar_t * pText, int y )
|
void DrawConsoleLine( const conchar_t * pText, int y )
|
||||||
|
@ -1391,33 +1387,25 @@ void DrawConsoleLine( const conchar_t * pText, int y )
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// int nHeight = WindowGetHeight( g_iWindowThis );
|
|
||||||
int nLineHeight = GetConsoleLineHeightPixels();
|
|
||||||
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
rect.left = 0;
|
GetConsoleRect( y, rect );
|
||||||
rect.top = GetConsoleTopPixels( y );
|
|
||||||
rect.bottom = rect.top + nLineHeight; //g_nFontHeight;
|
|
||||||
|
|
||||||
int nFontWidth = g_aFontConfig[ FONT_CONSOLE ]._nFontWidthAvg;
|
|
||||||
int nMiniConsoleRight = g_nConsoleDisplayWidth * nFontWidth;
|
|
||||||
int nFullConsoleRight = DISPLAY_WIDTH;
|
|
||||||
int nRight = g_bConsoleFullWidth ? nFullConsoleRight : nMiniConsoleRight;
|
|
||||||
rect.right = nRight;
|
|
||||||
|
|
||||||
// Console background is drawn in DrawWindowBackground_Info
|
// Console background is drawn in DrawWindowBackground_Info
|
||||||
PrintTextColor( (char*) pText, rect );
|
PrintTextColor( pText, rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void DrawConsoleInput() // HDC dc )
|
void DrawConsoleInput ()
|
||||||
{
|
{
|
||||||
// g_hDC = dc;
|
|
||||||
|
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_CONSOLE_INPUT ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_CONSOLE_INPUT ));
|
||||||
DebuggerSetColorBG( DebuggerGetColor( BG_CONSOLE_INPUT ));
|
DebuggerSetColorBG( DebuggerGetColor( BG_CONSOLE_INPUT ));
|
||||||
|
|
||||||
DrawConsoleLine( g_aConsoleInput, 0 );
|
RECT rect;
|
||||||
|
GetConsoleRect( 0, rect );
|
||||||
|
|
||||||
|
// Console background is drawn in DrawWindowBackground_Info
|
||||||
|
// DrawConsoleLine( g_aConsoleInput, 0 );
|
||||||
|
PrintText( g_aConsoleInput, rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1445,19 +1433,19 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
|
|
||||||
const int CHARS_FOR_ADDRESS = 8; // 4 digits plus null
|
const int CHARS_FOR_ADDRESS = 8; // 4 digits plus null
|
||||||
|
|
||||||
TCHAR sAddress [ CHARS_FOR_ADDRESS ];
|
char sAddress [ CHARS_FOR_ADDRESS ];
|
||||||
TCHAR sOpcodes [(nMaxOpcodes*3)+1] = TEXT("");
|
char sOpcodes [(nMaxOpcodes*3)+1] = "";
|
||||||
TCHAR sTarget [nMaxAddressLen] = TEXT("");
|
char sTarget [nMaxAddressLen] = "";
|
||||||
|
|
||||||
TCHAR sTargetOffset[ CHARS_FOR_ADDRESS ] = TEXT(""); // +/- 255, realistically +/-1
|
char sTargetOffset[ CHARS_FOR_ADDRESS ] = ""; // +/- 255, realistically +/-1
|
||||||
int nTargetOffset;
|
int nTargetOffset;
|
||||||
|
|
||||||
TCHAR sTargetPointer[ CHARS_FOR_ADDRESS ] = TEXT("");
|
char sTargetPointer[ CHARS_FOR_ADDRESS ] = "";
|
||||||
TCHAR sTargetValue [ CHARS_FOR_ADDRESS ] = TEXT("");
|
char sTargetValue [ CHARS_FOR_ADDRESS ] = "";
|
||||||
|
|
||||||
char nImmediate = 0;
|
char nImmediate = 0;
|
||||||
TCHAR sImmediate[ 4 ]; // 'c'
|
char sImmediate[ 4 ]; // 'c'
|
||||||
TCHAR sBranch [ 4 ]; // ^
|
char sBranch [ 4 ]; // ^
|
||||||
|
|
||||||
bool bTargetIndirect = false;
|
bool bTargetIndirect = false;
|
||||||
bool bTargetX = false;
|
bool bTargetX = false;
|
||||||
|
@ -1679,11 +1667,11 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
|
|
||||||
if (! bCursorLine)
|
if (! bCursorLine)
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPCODE ) );
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPCODE ) );
|
||||||
// PrintTextCursorX( TEXT(" "), linerect );
|
// PrintTextCursorX( " ", linerect );
|
||||||
|
|
||||||
if (g_bConfigDisasmOpcodesView)
|
if (g_bConfigDisasmOpcodesView)
|
||||||
PrintTextCursorX( (LPCTSTR) sOpcodes, linerect );
|
PrintTextCursorX( (LPCTSTR) sOpcodes, linerect );
|
||||||
// PrintTextCursorX( TEXT(" "), linerect );
|
// PrintTextCursorX( " ", linerect );
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
linerect.left = (int) aTabs[ TS_LABEL ];
|
linerect.left = (int) aTabs[ TS_LABEL ];
|
||||||
|
@ -1696,7 +1684,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
PrintTextCursorX( pSymbol, linerect );
|
PrintTextCursorX( pSymbol, linerect );
|
||||||
}
|
}
|
||||||
// linerect.left += (g_nFontWidthAvg * DISASM_SYMBOL_LEN);
|
// linerect.left += (g_nFontWidthAvg * DISASM_SYMBOL_LEN);
|
||||||
// PrintTextCursorX( TEXT(" "), linerect );
|
// PrintTextCursorX( " ", linerect );
|
||||||
|
|
||||||
// Instruction
|
// Instruction
|
||||||
linerect.left = (int) aTabs[ TS_INSTRUCTION ];
|
linerect.left = (int) aTabs[ TS_INSTRUCTION ];
|
||||||
|
@ -1707,21 +1695,21 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
LPCTSTR pMnemonic = g_aOpcodes[ iOpcode ].sMnemonic;
|
LPCTSTR pMnemonic = g_aOpcodes[ iOpcode ].sMnemonic;
|
||||||
PrintTextCursorX( pMnemonic, linerect );
|
PrintTextCursorX( pMnemonic, linerect );
|
||||||
|
|
||||||
PrintTextCursorX( TEXT(" "), linerect );
|
PrintTextCursorX( " ", linerect );
|
||||||
|
|
||||||
// Target
|
// Target
|
||||||
if (iOpmode == AM_M)
|
if (iOpmode == AM_M)
|
||||||
{
|
{
|
||||||
if (! bCursorLine)
|
if (! bCursorLine)
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
||||||
PrintTextCursorX( TEXT("#$"), linerect );
|
PrintTextCursorX( "#$", linerect );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bTargetIndirect)
|
if (bTargetIndirect)
|
||||||
{
|
{
|
||||||
if (! bCursorLine)
|
if (! bCursorLine)
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
||||||
PrintTextCursorX( TEXT("("), linerect );
|
PrintTextCursorX( "(", linerect );
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pTarget = sTarget;
|
char *pTarget = sTarget;
|
||||||
|
@ -1730,7 +1718,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
pTarget++;
|
pTarget++;
|
||||||
if (! bCursorLine)
|
if (! bCursorLine)
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
||||||
PrintTextCursorX( TEXT("$"), linerect );
|
PrintTextCursorX( "$", linerect );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! bCursorLine)
|
if (! bCursorLine)
|
||||||
|
@ -1753,7 +1741,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PrintTextCursorX( pTarget, linerect );
|
PrintTextCursorX( pTarget, linerect );
|
||||||
// PrintTextCursorX( TEXT(" "), linerect );
|
// PrintTextCursorX( " ", linerect );
|
||||||
|
|
||||||
// Target Offset +/-
|
// Target Offset +/-
|
||||||
if (bDisasmFormatFlags & DISASM_FORMAT_OFFSET)
|
if (bDisasmFormatFlags & DISASM_FORMAT_OFFSET)
|
||||||
|
@ -1762,9 +1750,9 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
||||||
|
|
||||||
if (nTargetOffset > 0)
|
if (nTargetOffset > 0)
|
||||||
PrintTextCursorX( TEXT("+" ), linerect );
|
PrintTextCursorX( "+", linerect );
|
||||||
if (nTargetOffset < 0)
|
if (nTargetOffset < 0)
|
||||||
PrintTextCursorX( TEXT("-" ), linerect );
|
PrintTextCursorX( "-", linerect );
|
||||||
|
|
||||||
if (! bCursorLine)
|
if (! bCursorLine)
|
||||||
{
|
{
|
||||||
|
@ -1779,16 +1767,34 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
||||||
|
|
||||||
if (bTargetX)
|
if (bTargetX)
|
||||||
PrintTextCursorX( TEXT(",X"), linerect );
|
{
|
||||||
|
PrintTextCursorX( ",", linerect );
|
||||||
|
if (! bCursorLine)
|
||||||
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_REG ) );
|
||||||
|
PrintTextCursorX( "X", linerect );
|
||||||
|
}
|
||||||
|
|
||||||
if (bTargetY)
|
if (bTargetY)
|
||||||
PrintTextCursorX( TEXT(",Y"), linerect );
|
{
|
||||||
|
PrintTextCursorX( ",", linerect );
|
||||||
|
if (! bCursorLine)
|
||||||
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_REG ) );
|
||||||
|
PrintTextCursorX( "Y", linerect );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! bCursorLine)
|
||||||
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
||||||
|
|
||||||
if (bTargetIndirect)
|
if (bTargetIndirect)
|
||||||
PrintTextCursorX( TEXT(")"), linerect );
|
PrintTextCursorX( ")", linerect );
|
||||||
|
|
||||||
if (iOpmode == AM_NZY)
|
if (iOpmode == AM_NZY)
|
||||||
PrintTextCursorX( TEXT(",Y"), linerect );
|
{
|
||||||
|
PrintTextCursorX( ",", linerect );
|
||||||
|
if (! bCursorLine)
|
||||||
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_REG ) );
|
||||||
|
PrintTextCursorX( "Y", linerect );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Memory Pointer and Value
|
// Memory Pointer and Value
|
||||||
|
@ -1796,7 +1802,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
{
|
{
|
||||||
linerect.left = (int) aTabs[ TS_IMMEDIATE ]; // TS_IMMEDIATE ];
|
linerect.left = (int) aTabs[ TS_IMMEDIATE ]; // TS_IMMEDIATE ];
|
||||||
|
|
||||||
// PrintTextCursorX( TEXT(" "), linerect );
|
// PrintTextCursorX( " ", linerect );
|
||||||
|
|
||||||
if (! bCursorLine)
|
if (! bCursorLine)
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS ));
|
||||||
|
@ -1815,7 +1821,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPCODE ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPCODE ));
|
||||||
|
|
||||||
PrintTextCursorX( sTargetValue, linerect );
|
PrintTextCursorX( sTargetValue, linerect );
|
||||||
PrintTextCursorX( TEXT(" "), linerect );
|
PrintTextCursorX( " ", linerect );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1830,7 +1836,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (! (bDisasmFormatFlags & DISASM_FORMAT_TARGET_POINTER))
|
// if (! (bDisasmFormatFlags & DISASM_FORMAT_TARGET_POINTER))
|
||||||
// PrintTextCursorX( TEXT("'"), linerect ); // TEXT(" '")
|
// PrintTextCursorX( "'", linerect );
|
||||||
|
|
||||||
if (! bCursorLine)
|
if (! bCursorLine)
|
||||||
{
|
{
|
||||||
|
@ -1846,7 +1852,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (! (bDisasmFormatFlags & DISASM_FORMAT_TARGET_POINTER))
|
// if (! (bDisasmFormatFlags & DISASM_FORMAT_TARGET_POINTER))
|
||||||
// PrintTextCursorX( TEXT("'"), linerect );
|
// PrintTextCursorX( "'", linerect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Branch Indicator
|
// Branch Indicator
|
||||||
|
@ -1864,7 +1870,8 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text)
|
||||||
SelectObject( g_hFrameDC, g_aFontConfig[ FONT_DISASM_BRANCH ]._hFont ); // g_hFontWebDings
|
SelectObject( g_hFrameDC, g_aFontConfig[ FONT_DISASM_BRANCH ]._hFont ); // g_hFontWebDings
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PrintTextColor( sBranch, linerect );
|
// PrintTextColor( sBranch, linerect );
|
||||||
|
PrintText( sBranch, linerect );
|
||||||
|
|
||||||
#if !USE_APPLE_FONT
|
#if !USE_APPLE_FONT
|
||||||
if (g_iConfigDisasmBranchType)
|
if (g_iConfigDisasmBranchType)
|
||||||
|
@ -1884,8 +1891,8 @@ void DrawFlags ( int line, WORD nRegFlags, LPTSTR pFlagNames_)
|
||||||
if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA))))
|
if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA))))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TCHAR sFlagNames[ _6502_NUM_FLAGS+1 ] = TEXT(""); // = TEXT("NVRBDIZC"); // copy from g_aFlagNames
|
char sFlagNames[ _6502_NUM_FLAGS+1 ] = ""; // = "NVRBDIZC"; // copy from g_aFlagNames
|
||||||
TCHAR sText[4] = TEXT("?");
|
char sText[4] = "?";
|
||||||
RECT rect;
|
RECT rect;
|
||||||
|
|
||||||
int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg;
|
int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg;
|
||||||
|
@ -1969,7 +1976,7 @@ void DrawFlags ( int line, WORD nRegFlags, LPTSTR pFlagNames_)
|
||||||
{
|
{
|
||||||
if (! bSet) //(nFlags & 1))
|
if (! bSet) //(nFlags & 1))
|
||||||
{
|
{
|
||||||
sFlagNames[nFlag] = TEXT('.');
|
sFlagNames[nFlag] = '.';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1981,7 +1988,7 @@ void DrawFlags ( int line, WORD nRegFlags, LPTSTR pFlagNames_)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pFlagNames_)
|
if (pFlagNames_)
|
||||||
_tcscpy(pFlagNames_,sFlagNames);
|
strcpy(pFlagNames_,sFlagNames);
|
||||||
/*
|
/*
|
||||||
if (g_hFrameDC)
|
if (g_hFrameDC)
|
||||||
{
|
{
|
||||||
|
@ -2034,11 +2041,11 @@ void DrawMemory ( int line, int iMemDump )
|
||||||
rect2 = rect;
|
rect2 = rect;
|
||||||
|
|
||||||
const int MAX_MEM_VIEW_TXT = 16;
|
const int MAX_MEM_VIEW_TXT = 16;
|
||||||
TCHAR sText[ MAX_MEM_VIEW_TXT * 2 ];
|
char sText[ MAX_MEM_VIEW_TXT * 2 ];
|
||||||
TCHAR sData[ MAX_MEM_VIEW_TXT * 2 ];
|
char sData[ MAX_MEM_VIEW_TXT * 2 ];
|
||||||
|
|
||||||
TCHAR sType [ 4 ] = TEXT("Mem");
|
char sType [ 4 ] = "Mem";
|
||||||
TCHAR sAddress[ 8 ] = TEXT("");
|
char sAddress[ 8 ] = "";
|
||||||
|
|
||||||
int iForeground = FG_INFO_OPCODE;
|
int iForeground = FG_INFO_OPCODE;
|
||||||
int iBackground = BG_INFO;
|
int iBackground = BG_INFO;
|
||||||
|
@ -2046,25 +2053,25 @@ void DrawMemory ( int line, int iMemDump )
|
||||||
#if DISPLAY_MEMORY_TITLE
|
#if DISPLAY_MEMORY_TITLE
|
||||||
if (eDevice == DEV_SY6522)
|
if (eDevice == DEV_SY6522)
|
||||||
{
|
{
|
||||||
// wsprintf(sData,TEXT("Mem at SY#%d"), nAddr);
|
// sprintf(sData,"Mem at SY#%d", nAddr);
|
||||||
wsprintf( sAddress,TEXT("SY#%d"), nAddr );
|
sprintf( sAddress,"SY#%d", nAddr );
|
||||||
}
|
}
|
||||||
else if(eDevice == DEV_AY8910)
|
else if(eDevice == DEV_AY8910)
|
||||||
{
|
{
|
||||||
// wsprintf(sData,TEXT("Mem at AY#%d"), nAddr);
|
// sprintf(sData,"Mem at AY#%d", nAddr);
|
||||||
wsprintf( sAddress,TEXT("AY#%d"), nAddr );
|
sprintf( sAddress,"AY#%d", nAddr );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wsprintf( sAddress,TEXT("%04X"),(unsigned)nAddr);
|
sprintf( sAddress,"%04X",(unsigned)nAddr);
|
||||||
|
|
||||||
if (iView == MEM_VIEW_HEX)
|
if (iView == MEM_VIEW_HEX)
|
||||||
wsprintf( sType, TEXT("HEX") );
|
sprintf( sType, "HEX" );
|
||||||
else
|
else
|
||||||
if (iView == MEM_VIEW_ASCII)
|
if (iView == MEM_VIEW_ASCII)
|
||||||
wsprintf( sType, TEXT("ASCII") );
|
sprintf( sType, "ASCII" );
|
||||||
else
|
else
|
||||||
wsprintf( sType, TEXT("TEXT") );
|
sprintf( sType, "TEXT" );
|
||||||
}
|
}
|
||||||
|
|
||||||
rect2 = rect;
|
rect2 = rect;
|
||||||
|
@ -2073,7 +2080,7 @@ void DrawMemory ( int line, int iMemDump )
|
||||||
PrintTextCursorX( sType, rect2 );
|
PrintTextCursorX( sType, rect2 );
|
||||||
|
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ));
|
||||||
PrintTextCursorX( TEXT(" at " ), rect2 );
|
PrintTextCursorX( " at ", rect2 );
|
||||||
|
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ));
|
||||||
PrintTextCursorY( sAddress, rect2 );
|
PrintTextCursorY( sAddress, rect2 );
|
||||||
|
@ -2110,7 +2117,7 @@ void DrawMemory ( int line, int iMemDump )
|
||||||
|
|
||||||
if (iView == MEM_VIEW_HEX)
|
if (iView == MEM_VIEW_HEX)
|
||||||
{
|
{
|
||||||
wsprintf( sText, TEXT("%04X"), iAddress );
|
sprintf( sText, "%04X", iAddress );
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ));
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
|
@ -2129,12 +2136,12 @@ void DrawMemory ( int line, int iMemDump )
|
||||||
// .12 Bugfix: DrawMemory() should draw memory byte for IO address: ML1 C000
|
// .12 Bugfix: DrawMemory() should draw memory byte for IO address: ML1 C000
|
||||||
// if ((iAddress >= _6502_IO_BEGIN) && (iAddress <= _6502_IO_END))
|
// if ((iAddress >= _6502_IO_BEGIN) && (iAddress <= _6502_IO_END))
|
||||||
// {
|
// {
|
||||||
// wsprintf( sText, TEXT("IO ") );
|
// sprintf( sText, "IO " );
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
if (eDevice == DEV_SY6522)
|
if (eDevice == DEV_SY6522)
|
||||||
{
|
{
|
||||||
wsprintf( sText, TEXT("%02X"), (unsigned) ((BYTE*)&SS_MB.Unit[nAddr & 1].RegsSY6522)[iAddress] );
|
sprintf( sText, "%02X", (unsigned) ((BYTE*)&SS_MB.Unit[nAddr & 1].RegsSY6522)[iAddress] );
|
||||||
if (iCol & 1)
|
if (iCol & 1)
|
||||||
DebuggerSetColorFG( DebuggerGetColor( iForeground ));
|
DebuggerSetColorFG( DebuggerGetColor( iForeground ));
|
||||||
else
|
else
|
||||||
|
@ -2143,7 +2150,7 @@ void DrawMemory ( int line, int iMemDump )
|
||||||
else
|
else
|
||||||
if (eDevice == DEV_AY8910)
|
if (eDevice == DEV_AY8910)
|
||||||
{
|
{
|
||||||
wsprintf( sText, TEXT("%02X"), (unsigned)SS_MB.Unit[nAddr & 1].RegsAY8910[iAddress] );
|
sprintf( sText, "%02X", (unsigned)SS_MB.Unit[nAddr & 1].RegsAY8910[iAddress] );
|
||||||
if (iCol & 1)
|
if (iCol & 1)
|
||||||
DebuggerSetColorFG( DebuggerGetColor( iForeground ));
|
DebuggerSetColorFG( DebuggerGetColor( iForeground ));
|
||||||
else
|
else
|
||||||
|
@ -2162,7 +2169,7 @@ void DrawMemory ( int line, int iMemDump )
|
||||||
{
|
{
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_IO_BYTE ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_IO_BYTE ));
|
||||||
}
|
}
|
||||||
wsprintf(sText, TEXT("%02X "), nData );
|
sprintf(sText, "%02X ", nData );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2179,7 +2186,7 @@ void DrawMemory ( int line, int iMemDump )
|
||||||
// Windows HACK: Bugfix: Rest of line is still background color
|
// Windows HACK: Bugfix: Rest of line is still background color
|
||||||
// DebuggerSetColorBG( hDC, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA
|
// DebuggerSetColorBG( hDC, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA
|
||||||
// DebuggerSetColorFG(hDC, DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC
|
// DebuggerSetColorFG(hDC, DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC
|
||||||
// PrintTextCursorX( TEXT(" "), rect2 );
|
// PrintTextCursorX( " ", rect2 );
|
||||||
|
|
||||||
rect.top += g_nFontHeight;
|
rect.top += g_nFontHeight;
|
||||||
rect.bottom += g_nFontHeight;
|
rect.bottom += g_nFontHeight;
|
||||||
|
@ -2224,12 +2231,12 @@ void DrawRegister ( int line, LPCTSTR name, const int nBytes, const WORD nValue,
|
||||||
unsigned int nData = nValue;
|
unsigned int nData = nValue;
|
||||||
int nOffset = 6;
|
int nOffset = 6;
|
||||||
|
|
||||||
TCHAR sValue[8];
|
char sValue[8];
|
||||||
|
|
||||||
if (PARAM_REG_SP == iSource)
|
if (PARAM_REG_SP == iSource)
|
||||||
{
|
{
|
||||||
WORD nStackDepth = _6502_STACK_END - nValue;
|
WORD nStackDepth = _6502_STACK_END - nValue;
|
||||||
wsprintf( sValue, "%02X", nStackDepth );
|
sprintf( sValue, "%02X", nStackDepth );
|
||||||
int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg;
|
int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg;
|
||||||
rect.left += (2 * nFontWidth) + (nFontWidth >> 1); // 2.5 looks a tad nicer then 2
|
rect.left += (2 * nFontWidth) + (nFontWidth >> 1); // 2.5 looks a tad nicer then 2
|
||||||
|
|
||||||
|
@ -2240,7 +2247,7 @@ void DrawRegister ( int line, LPCTSTR name, const int nBytes, const WORD nValue,
|
||||||
|
|
||||||
if (nBytes == 2)
|
if (nBytes == 2)
|
||||||
{
|
{
|
||||||
wsprintf(sValue,TEXT("%04X"), nData);
|
sprintf(sValue,"%04X", nData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2258,7 +2265,7 @@ void DrawRegister ( int line, LPCTSTR name, const int nBytes, const WORD nValue,
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ));
|
||||||
PrintTextCursorX( "'", rect ); // PrintTextCursorX()
|
PrintTextCursorX( "'", rect ); // PrintTextCursorX()
|
||||||
|
|
||||||
wsprintf(sValue,TEXT(" %02X"), nData );
|
sprintf(sValue," %02X", nData );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needs to be far enough over, since 4 chars of ZeroPage symbol also calls us
|
// Needs to be far enough over, since 4 chars of ZeroPage symbol also calls us
|
||||||
|
@ -2279,30 +2286,28 @@ void DrawRegister ( int line, LPCTSTR name, const int nBytes, const WORD nValue,
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
void DrawSourceLine( int iSourceLine, RECT &rect )
|
void DrawSourceLine( int iSourceLine, RECT &rect )
|
||||||
{
|
{
|
||||||
TCHAR sLine[ CONSOLE_WIDTH ];
|
char sLine[ CONSOLE_WIDTH ];
|
||||||
|
|
||||||
ZeroMemory( sLine, CONSOLE_WIDTH );
|
ZeroMemory( sLine, CONSOLE_WIDTH );
|
||||||
|
|
||||||
if ((iSourceLine >=0) && (iSourceLine < g_AssemblerSourceBuffer.GetNumLines() ))
|
if ((iSourceLine >=0) && (iSourceLine < g_AssemblerSourceBuffer.GetNumLines() ))
|
||||||
{
|
{
|
||||||
char * pSource = g_AssemblerSourceBuffer.GetLine( iSourceLine );
|
char * pSource = g_AssemblerSourceBuffer.GetLine( iSourceLine );
|
||||||
|
|
||||||
// int nLenSrc = _tcslen( pSource );
|
// int nLenSrc = strlen( pSource );
|
||||||
// if (nLenSrc >= CONSOLE_WIDTH)
|
// if (nLenSrc >= CONSOLE_WIDTH)
|
||||||
// bool bStop = true;
|
// bool bStop = true;
|
||||||
|
|
||||||
TextConvertTabsToSpaces( sLine, pSource, CONSOLE_WIDTH-1 ); // bugfix 2,3,1,15: fence-post error, buffer over-run
|
TextConvertTabsToSpaces( sLine, pSource, CONSOLE_WIDTH-1 ); // bugfix 2,3,1,15: fence-post error, buffer over-run
|
||||||
|
|
||||||
// int nLenTab = _tcslen( sLine );
|
// int nLenTab = strlen( sLine );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_tcscpy( sLine, TEXT(" "));
|
strcpy( sLine, " " );
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintText( sLine, rect );
|
PrintText( sLine, rect );
|
||||||
rect.top += g_nFontHeight;
|
rect.top += g_nFontHeight;
|
||||||
// iSourceLine++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2372,8 +2377,8 @@ void DrawTargets ( int line)
|
||||||
// if ((aTarget[iAddress] >= _6502_IO_BEGIN) && (aTarget[iAddress] <= _6502_IO_END))
|
// if ((aTarget[iAddress] >= _6502_IO_BEGIN) && (aTarget[iAddress] <= _6502_IO_END))
|
||||||
// aTarget[iAddress] = NO_6502_TARGET;
|
// aTarget[iAddress] = NO_6502_TARGET;
|
||||||
|
|
||||||
TCHAR sAddress[8] = TEXT("-none-");
|
char sAddress[8] = "-none-";
|
||||||
TCHAR sData[8] = TEXT("");
|
char sData[8] = "";
|
||||||
|
|
||||||
#if DEBUG_FORCE_DISPLAY
|
#if DEBUG_FORCE_DISPLAY
|
||||||
if (aTarget[iAddress] == NO_6502_TARGET)
|
if (aTarget[iAddress] == NO_6502_TARGET)
|
||||||
|
@ -2381,11 +2386,11 @@ void DrawTargets ( int line)
|
||||||
#endif
|
#endif
|
||||||
if (aTarget[iAddress] != NO_6502_TARGET)
|
if (aTarget[iAddress] != NO_6502_TARGET)
|
||||||
{
|
{
|
||||||
wsprintf(sAddress,TEXT("%04X"),aTarget[iAddress]);
|
sprintf(sAddress,"%04X",aTarget[iAddress]);
|
||||||
if (iAddress)
|
if (iAddress)
|
||||||
wsprintf(sData,TEXT("%02X"),*(LPBYTE)(mem+aTarget[iAddress]));
|
sprintf(sData,"%02X",*(LPBYTE)(mem+aTarget[iAddress]));
|
||||||
else
|
else
|
||||||
wsprintf(sData,TEXT("%04X"),*(LPWORD)(mem+aTarget[iAddress]));
|
sprintf(sData,"%04X",*(LPWORD)(mem+aTarget[iAddress]));
|
||||||
}
|
}
|
||||||
|
|
||||||
rect.left = DISPLAY_TARGETS_COLUMN;
|
rect.left = DISPLAY_TARGETS_COLUMN;
|
||||||
|
@ -2426,7 +2431,7 @@ void DrawWatches (int line)
|
||||||
rect.right = DISPLAY_WIDTH;
|
rect.right = DISPLAY_WIDTH;
|
||||||
rect.bottom = rect.top + g_nFontHeight;
|
rect.bottom = rect.top + g_nFontHeight;
|
||||||
|
|
||||||
TCHAR sText[16] = TEXT("Watches");
|
char sText[16] = "Watches";
|
||||||
|
|
||||||
DebuggerSetColorBG( DebuggerGetColor( WATCH_ZERO_BG )); // BG_INFO
|
DebuggerSetColorBG( DebuggerGetColor( WATCH_ZERO_BG )); // BG_INFO
|
||||||
|
|
||||||
|
@ -2450,14 +2455,14 @@ void DrawWatches (int line)
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) );
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) );
|
||||||
PrintTextCursorX( "W", rect2 );
|
PrintTextCursorX( "W", rect2 );
|
||||||
|
|
||||||
wsprintf( sText, "%X ",iWatch );
|
sprintf( sText, "%X ",iWatch );
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET ));
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
// DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ));
|
// DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ));
|
||||||
// PrintTextCursorX( ".", rect2 );
|
// PrintTextCursorX( ".", rect2 );
|
||||||
|
|
||||||
wsprintf( sText,TEXT("%04X"), g_aWatches[iWatch].nAddress );
|
sprintf( sText,"%04X", g_aWatches[iWatch].nAddress );
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS ));
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
|
@ -2465,12 +2470,12 @@ void DrawWatches (int line)
|
||||||
PrintTextCursorX( ":", rect2 );
|
PrintTextCursorX( ":", rect2 );
|
||||||
|
|
||||||
BYTE nTarget8 = (unsigned)*(LPBYTE)(mem+g_aWatches[iWatch].nAddress);
|
BYTE nTarget8 = (unsigned)*(LPBYTE)(mem+g_aWatches[iWatch].nAddress);
|
||||||
wsprintf(sText,TEXT("%02X"), nTarget8 );
|
sprintf(sText,"%02X", nTarget8 );
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE ));
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
WORD nTarget16 = (unsigned)*(LPWORD)(mem+g_aWatches[iWatch].nAddress);
|
WORD nTarget16 = (unsigned)*(LPWORD)(mem+g_aWatches[iWatch].nAddress);
|
||||||
wsprintf( sText,TEXT(" %04X"), nTarget16 );
|
sprintf( sText," %04X", nTarget16 );
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ));
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
|
@ -2478,7 +2483,7 @@ void DrawWatches (int line)
|
||||||
PrintTextCursorX( ":", rect2 );
|
PrintTextCursorX( ":", rect2 );
|
||||||
|
|
||||||
BYTE nValue8 = (unsigned)*(LPBYTE)(mem + nTarget16);
|
BYTE nValue8 = (unsigned)*(LPBYTE)(mem + nTarget16);
|
||||||
wsprintf(sText,TEXT("%02X"), nValue8 );
|
sprintf(sText,"%02X", nValue8 );
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE ));
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
}
|
}
|
||||||
|
@ -2522,7 +2527,7 @@ void DrawZeroPagePointers ( int line )
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) );
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) );
|
||||||
PrintTextCursorX( "Z", rect2 );
|
PrintTextCursorX( "Z", rect2 );
|
||||||
|
|
||||||
wsprintf( sText, "%X ", iZP );
|
sprintf( sText, "%X ", iZP );
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET ));
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
|
@ -2555,13 +2560,13 @@ void DrawZeroPagePointers ( int line )
|
||||||
if ((nLen1) && (pSymbol1[0] == '$'))
|
if ((nLen1) && (pSymbol1[0] == '$'))
|
||||||
{
|
{
|
||||||
// sprintf( sText, "%s%s", pSymbol1 );
|
// sprintf( sText, "%s%s", pSymbol1 );
|
||||||
// wsprintf( sText, "%04X", nZPAddr1 );
|
// sprintf( sText, "%04X", nZPAddr1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if ((nLen2) && (pSymbol2[0] == '$'))
|
if ((nLen2) && (pSymbol2[0] == '$'))
|
||||||
{
|
{
|
||||||
// sprintf( sText, "%s%s", pSymbol2 );
|
// sprintf( sText, "%s%s", pSymbol2 );
|
||||||
// wsprintf( sText, "%04X", nZPAddr2 );
|
// sprintf( sText, "%04X", nZPAddr2 );
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2578,7 +2583,7 @@ void DrawZeroPagePointers ( int line )
|
||||||
rect2.top += g_nFontHeight;
|
rect2.top += g_nFontHeight;
|
||||||
rect2.bottom += g_nFontHeight;
|
rect2.bottom += g_nFontHeight;
|
||||||
|
|
||||||
wsprintf( sText, "%02X", nZPAddr1 );
|
sprintf( sText, "%02X", nZPAddr1 );
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS ));
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
|
@ -2586,7 +2591,7 @@ void DrawZeroPagePointers ( int line )
|
||||||
PrintTextCursorX( ":", rect2 );
|
PrintTextCursorX( ":", rect2 );
|
||||||
|
|
||||||
WORD nTarget16 = (WORD)mem[ nZPAddr1 ] | ((WORD)mem[ nZPAddr2 ]<< 8);
|
WORD nTarget16 = (WORD)mem[ nZPAddr1 ] | ((WORD)mem[ nZPAddr2 ]<< 8);
|
||||||
wsprintf( sText, "%04X", nTarget16 );
|
sprintf( sText, "%04X", nTarget16 );
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ));
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
|
|
||||||
|
@ -2594,7 +2599,7 @@ void DrawZeroPagePointers ( int line )
|
||||||
PrintTextCursorX( ":", rect2 );
|
PrintTextCursorX( ":", rect2 );
|
||||||
|
|
||||||
BYTE nValue8 = (unsigned)*(LPBYTE)(mem + nTarget16);
|
BYTE nValue8 = (unsigned)*(LPBYTE)(mem + nTarget16);
|
||||||
wsprintf(sText, "%02X", nValue8 );
|
sprintf(sText, "%02X", nValue8 );
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE ));
|
||||||
PrintTextCursorX( sText, rect2 );
|
PrintTextCursorX( sText, rect2 );
|
||||||
}
|
}
|
||||||
|
@ -2649,12 +2654,12 @@ void DrawSubWindow_Data (Update_t bUpdate)
|
||||||
int iBackground;
|
int iBackground;
|
||||||
|
|
||||||
const int nMaxOpcodes = WINDOW_DATA_BYTES_PER_LINE;
|
const int nMaxOpcodes = WINDOW_DATA_BYTES_PER_LINE;
|
||||||
TCHAR sAddress [ 5];
|
char sAddress [ 5];
|
||||||
|
|
||||||
assert( CONSOLE_WIDTH > WINDOW_DATA_BYTES_PER_LINE );
|
assert( CONSOLE_WIDTH > WINDOW_DATA_BYTES_PER_LINE );
|
||||||
|
|
||||||
TCHAR sOpcodes [ CONSOLE_WIDTH ] = TEXT("");
|
char sOpcodes [ CONSOLE_WIDTH ] = "";
|
||||||
TCHAR sImmediate[ 4 ]; // 'c'
|
char sImmediate[ 4 ]; // 'c'
|
||||||
|
|
||||||
const int nDefaultFontWidth = 7; // g_aFontConfig[FONT_DISASM_DEFAULT]._nFontWidth or g_nFontWidthAvg
|
const int nDefaultFontWidth = 7; // g_aFontConfig[FONT_DISASM_DEFAULT]._nFontWidth or g_nFontWidthAvg
|
||||||
int X_OPCODE = 6 * nDefaultFontWidth;
|
int X_OPCODE = 6 * nDefaultFontWidth;
|
||||||
|
@ -2681,13 +2686,13 @@ void DrawSubWindow_Data (Update_t bUpdate)
|
||||||
iAddress = nAddress;
|
iAddress = nAddress;
|
||||||
|
|
||||||
// Format
|
// Format
|
||||||
wsprintf( sAddress, TEXT("%04X"), iAddress );
|
sprintf( sAddress, "%04X", iAddress );
|
||||||
|
|
||||||
sOpcodes[0] = 0;
|
sOpcodes[0] = 0;
|
||||||
for ( iByte = 0; iByte < nMaxOpcodes; iByte++ )
|
for ( iByte = 0; iByte < nMaxOpcodes; iByte++ )
|
||||||
{
|
{
|
||||||
BYTE nData = (unsigned)*(LPBYTE)(mem + iAddress + iByte);
|
BYTE nData = (unsigned)*(LPBYTE)(mem + iAddress + iByte);
|
||||||
wsprintf( &sOpcodes[ iByte * 3 ], TEXT("%02X "), nData );
|
sprintf( &sOpcodes[ iByte * 3 ], "%02X ", nData );
|
||||||
}
|
}
|
||||||
sOpcodes[ nMaxOpcodes * 3 ] = 0;
|
sOpcodes[ nMaxOpcodes * 3 ] = 0;
|
||||||
|
|
||||||
|
@ -2726,7 +2731,7 @@ void DrawSubWindow_Data (Update_t bUpdate)
|
||||||
|
|
||||||
// Seperator
|
// Seperator
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
||||||
PrintTextCursorX( (LPCSTR) TEXT(" | " ), rect );
|
PrintTextCursorX( " | ", rect );
|
||||||
|
|
||||||
|
|
||||||
// Plain Text
|
// Plain Text
|
||||||
|
@ -2769,12 +2774,12 @@ void DrawSubWindow_Data (Update_t bUpdate)
|
||||||
}
|
}
|
||||||
|
|
||||||
DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); // Hack, colorize Char background "spills over to EOL"
|
DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); // Hack, colorize Char background "spills over to EOL"
|
||||||
PrintTextCursorX( (LPCSTR) TEXT(" " ), rect );
|
PrintTextCursorX( " ", rect );
|
||||||
*/
|
*/
|
||||||
DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); // HACK: Colorize() can "spill over" to EOL
|
DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); // HACK: Colorize() can "spill over" to EOL
|
||||||
|
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ));
|
||||||
PrintTextCursorX( (LPCSTR) TEXT(" | " ), rect );
|
PrintTextCursorX( " | ", rect );
|
||||||
|
|
||||||
nAddress += nMaxOpcodes;
|
nAddress += nMaxOpcodes;
|
||||||
}
|
}
|
||||||
|
@ -2788,7 +2793,7 @@ void DrawSubWindow_Info( int iWindow )
|
||||||
if (g_iWindowThis == WINDOW_CONSOLE)
|
if (g_iWindowThis == WINDOW_CONSOLE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const TCHAR **sReg = g_aBreakpointSource;
|
const char **sReg = g_aBreakpointSource;
|
||||||
|
|
||||||
int yRegs = 0; // 12
|
int yRegs = 0; // 12
|
||||||
int yStack = yRegs + MAX_DISPLAY_REGS_LINES + 0; // 0
|
int yStack = yRegs + MAX_DISPLAY_REGS_LINES + 0; // 0
|
||||||
|
@ -2813,11 +2818,11 @@ void DrawSubWindow_Info( int iWindow )
|
||||||
DrawZeroPagePointers( yZeroPage );
|
DrawZeroPagePointers( yZeroPage );
|
||||||
|
|
||||||
#if defined(SUPPORT_Z80_EMU) && defined(OUTPUT_Z80_REGS)
|
#if defined(SUPPORT_Z80_EMU) && defined(OUTPUT_Z80_REGS)
|
||||||
DrawRegister( 19,TEXT("AF"),2,*(WORD*)(membank+REG_AF));
|
DrawRegister( 19,"AF",2,*(WORD*)(membank+REG_AF));
|
||||||
DrawRegister( 20,TEXT("BC"),2,*(WORD*)(membank+REG_BC));
|
DrawRegister( 20,"BC",2,*(WORD*)(membank+REG_BC));
|
||||||
DrawRegister( 21,TEXT("DE"),2,*(WORD*)(membank+REG_DE));
|
DrawRegister( 21,"DE",2,*(WORD*)(membank+REG_DE));
|
||||||
DrawRegister( 22,TEXT("HL"),2,*(WORD*)(membank+REG_HL));
|
DrawRegister( 22,"HL",2,*(WORD*)(membank+REG_HL));
|
||||||
DrawRegister( 23,TEXT("IX"),2,*(WORD*)(membank+REG_IX));
|
DrawRegister( 23,"IX",2,*(WORD*)(membank+REG_IX));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Right Side
|
// Right Side
|
||||||
|
@ -2898,11 +2903,11 @@ void DrawSubWindow_Source2 (Update_t bUpdate)
|
||||||
rect.right = DISPLAY_DISASM_RIGHT; // HACK: MAGIC #: 7
|
rect.right = DISPLAY_DISASM_RIGHT; // HACK: MAGIC #: 7
|
||||||
|
|
||||||
// Draw Title
|
// Draw Title
|
||||||
TCHAR sTitle[ CONSOLE_WIDTH ];
|
char sTitle[ CONSOLE_WIDTH ];
|
||||||
TCHAR sText [ CONSOLE_WIDTH ];
|
char sText [ CONSOLE_WIDTH ];
|
||||||
_tcscpy( sTitle, TEXT(" Source: "));
|
strcpy ( sTitle, " Source: " );
|
||||||
_tcsncpy( sText, g_aSourceFileName, g_nConsoleDisplayWidth - _tcslen( sTitle ) - 1 );
|
strncpy( sText , g_aSourceFileName, g_nConsoleDisplayWidth - strlen( sTitle ) - 1 );
|
||||||
_tcscat( sTitle, sText );
|
strcat ( sTitle, sText );
|
||||||
|
|
||||||
DebuggerSetColorBG( DebuggerGetColor( BG_SOURCE_TITLE ));
|
DebuggerSetColorBG( DebuggerGetColor( BG_SOURCE_TITLE ));
|
||||||
DebuggerSetColorFG( DebuggerGetColor( FG_SOURCE_TITLE ));
|
DebuggerSetColorFG( DebuggerGetColor( FG_SOURCE_TITLE ));
|
||||||
|
|
|
@ -8,12 +8,9 @@
|
||||||
#define DEBUG_APPLE_FONT 0
|
#define DEBUG_APPLE_FONT 0
|
||||||
|
|
||||||
// Win32 Debugger Font
|
// Win32 Debugger Font
|
||||||
// 1 = Use Debugger_Font_7x8.BMP
|
// 1 = Use Debugger_Font.BMP (7x8)
|
||||||
// 0 = Use CHARSET40.bmp (fg & bg colors aren't proper)
|
// 0 = Use CHARSET40.bmp (fg & bg colors aren't proper)
|
||||||
#define APPLE_FONT_NEW 1
|
#define APPLE_FONT_NEW 1
|
||||||
// 7x8 Font
|
|
||||||
//#define APPLE_FONT_SCALE_ONE_HALF 1
|
|
||||||
#define APPLE_FONT_SCALE_ONE_HALF $ERROR("APPLE_FONT_SCALE_ONE_HALF")
|
|
||||||
|
|
||||||
#if APPLE_FONT_NEW
|
#if APPLE_FONT_NEW
|
||||||
#define APPLE_FONT_BITMAP_PADDED 0
|
#define APPLE_FONT_BITMAP_PADDED 0
|
||||||
|
@ -64,10 +61,11 @@
|
||||||
|
|
||||||
void PrintGlyph ( const int x, const int y, const int iChar );
|
void PrintGlyph ( const int x, const int y, const int iChar );
|
||||||
int PrintText ( const char * pText, RECT & rRect );
|
int PrintText ( const char * pText, RECT & rRect );
|
||||||
void PrintTextColor ( const char * pText, RECT & rRect );
|
|
||||||
int PrintTextCursorX( const char * pText, RECT & rRect );
|
int PrintTextCursorX( const char * pText, RECT & rRect );
|
||||||
int PrintTextCursorY( const char * pText, RECT & rRect );
|
int PrintTextCursorY( const char * pText, RECT & rRect );
|
||||||
|
|
||||||
|
void PrintTextColor ( const conchar_t * pText, RECT & rRect );
|
||||||
|
|
||||||
void DrawWindow_Source (Update_t bUpdate);
|
void DrawWindow_Source (Update_t bUpdate);
|
||||||
|
|
||||||
void DrawBreakpoints ( int line);
|
void DrawBreakpoints ( int line);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -434,12 +434,12 @@ void ArgsRawParse ( void )
|
||||||
|
|
||||||
Note: The number of args can be changed via:
|
Note: The number of args can be changed via:
|
||||||
|
|
||||||
address1,length Length
|
address1,length Length
|
||||||
address1:address2 Range
|
address1:address2 Range
|
||||||
address1+delta Delta
|
address1+delta Delta
|
||||||
address1-delta Delta
|
address1-delta Delta
|
||||||
//=========================================================================== */
|
//=========================================================================== */
|
||||||
int ArgsCook ( const int nArgs, const int bProcessMask )
|
int ArgsCook ( const int nArgs ) //, const int bProcessMask )
|
||||||
{
|
{
|
||||||
const int BASE = 16; // hex
|
const int BASE = 16; // hex
|
||||||
TCHAR *pSrc = NULL;
|
TCHAR *pSrc = NULL;
|
||||||
|
@ -463,7 +463,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
|
||||||
pArg = & (g_aArgs[ iArg ]);
|
pArg = & (g_aArgs[ iArg ]);
|
||||||
pSrc = & (pArg->sArg[ 0 ]);
|
pSrc = & (pArg->sArg[ 0 ]);
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_DOLLAR))
|
// if (bProcessMask & (1 << TOKEN_DOLLAR))
|
||||||
if (pArg->eToken == TOKEN_DOLLAR) // address
|
if (pArg->eToken == TOKEN_DOLLAR) // address
|
||||||
{
|
{
|
||||||
// TODO: Need to flag was a DOLLAR token for assembler
|
// TODO: Need to flag was a DOLLAR token for assembler
|
||||||
|
@ -521,28 +521,16 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
|
||||||
nAddressVal = nAddressSym;
|
nAddressVal = nAddressSym;
|
||||||
pArg->bSymbol = true;
|
pArg->bSymbol = true;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (bProcessMask & (1 << TOKEN_COMMA))
|
|
||||||
if (pArg->eToken == TOKEN_COMMA) // COMMMA , length
|
|
||||||
{
|
|
||||||
pPrev->nVal2 = nAddressVal;
|
|
||||||
pPrev->eToken = TOKEN_COMMA;
|
|
||||||
pPrev->bType |= TYPE_ADDRESS;
|
|
||||||
pPrev->bType |= TYPE_LENGTH;
|
|
||||||
nParamLen = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_COLON))
|
// Comma and Colon are range operators, but they are not parsed here,
|
||||||
if (pArg->eToken == TOKEN_COLON) // COLON : range
|
// since args no longer have a 1st and 2nd value
|
||||||
{
|
/*
|
||||||
pPrev->nVal2 = nAddressVal;
|
|
||||||
pPrev->eToken = TOKEN_COLON;
|
pPrev->eToken = TOKEN_COLON;
|
||||||
pPrev->bType |= TYPE_ADDRESS;
|
pPrev->bType |= TYPE_ADDRESS;
|
||||||
pPrev->bType |= TYPE_RANGE;
|
pPrev->bType |= TYPE_RANGE;
|
||||||
nParamLen = 2;
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
if (bProcessMask & (1 << TOKEN_AMPERSAND))
|
|
||||||
|
// if (bProcessMask & (1 << TOKEN_AMPERSAND))
|
||||||
if (pArg->eToken == TOKEN_AMPERSAND) // AND & delta
|
if (pArg->eToken == TOKEN_AMPERSAND) // AND & delta
|
||||||
{
|
{
|
||||||
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
||||||
|
@ -554,7 +542,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
|
||||||
nParamLen = 2;
|
nParamLen = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_PIPE))
|
// if (bProcessMask & (1 << TOKEN_PIPE))
|
||||||
if (pArg->eToken == TOKEN_PIPE) // OR | delta
|
if (pArg->eToken == TOKEN_PIPE) // OR | delta
|
||||||
{
|
{
|
||||||
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
||||||
|
@ -566,31 +554,31 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
|
||||||
nParamLen = 2;
|
nParamLen = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_CARET))
|
// if (bProcessMask & (1 << TOKEN_CARET))
|
||||||
if (pArg->eToken == TOKEN_CARET) // XOR ^ delta
|
if (pArg->eToken == TOKEN_CARET) // XOR ^ delta
|
||||||
{
|
{
|
||||||
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
||||||
{
|
{
|
||||||
ArgsGetRegisterValue( pNext, & nAddressRHS );
|
ArgsGetRegisterValue( pNext, & nAddressRHS );
|
||||||
}
|
}
|
||||||
pPrev->nValue ^= nAddressRHS;
|
pPrev->nValue ^= nAddressRHS;
|
||||||
pPrev->bType |= TYPE_VALUE; // signal already up to date
|
pPrev->bType |= TYPE_VALUE; // signal already up to date
|
||||||
nParamLen = 2;
|
nParamLen = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_PLUS))
|
// if (bProcessMask & (1 << TOKEN_PLUS))
|
||||||
if (pArg->eToken == TOKEN_PLUS) // PLUS + delta
|
if (pArg->eToken == TOKEN_PLUS) // PLUS + delta
|
||||||
{
|
{
|
||||||
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
||||||
{
|
{
|
||||||
ArgsGetRegisterValue( pNext, & nAddressRHS );
|
ArgsGetRegisterValue( pNext, & nAddressRHS );
|
||||||
}
|
}
|
||||||
pPrev->nValue += nAddressRHS;
|
pPrev->nValue += nAddressRHS;
|
||||||
pPrev->bType |= TYPE_VALUE; // signal already up to date
|
pPrev->bType |= TYPE_VALUE; // signal already up to date
|
||||||
nParamLen = 2;
|
nParamLen = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_MINUS))
|
// if (bProcessMask & (1 << TOKEN_MINUS))
|
||||||
if (pArg->eToken == TOKEN_MINUS) // MINUS - delta
|
if (pArg->eToken == TOKEN_MINUS) // MINUS - delta
|
||||||
{
|
{
|
||||||
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
||||||
|
@ -602,7 +590,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
|
||||||
nParamLen = 2;
|
nParamLen = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_PERCENT))
|
// if (bProcessMask & (1 << TOKEN_PERCENT))
|
||||||
if (pArg->eToken == TOKEN_PERCENT) // PERCENT % delta
|
if (pArg->eToken == TOKEN_PERCENT) // PERCENT % delta
|
||||||
{
|
{
|
||||||
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
||||||
|
@ -614,7 +602,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
|
||||||
nParamLen = 2;
|
nParamLen = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_STAR))
|
// if (bProcessMask & (1 << TOKEN_STAR))
|
||||||
if (pArg->eToken == TOKEN_STAR) // STAR * delta
|
if (pArg->eToken == TOKEN_STAR) // STAR * delta
|
||||||
{
|
{
|
||||||
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
||||||
|
@ -626,7 +614,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
|
||||||
nParamLen = 2;
|
nParamLen = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_FSLASH))
|
// if (bProcessMask & (1 << TOKEN_FSLASH))
|
||||||
if (pArg->eToken == TOKEN_FSLASH) // FORWARD SLASH / delta
|
if (pArg->eToken == TOKEN_FSLASH) // FORWARD SLASH / delta
|
||||||
{
|
{
|
||||||
if (pNext->eToken == TOKEN_FSLASH) // Comment
|
if (pNext->eToken == TOKEN_FSLASH) // Comment
|
||||||
|
@ -645,7 +633,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
|
||||||
nParamLen = 2;
|
nParamLen = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_EQUAL))
|
// if (bProcessMask & (1 << TOKEN_EQUAL))
|
||||||
if (pArg->eToken == TOKEN_EQUAL) // EQUAL = assign
|
if (pArg->eToken == TOKEN_EQUAL) // EQUAL = assign
|
||||||
{
|
{
|
||||||
pPrev->nValue = nAddressRHS;
|
pPrev->nValue = nAddressRHS;
|
||||||
|
@ -653,7 +641,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
|
||||||
nParamLen = 0; // need token for Smart BreakPoints
|
nParamLen = 0; // need token for Smart BreakPoints
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_AT))
|
// if (bProcessMask & (1 << TOKEN_AT))
|
||||||
if (pArg->eToken == TOKEN_AT) // AT @ pointer de-reference
|
if (pArg->eToken == TOKEN_AT) // AT @ pointer de-reference
|
||||||
{
|
{
|
||||||
nParamLen = 1;
|
nParamLen = 1;
|
||||||
|
@ -673,7 +661,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
|
||||||
nParamLen = 0;
|
nParamLen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_HASH))
|
// if (bProcessMask & (1 << TOKEN_HASH))
|
||||||
if (pArg->eToken == TOKEN_HASH) // HASH # immediate
|
if (pArg->eToken == TOKEN_HASH) // HASH # immediate
|
||||||
{
|
{
|
||||||
pArg->nValue = nAddressRHS;
|
pArg->nValue = nAddressRHS;
|
||||||
|
@ -682,19 +670,19 @@ int ArgsCook ( const int nArgs, const int bProcessMask )
|
||||||
nParamLen = 0;
|
nParamLen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_LESS_THAN))
|
// if (bProcessMask & (1 << TOKEN_LESS_THAN))
|
||||||
if (pArg->eToken == TOKEN_LESS_THAN) // <
|
if (pArg->eToken == TOKEN_LESS_THAN) // <
|
||||||
{
|
{
|
||||||
nParamLen = 0;
|
nParamLen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_GREATER_THAN))
|
// if (bProcessMask & (1 << TOKEN_GREATER_THAN))
|
||||||
if (pArg->eToken == TOKEN_GREATER_THAN) // >
|
if (pArg->eToken == TOKEN_GREATER_THAN) // >
|
||||||
{
|
{
|
||||||
nParamLen = 0;
|
nParamLen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bProcessMask & (1 << TOKEN_EXCLAMATION))
|
// if (bProcessMask & (1 << TOKEN_EXCLAMATION))
|
||||||
if (pArg->eToken == TOKEN_EXCLAMATION) // NOT !
|
if (pArg->eToken == TOKEN_EXCLAMATION) // NOT !
|
||||||
{
|
{
|
||||||
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
if (! ArgsGetImmediateValue( pNext, & nAddressRHS ))
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#ifndef DEBUGGER_PARSER_H
|
#ifndef DEBUGGER_PARSER_H
|
||||||
#define DEBUGGER_PARSER_H
|
#define DEBUGGER_PARSER_H
|
||||||
|
|
||||||
#define CHAR_LF '\x0D'
|
#define CHAR_LF '\x0D'
|
||||||
#define CHAR_CR '\x0A'
|
#define CHAR_CR '\x0A'
|
||||||
#define CHAR_SPACE ' '
|
#define CHAR_SPACE ' '
|
||||||
#define CHAR_TAB '\t'
|
#define CHAR_TAB '\t'
|
||||||
#define CHAR_QUOTE_DOUBLE '"'
|
#define CHAR_QUOTE_DOUBLE '"'
|
||||||
#define CHAR_QUOTE_SINGLE '\''
|
#define CHAR_QUOTE_SINGLE '\''
|
||||||
#define CHAR_ESCAPE '\x1B'
|
#define CHAR_ESCAPE '\x1B'
|
||||||
|
|
||||||
// Globals __________________________________________________________________
|
// Globals __________________________________________________________________
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
int ArgsGet ( TCHAR * pInput );
|
int ArgsGet ( TCHAR * pInput );
|
||||||
bool ArgsGetRegisterValue ( Arg_t *pArg, WORD * pAddressValue_ );
|
bool ArgsGetRegisterValue ( Arg_t *pArg, WORD * pAddressValue_ );
|
||||||
void ArgsRawParse ( void );
|
void ArgsRawParse ( void );
|
||||||
int ArgsCook ( const int nArgs, const int bProcessMask ); // ArgsRawCook
|
int ArgsCook ( const int nArgs ); // const int bProcessMask );
|
||||||
|
|
||||||
// Token
|
// Token
|
||||||
const char * ParserFindToken( const char *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e * pToken_ );
|
const char * ParserFindToken( const char *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e * pToken_ );
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
struct AddressingMode_t
|
struct AddressingMode_t
|
||||||
{
|
{
|
||||||
TCHAR m_sFormat[ MAX_OPMODE_FORMAT ];
|
char m_sFormat[ MAX_OPMODE_FORMAT ];
|
||||||
int m_nBytes;
|
int m_nBytes;
|
||||||
char m_sName [ MAX_OPMODE_NAME ];
|
char m_sName [ MAX_OPMODE_NAME ];
|
||||||
};
|
};
|
||||||
|
@ -399,7 +399,7 @@
|
||||||
|
|
||||||
struct Command_t
|
struct Command_t
|
||||||
{
|
{
|
||||||
TCHAR m_sName[ MAX_COMMAND_LEN ];
|
char m_sName[ MAX_COMMAND_LEN ];
|
||||||
CmdFuncPtr_t pFunction;
|
CmdFuncPtr_t pFunction;
|
||||||
int iCommand; // offset (enum) for direct command name lookup
|
int iCommand; // offset (enum) for direct command name lookup
|
||||||
char *pHelpSummary; // 1 line help summary
|
char *pHelpSummary; // 1 line help summary
|
||||||
|
@ -904,7 +904,7 @@
|
||||||
|
|
||||||
struct FontConfig_t
|
struct FontConfig_t
|
||||||
{
|
{
|
||||||
TCHAR _sFontName[ MAX_FONT_NAME ];
|
char _sFontName[ MAX_FONT_NAME ];
|
||||||
HFONT _hFont;
|
HFONT _hFont;
|
||||||
// int _iFontType;
|
// int _iFontType;
|
||||||
int _nFontWidthAvg;
|
int _nFontWidthAvg;
|
||||||
|
@ -958,7 +958,7 @@
|
||||||
|
|
||||||
struct Instruction2_t
|
struct Instruction2_t
|
||||||
{
|
{
|
||||||
TCHAR sMnemonic[MAX_MNEMONIC_LEN+1];
|
char sMnemonic[MAX_MNEMONIC_LEN+1];
|
||||||
int nAddressMode;
|
int nAddressMode;
|
||||||
int iMemoryAccess;
|
int iMemoryAccess;
|
||||||
};
|
};
|
||||||
|
@ -1170,7 +1170,7 @@
|
||||||
|
|
||||||
struct Arg_t
|
struct Arg_t
|
||||||
{
|
{
|
||||||
TCHAR sArg[ MAX_ARG_LEN ]; // Array chars comes first, for alignment
|
char sArg[ MAX_ARG_LEN ]; // Array chars comes first, for alignment
|
||||||
int nArgLen; // Needed for TextSearch "ABC\x00"
|
int nArgLen; // Needed for TextSearch "ABC\x00"
|
||||||
WORD nValue ; // 2
|
WORD nValue ; // 2
|
||||||
// WORD nVal1 ; // 2
|
// WORD nVal1 ; // 2
|
||||||
|
|
Loading…
Add table
Reference in a new issue