diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.TimingBuilder.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.TimingBuilder.cs index e3ecb1fcf3..da2427fcff 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.TimingBuilder.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.TimingBuilder.cs @@ -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; diff --git a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs index 196bcedfaa..7d91d1fa7b 100644 --- a/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs +++ b/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs @@ -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 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) {