Added H Counter to try and fix Sonic demo - didn't work
This commit is contained in:
@@ -119,6 +119,25 @@ namespace Core.Video
|
||||
return (byte)(_currentScanline - 6);
|
||||
}
|
||||
}
|
||||
public byte ReadHCounter()
|
||||
{
|
||||
// The Master System H-Counter is a notoriously weird 8-bit timer.
|
||||
// It counts from 0x00 to 0x93, then jumps forward to 0xE9, ending at 0xFF.
|
||||
|
||||
// 1 T-State = 1.5 pixels. The H-Counter increments every 2 pixels.
|
||||
// So H = T * 0.75
|
||||
int h = (int)(_tStateCounter * 0.75);
|
||||
|
||||
if (h <= 0x93)
|
||||
{
|
||||
return (byte)h;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Emulate the hardware jump!
|
||||
return (byte)(h - 0x94 + 0xE9);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(int tStates)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user