Video: fix floating bus in new function getVideoScannerAddressTXTorHGR():

. when 'in mixed mode && vert >= 160' return text (not hires) video memory
This commit is contained in:
tomcw 2022-10-02 20:23:54 +01:00
parent dfaaa2823e
commit 9df0ea1e21
4 changed files with 25 additions and 30 deletions

View File

@ -7801,15 +7801,16 @@ void OutputTraceLine ()
if (g_bTraceFileWithVideoScanner)
{
uint16_t addr = NTSC_VideoGetScannerAddressForDebugger();
BYTE data = mem[addr];
uint32_t data;
int dataSize;
uint16_t addr = NTSC_GetScannerAddressAndData(data, dataSize);
fprintf( g_hTraceFile,
"%04X %04X %04X %02X %02X %02X %02X %04X %s %s\n",
g_nVideoClockVert,
g_nVideoClockHorz,
addr,
data,
(uint8_t)data, // truncated
(unsigned)regs.a,
(unsigned)regs.x,
(unsigned)regs.y,

View File

@ -3231,7 +3231,7 @@ static void DrawVideoScannerValue(int line, int vert, int horz, bool isVisible)
//===========================================================================
static void DrawVideoScannerInfo(int line)
{
NTSC_VideoGetScannerAddressForDebugger(); // update g_nVideoClockHorz/g_nVideoClockVert
NTSC_UpdateVideoHVForDebugger(); // update g_nVideoClockHorz/g_nVideoClockVert
int v = g_nVideoClockVert;
int h = g_nVideoClockHorz;

View File

@ -319,8 +319,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
INLINE void updatePixels( uint16_t bits );
INLINE void updateVideoScannerHorzEOL();
INLINE void updateVideoScannerAddress();
INLINE uint16_t getVideoScannerAddressTXT();
INLINE uint16_t getVideoScannerAddressHGR();
static void initChromaPhaseTables();
static real initFilterChroma (real z);
@ -869,6 +867,19 @@ INLINE uint16_t getVideoScannerAddressHGR()
return nAddress;
}
//===========================================================================
INLINE uint16_t getVideoScannerAddressTXTorHGR()
{
const bool isTextAddr = ((g_nVideoMixed && g_nVideoClockVert >= VIDEO_SCANNER_Y_MIXED) ||
(g_uNewVideoModeFlags & VF_TEXT) ||
!(g_uNewVideoModeFlags & VF_HIRES));
if (isTextAddr)
return getVideoScannerAddressTXT();
else
return getVideoScannerAddressHGR();
}
//===========================================================================
INLINE uint16_t getVideoScannerAddressSHR()
{
@ -1915,12 +1926,7 @@ uint16_t NTSC_VideoGetScannerAddress ( const ULONG uExecutedCycles )
g_nVideoClockVert = g_videoScannerMaxVert-1;
}
uint16_t addr;
bool bHires = (GetVideo().GetVideoMode() & VF_HIRES) && !(GetVideo().GetVideoMode() & VF_TEXT); // SW_HIRES && !SW_TEXT
if( bHires )
addr = getVideoScannerAddressHGR();
else
addr = getVideoScannerAddressTXT();
uint16_t addr = getVideoScannerAddressTXTorHGR();
g_nVideoClockVert = currVideoClockVert;
g_nVideoClockHorz = currVideoClockHorz;
@ -1928,10 +1934,10 @@ uint16_t NTSC_VideoGetScannerAddress ( const ULONG uExecutedCycles )
return addr;
}
uint16_t NTSC_VideoGetScannerAddressForDebugger(void)
void NTSC_UpdateVideoHVForDebugger(void)
{
ResetCyclesExecutedForDebugger(); // if in full-speed, then reset cycles so that CpuCalcCycles() doesn't ASSERT
return NTSC_VideoGetScannerAddress(0);
NTSC_VideoGetScannerAddress(0);
}
//===========================================================================
@ -2722,11 +2728,9 @@ bool NTSC_IsVisible(void)
// For debugger
uint16_t NTSC_GetScannerAddressAndData(uint32_t& data, int& dataSize)
{
uint16_t addr = 0;
if (g_uNewVideoModeFlags & VF_SHR)
{
addr = getVideoScannerAddressSHR();
uint16_t addr = getVideoScannerAddressSHR();
uint32_t* pAux = (uint32_t*)MemGetAuxPtr(addr); // 8 pixels (320 mode) / 16 pixels (640 mode)
data = pAux[0];
dataSize = 4;
@ -2735,17 +2739,6 @@ uint16_t NTSC_GetScannerAddressAndData(uint32_t& data, int& dataSize)
//
if ( (g_nVideoMixed && g_nVideoClockVert >= VIDEO_SCANNER_Y_MIXED) ||
(g_uNewVideoModeFlags & VF_TEXT) ||
!(g_uNewVideoModeFlags & VF_HIRES) )
{
addr = getVideoScannerAddressTXT();
}
else
{
addr = getVideoScannerAddressHGR();
}
// Copy logic from NTSC_SetVideoMode()
if (g_uNewVideoModeFlags & VF_TEXT)
{
@ -2787,8 +2780,9 @@ uint16_t NTSC_GetScannerAddressAndData(uint32_t& data, int& dataSize)
if (g_nVideoMixed && g_nVideoClockVert >= VIDEO_SCANNER_Y_MIXED && (g_uNewVideoModeFlags & VF_80COL))
dataSize = 2;
uint16_t addr = getVideoScannerAddressTXTorHGR();
data = 0;
if (dataSize == 2)
{
uint8_t* pAux = MemGetAuxPtr(addr);

View File

@ -14,7 +14,7 @@ void NTSC_SetVideoTextMode(int cols);
uint32_t* NTSC_VideoGetChromaTable(bool bHueTypeMonochrome, bool bMonitorTypeColorTV);
void NTSC_VideoClockResync(const DWORD dwCyclesThisFrame);
uint16_t NTSC_VideoGetScannerAddress(const ULONG uExecutedCycles);
uint16_t NTSC_VideoGetScannerAddressForDebugger(void);
void NTSC_UpdateVideoHVForDebugger(void);
void NTSC_Destroy(void);
void NTSC_VideoInit(uint8_t *pFramebuffer);
void NTSC_VideoReinitialize(DWORD cyclesThisFrame, bool bInitVideoScannerAddress);