Commodore64: Video chip framework maintenance.

This commit is contained in:
saxxonpike 2013-08-18 02:21:32 +00:00
parent 4efe07378f
commit e9d4c09ad1
6 changed files with 106 additions and 128 deletions

View File

@ -106,6 +106,9 @@
<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\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\MOS6581.cs" />
<Compile Include="Computers\Commodore64\Experimental\IMotherboard.cs" />

View File

@ -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;
}
}
}

View File

@ -7,120 +7,16 @@ namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
{
public abstract partial class Vic
{
public Func<int> InputAddress;
public Func<int> InputData;
public Func<bool> InputRead;
public Action ClockPhi0;
public Func<int, int> ReadColorRam;
public Func<int, int> ReadRam;
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 bool AEC { get { return cachedAEC; } }
public bool BA { get { return cachedBA; } }
public bool IRQ { get { return cachedIRQ; } }
public int Address
{
get
{
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) { }
public bool OutputAEC() { return AEC; }
public bool OutputBA() { return BA; }
public bool OutputIRQ() { return IRQ; }
}
}

View File

@ -5,15 +5,11 @@ using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
{
public partial class Vic
public abstract partial class Vic
{
int cachedADDR;
bool cachedAEC;
bool cachedBA;
bool cachedCAS;
int cachedDATA;
bool cachedIRQ;
bool cachedRAS;
class Sprite
{
@ -67,23 +63,25 @@ namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
int videoCounterBase;
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()
{
// at the end, clock other devices if applicable
if (pixelTimer == 0)
{
pixelTimer = 8;
badLineEnable |= (rasterY == 0x30 && displayEnable);
badLineCondition = (
badLineEnable &&
rasterY >= 0x030 &&
rasterY <= 0x0F7 &&
(rasterY & 0x007) == yScroll
);
if (!idleState && badLineCondition)
idleState = true;
ClockPhi0();
}
pixelTimer--;
}
}
}

View File

@ -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)
{
}
}
}

View File

@ -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;
}
}