diff --git a/source/Applewin.cpp b/source/Applewin.cpp index 58f4cc4b..e1411763 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -323,7 +323,12 @@ void EnterMessageLoop () { MSG message; - while (GetMessage(&message,0,0,0)) + PeekMessage( &message, NULL, 0, 0, PM_NOREMOVE); + + while (message.message!=WM_QUIT) + { +// while (GetMessage(&message,0,0,0)) + if (PeekMessage( &message, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&message); DispatchMessage(&message); @@ -348,9 +353,17 @@ void EnterMessageLoop () } } } + else + { + if (g_nAppMode == MODE_DEBUG) + { + DebuggerUpdate(); + } + } +} - while (PeekMessage(&message,0,0,0,PM_REMOVE)) - ; // intentional null statement +// while (PeekMessage(&message,0,0,0,PM_REMOVE)) +// ; // intentional null statement } //=========================================================================== diff --git a/source/Common.h b/source/Common.h index 539205de..0c598da6 100644 --- a/source/Common.h +++ b/source/Common.h @@ -53,7 +53,7 @@ enum AppMode_e #define MAXIMAGES 16 // TODO: Move to StringTable.h -#define TITLE_APPLE_2 TEXT("Apple ][ Emulator") +#define TITLE_APPLE_2_ORG TEXT("Apple ][ Emulator") #define TITLE_APPLE_2_PLUS TEXT("Apple ][+ Emulator") #define TITLE_APPLE_2_E TEXT("Apple //e Emulator") // #define TITLE TITLE_APPLE_2_E diff --git a/source/Debug.cpp b/source/Debug.cpp index b7efe5d4..8ed8d569 100644 --- a/source/Debug.cpp +++ b/source/Debug.cpp @@ -37,14 +37,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #define DEBUG_COMMAND_HELP 1 // #define DEBUG_ASM_HASH 1 #define ALLOW_INPUT_LOWERCASE 1 -#define CONSOLE_FULL_WIDTH 0 // TODO: COLOR RESET // TODO: COLOR SAVE ["filename"] // TODO: COLOR LOAD ["filename"] // See Debugger_Changelong.txt for full details - const int DEBUGGER_VERSION = MAKE_VERSION(2,5,6,42); + const int DEBUGGER_VERSION = MAKE_VERSION(2,5,7,1); // Public _________________________________________________________________________________________ @@ -513,7 +512,25 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA COLORREF DebuggerGetColor ( int iColor ); -// Cursor _____________________________________________________________________ +// Cursor (Console Input) _____________________________________________________ + +// char g_aInputCursor[] = "\|/-"; + enum InputCursor + { + CURSOR_INSERT, + CURSOR_OVERSTRIKE, + NUM_INPUT_CURSORS + }; + + const char g_aInputCursor[] = "_\x7F"; // insert over-write + bool g_bInputCursor = false; + int g_iInputCursor = CURSOR_OVERSTRIKE; // which cursor to use + const int g_nInputCursor = sizeof( g_aInputCursor ); + + void DebuggerCursorUpdate(); + char DebuggerCursorGet(); + +// Cursor (Disasm) ____________________________________________________________ WORD g_nDisasmTopAddress = 0; WORD g_nDisasmBotAddress = 0; @@ -521,7 +538,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA bool g_bDisasmCurBad = false; int g_nDisasmCurLine = 0; // Aligned to Top or Center - int g_iDisasmCurState = CURSOR_NORMAL; + int g_iDisasmCurState = CURSOR_NORMAL; int g_nDisasmWinHeight = 0; @@ -545,12 +562,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA int g_nFontHeight = 15; // 13 -> 12 Lucida Console is readable #endif - const int MIN_DISPLAY_CONSOLE_LINES = 4; // doesn't include ConsoleInput + const int MIN_DISPLAY_CONSOLE_LINES = 5; // doesn't include ConsoleInput - int g_nTotalLines = 0; // DISPLAY_HEIGHT / g_nFontHeight; - int MAX_DISPLAY_DISASM_LINES = 0; // g_nTotalLines - MIN_DISPLAY_CONSOLE_LINES; // 19; - - int MAX_DISPLAY_CONSOLE_LINES = 0; // MAX_DISPLAY_DISASM_LINES + MIN_DISPLAY_CONSOLE_LINES; // 23 + int g_nDisasmDisplayLines = 0; // Config _____________________________________________________________________ @@ -823,7 +837,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA static Update_t ExecuteCommand ( int nArgs ); // Breakpoints - void _ListBreakWatchZero( Breakpoint_t * aBreakWatchZero, int iBWZ, bool bZeroBased = true ); + void _BWZ_List( const Breakpoint_t * aBreakWatchZero, const int iBWZ ); // bool bZeroBased = true ); + void _BWZ_ListAll( const Breakpoint_t * aBreakWatchZero, const int nMax ); // bool CheckBreakpoint (WORD address, BOOL memory); bool CheckBreakpointsIO (); @@ -1240,15 +1255,7 @@ Update_t CmdBookmarkList (int nArgs) } else { - int iBookmark = 0; - while (iBookmark < MAX_BOOKMARKS) - { - if (g_aBookmarks[ iBookmark ].bSet) - { - _ListBreakWatchZero( g_aBookmarks, iBookmark, false ); - } - iBookmark++; - } + _BWZ_ListAll( g_aBookmarks, MAX_BOOKMARKS ); } return ConsoleUpdate(); } @@ -2055,35 +2062,33 @@ Update_t CmdBreakpointAddMem (int nArgs) //=========================================================================== -void _BreakWatchZero_Clear( Breakpoint_t * aBreakWatchZero, int iSlot ) +void _BWZ_Clear( Breakpoint_t * aBreakWatchZero, int iSlot ) { aBreakWatchZero[ iSlot ].bSet = false; aBreakWatchZero[ iSlot ].bEnabled = false; aBreakWatchZero[ iSlot ].nLength = 0; } -void _BreakWatchZero_RemoveOne( Breakpoint_t *aBreakWatchZero, const int iSlot, int & nTotal ) +void _BWZ_RemoveOne( Breakpoint_t *aBreakWatchZero, const int iSlot, int & nTotal ) { if (aBreakWatchZero[iSlot].bSet) { - _BreakWatchZero_Clear( aBreakWatchZero, iSlot ); + _BWZ_Clear( aBreakWatchZero, iSlot ); nTotal--; } } -void _BreakWatchZero_RemoveAll( Breakpoint_t *aBreakWatchZero, const int nMax, int & nTotal ) +void _BWZ_RemoveAll( Breakpoint_t *aBreakWatchZero, const int nMax, int & nTotal ) { - int iSlot = nMax; - - while (iSlot--) + for( int iSlot = 0; iSlot < nMax; iSlot++ ) { - _BreakWatchZero_RemoveOne( aBreakWatchZero, iSlot, nTotal ); + _BWZ_RemoveOne( aBreakWatchZero, iSlot, nTotal ); } } // called by BreakpointsClear, WatchesClear, ZeroPagePointersClear //=========================================================================== -void _ClearViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const int nMax, int & nTotal ) +void _BWZ_ClearViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const int nMax, int & nTotal ) { int iSlot = 0; @@ -2094,13 +2099,13 @@ void _ClearViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const int nMax, i if (! _tcscmp(g_aArgs[nArgs].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName)) { - _BreakWatchZero_RemoveAll( aBreakWatchZero, nMax, nTotal ); + _BWZ_RemoveAll( aBreakWatchZero, nMax, nTotal ); break; } else - if ((iSlot >= 1) && (iSlot <= nMax)) + if ((iSlot >= 0) && (iSlot < nMax)) { - _BreakWatchZero_RemoveOne( aBreakWatchZero, iSlot - 1, nTotal ); + _BWZ_RemoveOne( aBreakWatchZero, iSlot, nTotal ); } nArgs--; @@ -2109,7 +2114,7 @@ void _ClearViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const int nMax, i // called by BreakpointsEnable, WatchesEnable, ZeroPagePointersEnable // called by BreakpointsDisable, WatchesDisable, ZeroPagePointersDisable -void _EnableDisableViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const int nMax, const bool bEnabled ) +void _BWZ_EnableDisableViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const int nMax, const bool bEnabled ) { int iSlot = 0; @@ -2120,17 +2125,15 @@ void _EnableDisableViaArgs( int nArgs, Breakpoint_t * aBreakWatchZero, const int if (! _tcscmp(g_aArgs[nArgs].sArg, g_aParameters[ PARAM_WILDSTAR ].m_sName)) { - iSlot = nMax; - while (iSlot--) + for( ; iSlot < nMax; iSlot++ ) { aBreakWatchZero[ iSlot ].bEnabled = bEnabled; } - break; } else - if ((iSlot >= 1) && (iSlot <= nMax)) + if ((iSlot >= 0) && (iSlot < nMax)) { - aBreakWatchZero[iSlot-1].bEnabled = bEnabled; + aBreakWatchZero[ iSlot ].bEnabled = bEnabled; } nArgs--; @@ -2145,11 +2148,11 @@ Update_t CmdBreakpointClear (int nArgs) if (!nArgs) { - _BreakWatchZero_RemoveAll( g_aBreakpoints, MAX_BREAKPOINTS, g_nBreakpoints ); + _BWZ_RemoveAll( g_aBreakpoints, MAX_BREAKPOINTS, g_nBreakpoints ); } else { - _ClearViaArgs( nArgs, g_aBreakpoints, MAX_BREAKPOINTS, g_nBreakpoints ); + _BWZ_ClearViaArgs( nArgs, g_aBreakpoints, MAX_BREAKPOINTS, g_nBreakpoints ); } return UPDATE_DISASM | UPDATE_BREAKPOINTS | UPDATE_CONSOLE_DISPLAY; @@ -2164,7 +2167,7 @@ Update_t CmdBreakpointDisable (int nArgs) if (! nArgs) return Help_Arg_1( CMD_BREAKPOINT_DISABLE ); - _EnableDisableViaArgs( nArgs, g_aBreakpoints, MAX_BREAKPOINTS, false ); + _BWZ_EnableDisableViaArgs( nArgs, g_aBreakpoints, MAX_BREAKPOINTS, false ); return UPDATE_BREAKPOINTS; } @@ -2185,13 +2188,13 @@ Update_t CmdBreakpointEnable (int nArgs) { if (! nArgs) return Help_Arg_1( CMD_BREAKPOINT_ENABLE ); - _EnableDisableViaArgs( nArgs, g_aBreakpoints, MAX_BREAKPOINTS, true ); + _BWZ_EnableDisableViaArgs( nArgs, g_aBreakpoints, MAX_BREAKPOINTS, true ); return UPDATE_BREAKPOINTS; } -void _ListBreakWatchZero( Breakpoint_t * aBreakWatchZero, int iBWZ, bool bZeroBased ) +void _BWZ_List( const Breakpoint_t * aBreakWatchZero, const int iBWZ ) //, bool bZeroBased ) { static TCHAR sText[ CONSOLE_WIDTH ]; static const TCHAR sFlags[] = "-*"; @@ -2206,7 +2209,8 @@ void _ListBreakWatchZero( Breakpoint_t * aBreakWatchZero, int iBWZ, bool bZeroBa } wsprintf( sText, " #%d %c %04X %s", - (bZeroBased ? iBWZ + 1 : iBWZ), +// (bZeroBased ? iBWZ + 1 : iBWZ), + iBWZ, sFlags[ (int) aBreakWatchZero[ iBWZ ].bEnabled ], aBreakWatchZero[ iBWZ ].nAddress, pSymbol @@ -2214,6 +2218,18 @@ void _ListBreakWatchZero( Breakpoint_t * aBreakWatchZero, int iBWZ, bool bZeroBa ConsoleBufferPush( sText ); } +void _BWZ_ListAll( const Breakpoint_t * aBreakWatchZero, const int nMax ) +{ + int iBWZ = 0; + while (iBWZ < MAX_BOOKMARKS) + { + if (aBreakWatchZero[ iBWZ ].bSet) + { + _BWZ_List( aBreakWatchZero, iBWZ ); + } + iBWZ++; + } +} //=========================================================================== Update_t CmdBreakpointList (int nArgs) @@ -2239,15 +2255,7 @@ Update_t CmdBreakpointList (int nArgs) } else { - int iBreakpoint = 0; - while (iBreakpoint < MAX_BREAKPOINTS) - { - if (g_aBreakpoints[ iBreakpoint ].bSet) - { - _ListBreakWatchZero( g_aBreakpoints, iBreakpoint ); - } - iBreakpoint++; - } + _BWZ_ListAll( g_aBreakpoints, MAX_BREAKPOINTS ); } return ConsoleUpdate(); } @@ -3179,7 +3187,7 @@ Update_t CmdConfigFont (int nArgs) { TCHAR sText[ CONSOLE_WIDTH ]; wsprintf( sText, "Lines: %d Font Px: %d Line Px: %d" - , g_nTotalLines + , g_nDisasmDisplayLines , g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontHeight , g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight ); ConsoleBufferPush( sText ); @@ -3228,46 +3236,33 @@ void _UpdateWindowFontHeights( int nFontHeight ) { if (nFontHeight) { - // The screen layout defaults to a "virtal" font height of 16 pixels. - // The disassmebler has 19 lines. - // Total: 19 * 16 pixels - // - // Figure out how many lines we can display, given our new font height. - // Given: Total_Pixels = Lines * Pixels_Line - // Calc: Lines = Total_Pixels / Pixels_Line - int nConsoleTopY = 19 * 16; + int nConsoleTopY = GetConsoleTopPixels( g_nConsoleDisplayLines ); + int nHeight = 0; if (g_iFontSpacing == FONT_SPACING_CLASSIC) { nHeight = nFontHeight + 1; - g_nTotalLines = nConsoleTopY / nHeight; + g_nDisasmDisplayLines = nConsoleTopY / nHeight; } else if (g_iFontSpacing == FONT_SPACING_CLEAN) { nHeight = nFontHeight; - g_nTotalLines = nConsoleTopY / nHeight; + g_nDisasmDisplayLines = nConsoleTopY / nHeight; } else if (g_iFontSpacing == FONT_SPACING_COMPRESSED) { nHeight = nFontHeight - 1; - g_nTotalLines = (nConsoleTopY + nHeight) / nHeight; // Ceil() + g_nDisasmDisplayLines = (nConsoleTopY + nHeight) / nHeight; // Ceil() } g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight = nHeight; // int nHeightOptimal = (nHeight0 + nHeight1) / 2; // int nLinesOptimal = nConsoleTopY / nHeightOptimal; -// g_nTotalLines = nLinesOptimal; - - MAX_DISPLAY_DISASM_LINES = g_nTotalLines; - - // TODO/FIXME: Needs to take into account the console height - MAX_DISPLAY_CONSOLE_LINES = MAX_DISPLAY_DISASM_LINES + MIN_DISPLAY_CONSOLE_LINES; // 23 -// if (MAX_DISPLAY_CONSOLE_LINES > 23) -// MAX_DISPLAY_CONSOLE_LINES = 23; +// g_nDisasmDisplayLines = nLinesOptimal; WindowUpdateSizes(); } @@ -3821,9 +3816,9 @@ Update_t CmdCursorLineUp (int nArgs) aTopCandidates.reserve( MAX_LOOK_AHEAD ); aTopCandidates.erase( aTopCandidates.begin(), aTopCandidates.end() ); - int nTop = g_nDisasmTopAddress; - int iTop = 0; - int nCur = 0; + WORD nTop = g_nDisasmTopAddress; + WORD iTop = 0; + WORD nCur = 0; do { @@ -3831,6 +3826,7 @@ Update_t CmdCursorLineUp (int nArgs) nCur = nTop; iTop = (g_nDisasmTopAddress - nTop); + for (int iLine = 0; iLine < MAX_LOOK_AHEAD; iLine++ ) { iOpcode = _6502_GetOpmodeOpbytes( nCur, iOpmode, nOpbytes ); @@ -6657,7 +6653,7 @@ Update_t CmdWatchAdd (int nArgs) if (iWatch == NO_6502_TARGET) { iWatch = 0; - while ((iWatch < MAX_ZEROPAGE_POINTERS) && (g_aZeroPagePointers[iWatch].bSet)) + while ((iWatch < MAX_ZEROPAGE_POINTERS) && (g_aWatches[iWatch].bSet)) { iWatch++; } @@ -6700,7 +6696,7 @@ Update_t CmdWatchClear (int nArgs) if (!nArgs) return Help_Arg_1( CMD_WATCH_CLEAR ); - _ClearViaArgs( nArgs, g_aWatches, MAX_WATCHES, g_nWatches ); + _BWZ_ClearViaArgs( nArgs, g_aWatches, MAX_WATCHES, g_nWatches ); // if (! g_nWatches) // { @@ -6720,7 +6716,7 @@ Update_t CmdWatchDisable (int nArgs) if (!nArgs) return Help_Arg_1( CMD_WATCH_DISABLE ); - _EnableDisableViaArgs( nArgs, g_aWatches, MAX_WATCHES, false ); + _BWZ_EnableDisableViaArgs( nArgs, g_aWatches, MAX_WATCHES, false ); return UPDATE_WATCH; } @@ -6734,7 +6730,7 @@ Update_t CmdWatchEnable (int nArgs) if (!nArgs) return Help_Arg_1( CMD_WATCH_ENABLE ); - _EnableDisableViaArgs( nArgs, g_aWatches, MAX_WATCHES, true ); + _BWZ_EnableDisableViaArgs( nArgs, g_aWatches, MAX_WATCHES, true ); return UPDATE_WATCH; } @@ -6750,15 +6746,7 @@ Update_t CmdWatchList (int nArgs) } else { - int iWatch = 0; - while (iWatch < MAX_WATCHES) - { - if (g_aWatches[ iWatch ].bSet) - { - _ListBreakWatchZero( g_aWatches, iWatch, true ); - } - iWatch++; - } + _BWZ_List( g_aWatches, MAX_WATCHES ); } return ConsoleUpdate(); } @@ -6847,19 +6835,19 @@ Update_t _CmdWindowViewFull ( int iNewWindow ) //=========================================================================== void WindowUpdateConsoleDisplayedSize() { - g_nConsoleDisplayHeight = MIN_DISPLAY_CONSOLE_LINES; -#if CONSOLE_FULL_WIDTH + g_nConsoleDisplayLines = MIN_DISPLAY_CONSOLE_LINES; +#if USE_APPLE_FONT g_bConsoleFullWidth = true; g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1; if (g_iWindowThis == WINDOW_CONSOLE) { - g_nConsoleDisplayHeight = MAX_DISPLAY_CONSOLE_LINES; + g_nConsoleDisplayLines = MAX_DISPLAY_LINES; g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1; g_bConsoleFullWidth = true; } #else - g_nConsoleDisplayWidth = (CONSOLE_WIDTH / 2) + 8; + g_nConsoleDisplayWidth = (CONSOLE_WIDTH / 2) + 10; g_bConsoleFullWidth = false; // g_bConsoleFullWidth = false; @@ -6867,7 +6855,7 @@ void WindowUpdateConsoleDisplayedSize() if (g_iWindowThis == WINDOW_CONSOLE) { - g_nConsoleDisplayHeight = MAX_DISPLAY_CONSOLE_LINES; + g_nConsoleDisplayLines = MAX_DISPLAY_LINES; g_nConsoleDisplayWidth = CONSOLE_WIDTH - 1; g_bConsoleFullWidth = true; } @@ -6886,11 +6874,11 @@ void WindowUpdateDisasmSize() { if (g_aWindowConfig[ g_iWindowThis ].bSplit) { - g_nDisasmWinHeight = (MAX_DISPLAY_DISASM_LINES) / 2; + g_nDisasmWinHeight = (MAX_DISPLAY_LINES - g_nConsoleDisplayLines) / 2; } else { - g_nDisasmWinHeight = MAX_DISPLAY_DISASM_LINES; + g_nDisasmWinHeight = MAX_DISPLAY_LINES - g_nConsoleDisplayLines; } g_nDisasmCurLine = MAX(0, (g_nDisasmWinHeight - 1) / 2); #if _DEBUG @@ -7232,7 +7220,7 @@ Update_t CmdZeroPageClear (int nArgs) if (!nArgs) return Help_Arg_1( CMD_ZEROPAGE_POINTER_CLEAR ); - _ClearViaArgs( nArgs, g_aZeroPagePointers, MAX_ZEROPAGE_POINTERS, g_nZeroPagePointers ); + _BWZ_ClearViaArgs( nArgs, g_aZeroPagePointers, MAX_ZEROPAGE_POINTERS, g_nZeroPagePointers ); if (! g_nZeroPagePointers) { @@ -7251,7 +7239,7 @@ Update_t CmdZeroPageDisable (int nArgs) if (! g_nZeroPagePointers) return ConsoleDisplayError(TEXT("There are no (ZP) pointers defined.")); - _EnableDisableViaArgs( nArgs, g_aZeroPagePointers, MAX_ZEROPAGE_POINTERS, false ); + _BWZ_EnableDisableViaArgs( nArgs, g_aZeroPagePointers, MAX_ZEROPAGE_POINTERS, false ); return UPDATE_ZERO_PAGE; } @@ -7265,7 +7253,7 @@ Update_t CmdZeroPageEnable (int nArgs) if (!nArgs) return Help_Arg_1( CMD_ZEROPAGE_POINTER_ENABLE ); - _EnableDisableViaArgs( nArgs, g_aZeroPagePointers, MAX_ZEROPAGE_POINTERS, true ); + _BWZ_EnableDisableViaArgs( nArgs, g_aZeroPagePointers, MAX_ZEROPAGE_POINTERS, true ); return UPDATE_ZERO_PAGE; } @@ -7281,15 +7269,7 @@ Update_t CmdZeroPageList (int nArgs) } else { - int iZP = 0; - while (iZP < MAX_ZEROPAGE_POINTERS) - { - if (g_aZeroPagePointers[ iZP ].bEnabled) - { - _ListBreakWatchZero( g_aZeroPagePointers, iZP ); - } - iZP++; - } + _BWZ_ListAll( g_aZeroPagePointers, MAX_ZEROPAGE_POINTERS ); } return ConsoleUpdate(); } @@ -7686,8 +7666,8 @@ bool InternalSingleStep () void OutputTraceLine () { // HACK: MAGIC #: 50 -> 64 chars for disassembly - TCHAR sDisassembly[ 64 ] ; DrawDisassemblyLine((HDC)0,0,regs.pc, sDisassembly); // Get Disasm String - TCHAR sFlags[ _6502_NUM_FLAGS+1]; DrawFlags( (HDC)0, 0, regs.ps, sFlags); // Get Flags String + 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 _ftprintf(g_hTraceFile, TEXT("a=%02x x=%02x y=%02x sp=%03x ps=%s %s\n"), @@ -8182,7 +8162,7 @@ void DebugDestroy () _CmdSymbolsClear( (Symbols_e) iTable ); } - SelectObject( g_hDstDC, GetStockObject(NULL_BRUSH) ); + SelectObject( g_hFrameDC, GetStockObject(NULL_BRUSH) ); DeleteObject( g_hConsoleBrushFG ); DeleteObject( g_hConsoleBrushBG ); @@ -8190,7 +8170,7 @@ void DebugDestroy () DeleteDC( g_hConsoleFontDC ); DeleteObject( g_hConsoleFontBitmap ); - ReleaseDC( g_hFrameWindow, g_hDstDC ); +// ReleaseDC( g_hFrameWindow, g_hFrameDC ); } @@ -8303,19 +8283,19 @@ void DebugInitialize () DWORD nError = 0; #endif - g_hDstDC = GetDC( g_hFrameWindow ); +// g_hDstDC = g_hFrameDC; //GetDC( g_hFrameWindow ); #if _DEBUG nError = GetLastError(); #endif // Must select a bitmap into the temp DC ! - HDC hTmpDC = CreateCompatibleDC( g_hDstDC ); + HDC hTmpDC = CreateCompatibleDC( g_hFrameDC ); #if _DEBUG nError = GetLastError(); #endif - g_hConsoleFontDC = CreateCompatibleDC( g_hDstDC ); + g_hConsoleFontDC = CreateCompatibleDC( g_hFrameDC ); #if _DEBUG nError = GetLastError(); #endif @@ -8371,7 +8351,7 @@ void DebugInitialize () DeleteObject( hTmpDC ); #endif - DeleteDC( g_hDstDC ); g_hDstDC = NULL; +// DeleteDC( g_hFrameDC ); g_hDstDC = NULL; ZeroMemory( g_aConsoleDisplay, sizeof( g_aConsoleDisplay ) ); // CONSOLE_WIDTH * CONSOLE_HEIGHT ); ConsoleInputReset(); @@ -8426,12 +8406,13 @@ void DebugInitialize () _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 ); int iColor; iColor = FG_CONSOLE_OUTPUT; COLORREF nColor = gaColorPalette[ g_aColorIndex[ iColor ] ]; - g_anConsoleColor[ CONSOLE_COLOR_PREV ] = nColor; + g_anConsoleColor[ CONSOLE_COLOR_x ] = nColor; /* g_hFontDebugger = CreateFont( @@ -8467,6 +8448,7 @@ void DebugInitialize () , g_sFontNameBranch ); */ // if (g_hFontWebDings) +#if !USE_APPLE_FONT if (g_aFontConfig[ FONT_DISASM_BRANCH ]._hFont) { g_iConfigDisasmBranchType = DISASM_BRANCH_FANCY; @@ -8475,7 +8457,7 @@ void DebugInitialize () { g_iConfigDisasmBranchType = DISASM_BRANCH_PLAIN; } - +#endif // ConsoleInputReset(); already called in DebugInitialize() TCHAR sText[ CONSOLE_WIDTH ]; @@ -8542,6 +8524,12 @@ void DebuggerInputConsoleChar( TCHAR ch ) return; } + if (ch == CONSOLE_COLOR_ESCAPE_CHAR) + return; + + if (g_nConsoleInputSkip == ch) + return; + if (ch == CHAR_SPACE) { // If don't have console input, don't pass space to the input line @@ -8553,12 +8541,6 @@ void DebuggerInputConsoleChar( TCHAR ch ) if (g_nConsoleInputChars > (g_nConsoleDisplayWidth-1)) return; - if (g_bConsoleInputSkip) - { - g_bConsoleInputSkip = false; - return; - } - if ((ch >= CHAR_SPACE) && (ch <= 126)) // HACK MAGIC # 32 -> ' ', # 126 { if ((ch == TCHAR_QUOTE_DOUBLE) || (ch == TCHAR_QUOTE_SINGLE)) @@ -8574,8 +8556,10 @@ void DebuggerInputConsoleChar( TCHAR ch ) } ConsoleInputChar( ch ); - HDC dc = FrameGetDC(); - DrawConsoleInput( dc ); + DebuggerCursorNext(); + + FrameGetDC(); + DrawConsoleInput(); FrameReleaseDC(); } else @@ -8675,7 +8659,7 @@ Update_t DebuggerProcessCommand( const bool bEchoConsoleInput ) } } ConsoleInputReset(); - bUpdateDisplay |= UPDATE_CONSOLE_DISPLAY; + bUpdateDisplay |= UPDATE_CONSOLE_DISPLAY | UPDATE_CONSOLE_INPUT; ConsoleUpdate(); // udpate console, don't pause } else @@ -8728,7 +8712,7 @@ void DebuggerProcessKey( int keycode ) { if ((VK_SPACE == keycode) || (VK_RETURN == keycode) || (VK_TAB == keycode) || (VK_ESCAPE == keycode)) { - int nLines = MIN( g_nConsoleBuffer, g_nConsoleDisplayHeight - 1 ); // was -2 + int nLines = MIN( g_nConsoleBuffer, g_nConsoleDisplayLines - 1 ); // was -2 if (VK_ESCAPE == keycode) // user doesn't want to read all this stu { nLines = g_nConsoleBuffer; @@ -8739,23 +8723,24 @@ void DebuggerProcessKey( int keycode ) keycode = 0; // don't single-step } - bUpdateDisplay |= UPDATE_CONSOLE_DISPLAY; + bUpdateDisplay |= UPDATE_CONSOLE_DISPLAY | UPDATE_CONSOLE_INPUT; ConsoleDisplayPause(); } else - // If have console input, don't invoke cursor movement + // If have console input, don't invoke curmovement // TODO: Probably should disable all "movement" keys to map them to line editing g_nAppMode if ((keycode == VK_SPACE) && g_nConsoleInputChars) return; else if (keycode == VK_ESCAPE) { g_bConsoleInputQuoted = false; - ConsoleInputClear(); + ConsoleInputReset(); bUpdateDisplay |= UPDATE_CONSOLE_INPUT; } else if (keycode == VK_BACK) { // Note: Checks prev char if QUTOE - SINGLE or DOUBLE +// ConsoleUpdateCursor( CHAR_SPACE ); if (! ConsoleInputBackSpace()) { // CmdBeep(); @@ -8764,22 +8749,32 @@ void DebuggerProcessKey( int keycode ) } else if (keycode == VK_RETURN) { +// ConsoleUpdateCursor( 0 ); + ConsoleScrollEnd(); bUpdateDisplay |= DebuggerProcessCommand( true ); // copy console input to console output - + bUpdateDisplay |= UPDATE_CONSOLE_DISPLAY; } else if (keycode == VK_OEM_3) // Tilde ~ { - // Switch to Console Window - if (g_iWindowThis != WINDOW_CONSOLE) + if (KeybGetCtrlStatus()) { - CmdWindowViewConsole( 0 ); + // Switch to Console Window + if (g_iWindowThis != WINDOW_CONSOLE) + { + CmdWindowViewConsole( 0 ); + } + else // switch back to last window + { + CmdWindowLast( 0 ); + } + bUpdateDisplay |= UPDATE_ALL; } - else // switch back to last window + else { - CmdWindowLast( 0 ); + g_nConsoleInputSkip = 0; // VK_OEM_3; // don't pass to DebugProcessChar() + DebuggerInputConsoleChar( '~' ); } - bUpdateDisplay |= UPDATE_ALL; - g_bConsoleInputSkip = true; // don't pass to DebugProcessChar() + g_nConsoleInputSkip = '~'; // VK_OEM_3; // don't pass to DebugProcessChar() } else { @@ -9063,3 +9058,99 @@ void DebugDisplay( BOOL bDrawBackground ) UpdateDisplay( bUpdateFlags ); } + + +//=========================================================================== +void DebuggerUpdate() +{ + DebuggerCursorUpdate(); +} + + +//=========================================================================== +void DebuggerCursorUpdate() +{ + if (g_nAppMode != MODE_DEBUG) + return; + + const nUpdatesPerSecond = 4; + const DWORD nHz = 1000 / nUpdatesPerSecond; + static DWORD nBeg = GetTickCount(); // timeGetTime(); + DWORD nNow = GetTickCount(); // timeGetTime(); + + if (((nNow - nBeg)) >= nHz) + { + nBeg = nNow; + + DebuggerCursorNext(); + + FrameGetDC(); + DrawConsoleCursor(); + FrameReleaseDC(); + } +} + + +//=========================================================================== +void DebuggerCursorNext() +{ + g_bInputCursor ^= true; + if (g_bInputCursor) + { + ConsoleUpdateCursor( g_aInputCursor[ g_iInputCursor ] ); + } + else + ConsoleUpdateCursor( 0 ); // show char under cursor +} + + +//=========================================================================== +//char DebuggerCursorGet() +//{ +// return g_aInputCursor[ g_iInputCursor ]; +//} + + +//=========================================================================== +void DebuggerMouseClick( int x, int y ) +{ + int nFontWidth = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nFontWidthAvg; + int nFontHeight = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight ; + + // do picking + FrameGetDC(); + + int cx = (x - VIEWPORTX) / nFontWidth; + int cy = (y - VIEWPORTY) / nFontHeight; + +#if _DEBUG + char sText[ CONSOLE_WIDTH ]; + sprintf( sText, "x:%d y:%d cx:%d cy:%d", x, y, cx, cy ); + ConsoleDisplayPush( sText ); + DebugDisplay( UPDATE_CONSOLE_DISPLAY ); +#endif + + if (g_iWindowThis == WINDOW_CODE) + { + // Display_AssemblyLine -- need Tabs + if (cx == 4) + { + g_bConfigDisasmAddressColon ^= true; + DebugDisplay( UPDATE_DISASM ); + } + else + if ((cx > 4) & (cx <= 13)) + { + g_bConfigDisasmOpcodesView ^= true; + DebugDisplay( UPDATE_DISASM ); + } + else + if ((cx >= 51) && (cx <= 60) && (cy == 3)) + { + CmdCursorJumpPC( CURSOR_ALIGN_CENTER ); + DebugDisplay( UPDATE_DISASM ); + } + } + + FrameReleaseDC(); +} diff --git a/source/Debug.h b/source/Debug.h index 9207f9fc..1c0d25d9 100644 --- a/source/Debug.h +++ b/source/Debug.h @@ -68,6 +68,9 @@ using namespace std; // Config - Info extern bool g_bConfigInfoTargetPointer ; +// Disassembly + extern int g_aDisasmTargets[ MAX_DISPLAY_LINES ]; + // Display extern bool g_bDebuggerViewingAppleOutput; @@ -164,3 +167,9 @@ using namespace std; void DebuggerInputConsoleChar( TCHAR ch ); // void DebugProcessCommand (int); void DebuggerProcessKey( int keycode ); + + void DebuggerUpdate(); + void DebuggerCursorNext(); + + void DebuggerMouseClick( int x, int y ); + \ No newline at end of file diff --git a/source/Debugger_Console.cpp b/source/Debugger_Console.cpp index 90d7ef2a..3bd88ef0 100644 --- a/source/Debugger_Console.cpp +++ b/source/Debugger_Console.cpp @@ -49,34 +49,39 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Buffer bool g_bConsoleBufferPaused = false; // buffered output is waiting for user to continue int g_nConsoleBuffer = 0; - TCHAR g_aConsoleBuffer[ CONSOLE_HEIGHT ][ CONSOLE_WIDTH ]; // TODO: stl::vector< line_t > + conchar_t g_aConsoleBuffer[ CONSOLE_BUFFER_HEIGHT ][ CONSOLE_WIDTH*2 ]; // TODO: stl::vector< line_t > // Display - TCHAR g_aConsolePrompt[] = TEXT(">!"); // input, assembler // NUM_PROMPTS - TCHAR g_sConsolePrompt[] = TEXT(">"); // No, NOT Integer Basic! The nostalgic '*' "Monitor" doesn't look as good, IMHO. :-( + conchar_t g_aConsolePrompt[] = TEXT(">!"); // input, assembler // NUM_PROMPTS + + conchar_t g_sConsolePrompt[] = TEXT(">"); // No, NOT Integer Basic! The nostalgic '*' "Monitor" doesn't look as good, IMHO. :-( + int g_nConsolePromptLen = 1; + bool g_bConsoleFullWidth = true; // false int g_iConsoleDisplayStart = 0; // to allow scrolling int g_nConsoleDisplayTotal = 0; // number of lines added to console - int g_nConsoleDisplayHeight = 0; + int g_nConsoleDisplayLines = 0; int g_nConsoleDisplayWidth = 0; - TCHAR g_aConsoleDisplay[ CONSOLE_HEIGHT ][ CONSOLE_WIDTH ]; + conchar_t g_aConsoleDisplay[ CONSOLE_HEIGHT ][ CONSOLE_WIDTH*2 ]; // Input History int g_nHistoryLinesStart = 0; int g_nHistoryLinesTotal = 0; // number of commands entered - TCHAR g_aHistoryLines[ CONSOLE_HEIGHT ][ CONSOLE_WIDTH ] = {TEXT("")}; + TCHAR g_aHistoryLines[ HISTORY_HEIGHT ][ HISTORY_WIDTH ] = {TEXT("")}; // Input Line + conchar_t g_sConsoleCursor[] = "_"; + // Raw input Line (has prompt) - TCHAR * const g_aConsoleInput = g_aConsoleDisplay[0]; + conchar_t * const g_aConsoleInput = g_aConsoleDisplay[0]; // Cooked input line (no prompt) int g_nConsoleInputChars = 0; - TCHAR * g_pConsoleInput = 0; // points to past prompt - const TCHAR * g_pConsoleFirstArg = 0; // points to first arg + conchar_t * g_pConsoleInput = 0; // points to past prompt + const conchar_t * g_pConsoleFirstArg = 0; // points to first arg bool g_bConsoleInputQuoted = false; // Allows lower-case to be entered - bool g_bConsoleInputSkip = false; + char g_nConsoleInputSkip = '~'; // Prototypes _______________________________________________________________ @@ -89,21 +94,64 @@ LPCSTR ConsoleBufferPeek() } +//=========================================================================== +bool ConsolePrint( const char * pText ) +{ + // TODO: Must convert color string to native console color text + + const int nMaxWidth = (CONSOLE_WIDTH * 2) - 1; // g_nConsoleDisplayWidth; + + int nLen = _tcslen( pText ); + + // push multiple lines + while ((nLen > 0) && (g_nConsoleBuffer < CONSOLE_BUFFER_HEIGHT)) + { + _tcsncpy( g_aConsoleBuffer[ g_nConsoleBuffer ], pText, nMaxWidth ); + pText += nMaxWidth; + + g_nConsoleBuffer++; + nLen -= nMaxWidth; + } + return true; +} + // Add string to buffered output // Shifts the buffered console output lines "Up" //=========================================================================== bool ConsoleBufferPush( const TCHAR * pString ) // LPCSTR { - if (g_nConsoleBuffer < CONSOLE_HEIGHT) - { - const int nMaxWidth = CONSOLE_WIDTH-1; // g_nConsoleDisplayWidth; + int nLen = _tcslen( pString ); - int nLen = _tcslen( pString ); - if (nLen <= nMaxWidth) +#if USE_APPLE_FONT + // TODO/FIXME: Must convert console over to CHAR16 type, since colored strings are of varying length + const int nMaxWidth = CONSOLE_WIDTH; // + (CONSOLE_WIDTH / 2); // g_nConsoleDisplayWidth; +#else + const int nMaxWidth = CONSOLE_WIDTH-1; // g_nConsoleDisplayWidth; +#endif + + int x = 0; + + while ((nLen > 0) && (g_nConsoleBuffer < CONSOLE_HEIGHT)) + { + x = min( nLen, nMaxWidth ); + _tcsncpy( g_aConsoleBuffer[ g_nConsoleBuffer ], pString, x ); + nLen -= x; + + conchar_t *pLine = & g_aConsoleBuffer[ g_nConsoleBuffer ][ x ]; +/* + for ( ; x < nMaxWidth; x++ ) { - _tcscpy( g_aConsoleBuffer[ g_nConsoleBuffer ], pString ); - g_nConsoleBuffer++; - return true; + *pLine++ = CHAR_SPACE; + } +*/ + *pLine = 0; + + g_nConsoleBuffer++; + } + return true; + +// return true; +/* } else { @@ -123,10 +171,10 @@ bool ConsoleBufferPush( const TCHAR * pString ) // LPCSTR } return true; } - } +*/ // TODO: Warning: Too much output. - return false; +// return false; } // Shifts the buffered console output "down" @@ -168,14 +216,21 @@ void ConsoleDisplayPush( LPCSTR pText ) int nLen = MIN( g_nConsoleDisplayTotal, CONSOLE_HEIGHT - 1 - CONSOLE_FIRST_LINE); while (nLen--) { - _tcsncpy( - g_aConsoleDisplay[(nLen + 1 + CONSOLE_FIRST_LINE )], - g_aConsoleDisplay[nLen + CONSOLE_FIRST_LINE], - CONSOLE_WIDTH ); +// _tcsncpy( + _tcscpy( + g_aConsoleDisplay[(nLen + 1 + CONSOLE_FIRST_LINE )] + , g_aConsoleDisplay[nLen + CONSOLE_FIRST_LINE] + ); +// , CONSOLE_WIDTH ); } if (pText) - _tcsncpy( g_aConsoleDisplay[ CONSOLE_FIRST_LINE ], pText, CONSOLE_WIDTH ); +// _tcsncpy( + _tcscpy( + g_aConsoleDisplay[ CONSOLE_FIRST_LINE ] + , pText + ); +// , CONSOLE_WIDTH ); g_nConsoleDisplayTotal++; if (g_nConsoleDisplayTotal > (CONSOLE_HEIGHT - CONSOLE_FIRST_LINE)) @@ -189,7 +244,9 @@ void ConsoleDisplayPause() { if (g_nConsoleBuffer) { - _tcscpy( g_pConsoleInput, TEXT("...press SPACE continue, ESC skip..." ) ); + strcpy( g_aConsoleInput, "...press SPACE continue, ESC skip..." ); + g_nConsolePromptLen = strlen( g_pConsoleInput ) + 1; + g_nConsoleInputChars = 0; g_bConsoleBufferPaused = true; } else @@ -203,24 +260,32 @@ bool ConsoleInputBackSpace() { if (g_nConsoleInputChars) { + g_pConsoleInput[ g_nConsoleInputChars ] = CHAR_SPACE; + g_nConsoleInputChars--; if ((g_pConsoleInput[ g_nConsoleInputChars ] == TCHAR_QUOTE_DOUBLE) || (g_pConsoleInput[ g_nConsoleInputChars ] == TCHAR_QUOTE_SINGLE)) g_bConsoleInputQuoted = ! g_bConsoleInputQuoted; - g_pConsoleInput[ g_nConsoleInputChars ] = 0; + g_pConsoleInput[ g_nConsoleInputChars ] = CHAR_SPACE; return true; } return false; } +// Clears prompt too //=========================================================================== 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 ); +// ZeroMemory( g_pConsoleInput, g_nConsoleDisplayWidth ); g_nConsoleInputChars = 0; return true; } @@ -239,6 +304,23 @@ bool ConsoleInputChar( TCHAR ch ) return false; } +//=========================================================================== +void ConsoleUpdateCursor( char ch ) +{ + if (ch) + g_sConsoleCursor[0] = ch; + else + { + ch = g_aConsoleInput[ g_nConsoleInputChars + g_nConsolePromptLen ]; + if (! ch) + { + ch = CHAR_SPACE; + } + g_sConsoleCursor[0] = ch; + } +} + + //=========================================================================== LPCSTR ConsoleInputPeek() { @@ -252,12 +334,16 @@ void ConsoleInputReset () // Even if we add console scrolling, we don't need any special logic to draw the input line. g_bConsoleInputQuoted = false; - ZeroMemory( g_aConsoleInput, CONSOLE_WIDTH ); - _tcscpy( g_aConsoleInput, g_sConsolePrompt ); // Assembler can change prompt - _tcscat( g_aConsoleInput, TEXT(" " ) ); + ConsoleInputClear(); + +// _tcscpy( g_aConsoleInput, g_sConsolePrompt ); // Assembler can change prompt + g_aConsoleInput[0] = g_sConsolePrompt[0]; + g_nConsolePromptLen = 1; + +// _tcscat( g_aConsoleInput, TEXT(" " ) ); int nLen = _tcslen( g_aConsoleInput ); - g_pConsoleInput = &g_aConsoleInput[nLen]; + g_pConsoleInput = &g_aConsoleInput[ g_nConsolePromptLen ]; // nLen]; g_nConsoleInputChars = 0; } @@ -312,7 +398,7 @@ Update_t ConsoleScrollDn ( int nLines ) //=========================================================================== Update_t ConsoleScrollPageUp () { - ConsoleScrollUp( g_nConsoleDisplayHeight - CONSOLE_FIRST_LINE ); + ConsoleScrollUp( g_nConsoleDisplayLines - CONSOLE_FIRST_LINE ); return UPDATE_CONSOLE_DISPLAY; } @@ -320,13 +406,13 @@ Update_t ConsoleScrollPageUp () //=========================================================================== Update_t ConsoleScrollPageDn() { - ConsoleScrollDn( g_nConsoleDisplayHeight - CONSOLE_FIRST_LINE ); + ConsoleScrollDn( g_nConsoleDisplayLines - CONSOLE_FIRST_LINE ); return UPDATE_CONSOLE_DISPLAY; } //=========================================================================== -void ConsoleBufferTryUnpause (int nLines) +Update_t ConsoleBufferTryUnpause (int nLines) { for( int y = 0; y < nLines; y++ ) { @@ -338,7 +424,10 @@ void ConsoleBufferTryUnpause (int nLines) { g_bConsoleBufferPaused = true; ConsoleDisplayPause(); + return UPDATE_CONSOLE_INPUT | UPDATE_CONSOLE_DISPLAY; } + + return UPDATE_CONSOLE_DISPLAY; } //=========================================================================== @@ -346,8 +435,8 @@ Update_t ConsoleUpdate() { if (! g_bConsoleBufferPaused) { - int nLines = MIN( g_nConsoleBuffer, g_nConsoleDisplayHeight - 1); - ConsoleBufferTryUnpause( nLines ); + int nLines = MIN( g_nConsoleBuffer, g_nConsoleDisplayLines - 1); + return ConsoleBufferTryUnpause( nLines ); } return UPDATE_CONSOLE_DISPLAY; diff --git a/source/Debugger_Console.h b/source/Debugger_Console.h index c727a771..4d961a47 100644 --- a/source/Debugger_Console.h +++ b/source/Debugger_Console.h @@ -8,31 +8,44 @@ CONSOLE_HEIGHT = 384, // Lines, was 128, but need ~ 256+16 for PROFILE LIST CONSOLE_WIDTH = 80, + CONSOLE_BUFFER_HEIGHT = 128, + + HISTORY_HEIGHT = 128, + HISTORY_WIDTH = 128, + CONSOLE_FIRST_LINE = 1, // where ConsoleDisplay is pushed up from }; // Globals __________________________________________________________________ + typedef TCHAR conchar_t; + // Buffer extern bool g_bConsoleBufferPaused;// = false; // buffered output is waiting for user to continue extern int g_nConsoleBuffer; //= 0; - extern TCHAR g_aConsoleBuffer[ CONSOLE_HEIGHT ][ CONSOLE_WIDTH ]; // TODO: stl::vector< line_t > + extern TCHAR g_aConsoleBuffer[ CONSOLE_BUFFER_HEIGHT ][ CONSOLE_WIDTH*2 ]; // TODO: stl::vector< line_t > + + // Cursor + extern char g_sConsoleCursor[]; // Display extern TCHAR g_aConsolePrompt[];// = TEXT(">!"); // input, assembler // NUM_PROMPTS extern TCHAR g_sConsolePrompt[];// = TEXT(">"); // No, NOT Integer Basic! The nostalgic '*' "Monitor" doesn't look as good, IMHO. :-( + + extern int g_nConsolePromptLen; + extern bool g_bConsoleFullWidth;// = false; - extern int g_iConsoleDisplayStart ;// = 0; // to allow scrolling - extern int g_nConsoleDisplayTotal ;//= 0; // number of lines added to console - extern int g_nConsoleDisplayHeight ;//= 0; - extern int g_nConsoleDisplayWidth ;//= 0; - extern TCHAR g_aConsoleDisplay[ CONSOLE_HEIGHT ][ CONSOLE_WIDTH ]; + extern int g_iConsoleDisplayStart ; // to allow scrolling + extern int g_nConsoleDisplayTotal ; // number of lines added to console + extern int g_nConsoleDisplayLines ; + extern int g_nConsoleDisplayWidth ; + extern TCHAR g_aConsoleDisplay[ CONSOLE_HEIGHT ][ CONSOLE_WIDTH*2 ]; // Input History extern int g_nHistoryLinesStart;// = 0; extern int g_nHistoryLinesTotal;// = 0; // number of commands entered - extern TCHAR g_aHistoryLines[ CONSOLE_HEIGHT ][ CONSOLE_WIDTH ];// = {TEXT("")}; + extern TCHAR g_aHistoryLines[ HISTORY_HEIGHT ][ HISTORY_WIDTH ];// = {TEXT("")}; // Input Line // Raw input Line (has prompt) @@ -43,7 +56,7 @@ extern TCHAR * g_pConsoleInput ;//= 0; // points to past prompt extern const TCHAR * g_pConsoleFirstArg ;//= 0; // points to first arg extern bool g_bConsoleInputQuoted ;//= false; // Allows lower-case to be entered - extern bool g_bConsoleInputSkip ;//= false; + extern char g_nConsoleInputSkip ;//= false; // Prototypes _______________________________________________________________ @@ -51,6 +64,7 @@ // Console // Buffered + bool ConsolePrint( const char * pText ); void ConsoleBufferToDisplay (); LPCSTR ConsoleBufferPeek (); void ConsoleBufferPop (); @@ -71,7 +85,9 @@ void ConsoleInputReset (); int ConsoleInputTabCompletion (); - void ConsoleBufferTryUnpause (int nLines); + void ConsoleUpdateCursor( char ch ); + + Update_t ConsoleBufferTryUnpause (int nLines); // Scrolling Update_t ConsoleScrollHome (); diff --git a/source/Debugger_Display.cpp b/source/Debugger_Display.cpp index b579c91a..31252661 100644 --- a/source/Debugger_Display.cpp +++ b/source/Debugger_Display.cpp @@ -33,9 +33,21 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include // NEW UI debugging -#define DEBUG_FORCE_DISPLAY 0 -#define DEBUG_FONT_NO_BACKGROUND_CHAR 0 -#define DEBUG_FONT_NO_BACKGROUND_TEXT 1 +#define DEBUG_FORCE_DISPLAY 0 + +#if _DEBUG + #define DEBUG_FONT_NO_BACKGROUND_CHAR 0 + #define DEBUG_FONT_NO_BACKGROUND_TEXT 0 + #define DEBUG_FONT_NO_BACKGROUND_FILL_CON 0 + #define DEBUG_FONT_NO_BACKGROUND_FILL_INFO 0 + #define DEBUG_FONT_NO_BACKGROUND_FILL_MAIN 0 + + // no top console line + #define DEBUG_BACKGROUND 0 +#endif + +//#define WATCH_ZERO_BG BG_DATA_1 +#define WATCH_ZERO_BG BG_INFO #define DISPLAY_MEMORY_TITLE 1 // #define DISPLAY_BREAKPOINT_TITLE 1 @@ -43,15 +55,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Public _________________________________________________________________________________________ - const int DISPLAY_HEIGHT = 384; // 368; // DISPLAY_LINES * g_nFontHeight; - // Font FontConfig_t g_aFontConfig[ NUM_FONTS ]; // Private ________________________________________________________________________________________ // Display - Win32 - HDC g_hDstDC = NULL; // App Window +// HDC g_hDstDC = NULL; // App Window HDC g_hConsoleFontDC = NULL; HBRUSH g_hConsoleFontBrush = NULL; @@ -72,8 +82,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA RGB( 255, 255, 255 ), // 7 111 W }; - char * g_asConsoleColor[ MAX_CONSOLE_COLORS ] = + const char * g_asConsoleColor[ MAX_CONSOLE_COLORS ] = { +#if USE_APPLE_FONT "`0", // ConsoleColorMake( sColorW, CONSOLE_COLOR_W ); "`1", "`2", @@ -82,6 +93,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA "`5", "`6", "`7" +#else + "", // K + "", // R + "", // G + "", // Y + "", // B + "", // M + "", // C + "" // W +#endif }; // Disassembly @@ -108,36 +129,65 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \x18 Up \x19 Down */ - char * g_sConfigBranchIndicatorUp [ NUM_DISASM_BRANCH_TYPES+1 ] = { " ", "^", "`K", "\x35" }; - char * g_sConfigBranchIndicatorEqual[ NUM_DISASM_BRANCH_TYPES+1 ] = { " ", "=", "`H", "\x33" }; - char * g_sConfigBranchIndicatorDown [ NUM_DISASM_BRANCH_TYPES+1 ] = { " ", "v", "`J", "\x36" }; +#if USE_APPLE_FONT + char * g_sConfigBranchIndicatorUp [ NUM_DISASM_BRANCH_TYPES+1 ] = { " ", "^", "`K" }; + char * g_sConfigBranchIndicatorEqual[ NUM_DISASM_BRANCH_TYPES+1 ] = { " ", "=", "`H" }; + char * g_sConfigBranchIndicatorDown [ NUM_DISASM_BRANCH_TYPES+1 ] = { " ", "v", "`J" }; +#else + char * g_sConfigBranchIndicatorUp [ NUM_DISASM_BRANCH_TYPES+1 ] = { " ", "^", "\x35" }; + char * g_sConfigBranchIndicatorEqual[ NUM_DISASM_BRANCH_TYPES+1 ] = { " ", "=", "\x33" }; + char * g_sConfigBranchIndicatorDown [ NUM_DISASM_BRANCH_TYPES+1 ] = { " ", "v", "\x36" }; +#endif // Drawing // Width const int DISPLAY_WIDTH = 560; - #define SCREENSPLIT1 356 // Horizontal Column (pixels?) of Stack & Regs +// #define SCREENSPLIT1 356 // Horizontal Column (pixels?) of Stack & Regs + // New Font = 50.5 char * 7 px/char = 353.5 + #define SCREENSPLIT1 354 + // #define SCREENSPLIT2 456 // Horizontal Column (pixels?) of BPs, Watches & Mem // const int SCREENSPLIT2 = 456-7; // moved left one "char" to show PC in breakpoint: - const int SCREENSPLIT2 = SCREENSPLIT1 + (12 * 7); // moved left 3 chars to show B. prefix in breakpoint #, W. prefix in watch # +// const int SCREENSPLIT2 = SCREENSPLIT1 + (12 * 7); // moved left 3 chars to show B. prefix in breakpoint #, W. prefix in watch # - const int DISPLAY_BP_COLUMN = SCREENSPLIT2; - const int DISPLAY_MINI_CONSOLE = SCREENSPLIT1 - 6; // - 1 chars - const int DISPLAY_DISASM_RIGHT = SCREENSPLIT1 - 6; // - 1 char - const int DISPLAY_FLAG_COLUMN = SCREENSPLIT1 + 63; - const int DISPLAY_MINIMEM_COLUMN = SCREENSPLIT2 + 7; +// const int DISPLAY_MINI_CONSOLE_WIDTH = SCREENSPLIT1 - 6; // 50 chars + +// const int DISPLAY_DISASM_RIGHT = SCREENSPLIT1 - 6; // - 1 char + const int DISPLAY_DISASM_RIGHT = SCREENSPLIT1 - 1; // new + +#if USE_APPLE_FONT + const int INFO_COL_1 = (51 * 7); // nFontWidth + const int DISPLAY_REGS_COLUMN = INFO_COL_1; + const int DISPLAY_FLAG_COLUMN = INFO_COL_1; + const int DISPLAY_STACK_COLUMN = INFO_COL_1; + const int DISPLAY_TARGETS_COLUMN = INFO_COL_1; + const int DISPLAY_ZEROPAGE_COLUMN= INFO_COL_1; + + const int INFO_COL_2 = (62 * 7); // nFontWidth + const int DISPLAY_BP_COLUMN = INFO_COL_2; + const int DISPLAY_WATCHES_COLUMN = INFO_COL_2; + const int DISPLAY_MINIMEM_COLUMN = INFO_COL_2; +#else const int DISPLAY_REGS_COLUMN = SCREENSPLIT1; + const int DISPLAY_FLAG_COLUMN = SCREENSPLIT1; // + 63; const int DISPLAY_STACK_COLUMN = SCREENSPLIT1; const int DISPLAY_TARGETS_COLUMN = SCREENSPLIT1; - const int DISPLAY_WATCHES_COLUMN = SCREENSPLIT2; const int DISPLAY_ZEROPAGE_COLUMN= SCREENSPLIT1; - int MAX_DISPLAY_REGS_LINES = 6; + const int SCREENSPLIT2 = SCREENSPLIT1 + (12 * 7); // moved left 3 chars to show B. prefix in breakpoint #, W. prefix in watch # + const int DISPLAY_BP_COLUMN = SCREENSPLIT2; + const int DISPLAY_WATCHES_COLUMN = SCREENSPLIT2; + const int DISPLAY_MINIMEM_COLUMN = SCREENSPLIT2; // nFontWidth +#endif + + int MAX_DISPLAY_REGS_LINES = 7; int MAX_DISPLAY_STACK_LINES = 8; - int MAX_DISPLAY_BREAKPOINTS_LINES = 7; // 6 // 5 - int MAX_DISPLAY_WATCHES_LINES = 8; // 6 // 5 + int MAX_DISPLAY_ZEROPAGE_LINES = 8; + +// int MAX_DISPLAY_BREAKPOINTS_LINES = 7; // 7 +// int MAX_DISPLAY_WATCHES_LINES = 8; // 8 int MAX_DISPLAY_MEMORY_LINES_1 = 4; // 4 int MAX_DISPLAY_MEMORY_LINES_2 = 4; // 4 // 2 - int MAX_DISPLAY_ZEROPAGE_LINES = 8; int g_nDisplayMemoryLines; // Height @@ -147,14 +197,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 384 = 16 * 24 very bottom const int DEFAULT_HEIGHT = 16; - static HDC g_hDC = 0; +// static HDC g_hDC = 0; -static void SetupColorsHiLoBits ( HDC dc, bool bHiBit, bool bLoBit, +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( HDC hDC, TCHAR * sText, BYTE nData, const MemoryView_e iView, +static char ColorizeSpecialChar( TCHAR * 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 ); @@ -212,6 +262,7 @@ enum WinROP4_e R2_WHITE 1 1 1 1 15 1 */ +#if DEBUG_FONT_ROP const DWORD aROP4[ 256 ] = { 0x00000042, // BLACKNESS @@ -471,6 +522,7 @@ const DWORD aROP4[ 256 ] = 0x00FE02A9, // DPSoo 0x00FF0062 // _WHITE // FF WHITENESS }; +#endif // PATPAINT // MERGECOPY @@ -487,32 +539,28 @@ const DWORD aROP4[ 256 ] = //=========================================================================== void DebuggerSetColorFG( COLORREF nRGB ) { +#if USE_APPLE_FONT if (g_hConsoleBrushFG) { - SelectObject( g_hDstDC, GetStockObject(NULL_BRUSH) ); +// SelectObject( g_hDstDC, GetStockObject(NULL_BRUSH) ); + SelectObject( g_hFrameDC, GetStockObject(NULL_BRUSH) ); DeleteObject( g_hConsoleBrushFG ); g_hConsoleBrushFG = NULL; } g_hConsoleBrushFG = CreateSolidBrush( nRGB ); -} - -void DebuggerSetColorFG( HDC hDC, COLORREF nRGB ) -{ -#if USE_APPLE_FONT - DebuggerSetColorFG( nRGB ); -// SelectObject( hDC, g_hBrushFG ); #else - SetTextColor( hDC, nRGB ); + SetTextColor( g_hFrameDC, nRGB ); #endif } //=================================================== void DebuggerSetColorBG( COLORREF nRGB, bool bTransparent ) { +#if USE_APPLE_FONT if (g_hConsoleBrushBG) { - SelectObject( g_hDstDC, GetStockObject(NULL_BRUSH) ); + SelectObject( g_hFrameDC, GetStockObject(NULL_BRUSH) ); DeleteObject( g_hConsoleBrushBG ); g_hConsoleBrushBG = NULL; } @@ -521,15 +569,8 @@ void DebuggerSetColorBG( COLORREF nRGB, bool bTransparent ) { g_hConsoleBrushBG = CreateSolidBrush( nRGB ); } -} - -void DebuggerSetColorBG( HDC hDC, COLORREF nRGB ) -{ -#if USE_APPLE_FONT - DebuggerSetColorBG( nRGB ); -// SelectObject( hDC, g_hBrushBG ); #else - SetBkColor( hDC, nRGB ); + SetBkColor( g_hFrameDC, nRGB ); #endif } @@ -537,6 +578,14 @@ void DebuggerSetColorBG( HDC hDC, COLORREF nRGB ) //=========================================================================== void DebuggerPrintChar( const int x, const int y, const int glyph ) { +#if _DEBUG +// if ((x >= 357) && (x <= 360)) +// if (y >= 328) && (y < 336) + { + bool bStop = true; + } +#endif + HDC g_hDstDC = FrameGetDC(); int xDst = x; @@ -554,7 +603,7 @@ void DebuggerPrintChar( const int x, const int y, const int glyph ) // Draw Background (solid pattern) BitBlt( - g_hDstDC, // hdcDest + g_hFrameDC, // hdcDest xDst, yDst, // nXDest, nYDest CONSOLE_FONT_WIDTH, CONSOLE_FONT_HEIGHT, // nWidth, nHeight g_hConsoleFontDC, // hdcSrc @@ -580,7 +629,7 @@ void DebuggerPrintChar( const int x, const int y, const int glyph ) #if DEBUG_FONT_ROP SelectObject( g_hDstDC, g_hConsoleBrushFG ); BitBlt( - g_hDstDC, + g_hFrameDC, xDst, yDst, DEBUG_FONT_WIDTH, DEBUG_FONT_HEIGHT, g_hDebugFontDC, @@ -591,7 +640,7 @@ void DebuggerPrintChar( const int x, const int y, const int glyph ) // Use inverted source as mask (AND) // D & ~S -> DSna BitBlt( - g_hDstDC, + g_hFrameDC, xDst, yDst, CONSOLE_FONT_WIDTH, CONSOLE_FONT_HEIGHT, g_hConsoleFontDC, @@ -604,7 +653,7 @@ void DebuggerPrintChar( const int x, const int y, const int glyph ) // Use Source ask mask to make color Pattern mask (AND), then apply to dest (OR) // D | (P & S) -> DPSao BitBlt( - g_hDstDC, + g_hFrameDC, xDst, yDst, CONSOLE_FONT_WIDTH, CONSOLE_FONT_HEIGHT, g_hConsoleFontDC, @@ -613,8 +662,8 @@ void DebuggerPrintChar( const int x, const int y, const int glyph ) ); #endif - SelectObject( g_hDstDC, GetStockObject(NULL_BRUSH) ); - FrameReleaseDC(); + SelectObject( g_hFrameDC, GetStockObject(NULL_BRUSH) ); +// FrameReleaseDC(); } @@ -625,7 +674,7 @@ void DebuggerPrint ( int x, int y, char *pText ) if (pText) { - HDC g_hDstDC = FrameGetDC(); +// HDC g_hDstDC = FrameGetDC(); unsigned char c; char *p = pText; @@ -644,16 +693,19 @@ void DebuggerPrint ( int x, int y, char *pText ) } if (ConsoleColorIsEscapeMeta( c )) { - p++; - c = *p; - if (ConsoleColorIsEscapeData( c )) + if (ConsoleColorIsEscapeData( p[1] )) { - DebuggerSetColorFG( ConsoleColorGetEscapeData( c ) ); - p++; + DebuggerSetColorFG( ConsoleColorGetEscapeData( p[1] ) ); + p += 2; continue; // c = 0; } -// if ((p[1]) >= '8') && (p[1] <= '9') -// ; + else + { + p++; + c = *p; + if (ConsoleColorIsEscapeMeta( c )) + c += 0x80; + } } else if ((c >= 0x20) && (c <= 0x7F)) @@ -670,11 +722,11 @@ void DebuggerPrint ( int x, int y, char *pText ) if (g_hConsoleBrushBG) { - SelectObject( g_hDstDC, g_hConsoleBrushBG ); + SelectObject( g_hFrameDC, g_hConsoleBrushBG ); // Draw Background (solid pattern) BitBlt( - g_hDstDC, // + g_hFrameDC, // x, y, CONSOLE_FONT_WIDTH, CONSOLE_FONT_HEIGHT, g_hConsoleFontDC, @@ -684,7 +736,7 @@ void DebuggerPrint ( int x, int y, char *pText ) } BitBlt( - g_hDstDC, + g_hFrameDC, x, y, CONSOLE_FONT_WIDTH, CONSOLE_FONT_HEIGHT, g_hConsoleFontDC, @@ -692,10 +744,10 @@ void DebuggerPrint ( int x, int y, char *pText ) DSna ); - SelectObject( g_hDstDC, g_hConsoleBrushFG ); + SelectObject( g_hFrameDC, g_hConsoleBrushFG ); BitBlt( - g_hDstDC, + g_hFrameDC, x, y, CONSOLE_FONT_WIDTH, CONSOLE_FONT_HEIGHT, g_hConsoleFontDC, @@ -708,8 +760,8 @@ void DebuggerPrint ( int x, int y, char *pText ) p++; } - SelectObject( g_hDstDC, GetStockObject(NULL_BRUSH) ); - FrameReleaseDC(); + SelectObject( g_hFrameDC, GetStockObject(NULL_BRUSH) ); +// FrameReleaseDC(); } } @@ -743,14 +795,18 @@ int DebugDrawText ( LPCTSTR pText, RECT & rRect ) #if USE_APPLE_FONT // SelectObject( g_hDC, g_hBrushBG ); + // Fast draw of background + // i.e. + // >consonleinput + // ESC + // > #if !DEBUG_FONT_NO_BACKGROUND_TEXT - FillRect( g_hDC, &rRect, g_hBrushBG ); + FillRect( g_hFrameDC, &rRect, g_hConsoleBrushBG ); #endif DebuggerPrint( rRect.left, rRect.top, (char*)pText ); -// rRect.left += (DEBUG_FONT_CELL_WIDTH * nLen) #else - ExtTextOut( g_hDC, + ExtTextOut( g_hFrameDC, rRect.left, rRect.top, ETO_CLIPPED | ETO_OPAQUE, &rRect, pText, nLen, @@ -795,7 +851,7 @@ int DebugDrawTextHorz ( LPCTSTR pText, RECT & rRect ) int nChars = DebugDrawText( pText, rRect ); #if !USE_APPLE_FONT SIZE size; - if (GetTextExtentPoint32( g_hDC, pText, nChars, &size )) + if (GetTextExtentPoint32( g_hFrameDC, pText, nChars, &size )) { rRect.left += size.cx; } @@ -1013,7 +1069,14 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB bDisasmFormatFlags |= DISASM_FORMAT_CHAR; nImmediate_ = (BYTE) nTargetValue; - wsprintf( sImmediate_, "%c", FormatCharTxtCtrl( FormatCharTxtHigh( nImmediate_, NULL ), NULL ) ); + + unsigned _char = FormatCharTxtCtrl( FormatCharTxtHigh( nImmediate_, NULL ), NULL ); + +// if (ConsoleColorIsEscapeMeta( nImmediate_ )) + if (ConsoleColorIsEscapeMeta( _char )) + sprintf( sImmediate_, "%c%c", _char, _char ); + else + wsprintf( sImmediate_, "%c", _char ); } // if (iOpmode == AM_NA ) // Indirect Absolute @@ -1033,7 +1096,13 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB { bDisasmFormatFlags |= DISASM_FORMAT_CHAR; nImmediate_ = (BYTE) nTarget; - wsprintf( sImmediate_, "%c", FormatCharTxtCtrl( FormatCharTxtHigh( nImmediate_, NULL ), NULL ) ); + unsigned _char = FormatCharTxtCtrl( FormatCharTxtHigh( nImmediate_, NULL ), NULL ); + +// wsprintf( sImmediate_, "%c", _char ); + if (ConsoleColorIsEscapeMeta( _char )) + sprintf( sImmediate_, "%c%c", _char, _char ); + else + wsprintf( sImmediate_, "%c", _char ); } } } @@ -1064,7 +1133,7 @@ int FormatDisassemblyLine( WORD nBaseAddress, int iOpcode, int iOpmode, int nOpB //=========================================================================== -void SetupColorsHiLoBits ( HDC hDC, bool bHighBit, bool bCtrlBit, +void SetupColorsHiLoBits ( bool bHighBit, bool bCtrlBit, const int iBackground, const int iForeground, const int iColorHiBG , const int iColorHiFG, const int iColorLoBG , const int iColorLoFG ) @@ -1076,26 +1145,26 @@ void SetupColorsHiLoBits ( HDC hDC, bool bHighBit, bool bCtrlBit, // 1 0 HiBG normal BG_INFO_CHAR FG_DISASM_CHAR (mid cyan bright cyan) // 1 1 HiBG LoFG BG_INFO_CHAR FG_DISASM_OPCODE (mid cyan yellow) - DebuggerSetColorBG( hDC, DebuggerGetColor( iBackground )); - DebuggerSetColorFG( hDC, DebuggerGetColor( iForeground )); + DebuggerSetColorBG( DebuggerGetColor( iBackground )); + DebuggerSetColorFG( DebuggerGetColor( iForeground )); if (bHighBit) { - DebuggerSetColorBG( hDC, DebuggerGetColor( iColorHiBG )); - DebuggerSetColorFG( hDC, DebuggerGetColor( iColorHiFG )); // was iForeground + DebuggerSetColorBG( DebuggerGetColor( iColorHiBG )); + DebuggerSetColorFG( DebuggerGetColor( iColorHiFG )); // was iForeground } if (bCtrlBit) { - DebuggerSetColorBG( hDC, DebuggerGetColor( iColorLoBG )); - DebuggerSetColorFG( hDC, DebuggerGetColor( iColorLoFG )); + DebuggerSetColorBG( DebuggerGetColor( iColorLoBG )); + DebuggerSetColorFG( DebuggerGetColor( iColorLoFG )); } } // To flush out color bugs... swap: iAsciBackground & iHighBackground //=========================================================================== -char ColorizeSpecialChar( HDC hDC, TCHAR * sText, BYTE nData, const MemoryView_e iView, +char ColorizeSpecialChar( TCHAR * 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*/ ) @@ -1140,12 +1209,20 @@ char ColorizeSpecialChar( HDC hDC, TCHAR * sText, BYTE nData, const MemoryView_e default: break; } - if (sText) - wsprintf( sText, TEXT("%c"), nChar ); +// if (sText) +// sprintf( sText, "%c", nChar ); - if (hDC) + if (sText) + { + if (ConsoleColorIsEscapeMeta( nChar )) + sprintf( sText, "%c%c", nChar, nChar ); + else + sprintf( sText, "%c", nChar ); + } + +// if (hDC) { - SetupColorsHiLoBits( hDC, bHighBit, bCtrlBit + SetupColorsHiLoBits( bHighBit, bCtrlBit , iTextBG, iTextFG // FG_DISASM_CHAR , iHighBG, iHighFG // BG_INFO_CHAR , iCtrlBG, iCtrlFG // FG_DISASM_OPCODE @@ -1159,7 +1236,7 @@ char ColorizeSpecialChar( HDC hDC, TCHAR * sText, BYTE nData, const MemoryView_e //=========================================================================== -void DrawBreakpoints (HDC dc, int line) +void DrawBreakpoints ( int line ) { if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA)))) return; @@ -1174,8 +1251,8 @@ void DrawBreakpoints (HDC dc, int line) TCHAR sText[16] = TEXT("Breakpoints"); // TODO: Move to BP1 #if DISPLAY_BREAKPOINT_TITLE - DebuggerSetColorBG(dc, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC DebugDrawText( sText, rect ); rect.top += g_nFontHeight; rect.bottom += g_nFontHeight; @@ -1200,45 +1277,46 @@ void DrawBreakpoints (HDC dc, int line) WORD nAddress2 = nAddress1 + nLength - 1; #if DEBUG_FORCE_DISPLAY - if (iBreakpoint < MAX_DISPLAY_BREAKPOINTS_LINES) +// if (iBreakpoint < MAX_DISPLAY_BREAKPOINTS_LINES) bSet = true; #endif if (! bSet) continue; nBreakpointsDisplayed++; - if (nBreakpointsDisplayed > MAX_DISPLAY_BREAKPOINTS_LINES) - break; + +// if (nBreakpointsDisplayed > MAX_DISPLAY_BREAKPOINTS_LINES) +// break; RECT rect2; rect2 = rect; - DebuggerSetColorBG( dc, DebuggerGetColor( BG_INFO )); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_TITLE ) ); - wsprintf( sText, TEXT("B.") ); + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) ); + wsprintf( sText, "B" ); DebugDrawTextFixed( sText, rect2 ); - DebuggerSetColorBG( dc, DebuggerGetColor( BG_INFO )); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_BULLET ) ); - wsprintf( sText, TEXT("%d"), iBreakpoint+1 ); + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET ) ); + wsprintf( sText, "%X ", iBreakpoint ); DebugDrawTextFixed( sText, rect2 ); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_OPERATOR ) ); - _tcscpy( sText, TEXT(":") ); - DebugDrawTextFixed( sText, rect2 ); +// DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ) ); +// _tcscpy( sText, TEXT(".") ); +// DebugDrawTextFixed( sText, rect2 ); #if DEBUG_FORCE_DISPLAY pBP->eSource = (BreakpointSource_t) iBreakpoint; #endif - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_REG ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_REG ) ); int nRegLen = DebugDrawTextFixed( g_aBreakpointSource[ pBP->eSource ], rect2 ); // Pad to 2 chars if (nRegLen < 2) rect2.left += g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; - DebuggerSetColorBG( dc, DebuggerGetColor( BG_INFO )); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_BULLET ) ); + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET ) ); #if DEBUG_FORCE_DISPLAY if (iBreakpoint < 3) pBP->eOperator = (BreakpointOperator_t)(iBreakpoint * 2); @@ -1268,20 +1346,20 @@ void DrawBreakpoints (HDC dc, int line) iForeground = FG_INFO_TITLE; } - DebuggerSetColorBG( dc, DebuggerGetColor( iBackground ) ); - DebuggerSetColorFG( dc, DebuggerGetColor( iForeground ) ); + DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); + DebuggerSetColorFG( DebuggerGetColor( iForeground ) ); #if DEBUG_FORCE_DISPLAY extern COLORREF gaColorPalette[ NUM_PALETTE ]; - int iColor = R8 + (iBreakpoint*2); + int iColor = R8 + iBreakpoint; COLORREF nColor = gaColorPalette[ iColor ]; - if (iBreakpoint >= 4) + if (iBreakpoint >= 8) { - DebuggerSetColorBG ( dc, DebuggerGetColor( BG_DISASM_BP_S_C ) ); + DebuggerSetColorBG( DebuggerGetColor( BG_DISASM_BP_S_C ) ); nColor = DebuggerGetColor( FG_DISASM_BP_S_C ); } - DebuggerSetColorFG( dc, nColor ); + DebuggerSetColorFG( nColor ); #endif wsprintf( sText, TEXT("%04X"), nAddress1 ); @@ -1289,8 +1367,8 @@ void DrawBreakpoints (HDC dc, int line) if (nLength > 1) { - DebuggerSetColorBG( dc, DebuggerGetColor( BG_INFO ) ); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_OPERATOR ) ); + DebuggerSetColorBG( DebuggerGetColor( BG_INFO ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR ) ); // if (g_bConfigDisasmOpcodeSpaces) // { @@ -1298,25 +1376,24 @@ void DrawBreakpoints (HDC dc, int line) // rect2.left += g_nFontWidthAvg; // } - DebugDrawTextFixed( TEXT(":"), rect2 ); + DebugDrawTextFixed( ":", rect2 ); // rect2.left += g_nFontWidthAvg; // if (g_bConfigDisasmOpcodeSpaces) // TODO: Might have to remove spaces, for BPIO... addr-addr xx // { // rect2.left += g_nFontWidthAvg; // } - DebuggerSetColorBG( dc, DebuggerGetColor( iBackground ) ); - DebuggerSetColorFG( dc, DebuggerGetColor( iForeground ) ); + DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); + DebuggerSetColorFG( DebuggerGetColor( iForeground ) ); #if DEBUG_FORCE_DISPLAY - iColor++; COLORREF nColor = gaColorPalette[ iColor ]; - if (iBreakpoint >= 4) + if (iBreakpoint >= 8) { nColor = DebuggerGetColor( BG_INFO ); - DebuggerSetColorBG( dc, nColor ); + DebuggerSetColorBG( nColor ); nColor = DebuggerGetColor( FG_DISASM_BP_S_X ); } - DebuggerSetColorFG( dc, nColor ); + DebuggerSetColorFG( nColor ); #endif wsprintf( sText, TEXT("%04X"), nAddress2 ); DebugDrawTextFixed( sText, rect2 ); @@ -1324,8 +1401,8 @@ void DrawBreakpoints (HDC dc, int line) #if !USE_APPLE_FONT // Windows HACK: Bugfix: Rest of line is still breakpoint background color - DebuggerSetColorBG(dc, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); //COLOR_STATIC DebugDrawTextHorz( TEXT(" "), rect2 ); #endif rect.top += g_nFontHeight; @@ -1336,23 +1413,22 @@ void DrawBreakpoints (HDC dc, int line) //=========================================================================== -void DrawConsoleInput( HDC dc ) +void DrawConsoleInput() // HDC dc ) { - g_hDC = dc; +// g_hDC = dc; - DebuggerSetColorFG( g_hDC, DebuggerGetColor( FG_CONSOLE_INPUT )); - DebuggerSetColorBG( g_hDC, DebuggerGetColor( BG_CONSOLE_INPUT )); + DebuggerSetColorFG( DebuggerGetColor( FG_CONSOLE_INPUT )); + DebuggerSetColorBG( DebuggerGetColor( BG_CONSOLE_INPUT )); DrawConsoleLine( g_aConsoleInput, 0 ); } - //=========================================================================== int GetConsoleLineHeightPixels() { int nHeight = nHeight = g_aFontConfig[ FONT_CONSOLE ]._nFontHeight; // _nLineHeight; // _nFontHeight; - +/* if (g_iFontSpacing == FONT_SPACING_CLASSIC) { nHeight++; // "Classic" Height/Spacing @@ -1367,11 +1443,10 @@ int GetConsoleLineHeightPixels() { // default case handled } - +*/ return nHeight; } - //=========================================================================== int GetConsoleTopPixels( int y ) { @@ -1384,6 +1459,11 @@ int GetConsoleTopPixels( int y ) //=========================================================================== void DrawConsoleLine( LPCSTR pText, int y ) { +#if DEBUG_BACKGROUND +if (y >= 3) +return; +#endif + if (y < 0) return; @@ -1400,18 +1480,48 @@ void DrawConsoleLine( LPCSTR pText, int y ) // Default: (356-14) = 342 pixels ~= 48 chars (7 pixel width) // rect.right = SCREENSPLIT1-14; // rect.right = (g_nConsoleDisplayWidth * g_nFontWidthAvg) + (g_nFontWidthAvg - 1); + int nFontWidth = g_aFontConfig[ FONT_CONSOLE ]._nFontWidthAvg; - int nMiniConsoleRight = DISPLAY_MINI_CONSOLE; // (g_nConsoleDisplayWidth * g_nFontWidthAvg) + (g_nFontWidthAvg * 2); // +14 + int nMiniConsoleRight = g_nConsoleDisplayWidth * nFontWidth; int nFullConsoleRight = DISPLAY_WIDTH; int nRight = g_bConsoleFullWidth ? nFullConsoleRight : nMiniConsoleRight; rect.right = nRight; +#if USE_APPLE_FONT + if (y == 0) + FillRect( g_hFrameDC, &rect, g_hConsoleBrushBG ); +#endif + DebugDrawText( pText, rect ); } //=========================================================================== -WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) +void DrawConsoleCursor() // HDC dc ) +{ +// g_hDC = dc; + + DebuggerSetColorFG( DebuggerGetColor( FG_CONSOLE_INPUT )); + DebuggerSetColorBG( DebuggerGetColor( BG_CONSOLE_INPUT )); + + int nWidth = g_aFontConfig[ FONT_CONSOLE ]._nFontWidthAvg; + + int nLineHeight = GetConsoleLineHeightPixels(); + int y = 0; + + RECT rect; + rect.left = (g_nConsoleInputChars + g_nConsolePromptLen) * nWidth; + rect.top = GetConsoleTopPixels( y ); + rect.bottom = rect.top + nLineHeight; //g_nFontHeight; +// int nRight = g_bConsoleFullWidth ? nFullConsoleRight : nMiniConsoleRight; + rect.right = rect.left + nWidth; + + DebugDrawText( g_sConsoleCursor, rect ); +} + + +//=========================================================================== +WORD DrawDisassemblyLine ( int iLine, WORD nBaseAddress, LPTSTR text) { if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA)))) return 0; @@ -1424,6 +1534,11 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) int nOpbytes; iOpcode = _6502_GetOpmodeOpbytes( nBaseAddress, iOpmode, nOpbytes ); +#if _DEBUG +// if (iLine != 41) +// return nOpbytes; +#endif + const int CHARS_FOR_ADDRESS = 8; // 4 digits plus null TCHAR sAddress [ CHARS_FOR_ADDRESS ]; @@ -1491,7 +1606,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) // { 5, 14, 20, 40, 46, 49 }; // xxxx:xx xx xx LABELxxxxxx MNEMONIC 'E' = // 0 45 14 26 - { 5, 14, 26, 41, 47, 49 }; + { 5, 14, 26, 41, 48, 49 }; #else { 5.75, 15.5, 25, 40.5, 45.5, 48.5 }; #endif @@ -1512,14 +1627,17 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) const int OPCODE_TO_LABEL_SPACE = static_cast( aTabs[ TS_INSTRUCTION ] - aTabs[ TS_LABEL ] ); int iTab = 0; - int nSpacer = 9; + int nSpacer = 11; // 9 for (iTab = 0; iTab < _NUM_TAB_STOPS; iTab++ ) { if (! g_bConfigDisasmOpcodesView) { - aTabs[ iTab ] -= nSpacer; - if (nSpacer > 0) - nSpacer -= 2; + if (iTab < TS_IMMEDIATE) // TS_BRANCH) + { + aTabs[ iTab ] -= nSpacer; + if (nSpacer > 0) + nSpacer -= 2; + } } aTabs[ iTab ] *= nDefaultFontWidth; @@ -1531,6 +1649,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) const int DISASM_SYMBOL_LEN = 9; #endif + HDC dc = g_hFrameDC; if (dc) { int nFontHeight = g_aFontConfig[ FONT_DISASM_DEFAULT ]._nLineHeight; // _nFontHeight; // g_nFontHeight @@ -1619,18 +1738,18 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) if (bAddressIsBookmark) { - DebuggerSetColorBG( dc, DebuggerGetColor( BG_DISASM_BOOKMARK ) ); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_BOOKMARK ) ); + DebuggerSetColorBG( DebuggerGetColor( BG_DISASM_BOOKMARK ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_BOOKMARK ) ); } else { - DebuggerSetColorBG( dc, DebuggerGetColor( iBackground ) ); - DebuggerSetColorFG( dc, DebuggerGetColor( iForeground ) ); + DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); + DebuggerSetColorFG( DebuggerGetColor( iForeground ) ); } // Address if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_ADDRESS ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS ) ); // else // { // DebuggerSetColorBG( dc, DebuggerGetColor( FG_DISASM_BOOKMARK ) ); // swapped @@ -1640,22 +1759,22 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) if (bAddressIsBookmark) { - DebuggerSetColorBG( dc, DebuggerGetColor( iBackground ) ); - DebuggerSetColorFG( dc, DebuggerGetColor( iForeground ) ); + DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); + DebuggerSetColorFG( DebuggerGetColor( iForeground ) ); } // Address Seperator if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPERATOR ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ) ); if (g_bConfigDisasmAddressColon) - DebugDrawTextHorz( TEXT(":"), linerect ); + DebugDrawTextHorz( ":", linerect ); // Opcodes linerect.left = (int) aTabs[ TS_OPCODE ]; if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPCODE ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPCODE ) ); // DebugDrawTextHorz( TEXT(" "), linerect ); if (g_bConfigDisasmOpcodesView) @@ -1669,7 +1788,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) if (pSymbol) { if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_SYMBOL ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_SYMBOL ) ); DebugDrawTextHorz( pSymbol, linerect ); } // linerect.left += (g_nFontWidthAvg * DISASM_SYMBOL_LEN); @@ -1679,7 +1798,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) linerect.left = (int) aTabs[ TS_INSTRUCTION ]; if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( iForeground ) ); + DebuggerSetColorFG( DebuggerGetColor( iForeground ) ); LPCTSTR pMnemonic = g_aOpcodes[ iOpcode ].sMnemonic; DebugDrawTextHorz( pMnemonic, linerect ); @@ -1690,14 +1809,14 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) if (iOpmode == AM_M) { if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPERATOR )); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); DebugDrawTextHorz( TEXT("#$"), linerect ); } if (bTargetIndirect) { if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPERATOR )); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); DebugDrawTextHorz( TEXT("("), linerect ); } @@ -1706,7 +1825,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) { pTarget++; if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPERATOR )); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); DebugDrawTextHorz( TEXT("$"), linerect ); } @@ -1714,18 +1833,18 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) { if (bDisasmFormatFlags & DISASM_FORMAT_SYMBOL) { - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_SYMBOL ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_SYMBOL ) ); } else { if (iOpmode == AM_M) // if (bDisasmFormatFlags & DISASM_FORMAT_CHAR) { - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPCODE ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPCODE ) ); } else { - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_TARGET ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_TARGET ) ); } } } @@ -1736,7 +1855,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) if (bDisasmFormatFlags & DISASM_FORMAT_OFFSET) { if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPERATOR )); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); if (nTargetOffset > 0) DebugDrawTextHorz( TEXT("+" ), linerect ); @@ -1745,7 +1864,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) if (! bCursorLine) { - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPCODE )); // Technically, not a hex number, but decimal + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPCODE )); // Technically, not a hex number, but decimal } DebugDrawTextHorz( sTargetOffset, linerect ); } @@ -1753,7 +1872,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) if (bTargetIndirect || bTargetX || bTargetY) { if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPERATOR )); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); if (bTargetX) DebugDrawTextHorz( TEXT(",X"), linerect ); @@ -1776,20 +1895,20 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) // DebugDrawTextHorz( TEXT(" "), linerect ); if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_ADDRESS )); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS )); DebugDrawTextHorz( sTargetPointer, linerect ); if (bDisasmFormatFlags & DISASM_FORMAT_TARGET_VALUE) { if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPERATOR )); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); if (g_iConfigDisasmTargets & DISASM_TARGET_BOTH) - DebugDrawTextHorz( TEXT(":"), linerect ); + DebugDrawTextHorz( ":", linerect ); if (! bCursorLine) - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPCODE )); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPCODE )); DebugDrawTextHorz( sTargetValue, linerect ); DebugDrawTextHorz( TEXT(" "), linerect ); @@ -1803,7 +1922,7 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) if (! bCursorLine) { - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPERATOR ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ) ); } // if (! (bDisasmFormatFlags & DISASM_FORMAT_TARGET_POINTER)) @@ -1811,15 +1930,15 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) if (! bCursorLine) { - ColorizeSpecialChar( dc, NULL, nImmediate, MEM_VIEW_ASCII, iBackground ); + ColorizeSpecialChar( NULL, nImmediate, MEM_VIEW_ASCII, iBackground ); // iBackground, FG_INFO_CHAR_HI, FG_DISASM_CHAR, FG_INFO_CHAR_LO ); } DebugDrawTextHorz( sImmediate, linerect ); - DebuggerSetColorBG( dc, DebuggerGetColor( iBackground ) ); // Hack: Colorize can "color bleed to EOL" + DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); // Hack: Colorize can "color bleed to EOL" if (! bCursorLine) { - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_OPERATOR ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ) ); } // if (! (bDisasmFormatFlags & DISASM_FORMAT_TARGET_POINTER)) @@ -1833,16 +1952,20 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) if (! bCursorLine) { - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_BRANCH ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_BRANCH ) ); } +#if !USE_APPLE_FONT if (g_iConfigDisasmBranchType == DISASM_BRANCH_FANCY) - SelectObject( dc, g_aFontConfig[ FONT_DISASM_BRANCH ]._hFont ); // g_hFontWebDings + SelectObject( g_hFrameDC, g_aFontConfig[ FONT_DISASM_BRANCH ]._hFont ); // g_hFontWebDings +#endif DebugDrawText( sBranch, linerect ); +#if !USE_APPLE_FONT if (g_iConfigDisasmBranchType) SelectObject( dc, g_aFontConfig[ FONT_DISASM_DEFAULT ]._hFont ); // g_hFontDisasm +#endif } } @@ -1852,13 +1975,13 @@ WORD DrawDisassemblyLine (HDC dc, int iLine, WORD nBaseAddress, LPTSTR text) // Optionally copy the flags to pText_ //=========================================================================== -void DrawFlags (HDC dc, int line, WORD nRegFlags, LPTSTR pFlagNames_) +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[2] = TEXT("?"); + TCHAR sText[4] = TEXT("?"); RECT rect; int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; @@ -1866,45 +1989,76 @@ void DrawFlags (HDC dc, int line, WORD nRegFlags, LPTSTR pFlagNames_) // Regs are 10 chars across // Flags are 8 chars across -- scale "up" int nSpacerWidth = nFontWidth; - if (nFontWidth) - nSpacerWidth = (10 * nFontWidth) / 8; - nSpacerWidth++; - if (dc) +#if OLD_FLAGS_SPACING + const int nScaledWidth = 10; + if (nFontWidth) + nSpacerWidth = (nScaledWidth * nFontWidth) / 8; + nSpacerWidth++; +#endif + + if (g_hFrameDC) { - rect.left = DISPLAY_FLAG_COLUMN; rect.top = line * g_nFontHeight; - rect.right = rect.left + (10 * nFontWidth);// nSpacerWidth; // nFontWidth = 80's look; // HACK: 9 rect.bottom = rect.top + g_nFontHeight; - DebuggerSetColorBG(dc, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA + rect.left = DISPLAY_FLAG_COLUMN; + rect.right = rect.left + (10 * nFontWidth); + + DebuggerSetColorBG( DebuggerGetColor( BG_DATA_1 )); // BG_INFO + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_REG )); + DebugDrawText( "P ", rect ); + + rect.top += g_nFontHeight; + rect.bottom += g_nFontHeight; + + sprintf( sText, "%02X", nRegFlags ); + + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); + DebugDrawText( sText, rect ); + + rect.top -= g_nFontHeight; + rect.bottom -= g_nFontHeight; + sText[1] = 0; + + rect.left += ((2 + _6502_NUM_FLAGS) * nSpacerWidth); + rect.right = rect.left + nFontWidth; } int iFlag = 0; int nFlag = _6502_NUM_FLAGS; while (nFlag--) { - iFlag = BP_SRC_FLAG_C + (_6502_NUM_FLAGS - nFlag - 1); + iFlag = (_6502_NUM_FLAGS - nFlag - 1); bool bSet = (nRegFlags & 1); - if (dc) + if (g_hFrameDC) { -// sText[0] = g_aFlagNames[ MAX_FLAGS - iFlag - 1]; // mnemonic[iFlag]; // mnemonic is reversed - sText[0] = g_aBreakpointSource[ iFlag ][0]; + sText[0] = g_aBreakpointSource[ BP_SRC_FLAG_C + iFlag ][0]; if (bSet) { - DebuggerSetColorBG( dc, DebuggerGetColor( BG_INFO_INVERSE )); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_INVERSE )); + DebuggerSetColorBG( DebuggerGetColor( BG_INFO_INVERSE )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_INVERSE )); } else { - DebuggerSetColorBG(dc, DebuggerGetColor( BG_INFO )); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_TITLE )); + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); } - - rect.left = DISPLAY_FLAG_COLUMN - ((_6502_NUM_FLAGS - 1 - nFlag) * nSpacerWidth); - rect.right = rect.left + nSpacerWidth; - + rect.left -= nSpacerWidth; + rect.right -= nSpacerWidth; DebugDrawText( sText, rect ); + + // Print Binary value + rect.top += g_nFontHeight; + rect.bottom += g_nFontHeight; + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); // + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); + + sText[0] = '0' + static_cast(bSet); + DebugDrawText( sText, rect ); + rect.top -= g_nFontHeight; + rect.bottom -= g_nFontHeight; } if (pFlagNames_) @@ -1915,7 +2069,7 @@ void DrawFlags (HDC dc, int line, WORD nRegFlags, LPTSTR pFlagNames_) } else { - sFlagNames[nFlag] = g_aBreakpointSource[ iFlag ][0]; + sFlagNames[nFlag] = g_aBreakpointSource[ BP_SRC_FLAG_C + iFlag ][0]; } } @@ -1924,10 +2078,31 @@ void DrawFlags (HDC dc, int line, WORD nRegFlags, LPTSTR pFlagNames_) if (pFlagNames_) _tcscpy(pFlagNames_,sFlagNames); +/* + if (g_hFrameDC) + { + rect.top += g_nFontHeight; + rect.bottom += g_nFontHeight; + rect.left = DISPLAY_FLAG_COLUMN; + rect.right = rect.left + (10 * nFontWidth); + + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_REG )); + DebugDrawTextFixed( "P ", rect ); + + + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA + + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_REG )); + DebugDrawTextFixed( "P ", rect ); + + rect.left += (_6502_NUM_FLAGS * nSpacerWidth); + rect.right = rect.left + nFontWidth; + } +*/ } //=========================================================================== -void DrawMemory (HDC hDC, int line, int iMemDump ) +void DrawMemory ( int line, int iMemDump ) { if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA)))) return; @@ -1946,7 +2121,7 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; RECT rect; - rect.left = DISPLAY_MINIMEM_COLUMN - nFontWidth; + rect.left = DISPLAY_MINIMEM_COLUMN; rect.top = (line * g_nFontHeight); rect.right = DISPLAY_WIDTH; rect.bottom = rect.top + g_nFontHeight; @@ -1989,14 +2164,14 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) } rect2 = rect; - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_INFO_TITLE )); - DebuggerSetColorBG( hDC, DebuggerGetColor( BG_INFO )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); DebugDrawTextFixed( sType, rect2 ); - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_INFO_OPERATOR )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); DebugDrawTextFixed( TEXT(" at " ), rect2 ); - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_INFO_ADDRESS )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); DebugDrawTextLine( sAddress, rect2 ); #endif @@ -2023,7 +2198,7 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) rect.right = DISPLAY_WIDTH - 1; - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_INFO_OPCODE )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); for (int iLine = 0; iLine < nLines; iLine++ ) { @@ -2032,11 +2207,11 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) if (iView == MEM_VIEW_HEX) { wsprintf( sText, TEXT("%04X"), iAddress ); - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_INFO_ADDRESS )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); DebugDrawTextFixed( sText, rect2 ); - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_INFO_OPERATOR )); - DebugDrawTextFixed( TEXT(":"), rect2 ); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); + DebugDrawTextFixed( ":", rect2 ); } for (int iCol = 0; iCol < nCols; iCol++) @@ -2044,8 +2219,8 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) bool bHiBit = false; bool bLoBit = false; - DebuggerSetColorBG ( hDC, DebuggerGetColor( iBackground )); - DebuggerSetColorFG( hDC, DebuggerGetColor( iForeground )); + DebuggerSetColorBG( DebuggerGetColor( iBackground )); + DebuggerSetColorFG( DebuggerGetColor( iForeground )); // .12 Bugfix: DrawMemory() should draw memory byte for IO address: ML1 C000 // if ((iAddress >= _6502_IO_BEGIN) && (iAddress <= _6502_IO_END)) @@ -2057,18 +2232,18 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) { wsprintf( sText, TEXT("%02X"), (unsigned) ((BYTE*)&SS_MB.Unit[nAddr & 1].RegsSY6522)[iAddress] ); if (iCol & 1) - DebuggerSetColorFG( hDC, DebuggerGetColor( iForeground )); + DebuggerSetColorFG( DebuggerGetColor( iForeground )); else - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_INFO_ADDRESS )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); } else if (eDevice == DEV_AY8910) { wsprintf( sText, TEXT("%02X"), (unsigned)SS_MB.Unit[nAddr & 1].RegsAY8910[iAddress] ); if (iCol & 1) - DebuggerSetColorFG( hDC, DebuggerGetColor( iForeground )); + DebuggerSetColorFG( DebuggerGetColor( iForeground )); else - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_INFO_ADDRESS )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); } else { @@ -2081,7 +2256,7 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) { if ((iAddress >= _6502_IO_BEGIN) && (iAddress <= _6502_IO_END)) { - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_INFO_IO_BYTE )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_IO_BYTE )); } wsprintf(sText, TEXT("%02X "), nData ); } @@ -2091,7 +2266,7 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) if ((iAddress >= _6502_IO_BEGIN) && (iAddress <= _6502_IO_END)) iBackground = BG_INFO_IO_BYTE; - ColorizeSpecialChar( hDC, sText, nData, iView, iBackground ); + ColorizeSpecialChar( sText, nData, iView, iBackground ); } } int nChars = DebugDrawTextFixed( sText, rect2 ); // DebugDrawTextFixed() @@ -2109,7 +2284,7 @@ void DrawMemory (HDC hDC, int line, int iMemDump ) } //=========================================================================== -void DrawRegister (HDC dc, int line, LPCTSTR name, const int nBytes, const WORD nValue, int iSource ) +void DrawRegister ( int line, LPCTSTR name, const int nBytes, const WORD nValue, int iSource ) { if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA)))) return; @@ -2117,10 +2292,10 @@ void DrawRegister (HDC dc, int line, LPCTSTR name, const int nBytes, const WORD int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; RECT rect; - rect.left = DISPLAY_REGS_COLUMN; rect.top = line * g_nFontHeight; - rect.right = rect.left + (10 * nFontWidth) + 1; rect.bottom = rect.top + g_nFontHeight; + rect.left = DISPLAY_REGS_COLUMN; + rect.right = rect.left + (10 * nFontWidth); // + 1; if ((PARAM_REG_A == iSource) || (PARAM_REG_X == iSource) || @@ -2128,17 +2303,18 @@ void DrawRegister (HDC dc, int line, LPCTSTR name, const int nBytes, const WORD (PARAM_REG_PC == iSource) || (PARAM_REG_SP == iSource)) { - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_REG )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_REG )); } else { - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_TITLE )); +// DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); + rect.left += nFontWidth; } // 2.6.0.0 Alpha - Regs not "boxed" int iBackground = BG_DATA_1; // BG_INFO - DebuggerSetColorBG(dc, DebuggerGetColor( iBackground )); + DebuggerSetColorBG( DebuggerGetColor( iBackground )); DebugDrawText( name, rect ); unsigned int nData = nValue; @@ -2154,7 +2330,7 @@ void DrawRegister (HDC dc, int line, LPCTSTR name, const int nBytes, const WORD rect.left += (2 * nFontWidth) + (nFontWidth >> 1); // 2.5 looks a tad nicer then 2 // ## = Stack Depth (in bytes) - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_OPERATOR )); // FG_INFO_OPCODE, FG_INFO_TITLE + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); // FG_INFO_OPCODE, FG_INFO_TITLE DebugDrawText( sValue, rect ); } @@ -2167,16 +2343,18 @@ void DrawRegister (HDC dc, int line, LPCTSTR name, const int nBytes, const WORD rect.left = DISPLAY_REGS_COLUMN + (3 * nFontWidth); // rect.right = SCREENSPLIT2; - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_OPERATOR )); - DebugDrawTextFixed( TEXT("'"), rect ); // DebugDrawTextFixed + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); + DebugDrawTextFixed( "'", rect ); // DebugDrawTextFixed - ColorizeSpecialChar( dc, sValue, nData, MEM_VIEW_ASCII ); // MEM_VIEW_APPLE for inverse background little hard on the eyes + ColorizeSpecialChar( sValue, nData, MEM_VIEW_ASCII ); // MEM_VIEW_APPLE for inverse background little hard on the eyes - DebuggerSetColorBG(dc, DebuggerGetColor( iBackground )); - DebugDrawTextFixed( sValue, rect ); // DebugDrawTextFixed() + DebuggerSetColorBG( DebuggerGetColor( iBackground )); + DebugDrawText( sValue, rect ); // DebugDrawTextFixed() - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_OPERATOR )); - DebugDrawTextFixed( TEXT("'"), rect ); // DebugDrawTextFixed() + rect.left += nFontWidth; // HACK: double byte char if char was console escape char + + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); + DebugDrawTextFixed( "'", rect ); // DebugDrawTextFixed() wsprintf(sValue,TEXT(" %02X"), nData ); } @@ -2187,11 +2365,11 @@ void DrawRegister (HDC dc, int line, LPCTSTR name, const int nBytes, const WORD if ((PARAM_REG_PC == iSource) || (PARAM_REG_SP == iSource)) // Stack Pointer is target address, but doesn't look as good. { - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_ADDRESS )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); } else { - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_OPCODE )); // FG_DISASM_OPCODE + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); // FG_DISASM_OPCODE } DebugDrawText( sValue, rect ); } @@ -2228,7 +2406,7 @@ void DrawSourceLine( int iSourceLine, RECT &rect ) //=========================================================================== -void DrawStack (HDC dc, int line) +void DrawStack ( int line) { if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA)))) return; @@ -2240,6 +2418,9 @@ void DrawStack (HDC dc, int line) int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; + // 2.6.0.0 Alpha - Stack was dark cyan BG_DATA_1 + DebuggerSetColorBG( DebuggerGetColor( BG_DATA_1 )); // BG_INFO // recessed 3d look + int iStack = 0; while (iStack < MAX_DISPLAY_STACK_LINES) { @@ -2251,32 +2432,28 @@ void DrawStack (HDC dc, int line) rect.right = rect.left + (10 * nFontWidth) + 1; rect.bottom = rect.top + g_nFontHeight; - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_TITLE )); // [COLOR_STATIC - // 2.6.0.0 Alpha - Stack was dark cyan BG_DATA_1 - DebuggerSetColorBG(dc, DebuggerGetColor( BG_INFO )); // BG_INFO + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); // [COLOR_STATIC - TCHAR sText[8] = TEXT(""); + char sText[8] = ""; if (nAddress <= _6502_STACK_END) { - wsprintf(sText,TEXT("%04X: "),nAddress); + sprintf( sText,"%04X: ", nAddress ); + DebugDrawTextFixed( sText, rect ); } - DebugDrawTextFixed( sText, rect ); - - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_OPCODE )); // COLOR_FG_DATA_TEXT - if (nAddress <= _6502_STACK_END) { - wsprintf(sText,TEXT(" %02X"),(unsigned)*(LPBYTE)(mem+nAddress)); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); // COLOR_FG_DATA_TEXT + sprintf(sText, " %02X",(unsigned)*(LPBYTE)(mem+nAddress)); + DebugDrawTextFixed( sText, rect ); } - DebugDrawTextFixed( sText, rect ); iStack++; } } //=========================================================================== -void DrawTargets (HDC dc, int line) +void DrawTargets ( int line) { if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA)))) return; @@ -2317,27 +2494,27 @@ void DrawTargets (HDC dc, int line) rect.bottom = rect.top + g_nFontHeight; if (iAddress == 0) - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_TITLE )); // Temp Address + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); // Temp Address else - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_ADDRESS )); // Target Address + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); // Target Address - DebuggerSetColorBG(dc, DebuggerGetColor( BG_INFO )); + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); DebugDrawText( sAddress, rect ); rect.left = nColumn; - rect.right = SCREENSPLIT2; + rect.right = rect.left + (10 * nFontWidth); // SCREENSPLIT2 if (iAddress == 0) - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_ADDRESS )); // Temp Target + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); // Temp Target else - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_OPCODE )); // Target Bytes + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); // Target Bytes DebugDrawText( sData, rect ); } } //=========================================================================== -void DrawWatches (HDC dc, int line) +void DrawWatches (int line) { if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA)))) return; @@ -2350,10 +2527,10 @@ void DrawWatches (HDC dc, int line) TCHAR sText[16] = TEXT("Watches"); - DebuggerSetColorBG(dc, DebuggerGetColor( BG_DATA_1 )); // BG_INFO + DebuggerSetColorBG( DebuggerGetColor( WATCH_ZERO_BG )); // BG_INFO #if DISPLAY_WATCH_TITLE - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_TITLE )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE )); DebugDrawTextLine( sText, rect ); #endif @@ -2368,34 +2545,42 @@ void DrawWatches (HDC dc, int line) { RECT rect2 = rect; -// DebuggerSetColorBG( dc, DebuggerGetColor( BG_INFO )); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_TITLE ) ); - wsprintf( sText, TEXT("W.") ); - DebugDrawTextFixed( sText, rect2 ); +// DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) ); + DebugDrawTextFixed( "W", rect2 ); - wsprintf( sText,TEXT("%d"),iWatch+1 ); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_BULLET )); + wsprintf( sText, "%X ",iWatch ); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET )); DebugDrawTextFixed( sText, rect2 ); - wsprintf( sText,TEXT(":") ); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_OPERATOR )); - DebugDrawTextFixed( sText, rect2 ); +// DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); +// DebugDrawTextFixed( ".", rect2 ); wsprintf( sText,TEXT("%04X"), g_aWatches[iWatch].nAddress ); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_DISASM_ADDRESS )); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS )); DebugDrawTextFixed( sText, rect2 ); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); + DebugDrawTextFixed( ":", rect2 ); + BYTE nTarget8 = (unsigned)*(LPBYTE)(mem+g_aWatches[iWatch].nAddress); - wsprintf(sText,TEXT(" %02X"), nTarget8 ); - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_OPCODE )); + wsprintf(sText,TEXT("%02X"), nTarget8 ); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); DebugDrawTextFixed( sText, rect2 ); WORD nTarget16 = (unsigned)*(LPWORD)(mem+g_aWatches[iWatch].nAddress); wsprintf( sText,TEXT(" %04X"), nTarget16 ); - DebuggerSetColorFG( dc, DebuggerGetColor( FG_INFO_ADDRESS )); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); + DebugDrawTextFixed( sText, rect2 ); + + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); + DebugDrawTextFixed( ":", rect2 ); + + BYTE nValue8 = (unsigned)*(LPBYTE)(mem + nTarget16); + wsprintf(sText,TEXT("%02X"), nValue8 ); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); DebugDrawTextFixed( sText, rect2 ); } - rect.top += g_nFontHeight; rect.bottom += g_nFontHeight; } @@ -2403,24 +2588,27 @@ void DrawWatches (HDC dc, int line) //=========================================================================== -void DrawZeroPagePointers(HDC dc, int line) +void DrawZeroPagePointers ( int line ) { if (! ((g_iWindowThis == WINDOW_CODE) || ((g_iWindowThis == WINDOW_DATA)))) return; + int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; + + RECT rect; + rect.top = line * g_nFontHeight; + rect.bottom = rect.top + g_nFontHeight; + rect.left = DISPLAY_ZEROPAGE_COLUMN; + rect.right = rect.left + (10 * nFontWidth); + + DebuggerSetColorBG( DebuggerGetColor( WATCH_ZERO_BG )); // BG_INFO + + const nMaxSymbolLen = 7; + char sText[nMaxSymbolLen+1] = ""; + for(int iZP = 0; iZP < MAX_ZEROPAGE_POINTERS; iZP++) { - RECT rect; - rect.left = DISPLAY_ZEROPAGE_COLUMN; - rect.top = (line+iZP) * g_nFontHeight; - rect.right = SCREENSPLIT2; // TODO/FIXME: - rect.bottom = rect.top + g_nFontHeight; - - TCHAR sText[8] = TEXT(" "); - - DebuggerSetColorFG(dc, DebuggerGetColor( FG_INFO_TITLE )); // COLOR_STATIC - DebuggerSetColorBG(dc, DebuggerGetColor( BG_INFO )); - DebugDrawText( sText, rect ); + RECT rect2 = rect; Breakpoint_t *pZP = &g_aZeroPagePointers[iZP]; bool bEnabled = pZP->bEnabled; @@ -2428,76 +2616,137 @@ void DrawZeroPagePointers(HDC dc, int line) #if DEBUG_FORCE_DISPLAY bEnabled = true; #endif - if (bEnabled) -// if (g_aZeroPagePointers[iZP].bSet) // TODO: Only list enanbled ones { - const UINT nSymbolLen = 4; - char szZP[nSymbolLen+1]; + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_TITLE ) ); + DebugDrawTextFixed( "Z", rect2 ); + + wsprintf( sText, "%X ", iZP ); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_BULLET )); + DebugDrawTextFixed( sText, rect2 ); + +// DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); +// DebugDrawTextFixed( " ", rect2 ); BYTE nZPAddr1 = (g_aZeroPagePointers[iZP].nAddress ) & 0xFF; // +MJP missig: "& 0xFF", or "(BYTE) ..." BYTE nZPAddr2 = (g_aZeroPagePointers[iZP].nAddress+1) & 0xFF; // Get nZPAddr1 last (for when neither symbol is not found - GetSymbol() return ptr to static buffer) - const char* pszSymbol2 = GetSymbol(nZPAddr2, 2); // 2:8-bit value (if symbol not found) - const char* pszSymbol1 = GetSymbol(nZPAddr1, 2); // 2:8-bit value (if symbol not found) + const char* pSymbol2 = GetSymbol(nZPAddr2, 2); // 2:8-bit value (if symbol not found) + const char* pSymbol1 = GetSymbol(nZPAddr1, 2); // 2:8-bit value (if symbol not found) - if( (strlen(pszSymbol1)==1) && (strlen(pszSymbol2)==1) ) + int nLen1 = strlen( pSymbol1 ); + int nLen2 = strlen( pSymbol2 ); + + +// if ((nLen1 == 1) && (nLen2 == 1)) +// sprintf( sText, "%s%s", pszSymbol1, pszSymbol2); + + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS )); + + int x; + for( x = 0; x < nMaxSymbolLen; x++ ) { - sprintf(szZP, "%s%s", pszSymbol1, pszSymbol2); + sText[ x ] = CHAR_SPACE; + } + sText[nMaxSymbolLen] = 0; + + if ((nLen1) && (pSymbol1[0] == '$')) + { +// sprintf( sText, "%s%s", pSymbol1 ); +// wsprintf( sText, "%04X", nZPAddr1 ); + } + else + if ((nLen2) && (pSymbol2[0] == '$')) + { +// sprintf( sText, "%s%s", pSymbol2 ); +// wsprintf( sText, "%04X", nZPAddr2 ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS )); } else { - memcpy(szZP, pszSymbol1, nSymbolLen); - szZP[nSymbolLen] = 0; + int nMin = min( nLen1, nMaxSymbolLen ); + memcpy(sText, pSymbol1, nMin); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_SYMBOL ) ); } +// DrawRegister( line+iZP, szZP, 2, nTarget16); +// DebugDrawText( szZP, rect2 ); + DebugDrawText( sText, rect2); - WORD nZPPtr = (WORD)mem[ nZPAddr1 ] | ((WORD)mem[ nZPAddr2 ]<< 8); - DrawRegister(dc, line+iZP, szZP, 2, nZPPtr); + rect2.left = rect.left; + rect2.top += g_nFontHeight; + rect2.bottom += g_nFontHeight; + + wsprintf( sText, "%02X", nZPAddr1 ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS )); + DebugDrawTextFixed( sText, rect2 ); + + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); + DebugDrawTextFixed( ":", rect2 ); + + WORD nTarget16 = (WORD)mem[ nZPAddr1 ] | ((WORD)mem[ nZPAddr2 ]<< 8); + wsprintf( sText, "%04X", nTarget16 ); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS )); + DebugDrawTextFixed( sText, rect2 ); + + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPERATOR )); + DebugDrawTextFixed( ":", rect2 ); + + BYTE nValue8 = (unsigned)*(LPBYTE)(mem + nTarget16); + wsprintf(sText, "%02X", nValue8 ); + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_OPCODE )); + DebugDrawTextFixed( sText, rect2 ); } + rect.top += (g_nFontHeight * 2); + rect.bottom += (g_nFontHeight * 2); } } // Sub Windows ____________________________________________________________________________________ - //=========================================================================== void DrawSubWindow_Console (Update_t bUpdate) { if (! CanDrawDebugger()) return; - SelectObject( g_hDC, g_aFontConfig[ FONT_CONSOLE ]._hFont ); +#if !USE_APPLE_FONT + SelectObject( g_hFrameDC, g_aFontConfig[ FONT_CONSOLE ]._hFont ); +#endif // static TCHAR sConsoleBlank[ CONSOLE_WIDTH ]; - if ((bUpdate & UPDATE_CONSOLE_INPUT) || (bUpdate & UPDATE_CONSOLE_DISPLAY)) + if ((bUpdate & UPDATE_CONSOLE_DISPLAY) + || (bUpdate & UPDATE_CONSOLE_INPUT)) { - DebuggerSetColorFG( g_hDC, DebuggerGetColor( FG_CONSOLE_OUTPUT )); // COLOR_FG_CONSOLE - DebuggerSetColorBG( g_hDC, DebuggerGetColor( BG_CONSOLE_OUTPUT )); // COLOR_BG_CONSOLE + DebuggerSetColorFG( DebuggerGetColor( FG_CONSOLE_OUTPUT )); // COLOR_FG_CONSOLE + DebuggerSetColorBG( DebuggerGetColor( BG_CONSOLE_OUTPUT )); // COLOR_BG_CONSOLE // int nLines = MIN(g_nConsoleDisplayTotal - g_iConsoleDisplayStart, g_nConsoleDisplayHeight); int iLine = g_iConsoleDisplayStart + CONSOLE_FIRST_LINE; - for (int y = 0; y < g_nConsoleDisplayHeight ; y++ ) + for (int y = 1; y < g_nConsoleDisplayLines ; y++ ) { if (iLine <= (g_nConsoleDisplayTotal + CONSOLE_FIRST_LINE)) { - DrawConsoleLine( g_aConsoleDisplay[ iLine ], y+1 ); + DrawConsoleLine( g_aConsoleDisplay[ iLine ], y ); } iLine++; -// else -// DrawConsoleLine( sConsoleBlank, y ); } - DrawConsoleInput( g_hDC ); + DrawConsoleInput(); // g_hFrameDC ); + } + +// if (bUpdate & UPDATE_CONSOLE_INPUT) + { +// DrawConsoleInput(); // g_hFrameDC ); } } //=========================================================================== void DrawSubWindow_Data (Update_t bUpdate) { - HDC hDC = g_hDC; +// HDC hDC = g_hDC; int iBackground; const int nMaxOpcodes = WINDOW_DATA_BYTES_PER_LINE; @@ -2560,29 +2809,29 @@ void DrawSubWindow_Data (Update_t bUpdate) { iBackground = BG_DATA_2; } - DebuggerSetColorBG( hDC, DebuggerGetColor( iBackground ) ); + DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_DISASM_ADDRESS ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_ADDRESS ) ); DebugDrawTextHorz( (LPCTSTR) sAddress, rect ); - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_DISASM_OPERATOR ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR ) ); if (g_bConfigDisasmAddressColon) - DebugDrawTextHorz( TEXT(":"), rect ); + DebugDrawTextHorz( ":", rect ); rect.left = X_OPCODE; - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_DATA_BYTE ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DATA_BYTE ) ); DebugDrawTextHorz( (LPCTSTR) sOpcodes, rect ); rect.left = X_CHAR; // Seperator - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_DISASM_OPERATOR )); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); DebugDrawTextHorz( (LPCSTR) TEXT(" | " ), rect ); // Plain Text - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_DISASM_CHAR ) ); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_CHAR ) ); MemoryView_e eView = pMD->eView; if ((eView != MEM_VIEW_ASCII) && (eView != MEM_VIEW_APPLE)) @@ -2598,7 +2847,7 @@ void DrawSubWindow_Data (Update_t bUpdate) iTextBackground = BG_INFO_IO_BYTE; } - ColorizeSpecialChar( hDC, sImmediate, (BYTE) nImmediate, eView, iBackground ); + ColorizeSpecialChar( sImmediate, (BYTE) nImmediate, eView, iBackground ); DebugDrawTextHorz( (LPCSTR) sImmediate, rect ); iAddress++; @@ -2620,12 +2869,12 @@ void DrawSubWindow_Data (Update_t bUpdate) iAddress++; } - DebuggerSetColorBG( hDC, DebuggerGetColor( iBackground ) ); // Hack, colorize Char background "spills over to EOL" + DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); // Hack, colorize Char background "spills over to EOL" DebugDrawTextHorz( (LPCSTR) TEXT(" " ), rect ); */ - DebuggerSetColorBG( hDC, DebuggerGetColor( iBackground ) ); // HACK: Colorize() can "spill over" to EOL + DebuggerSetColorBG( DebuggerGetColor( iBackground ) ); // HACK: Colorize() can "spill over" to EOL - DebuggerSetColorFG( hDC, DebuggerGetColor( FG_DISASM_OPERATOR )); + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_OPERATOR )); DebugDrawTextHorz( (LPCSTR) TEXT(" | " ), rect ); nAddress += nMaxOpcodes; @@ -2644,54 +2893,55 @@ void DrawSubWindow_Info( int iWindow ) int yRegs = 0; // 12 int yStack = yRegs + MAX_DISPLAY_REGS_LINES + 0; // 0 - int yTarget = yStack + MAX_DISPLAY_STACK_LINES - 2; // 9 - int yZeroPage = yStack + MAX_DISPLAY_STACK_LINES + 0; // 19 + int yTarget = yStack + MAX_DISPLAY_STACK_LINES - 1; // 9 + int yZeroPage = 16; // 19 - DrawRegister( g_hDC,yRegs++, sReg[ BP_SRC_REG_A ] , 1, regs.a , PARAM_REG_A ); - DrawRegister( g_hDC,yRegs++, sReg[ BP_SRC_REG_X ] , 1, regs.x , PARAM_REG_X ); - DrawRegister( g_hDC,yRegs++, sReg[ BP_SRC_REG_Y ] , 1, regs.y , PARAM_REG_Y ); - DrawRegister( g_hDC,yRegs++, sReg[ BP_SRC_REG_PC] , 2, regs.pc, PARAM_REG_PC ); - DrawRegister( g_hDC,yRegs++, sReg[ BP_SRC_REG_S ] , 2, regs.sp, PARAM_REG_SP ); - DrawFlags ( g_hDC,yRegs++, regs.ps, NULL); + DrawRegister( yRegs++, sReg[ BP_SRC_REG_A ] , 1, regs.a , PARAM_REG_A ); + DrawRegister( yRegs++, sReg[ BP_SRC_REG_X ] , 1, regs.x , PARAM_REG_X ); + DrawRegister( yRegs++, sReg[ BP_SRC_REG_Y ] , 1, regs.y , PARAM_REG_Y ); + DrawRegister( yRegs++, sReg[ BP_SRC_REG_PC] , 2, regs.pc, PARAM_REG_PC ); + DrawFlags ( yRegs , regs.ps, NULL); + yRegs += 2; + DrawRegister( yRegs++, sReg[ BP_SRC_REG_S ] , 2, regs.sp, PARAM_REG_SP ); - DrawStack(g_hDC, yStack); + DrawStack( yStack ); if (g_bConfigInfoTargetPointer) { - DrawTargets(g_hDC,yTarget); + DrawTargets( yTarget ); } - DrawZeroPagePointers( g_hDC, yZeroPage ); + DrawZeroPagePointers( yZeroPage ); #if defined(SUPPORT_Z80_EMU) && defined(OUTPUT_Z80_REGS) - DrawRegister(g_hDC,19,TEXT("AF"),2,*(WORD*)(membank+REG_AF)); - DrawRegister(g_hDC,20,TEXT("BC"),2,*(WORD*)(membank+REG_BC)); - DrawRegister(g_hDC,21,TEXT("DE"),2,*(WORD*)(membank+REG_DE)); - DrawRegister(g_hDC,22,TEXT("HL"),2,*(WORD*)(membank+REG_HL)); - DrawRegister(g_hDC,23,TEXT("IX"),2,*(WORD*)(membank+REG_IX)); + 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)); #endif // Right Side int yBreakpoints = 0; - int yWatches = yBreakpoints + MAX_DISPLAY_BREAKPOINTS_LINES; // 7 - int yMemory = yWatches + MAX_DISPLAY_WATCHES_LINES ; // 14 + int yWatches = yBreakpoints + MAX_BREAKPOINTS; // MAX_DISPLAY_BREAKPOINTS_LINES; // 7 + int yMemory = yWatches + MAX_WATCHES ; // MAX_DISPLAY_WATCHES_LINES ; // 14 - if ((MAX_DISPLAY_BREAKPOINTS_LINES + MAX_DISPLAY_WATCHES_LINES) < 12) - yWatches++; +// if ((MAX_DISPLAY_BREAKPOINTS_LINES + MAX_DISPLAY_WATCHES_LINES) < 12) +// yWatches++; #if DEBUG_FORCE_DISPLAY if (true) #else if (g_nBreakpoints) #endif - DrawBreakpoints( g_hDC, yBreakpoints ); + DrawBreakpoints( yBreakpoints ); #if DEBUG_FORCE_DISPLAY if (true) #else if (g_nWatches) #endif - DrawWatches(g_hDC, yWatches ); + DrawWatches( yWatches ); g_nDisplayMemoryLines = MAX_DISPLAY_MEMORY_LINES_1; @@ -2700,7 +2950,7 @@ void DrawSubWindow_Info( int iWindow ) #else if (g_aMemDump[0].bActive) #endif - DrawMemory(g_hDC, yMemory, 0 ); // g_aMemDump[0].nAddress, g_aMemDump[0].eDevice); + DrawMemory( yMemory, 0 ); // g_aMemDump[0].nAddress, g_aMemDump[0].eDevice); yMemory += (g_nDisplayMemoryLines + 1); g_nDisplayMemoryLines = MAX_DISPLAY_MEMORY_LINES_2; @@ -2710,7 +2960,7 @@ void DrawSubWindow_Info( int iWindow ) #else if (g_aMemDump[1].bActive) #endif - DrawMemory(g_hDC, yMemory, 1 ); // g_aMemDump[1].nAddress, g_aMemDump[1].eDevice); + DrawMemory( yMemory, 1 ); // g_aMemDump[1].nAddress, g_aMemDump[1].eDevice); } @@ -2731,7 +2981,7 @@ void DrawSubWindow_Source2 (Update_t bUpdate) // if (! g_bSourceLevelDebugging) // return; - DebuggerSetColorFG( g_hDC, DebuggerGetColor( FG_SOURCE )); + DebuggerSetColorFG( DebuggerGetColor( FG_SOURCE )); int iSource = g_iSourceDisplayStart; int nLines = g_nDisasmWinHeight; @@ -2755,8 +3005,8 @@ void DrawSubWindow_Source2 (Update_t bUpdate) _tcsncpy( sText, g_aSourceFileName, g_nConsoleDisplayWidth - _tcslen( sTitle ) - 1 ); _tcscat( sTitle, sText ); - DebuggerSetColorBG( g_hDC, DebuggerGetColor( BG_SOURCE_TITLE )); - DebuggerSetColorFG( g_hDC, DebuggerGetColor( FG_SOURCE_TITLE )); + DebuggerSetColorBG( DebuggerGetColor( BG_SOURCE_TITLE )); + DebuggerSetColorFG( DebuggerGetColor( FG_SOURCE_TITLE )); DebugDrawText( sTitle, rect ); rect.top += g_nFontHeight; @@ -2793,8 +3043,8 @@ void DrawSubWindow_Source2 (Update_t bUpdate) iBackground = BG_DISASM_PC_X; // _C iForeground = FG_DISASM_PC_X; // _C } - DebuggerSetColorBG( g_hDC, DebuggerGetColor( iBackground )); - DebuggerSetColorFG( g_hDC, DebuggerGetColor( iForeground )); + DebuggerSetColorBG( DebuggerGetColor( iBackground )); + DebuggerSetColorFG( DebuggerGetColor( iForeground )); DrawSourceLine( iSourceLine, rect ); iSourceLine++; @@ -2823,32 +3073,39 @@ void DrawWindow_Code( Update_t bUpdate ) DrawSubWindow_Info( g_iWindowThis ); } +// Full Screen console //=========================================================================== void DrawWindow_Console( Update_t bUpdate ) { // Nothing to do, except draw background, since text handled by DrawSubWindow_Console() - RECT viewportrect; - viewportrect.left = 0; - viewportrect.top = 0; - viewportrect.right = DISPLAY_WIDTH; - viewportrect.bottom = DISPLAY_HEIGHT - DEFAULT_HEIGHT; // 368 = 23 lines // TODO/FIXME + RECT rect; + rect.left = 0; + rect.top = 0; + rect.right = DISPLAY_WIDTH; + rect.bottom = DISPLAY_HEIGHT - DEFAULT_HEIGHT; // 368 = 23 lines // TODO/FIXME // TODO/FIXME: COLOR_BG_CODE -> g_iWindowThis, once all tab backgrounds are listed first in g_aColors ! - DebuggerSetColorBG(g_hDC, DebuggerGetColor( BG_DISASM_2 )); // COLOR_BG_CODE + DebuggerSetColorBG( DebuggerGetColor( BG_DISASM_2 )); // COLOR_BG_CODE -#if USE_APPLE_FONT -// RenderFilledRect( viewportrect ); -#else - // Can't use DebugDrawText, since we don't ned the CLIPPED flag - // TODO: add default param OPAQUE|CLIPPED - ExtTextOut( g_hDC - ,0,0 - ,ETO_OPAQUE - ,&viewportrect - ,TEXT("") - ,0 - ,NULL - ); +#if DEBUG_BACKGROUND + DebuggerSetColorBG( RGB(255,0,0) ); +#endif + +#if !DEBUG_FONT_NO_BACKGROUND_FILL_CON + #if USE_APPLE_FONT +// FillRect( g_hFrameDC, &rect, g_hConsoleBrushBG ); + #else + // Can't use DebugDrawText, since we don't ned the CLIPPED flag + // TODO: add default param OPAQUE|CLIPPED + ExtTextOut( g_hFrameDC + ,0,0 + ,ETO_OPAQUE + ,&rect + ,TEXT("") + ,0 + ,NULL + ); + #endif #endif } @@ -2891,39 +3148,53 @@ void DrawWindowBackground_Main( int g_iWindowThis ) { int nFontWidth = g_aFontConfig[ FONT_INFO ]._nFontWidthAvg; - RECT viewportrect; - viewportrect.left = 0; - viewportrect.top = 0; - viewportrect.right = SCREENSPLIT1 - nFontWidth; // HACK: MAGIC #: 14 -> 6 -> (g_nFonWidthAvg-1) - viewportrect.bottom = DISPLAY_HEIGHT - DEFAULT_HEIGHT; // 368 = 23 lines // TODO/FIXME + RECT rect; + rect.left = 0; + rect.top = 0; +// rect.right = SCREENSPLIT1 - nFontWidth; // HACK: MAGIC #: 14 -> 6 -> (g_nFonWidthAvg-1) + rect.right = SCREENSPLIT1; // HACK: MAGIC #: 14 -> 6 -> (g_nFonWidthAvg-1) + int nTop = GetConsoleTopPixels( g_nConsoleDisplayLines ); + rect.bottom = nTop; +// rect.bottom = DISPLAY_HEIGHT - DEFAULT_HEIGHT; // 368 = 23 lines // TODO/FIXME + // g_nFontHeight * g_nDisasmWinHeight; // 304 // TODO/FIXME: COLOR_BG_CODE -> g_iWindowThis, once all tab backgrounds are listed first in g_aColors ! - DebuggerSetColorBG(g_hDC, DebuggerGetColor( BG_DISASM_1 )); // COLOR_BG_CODE + DebuggerSetColorBG( DebuggerGetColor( BG_DISASM_1 )); // COLOR_BG_CODE -#if USE_APPLE_FONT -#else - // Can't use DebugDrawText, since we don't need CLIPPED - ExtTextOut(g_hDC,0,0,ETO_OPAQUE,&viewportrect,TEXT(""),0,NULL); +#if DEBUG_BACKGROUND + DebuggerSetColorBG( RGB(255,0,255) ); +#endif + +#if !DEBUG_FONT_NO_BACKGROUND_FILL_MAIN + #if USE_APPLE_FONT + FillRect( g_hFrameDC, &rect, g_hConsoleBrushBG ); + #else + // Can't use DebugDrawText, since we don't need CLIPPED + ExtTextOut( g_hFrameDC, 0, 0, ETO_OPAQUE,&rect,TEXT(""),0,NULL); + #endif #endif } //=========================================================================== void DrawWindowBackground_Info( int g_iWindowThis ) { - RECT viewportrect; - viewportrect.top = 0; - viewportrect.left = SCREENSPLIT1 - 6; // 14 // HACK: MAGIC #: 14 -> (g_nFontWidthAvg-1) - viewportrect.right = DISPLAY_WIDTH; - viewportrect.bottom = DISPLAY_HEIGHT; //g_nFontHeight * MAX_DISPLAY_INFO_LINES; // 384 + RECT rect; + rect.top = 0; + rect.left = SCREENSPLIT1 - 6; // 14 // HACK: MAGIC #: 14 -> (g_nFontWidthAvg-1) + rect.right = DISPLAY_WIDTH; + rect.bottom = DISPLAY_HEIGHT; //g_nFontHeight * MAX_DISPLAY_INFO_LINES; // 384 - DebuggerSetColorBG(g_hDC, DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA + DebuggerSetColorBG( DebuggerGetColor( BG_INFO )); // COLOR_BG_DATA // Can't use DebugDrawText, since we don't need CLIPPED -#if USE_APPLE_FONT -#else - ExtTextOut(g_hDC,0,0,ETO_OPAQUE,&viewportrect,TEXT(""),0,NULL); +#if !DEBUG_FONT_NO_BACKGROUND_FILL_INFO + #if USE_APPLE_FONT + FillRect( g_hFrameDC, &rect, g_hConsoleBrushBG ); + #else + ExtTextOut(g_hFrameDC,0,0,ETO_OPAQUE,&rect,TEXT(""),0,NULL); + #endif #endif } @@ -2931,18 +3202,35 @@ void DrawWindowBackground_Info( int g_iWindowThis ) //=========================================================================== void UpdateDisplay (Update_t bUpdate) { - g_hDC = FrameGetDC(); - -#if USE_APPLE_FONT - VideoDrawLogoBitmap( g_hDC ); - - SetBkMode(g_hDC,OPAQUE); - SetBkColor(g_hDC,RGB(0,0,0)); -#else - SelectObject( g_hDC, g_aFontConfig[ FONT_INFO ]._hFont ); // g_hFontDebugger + static spDrawMutex = false; + + if (spDrawMutex) + { +#if DEBUG + MessageBox( g_hFrameWindow, "Already drawing!", "!", MB_OK ); #endif + } + spDrawMutex = true; - SetTextAlign(g_hDC,TA_TOP | TA_LEFT); + FrameGetDC(); + + // Hack: Full screen console scrolled, "erase" left over console lines + if (g_iWindowThis == WINDOW_CONSOLE) + bUpdate |= UPDATE_BACKGROUND; + + if (bUpdate & UPDATE_BACKGROUND) + { +#if USE_APPLE_FONT + VideoDrawLogoBitmap( g_hFrameDC ); + + SetBkMode( g_hFrameDC, OPAQUE); + SetBkColor(g_hFrameDC, RGB(0,0,0)); +#else + SelectObject( g_hFrameDC, g_aFontConfig[ FONT_INFO ]._hFont ); // g_hFontDebugger +#endif + } + + SetTextAlign( g_hFrameDC, TA_TOP | TA_LEFT); if ((bUpdate & UPDATE_BREAKPOINTS) || (bUpdate & UPDATE_DISASM) @@ -3003,7 +3291,9 @@ void UpdateDisplay (Update_t bUpdate) DrawSubWindow_Console( bUpdate ); FrameReleaseDC(); - g_hDC = 0; +// g_hDC = 0; + + spDrawMutex = false; } @@ -3039,13 +3329,17 @@ void DrawSubWindow_Code ( int iWindow ) // These should be functionally equivalent. // DisasmCalcTopFromCurAddress(); // DisasmCalcBotFromTopAddress(); - SelectObject( g_hDC, g_aFontConfig[ FONT_DISASM_DEFAULT ]._hFont ); // g_hFontDisasm +#if !USE_APPLE_FONT + SelectObject( g_hFrameDC, g_aFontConfig[ FONT_DISASM_DEFAULT ]._hFont ); // g_hFontDisasm +#endif WORD nAddress = g_nDisasmTopAddress; // g_nDisasmCurAddress; for (int iLine = 0; iLine < nLines; iLine++ ) { - nAddress += DrawDisassemblyLine( g_hDC, iLine, nAddress, NULL); + nAddress += DrawDisassemblyLine( iLine, nAddress, NULL); } - SelectObject( g_hDC, g_aFontConfig[ FONT_INFO ]._hFont ); // g_hFontDebugger +#if !USE_APPLE_FONT + SelectObject( g_hFrameDC, g_aFontConfig[ FONT_INFO ]._hFont ); // g_hFontDebugger +#endif } diff --git a/source/Debugger_Display.h b/source/Debugger_Display.h index 9a5ab074..b0bb1062 100644 --- a/source/Debugger_Display.h +++ b/source/Debugger_Display.h @@ -1,10 +1,11 @@ #ifndef DEBUGGER_DISPLAY_H #define DEBUGGER_DISPLAY_H +// use the new Debugger Font (Apple Font) +#define USE_APPLE_FONT 1 + // Test Colors & Glyphs #define DEBUG_APPLE_FONT 0 -// Re-route all debugger text to new font -#define USE_APPLE_FONT 0 // Win32 Debugger Font // 1 = Use Debugger_Font_7x8.BMP @@ -40,7 +41,7 @@ #endif }; - extern HDC g_hDstDC ; +// extern HDC g_hDstDC ; extern HBRUSH g_hConsoleBrushFG; extern HBRUSH g_hConsoleBrushBG; @@ -51,7 +52,7 @@ enum ConsoleColors_e { CONSOLE_COLOR_K, - CONSOLE_COLOR_PREV = 0, + CONSOLE_COLOR_x = 0, // default console foreground CONSOLE_COLOR_R, CONSOLE_COLOR_G, CONSOLE_COLOR_Y, @@ -62,11 +63,47 @@ MAX_CONSOLE_COLORS }; - extern COLORREF g_anConsoleColor[ MAX_CONSOLE_COLORS ]; - extern char *g_asConsoleColor[ MAX_CONSOLE_COLORS ]; + extern COLORREF g_anConsoleColor[ MAX_CONSOLE_COLORS ]; +// extern const char *g_asConsoleColor[ MAX_CONSOLE_COLORS ]; - // ` ~ should always display ~ + // Note: THe ` ~ key should always display ~ to prevent rendering errors #define CONSOLE_COLOR_ESCAPE_CHAR '`' + +// Help Colors +/* + Types + Plain White + Header Yellow i.e. Usage + Operator Yellow + Command Green + Key Red + ArgMandatory Magenta < > + ArgOptional Blue [ ] + ArgSeperator White | + + #define CON_COLOR_DEFAULT g_asConsoleColor[ CONSOLE_COLOR_x ] + #define CON_COLOR_DEFAULT "`0" + +*/ +#if 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" +#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 "" +#endif + inline bool ConsoleColorIsEscapeMeta( char c ) { if (CONSOLE_COLOR_ESCAPE_CHAR == c) @@ -98,7 +135,13 @@ #endif } - extern const int DISPLAY_HEIGHT; + enum + { + DISPLAY_HEIGHT = 384, + MAX_DISPLAY_LINES = DISPLAY_HEIGHT / CONSOLE_FONT_HEIGHT, + }; + + int GetConsoleTopPixels( int y ); extern FontConfig_t g_aFontConfig[ NUM_FONTS ]; @@ -114,16 +157,18 @@ void DrawWindow_Source (Update_t bUpdate); - void DrawBreakpoints (HDC dc, int line); - void DrawConsoleInput (HDC dc); + void DrawBreakpoints ( int line); + void DrawConsoleInput (); void DrawConsoleLine (LPCSTR pText, int y); - WORD DrawDisassemblyLine (HDC dc, int line, WORD offset, LPTSTR text); - void DrawFlags (HDC dc, int line, WORD nRegFlags, LPTSTR pFlagNames_); - void DrawMemory (HDC dc, int line, int iMem ); - void DrawRegister (HDC dc, int line, LPCTSTR name, int bytes, WORD value, int iSource = 0 ); - void DrawStack (HDC dc, int line); - void DrawTargets (HDC dc, int line); - void DrawWatches (HDC dc, int line); - void DrawZeroPagePointers (HDC dc, int line); + void DrawConsoleCursor (); + + WORD DrawDisassemblyLine ( int line, WORD offset, LPTSTR text); + void DrawFlags ( int line, WORD nRegFlags, LPTSTR pFlagNames_); + void DrawMemory ( int line, int iMem ); + void DrawRegister ( int line, LPCTSTR name, int bytes, WORD value, int iSource = 0 ); + void DrawStack ( int line); + void DrawTargets ( int line); + void DrawWatches ( int line); + void DrawZeroPagePointers ( int line); #endif diff --git a/source/Debugger_Help.cpp b/source/Debugger_Help.cpp index 2a4173d6..886168a9 100644 --- a/source/Debugger_Help.cpp +++ b/source/Debugger_Help.cpp @@ -86,7 +86,7 @@ bool TryStringCat ( TCHAR * pDst, LPCSTR pSrc, const int nDstSize ) // cats string as much as possible // returns true if pSrc safely fits into pDst, else false (pSrc would of overflowed pDst) //=========================================================================== -bool StringCat ( TCHAR * pDst, LPCSTR pSrc, const int nDstSize ) +int StringCat ( TCHAR * pDst, LPCSTR pSrc, const int nDstSize ) { int nLenDst = _tcslen( pDst ); int nLenSrc = _tcslen( pSrc ); @@ -97,9 +97,9 @@ bool StringCat ( TCHAR * pDst, LPCSTR pSrc, const int nDstSize ) bool bOverflow = (nSpcDst < nLenSrc); if (bOverflow) - return false; + return 0; - return true; + return nChars; } @@ -126,6 +126,70 @@ Update_t Help_Arg_1( int iCommandHelp ) } +//=========================================================================== +void Help_Categories() +{ + const int nBuf = CONSOLE_WIDTH * 2; + + char sText[ nBuf ] = ""; + int nLen = 0; + + nLen += StringCat( sText, CON_COLOR_USAGE , nBuf ); + nLen += StringCat( sText, "Usage", nBuf ); + + nLen += StringCat( sText, CON_COLOR_DEFAULT, nBuf ); + nLen += StringCat( sText, ": " , nBuf ); + + nLen += StringCat( sText, CON_COLOR_ARG_OPT, nBuf ); + nLen += StringCat( sText, "[ ", nBuf ); + + nLen += StringCat( sText, CON_COLOR_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; + + if (nLen + _tcslen( pName ) >= (CONSOLE_WIDTH - 4)) + { + ConsolePrint( sText ); + sText[ 0 ] = 0; + nLen = StringCat( sText, " ", nBuf ); + } + + StringCat( sText, CON_COLOR_PARAM, 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, CON_COLOR_ARG_MAND, nBuf ); + StringCat( sText, TEXT(" >"), nBuf); + + StringCat( sText, CON_COLOR_ARG_OPT, nBuf ); + StringCat( sText, TEXT(" ]"), 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 + ); + ConsolePrint( sText ); // Transcode colored text to native console color text +// ConsoleBufferPush( sText ); +} + //=========================================================================== void Help_Range() { @@ -137,33 +201,41 @@ void Help_Range() //=========================================================================== void Help_Operators() { - ConsoleBufferPush( TEXT(" Operators: (Math)" ) ); - ConsoleBufferPush( TEXT(" + Addition" ) ); - ConsoleBufferPush( TEXT(" - Subtraction" ) ); - ConsoleBufferPush( TEXT(" * Multiplication" ) ); - ConsoleBufferPush( TEXT(" / Division" ) ); - ConsoleBufferPush( TEXT(" % Modulas or Remainder" ) ); - ConsoleBufferPush( TEXT(" Operators: (Bit Wise)" ) ); - ConsoleBufferPush( TEXT(" & Bit-wise and (AND)" ) ); - ConsoleBufferPush( TEXT(" | Bit-wise or (OR )" ) ); - ConsoleBufferPush( TEXT(" ^ Bit-wise exclusive-or (EOR/XOR)" ) ); - ConsoleBufferPush( TEXT(" ! Bit-wise negation (NOT)" ) ); - ConsoleBufferPush( TEXT(" Operators: (Input)" ) ); - ConsoleBufferPush( TEXT(" @ next number refers to search results" ) ); - ConsoleBufferPush( TEXT(" \" Designate string in ASCII format" ) ); - ConsoleBufferPush( TEXT(" \' Desginate string in High-Bit apple format" ) ); - ConsoleBufferPush( TEXT(" $ Designate number/symbol" ) ); - ConsoleBufferPush( TEXT(" # Designate number in hex" ) ); - ConsoleBufferPush( TEXT(" Operators: (Range)" ) ); - ConsoleBufferPush( TEXT(" , range seperator (2nd address is relative)" ) ); - ConsoleBufferPush( TEXT(" : range seperator (2nd address is absolute)" ) ); - ConsoleBufferPush( TEXT(" Operators: (Misc)" ) ); - ConsoleBufferPush( TEXT(" // comment until end of line" ) ); - ConsoleBufferPush( TEXT(" Operators: (Breakpoint)" ) ); - - TCHAR sText[ CONSOLE_WIDTH ]; + char sText[ CONSOLE_WIDTH ]; + +// sprintf( sText," %sOperators%s:" , CON_COLOR_USAGE, CON_COLOR_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 ); +//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 ); +//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 ); +//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: (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 ); +//ConsoleBufferPush( " Operators: (Breakpoint)" ); + sprintf( sText," Operators: (%sBreakpoint%s)" , CON_COLOR_USAGE, CON_COLOR_DEFAULT ); ConsolePrint( sText ); _tcscpy( sText, " " ); + _tcscat( sText, CON_COLOR_USAGE ); int iBreakOp = 0; for( iBreakOp = 0; iBreakOp < NUM_BREAKPOINT_OPERATORS; iBreakOp++ ) { @@ -174,6 +246,7 @@ void Help_Operators() _tcscat( sText, " " ); } } + _tcscat( sText, CON_COLOR_DEFAULT ); ConsoleBufferPush( sText ); } @@ -202,10 +275,16 @@ Update_t CmdMOTD( int nArgs ) ConsoleBufferPush( TEXT(" Apple ][ ][+ //e Emulator for Windows") ); CmdVersion(0); CmdSymbols(0); - wsprintf( sText, " '~' console, '%s' (specific), '%s' (all)" + 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 ); ConsoleBufferPush( sText ); @@ -221,41 +300,13 @@ Update_t CmdMOTD( int nArgs ) Update_t CmdHelpSpecific (int nArgs) { int iArg; - TCHAR sText[ CONSOLE_WIDTH ]; + TCHAR sText[ CONSOLE_WIDTH * 2 ]; ZeroMemory( sText, CONSOLE_WIDTH ); if (! nArgs) { -// ConsoleBufferPush( TEXT(" [] = optional, {} = mandatory. Categories are: ") ); - - _tcscpy( sText, TEXT("Usage: [< ") ); - for (int iCategory = _PARAM_HELPCATEGORIES_BEGIN ; iCategory < _PARAM_HELPCATEGORIES_END; iCategory++) - { -#if _DEBUG -// if (iCategory == (PARAM_CAT_ZEROPAGE - 1)) -// { -// int nLen = _tcslen( sText ); -// bool bStop = true; -// } -#endif - TCHAR *pName = g_aParameters[ iCategory ].m_sName; - if (! TestStringCat( sText, pName, CONSOLE_WIDTH - 4 )) // CONSOLE_WIDTH // g_nConsoleDisplayWidth - 3 - { - ConsoleBufferPush( sText ); - _tcscpy( sText, TEXT(" ") ); - } - - StringCat( sText, pName, CONSOLE_WIDTH ); - if (iCategory < (_PARAM_HELPCATEGORIES_END - 1)) - { - StringCat( sText, TEXT(" | "), CONSOLE_WIDTH - 1 ); - } - } - StringCat( sText, TEXT(" >]"), CONSOLE_WIDTH - 3 ); - ConsoleBufferPush( sText ); - - wsprintf( sText, TEXT("Note: [] = optional, <> = mandatory"), CONSOLE_WIDTH ); - ConsoleBufferPush( sText ); + Help_Categories(); + return ConsoleUpdate(); } CmdFuncPtr_t pFunction = NULL; @@ -1068,12 +1119,12 @@ Update_t CmdVersion (int nArgs) // wsprintf( sText, "Version" ); ConsoleBufferPush( sText ); wsprintf( sText, " Emulator: %s%s%s Debugger: %s%d.%d.%d.%d%s" - , g_asConsoleColor[ CONSOLE_COLOR_G ] + , CON_COLOR_NUM , VERSIONSTRING - , g_asConsoleColor[ CONSOLE_COLOR_PREV ] - , g_asConsoleColor[ CONSOLE_COLOR_G ] + , CON_COLOR_DEFAULT + , CON_COLOR_NUM , nMajor, nMinor, nFixMajor, nFixMinor - , g_asConsoleColor[ CONSOLE_COLOR_PREV ] + , CON_COLOR_DEFAULT ); ConsoleBufferPush( sText ); diff --git a/source/Debugger_Types.h b/source/Debugger_Types.h index 54c8e604..0231cd06 100644 --- a/source/Debugger_Types.h +++ b/source/Debugger_Types.h @@ -152,7 +152,7 @@ enum { - MAX_BREAKPOINTS = 15 + MAX_BREAKPOINTS = 16 }; /* @@ -1383,7 +1383,7 @@ enum { - MAX_WATCHES = 8 + MAX_WATCHES = 16 }; diff --git a/source/Frame.cpp b/source/Frame.cpp index f4b0a6a7..93339660 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -32,8 +32,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #define ENABLE_MENU 0 -#define VIEWPORTX 5 -#define VIEWPORTY 5 #define VIEWPORTCX 560 #if ENABLE_MENU #define VIEWPORTCY 400 @@ -68,7 +66,7 @@ static int buttonover = -1; static int buttonx = BUTTONX; static int buttony = BUTTONY; static HRGN clipregion = (HRGN)0; -static HDC g_hFrameDC = (HDC)0; + HDC g_hFrameDC = (HDC)0; static RECT framerect = {0,0,0,0}; HWND g_hFrameWindow = (HWND)0; BOOL fullscreen = 0; @@ -142,19 +140,21 @@ void DeleteGdiObjects () { DeleteObject(smallfont); } +// Draws an 3D box around the main apple screen //=========================================================================== -void Draw3dRect (HDC dc, int x1, int y1, int x2, int y2, BOOL out) { - SelectObject(dc,GetStockObject(NULL_BRUSH)); - SelectObject(dc,out ? btnshadowpen : btnhighlightpen); - POINT pt[3]; - pt[0].x = x1; pt[0].y = y2-1; - pt[1].x = x2-1; pt[1].y = y2-1; - pt[2].x = x2-1; pt[2].y = y1; - Polyline(dc,(LPPOINT)&pt,3); - SelectObject(dc,(out == 1) ? btnhighlightpen : btnshadowpen); - pt[1].x = x1; pt[1].y = y1; - pt[2].x = x2; pt[2].y = y1; - Polyline(dc,(LPPOINT)&pt,3); +void Draw3dRect (HDC dc, int x1, int y1, int x2, int y2, BOOL out) +{ + SelectObject(dc,GetStockObject(NULL_BRUSH)); + SelectObject(dc,out ? btnshadowpen : btnhighlightpen); + POINT pt[3]; + pt[0].x = x1; pt[0].y = y2-1; + pt[1].x = x2-1; pt[1].y = y2-1; + pt[2].x = x2-1; pt[2].y = y1; + Polyline(dc,(LPPOINT)&pt,3); + SelectObject(dc,(out == 1) ? btnhighlightpen : btnshadowpen); + pt[1].x = x1; pt[1].y = y1; + pt[2].x = x2; pt[2].y = y1; + Polyline(dc,(LPPOINT)&pt,3); } //=========================================================================== @@ -397,10 +397,10 @@ void DrawStatusArea (HDC passdc, int drawflags) { TCHAR title[40]; _tcscpy(title,g_bApple2e - ? TITLE_APPLE_2 + ? TITLE_APPLE_2_E : (g_bApple2plus ? TITLE_APPLE_2_PLUS - : TITLE_APPLE_2 )); + : TITLE_APPLE_2_ORG )); switch (g_nAppMode) { @@ -681,6 +681,7 @@ LRESULT CALLBACK FrameWndProc ( else if ((x < buttonx) && JoyUsingMouse() && ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_STEPPING))) SetUsingCursor(1); + DebuggerMouseClick( x, y ); } RelayEvent(WM_LBUTTONDOWN,wparam,lparam); break; @@ -1187,7 +1188,7 @@ void FrameCreateWindow () if (g_bApple2plus) g_pAppTitle = TITLE_APPLE_2_PLUS; else - g_pAppTitle = TITLE_APPLE_2; + g_pAppTitle = TITLE_APPLE_2_ORG; } g_hFrameWindow = CreateWindow( diff --git a/source/Frame.h b/source/Frame.h index bc6b32f4..f32e6a14 100644 --- a/source/Frame.h +++ b/source/Frame.h @@ -2,8 +2,13 @@ enum {NOT_ASCII=0, ASCII}; +// 3D Border +#define VIEWPORTX 5 +#define VIEWPORTY 5 + // Win32 extern HWND g_hFrameWindow; +extern HDC g_hFrameDC; extern BOOL fullscreen;