MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / updateVideoScannerAddress

Function updateVideoScannerAddress

source/NTSC.cpp:748–804  ·  view source on GitHub ↗

===========================================================================

Source from the content-addressed store, hash-verified

746
747//===========================================================================
748inline void updateVideoScannerAddress()
749{
750 if (g_nVideoMixed && GetVideo().GetVideoRefreshRate() == VR_50HZ) // GH#763
751 {
752 if (g_nVideoClockVert >= VIDEO_SCANNER_Y_MIXED)
753 g_nColorBurstPixels = 0; // instantaneously kill color-burst!
754 else if (g_nVideoClockVert == 0 && (GetVideo().GetVideoMode() & VF_TEXT) == 0)
755 g_nColorBurstPixels = 1024; // setup for line-0 (when TEXT is off), ie. so GetColorBurst() returns true below (GH#1119)
756 }
757
758 if (g_pFuncUpdateGraphicsScreen == updateScreenSHR)
759 {
760 g_pVideoAddress = g_nVideoClockVert < VIDEO_SCANNER_Y_DISPLAY_IIGS ? g_pScanLines[2 * g_nVideoClockVert] : g_pScanLines[0];
761 return;
762 }
763
764 g_pVideoAddress = g_nVideoClockVert < VIDEO_SCANNER_Y_DISPLAY ? g_pScanLines[2 * g_nVideoClockVert] : g_pScanLines[0];
765
766 // Adjust, as these video styles have 2x 14M pixels of pre-render
767 // NB. For VT_COLOR_MONITOR_NTSC, also check color-burst so that TEXT and MIXED(HGR+TEXT) render the TEXT at the same offset (GH#341)
768 if (GetVideo().GetVideoType() == VT_MONO_TV || GetVideo().GetVideoType() == VT_COLOR_TV || (GetVideo().GetVideoType() == VT_COLOR_MONITOR_NTSC && GetColorBurst()))
769 g_pVideoAddress -= 2;
770
771 // GH#555: For the 14M video modes (DHGR,DGR,80COL), start rendering 1x 14M pixel early to account for these video modes being shifted right by 1 pixel
772 // NB. This 1 pixel shift right is a workaround for the 14M video modes that actually start 7x 14M pixels to the left on *real h/w*.
773 // . 7x 14M pixels early + 1x 14M pixel shifted right = 2 complete color phase rotations.
774 // . ie. the 14M colors are correct, but being 1 pixel out is the closest we can get the 7M and 14M video modes to overlap.
775 // . The alternative is to render the 14M correctly 7 pixels early, but have 7-pixel borders left (for 7M modes) or right (for 14M modes).
776 if (((g_pFuncUpdateGraphicsScreen == updateScreenDoubleHires80) ||
777 (g_pFuncUpdateGraphicsScreen == updateScreenDoubleLores80) ||
778 (g_pFuncUpdateGraphicsScreen == updateScreenText80) ||
779 (g_pFuncUpdateGraphicsScreen == updateScreenText80RGB) ||
780 (g_nVideoMixed && g_nVideoClockVert >= VIDEO_SCANNER_Y_MIXED && (g_pFuncUpdateTextScreen == updateScreenText80 || g_pFuncUpdateGraphicsScreen == updateScreenText80RGB)))
781 && (GetVideo().GetVideoType() != VT_COLOR_IDEALIZED) && (GetVideo().GetVideoType() != VT_COLOR_VIDEOCARD_RGB)) // Fix for "Ansi Story" (Turn the disk over) - Top row of TEXT80 is shifted by 1 pixel
782 {
783 g_pVideoAddress -= 1;
784 }
785
786 // Centre the older //e video modes when running with a VidHD
787 g_pVideoAddress += GetVideo().GetFrameBufferCentringValue();
788
789 if (GetVideo().HasVidHD())
790 {
791 if (GetVideo().GetVideoType() == VT_COLOR_MONITOR_NTSC)
792 {
793 // EG. Switching between TEXT (full 24 lines) and MIXED (HGR with purple vertical line-0)
794 // - AppleWin-Test repo, Tests-Various.dsk, option-C
795 g_pVideoAddress -= 2;
796 *(uint32_t*)g_pVideoAddress++ = 0 | ALPHA32_MASK;
797 *(uint32_t*)g_pVideoAddress++ = 0 | ALPHA32_MASK;
798 }
799 }
800
801 g_nColorPhaseNTSC = INITIAL_COLOR_PHASE;
802 g_nLastColumnPixelNTSC = 0;
803 g_nSignalBitsNTSC = 0;
804}
805

Calls 6

GetColorBurstFunction · 0.85
GetVideoRefreshRateMethod · 0.80
GetVideoModeMethod · 0.80
GetVideoTypeMethod · 0.80
HasVidHDMethod · 0.80

Tested by

no test coverage detected