From 40b8ff01a4bf5295131ad91398bdbe17c0924448 Mon Sep 17 00:00:00 2001 From: mpohoreski Date: Sun, 9 Jul 2006 04:53:08 +0000 Subject: [PATCH] Help is colorized Rewrote color console for 2nd and last time. --- source/Debug.cpp | 223 +++++---- source/Debug.h | 2 +- source/Debugger_Console.cpp | 218 +++++++-- source/Debugger_Console.h | 182 ++++--- source/Debugger_Display.cpp | 393 +++++++-------- source/Debugger_Display.h | 8 +- source/Debugger_Help.cpp | 924 +++++++++++++++++++++++------------- source/Debugger_Parser.cpp | 60 +-- source/Debugger_Parser.h | 12 +- source/Debugger_Types.h | 10 +- 10 files changed, 1259 insertions(+), 773 deletions(-) diff --git a/source/Debug.cpp b/source/Debug.cpp index 790e1945..8c665de7 100644 --- a/source/Debug.cpp +++ b/source/Debug.cpp @@ -43,7 +43,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // TODO: COLOR LOAD ["filename"] // 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 _________________________________________________________________________________________ @@ -65,30 +65,30 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Breakpoint_t g_aBreakpoints[ MAX_BREAKPOINTS ]; // 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 for both Input & Output! // Regs - TEXT("A"), // Reg A - TEXT("X"), // Reg X - TEXT("Y"), // Reg Y + "A", // Reg A + "X", // Reg X + "Y", // Reg Y // Special - TEXT("PC"), // Program Counter - TEXT("S" ), // Stack Pointer + "PC", // Program Counter + "S" , // Stack Pointer // Flags -- .8 Moved: Flag names from g_aFlagNames[] to "inlined" g_aBreakpointSource[] - TEXT("P"), // Processor Status - TEXT("C"), // ---- ---1 Carry - TEXT("Z"), // ---- --1- Zero - TEXT("I"), // ---- -1-- Interrupt - TEXT("D"), // ---- 1--- Decimal - TEXT("B"), // ---1 ---- Break - TEXT("R"), // --1- ---- Reserved - TEXT("V"), // -1-- ---- Overflow - TEXT("N"), // 1--- ---- Sign + "P", // Processor Status + "C", // ---- ---1 Carry + "Z", // ---- --1- Zero + "I", // ---- -1-- Interrupt + "D", // ---- 1--- Decimal + "B", // ---1 ---- Break + "R", // --1- ---- Reserved + "V", // -1-- ---- Overflow + "N", // 1--- ---- Sign // Misc - TEXT("OP"), // Opcode/Instruction/Mnemonic + "OP", // Opcode/Instruction/Mnemonic // Memory - TEXT("M") // Main + "M" // Main }; // 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?? }; -// 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 ;-) @@ -542,18 +542,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA int g_nDisasmWinHeight = 0; -// TCHAR g_aConfigDisasmAddressColon[] = TEXT(" :"); +// char g_aConfigDisasmAddressColon[] = TEXT(" :"); extern const int WINDOW_DATA_BYTES_PER_LINE = 8; +#if OLD_FONT // Font TCHAR g_sFontNameDefault[ 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_sFontNameInfo [ MAX_FONT_NAME ] = TEXT("Courier New"); TCHAR g_sFontNameBranch [ MAX_FONT_NAME ] = TEXT("Webdings"); - int g_iFontSpacing = FONT_SPACING_CLEAN; 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 #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 ) { - static TCHAR sText[ CONSOLE_WIDTH ]; - static const TCHAR sFlags[] = "-*"; - static TCHAR sName[ MAX_SYMBOLS_LEN+1 ]; + static char sText[ CONSOLE_WIDTH ]; + static const char sFlags[] = "-*"; + static char sName[ MAX_SYMBOLS_LEN+1 ]; WORD nAddress = aBreakWatchZero[ iBWZ ].nAddress; LPCTSTR pSymbol = GetSymbol( nAddress, 2 ); @@ -2208,7 +2210,7 @@ void _BWZ_List( const Breakpoint_t * aBreakWatchZero, const int iBWZ ) //, bool pSymbol = sName; } - wsprintf( sText, " #%d %c %04X %s", + sprintf( sText, " #%d %c %04X %s", // (bZeroBased ? iBWZ + 1 : iBWZ), iBWZ, 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; 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; } @@ -3368,6 +3378,7 @@ bool _CmdConfigFont ( int iFont, LPCSTR pFontName, int iPitchFamily, int nFontHe //=========================================================================== Update_t CmdConfigSetFont (int nArgs) { +#if OLD_FONT HFONT hFont = (HFONT) 0; TCHAR *pFontName = NULL; int nHeight = g_nFontHeight; @@ -3425,7 +3436,7 @@ Update_t CmdConfigSetFont (int nArgs) if (! _CmdConfigFont( iFontTarget, pFontName, iFontPitch, nHeight )) { } - +#endif return UPDATE_ALL; } @@ -5599,9 +5610,13 @@ Update_t CmdOutputRun (int nArgs) } else { - TCHAR sText[ CONSOLE_WIDTH ]; - wsprintf( sText, "Couldn't load filename: %s", sFileName ); - ConsoleBufferPush( sText ); + char sText[ CONSOLE_WIDTH ]; + sprintf( sText, "%sCouldn't load filename: %s%s" + , CHC_ERROR + , CHC_STRING + , sFileName + ); + ConsolePrint( sText ); } return ConsoleUpdate(); @@ -5953,7 +5968,7 @@ Update_t CmdSymbolsClear (int nArgs) //=========================================================================== Update_t CmdSymbolsInfo (int nArgs) { - TCHAR sText[ CONSOLE_WIDTH ]; + char sText[ CONSOLE_WIDTH ]; bool bDisplayMain = false; bool bDisplayUser = false; @@ -5981,24 +5996,48 @@ Update_t CmdSymbolsInfo (int nArgs) if (bDisplayMain && bDisplayUser && bDisplaySrc) { - wsprintf( sText, " Symbols Main: %d User: %d Source: %d", - nSymbolsMain, nSymbolsUser, nSymbolsSrc ); - ConsoleBufferPush( sText ); + sprintf( sText, " Symbols Main: %s%d%s User: %s%d%s Source: %s%d%s" + , CHC_NUMBER + , nSymbolsMain + , CHC_DEFAULT + , CHC_NUMBER + , nSymbolsUser + , CHC_DEFAULT + , CHC_NUMBER + , nSymbolsSrc + , CHC_DEFAULT + ); + ConsolePrint( sText ); } else 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 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 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) @@ -6009,9 +6048,19 @@ Update_t CmdSymbolsInfo (int nArgs) void _CmdPrintSymbol( LPCTSTR pSymbol, WORD nAddress, int iTable ) { - TCHAR sText[ CONSOLE_WIDTH ]; - wsprintf( sText, " $%04X (%s) %s", nAddress, g_aSymbolTableNames[ iTable ], pSymbol ); - ConsoleBufferPush( sText ); + char sText[ CONSOLE_WIDTH ]; + sprintf( sText, " %s$%s%04X%s (%s%s%s) %s%s" + , 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 ]; - if (pText[0] == TEXT('$')) + if (pText[0] == '$') { if (!TextIsHexString( pText+1)) return false; - _tcscpy( sHexApple, TEXT("0x") ); + _tcscpy( sHexApple, "0x" ); _tcsncpy( sHexApple+2, pText+1, MAX_SYMBOLS_LEN - 3 ); pText = sHexApple; } @@ -6268,7 +6317,7 @@ int ParseSymbolTable( TCHAR *pFileName, Symbols_e eWhichTableToLoad ) nSymbolsLoaded++; } - if(hFile) + if (hFile) fclose(hFile); return nSymbolsLoaded; @@ -7453,27 +7502,36 @@ int FindCommand( LPTSTR pName, CmdFuncPtr_t & pFunction_, int * iCommand_ ) //=========================================================================== void DisplayAmbigiousCommands( int nFound ) { - TCHAR sText[ CONSOLE_WIDTH ]; - wsprintf( sText, TEXT("Ambiguous %d Commands:"), g_vPotentialCommands.size() ); - ConsoleBufferPush( sText ); + char sText[ CONSOLE_WIDTH * 2 ]; + sprintf( sText, "Ambiguous %s%d%s Commands:" + , CHC_NUMBER + , g_vPotentialCommands.size() + , CHC_DEFAULT + ); + ConsolePrint( sText ); int iCommand = 0; while (iCommand < nFound) { - TCHAR sPotentialCommands[ CONSOLE_WIDTH ] = TEXT(" "); - int iWidth = _tcslen( sPotentialCommands ); + char sPotentialCommands[ CONSOLE_WIDTH ]; + sprintf( sPotentialCommands, "%s ", CHC_COMMAND ); + + int iWidth = strlen( sPotentialCommands ); while ((iCommand < nFound) && (iWidth < g_nConsoleDisplayWidth)) { - int nCommand = g_vPotentialCommands[ iCommand ]; - TCHAR *pName = g_aCommands[ nCommand ].m_sName; - int nLen = _tcslen( pName ); + int nCommand = g_vPotentialCommands[ iCommand ]; + char *pName = g_aCommands[ nCommand ].m_sName; + int nLen = strlen( pName ); - wsprintf( sText, TEXT("%s "), pName ); - _tcscat( sPotentialCommands, sText ); + if ((iWidth + nLen) >= (CONSOLE_WIDTH - 1)) + break; + + sprintf( sText, "%s ", pName ); + strcat( sPotentialCommands, sText ); iWidth += nLen + 1; iCommand++; } - ConsoleBufferPush( sPotentialCommands ); + ConsolePrint( sPotentialCommands ); } } @@ -7481,16 +7539,16 @@ void DisplayAmbigiousCommands( int nFound ) Update_t ExecuteCommand (int nArgs) { Arg_t * pArg = & g_aArgs[ 0 ]; - TCHAR * pCommand = & pArg->sArg[0]; + char * pCommand = & pArg->sArg[0]; CmdFuncPtr_t pFunction = NULL; 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) { - int nLen = _tcslen( pCommand); + int nLen = strlen( pCommand ); if (nLen < 6) { // 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) } } - -/* - // C++ // TOKEN_COMMENT_EOL - if (pArg->eToken == TOKEN_FSLASH) - { - pArg++; - if (pArg->eToken == TOKEN_FSLASH) - { - nFound = 1; - pFunction = NULL; - } - } -*/ } if (nFound > 1) @@ -7609,7 +7654,7 @@ Update_t ExecuteCommand (int nArgs) int nArgsCooked = nArgs; if (bCook) - nArgsCooked = ArgsCook( nArgs, nCookMask ); // Cook them + nArgsCooked = ArgsCook( nArgs ); // nCookMask if (nArgsCooked == ARG_SYNTAX_ERROR) return ConsoleDisplayError(TEXT("Syntax Error")); @@ -7665,18 +7710,19 @@ bool InternalSingleStep () //=========================================================================== void OutputTraceLine () { - // HACK: MAGIC #: 50 -> 64 chars for disassembly - TCHAR sDisassembly[ 64 ] ; DrawDisassemblyLine( 0,regs.pc, sDisassembly); // Get Disasm String - TCHAR sFlags[ _6502_NUM_FLAGS+1]; DrawFlags( 0, regs.ps, sFlags ); // Get Flags String + char sDisassembly[ CONSOLE_WIDTH ]; DrawDisassemblyLine( 0,regs.pc, sDisassembly); // Get Disasm String + char sFlags[ _6502_NUM_FLAGS + 1 ]; DrawFlags( 0, regs.ps, sFlags ); // Get Flags String - _ftprintf(g_hTraceFile, - TEXT("a=%02x x=%02x y=%02x sp=%03x ps=%s %s\n"), + // _ftprintf(g_hTraceFile, + fprintf( g_hTraceFile, + "a=%02x x=%02x y=%02x sp=%03x ps=%s %s\n", (unsigned)regs.a, (unsigned)regs.x, (unsigned)regs.y, (unsigned)regs.sp, - (LPCTSTR) sFlags, - (LPCTSTR) sDisassembly); + (char*) sFlags, + (char*) sDisassembly + ); } //=========================================================================== @@ -7696,9 +7742,6 @@ int ParseInput ( LPTSTR pConsoleInput, bool bCook ) g_aArgs[ iArg ] = g_aArgRaw[ iArg ]; } -// if (bCook) -// nArg = ArgsCook( nArg ); // Cook them - return nArg; } @@ -7884,9 +7927,11 @@ void ProfileFormat( bool bExport, ProfileFormat_e eFormatMode ) , "\"Percent\"" DELIM "\"Count\"" DELIM DELIM DELIM "\"Addressing Mode\"\n" , sSeperator7, sSeperator2, sSeperator2, sSeperator2 ); else + { sprintf( pText , "Percent" DELIM "Count" DELIM "Addressing Mode\n" , sSeperator7, sSeperator2 ); + } pText = ProfileLinePush(); if (nOpmodeTotal < 1) @@ -8382,9 +8427,10 @@ void DebugInitialize () g_iCommand = CMD_SYMBOLS_MAIN; CmdSymbolsLoad(0); +#if OLD_FONT // CREATE A FONT FOR THE DEBUGGING SCREEN int nArgs = _Arg_1( g_sFontNameDefault ); -// CmdConfigSetFont( nArgs ); +#endif for (int iFont = 0; iFont < NUM_FONTS; iFont++ ) { @@ -8397,16 +8443,13 @@ void DebugInitialize () #endif } -//#if USE_APPLE_FONT -// _UpdateWindowFontHeights( g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontHeight ); -//#else - // TODO: g_aFontPitch +#if OLD_FONT _CmdConfigFont( FONT_INFO , g_sFontNameInfo , FIXED_PITCH | FF_MODERN , g_nFontHeight ); // DEFAULT_CHARSET _CmdConfigFont( FONT_CONSOLE , g_sFontNameConsole, FIXED_PITCH | FF_MODERN , g_nFontHeight ); // DEFAULT_CHARSET _CmdConfigFont( FONT_DISASM_DEFAULT, g_sFontNameDisasm , FIXED_PITCH | FF_MODERN , g_nFontHeight ); // OEM_CHARSET _CmdConfigFont( FONT_DISASM_BRANCH , g_sFontNameBranch , DEFAULT_PITCH | FF_DECORATIVE, g_nFontHeight+3); // DEFAULT_CHARSET -//#endif -// _UpdateWindowFontHeights( nFontHeight ); +#endif + _UpdateWindowFontHeights( g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontHeight ); int iColor; @@ -8634,7 +8677,7 @@ Update_t DebuggerProcessCommand( const bool bEchoConsoleInput ) { Update_t bUpdateDisplay = UPDATE_NOTHING; - TCHAR sText[ CONSOLE_WIDTH ]; + char sText[ CONSOLE_WIDTH ]; if (bEchoConsoleInput) ConsoleDisplayPush( ConsoleInputPeek() ); @@ -8653,7 +8696,7 @@ Update_t DebuggerProcessCommand( const bool bEchoConsoleInput ) int nDelayedTargets = AssemblerDelayedTargetsSize(); if (nDelayedTargets) { - wsprintf( sText, " Asm: %d sym declared, not defined", nDelayedTargets ); + sprintf( sText, " Asm: %d sym declared, not defined", nDelayedTargets ); ConsoleDisplayPush( sText ); bUpdateDisplay |= UPDATE_CONSOLE_DISPLAY; } @@ -8671,7 +8714,7 @@ Update_t DebuggerProcessCommand( const bool bEchoConsoleInput ) int nArgs = ParseInput( g_pConsoleInput ); 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 ); } else diff --git a/source/Debug.h b/source/Debug.h index 1c0d25d9..a4378712 100644 --- a/source/Debug.h +++ b/source/Debug.h @@ -27,7 +27,7 @@ using namespace std; extern int g_nBreakpoints; 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 ]; // Full-Speed debugging diff --git a/source/Debugger_Console.cpp b/source/Debugger_Console.cpp index 6be900b5..ee219bff 100644 --- a/source/Debugger_Console.cpp +++ b/source/Debugger_Console.cpp @@ -76,7 +76,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Input Line // 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) int g_nConsoleInputChars = 0; @@ -89,6 +89,23 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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 () { @@ -106,15 +123,19 @@ bool ConsolePrint ( const char * pText ) // Convert color string to native console color text // Ignores g_nConsoleDisplayWidth - conchar_t c; + char c; int x = 0; - const char * pSrc = pText; - conchar_t *pDst = & g_aConsoleBuffer[ g_nConsoleBuffer ][ 0 ]; + const char *pSrc = pText; + conchar_t *pDst = & g_aConsoleBuffer[ g_nConsoleBuffer ][ 0 ]; + + conchar_t g = 0; + bool bHaveColor = false; + char cColor = 0; while ((x < CONSOLE_WIDTH) && (c = *pSrc)) { - if ((c == '\n') || (x == (CONSOLE_WIDTH - 1))) + if ((c == '\n') || (x >= (CONSOLE_WIDTH - 1))) { *pDst = 0; x = 0; @@ -130,22 +151,102 @@ bool ConsolePrint ( const char * pText ) pDst = & g_aConsoleBuffer[ g_nConsoleBuffer ][ 0 ]; } else - if (ConsoleColor_IsCharMeta( c )) { - pSrc++; - c = *pSrc; - if (c) + g = (c & _CONSOLE_COLOR_MASK); + + // `# `A color encode mouse text + if (ConsoleColor_IsCharMeta( c )) { - if (ConsoleColor_IsCharMeta( c )) - *pDst = c; + if (! pSrc[1]) + break; + + if (ConsoleColor_IsCharMeta( pSrc[1] )) // ` ` + { + bHaveColor = false; + cColor = 0; + g = ConsoleColor_MakeColor( cColor, c ); + *pDst = g; + x++; + pDst++; + } else - *pDst = ConsoleColor_Make( c ); - x++; + if (ConsoleColor_IsCharColor( pSrc[1] )) // ` # + { + cColor = pSrc[1]; + bHaveColor = true; + } + else // ` @ + { + c = ConsoleColor_MakeMouse( pSrc[1] ); + g = ConsoleColor_MakeColor( cColor, c ); + *pDst = g; + x++; + pDst++; + } + pSrc++; pSrc++; - pDst++; } 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 { @@ -154,6 +255,7 @@ bool ConsolePrint ( const char * pText ) pSrc++; pDst++; } +*/ } *pDst = 0; g_nConsoleBuffer++; @@ -175,7 +277,7 @@ bool ConsoleBufferPush ( const char * pText ) int x = 0; 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)) { @@ -215,7 +317,11 @@ void ConsoleBufferPop () int y = 0; 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++; } @@ -228,10 +334,26 @@ void ConsoleBufferPop () //=========================================================================== void ConsoleBufferToDisplay () { - ConsoleDisplayPush( (char*) ConsoleBufferPeek() ); + ConsoleDisplayPush( ConsoleBufferPeek() ); 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) { @@ -239,27 +361,39 @@ Update_t ConsoleDisplayError ( const char * pText) return ConsoleUpdate(); } -// Shifts the console display lines "up" + //=========================================================================== 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); while (nLen--) { - strcpy( - (char*) g_aConsoleDisplay[(nLen + 1 + CONSOLE_FIRST_LINE )] - ,(char*) g_aConsoleDisplay[nLen + CONSOLE_FIRST_LINE] + memcpy( + (char*) g_aConsoleDisplay[(nLen + 1 + CONSOLE_FIRST_LINE )] + , (char*) g_aConsoleDisplay[nLen + CONSOLE_FIRST_LINE] + , sizeof(conchar_t) * CONSOLE_WIDTH ); -// , CONSOLE_WIDTH ); } if (pText) - strcpy( + { + memcpy( (char*) g_aConsoleDisplay[ CONSOLE_FIRST_LINE ] , pText - ); -// , CONSOLE_WIDTH ); - + , sizeof(conchar_t) * CONSOLE_WIDTH + ); + } + g_nConsoleDisplayTotal++; if (g_nConsoleDisplayTotal > (CONSOLE_HEIGHT - CONSOLE_FIRST_LINE)) g_nConsoleDisplayTotal = (CONSOLE_HEIGHT - CONSOLE_FIRST_LINE); @@ -272,11 +406,19 @@ void ConsoleDisplayPause () { if (g_nConsoleBuffer) { +#if CONSOLE_INPUT_CHAR16 + ConsoleConvertFromText( + g_aConsoleInput, + "...press SPACE continue, ESC skip..." + ); + g_nConsolePromptLen = ConsoleLineLength( g_pConsoleInput ) + 1; +#else strcpy( - (char*) g_aConsoleInput, + g_aConsoleInput, "...press SPACE continue, ESC skip..." ); g_nConsolePromptLen = strlen( g_pConsoleInput ) + 1; +#endif g_nConsoleInputChars = 0; g_bConsoleBufferPaused = true; } @@ -310,13 +452,9 @@ bool ConsoleInputBackSpace () bool ConsoleInputClear () { 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) { -// ZeroMemory( g_pConsoleInput, g_nConsoleDisplayWidth ); g_nConsoleInputChars = 0; return true; } @@ -342,7 +480,7 @@ void ConsoleUpdateCursor ( char ch ) g_sConsoleCursor[0] = ch; else { - ch = g_aConsoleInput[ g_nConsoleInputChars + g_nConsolePromptLen ]; + ch = (char) g_aConsoleInput[ g_nConsoleInputChars + g_nConsolePromptLen ]; if (! ch) { ch = CHAR_SPACE; @@ -355,7 +493,9 @@ void ConsoleUpdateCursor ( char ch ) //=========================================================================== 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_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 = (char*) &g_aConsoleInput[ g_nConsolePromptLen ]; // nLen]; + g_pConsoleInput = &g_aConsoleInput[ g_nConsolePromptLen ]; g_nConsoleInputChars = 0; } diff --git a/source/Debugger_Console.h b/source/Debugger_Console.h index ac4ea141..2ef46cfa 100644 --- a/source/Debugger_Console.h +++ b/source/Debugger_Console.h @@ -17,63 +17,62 @@ // Color ____________________________________________________________________ - //typedef short conchar_t; - typedef unsigned char conchar_t; + // typedef unsigned char conchar_t; + typedef short conchar_t; enum ConsoleColors_e { - CONSOLE_COLOR_K, + CONSOLE_COLOR_K, // 0 CONSOLE_COLOR_x = 0, // default console foreground - CONSOLE_COLOR_R, - CONSOLE_COLOR_G, - CONSOLE_COLOR_Y, - CONSOLE_COLOR_B, - CONSOLE_COLOR_M, - CONSOLE_COLOR_C, - CONSOLE_COLOR_W, - - MAX_CONSOLE_COLORS + CONSOLE_COLOR_R, // 1 + CONSOLE_COLOR_G, // 2 + CONSOLE_COLOR_Y, // 3 + CONSOLE_COLOR_B, // 4 + CONSOLE_COLOR_M, // 5 Lite Blue + CONSOLE_COLOR_C, // 6 + CONSOLE_COLOR_W, // 7 + CONSOLE_COLOR_O, // 8 + CONSOLE_COLOR_k, // 9 Grey + NUM_CONSOLE_COLORS }; - - extern COLORREF g_anConsoleColor[ MAX_CONSOLE_COLORS ]; + extern COLORREF g_anConsoleColor[ NUM_CONSOLE_COLORS ]; // Note: THe ` ~ key should always display ~ to prevent rendering errors #define CONSOLE_COLOR_ESCAPE_CHAR '`' #define _CONSOLE_COLOR_MASK 0x7F -// 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" - +/* Help Colors */ #if 1 // USE_APPLE_FONT - #define CON_COLOR_DEFAULT "`0" - #define CON_COLOR_USAGE "`3" - #define CON_COLOR_PARAM "`2" - #define CON_COLOR_KEY "`1" - #define CON_COLOR_ARG_MAND "`5" - #define CON_COLOR_ARG_OPT "`4" - #define CON_COLOR_ARG_SEP "`3" - #define CON_COLOR_NUM "`2" + // Console Help Color + #define CHC_DEFAULT "`0" + #define CHC_USAGE "`3" + #define CHC_CATEGORY "`6" + #define CHC_COMMAND "`2" + #define CHC_KEY "`1" + #define CHC_ARG_MAND "`7" // < > + #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 - #define CON_COLOR_DEFAULT "" - #define CON_COLOR_USAGE "" - #define CON_COLOR_PARAM "" - #define CON_COLOR_KEY "" - #define CON_COLOR_ARG_MAND "" - #define CON_COLOR_ARG_OPT "" - #define CON_COLOR_ARG_SEP "" + #define CHC_DEFAULT "" + #define CHC_USAGE "" + #define CHC_COMMAND "" + #define CHC_KEY "" + #define CHC_ARG_MAND "" + #define CHC_ARG_OPT "" + #define CHC_ARG_SEP "" + #define CHC_NUMBER "" + #define CHC_SYMBOL "" + #define CHC_ADDRESS "" + #define CHC_ERROR "" + #define CHC_STRING "" + #define CHC_EXAMPLE "" #endif // ascii markup @@ -86,52 +85,87 @@ inline bool ConsoleColor_IsCharColor( unsigned char c ) { - if ((c >= '0') && (c <= '7')) + if ((c >= '0') && ((c - '0') < NUM_CONSOLE_COLORS)) return true; return false; } - // native char + // Console "Native" Chars + // // There are a few different ways of encoding color chars & mouse text - // 0x80 Console Color - // 0xC0 Mouse Text - // High Low - // 1) xx n/a Extended ASCII (Multi-Byte to Single-Byte) - // 0..7 = Color - // @..Z = Mouse Text - // Con: Colors chars take up extra chars - // 2) ccxx Color ASCII Con: need to provide char8 and char16 API - // 3) xxcc ASCII Color Con: "" - // 4) fxx Flag ASCII Con: Colors chars take up extra chars - inline bool ConsoleColor_IsMeta( conchar_t g ) + // Simplist method is to use a user-defined ESCAPE char to shift + // into color mode, or mouse text mode. The other solution + // is to use a wide-char, simulating unicode16. + // + // C1C0 char16 of High Byte (c1) and Low Byte (c0) + // 1) --?? Con: Colors chars take up extra chars. + // Con: String Length is complicated. + // Pro: simple to parse + // + // <-- WE USE THIS + // 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) return true; return false; } -// inline bool ConsoleColor_IsCharColor( unsigned char c ) inline bool ConsoleColor_IsColor( conchar_t g ) { - if (((g - '0') & _CONSOLE_COLOR_MASK) < MAX_CONSOLE_COLORS) - return true; - return false; + return ConsoleColor_IsCharColor (g >> 8); } inline COLORREF ConsoleColor_GetColor( conchar_t g ) { - const int iColor = g & (MAX_CONSOLE_COLORS - 1); - return g_anConsoleColor[ iColor ]; + const int iColor = (g >> 8) - '0'; + 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); } - 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; } @@ -165,14 +199,15 @@ // Input Line // 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) - extern int g_nConsoleInputChars ; - extern char * g_pConsoleInput ;//= 0; // points to past prompt - extern const char * g_pConsoleFirstArg ;//= 0; // points to first arg - extern bool g_bConsoleInputQuoted ; - extern char g_nConsoleInputSkip ; + extern int g_nConsoleInputChars ; + extern char * g_pConsoleInput ; // points to past prompt + extern const char * g_pConsoleFirstArg ; // points to first arg + extern bool g_bConsoleInputQuoted ; + + extern char g_nConsoleInputSkip ; // Prototypes _______________________________________________________________ @@ -186,10 +221,13 @@ void ConsoleBufferPop (); bool ConsoleBufferPush ( const char * pString ); + void ConsoleConvertFromText( conchar_t * sText, const char * pText ); + // Display Update_t ConsoleDisplayError ( const char * pTextError ); void ConsoleDisplayPause (); void ConsoleDisplayPush ( const char * pText ); + void ConsoleDisplayPush ( const conchar_t * pText ); Update_t ConsoleUpdate (); // Input diff --git a/source/Debugger_Display.cpp b/source/Debugger_Display.cpp index f5e8d805..1479575b 100644 --- a/source/Debugger_Display.cpp +++ b/source/Debugger_Display.cpp @@ -70,39 +70,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA HBRUSH g_hConsoleBrushFG = 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( 255, 0, 0 ), // 1 001 R + RGB( 255, 32, 32 ), // 1 001 R RGB( 0, 255, 0 ), // 2 010 G RGB( 255, 255, 0 ), // 3 011 Y - RGB( 0, 0, 255 ), // 4 100 B - RGB( 255, 0, 255 ), // 5 101 M + RGB( 64, 64, 255 ), // 4 100 B +// RGB( 255, 0, 255 ), // 5 101 M Purple/Magenta is useless + RGB( 80, 192, 255 ), RGB( 0, 255, 255 ), // 6 110 C RGB( 255, 255, 255 ), // 7 111 W - }; - - 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 + RGB( 255, 128, 0 ), // 8 Orange + RGB( 128, 128, 128 ) // 9 Grey }; // Disassembly @@ -196,7 +176,7 @@ static void SetupColorsHiLoBits ( bool bHiBit, bool bLoBit, const int iBackground, const int iForeground, const int iColorHiBG , /*const int iColorHiFG, 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 iHighBackground = BG_INFO_CHAR, const int iHighForeground = FG_INFO_CHAR_HI, 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; - char c; - const char *p = pText; + conchar_t g; + const conchar_t *pSrc = pText; - while (c = *p) + while (g = (*pSrc)) { - if (c == '\n') + if (g == '\n') { x = nLeft; y += CONSOLE_FONT_HEIGHT; - p++; + pSrc++; continue; } - else - if (ConsoleColor_IsMeta( c )) + + if (ConsoleColor_IsColorOrMouse( g )) { - if (ConsoleColor_IsColor( c )) + if (ConsoleColor_IsColor( g )) { - DebuggerSetColorFG( ConsoleColor_GetColor( c ) ); - p++; - continue; + DebuggerSetColorFG( ConsoleColor_GetColor( g ) ); } - 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; - 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 FillRect( g_hFrameDC, &rRect, g_hConsoleBrushBG ); @@ -878,20 +857,20 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB if (nTarget < nBaseAddress) { - wsprintf( sBranch_, TEXT("%s"), g_sConfigBranchIndicatorUp[ g_iConfigDisasmBranchType ] ); + sprintf( sBranch_, "%s", g_sConfigBranchIndicatorUp[ g_iConfigDisasmBranchType ] ); } else if (nTarget > nBaseAddress) { - wsprintf( sBranch_, TEXT("%s"), g_sConfigBranchIndicatorDown[ g_iConfigDisasmBranchType ] ); + sprintf( sBranch_, "%s", g_sConfigBranchIndicatorDown[ g_iConfigDisasmBranchType ] ); } 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 == AM_A ) || // Absolute (iOpmode == AM_Z ) || // Zeropage @@ -943,13 +922,13 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB pTarget = FormatAddress( nTarget, nOpBytes ); } -// wsprintf( sTarget, g_aOpmodes[ iOpmode ]._sFormat, pTarget ); +// sprintf( sTarget, g_aOpmodes[ iOpmode ]._sFormat, pTarget ); if (bDisasmFormatFlags & DISASM_FORMAT_OFFSET) { int nAbsTargetOffset = (nTargetOffset_ > 0) ? nTargetOffset_ : -nTargetOffset_; - wsprintf( sTargetOffset_, "%d", nAbsTargetOffset ); + sprintf( sTargetOffset_, "%d", nAbsTargetOffset ); } - wsprintf( sTarget_, "%s", pTarget ); + sprintf( sTarget_, "%s", pTarget ); // 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)) // 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) - wsprintf( sTargetPointer_, "%04X", nTargetPointer & 0xFFFF ); + sprintf( sTargetPointer_, "%04X", nTargetPointer & 0xFFFF ); if (iOpmode != AM_NA ) // Indirect Absolute { bDisasmFormatFlags |= DISASM_FORMAT_TARGET_VALUE; if (g_iConfigDisasmTargets & DISASM_TARGET_VAL) - wsprintf( sTargetValue_, "%02X", nTargetValue & 0xFF ); + sprintf( sTargetValue_, "%02X", nTargetValue & 0xFF ); bDisasmFormatFlags |= DISASM_FORMAT_CHAR; nImmediate_ = (BYTE) nTargetValue; @@ -989,22 +968,22 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB if (ConsoleColorIsEscapeMeta( _char )) sprintf( sImmediate_, "%c%c", _char, _char ); else - wsprintf( sImmediate_, "%c", _char ); + sprintf( sImmediate_, "%c", _char ); #endif } // if (iOpmode == AM_NA ) // Indirect Absolute -// wsprintf( sTargetValue_, "%04X", nTargetPointer & 0xFFFF ); +// sprintf( sTargetValue_, "%04X", nTargetPointer & 0xFFFF ); // else -// // wsprintf( sTargetValue_, "%02X", nTargetValue & 0xFF ); -// wsprintf( sTargetValue_, "%04X:%02X", nTargetPointer & 0xFFFF, nTargetValue & 0xFF ); +// // sprintf( sTargetValue_, "%02X", nTargetValue & 0xFF ); +// sprintf( sTargetValue_, "%04X:%02X", nTargetPointer & 0xFFFF, nTargetValue & 0xFF ); } } else if (iOpmode == AM_M) { -// wsprintf( sTarget, g_aOpmodes[ iOpmode ]._sFormat, (unsigned)nTarget ); - wsprintf( sTarget_, "%02X", (unsigned)nTarget ); +// sprintf( sTarget, g_aOpmodes[ iOpmode ]._sFormat, (unsigned)nTarget ); + sprintf( sTarget_, "%02X", (unsigned)nTarget ); if (iOpmode == AM_M) { @@ -1017,31 +996,31 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB if (ConsoleColorIsEscapeMeta( _char )) sprintf( sImmediate_, "%c%c", _char, _char ); else - wsprintf( sImmediate_, "%c", _char ); + sprintf( sImmediate_, "%c", _char ); #endif } } } - wsprintf( sAddress_, "%04X", nBaseAddress ); + sprintf( sAddress_, "%04X", nBaseAddress ); // Opcode Bytes - TCHAR *pDst = sOpCodes_; + char *pDst = sOpCodes_; for( int iBytes = 0; iBytes < nOpBytes; iBytes++ ) { BYTE nMem = (unsigned)*(mem+nBaseAddress+iBytes); - wsprintf( pDst, TEXT("%02X"), nMem ); // sBytes+_tcslen(sBytes) + sprintf( pDst, "%02X", nMem ); // sBytes+strlen(sBytes) pDst += 2; if (g_bConfigDisasmOpcodeSpaces) { - _tcscat( pDst, TEXT(" " ) ); + strcat( pDst, " " ); pDst++; // 2.5.3.3 fix } } - while (_tcslen(sOpCodes_) < nMinBytesLen) + while (strlen(sOpCodes_) < nMinBytesLen) { - _tcscat( sOpCodes_, TEXT(" ") ); + strcat( sOpCodes_, " " ); } return bDisasmFormatFlags; @@ -1080,7 +1059,7 @@ void SetupColorsHiLoBits ( bool bHighBit, bool bCtrlBit, // 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 iHighBackground /*= BG_INFO_CHAR*/, const int iHighForeground /*= FG_INFO_CHAR_HI*/, 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; 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 DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA @@ -1211,16 +1190,16 @@ void DrawBreakpoints ( int line ) DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) ); - wsprintf( sText, "B" ); + sprintf( sText, "B" ); PrintTextCursorX( sText, rect2 ); DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET ) ); - wsprintf( sText, "%X ", iBreakpoint ); + sprintf( sText, "%X ", iBreakpoint ); PrintTextCursorX( sText, rect2 ); // DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ) ); -// _tcscpy( sText, TEXT(".") ); +// strcpy( sText, "." ); // PrintTextCursorX( sText, rect2 ); #if DEBUG_FORCE_DISPLAY @@ -1280,7 +1259,7 @@ void DrawBreakpoints ( int line ) DebuggerSetColorFG( nColor ); #endif - wsprintf( sText, TEXT("%04X"), nAddress1 ); + sprintf( sText, "%04X", nAddress1 ); PrintTextCursorX( sText, rect2 ); if (nLength > 1) @@ -1290,7 +1269,7 @@ void DrawBreakpoints ( int line ) // if (g_bConfigDisasmOpcodeSpaces) // { -// PrintTextCursorX( TEXT(" "), rect2 ); +// PrintTextCursorX( " ", rect2 ); // rect2.left += g_nFontWidthAvg; // } @@ -1313,7 +1292,7 @@ void DrawBreakpoints ( int line ) } DebuggerSetColorFG( nColor ); #endif - wsprintf( sText, TEXT("%04X"), nAddress2 ); + sprintf( sText, "%04X", nAddress2 ); PrintTextCursorX( sText, rect2 ); } @@ -1321,7 +1300,7 @@ void DrawBreakpoints ( int line ) // Windows HACK: Bugfix: Rest of line is still breakpoint background color DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC - PrintTextCursorX( TEXT(" "), rect2 ); + PrintTextCursorX( " ", rect2 ); #endif rect.top += g_nFontHeight; rect.bottom += g_nFontHeight; @@ -1379,11 +1358,28 @@ void DrawConsoleCursor () rect.left = (g_nConsoleInputChars + g_nConsolePromptLen) * nWidth; rect.top = GetConsoleTopPixels( y ); rect.bottom = rect.top + nLineHeight; //g_nFontHeight; - rect.right = rect.left + nWidth; + rect.right = rect.left + nWidth; 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 ) @@ -1391,33 +1387,25 @@ void DrawConsoleLine( const conchar_t * pText, int y ) if (y < 0) return; -// int nHeight = WindowGetHeight( g_iWindowThis ); - int nLineHeight = GetConsoleLineHeightPixels(); - RECT rect; - rect.left = 0; - 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; + GetConsoleRect( y, rect ); // 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 )); 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 - TCHAR sAddress [ CHARS_FOR_ADDRESS ]; - TCHAR sOpcodes [(nMaxOpcodes*3)+1] = TEXT(""); - TCHAR sTarget [nMaxAddressLen] = TEXT(""); + char sAddress [ CHARS_FOR_ADDRESS ]; + char sOpcodes [(nMaxOpcodes*3)+1] = ""; + char sTarget [nMaxAddressLen] = ""; - TCHAR sTargetOffset[ CHARS_FOR_ADDRESS ] = TEXT(""); // +/- 255, realistically +/-1 - int nTargetOffset; + char sTargetOffset[ CHARS_FOR_ADDRESS ] = ""; // +/- 255, realistically +/-1 + int nTargetOffset; - TCHAR sTargetPointer[ CHARS_FOR_ADDRESS ] = TEXT(""); - TCHAR sTargetValue [ CHARS_FOR_ADDRESS ] = TEXT(""); + char sTargetPointer[ CHARS_FOR_ADDRESS ] = ""; + char sTargetValue [ CHARS_FOR_ADDRESS ] = ""; - char nImmediate = 0; - TCHAR sImmediate[ 4 ]; // 'c' - TCHAR sBranch [ 4 ]; // ^ + char nImmediate = 0; + char sImmediate[ 4 ]; // 'c' + char sBranch [ 4 ]; // ^ bool bTargetIndirect = false; bool bTargetX = false; @@ -1679,11 +1667,11 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text) if (! bCursorLine) DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPCODE ) ); -// PrintTextCursorX( TEXT(" "), linerect ); +// PrintTextCursorX( " ", linerect ); if (g_bConfigDisasmOpcodesView) PrintTextCursorX( (LPCTSTR) sOpcodes, linerect ); -// PrintTextCursorX( TEXT(" "), linerect ); +// PrintTextCursorX( " ", linerect ); // Label linerect.left = (int) aTabs[ TS_LABEL ]; @@ -1696,7 +1684,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text) PrintTextCursorX( pSymbol, linerect ); } // linerect.left += (g_nFontWidthAvg * DISASM_SYMBOL_LEN); -// PrintTextCursorX( TEXT(" "), linerect ); +// PrintTextCursorX( " ", linerect ); // 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; PrintTextCursorX( pMnemonic, linerect ); - PrintTextCursorX( TEXT(" "), linerect ); + PrintTextCursorX( " ", linerect ); // Target if (iOpmode == AM_M) { if (! bCursorLine) DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); - PrintTextCursorX( TEXT("#$"), linerect ); + PrintTextCursorX( "#$", linerect ); } if (bTargetIndirect) { if (! bCursorLine) DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); - PrintTextCursorX( TEXT("("), linerect ); + PrintTextCursorX( "(", linerect ); } char *pTarget = sTarget; @@ -1730,7 +1718,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text) pTarget++; if (! bCursorLine) DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); - PrintTextCursorX( TEXT("$"), linerect ); + PrintTextCursorX( "$", linerect ); } if (! bCursorLine) @@ -1753,7 +1741,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text) } } PrintTextCursorX( pTarget, linerect ); -// PrintTextCursorX( TEXT(" "), linerect ); +// PrintTextCursorX( " ", linerect ); // Target Offset +/- if (bDisasmFormatFlags & DISASM_FORMAT_OFFSET) @@ -1762,9 +1750,9 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text) DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); if (nTargetOffset > 0) - PrintTextCursorX( TEXT("+" ), linerect ); + PrintTextCursorX( "+", linerect ); if (nTargetOffset < 0) - PrintTextCursorX( TEXT("-" ), linerect ); + PrintTextCursorX( "-", linerect ); if (! bCursorLine) { @@ -1779,16 +1767,34 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text) DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); if (bTargetX) - PrintTextCursorX( TEXT(",X"), linerect ); - + { + PrintTextCursorX( ",", linerect ); + if (! bCursorLine) + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_REG ) ); + PrintTextCursorX( "X", linerect ); + } + 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) - PrintTextCursorX( TEXT(")"), linerect ); + PrintTextCursorX( ")", linerect ); if (iOpmode == AM_NZY) - PrintTextCursorX( TEXT(",Y"), linerect ); + { + PrintTextCursorX( ",", linerect ); + if (! bCursorLine) + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_REG ) ); + PrintTextCursorX( "Y", linerect ); + } } // Memory Pointer and Value @@ -1796,7 +1802,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text) { linerect.left = (int) aTabs[ TS_IMMEDIATE ]; // TS_IMMEDIATE ]; -// PrintTextCursorX( TEXT(" "), linerect ); +// PrintTextCursorX( " ", linerect ); if (! bCursorLine) DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS )); @@ -1815,7 +1821,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text) DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPCODE )); 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)) -// PrintTextCursorX( TEXT("'"), linerect ); // TEXT(" '") +// PrintTextCursorX( "'", linerect ); if (! bCursorLine) { @@ -1846,7 +1852,7 @@ WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text) } // if (! (bDisasmFormatFlags & DISASM_FORMAT_TARGET_POINTER)) -// PrintTextCursorX( TEXT("'"), linerect ); +// PrintTextCursorX( "'", linerect ); } // 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 #endif - PrintTextColor( sBranch, linerect ); +// PrintTextColor( sBranch, linerect ); + PrintText( sBranch, linerect ); #if !USE_APPLE_FONT if (g_iConfigDisasmBranchType) @@ -1884,8 +1891,8 @@ void DrawFlags ( int line, WORD nRegFlags, LPTSTR pFlagNames_) if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA)))) return; - TCHAR sFlagNames[ _6502_NUM_FLAGS+1 ] = TEXT(""); // = TEXT("NVRBDIZC"); // copy from g_aFlagNames - TCHAR sText[4] = TEXT("?"); + char sFlagNames[ _6502_NUM_FLAGS+1 ] = ""; // = "NVRBDIZC"; // copy from g_aFlagNames + char sText[4] = "?"; RECT rect; int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; @@ -1969,7 +1976,7 @@ void DrawFlags ( int line, WORD nRegFlags, LPTSTR pFlagNames_) { if (! bSet) //(nFlags & 1)) { - sFlagNames[nFlag] = TEXT('.'); + sFlagNames[nFlag] = '.'; } else { @@ -1981,7 +1988,7 @@ void DrawFlags ( int line, WORD nRegFlags, LPTSTR pFlagNames_) } if (pFlagNames_) - _tcscpy(pFlagNames_,sFlagNames); + strcpy(pFlagNames_,sFlagNames); /* if (g_hFrameDC) { @@ -2034,11 +2041,11 @@ void DrawMemory ( int line, int iMemDump ) rect2 = rect; const int MAX_MEM_VIEW_TXT = 16; - TCHAR sText[ MAX_MEM_VIEW_TXT * 2 ]; - TCHAR sData[ MAX_MEM_VIEW_TXT * 2 ]; + char sText[ MAX_MEM_VIEW_TXT * 2 ]; + char sData[ MAX_MEM_VIEW_TXT * 2 ]; - TCHAR sType [ 4 ] = TEXT("Mem"); - TCHAR sAddress[ 8 ] = TEXT(""); + char sType [ 4 ] = "Mem"; + char sAddress[ 8 ] = ""; int iForeground = FG_INFO_OPCODE; int iBackground = BG_INFO; @@ -2046,25 +2053,25 @@ void DrawMemory ( int line, int iMemDump ) #if DISPLAY_MEMORY_TITLE if (eDevice == DEV_SY6522) { -// wsprintf(sData,TEXT("Mem at SY#%d"), nAddr); - wsprintf( sAddress,TEXT("SY#%d"), nAddr ); +// sprintf(sData,"Mem at SY#%d", nAddr); + sprintf( sAddress,"SY#%d", nAddr ); } else if(eDevice == DEV_AY8910) { -// wsprintf(sData,TEXT("Mem at AY#%d"), nAddr); - wsprintf( sAddress,TEXT("AY#%d"), nAddr ); +// sprintf(sData,"Mem at AY#%d", nAddr); + sprintf( sAddress,"AY#%d", nAddr ); } else { - wsprintf( sAddress,TEXT("%04X"),(unsigned)nAddr); + sprintf( sAddress,"%04X",(unsigned)nAddr); if (iView == MEM_VIEW_HEX) - wsprintf( sType, TEXT("HEX") ); + sprintf( sType, "HEX" ); else if (iView == MEM_VIEW_ASCII) - wsprintf( sType, TEXT("ASCII") ); + sprintf( sType, "ASCII" ); else - wsprintf( sType, TEXT("TEXT") ); + sprintf( sType, "TEXT" ); } rect2 = rect; @@ -2073,7 +2080,7 @@ void DrawMemory ( int line, int iMemDump ) PrintTextCursorX( sType, rect2 ); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); - PrintTextCursorX( TEXT(" at " ), rect2 ); + PrintTextCursorX( " at ", rect2 ); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); PrintTextCursorY( sAddress, rect2 ); @@ -2110,7 +2117,7 @@ void DrawMemory ( int line, int iMemDump ) if (iView == MEM_VIEW_HEX) { - wsprintf( sText, TEXT("%04X"), iAddress ); + sprintf( sText, "%04X", iAddress ); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); 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 // if ((iAddress >= _6502_IO_BEGIN) && (iAddress <= _6502_IO_END)) // { -// wsprintf( sText, TEXT("IO ") ); +// sprintf( sText, "IO " ); // } // else 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) DebuggerSetColorFG( DebuggerGetColor( iForeground )); else @@ -2143,7 +2150,7 @@ void DrawMemory ( int line, int iMemDump ) else 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) DebuggerSetColorFG( DebuggerGetColor( iForeground )); else @@ -2162,7 +2169,7 @@ void DrawMemory ( int line, int iMemDump ) { DebuggerSetColorFG( DebuggerGetColor( FG_INFO_IO_BYTE )); } - wsprintf(sText, TEXT("%02X "), nData ); + sprintf(sText, "%02X ", nData ); } else { @@ -2179,7 +2186,7 @@ void DrawMemory ( int line, int iMemDump ) // Windows HACK: Bugfix: Rest of line is still background color // DebuggerSetColorBG( hDC, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA // DebuggerSetColorFG(hDC, DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC -// PrintTextCursorX( TEXT(" "), rect2 ); +// PrintTextCursorX( " ", rect2 ); rect.top += 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; int nOffset = 6; - TCHAR sValue[8]; + char sValue[8]; if (PARAM_REG_SP == iSource) { WORD nStackDepth = _6502_STACK_END - nValue; - wsprintf( sValue, "%02X", nStackDepth ); + sprintf( sValue, "%02X", nStackDepth ); int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; 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) { - wsprintf(sValue,TEXT("%04X"), nData); + sprintf(sValue,"%04X", nData); } else { @@ -2258,7 +2265,7 @@ void DrawRegister ( int line, LPCTSTR name, const int nBytes, const WORD nValue, DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); 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 @@ -2279,30 +2286,28 @@ void DrawRegister ( int line, LPCTSTR name, const int nBytes, const WORD nValue, //=========================================================================== void DrawSourceLine( int iSourceLine, RECT &rect ) { - TCHAR sLine[ CONSOLE_WIDTH ]; - + char sLine[ CONSOLE_WIDTH ]; ZeroMemory( sLine, CONSOLE_WIDTH ); if ((iSourceLine >=0) && (iSourceLine < g_AssemblerSourceBuffer.GetNumLines() )) { char * pSource = g_AssemblerSourceBuffer.GetLine( iSourceLine ); -// int nLenSrc = _tcslen( pSource ); +// int nLenSrc = strlen( pSource ); // if (nLenSrc >= CONSOLE_WIDTH) // bool bStop = true; 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 { - _tcscpy( sLine, TEXT(" ")); + strcpy( sLine, " " ); } PrintText( sLine, rect ); rect.top += g_nFontHeight; -// iSourceLine++; } @@ -2372,8 +2377,8 @@ void DrawTargets ( int line) // if ((aTarget[iAddress] >= _6502_IO_BEGIN) && (aTarget[iAddress] <= _6502_IO_END)) // aTarget[iAddress] = NO_6502_TARGET; - TCHAR sAddress[8] = TEXT("-none-"); - TCHAR sData[8] = TEXT(""); + char sAddress[8] = "-none-"; + char sData[8] = ""; #if DEBUG_FORCE_DISPLAY if (aTarget[iAddress] == NO_6502_TARGET) @@ -2381,11 +2386,11 @@ void DrawTargets ( int line) #endif if (aTarget[iAddress] != NO_6502_TARGET) { - wsprintf(sAddress,TEXT("%04X"),aTarget[iAddress]); + sprintf(sAddress,"%04X",aTarget[iAddress]); if (iAddress) - wsprintf(sData,TEXT("%02X"),*(LPBYTE)(mem+aTarget[iAddress])); + sprintf(sData,"%02X",*(LPBYTE)(mem+aTarget[iAddress])); else - wsprintf(sData,TEXT("%04X"),*(LPWORD)(mem+aTarget[iAddress])); + sprintf(sData,"%04X",*(LPWORD)(mem+aTarget[iAddress])); } rect.left = DISPLAY_TARGETS_COLUMN; @@ -2426,7 +2431,7 @@ void DrawWatches (int line) rect.right = DISPLAY_WIDTH; rect.bottom = rect.top + g_nFontHeight; - TCHAR sText[16] = TEXT("Watches"); + char sText[16] = "Watches"; DebuggerSetColorBG( DebuggerGetColor( WATCH_ZERO_BG )); // BG_INFO @@ -2450,14 +2455,14 @@ void DrawWatches (int line) DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) ); PrintTextCursorX( "W", rect2 ); - wsprintf( sText, "%X ",iWatch ); + sprintf( sText, "%X ",iWatch ); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET )); PrintTextCursorX( sText, rect2 ); // DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); // PrintTextCursorX( ".", rect2 ); - wsprintf( sText,TEXT("%04X"), g_aWatches[iWatch].nAddress ); + sprintf( sText,"%04X", g_aWatches[iWatch].nAddress ); DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS )); PrintTextCursorX( sText, rect2 ); @@ -2465,12 +2470,12 @@ void DrawWatches (int line) PrintTextCursorX( ":", rect2 ); BYTE nTarget8 = (unsigned)*(LPBYTE)(mem+g_aWatches[iWatch].nAddress); - wsprintf(sText,TEXT("%02X"), nTarget8 ); + sprintf(sText,"%02X", nTarget8 ); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); PrintTextCursorX( sText, rect2 ); WORD nTarget16 = (unsigned)*(LPWORD)(mem+g_aWatches[iWatch].nAddress); - wsprintf( sText,TEXT(" %04X"), nTarget16 ); + sprintf( sText," %04X", nTarget16 ); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); PrintTextCursorX( sText, rect2 ); @@ -2478,7 +2483,7 @@ void DrawWatches (int line) PrintTextCursorX( ":", rect2 ); BYTE nValue8 = (unsigned)*(LPBYTE)(mem + nTarget16); - wsprintf(sText,TEXT("%02X"), nValue8 ); + sprintf(sText,"%02X", nValue8 ); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); PrintTextCursorX( sText, rect2 ); } @@ -2522,7 +2527,7 @@ void DrawZeroPagePointers ( int line ) DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) ); PrintTextCursorX( "Z", rect2 ); - wsprintf( sText, "%X ", iZP ); + sprintf( sText, "%X ", iZP ); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET )); PrintTextCursorX( sText, rect2 ); @@ -2555,13 +2560,13 @@ void DrawZeroPagePointers ( int line ) if ((nLen1) && (pSymbol1[0] == '$')) { // sprintf( sText, "%s%s", pSymbol1 ); -// wsprintf( sText, "%04X", nZPAddr1 ); +// sprintf( sText, "%04X", nZPAddr1 ); } else if ((nLen2) && (pSymbol2[0] == '$')) { // sprintf( sText, "%s%s", pSymbol2 ); -// wsprintf( sText, "%04X", nZPAddr2 ); +// sprintf( sText, "%04X", nZPAddr2 ); DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS )); } else @@ -2578,7 +2583,7 @@ void DrawZeroPagePointers ( int line ) rect2.top += g_nFontHeight; rect2.bottom += g_nFontHeight; - wsprintf( sText, "%02X", nZPAddr1 ); + sprintf( sText, "%02X", nZPAddr1 ); DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS )); PrintTextCursorX( sText, rect2 ); @@ -2586,7 +2591,7 @@ void DrawZeroPagePointers ( int line ) PrintTextCursorX( ":", rect2 ); WORD nTarget16 = (WORD)mem[ nZPAddr1 ] | ((WORD)mem[ nZPAddr2 ]<< 8); - wsprintf( sText, "%04X", nTarget16 ); + sprintf( sText, "%04X", nTarget16 ); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); PrintTextCursorX( sText, rect2 ); @@ -2594,7 +2599,7 @@ void DrawZeroPagePointers ( int line ) PrintTextCursorX( ":", rect2 ); BYTE nValue8 = (unsigned)*(LPBYTE)(mem + nTarget16); - wsprintf(sText, "%02X", nValue8 ); + sprintf(sText, "%02X", nValue8 ); DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); PrintTextCursorX( sText, rect2 ); } @@ -2649,12 +2654,12 @@ void DrawSubWindow_Data (Update_t bUpdate) int iBackground; const int nMaxOpcodes = WINDOW_DATA_BYTES_PER_LINE; - TCHAR sAddress [ 5]; + char sAddress [ 5]; assert( CONSOLE_WIDTH > WINDOW_DATA_BYTES_PER_LINE ); - TCHAR sOpcodes [ CONSOLE_WIDTH ] = TEXT(""); - TCHAR sImmediate[ 4 ]; // 'c' + char sOpcodes [ CONSOLE_WIDTH ] = ""; + char sImmediate[ 4 ]; // 'c' const int nDefaultFontWidth = 7; // g_aFontConfig[FONT_DISASM_DEFAULT]._nFontWidth or g_nFontWidthAvg int X_OPCODE = 6 * nDefaultFontWidth; @@ -2681,13 +2686,13 @@ void DrawSubWindow_Data (Update_t bUpdate) iAddress = nAddress; // Format - wsprintf( sAddress, TEXT("%04X"), iAddress ); + sprintf( sAddress, "%04X", iAddress ); sOpcodes[0] = 0; for ( iByte = 0; iByte < nMaxOpcodes; 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; @@ -2726,7 +2731,7 @@ void DrawSubWindow_Data (Update_t bUpdate) // Seperator DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); - PrintTextCursorX( (LPCSTR) TEXT(" | " ), rect ); + PrintTextCursorX( " | ", rect ); // Plain Text @@ -2769,12 +2774,12 @@ void DrawSubWindow_Data (Update_t bUpdate) } 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 DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); - PrintTextCursorX( (LPCSTR) TEXT(" | " ), rect ); + PrintTextCursorX( " | ", rect ); nAddress += nMaxOpcodes; } @@ -2788,7 +2793,7 @@ void DrawSubWindow_Info( int iWindow ) if (g_iWindowThis == WINDOW_CONSOLE) return; - const TCHAR **sReg = g_aBreakpointSource; + const char **sReg = g_aBreakpointSource; int yRegs = 0; // 12 int yStack = yRegs + MAX_DISPLAY_REGS_LINES + 0; // 0 @@ -2813,11 +2818,11 @@ void DrawSubWindow_Info( int iWindow ) DrawZeroPagePointers( yZeroPage ); #if defined(SUPPORT_Z80_EMU) && defined(OUTPUT_Z80_REGS) - DrawRegister( 19,TEXT("AF"),2,*(WORD*)(membank+REG_AF)); - DrawRegister( 20,TEXT("BC"),2,*(WORD*)(membank+REG_BC)); - DrawRegister( 21,TEXT("DE"),2,*(WORD*)(membank+REG_DE)); - DrawRegister( 22,TEXT("HL"),2,*(WORD*)(membank+REG_HL)); - DrawRegister( 23,TEXT("IX"),2,*(WORD*)(membank+REG_IX)); + DrawRegister( 19,"AF",2,*(WORD*)(membank+REG_AF)); + DrawRegister( 20,"BC",2,*(WORD*)(membank+REG_BC)); + DrawRegister( 21,"DE",2,*(WORD*)(membank+REG_DE)); + DrawRegister( 22,"HL",2,*(WORD*)(membank+REG_HL)); + DrawRegister( 23,"IX",2,*(WORD*)(membank+REG_IX)); #endif // Right Side @@ -2898,11 +2903,11 @@ void DrawSubWindow_Source2 (Update_t bUpdate) rect.right = DISPLAY_DISASM_RIGHT; // HACK: MAGIC #: 7 // Draw Title - TCHAR sTitle[ CONSOLE_WIDTH ]; - TCHAR sText [ CONSOLE_WIDTH ]; - _tcscpy( sTitle, TEXT(" Source: ")); - _tcsncpy( sText, g_aSourceFileName, g_nConsoleDisplayWidth - _tcslen( sTitle ) - 1 ); - _tcscat( sTitle, sText ); + char sTitle[ CONSOLE_WIDTH ]; + char sText [ CONSOLE_WIDTH ]; + strcpy ( sTitle, " Source: " ); + strncpy( sText , g_aSourceFileName, g_nConsoleDisplayWidth - strlen( sTitle ) - 1 ); + strcat ( sTitle, sText ); DebuggerSetColorBG( DebuggerGetColor( BG_SOURCE_TITLE )); DebuggerSetColorFG( DebuggerGetColor( FG_SOURCE_TITLE )); diff --git a/source/Debugger_Display.h b/source/Debugger_Display.h index cf10fe3e..551a21ba 100644 --- a/source/Debugger_Display.h +++ b/source/Debugger_Display.h @@ -8,12 +8,9 @@ #define DEBUG_APPLE_FONT 0 // 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) #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 #define APPLE_FONT_BITMAP_PADDED 0 @@ -64,10 +61,11 @@ void PrintGlyph ( const int x, const int y, const int iChar ); int PrintText ( const char * pText, RECT & rRect ); - void PrintTextColor ( const char * pText, RECT & rRect ); int PrintTextCursorX( 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 DrawBreakpoints ( int line); diff --git a/source/Debugger_Help.cpp b/source/Debugger_Help.cpp index 4becf3d5..8dd18c56 100644 --- a/source/Debugger_Help.cpp +++ b/source/Debugger_Help.cpp @@ -29,6 +29,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #pragma hdrstop +#define DEBUG_COLOR_CONSOLE 0 + // Utility ________________________________________________________________________________________ @@ -134,68 +136,79 @@ void Help_Categories() char sText[ nBuf ] = ""; int nLen = 0; - nLen += StringCat( sText, CON_COLOR_USAGE , nBuf ); + // TODO/FIXME: Colorize( sText, ... ) + nLen += StringCat( sText, CHC_USAGE , nBuf ); nLen += StringCat( sText, "Usage", nBuf ); - nLen += StringCat( sText, CON_COLOR_DEFAULT, nBuf ); + nLen += StringCat( sText, CHC_DEFAULT, nBuf ); nLen += StringCat( sText, ": " , nBuf ); - nLen += StringCat( sText, CON_COLOR_ARG_OPT, nBuf ); + nLen += StringCat( sText, CHC_ARG_OPT, nBuf ); nLen += StringCat( sText, "[ ", nBuf ); - nLen += StringCat( sText, CON_COLOR_ARG_MAND, nBuf ); + nLen += StringCat( sText, CHC_ARG_MAND, nBuf ); nLen += StringCat( sText, "< ", nBuf ); for (int iCategory = _PARAM_HELPCATEGORIES_BEGIN ; iCategory < _PARAM_HELPCATEGORIES_END; iCategory++) { - TCHAR *pName = g_aParameters[ iCategory ].m_sName; + char *pName = g_aParameters[ iCategory ].m_sName; - if (nLen + _tcslen( pName ) >= (CONSOLE_WIDTH - 4)) + if (nLen + strlen( pName ) >= (CONSOLE_WIDTH - 1)) { ConsolePrint( sText ); sText[ 0 ] = 0; nLen = StringCat( sText, " ", nBuf ); } - StringCat( sText, CON_COLOR_PARAM, nBuf ); - nLen += StringCat( sText, pName, nBuf ); + StringCat( sText, CHC_COMMAND, nBuf ); + nLen += StringCat( sText, pName , nBuf ); if (iCategory < (_PARAM_HELPCATEGORIES_END - 1)) { - StringCat( sText, CON_COLOR_ARG_SEP, nBuf ); - nLen += StringCat( sText, " | " , nBuf ); + StringCat( sText, CHC_ARG_SEP, nBuf ); + nLen += StringCat( sText, " | " , nBuf ); } } - StringCat( sText, CON_COLOR_ARG_MAND, nBuf ); - StringCat( sText, TEXT(" >"), nBuf); + StringCat( sText, CHC_ARG_MAND, nBuf ); + StringCat( sText, " >", nBuf); - StringCat( sText, CON_COLOR_ARG_OPT, nBuf ); - StringCat( sText, TEXT(" ]"), nBuf); + StringCat( sText, CHC_ARG_OPT, nBuf ); + StringCat( sText, " ]", nBuf); // ConsoleBufferPush( sText ); ConsolePrint( sText ); // Transcode colored text to native console color text - wsprintf( sText, "%sNotes%s: %s<>%s = mandatory, %s[]%s = optional, %s|%s argument option" - , CON_COLOR_USAGE - , CON_COLOR_DEFAULT - , CON_COLOR_ARG_MAND - , CON_COLOR_DEFAULT - , CON_COLOR_ARG_OPT - , CON_COLOR_DEFAULT - , CON_COLOR_ARG_SEP - , CON_COLOR_DEFAULT + sprintf( sText, "%sNotes%s: %s<>%s = mandatory, %s[]%s = optional, %s|%s argument option" + , CHC_USAGE + , CHC_DEFAULT + , CHC_ARG_MAND + , CHC_DEFAULT + , CHC_ARG_OPT + , CHC_DEFAULT + , CHC_ARG_SEP + , CHC_DEFAULT ); ConsolePrint( sText ); // Transcode colored text to native console color text // ConsoleBufferPush( sText ); } +void Help_Examples() +{ + char sText[ CONSOLE_WIDTH ]; + sprintf( sText, " %sExamples%s:" + , CHC_USAGE + , CHC_DEFAULT + ); + ConsolePrint( sText ); +} + //=========================================================================== void Help_Range() { - ConsoleBufferPush( TEXT(" Where is of the form:" ) ); - ConsoleBufferPush( TEXT(" address , length [address,address+length)" ) ); - ConsoleBufferPush( TEXT(" address : end [address,end]" ) ); + ConsoleBufferPush( " Where is of the form:" ); + ConsoleBufferPush( " address , length [address,address+length)" ); + ConsoleBufferPush( " address : end [address,end]" ); } //=========================================================================== @@ -203,39 +216,39 @@ void Help_Operators() { char sText[ CONSOLE_WIDTH ]; -// sprintf( sText," %sOperators%s:" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); +// sprintf( sText," %sOperators%s:" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); // sprintf( sText," Operators: (Math)" ); - sprintf( sText," Operators: (%sMath%s)" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s+%s Addition" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s-%s Subtraction" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s*%s Multiplication" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s/%s Division" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s%%%s Modulas or Remainder" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," Operators: (%sMath%s)" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s+%s Addition" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s-%s Subtraction" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s*%s Multiplication" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s/%s Division" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s%%%s Modulas or Remainder" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); //ConsoleBufferPush( " Operators: (Bit Wise)" ); - sprintf( sText," Operators: (%sBit Wise%s)" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s&%s Bit-wise and (AND)" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s|%s Bit-wise or (OR )" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s^%s Bit-wise exclusive-or (EOR/XOR)" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s!%s Bit-wise negation (NOT)" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," Operators: (%sBit Wise%s)" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s&%s Bit-wise and (AND)" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s|%s Bit-wise or (OR )" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s^%s Bit-wise exclusive-or (EOR/XOR)" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s!%s Bit-wise negation (NOT)" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); //ConsoleBufferPush( " Operators: (Input)" ); - sprintf( sText," Operators: (%sInput%s)" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s@%s next number refers to search results", CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s\"%s Designate string in ASCII format" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s\'%s Desginate string in High-Bit apple format", CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s$%s Designate number/symbol" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s#%s Designate number in hex" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," Operators: (%sInput%s)" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s@%s next number refers to search results", CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s\"%s Designate string in ASCII format" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s\'%s Desginate string in High-Bit apple format", CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s$%s Designate number/symbol" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s#%s Designate number in hex" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); //ConsoleBufferPush( " Operators: (Range)" ); - sprintf( sText," Operators: (%sRange%s)" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s,%s range seperator (2nd address is relative)", CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s:%s range seperator (2nd address is absolute)", CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," Operators: (%sRange%s)" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s,%s range seperator (2nd address is relative)", CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s:%s range seperator (2nd address is absolute)", CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); // sprintf( sText," Operators: (Misc)" ); - sprintf( sText," Operators: (%sMisc%s)" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); - sprintf( sText," %s//%s comment until end of line" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," Operators: (%sMisc%s)" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," %s//%s comment until end of line" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); //ConsoleBufferPush( " Operators: (Breakpoint)" ); - sprintf( sText," Operators: (%sBreakpoint%s)" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); + sprintf( sText," Operators: (%sBreakpoint%s)" , CHC_USAGE, CHC_DEFAULT ); ConsolePrint( sText ); _tcscpy( sText, " " ); - _tcscat( sText, CON_COLOR_USAGE ); + _tcscat( sText, CHC_USAGE ); int iBreakOp = 0; for( iBreakOp = 0; iBreakOp < NUM_BREAKPOINT_OPERATORS; iBreakOp++ ) { @@ -246,7 +259,7 @@ void Help_Operators() _tcscat( sText, " " ); } } - _tcscat( sText, CON_COLOR_DEFAULT ); + _tcscat( sText, CHC_DEFAULT ); ConsolePrint( sText ); } @@ -267,26 +280,161 @@ void Help_KeyboardShortcuts() ConsoleBufferPush(" Ctrl-# " ); } + +void _ColorizeHeader( + char * & pDst,const char * & pSrc, + const char * pHeader, const int nHeaderLen ) +{ + int nLen; + + nLen = strlen( CHC_USAGE ); + strcpy( pDst, CHC_USAGE ); + pDst += nLen; + + nLen = nHeaderLen - 1; + strncpy( pDst, pHeader, nLen ); + pDst += nLen; + + pSrc += nHeaderLen; + + nLen = strlen( CHC_ARG_SEP ); + strcpy( pDst, CHC_ARG_SEP ); + pDst += nLen; + + *pDst = ':'; + pDst++; + + nLen = strlen( CHC_DEFAULT ); + strcpy( pDst, CHC_DEFAULT ); + pDst += nLen; +} + +void _ColorizeOperator( + char * & pDst, const char * & pSrc, + char * pOperator ) +{ + int nLen; + + nLen = strlen( pOperator ); + strcpy( pDst, pOperator ); + pDst += nLen; + + *pDst = *pSrc; + pDst++; + + nLen = strlen( CHC_DEFAULT ); + strcpy( pDst, CHC_DEFAULT ); + pDst += nLen; + + pSrc++; +} + + +bool Colorize( char * pDst, const char * pSrc ) +{ + if (! pSrc) + return false; + + if (! pDst) + return false; + + const char sNote [] = "Note:"; + const int nNote = sizeof( sNote ) - 1; + + const char sSeeAlso[] = "See also:"; + const char nSeeAlso = sizeof( sSeeAlso ) - 1; + + const char sUsage[] = "Usage:"; + const int nUsage = sizeof( sUsage ) - 1; + + int nLen = 0; + while (*pSrc) + { + if (strncmp( sUsage, pSrc, nUsage) == 0) + { + _ColorizeHeader( pDst, pSrc, sUsage, nUsage ); + } + else + if (strncmp( sSeeAlso, pSrc, nSeeAlso) == 0) + { + _ColorizeHeader( pDst, pSrc, sSeeAlso, nSeeAlso ); + } + else + if (strncmp( sNote, pSrc, nNote) == 0) + { + _ColorizeHeader( pDst, pSrc, sNote, nNote ); + } + else + if (*pSrc == '[') + { + _ColorizeOperator( pDst, pSrc, CHC_ARG_OPT ); + } + else + if (*pSrc == ']') + { + _ColorizeOperator( pDst, pSrc, CHC_ARG_OPT ); + } + else + if (*pSrc == '<') + { + _ColorizeOperator( pDst, pSrc, CHC_ARG_MAND ); + } + else + if (*pSrc == '>') + { + _ColorizeOperator( pDst, pSrc, CHC_ARG_MAND ); + } + else + if (*pSrc == '|') + { + _ColorizeOperator( pDst, pSrc, CHC_ARG_SEP ); + } + else + if (*pSrc == '\'') + { + _ColorizeOperator( pDst, pSrc, CHC_ARG_SEP ); + } + else + { + *pDst = *pSrc; + pDst++; + pSrc++; + } + } + *pDst = 0; + return true; +} + //=========================================================================== Update_t CmdMOTD( int nArgs ) { - char sText[ CONSOLE_WIDTH ]; + char sText[ CONSOLE_WIDTH*2 ]; + char sTemp[ CONSOLE_WIDTH*2 ]; + +#if DEBUG_COLOR_CONSOLE + ConsolePrint( "`" ); + ConsolePrint( "`A" ); + ConsolePrint( "`2`A" ); +#endif + + sprintf( sText, "`9`A`7 Apple `9][ ][+ //e `7Emulator for Windows (TM) `9`@" ); + ConsolePrint( sText ); - ConsoleBufferPush( " Apple ][ ][+ //e Emulator for Windows" ); CmdVersion(0); CmdSymbols(0); - wsprintf( sText, " '%sCtrl ~%s' console, '%s%s%s' (specific), '%s%s%s' (all)" - , CON_COLOR_KEY - , CON_COLOR_DEFAULT - , CON_COLOR_PARAM - , g_aCommands[ CMD_HELP_SPECIFIC ].m_sName - , CON_COLOR_DEFAULT -// , g_aCommands[ CMD_HELP_SPECIFIC ].pHelpSummary - , CON_COLOR_PARAM - , g_aCommands[ CMD_HELP_LIST ].m_sName - , CON_COLOR_DEFAULT -// , g_aCommands[ CMD_HELP_LIST ].pHelpSummary + sprintf( sTemp, " '%sCtrl ~'%s console, '%s%s'%s (specific), '%s%s'%s (all)" + , CHC_KEY + , CHC_DEFAULT + , CHC_COMMAND + , g_aCommands[ CMD_HELP_SPECIFIC ].m_sName + , CHC_DEFAULT +// , g_aCommands[ CMD_HELP_SPECIFIC ].pHelpSummary + , CHC_COMMAND + , g_aCommands[ CMD_HELP_LIST ].m_sName + , CHC_DEFAULT +// , g_aCommands[ CMD_HELP_LIST ].pHelpSummary ); + Colorize( sText, sTemp ); ConsolePrint( sText ); ConsoleUpdate(); @@ -300,8 +448,10 @@ Update_t CmdMOTD( int nArgs ) Update_t CmdHelpSpecific (int nArgs) { int iArg; - TCHAR sText[ CONSOLE_WIDTH * 2 ]; - ZeroMemory( sText, CONSOLE_WIDTH ); + char sText[ CONSOLE_WIDTH * 2 ]; + char sTemp[ CONSOLE_WIDTH * 2 ]; + ZeroMemory( sText, CONSOLE_WIDTH*2 ); + ZeroMemory( sTemp, CONSOLE_WIDTH*2 ); if (! nArgs) { @@ -358,7 +508,18 @@ Update_t CmdHelpSpecific (int nArgs) bCategory = false; break; case PARAM_CAT_MEMORY : iCmdBegin = CMD_MEMORY_COMPARE ; iCmdEnd = CMD_MEMORY_FILL ; break; - case PARAM_CAT_OUTPUT : iCmdBegin = CMD_OUTPUT_CALC ; iCmdEnd = CMD_OUTPUT_RUN ; break; + case PARAM_CAT_OUTPUT : + // HACK: check if we have an exact command match first + nFound = FindCommand( g_aArgs[iArg].sArg, pFunction, & iCommand ); + if (nFound && (iCommand != CMD_OUT)) + { + iCmdBegin = CMD_OUTPUT_CALC ; iCmdEnd = CMD_OUTPUT_RUN ; break; + bCategory = true; + } + else + bCategory = false; + break; + case PARAM_CAT_SYMBOLS : // HACK: check if we have an exact command match first nFound = FindCommand( g_aArgs[iArg].sArg, pFunction, & iCommand ); @@ -370,7 +531,18 @@ Update_t CmdHelpSpecific (int nArgs) else bCategory = false; break; - case PARAM_CAT_WATCHES : iCmdBegin = CMD_WATCH_ADD ; iCmdEnd = CMD_WATCH_LIST ; break; + case PARAM_CAT_WATCHES : + // HACK: check if we have an exact command match first + nFound = FindCommand( g_aArgs[iArg].sArg, pFunction, & iCommand ); + if (nFound && (iCommand != CMD_WATCH_ADD)) + { + iCmdBegin = CMD_WATCH_ADD ; iCmdEnd = CMD_WATCH_LIST ; break; + bCategory = true; + } + else + bCategory = false; + break; + case PARAM_CAT_WINDOW : iCmdBegin = CMD_WINDOW ; iCmdEnd = CMD_WINDOW_OUTPUT ; break; case PARAM_CAT_ZEROPAGE : iCmdBegin = CMD_ZEROPAGE_POINTER; iCmdEnd = CMD_ZEROPAGE_POINTER_SAVE;break; @@ -457,7 +629,7 @@ Update_t CmdHelpSpecific (int nArgs) // if (nFound && (! bAllCommands) && (! bCategory)) if (nFound && (! bAllCommands) && bDisplayCategory) { - TCHAR sCategory[ CONSOLE_WIDTH ]; + char sCategory[ CONSOLE_WIDTH ]; int iCmd = g_aCommands[ iCommand ].iCommand; // Unaliased command // HACK: Major kludge to display category!!! @@ -505,8 +677,12 @@ Update_t CmdHelpSpecific (int nArgs) else wsprintf( sCategory, "Unknown!" ); - wsprintf( sText, "Category: %s", sCategory ); - ConsoleBufferPush( sText ); + sprintf( sText, "%sCategory%s: %s%s" + , CHC_USAGE + , CHC_DEFAULT + , CHC_CATEGORY + , sCategory ); + ConsolePrint( sText ); if (bCategory) if (bDisplayCategory) @@ -519,18 +695,28 @@ Update_t CmdHelpSpecific (int nArgs) if (pHelp) { if (bCategory) - wsprintf( sText, "%8s, ", pCommand->m_sName ); + sprintf( sText, "%s%8s%s, " + , CHC_COMMAND + , pCommand->m_sName + , CHC_ARG_SEP + ); else - wsprintf( sText, "%s, ", pCommand->m_sName ); - if (! TryStringCat( sText, pHelp, g_nConsoleDisplayWidth )) - { - if (! TryStringCat( sText, pHelp, CONSOLE_WIDTH-1 )) - { - StringCat( sText, pHelp, CONSOLE_WIDTH ); - ConsoleBufferPush( sText ); - } - } - ConsoleBufferPush( sText ); + sprintf( sText, "%s%s%s, " + , CHC_COMMAND + , pCommand->m_sName + , CHC_ARG_SEP + ); + +// if (! TryStringCat( sText, pHelp, g_nConsoleDisplayWidth )) +// { +// if (! TryStringCat( sText, pHelp, CONSOLE_WIDTH-1 )) +// { + strncat( sText, CHC_DEFAULT, CONSOLE_WIDTH ); + strncat( sText, pHelp , CONSOLE_WIDTH ); +// ConsoleBufferPush( sText ); +// } +// } + ConsolePrint( sText ); } else { @@ -556,103 +742,119 @@ Update_t CmdHelpSpecific (int nArgs) { // CPU / General case CMD_ASSEMBLE: - ConsoleBufferPush( TEXT(" Built-in assember isn't functional yet.") ); + ConsoleBufferPush( " Built-in assember isn't functional yet." ); break; case CMD_UNASSEMBLE: - ConsoleBufferPush( TEXT(" Usage: {address | symbol}") ); - ConsoleBufferPush( TEXT(" Disassembles memory.") ); + Colorize( sText, " Usage: [address | symbol]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Disassembles memory." ); break; case CMD_GO: - ConsoleBufferPush( TEXT(" Usage: address | symbol [Skip,Length]]") ); - ConsoleBufferPush( TEXT(" addres | symbol [Start:End]") ); - ConsoleBufferPush( TEXT(" Skip : Start address to skip stepping" ) ); - ConsoleBufferPush( TEXT(" Length: Range of bytes past start address to skip stepping" ) ); - ConsoleBufferPush( TEXT(" End : Inclusive end address to skip stepping" ) ); - ConsoleBufferPush( TEXT(" If the Program Counter is outside the skip range, resumes single-stepping." ) ); - ConsoleBufferPush( TEXT(" Can be used to skip ROM/OS/user code." )); - ConsoleBufferPush( TEXT(" Examples:" ) ); - ConsoleBufferPush( TEXT(" G C600 FA00,600" ) ); - ConsoleBufferPush( TEXT(" G C600 F000:FFFF" ) ); + Colorize( sText, " Usage: address | symbol [Skip,Length]" ); + ConsolePrint( sText ); + Colorize( sText, " Usage: address | symbol [Start:End]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Skip : Start address to skip stepping" ); + ConsoleBufferPush( " Length: Range of bytes past start address to skip stepping" ); + ConsoleBufferPush( " End : Inclusive end address to skip stepping" ); + ConsoleBufferPush( " If the Program Counter is outside the skip range, resumes single-stepping." ); + ConsoleBufferPush( " Can be used to skip ROM/OS/user code." ); + Help_Examples(); + sprintf( sText, "%s G C600 FA00,600" , CHC_EXAMPLE ); ConsolePrint( sText ); + sprintf( sText, "%s G C600 F000:FFFF", CHC_EXAMPLE ); ConsolePrint( sText ); break; case CMD_JSR: - ConsoleBufferPush( TEXT(" Usage: {symbol | address}") ); - ConsoleBufferPush( TEXT(" Pushes PC on stack; calls the named subroutine.") ); + Colorize( sText, " %sUsage%s: %s[symbol | address]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Pushes PC on stack; calls the named subroutine." ); break; case CMD_NOP: ConsoleBufferPush( TEXT(" Puts a NOP opcode at current instruction") ); break; case CMD_OUT: - ConsoleBufferPush( TEXT(" Usage: {address8 | address16 | symbol} ## [##]") ); + Colorize( sText, " Usage: [address8 | address16 | symbol] ## [##]" ); + ConsolePrint( sText ); ConsoleBufferPush( TEXT(" Ouput a byte or word to the IO address $C0xx" ) ); break; case CMD_PROFILE: - wsprintf( sText, TEXT(" Usage: [%s | %s | %s]") + sprintf( sTemp, " Usage: [%s | %s | %s]" , g_aParameters[ PARAM_RESET ].m_sName , g_aParameters[ PARAM_SAVE ].m_sName , g_aParameters[ PARAM_LIST ].m_sName ); - ConsoleBufferPush( sText ); - ConsoleBufferPush( TEXT(" No arguments resets the profile.") ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + ConsoleBufferPush( " No arguments resets the profile." ); break; // Registers case CMD_REGISTER_SET: - wsprintf( sText, TEXT(" Usage: " ) ); ConsoleBufferPush( sText ); - ConsoleBufferPush( TEXT(" Where is one of: A X Y PC SP ") ); - wsprintf( sText, TEXT(" See also: %s" ), g_aParameters[ PARAM_CAT_OPERATORS ].m_sName ); ConsoleBufferPush( sText ); - ConsoleBufferPush( TEXT(" Examples:") ); - ConsoleBufferPush( TEXT(" R PC RESET + 1") ); - ConsoleBufferPush( TEXT(" R PC $FC58") ); - ConsoleBufferPush( TEXT(" R A A1") ); - ConsoleBufferPush( TEXT(" R A $A1") ); - ConsoleBufferPush( TEXT(" R A #A1") ); + Colorize( sText, " Usage: " ); + ConsolePrint( sText ); + ConsoleBufferPush( " Where is one of: A X Y PC SP " ); + sprintf( sTemp, " See also: %s%s" + , CHC_CATEGORY + , g_aParameters[ PARAM_CAT_OPERATORS ].m_sName ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + Help_Examples(); + sprintf( sText, "%s R PC RESET + 1", CHC_EXAMPLE ); ConsolePrint( sText ); + sprintf( sText, "%s R PC $FC58" , CHC_EXAMPLE ); ConsolePrint( sText ); + sprintf( sText, "%s R A A1" , CHC_EXAMPLE ); ConsolePrint( sText ); + sprintf( sText, "%s R A $A1" , CHC_EXAMPLE ); ConsolePrint( sText ); + sprintf( sText, "%s R A #A1" , CHC_EXAMPLE ); ConsolePrint( sText ); break; case CMD_SOURCE: // ConsoleBufferPush( TEXT(" Reads assembler source file." ) ); - wsprintf( sText, TEXT(" Usage: [ %s | %s ] \"filename\"" ), g_aParameters[ PARAM_SRC_MEMORY ].m_sName, g_aParameters[ PARAM_SRC_SYMBOLS ].m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s: read source bytes into memory." ), g_aParameters[ PARAM_SRC_MEMORY ].m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s: read symbols into Source symbol table."), g_aParameters[ PARAM_SRC_SYMBOLS ].m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" Supports: %s." ), g_aParameters[ PARAM_SRC_MERLIN ].m_sName ); ConsoleBufferPush( sText ); + sprintf( sTemp, " Usage: [ %s | %s ] \"filename\"" , g_aParameters[ PARAM_SRC_MEMORY ].m_sName, g_aParameters[ PARAM_SRC_SYMBOLS ].m_sName ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + sprintf( sText, " %s: read source bytes into memory." , g_aParameters[ PARAM_SRC_MEMORY ].m_sName ); ConsoleBufferPush( sText ); + sprintf( sText, " %s: read symbols into Source symbol table.", g_aParameters[ PARAM_SRC_SYMBOLS ].m_sName ); ConsoleBufferPush( sText ); + sprintf( sText, " Supports: %s." , g_aParameters[ PARAM_SRC_MERLIN ].m_sName ); ConsoleBufferPush( sText ); break; case CMD_STEP_OUT: - ConsoleBufferPush( TEXT(" Steps out of current subroutine") ); - ConsoleBufferPush( TEXT(" Hotkey: Ctrl-Space" ) ); // TODO: FIXME + ConsoleBufferPush( " Steps out of current subroutine" ); + ConsoleBufferPush( " Hotkey: Ctrl-Space" ); // TODO: FIXME break; case CMD_STEP_OVER: // Bad name? FIXME/TODO: do we need to rename? - ConsoleBufferPush( TEXT(" Usage: [#]") ); - ConsoleBufferPush( TEXT(" Steps, # times, thru current instruction") ); - ConsoleBufferPush( TEXT(" JSR will be stepped into AND out of.") ); - ConsoleBufferPush( TEXT(" Hotkey: Ctrl-Space" ) ); // TODO: FIXME + Colorize( sText, " Usage: [#]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Steps, # times, thru current instruction" ); + ConsoleBufferPush( " JSR will be stepped into AND out of." ); + ConsoleBufferPush( " Hotkey: Ctrl-Space" ); // TODO: FIXME break; case CMD_TRACE: - ConsoleBufferPush( TEXT(" Usage: [#]") ); - ConsoleBufferPush( TEXT(" Traces, # times, current instruction(s)") ); - ConsoleBufferPush( TEXT(" JSR will be stepped into") ); - ConsoleBufferPush( TEXT(" Hotkey: Shift-Space" ) ); + Colorize( sText, " Usage: [#]" ); ConsolePrint( sText ); + ConsoleBufferPush( " Traces, # times, current instruction(s)" ); + ConsoleBufferPush( " JSR will be stepped into" ); + ConsoleBufferPush( " Hotkey: Shift-Space" ); case CMD_TRACE_FILE: - ConsoleBufferPush( TEXT(" Usage: [filename]") ); + Colorize( sText, " Usage: \"[filename]\"" ); + ConsolePrint( sText ); break; case CMD_TRACE_LINE: - ConsoleBufferPush( TEXT(" Usage: [#]") ); - ConsoleBufferPush( TEXT(" Traces into current instruction") ); - ConsoleBufferPush( TEXT(" with cycle counting." ) ); + Colorize( sText, " Usage: [#]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Traces into current instruction" ); + ConsoleBufferPush( " with cycle counting." ); break; // Bookmarks case CMD_BOOKMARK: case CMD_BOOKMARK_ADD: - ConsoleBufferPush(" Usage: [address | symbol]" ); - ConsoleBufferPush(" Usage: #
" ); + Colorize( sText, " Usage: [address | symbol]" ); ConsolePrint( sText ); + Colorize( sText, " Usage: #
" ); ConsolePrint( sText ); ConsoleBufferPush(" If no address or symbol is specified, lists the current bookmarks." ); ConsoleBufferPush(" Updates the specified bookmark (#)" ); - wsprintf( sText, TEXT(" i.e. %s RESET" ), pCommand->m_sName ); - ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" i.e. %s 1 HOME" ), pCommand->m_sName ); - ConsoleBufferPush( sText ); + Help_Examples(); + sprintf( sText, "%s %s RESET ", CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s 1 HOME", CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); break; case CMD_BOOKMARK_CLEAR: - ConsoleBufferPush( TEXT(" Usage: [# | *]") ); - ConsoleBufferPush( TEXT(" Clears specified bookmark, or all.") ); - wsprintf( sText, TEXT(" i.e. %s 1" ), pCommand->m_sName ); - ConsoleBufferPush( sText ); + Colorize( sText, " Usage: [# | *]" ); ConsolePrint( sText ); + ConsoleBufferPush( " Clears specified bookmark, or all." ); + Help_Examples(); + sprintf( sText, "%s %s 1", CHC_EXAMPLE, pCommand->m_sName ); + ConsolePrint( sText ); break; case CMD_BOOKMARK_LIST: // case CMD_BOOKMARK_LOAD: @@ -660,69 +862,89 @@ Update_t CmdHelpSpecific (int nArgs) break; // Breakpoints case CMD_BREAKPOINT: - wsprintf( sText, " Maximum breakpoints: %d", MAX_BREAKPOINTS ); - ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" Usage: [%s | %s | %s]") + sprintf( sTemp, TEXT(" Usage: [%s%s | %s%s | %s%s]") + , CHC_COMMAND , g_aParameters[ PARAM_LOAD ].m_sName + , CHC_COMMAND , g_aParameters[ PARAM_SAVE ].m_sName + , CHC_COMMAND , g_aParameters[ PARAM_RESET ].m_sName ); - ConsoleBufferPush( sText ); - ConsoleBufferPush( TEXT(" Set breakpoint at PC if no args.") ); - ConsoleBufferPush( TEXT(" Loading/Saving not yet implemented.") ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + sprintf( sText, " Maximum breakpoints: %s%d", CHC_NUMBER, MAX_BREAKPOINTS ); + ConsolePrint( sText ); + ConsoleBufferPush( " Set breakpoint at PC if no args." ); + ConsoleBufferPush( " Loading/Saving not yet implemented." ); break; case CMD_BREAKPOINT_ADD_REG: - ConsoleBufferPush( " Usage: [A|X|Y|PC|S] [op] " ); + Colorize( sText, " Usage: [A|X|Y|PC|S] [op] " ); + ConsolePrint( sText ); ConsoleBufferPush( " Set breakpoint when reg is [op] value" ); ConsoleBufferPush( " Default operator is '='" ); - wsprintf( sText, " See also: %s", g_aParameters[ PARAM_CAT_OPERATORS ].m_sName ); ConsoleBufferPush( sText ); - ConsoleBufferPush( " Examples:" ); - wsprintf( sText, " %s PC < D000", pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, " %s PC = F000:FFFF PC < D000,1000", pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, " %s A <= D5" , pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, " %s A != 01:FF" , pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, " %s X = A5" , pCommand->m_sName ); ConsoleBufferPush( sText ); + sprintf( sTemp, " See also: %s%s" + , CHC_CATEGORY + , g_aParameters[ PARAM_CAT_OPERATORS ].m_sName ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + // ConsoleBufferPush( " Examples:" ); + Help_Examples(); + sprintf( sText, "%s %s PC < D000" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s PC = F000:FFFF PC < D000,1000", CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s A <= D5" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s A != 01:FF" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s X = A5" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); break; case CMD_BREAKPOINT_ADD_SMART: - ConsoleBufferPush( TEXT(" Usage: [address | register]") ); - ConsoleBufferPush( TEXT(" If address, sets two breakpoints" ) ); - ConsoleBufferPush( TEXT(" 1. one memory access at address" ) ); - ConsoleBufferPush( TEXT(" 2. if PC reaches address" ) ); -// "Sets a breakpoint at the current PC or specified address." ) ); - ConsoleBufferPush( TEXT(" If an IO address, sets breakpoint on IO access.") ); - ConsoleBufferPush( TEXT(" If register, sets a breakpoint on memory access at address of register.") ); + Colorize( sText, " Usage: [address | register]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " If address, sets two breakpoints" ); + ConsoleBufferPush( " 1. one memory access at address" ); + ConsoleBufferPush( " 2. if PC reaches address" ); +// "Sets a breakpoint at the current PC or specified address." ); + ConsoleBufferPush( " If an IO address, sets breakpoint on IO access." ); + ConsoleBufferPush( " If register, sets a breakpoint on memory access at address of register." ); break; case CMD_BREAKPOINT_ADD_PC: - ConsoleBufferPush( TEXT(" Usage: [address]") ); - ConsoleBufferPush( TEXT(" Sets a breakpoint at the current PC or at the specified address.") ); + Colorize( sText, " Usage: [address]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Sets a breakpoint at the current PC or at the specified address." ); break; case CMD_BREAKPOINT_CLEAR: - ConsoleBufferPush( TEXT(" Usage: [# | *]") ); - ConsoleBufferPush( TEXT(" Clears specified breakpoint, or all.") ); - wsprintf( sText, TEXT(" i.e. %s 1" ), pCommand->m_sName ); - ConsoleBufferPush( sText ); + Colorize( sText, " Usage: [# | *]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Clears specified breakpoint, or all." ); + Help_Examples(); + sprintf( sText, "%s %s 1", CHC_EXAMPLE, pCommand->m_sName ); + ConsolePrint( sText ); break; case CMD_BREAKPOINT_DISABLE: - ConsoleBufferPush( TEXT(" Usage: [# [,#] | *]") ); - ConsoleBufferPush( TEXT(" Disable breakpoint previously set, or all.") ); - wsprintf( sText, TEXT(" i.e. %s 1" ), pCommand->m_sName ); - ConsoleBufferPush( sText ); + Colorize( sText, " Usage: [# [,#] | *]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Disable breakpoint previously set, or all." ); + Help_Examples(); + sprintf( sText, "%s %s 1", CHC_EXAMPLE, pCommand->m_sName ); + ConsolePrint( sText ); break; case CMD_BREAKPOINT_ENABLE: - ConsoleBufferPush( TEXT(" Usage: [# [,#] | *]") ); - ConsoleBufferPush( TEXT(" Re-enables breakpoint previously set, or all.") ); - wsprintf( sText, TEXT(" i.e. %s 1" ), pCommand->m_sName ); - ConsoleBufferPush( sText ); + Colorize( sText, " Usage: [# [,#] | *]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Re-enables breakpoint previously set, or all." ); + Help_Examples(); + sprintf( sText, "%s %s 1", CHC_EXAMPLE, pCommand->m_sName ); + ConsolePrint( sText ); break; case CMD_BREAKPOINT_LIST: break; // Config - Load / Save case CMD_CONFIG_LOAD: - ConsoleBufferPush( TEXT(" Usage: [\"filename\"]" ) ); - wsprintf( sText, TEXT(" Load debugger configuration from '%s', or the specificed file." ), g_sFileNameConfig ); ConsoleBufferPush( sText ); + Colorize( sText, " Usage: [\"filename\"]" ); + ConsolePrint( sText ); + sprintf( sText, " Load debugger configuration from '%s', or the specificed file.", g_sFileNameConfig ); ConsoleBufferPush( sText ); break; case CMD_CONFIG_SAVE: - ConsoleBufferPush( TEXT(" Usage: [\"filename\"]" ) ); - wsprintf( sText, TEXT(" Save debugger configuration to '%s', or the specificed file." ), g_sFileNameConfig ); ConsoleBufferPush( sText ); + Colorize( sText, " Usage: [\"filename\"]" ); + ConsolePrint( sText ); + sprintf( sText, " Save debugger configuration to '%s', or the specificed file.", g_sFileNameConfig ); ConsoleBufferPush( sText ); break; // Config - Color case CMD_CONFIG_COLOR: @@ -740,62 +962,77 @@ Update_t CmdHelpSpecific (int nArgs) // Config - Diasm case CMD_CONFIG_DISASM: { - ConsoleBufferPush( TEXT(" Note: All arguments effect the disassembly view" ) ); + Colorize( sText, " Note: All arguments effect the disassembly view" ); + ConsolePrint( sText ); - wsprintf( sText, TEXT(" Usage: [%s | %s | %s | %s | %s]") + sprintf( sTemp, " Usage: [%s%s | %s%s | %s%s | %s%s | %s%s]" + , CHC_COMMAND , g_aParameters[ PARAM_CONFIG_BRANCH ].m_sName + , CHC_COMMAND , g_aParameters[ PARAM_CONFIG_COLON ].m_sName + , CHC_COMMAND , g_aParameters[ PARAM_CONFIG_OPCODE ].m_sName + , CHC_COMMAND , g_aParameters[ PARAM_CONFIG_SPACES ].m_sName + , CHC_COMMAND , g_aParameters[ PARAM_CONFIG_TARGET ].m_sName ); - ConsoleBufferPush( sText ); - ConsoleBufferPush( TEXT(" Display current settings if no args." ) ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + ConsoleBufferPush( " Display current settings if no args." ); iParam = PARAM_CONFIG_BRANCH; - wsprintf( sText, TEXT(" Usage: %s [#]" ), g_aParameters[ iParam ].m_sName ); - ConsoleBufferPush( sText ); - ConsoleBufferPush( TEXT(" Set the type of branch character:" ) ); - wsprintf( sText, TEXT(" %d off, %d plain, %d fancy" ), + sprintf( sTemp, " Usage: %s [#]", g_aParameters[ iParam ].m_sName ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + ConsoleBufferPush( " Set the type of branch character:" ); + sprintf( sText, " %d off, %d plain, %d fancy", DISASM_BRANCH_OFF, DISASM_BRANCH_PLAIN, DISASM_BRANCH_FANCY ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" i.e. %s %s 1" ), pCommand->m_sName, g_aParameters[ iParam ].m_sName ); - ConsoleBufferPush( sText ); + sprintf( sText, " i.e. %s%s %s 1", CHC_EXAMPLE, pCommand->m_sName, g_aParameters[ iParam ].m_sName ); + ConsolePrint( sText ); iParam = PARAM_CONFIG_COLON; - wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ iParam ].m_sName ); - ConsoleBufferPush( sText ); - ConsoleBufferPush( TEXT(" Display a colon after the address" ) ); - wsprintf( sText, TEXT(" i.e. %s %s 0" ), pCommand->m_sName, g_aParameters[ iParam ].m_sName ); - ConsoleBufferPush( sText ); + sprintf( sTemp, " Usage: %s [0|1]", g_aParameters[ iParam ].m_sName ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + ConsoleBufferPush( " Display a colon after the address" ); + sprintf( sText, " i.e. %s%s %s 0", CHC_EXAMPLE, pCommand->m_sName, g_aParameters[ iParam ].m_sName ); + ConsolePrint( sText ); iParam = PARAM_CONFIG_OPCODE; - wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ iParam ].m_sName ); - ConsoleBufferPush( sText ); - ConsoleBufferPush( TEXT(" Display opcode(s) after colon" ) ); - wsprintf( sText, TEXT(" i.e. %s %s 1" ), pCommand->m_sName, g_aParameters[ iParam ].m_sName ); - ConsoleBufferPush( sText ); + sprintf( sTemp, " Usage: %s [0|1]", g_aParameters[ iParam ].m_sName ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + ConsoleBufferPush( " Display opcode(s) after colon" ); + sprintf( sText, " i.e. %s%s %s 1", CHC_EXAMPLE, pCommand->m_sName, g_aParameters[ iParam ].m_sName ); + ConsolePrint( sText ); iParam = PARAM_CONFIG_SPACES; - wsprintf( sText, TEXT(" Usage: %s [0|1]" ), g_aParameters[ iParam ].m_sName ); - ConsoleBufferPush( sText ); - ConsoleBufferPush( TEXT(" Display spaces between opcodes" ) ); - wsprintf( sText, TEXT(" i.e. %s %s 0" ), pCommand->m_sName, g_aParameters[ iParam ].m_sName ); - ConsoleBufferPush( sText ); + sprintf( sTemp, " Usage: %s [0|1]", g_aParameters[ iParam ].m_sName ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + ConsoleBufferPush( " Display spaces between opcodes" ); + sprintf( sText, " i.e. %s%s %s 0", CHC_EXAMPLE, pCommand->m_sName, g_aParameters[ iParam ].m_sName ); + ConsolePrint( sText ); iParam = PARAM_CONFIG_TARGET; - wsprintf( sText, TEXT(" Usage: %s [#]" ), g_aParameters[ iParam ].m_sName ); - ConsoleBufferPush( sText ); - ConsoleBufferPush( TEXT(" Set the type of target address/value displayed:" ) ); - wsprintf( sText, TEXT(" %d off, %d value only, %d address only, %d both" ), + sprintf( sTemp, " Usage: %s [#]", g_aParameters[ iParam ].m_sName ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + ConsoleBufferPush( " Set the type of target address/value displayed:" ); + sprintf( sText, " %d off, %d value only, %d address only, %d both", DISASM_TARGET_OFF, DISASM_TARGET_VAL, DISASM_TARGET_ADDR, DISASM_TARGET_BOTH ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" i.e. %s %s %d" ), pCommand->m_sName, g_aParameters[ iParam ].m_sName, DISASM_TARGET_VAL ); - ConsoleBufferPush( sText ); + sprintf( sText, " i.e. %s%s %s %d", CHC_EXAMPLE, pCommand->m_sName, g_aParameters[ iParam ].m_sName, DISASM_TARGET_VAL ); + ConsolePrint( sText ); break; } // Config - Font case CMD_CONFIG_FONT: - wsprintf( sText, TEXT(" Usage: [%s | %s] \"FontName\" [Height]" ), + sprintf( sText, " No longer applicable with new debugger font" ); + ConsolePrint( sText ); +/* + sprintf( sText, TEXT(" Usage: [%s | %s] \"FontName\" [Height]" ), g_aParameters[ PARAM_FONT_MODE ].m_sName, g_aParameters[ PARAM_DISASM ].m_sName ); ConsoleBufferPush( sText ); ConsoleBufferPush( TEXT(" i.e. FONT \"Courier\" 12" ) ); @@ -805,19 +1042,26 @@ Update_t CmdHelpSpecific (int nArgs) wsprintf( sText, TEXT(" Valid values are: %d, %d, %d." ), FONT_SPACING_CLASSIC, FONT_SPACING_CLEAN, FONT_SPACING_COMPRESSED ); ConsoleBufferPush( sText ); +*/ break; // Memory case CMD_MEMORY_ENTER_BYTE: - ConsoleBufferPush( TEXT(" Usage:
## [## ... ##]") ); + sprintf( sTemp, " Usage:
## [## ... ##]" ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); ConsoleBufferPush( TEXT(" Sets memory to the specified 8-Bit Values (bytes)" ) ); break; case CMD_MEMORY_ENTER_WORD: - ConsoleBufferPush( TEXT(" Usage:
#### [#### ... ####]") ); + sprintf( sTemp, " Usage:
#### [#### ... ####]" ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); ConsoleBufferPush( TEXT(" Sets memory to the specified 16-Bit Values (words)" ) ); break; case CMD_MEMORY_FILL: - ConsoleBufferPush( TEXT(" Usage:
##" ) ); + sprintf( sTemp, " Usage:
##" ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); ConsoleBufferPush( TEXT(" Fills the memory range with the specified byte" ) ); ConsoleBufferPush( TEXT(" Can't fill IO address $C0xx" ) ); break; @@ -825,7 +1069,9 @@ Update_t CmdHelpSpecific (int nArgs) // case CMD_MEM_MINI_DUMP_ASC_2: case CMD_MEM_MINI_DUMP_ASCII_1: case CMD_MEM_MINI_DUMP_ASCII_2: - ConsoleBufferPush( TEXT(" Usage:
") ); + sprintf( sTemp, " Usage:
" ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); ConsoleBufferPush( TEXT(" Displays ASCII text in the Mini-Memory area") ); ConsoleBufferPush( TEXT(" ASCII control chars are hilighted") ); ConsoleBufferPush( TEXT(" ASCII hi-bit chars are normal") ); @@ -834,10 +1080,12 @@ Update_t CmdHelpSpecific (int nArgs) // case CMD_MEM_MINI_DUMP_TXT_LO_2: case CMD_MEM_MINI_DUMP_APPLE_1: case CMD_MEM_MINI_DUMP_APPLE_2: - ConsoleBufferPush( TEXT(" Usage:
") ); - ConsoleBufferPush( TEXT(" Displays APPLE text in the Mini-Memory area") ); - ConsoleBufferPush( TEXT(" APPLE control chars are inverse") ); - ConsoleBufferPush( TEXT(" APPLE hi-bit chars are normal") ); + sprintf( sTemp, " Usage:
" ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + ConsoleBufferPush( " Displays APPLE text in the Mini-Memory area" ); + ConsoleBufferPush( " APPLE control chars are inverse" ); + ConsoleBufferPush( " APPLE hi-bit chars are normal" ); break; // case CMD_MEM_MINI_DUMP_TXT_HI_1: // case CMD_MEM_MINI_DUMP_TXT_HI_2: @@ -850,59 +1098,70 @@ Update_t CmdHelpSpecific (int nArgs) case CMD_MEMORY_SAVE: if (iCommand == CMD_MEMORY_LOAD) { - ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],address[,length]" ) ); - ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],range" ) ); + sprintf( sTemp, " Usage: [\"Filename\"],address[,length]" ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + sprintf( sTemp, " Usage: [\"Filename\"],range" ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); Help_Range(); - ConsoleBufferPush( TEXT(" Notes: If no filename specified, defaults to the last filename (if possible)" ) ); + ConsoleBufferPush( " Notes: If no filename specified, defaults to the last filename (if possible)" ); } if (iCommand == CMD_MEMORY_SAVE) { - ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],address,length" ) ); - ConsoleBufferPush( TEXT(" Usage: [\"Filename\"],range" ) ); + sprintf( sTemp, " Usage: [\"Filename\"],address,length" ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); + sprintf( sTemp, " Usage: [\"Filename\"],range" ); + Colorize( sText, sTemp ); + ConsolePrint( sText ); Help_Range(); - ConsoleBufferPush( TEXT(" Notes: If no filename specified, defaults to: '####.####.bin'" ) ); - ConsoleBufferPush( TEXT(" Where the form is
..bin" ) ); + ConsoleBufferPush( " Notes: If no filename specified, defaults to: '####.####.bin'" ); + ConsoleBufferPush( " Where the form is
..bin" ); } - ConsoleBufferPush( TEXT(" Examples:" ) ); - ConsoleBufferPush( TEXT(" BSAVE \"test\",FF00,100" ) ); - ConsoleBufferPush( TEXT(" BLOAD \"test\",2000:2010" ) ); - ConsoleBufferPush( TEXT(" BSAVE \"test\",F000:FFFF" ) ); - ConsoleBufferPush( TEXT(" BLOAD \"test\",4000" ) ); +// ConsoleBufferPush( TEXT(" Examples:" ) ); + Help_Examples(); + sprintf( sText, "%s BSAVE \"test\",FF00,100" , CHC_EXAMPLE ); ConsolePrint( sText ); + sprintf( sText, "%s BLOAD \"test\",2000:2010" , CHC_EXAMPLE ); ConsolePrint( sText ); + sprintf( sText, "%s BSAVE \"test\",F000:FFFF" , CHC_EXAMPLE ); ConsolePrint( sText ); + sprintf( sText, "%s BLOAD \"test\",4000" , CHC_EXAMPLE ); ConsolePrint( sText ); break; case CMD_MEMORY_SEARCH: - ConsoleBufferPush( TEXT(" Usage: range <\"ASCII text\" | 'apple text' | hex>" ) ); + Colorize( sText, " Usage: range <\"ASCII text\" | 'apple text' | hex>" ); + ConsolePrint( sText ); Help_Range(); - ConsoleBufferPush( TEXT(" Where text is of the form:") ); - ConsoleBufferPush( TEXT(" \"...\" designate ASCII text") ); - ConsoleBufferPush( TEXT(" '...' designate Apple High-Bit text") ); - ConsoleBufferPush( TEXT(" Examples: (Text)" ) ); - wsprintf( sText, TEXT(" %s F000,1000 'Apple' // search High-Bit" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" MT1 @2" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s D000:FFFF \"FLAS\" // search ASCII " ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" MA1 @1" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s D000,4000 \"EN\" 'D' // Mixed text" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" MT1 @1" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s D000,4000 'Apple' ? ']'" ), pCommand->m_sName ); ConsoleBufferPush( sText ); + ConsoleBufferPush( " Where text is of the form:" ); + ConsoleBufferPush( " \"...\" designate ASCII text" ); + ConsoleBufferPush( " '...' designate Apple High-Bit text" ); + Help_Examples(); + sprintf( sText, "%s %s F000,1000 'Apple' // search High-Bit", CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s MT1 @2" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s D000:FFFF \"FLAS\" // search ASCII ", CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s MA1 @1" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s D000,4000 \"EN\" 'D' // Mixed text" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s MT1 @1" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s D000,4000 'Apple' ? ']'" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); break; case CMD_MEMORY_SEARCH_HEX: - ConsoleBufferPush( TEXT(" Usage: range [text | byte1 [byte2 ...]]" ) ); + Colorize( sText, " Usage: range [text | byte1 [byte2 ...]]" ); + ConsolePrint( sText ); Help_Range(); - ConsoleBufferPush( TEXT(" Where is of the form:") ); - ConsoleBufferPush( TEXT(" ## match specific byte") ); - ConsoleBufferPush( TEXT(" #### match specific 16-bit value") ); - ConsoleBufferPush( TEXT(" ? match any byte") ); - ConsoleBufferPush( TEXT(" ?# match any high nibble, match low nibble to specific number") ); - ConsoleBufferPush( TEXT(" #? match specific high nibble, match any low nibble") ); - ConsoleBufferPush( TEXT(" Examples: (Hex)" ) ); - wsprintf( sText, TEXT(" %s F000,1000 AD ? C0" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" U @1" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s F000,1000 ?1 C0" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s F000,1000 5? C0" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s F000,1000 10 C?" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" U @2 - 1" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s F000:FFFF C030" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" U @1 - 1" ), pCommand->m_sName ); ConsoleBufferPush( sText ); + ConsoleBufferPush( " Where is of the form:" ); + ConsoleBufferPush( " ## match specific byte" ); + ConsoleBufferPush( " #### match specific 16-bit value" ); + ConsoleBufferPush( " ? match any byte" ); + ConsoleBufferPush( " ?# match any high nibble, match low nibble to specific number" ); + ConsoleBufferPush( " #? match specific high nibble, match any low nibble" ); + Help_Examples(); + sprintf( sText, "%s %s F000,1000 AD ? C0", CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s U @1" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s F000,1000 ?1 C0" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s F000,1000 5? C0" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s F000,1000 10 C?" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s U @2 - 1" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s F000:FFFF C030" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s U @1 - 1" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); break; // case CMD_MEMORY_SEARCH_APPLE: // wsprintf( sText, TEXT("Deprecated. Use: %s" ), g_aCommands[ CMD_MEMORY_SEARCH ].m_sName ); ConsoleBufferPush( sText ); @@ -912,44 +1171,52 @@ Update_t CmdHelpSpecific (int nArgs) // break; // Output case CMD_OUTPUT_CALC: - ConsoleBufferPush( TEXT(" Usage:
" ) ); - ConsoleBufferPush( TEXT(" Expression is one of: + - * / % ^ ~" ) ); - ConsoleBufferPush( TEXT(" Output order is: Hex Bin Dec Char" ) ); - ConsoleBufferPush( TEXT(" Note: symbols take piority." ) ); - ConsoleBufferPush( TEXT("i.e. #A (if you don't want accum. val)" ) ); - ConsoleBufferPush( TEXT("i.e. #F (if you don't want flags val)" ) ); + Colorize( sText, " Usage:
" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Expression is one of: + - * / % ^ ~" ); + ConsoleBufferPush( " Output order is: Hex Bin Dec Char" ); + ConsoleBufferPush( " Note: symbols take piority." ); + Help_Examples(); + ConsoleBufferPush( "i.e. #A (if you don't want accum. val)" ); + ConsoleBufferPush( "i.e. #F (if you don't want flags val)" ); break; case CMD_OUTPUT_ECHO: - ConsoleBufferPush( TEXT(" Usage: string" ) ); - ConsoleBufferPush( TEXT(" Examples:" ) ); - wsprintf( sText, TEXT(" %s Checkpoint"), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s PC" ), pCommand->m_sName ); ConsoleBufferPush( sText ); + Colorize( sText, " Usage: string" ); + ConsolePrint( sText ); +// ConsoleBufferPush( TEXT(" Examples:" ) ); + Help_Examples(); + sprintf( sText, "%s %s Checkpoint", CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s PC" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); // ConsoleBufferPush( TEXT(" Echo the string to the console" ) ); break; case CMD_OUTPUT_PRINT: - ConsoleBufferPush( TEXT(" Usage: [, string | expression]*" ) ); - ConsoleBufferPush( TEXT(" Note: To print Register values, they must be in upper case" ) ); - ConsoleBufferPush( TEXT(" Examples:") ); - wsprintf( sText, TEXT(" %s \"A:\",A,\" X:\",X"), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s A,\" \",X,\" \",Y" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s PC" ), pCommand->m_sName ); ConsoleBufferPush( sText ); + Colorize( sText, " Usage: [, string | expression]*" ); + ConsolePrint( sText ); + Colorize( sText, " Note: To print Register values, they must be in upper case" ); + ConsolePrint( sText ); + Help_Examples(); + sprintf( sText, "%s %s \"A:\",A,\" X:\",X", CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s A,\" \",X,\" \",Y" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s PC" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); break; case CMD_OUTPUT_PRINTF: - ConsoleBufferPush( TEXT(" Usage: [, expression, ...]" ) ); - ConsoleBufferPush( TEXT(" The string may contain c-style printf formatting flags: %d %x %z %c" ) ); - ConsoleBufferPush( TEXT(" Where: %d decimal, %x hex, %z binary, %c char, %% percent" ) ); - ConsoleBufferPush( TEXT(" Examples:") ); - wsprintf( sText , TEXT(" %s \"Dec: %%d Hex: %%x Bin: %%z Char: %c\",A,A,A,A" ), pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s \"%%x %%x %%x\",A,X,Y" ), pCommand->m_sName ); ConsoleBufferPush( sText ); + Colorize( sText, " Usage: [, expression, ...]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " The string may contain c-style printf formatting flags: %d %x %z %c" ); + ConsoleBufferPush( " Where: %d decimal, %x hex, %z binary, %c char, %% percent" ); + Help_Examples(); + sprintf( sText, "%s %s \"Dec: %%d Hex: %%x Bin: %%z Char: %c\",A,A,A,A", CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s \"%%x %%x %%x\",A,X,Y" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); break; // Symbols case CMD_SYMBOLS_LOOKUP: - ConsoleBufferPush( TEXT(" Usage: symbol [=
]" ) ); - ConsoleBufferPush( TEXT(" Examples:" ) ); - wsprintf( sText, TEXT(" %s HOME" ),pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s LIFE = 2000" ),pCommand->m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s LIFE" ),pCommand->m_sName ); ConsoleBufferPush( sText ); + Colorize( sText, " Usage: symbol [=
]" ); + ConsolePrint( sText ); + Help_Examples(); + wsprintf( sText, "%s %s HOME" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + wsprintf( sText, "%s %s LIFE = 2000", CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + wsprintf( sText, "%s %s LIFE" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); break; case CMD_SYMBOLS_MAIN: case CMD_SYMBOLS_USER: @@ -961,22 +1228,25 @@ Update_t CmdHelpSpecific (int nArgs) // ConsoleBufferPush( TEXT(" LOAD: Loads symbols from last/default filename" ) ); // ConsoleBufferPush( TEXT(" SAVE: Saves symbol table to file" ) ); // ConsoleBufferPush( TEXT(" CLEAR: Clears the symbol table" ) ); - ConsoleBufferPush( TEXT(" Usage: [ | symbol | address ]") ); - ConsoleBufferPush( TEXT(" Where is one of:" ) ); - wsprintf( sText, TEXT(" %s " ": Turns symbols on in the disasm window" ), g_aParameters[ PARAM_ON ].m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s " ": Turns symbols off in the disasm window" ), g_aParameters[ PARAM_OFF ].m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s" ": Loads symbols from last/default \"filename\"" ), g_aParameters[ PARAM_SAVE ].m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s" ": Saves symbol table to \"filename\"" ), g_aParameters[ PARAM_LOAD ].m_sName ); ConsoleBufferPush( sText ); - wsprintf( sText, TEXT(" %s" ": Clears the symbol table" ), g_aParameters[ PARAM_CLEAR ].m_sName ); ConsoleBufferPush( sText ); + Colorize( sText, " Usage: [ | symbol | address ]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Where is one of:" ); + sprintf( sText, " %s " ": Turns symbols on in the disasm window" , g_aParameters[ PARAM_ON ].m_sName ); ConsoleBufferPush( sText ); + sprintf( sText, " %s " ": Turns symbols off in the disasm window" , g_aParameters[ PARAM_OFF ].m_sName ); ConsoleBufferPush( sText ); + sprintf( sText, " %s" ": Loads symbols from last/default \"filename\"", g_aParameters[ PARAM_SAVE ].m_sName ); ConsoleBufferPush( sText ); + sprintf( sText, " %s" ": Saves symbol table to \"filename\"" , g_aParameters[ PARAM_LOAD ].m_sName ); ConsoleBufferPush( sText ); + sprintf( sText, " %s" ": Clears the symbol table" , g_aParameters[ PARAM_CLEAR ].m_sName ); ConsoleBufferPush( sText ); break; case CMD_SYMBOLS_LIST : - ConsoleBufferPush( TEXT(" Usage: symbol" ) ); - ConsoleBufferPush( TEXT(" Looks up symbol in all 3 symbol tables: main, user, source" ) ); + Colorize( sText, " Usage: symbol" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Looks up symbol in all 3 symbol tables: main, user, source" ); break; // Watches case CMD_WATCH_ADD: - ConsoleBufferPush( TEXT(" Usage:
" ) ); - ConsoleBufferPush( TEXT(" Adds the specified memory location to the watch window." ) ); + Colorize( sText, " Usage:
" ); + ConsolePrint( sText ); + ConsoleBufferPush( " Adds the specified memory location to the watch window." ); break; // Window case CMD_WINDOW_CODE : // summary is good enough @@ -986,24 +1256,23 @@ Update_t CmdHelpSpecific (int nArgs) // Zero Page pointers case CMD_ZEROPAGE_POINTER: case CMD_ZEROPAGE_POINTER_ADD: - ConsoleBufferPush(" Usage:
" ); - ConsoleBufferPush(" Usage: #
[address...]" ); + Colorize( sText, " Usage:
" ); + ConsolePrint( sText ); + Colorize( sText, " Usage: #
[address...]" ); + ConsolePrint( sText ); ConsoleBufferPush(" Adds the specified memory location to the zero page pointer window." ); ConsoleBufferPush(" Update the specified zero page pointer (#) with the address." ); ConsoleBufferPush(" Note: Displayed as symbol name (if possible) and the 16-bit target pointer" ); - ConsoleBufferPush(" Examples:" ); - wsprintf( sText, " %s CH", pCommand->m_sName ); - ConsoleBufferPush( sText ); - wsprintf( sText, " %s 0 CV", pCommand->m_sName ); - ConsoleBufferPush( sText ); - wsprintf( sText, " %s 0 CV CH", pCommand->m_sName ); - ConsoleBufferPush( sText ); + Help_Examples(); + sprintf( sText, "%s %s CH" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s 0 CV" , CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); + sprintf( sText, "%s %s 0 CV CH", CHC_EXAMPLE, pCommand->m_sName ); ConsolePrint( sText ); break; case CMD_ZEROPAGE_POINTER_CLEAR: - ConsoleBufferPush( TEXT(" Usage: [# | *]") ); - ConsoleBufferPush( TEXT(" Clears specified zero page pointer, or all.") ); - wsprintf( sText, TEXT(" i.e. %s 1" ), pCommand->m_sName ); - ConsoleBufferPush( sText ); + Colorize( sText, " Usage: [# | *]" ); + ConsoleBufferPush( " Clears specified zero page pointer, or all." ); + sprintf( sText, " i.e. %s%s 1", CHC_EXAMPLE, pCommand->m_sName ); + ConsolePrint( sText ); break; case CMD_ZEROPAGE_POINTER_0: case CMD_ZEROPAGE_POINTER_1: @@ -1013,14 +1282,16 @@ Update_t CmdHelpSpecific (int nArgs) case CMD_ZEROPAGE_POINTER_5: case CMD_ZEROPAGE_POINTER_6: case CMD_ZEROPAGE_POINTER_7: - ConsoleBufferPush( TEXT(" Usage: [
]" ) ); - ConsoleBufferPush( TEXT(" If no address specified, will remove watching the zero page pointer." ) ); + Colorize( sText, " Usage: [
]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " If no address specified, will remove watching the zero page pointer." ); break; // Misc case CMD_VERSION: - ConsoleBufferPush( TEXT(" Usage: [*]") ); - ConsoleBufferPush( TEXT(" * Display extra internal stats" ) ); + Colorize( sText, " Usage: [*]" ); + ConsolePrint( sText ); + ConsoleBufferPush( " * Display extra internal stats" ); break; default: if (bAllCommands) @@ -1051,8 +1322,8 @@ Update_t CmdHelpSpecific (int nArgs) //=========================================================================== Update_t CmdHelpList (int nArgs) { - TCHAR sText[ CONSOLE_WIDTH ] = TEXT("Commands: "); - int nLenLine = _tcslen( sText ); + char sText[ CONSOLE_WIDTH ] = "Commands: "; + int nLenLine = strlen( sText ); int y = 0; int nLinesScrolled = 0; @@ -1076,25 +1347,25 @@ Update_t CmdHelpList (int nArgs) { // Command_t *pCommand = & g_vSortedCommands.at( iCommand ); Command_t *pCommand = & g_aCommands[ iCommand ]; - TCHAR *pName = pCommand->m_sName; + char *pName = pCommand->m_sName; if (! pCommand->pFunction) continue; // not implemented function - int nLenCmd = _tcslen( pName ); + int nLenCmd = strlen( pName ); if ((nLenLine + nLenCmd) < (nMaxWidth)) { - _tcscat( sText, pName ); + strcat( sText, pName ); } else { ConsoleBufferPush( sText ); nLenLine = 1; - _tcscpy( sText, TEXT(" " ) ); - _tcscat( sText, pName ); + strcpy( sText, " " ); + strcat( sText, pName ); } - _tcscat( sText, TEXT(" ") ); + strcat( sText, " " ); nLenLine += (nLenCmd + 1); } @@ -1117,14 +1388,13 @@ Update_t CmdVersion (int nArgs) int nFixMinor; UnpackVersion( nVersion, nMajor, nMinor, nFixMajor, nFixMinor ); -// wsprintf( sText, "Version" ); ConsoleBufferPush( sText ); - wsprintf( sText, " Emulator: %s%s%s Debugger: %s%d.%d.%d.%d%s" - , CON_COLOR_NUM + sprintf( sText, " Emulator: %s%s%s Debugger: %s%d.%d.%d.%d%s" + , CHC_SYMBOL , VERSIONSTRING - , CON_COLOR_DEFAULT - , CON_COLOR_NUM + , CHC_DEFAULT + , CHC_SYMBOL , nMajor, nMinor, nFixMajor, nFixMinor - , CON_COLOR_DEFAULT + , CHC_DEFAULT ); ConsolePrint( sText ); diff --git a/source/Debugger_Parser.cpp b/source/Debugger_Parser.cpp index 40c948a1..a860cbc8 100644 --- a/source/Debugger_Parser.cpp +++ b/source/Debugger_Parser.cpp @@ -434,12 +434,12 @@ void ArgsRawParse ( void ) Note: The number of args can be changed via: - address1,length Length + address1,length Length address1:address2 Range 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 TCHAR *pSrc = NULL; @@ -463,7 +463,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) pArg = & (g_aArgs[ iArg ]); pSrc = & (pArg->sArg[ 0 ]); - if (bProcessMask & (1 << TOKEN_DOLLAR)) +// if (bProcessMask & (1 << TOKEN_DOLLAR)) if (pArg->eToken == TOKEN_DOLLAR) // address { // TODO: Need to flag was a DOLLAR token for assembler @@ -521,28 +521,16 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) nAddressVal = nAddressSym; 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)) - if (pArg->eToken == TOKEN_COLON) // COLON : range - { - pPrev->nVal2 = nAddressVal; + // Comma and Colon are range operators, but they are not parsed here, + // since args no longer have a 1st and 2nd value +/* pPrev->eToken = TOKEN_COLON; pPrev->bType |= TYPE_ADDRESS; pPrev->bType |= TYPE_RANGE; - nParamLen = 2; - } */ - if (bProcessMask & (1 << TOKEN_AMPERSAND)) + +// if (bProcessMask & (1 << TOKEN_AMPERSAND)) if (pArg->eToken == TOKEN_AMPERSAND) // AND & delta { if (! ArgsGetImmediateValue( pNext, & nAddressRHS )) @@ -554,7 +542,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) nParamLen = 2; } - if (bProcessMask & (1 << TOKEN_PIPE)) +// if (bProcessMask & (1 << TOKEN_PIPE)) if (pArg->eToken == TOKEN_PIPE) // OR | delta { if (! ArgsGetImmediateValue( pNext, & nAddressRHS )) @@ -566,31 +554,31 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) nParamLen = 2; } - if (bProcessMask & (1 << TOKEN_CARET)) +// if (bProcessMask & (1 << TOKEN_CARET)) if (pArg->eToken == TOKEN_CARET) // XOR ^ delta { if (! ArgsGetImmediateValue( pNext, & nAddressRHS )) { - ArgsGetRegisterValue( pNext, & nAddressRHS ); + ArgsGetRegisterValue( pNext, & nAddressRHS ); } pPrev->nValue ^= nAddressRHS; pPrev->bType |= TYPE_VALUE; // signal already up to date nParamLen = 2; - } + } - if (bProcessMask & (1 << TOKEN_PLUS)) +// if (bProcessMask & (1 << TOKEN_PLUS)) if (pArg->eToken == TOKEN_PLUS) // PLUS + delta { if (! ArgsGetImmediateValue( pNext, & nAddressRHS )) { - ArgsGetRegisterValue( pNext, & nAddressRHS ); + ArgsGetRegisterValue( pNext, & nAddressRHS ); } pPrev->nValue += nAddressRHS; pPrev->bType |= TYPE_VALUE; // signal already up to date nParamLen = 2; } - if (bProcessMask & (1 << TOKEN_MINUS)) +// if (bProcessMask & (1 << TOKEN_MINUS)) if (pArg->eToken == TOKEN_MINUS) // MINUS - delta { if (! ArgsGetImmediateValue( pNext, & nAddressRHS )) @@ -602,7 +590,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) nParamLen = 2; } - if (bProcessMask & (1 << TOKEN_PERCENT)) +// if (bProcessMask & (1 << TOKEN_PERCENT)) if (pArg->eToken == TOKEN_PERCENT) // PERCENT % delta { if (! ArgsGetImmediateValue( pNext, & nAddressRHS )) @@ -614,7 +602,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) nParamLen = 2; } - if (bProcessMask & (1 << TOKEN_STAR)) +// if (bProcessMask & (1 << TOKEN_STAR)) if (pArg->eToken == TOKEN_STAR) // STAR * delta { if (! ArgsGetImmediateValue( pNext, & nAddressRHS )) @@ -626,7 +614,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) nParamLen = 2; } - if (bProcessMask & (1 << TOKEN_FSLASH)) +// if (bProcessMask & (1 << TOKEN_FSLASH)) if (pArg->eToken == TOKEN_FSLASH) // FORWARD SLASH / delta { if (pNext->eToken == TOKEN_FSLASH) // Comment @@ -645,7 +633,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) nParamLen = 2; } - if (bProcessMask & (1 << TOKEN_EQUAL)) +// if (bProcessMask & (1 << TOKEN_EQUAL)) if (pArg->eToken == TOKEN_EQUAL) // EQUAL = assign { pPrev->nValue = nAddressRHS; @@ -653,7 +641,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) 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 { nParamLen = 1; @@ -673,7 +661,7 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) nParamLen = 0; } - if (bProcessMask & (1 << TOKEN_HASH)) +// if (bProcessMask & (1 << TOKEN_HASH)) if (pArg->eToken == TOKEN_HASH) // HASH # immediate { pArg->nValue = nAddressRHS; @@ -682,19 +670,19 @@ int ArgsCook ( const int nArgs, const int bProcessMask ) nParamLen = 0; } - if (bProcessMask & (1 << TOKEN_LESS_THAN)) +// if (bProcessMask & (1 << TOKEN_LESS_THAN)) if (pArg->eToken == TOKEN_LESS_THAN) // < { nParamLen = 0; } - if (bProcessMask & (1 << TOKEN_GREATER_THAN)) +// if (bProcessMask & (1 << TOKEN_GREATER_THAN)) if (pArg->eToken == TOKEN_GREATER_THAN) // > { nParamLen = 0; } - if (bProcessMask & (1 << TOKEN_EXCLAMATION)) +// if (bProcessMask & (1 << TOKEN_EXCLAMATION)) if (pArg->eToken == TOKEN_EXCLAMATION) // NOT ! { if (! ArgsGetImmediateValue( pNext, & nAddressRHS )) diff --git a/source/Debugger_Parser.h b/source/Debugger_Parser.h index 38bb9b2d..34b9300e 100644 --- a/source/Debugger_Parser.h +++ b/source/Debugger_Parser.h @@ -1,13 +1,13 @@ #ifndef DEBUGGER_PARSER_H #define DEBUGGER_PARSER_H - #define CHAR_LF '\x0D' - #define CHAR_CR '\x0A' - #define CHAR_SPACE ' ' - #define CHAR_TAB '\t' + #define CHAR_LF '\x0D' + #define CHAR_CR '\x0A' + #define CHAR_SPACE ' ' + #define CHAR_TAB '\t' #define CHAR_QUOTE_DOUBLE '"' #define CHAR_QUOTE_SINGLE '\'' - #define CHAR_ESCAPE '\x1B' + #define CHAR_ESCAPE '\x1B' // Globals __________________________________________________________________ @@ -41,7 +41,7 @@ int ArgsGet ( TCHAR * pInput ); bool ArgsGetRegisterValue ( Arg_t *pArg, WORD * pAddressValue_ ); void ArgsRawParse ( void ); - int ArgsCook ( const int nArgs, const int bProcessMask ); // ArgsRawCook + int ArgsCook ( const int nArgs ); // const int bProcessMask ); // Token const char * ParserFindToken( const char *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e * pToken_ ); diff --git a/source/Debugger_Types.h b/source/Debugger_Types.h index 0231cd06..cbdf5379 100644 --- a/source/Debugger_Types.h +++ b/source/Debugger_Types.h @@ -23,7 +23,7 @@ struct AddressingMode_t { - TCHAR m_sFormat[ MAX_OPMODE_FORMAT ]; + char m_sFormat[ MAX_OPMODE_FORMAT ]; int m_nBytes; char m_sName [ MAX_OPMODE_NAME ]; }; @@ -399,7 +399,7 @@ struct Command_t { - TCHAR m_sName[ MAX_COMMAND_LEN ]; + char m_sName[ MAX_COMMAND_LEN ]; CmdFuncPtr_t pFunction; int iCommand; // offset (enum) for direct command name lookup char *pHelpSummary; // 1 line help summary @@ -904,7 +904,7 @@ struct FontConfig_t { - TCHAR _sFontName[ MAX_FONT_NAME ]; + char _sFontName[ MAX_FONT_NAME ]; HFONT _hFont; // int _iFontType; int _nFontWidthAvg; @@ -958,7 +958,7 @@ struct Instruction2_t { - TCHAR sMnemonic[MAX_MNEMONIC_LEN+1]; + char sMnemonic[MAX_MNEMONIC_LEN+1]; int nAddressMode; int iMemoryAccess; }; @@ -1170,7 +1170,7 @@ 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" WORD nValue ; // 2 // WORD nVal1 ; // 2