mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-04-19 07:37:12 +00:00
Debugger: show video-scanner's h,v position (at the expense of losing 2 watches). (#666)
This commit is contained in:
@@ -193,6 +193,11 @@ bool Is6502InterruptEnabled(void)
|
||||
return !(regs.ps & AF_INTERRUPT);
|
||||
}
|
||||
|
||||
void ResetCyclesExecutedForDebugger(void)
|
||||
{
|
||||
g_nCyclesExecuted = 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
#include "CPU/cpu_general.inl"
|
||||
|
||||
@@ -44,3 +44,4 @@ eCpuType GetActiveCpu(void);
|
||||
void SetActiveCpu(eCpuType cpu);
|
||||
|
||||
bool Is6502InterruptEnabled(void);
|
||||
void ResetCyclesExecutedForDebugger(void);
|
||||
|
||||
@@ -6811,6 +6811,38 @@ Update_t CmdStackPopPseudo (int nArgs)
|
||||
return UPDATE_CONSOLE_DISPLAY;
|
||||
}
|
||||
|
||||
// Video __________________________________________________________________________________________
|
||||
|
||||
Update_t CmdVideoScannerInfo(int nArgs)
|
||||
{
|
||||
if (nArgs != 1)
|
||||
{
|
||||
ConsoleBufferPush("Video-scanner display config: <dec|hex|real|apple>");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(g_aArgs[1].sArg, "dec") == 0)
|
||||
{
|
||||
g_videoScannerDisplayInfo.isDecimal = true;
|
||||
}
|
||||
else if (strcmp(g_aArgs[1].sArg, "hex") == 0)
|
||||
{
|
||||
g_videoScannerDisplayInfo.isDecimal = false;
|
||||
}
|
||||
else if (strcmp(g_aArgs[1].sArg, "real") == 0)
|
||||
{
|
||||
g_videoScannerDisplayInfo.isHorzReal = true;
|
||||
}
|
||||
else if (strcmp(g_aArgs[1].sArg, "apple") == 0)
|
||||
{
|
||||
g_videoScannerDisplayInfo.isHorzReal = false;
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleBufferToDisplay();
|
||||
|
||||
return UPDATE_ALL;
|
||||
}
|
||||
|
||||
// View ___________________________________________________________________________________________
|
||||
|
||||
@@ -8068,7 +8100,7 @@ void OutputTraceLine ()
|
||||
|
||||
if (g_bTraceFileWithVideoScanner)
|
||||
{
|
||||
uint16_t addr = NTSC_VideoGetScannerAddress(0); // NB. uExecutedCycles==0 as SingleStep() called afterwards
|
||||
uint16_t addr = NTSC_VideoGetScannerAddressForDebugger();
|
||||
BYTE data = mem[addr];
|
||||
|
||||
fprintf( g_hTraceFile,
|
||||
|
||||
@@ -239,6 +239,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// {TEXT("VARSLOAD") , CmdVarsLoad , CMD_VARIABLES_LOAD },
|
||||
// {TEXT("VARSSAVE") , CmdVarsSave , CMD_VARIABLES_SAVE },
|
||||
// {TEXT("SET") , CmdVarsSet , CMD_VARIABLES_SET },
|
||||
// Video-scanner info
|
||||
{TEXT("VIDEOINFO") , CmdVideoScannerInfo , CMD_VIDEO_SCANNER_INFO, "Video-scanner info" },
|
||||
// View
|
||||
{TEXT("TEXT") , CmdViewOutput_Text4X , CMD_VIEW_TEXT4X, "View Text screen (current page)" },
|
||||
{TEXT("TEXT1") , CmdViewOutput_Text41 , CMD_VIEW_TEXT41, "View Text screen Page 1" },
|
||||
|
||||
@@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../LanguageCard.h"
|
||||
#include "../Memory.h"
|
||||
#include "../Mockingboard.h"
|
||||
#include "../NTSC.h"
|
||||
#include "../Video.h"
|
||||
|
||||
// NEW UI debugging - force display ALL meta-info (regs, stack, bp, watches, zp) for debugging purposes
|
||||
@@ -59,6 +60,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//#define WATCH_ZERO_BG BG_DATA_1
|
||||
#define WATCH_ZERO_BG BG_INFO
|
||||
|
||||
#define VIDEO_INFO_BG BG_INFO
|
||||
|
||||
#define DISPLAY_MEMORY_TITLE 1
|
||||
// #define DISPLAY_BREAKPOINT_TITLE 1
|
||||
// #define DISPLAY_WATCH_TITLE 1
|
||||
@@ -161,6 +164,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
const int DISPLAY_BP_COLUMN = INFO_COL_2;
|
||||
const int DISPLAY_WATCHES_COLUMN = INFO_COL_2;
|
||||
const int DISPLAY_MINIMEM_COLUMN = INFO_COL_2;
|
||||
const int DISPLAY_VIDEO_SCANNER_COLUMN = INFO_COL_2;
|
||||
#else
|
||||
const int DISPLAY_CPU_INFO_LEFT_COLUMN = SCREENSPLIT1 // TC: SCREENSPLIT1 is not defined anywhere in the .sln!
|
||||
|
||||
@@ -197,6 +201,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
// static HDC g_hDC = 0;
|
||||
|
||||
VideoScannerDisplayInfo g_videoScannerDisplayInfo;
|
||||
|
||||
|
||||
static void SetupColorsHiLoBits ( bool bHiBit, bool bLoBit,
|
||||
const int iBackground, const int iForeground,
|
||||
@@ -3664,6 +3670,69 @@ void DrawSubWindow_Data (Update_t bUpdate)
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void DrawBeamValue(int line, LPCTSTR name, int nValue, bool isVisible)
|
||||
{
|
||||
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_VIDEO_SCANNER_COLUMN;
|
||||
rect.right = rect.left + (5 * nFontWidth);
|
||||
|
||||
DebuggerSetColorFG(DebuggerGetColor(FG_INFO_CHAR_HI));
|
||||
DebuggerSetColorBG(DebuggerGetColor(VIDEO_INFO_BG));
|
||||
PrintText(name, rect);
|
||||
|
||||
|
||||
char sValue[8];
|
||||
if (g_videoScannerDisplayInfo.isDecimal)
|
||||
sprintf_s(sValue, sizeof(sValue), "%03u", nValue);
|
||||
else
|
||||
sprintf_s(sValue, sizeof(sValue), "%03X", nValue);
|
||||
|
||||
// Needs to be far enough over, since 4 chars of ZeroPage symbol also calls us
|
||||
int nOffset = 2;
|
||||
rect.left = DISPLAY_VIDEO_SCANNER_COLUMN + (nOffset * nFontWidth);
|
||||
|
||||
if (!isVisible)
|
||||
DebuggerSetColorFG(DebuggerGetColor(FG_DISASM_BP_S_X)); // red
|
||||
else
|
||||
DebuggerSetColorFG(DebuggerGetColor(FG_DISASM_BRANCH)); // green
|
||||
PrintText(sValue, rect);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void DrawBeamInfo (int line)
|
||||
{
|
||||
NTSC_VideoGetScannerAddressForDebugger(); // update g_nVideoClockHorz/g_nVideoClockVert
|
||||
|
||||
int v = g_nVideoClockVert;
|
||||
int h = g_nVideoClockHorz;
|
||||
|
||||
if (g_videoScannerDisplayInfo.isHorzReal)
|
||||
{
|
||||
h -= 13; // UTA2e ref?
|
||||
|
||||
if (h < 0)
|
||||
{
|
||||
h = h + 65;
|
||||
v = v - 1;
|
||||
if (v < 0)
|
||||
v = v + NTSC_GetVideoLines();
|
||||
}
|
||||
}
|
||||
|
||||
const bool isVisible = NTSC_IsVisible();
|
||||
|
||||
DrawBeamValue(line++, "h:", h, isVisible);
|
||||
DrawBeamValue(line++, "v:", v, isVisible);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void DrawSubWindow_Info ( Update_t bUpdate, int iWindow )
|
||||
{
|
||||
@@ -3676,6 +3745,10 @@ void DrawSubWindow_Info ( Update_t bUpdate, int iWindow )
|
||||
int yTarget = yStack + MAX_DISPLAY_STACK_LINES - 1; // 9
|
||||
int yZeroPage = 16; // yTarget
|
||||
int ySoft = yZeroPage + (2 * MAX_DISPLAY_ZEROPAGE_LINES) + !SOFTSWITCH_LANGCARD;
|
||||
int yBeam = ySoft - 3;
|
||||
|
||||
if (bUpdate & UPDATE_REGS)
|
||||
DrawBeamInfo(yBeam);
|
||||
|
||||
if ((bUpdate & UPDATE_REGS) || (bUpdate & UPDATE_FLAGS))
|
||||
DrawRegisters( yRegs );
|
||||
@@ -3705,7 +3778,8 @@ void DrawSubWindow_Info ( Update_t bUpdate, int iWindow )
|
||||
// Right Side
|
||||
int yBreakpoints = 0;
|
||||
int yWatches = yBreakpoints + MAX_BREAKPOINTS; // MAX_DISPLAY_BREAKPOINTS_LINES; // 7
|
||||
int yMemory = yWatches + (MAX_WATCHES*2); // MAX_DISPLAY_WATCHES_LINES ; // 14 // 2.7.0.15 Fixed: Memory Dump was over-writing watches
|
||||
const UINT numVideoScannerInfoLines = 4; // There used to be 2 extra watches (and each watch is 2 lines)
|
||||
int yMemory = yWatches + numVideoScannerInfoLines + (MAX_WATCHES*2); // MAX_DISPLAY_WATCHES_LINES ; // 14 // 2.7.0.15 Fixed: Memory Dump was over-writing watches
|
||||
|
||||
// if ((MAX_DISPLAY_BREAKPOINTS_LINES + MAX_DISPLAY_WATCHES_LINES) < 12)
|
||||
// yWatches++;
|
||||
|
||||
@@ -105,3 +105,14 @@
|
||||
|
||||
extern char g_aDebuggerVirtualTextScreen[ DEBUG_VIRTUAL_TEXT_HEIGHT ][ DEBUG_VIRTUAL_TEXT_WIDTH ];
|
||||
extern size_t Util_GetDebuggerText( char* &pText_ ); // Same API as Util_GetTextScreen()
|
||||
|
||||
class VideoScannerDisplayInfo
|
||||
{
|
||||
public:
|
||||
VideoScannerDisplayInfo() : isDecimal(true), isHorzReal(true) {}
|
||||
|
||||
bool isDecimal;
|
||||
bool isHorzReal;
|
||||
};
|
||||
|
||||
extern VideoScannerDisplayInfo g_videoScannerDisplayInfo;
|
||||
|
||||
@@ -473,6 +473,8 @@
|
||||
// , CMD_SYMBOLS_LOAD_1
|
||||
// , CMD_SYMBOLS_LOAD_2
|
||||
// , CMD_SYMBOLS_SAVE
|
||||
// Video-scanner info
|
||||
, CMD_VIDEO_SCANNER_INFO
|
||||
// View
|
||||
, CMD_VIEW_TEXT4X
|
||||
, CMD_VIEW_TEXT41
|
||||
@@ -719,6 +721,9 @@
|
||||
// Update_t CmdSymbolsAssembly (int nArgs);
|
||||
// Update_t CmdSymbolsSource (int nArgs);
|
||||
|
||||
// Video-scanner info
|
||||
Update_t CmdVideoScannerInfo (int nArgs);
|
||||
|
||||
// View
|
||||
Update_t CmdViewOutput_Text4X (int nArgs);
|
||||
Update_t CmdViewOutput_Text41 (int nArgs);
|
||||
@@ -1482,7 +1487,7 @@ const DisasmData_t* pDisasmData; // If != NULL then bytes are marked up as data
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_WATCHES = 8
|
||||
MAX_WATCHES = 6
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1717,6 +1717,12 @@ uint16_t NTSC_VideoGetScannerAddress ( const ULONG uExecutedCycles )
|
||||
return addr;
|
||||
}
|
||||
|
||||
uint16_t NTSC_VideoGetScannerAddressForDebugger(void)
|
||||
{
|
||||
ResetCyclesExecutedForDebugger(); // if in full-speed, then reset cycles so that CpuCalcCycles() doesn't ASSERT
|
||||
return NTSC_VideoGetScannerAddress(0);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void NTSC_SetVideoTextMode( int cols )
|
||||
{
|
||||
@@ -2311,3 +2317,13 @@ UINT NTSC_GetCyclesPerFrame(void)
|
||||
{
|
||||
return g_videoScanner6502Cycles;
|
||||
}
|
||||
|
||||
UINT NTSC_GetVideoLines(void)
|
||||
{
|
||||
return (GetVideoRefreshRate() == VR_50HZ) ? VIDEO_SCANNER_MAX_VERT_PAL : VIDEO_SCANNER_MAX_VERT;
|
||||
}
|
||||
|
||||
bool NTSC_IsVisible(void)
|
||||
{
|
||||
return (g_nVideoClockVert < VIDEO_SCANNER_Y_DISPLAY) && (g_nVideoClockHorz >= VIDEO_SCANNER_HORZ_START);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
extern uint32_t*NTSC_VideoGetChromaTable( bool bHueTypeMonochrome, bool bMonitorTypeColorTV );
|
||||
extern void NTSC_VideoClockResync( const DWORD dwCyclesThisFrame );
|
||||
extern uint16_t NTSC_VideoGetScannerAddress( const ULONG uExecutedCycles );
|
||||
extern uint16_t NTSC_VideoGetScannerAddressForDebugger(void);
|
||||
extern void NTSC_VideoInit( uint8_t *pFramebuffer );
|
||||
extern void NTSC_VideoReinitialize( DWORD cyclesThisFrame, bool bInitVideoScannerAddress );
|
||||
extern void NTSC_VideoInitAppleType();
|
||||
@@ -20,3 +21,5 @@
|
||||
enum VideoRefreshRate_e;
|
||||
void NTSC_SetRefreshRate(VideoRefreshRate_e rate);
|
||||
UINT NTSC_GetCyclesPerFrame(void);
|
||||
UINT NTSC_GetVideoLines(void);
|
||||
bool NTSC_IsVisible(void);
|
||||
|
||||
Reference in New Issue
Block a user