Commodore64: Video chip framework maintenance.
This commit is contained in:
parent
4efe07378f
commit
e9d4c09ad1
|
@ -106,6 +106,9 @@
|
||||||
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Cia.Internal.cs" />
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Cia.Internal.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Sid.SoundProvider.cs" />
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Sid.SoundProvider.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Userport.cs" />
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Userport.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.Cache.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.State.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.Timing.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.VideoProvider.cs" />
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.VideoProvider.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Experimental\Chips\MOS6581.cs" />
|
<Compile Include="Computers\Commodore64\Experimental\Chips\MOS6581.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Experimental\IMotherboard.cs" />
|
<Compile Include="Computers\Commodore64\Experimental\IMotherboard.cs" />
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public abstract partial class Vic
|
||||||
|
{
|
||||||
|
public void Precache()
|
||||||
|
{
|
||||||
|
cachedAEC = (pixelTimer >= 4);
|
||||||
|
cachedBA = ba;
|
||||||
|
cachedIRQ = irq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,120 +7,16 @@ namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
{
|
{
|
||||||
public abstract partial class Vic
|
public abstract partial class Vic
|
||||||
{
|
{
|
||||||
public Func<int> InputAddress;
|
public Action ClockPhi0;
|
||||||
public Func<int> InputData;
|
public Func<int, int> ReadColorRam;
|
||||||
public Func<bool> InputRead;
|
public Func<int, int> ReadRam;
|
||||||
|
|
||||||
public Vic()
|
public bool AEC { get { return cachedAEC; } }
|
||||||
{
|
public bool BA { get { return cachedBA; } }
|
||||||
backgroundColor = new int[4];
|
public bool IRQ { get { return cachedIRQ; } }
|
||||||
spriteMultiColor = new int[2];
|
|
||||||
sprites = new Sprite[8];
|
|
||||||
for (int i = 0; i < 8; i++)
|
|
||||||
sprites[i] = new Sprite();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Address
|
public bool OutputAEC() { return AEC; }
|
||||||
{
|
public bool OutputBA() { return BA; }
|
||||||
get
|
public bool OutputIRQ() { return IRQ; }
|
||||||
{
|
|
||||||
return cachedADDR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AEC
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return cachedAEC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool BA
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return cachedBA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CAS
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return cachedCAS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Data
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return cachedDATA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IRQ
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return cachedIRQ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int OutputAddress()
|
|
||||||
{
|
|
||||||
return Address;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OutputAEC()
|
|
||||||
{
|
|
||||||
return AEC;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OutputBA()
|
|
||||||
{
|
|
||||||
return BA;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OutputCAS()
|
|
||||||
{
|
|
||||||
return CAS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int OutputData()
|
|
||||||
{
|
|
||||||
return Data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OutputIRQ()
|
|
||||||
{
|
|
||||||
return IRQ;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool OutputRAS()
|
|
||||||
{
|
|
||||||
return RAS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool RAS
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return cachedRAS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Precache()
|
|
||||||
{
|
|
||||||
cachedAEC = (pixelTimer >= 4);
|
|
||||||
cachedBA = ba;
|
|
||||||
cachedCAS = cas;
|
|
||||||
cachedDATA = data;
|
|
||||||
cachedIRQ = irq;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SyncState(Serializer ser) { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,11 @@ using System.Text;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
{
|
{
|
||||||
public partial class Vic
|
public abstract partial class Vic
|
||||||
{
|
{
|
||||||
int cachedADDR;
|
|
||||||
bool cachedAEC;
|
bool cachedAEC;
|
||||||
bool cachedBA;
|
bool cachedBA;
|
||||||
bool cachedCAS;
|
|
||||||
int cachedDATA;
|
|
||||||
bool cachedIRQ;
|
bool cachedIRQ;
|
||||||
bool cachedRAS;
|
|
||||||
|
|
||||||
class Sprite
|
class Sprite
|
||||||
{
|
{
|
||||||
|
@ -67,23 +63,25 @@ namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
int videoCounterBase;
|
int videoCounterBase;
|
||||||
int videoMatrixLineIndex;
|
int videoMatrixLineIndex;
|
||||||
|
|
||||||
|
public Vic()
|
||||||
|
{
|
||||||
|
backgroundColor = new int[4];
|
||||||
|
spriteMultiColor = new int[2];
|
||||||
|
sprites = new Sprite[8];
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
sprites[i] = new Sprite();
|
||||||
|
}
|
||||||
|
|
||||||
public void Clock()
|
public void Clock()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// at the end, clock other devices if applicable
|
||||||
if (pixelTimer == 0)
|
if (pixelTimer == 0)
|
||||||
{
|
{
|
||||||
pixelTimer = 8;
|
pixelTimer = 8;
|
||||||
badLineEnable |= (rasterY == 0x30 && displayEnable);
|
ClockPhi0();
|
||||||
badLineCondition = (
|
|
||||||
badLineEnable &&
|
|
||||||
rasterY >= 0x030 &&
|
|
||||||
rasterY <= 0x0F7 &&
|
|
||||||
(rasterY & 0x007) == yScroll
|
|
||||||
);
|
|
||||||
if (!idleState && badLineCondition)
|
|
||||||
idleState = true;
|
|
||||||
}
|
}
|
||||||
pixelTimer--;
|
pixelTimer--;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public abstract partial class Vic
|
||||||
|
{
|
||||||
|
public void SyncState(Serializer ser)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public abstract partial class Vic
|
||||||
|
{
|
||||||
|
protected struct CycleTiming
|
||||||
|
{
|
||||||
|
public int CharacterCycle;
|
||||||
|
public int RefreshCycle;
|
||||||
|
public int SpriteCycle;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected struct DisplayTiming
|
||||||
|
{
|
||||||
|
public int CyclesPerLine;
|
||||||
|
public int HBlankStart;
|
||||||
|
public int HBlankEnd;
|
||||||
|
public int LeftXCoordinate;
|
||||||
|
public int LinesPerFrame;
|
||||||
|
public int VBlankStart;
|
||||||
|
public int VBlankEnd;
|
||||||
|
public int VisibleLines;
|
||||||
|
public int VisiblePixels;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class VicTiming
|
||||||
|
{
|
||||||
|
public CycleTiming Cycle;
|
||||||
|
public DisplayTiming Display;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum FetchState
|
||||||
|
{
|
||||||
|
Idle,
|
||||||
|
Graphics,
|
||||||
|
Color,
|
||||||
|
Refresh,
|
||||||
|
Sprite,
|
||||||
|
Pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
int characterCycleCount;
|
||||||
|
int refreshCycleCount;
|
||||||
|
int spriteCycleCount;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue