NTSC: only use accessors to get internal video clock vert/horz values

This commit is contained in:
tomcw 2023-01-14 14:08:42 +00:00
parent 1effb64226
commit d63a31a043
5 changed files with 20 additions and 16 deletions

View File

@ -1350,7 +1350,7 @@ int CheckBreakpointsVideo()
if (pBP->eSource != BP_SRC_VIDEO_SCANNER) if (pBP->eSource != BP_SRC_VIDEO_SCANNER)
continue; continue;
uint16_t vert = NTSC_GetVideoVForDebugger(); // update video scanner's vert/horz position - needed for when in fullspeed (GH#1164) uint16_t vert = NTSC_GetVideoVertForDebugger(); // update video scanner's vert/horz position - needed for when in fullspeed (GH#1164)
if (_CheckBreakpointValue(pBP, vert)) if (_CheckBreakpointValue(pBP, vert))
{ {
bBreakpointHit = BP_HIT_VIDEO_POS; bBreakpointHit = BP_HIT_VIDEO_POS;
@ -7893,7 +7893,7 @@ void OutputTraceLine ()
if (g_bTraceFileWithVideoScanner) if (g_bTraceFileWithVideoScanner)
{ {
uint16_t vert, horz; uint16_t vert, horz;
NTSC_GetVideoHVForDebugger(vert, horz); // update video scanner's vert/horz position - needed for when in fullspeed (GH#1164) NTSC_GetVideoVertHorzForDebugger(vert, horz); // update video scanner's vert/horz position - needed for when in fullspeed (GH#1164)
uint32_t data; uint32_t data;
int dataSize; int dataSize;
@ -8519,7 +8519,7 @@ void DebugContinueStepping(const bool bCallerWillUpdateDisplay/*=false*/)
stopReason = (g_LBR == LBR_UNDEFINED) ? StrFormat("Interrupt occurred (LBR unknown)") stopReason = (g_LBR == LBR_UNDEFINED) ? StrFormat("Interrupt occurred (LBR unknown)")
: StrFormat("Interrupt occurred at $%04X", g_LBR); : StrFormat("Interrupt occurred at $%04X", g_LBR);
else if (g_bDebugBreakpointHit & BP_HIT_VIDEO_POS) else if (g_bDebugBreakpointHit & BP_HIT_VIDEO_POS)
stopReason = StrFormat("Video scanner position matches at vpos=$%04X", NTSC_GetVideoVForDebugger()); stopReason = StrFormat("Video scanner position matches at vpos=$%04X", NTSC_GetVideoVertForDebugger());
else if (g_bDebugBreakpointHit & BP_DMA_TO_IO_MEM) else if (g_bDebugBreakpointHit & BP_DMA_TO_IO_MEM)
stopReason = StrFormat("HDD DMA to I/O memory or ROM at $%04X", g_DebugBreakOnDMAIO.memoryAddr); stopReason = StrFormat("HDD DMA to I/O memory or ROM at $%04X", g_DebugBreakOnDMAIO.memoryAddr);
else if (g_bDebugBreakpointHit & BP_DMA_FROM_IO_MEM) else if (g_bDebugBreakpointHit & BP_DMA_FROM_IO_MEM)

View File

@ -3232,7 +3232,7 @@ static void DrawVideoScannerValue(int line, int vert, int horz, bool isVisible)
static void DrawVideoScannerInfo(int line) static void DrawVideoScannerInfo(int line)
{ {
uint16_t v, h; uint16_t v, h;
NTSC_GetVideoHVForDebugger(v, h); // update video scanner's vert/horz position - needed for when in fullspeed (GH#1164) NTSC_GetVideoVertHorzForDebugger(v, h); // update video scanner's vert/horz position - needed for when in fullspeed (GH#1164)
if (g_videoScannerDisplayInfo.isHorzReal) if (g_videoScannerDisplayInfo.isHorzReal)
{ {

View File

@ -69,8 +69,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Globals (Public) ___________________________________________________ // Globals (Public) ___________________________________________________
uint16_t g_nVideoClockVert = 0; // 9-bit: VC VB VA V5 V4 V3 V2 V1 V0 = 0 .. 262 static uint16_t g_nVideoClockVert = 0; // 9-bit: VC VB VA V5 V4 V3 V2 V1 V0 = 0 .. 262
uint16_t g_nVideoClockHorz = 0; // 6-bit: H5 H4 H3 H2 H1 H0 = 0 .. 64, 25 >= visible (NB. final hpos is 2 cycles long, so a line is 65 cycles) static uint16_t g_nVideoClockHorz = 0; // 6-bit: H5 H4 H3 H2 H1 H0 = 0 .. 64, 25 >= visible (NB. final hpos is 2 cycles long, so a line is 65 cycles)
// Globals (Private) __________________________________________________ // Globals (Private) __________________________________________________
static int g_nVideoCharSet = 0; static int g_nVideoCharSet = 0;
@ -1940,7 +1940,12 @@ uint16_t NTSC_VideoGetScannerAddress ( const ULONG uExecutedCycles )
return addr; return addr;
} }
void NTSC_GetVideoHVForDebugger(uint16_t& vert, uint16_t& horz) uint16_t NTSC_GetVideoVert(void)
{
return g_nVideoClockVert;
}
void NTSC_GetVideoVertHorzForDebugger(uint16_t& vert, uint16_t& horz)
{ {
ResetCyclesExecutedForDebugger(); // if in full-speed, then reset cycles so that CpuCalcCycles() doesn't ASSERT ResetCyclesExecutedForDebugger(); // if in full-speed, then reset cycles so that CpuCalcCycles() doesn't ASSERT
NTSC_VideoGetScannerAddress(0); NTSC_VideoGetScannerAddress(0);
@ -1948,10 +1953,10 @@ void NTSC_GetVideoHVForDebugger(uint16_t& vert, uint16_t& horz)
horz = g_nVideoClockHorz; horz = g_nVideoClockHorz;
} }
uint16_t NTSC_GetVideoVForDebugger(void) uint16_t NTSC_GetVideoVertForDebugger(void)
{ {
uint16_t vert, horz; uint16_t vert, horz;
NTSC_GetVideoHVForDebugger(vert, horz); NTSC_GetVideoVertHorzForDebugger(vert, horz);
return vert; return vert;
} }

View File

@ -3,8 +3,6 @@
#include "Video.h" // NB. needed by GCC (for fwd enum declaration) #include "Video.h" // NB. needed by GCC (for fwd enum declaration)
// Globals (Public) // Globals (Public)
extern uint16_t g_nVideoClockVert;
extern uint16_t g_nVideoClockHorz;
extern uint32_t g_nChromaSize; extern uint32_t g_nChromaSize;
// Prototypes (Public) ________________________________________________ // Prototypes (Public) ________________________________________________
@ -14,8 +12,9 @@ void NTSC_SetVideoTextMode(int cols);
uint32_t* NTSC_VideoGetChromaTable(bool bHueTypeMonochrome, bool bMonitorTypeColorTV); uint32_t* NTSC_VideoGetChromaTable(bool bHueTypeMonochrome, bool bMonitorTypeColorTV);
void NTSC_VideoClockResync(const DWORD dwCyclesThisFrame); void NTSC_VideoClockResync(const DWORD dwCyclesThisFrame);
uint16_t NTSC_VideoGetScannerAddress(const ULONG uExecutedCycles); uint16_t NTSC_VideoGetScannerAddress(const ULONG uExecutedCycles);
void NTSC_GetVideoHVForDebugger(uint16_t& vert, uint16_t& horz); uint16_t NTSC_GetVideoVert(void);
uint16_t NTSC_GetVideoVForDebugger(void); void NTSC_GetVideoVertHorzForDebugger(uint16_t& vert, uint16_t& horz);
uint16_t NTSC_GetVideoVertForDebugger(void);
void NTSC_Destroy(void); void NTSC_Destroy(void);
void NTSC_VideoInit(uint8_t *pFramebuffer); void NTSC_VideoInit(uint8_t *pFramebuffer);
void NTSC_VideoReinitialize(DWORD cyclesThisFrame, bool bInitVideoScannerAddress); void NTSC_VideoReinitialize(DWORD cyclesThisFrame, bool bInitVideoScannerAddress);

View File

@ -156,7 +156,7 @@ void Video::VideoReinitialize(bool bInitVideoScannerAddress)
NTSC_VideoInitAppleType(); NTSC_VideoInitAppleType();
NTSC_SetVideoStyle(); NTSC_SetVideoStyle();
NTSC_SetVideoTextMode( g_uVideoMode & VF_80COL ? 80 : 40 ); NTSC_SetVideoTextMode( g_uVideoMode & VF_80COL ? 80 : 40 );
NTSC_SetVideoMode( g_uVideoMode ); // Pre-condition: g_nVideoClockHorz (derived from g_dwCyclesThisFrame) NTSC_SetVideoMode( g_uVideoMode );
VideoSwitchVideocardPalette(RGB_GetVideocard(), GetVideoType()); VideoSwitchVideocardPalette(RGB_GetVideocard(), GetVideoType());
} }
@ -455,7 +455,7 @@ bool Video::VideoGetVblBarEx(const DWORD dwCyclesThisFrame)
NTSC_VideoClockResync(dwCyclesThisFrame); NTSC_VideoClockResync(dwCyclesThisFrame);
} }
return g_nVideoClockVert < kVDisplayableScanLines; return NTSC_GetVideoVert() < kVDisplayableScanLines;
} }
// Called when *inside* CpuExecute() // Called when *inside* CpuExecute()
@ -467,7 +467,7 @@ bool Video::VideoGetVblBar(const DWORD uExecutedCycles)
NTSC_VideoClockResync(CpuGetCyclesThisVideoFrame(uExecutedCycles)); NTSC_VideoClockResync(CpuGetCyclesThisVideoFrame(uExecutedCycles));
} }
return g_nVideoClockVert < kVDisplayableScanLines; return NTSC_GetVideoVert() < kVDisplayableScanLines;
} }
//=========================================================================== //===========================================================================