C64: Actually proper border checking.

This commit is contained in:
SaxxonPike 2019-07-25 22:35:12 -05:00
parent e4a3c2f410
commit fba98fef2c
2 changed files with 13 additions and 16 deletions

View File

@ -9,8 +9,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
private const int BorderLeft40 = 0x018;
private const int BorderRight38 = 0x14F;
private const int BorderRight40 = 0x158;
private const int BorderTop25 = 0x033 - 1;
private const int BorderTop24 = 0x037 - 1;
private const int BorderTop25 = 0x033;
private const int BorderTop24 = 0x037;
private const int BorderBottom25 = 0x0FB;
private const int BorderBottom24 = 0x0F7;
private const int BadLineEnableRaster = 0x030;

View File

@ -19,6 +19,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
http://www.classiccmp.org/cini/pdf/Commodore/ds_6567.pdf
- Michael Huth for die shots of the 6569R3 chip (to get ideas how to implement)
http://mail.lipsia.de/~enigma/neu/6581.html
- US Patent US4561659, inventors: James W. Redfield; Albert J. Charpentier
https://patents.google.com/patent/US4561659
*/
public Func<int, int> ReadColorRam;
@ -194,20 +196,6 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
// advance cycle and optionally raster line
_cycle++;
if (_cycle == _totalCycles)
{
// border check
if (_rasterLine == _borderB)
{
_borderOnVertical = true;
}
if (_rasterLine == _borderT && _displayEnable)
{
_borderOnVertical = false;
}
}
if (_cycle > _totalCycles)
{
// vblank check
@ -276,6 +264,15 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
// phi2
_dataCPrev >>= 12;
// border check
if (_cycle == _totalCycles)
{
if (_rasterLine == _borderB)
_borderOnVertical = true;
else if (_rasterLine == _borderT - 1 && _displayEnable)
_borderOnVertical = false;
}
// display enable compare
if (_rasterLine == BadLineEnableRaster)
{