mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-03-28 04:35:23 +00:00
Some video-related comment clean up & simplified VideoGetVblBar()
This commit is contained in:
parent
b8b90a6bd9
commit
3e0d399665
@ -1506,18 +1506,21 @@ void MemReset()
|
||||
BYTE MemReadFloatingBus(const ULONG uExecutedCycles)
|
||||
{
|
||||
#if 0
|
||||
// TC (11/12/2016) This comment is out of date.
|
||||
// - TODO: Check "Rainbow" Bug #254, then remove this comment
|
||||
|
||||
// NTSC: It is tempting to replace with
|
||||
// return NTSC_VideoGetScannerAddress( );
|
||||
// But that breaks "Rainbow" Bug #254 if NTSC_VideoGetScannerAddress() is not correct.
|
||||
// This is out of sync with VideoGetScannerAddress() due to two reasons:
|
||||
// This is out of sync with VideoGetScannerAddress() due to this reason:
|
||||
// a) returning a cached copy of g_aHorzClockMemAddress
|
||||
// Fixed by calling: updateVideoScannerAddressTXT or updateVideoScannerAddressHGR()
|
||||
// b) A bug? in APPLE_IIE_HORZ_CLOCK_OFFSET[0][8] containing the incorrect value of 0x006F
|
||||
uint16_t addr1 = NTSC_VideoGetScannerAddress();
|
||||
uint16_t addr2 = VideoGetScannerAddress(NULL, uExecutedCycles);
|
||||
_ASSERT(addr1 == addr2);
|
||||
#endif
|
||||
return mem[ VideoGetScannerAddress(NULL, uExecutedCycles) ];
|
||||
// return mem[ VideoGetScannerAddress(NULL, uExecutedCycles) ]; // NG: ANSI STORY (End Credits) - repro by running from "Turn the disk over"
|
||||
return mem[ NTSC_VideoGetScannerAddress() ]; // OK: This does the 2-cycle adjust for ANSI STORY (End Credits)
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -287,7 +287,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
static unsigned APPLE_IIE_HORZ_CLOCK_OFFSET[5][VIDEO_SCANNER_MAX_HORZ] =
|
||||
{
|
||||
{0x0068,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, // bug? 0x106F - see comment in Memory.cpp, MemReadFloatingBus(const ULONG)
|
||||
{0x0068,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
|
||||
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
|
||||
|
@ -227,6 +227,7 @@ int const kPALVSyncLine = 264; // line when VSync starts (PAL)
|
||||
int const kVLine0State = 0x100; // V[543210CBA] = 100000000
|
||||
int const kVPresetLine = 256; // line when V state presets
|
||||
int const kVSyncLines = 4; // lines per VSync duration
|
||||
int const kVDisplayableScanLines = 192; // max displayable scanlines
|
||||
|
||||
static COLORREF customcolors[256]; // MONOCHROME is last custom color
|
||||
|
||||
@ -884,10 +885,6 @@ BYTE VideoCheckMode (WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles)
|
||||
BYTE VideoCheckVbl ( ULONG uExecutedCycles )
|
||||
{
|
||||
bool bVblBar = VideoGetVblBar(uExecutedCycles);
|
||||
// NTSC: It is tempting to replace with
|
||||
// bool bVblBar = !NTSC_VideoIsVbl();
|
||||
// But during full-speed, the NTSC video-scanner is not updated, so video-dependent Apple II code can hang
|
||||
|
||||
BYTE r = KeybGetKeycode();
|
||||
return (r & ~0x80) | (bVblBar ? 0x80 : 0);
|
||||
}
|
||||
@ -1549,40 +1546,18 @@ WORD VideoGetScannerAddress(bool* pbVblBar_OUT, const DWORD uExecutedCycles)
|
||||
|
||||
//===========================================================================
|
||||
|
||||
// Derived from VideoGetScannerAddress()
|
||||
bool VideoGetVblBar(const DWORD uExecutedCycles)
|
||||
{
|
||||
// get video scanner position
|
||||
//
|
||||
int nCycles = CpuGetCyclesThisVideoFrame(uExecutedCycles);
|
||||
// get video scanner position
|
||||
int nCycles = CpuGetCyclesThisVideoFrame(uExecutedCycles);
|
||||
|
||||
// calculate video parameters according to display standard
|
||||
//
|
||||
int nScanLines = bVideoScannerNTSC ? kNTSCScanLines : kPALScanLines;
|
||||
int nScanCycles = nScanLines * kHClocks;
|
||||
nCycles %= nScanCycles;
|
||||
// calculate video parameters according to display standard
|
||||
const int kScanLines = bVideoScannerNTSC ? kNTSCScanLines : kPALScanLines;
|
||||
const int kScanCycles = kScanLines * kHClocks;
|
||||
nCycles %= kScanCycles;
|
||||
|
||||
// calculate vertical scanning state
|
||||
//
|
||||
int nVLine = nCycles / kHClocks; // which vertical scanning line
|
||||
int nVState = kVLine0State + nVLine; // V state bits
|
||||
if ((nVLine >= kVPresetLine)) // check for previous vertical state preset
|
||||
{
|
||||
nVState -= nScanLines; // compensate for preset
|
||||
}
|
||||
int v_3 = (nVState >> 6) & 1;
|
||||
int v_4 = (nVState >> 7) & 1;
|
||||
|
||||
// update VBL' state
|
||||
//
|
||||
if (v_4 & v_3) // VBL?
|
||||
{
|
||||
return false; // Y: VBL' is false
|
||||
}
|
||||
else
|
||||
{
|
||||
return true; // N: VBL' is true
|
||||
}
|
||||
// VBL'
|
||||
return nCycles < kVDisplayableScanLines * kHClocks;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user