Tried to fix Sonic 1 demo loop
This commit is contained in:
@@ -104,11 +104,21 @@ namespace Core.Video
|
|||||||
|
|
||||||
public byte ReadVCounter()
|
public byte ReadVCounter()
|
||||||
{
|
{
|
||||||
// Note: On real NTSC hardware, the V-Counter jumps slightly around
|
// NTSC Hardware Quirk: The Master System outputs 262 lines,
|
||||||
// the VBlank period to keep the math 8-bit, but simply returning
|
// but an 8-bit register can only hold a maximum value of 255!
|
||||||
// the raw current scanline is perfectly fine to get us booting!
|
// To prevent a hardware overflow to 0, the silicon jumps backward during VBlank.
|
||||||
|
|
||||||
|
if (_currentScanline <= 218) // 0xDA
|
||||||
|
{
|
||||||
return (byte)_currentScanline;
|
return (byte)_currentScanline;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// At scanline 219, the counter jumps back to 213 (0xD5).
|
||||||
|
// It then counts up to exactly 255 (0xFF) at the end of the frame.
|
||||||
|
return (byte)(_currentScanline - 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Update(int tStates)
|
public void Update(int tStates)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user