diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj
index f7f1db8f79..3533a8fd22 100644
--- a/BizHawk.Emulation/BizHawk.Emulation.csproj
+++ b/BizHawk.Emulation/BizHawk.Emulation.csproj
@@ -105,17 +105,11 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/BizHawk.Emulation/Computers/Commodore64/C64.core.cs b/BizHawk.Emulation/Computers/Commodore64/C64.core.cs
index f1fa692303..b6dfd02312 100644
--- a/BizHawk.Emulation/Computers/Commodore64/C64.core.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/C64.core.cs
@@ -32,7 +32,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
public MOS6502X cpu;
public Memory mem;
public Sid sid;
- public VicIINew vic;
+ public VicII vic;
public ChipSignals signal;
// cpu
@@ -78,7 +78,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
// initialize vic
signal = new ChipSignals();
- vic = new VicIINew(signal, initRegion);
+ vic = new VicII(signal, initRegion);
// set vsync rate
switch (initRegion)
diff --git a/BizHawk.Emulation/Computers/Commodore64/MemBus.cs b/BizHawk.Emulation/Computers/Commodore64/MemBus.cs
index 37a2ad0be7..1a8284992d 100644
--- a/BizHawk.Emulation/Computers/Commodore64/MemBus.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/MemBus.cs
@@ -40,7 +40,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
// chips
public Cia cia0;
public Cia cia1;
- public VicIINew vic;
+ public VicII vic;
public Sid sid;
// storage
@@ -77,7 +77,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
throw new FileNotFoundException();
}
- public Memory(string sourceFolder, VicIINew newVic, Sid newSid, Cia newCia0, Cia newCia1)
+ public Memory(string sourceFolder, VicII newVic, Sid newSid, Cia newCia0, Cia newCia1)
{
string basicFile = "basic";
string charFile = "chargen";
diff --git a/BizHawk.Emulation/Computers/Commodore64/Vic.cs b/BizHawk.Emulation/Computers/Commodore64/Vic.cs
deleted file mode 100644
index e7a2c9882c..0000000000
--- a/BizHawk.Emulation/Computers/Commodore64/Vic.cs
+++ /dev/null
@@ -1,225 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace BizHawk.Emulation.Computers.Commodore64
-{
- public partial class VicII
- {
- private uint cyclesTotal;
- private uint linesTotal;
- private Memory mem;
- private uint rasterLeft;
- private Region region;
-
- private Action Execute;
-
- public VicII(Region vicRegion, Memory vicMem)
- {
- mem = vicMem;
- region = vicRegion;
-
- switch (region)
- {
- case Region.NTSC:
- cyclesTotal = 65;
- linesTotal = 263;
- rasterLeft = 0x19C;
- Execute = ExecuteNTSC;
- break;
- case Region.PAL:
- cyclesTotal = 63;
- linesTotal = 312;
- rasterLeft = 0x194;
- Execute = ExecutePAL;
- break;
- }
-
- // initalize screen properties
- screenWidth = cyclesTotal * 8;
- screenHeight = linesTotal;
-
- // initialize viewport properties
- visibleWidth = screenWidth;
- visibleHeight = screenHeight;
- visibleRight = visibleLeft + visibleWidth;
- visibleBottom = visibleTop + visibleHeight;
-
- // initialize screen buffer
- screenBuffer = new int[visibleWidth * visibleHeight];
- }
-
- private void ExecuteCommon()
- {
- cycleFetchG = false;
- cycleFetchP = false;
- cycleFetchR = false;
- cycleFetchS = false;
-
- if (!badlineEnabled && rasterLine == 0x30)
- badlineEnabled = displayEnable;
-
- if (badlineEnabled)
- CheckBadline();
-
- Execute();
- }
-
- private void ExecuteNTSC()
- {
- switch (rasterCycle)
- {
- case 0: break;
- case 1: break;
- case 2: break;
- case 3: break;
- case 4: break;
- case 5: break;
- case 6: break;
- case 7: break;
- case 8: break;
- case 9: break;
- case 10: break;
- case 11: break;
- case 12: break;
- case 13: break;
- case 14: break;
- case 15: break;
- case 16: break;
- case 17: break;
- case 18: break;
- case 19: break;
- case 20: break;
- case 21: break;
- case 22: break;
- case 23: break;
- case 24: break;
- case 25: break;
- case 26: break;
- case 27: break;
- case 28: break;
- case 29: break;
- case 30: break;
- case 31: break;
- case 32: break;
- case 33: break;
- case 34: break;
- case 35: break;
- case 36: break;
- case 37: break;
- case 38: break;
- case 39: break;
- case 40: break;
- case 41: break;
- case 42: break;
- case 43: break;
- case 44: break;
- case 45: break;
- case 46: break;
- case 47: break;
- case 48: break;
- case 49: break;
- case 50: break;
- case 51: break;
- case 52: break;
- case 53: break;
- case 54: break;
- case 55: break;
- case 56: break;
- case 57: break;
- case 58: break;
- case 59: break;
- case 60: break;
- case 61: break;
- case 62: break;
- case 63: break;
- case 64: break;
- }
- }
-
- private void ExecutePAL()
- {
- switch (rasterCycle)
- {
- case 0:
-
- BASprite(3, 4);
- break;
- case 1: break;
- case 2: break;
- case 3: break;
- case 4: break;
- case 5: break;
- case 6: break;
- case 7: break;
- case 8: break;
- case 9: break;
- case 10: break;
- case 11: break;
- case 12: break;
- case 13: break;
- case 14: break;
- case 15: break;
- case 16: break;
- case 17: break;
- case 18: break;
- case 19: break;
- case 20: break;
- case 21: break;
- case 22: break;
- case 23: break;
- case 24: break;
- case 25: break;
- case 26: break;
- case 27: break;
- case 28: break;
- case 29: break;
- case 30: break;
- case 31: break;
- case 32: break;
- case 33: break;
- case 34: break;
- case 35: break;
- case 36: break;
- case 37: break;
- case 38: break;
- case 39: break;
- case 40: break;
- case 41: break;
- case 42: break;
- case 43: break;
- case 44: break;
- case 45: break;
- case 46: break;
- case 47: break;
- case 48: break;
- case 49: break;
- case 50: break;
- case 51: break;
- case 52: break;
- case 53: break;
- case 54: break;
- case 55: break;
- case 56: break;
- case 57: break;
- case 58: break;
- case 59: break;
- case 60: break;
- case 61: break;
- case 62: break;
- }
- }
-
- public void PerformCycle()
- {
- ExecuteCommon();
- rasterCycle++;
- if (rasterCycle == cyclesTotal)
- {
- rasterCycle = 0;
- NextRasterLine();
- }
- }
- }
-}
diff --git a/BizHawk.Emulation/Computers/Commodore64/VicCycles.cs b/BizHawk.Emulation/Computers/Commodore64/VicCycles.cs
deleted file mode 100644
index 3c5c03d5fc..0000000000
--- a/BizHawk.Emulation/Computers/Commodore64/VicCycles.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace BizHawk.Emulation.Computers.Commodore64
-{
- public partial class VicII
- {
- private CycleFlags[] cycleActions;
-
- private struct CycleFlags
- {
- public bool baFetch;
- public uint baspr0;
- public bool baspr0e;
- public uint baspr1;
- public bool baspr1e;
- public uint baspr2;
- public bool baspr2e;
- public bool chkBrdL0;
- public bool chkBrdL1;
- public bool chkBrdR0;
- public bool chkBrdR1;
- public bool chkSprCrunch;
- public bool chkSprDisp;
- public bool chkSprDma;
- public bool chkSprExp;
- public uint cycle;
- public bool fetchC;
- public bool fetchG;
- public bool fetchIdle;
- public bool fetchRefresh;
- public uint phase;
- public uint sprDma0;
- public bool sprDma0e;
- public uint sprDma1;
- public bool sprDma1e;
- public uint sprDma2;
- public bool sprDma2e;
- public uint sprPtr;
- public bool sprPtre;
- public bool updateMcBase;
- public bool updateRc;
- public bool updateVc;
- public uint vis;
- public bool vise;
- public uint x;
- }
-
- static private uint[,] CycleTableNTSC =
- {
- { 1, 0, 0x19C, 0x40, 0x13, 0x345, 0 },
- { 1, 1, 0x1A0, 0x40, 0x13, 0x345, 0 },
- { 2, 0, 0x1A4, 0x40, 0x13, 0x345, 0 },
- { 2, 1, 0x1A8, 0x40, 0x13, 0x345, 0 },
- };
-
- }
-
-}
diff --git a/BizHawk.Emulation/Computers/Commodore64/VicFunction.cs b/BizHawk.Emulation/Computers/Commodore64/VicFunction.cs
deleted file mode 100644
index 31ebd94f62..0000000000
--- a/BizHawk.Emulation/Computers/Commodore64/VicFunction.cs
+++ /dev/null
@@ -1,351 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace BizHawk.Emulation.Computers.Commodore64
-{
- public partial class VicII
- {
- private void BAClear()
- {
- ba = false;
- prefetchCounter = 0;
- }
-
- private void BASet()
- {
- if (!ba)
- {
- ba = true;
- prefetchCounter = 4;
- }
- }
-
- private void BASprite(uint index0)
- {
- if (sprites[index0].dma)
- BASet();
- }
-
- private void BASprite(uint index0, uint index1)
- {
- if (sprites[index0].dma || sprites[index1].dma)
- BASet();
- }
-
- private void BASprite(uint index0, uint index1, uint index2)
- {
- if (sprites[index0].dma || sprites[index1].dma || sprites[index2].dma)
- BASet();
- }
-
- private void CheckBadline()
- {
- if ((rasterLine & 0x07) == ySmooth)
- {
- badline = true;
- idle = false;
- }
- else
- {
- badline = false;
- }
- }
-
- private void CheckBorderBottom()
- {
- if (rasterLine == borderBottom)
- borderOnVerticalEnable = true;
- }
-
- private void CheckBorderLeft0()
- {
- }
-
- private void CheckBorderLeft1()
- {
- }
-
- private void CheckBorderRight0()
- {
- }
-
- private void CheckBorderRight1()
- {
- }
-
- private void CheckBorderTop()
- {
- if (rasterLine == borderTop)
- {
- borderOnVertical = false;
- borderOnVerticalEnable = false;
- }
- }
-
- private void CheckSpriteCrunch()
- {
- }
-
- private void CheckSpriteDisplay()
- {
- for (int i = 0; i < 8; i++)
- {
- Sprite spr = sprites[i];
- spr.mc = spr.mcBase;
-
- if (spr.dma)
- {
- if ((spr.enable) && (spr.y == (rasterLine & 0xFF)))
- spr.display = true;
- }
- else
- spr.display = false;
- }
- }
-
- private void CheckSpriteDma()
- {
- for (int i = 0; i < 8; i++)
- {
- Sprite spr = sprites[i];
- if (spr.enable && (spr.y == (rasterLine & 0xFF)) && !spr.dma)
- {
- spr.dma = true;
- spr.mcBase = 0;
- spr.exp = true;
- }
- }
- }
-
- private void CheckSpriteExpansion()
- {
- for (int i = 0; i < 8; i++)
- {
- Sprite spr = sprites[i];
- if (spr.dma && spr.exp)
- {
- spr.exp = !spr.exp;
- }
- }
- }
-
- private uint Fetch0(ushort addr)
- {
- phaseRead0 = mem.VicRead(addr);
- return phaseRead0;
- }
-
- private uint Fetch1(ushort addr)
- {
- phaseRead1 = mem.VicRead(addr);
- return phaseRead1;
- }
-
- private ushort FetchAddr()
- {
- ushort addr;
-
- if (cycleFetchG)
- addr = idle ? FetchAddrGI() : FetchAddrG();
- else if (cycleFetchP)
- addr = FetchAddrP();
- else if (cycleFetchS)
- addr = FetchAddrS();
- else if (cycleFetchR)
- addr = FetchAddrR();
- else
- addr = extraColorMode ? (ushort)0x39FF : (ushort)0x3FFF;
-
- return addr;
- }
-
- private ushort FetchAddrG()
- {
- ushort addr;
-
- if (bitmapMode)
- addr = (ushort)((vc << 3) | rc | ((bitmapRam & 0x8) << 10));
- else
- addr = (ushort)((videoBuffer[vmli] << 3) | rc | ((bitmapRam & 0xE) << 10));
-
- if (extraColorMode)
- addr &= (ushort)0x39FF;
-
- return addr;
- }
-
- private ushort FetchAddrGI()
- {
- return (extraColorMode ? (ushort)0x39FF : (ushort)0x3FFF);
- }
-
- private ushort FetchAddrP()
- {
- return 0;
- }
-
- private ushort FetchAddrR()
- {
- ushort addr = refreshAddr--;
- addr |= 0x3F00;
- return addr;
- }
-
- private ushort FetchAddrS()
- {
- return 0;
- }
-
- private ushort FetchAddrV(uint offset)
- {
- return (ushort)((videoRam << 10) | offset);
- }
-
- private ushort FetchC()
- {
- return 0;
- }
-
- private void FetchG()
- {
- if (prefetchCounter > 0)
- {
- videoBuffer[vmli] = 0xFF;
- colorBuffer[vmli] = 0;
- }
- else
- {
- videoBuffer[vmli] = Fetch1(FetchAddrV(vc));
- colorBuffer[vmli] = (uint)mem.colorRam[vc] & 0xF;
- }
- }
-
- private ushort FetchIdle()
- {
- return 0;
- }
-
- private ushort FetchP()
- {
- return 0;
- }
-
- private ushort FetchR()
- {
- return 0;
- }
-
- private ushort FetchS()
- {
- return 0;
- }
-
- private void Idle()
- {
- }
-
- private void LineStart()
- {
- if ((rasterLine == 0x30) && (!badlineEnabled) && (displayEnable))
- badlineEnabled = true;
-
- if (rasterLine == 0xF8)
- badlineEnabled = false;
-
- badline = false;
- }
-
- private void NextRasterLine()
- {
- }
-
- private void Phase0()
- {
- }
-
- private void Phase1()
- {
- }
-
- private void Refresh()
- {
- }
-
- private void SpritePointer(int index)
- {
- }
-
- private void SpriteDma0(uint index)
- {
- }
-
- private void SpriteDma1(int index)
- {
- }
-
- private void SpriteDma2(int index)
- {
- }
-
- private void UpdateBorder()
- {
- borderBottom = rowSelect ? (uint)0xFA : (uint)0xF6;
- borderLeft = columnSelect ? (uint)0x018 : (uint)0x01F;
- borderRight = columnSelect ? (uint)0x157 : (uint)0x14E;
- borderTop = rowSelect ? (uint)0x33 : (uint)0x37;
- }
-
- private void UpdateInterrupts()
- {
- irq =
- (irqDataCollision & enableIrqDataCollision) |
- (irqLightPen & enableIrqLightPen) |
- (irqRaster & enableIrqRaster) |
- (irqSpriteCollision & enableIrqSpriteCollision);
- }
-
- private void UpdateMCBASE()
- {
- for (int i = 0; i < 8; i++)
- {
- Sprite spr = sprites[i];
- if (spr.exp)
- {
- spr.mcBase = spr.mc;
- if (spr.mcBase == 63)
- {
- spr.dma = false;
- }
- }
- }
- }
-
- private void UpdateRC()
- {
- if (rc == 7)
- {
- idle = true;
- vcbase = vc;
- }
- if (!idle || badline)
- {
- idle = false;
- rc = (rc + 1) & 0x7;
- }
- }
-
- private void UpdateVC()
- {
- vc = vcbase;
- vmli = 0;
- if (badline)
- rc = 0;
- }
-
- private void Vis(uint index)
- {
- }
- }
-}
diff --git a/BizHawk.Emulation/Computers/Commodore64/_VicIINew.cs b/BizHawk.Emulation/Computers/Commodore64/VicIINew.cs
similarity index 84%
rename from BizHawk.Emulation/Computers/Commodore64/_VicIINew.cs
rename to BizHawk.Emulation/Computers/Commodore64/VicIINew.cs
index 6bc903f7bb..4d929fe7f5 100644
--- a/BizHawk.Emulation/Computers/Commodore64/_VicIINew.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/VicIINew.cs
@@ -5,13 +5,13 @@ using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64
{
- public partial class VicIINew : IVideoProvider
+ public partial class VicII : IVideoProvider
{
public Memory mem;
public Region region;
public ChipSignals signal;
- public VicIINew(ChipSignals newSignal, Region newRegion)
+ public VicII(ChipSignals newSignal, Region newRegion)
{
region = newRegion;
signal = newSignal;
diff --git a/BizHawk.Emulation/Computers/Commodore64/_VicIINewPipeline.cs b/BizHawk.Emulation/Computers/Commodore64/VicIINewPipeline.cs
similarity index 94%
rename from BizHawk.Emulation/Computers/Commodore64/_VicIINewPipeline.cs
rename to BizHawk.Emulation/Computers/Commodore64/VicIINewPipeline.cs
index 2ff846a4da..0c12ec04e4 100644
--- a/BizHawk.Emulation/Computers/Commodore64/_VicIINewPipeline.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/VicIINewPipeline.cs
@@ -5,7 +5,7 @@ using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64
{
- public partial class VicIINew : IVideoProvider
+ public partial class VicII : IVideoProvider
{
private int baCount;
private int cycle;
@@ -1526,7 +1526,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
for (int i = 0; i < 8; i++)
{
- VicIINewSprite sprite = sprites[i];
+ VicIISprite sprite = sprites[i];
if (sprite.MSR == 0)
{
@@ -1605,7 +1605,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
{
for (int i = 0; i < 8; i++)
{
- VicIINewSprite sprite = sprites[i];
+ VicIISprite sprite = sprites[i];
sprite.MC = sprite.MCBASE;
if (sprite.MDMA && sprite.MxY == (RASTER & 0xFF))
{
@@ -1619,7 +1619,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
int endIndex = index + 4;
for (int i = index; i < endIndex; i++)
{
- VicIINewSprite sprite = sprites[i];
+ VicIISprite sprite = sprites[i];
sprite.MD = false;
if (sprite.MxE == true && sprite.MxY == (RASTER & 0xFF) && sprite.MDMA == false)
{
@@ -1646,7 +1646,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
{
for (int i = 0; i < 8; i++)
{
- VicIINewSprite sprite = sprites[i];
+ VicIISprite sprite = sprites[i];
if (sprite.MxYEToggle)
{
sprite.MCBASE += 3;
diff --git a/BizHawk.Emulation/Computers/Commodore64/_VicIINewVideoProvider.cs b/BizHawk.Emulation/Computers/Commodore64/VicIINewVideoProvider.cs
similarity index 92%
rename from BizHawk.Emulation/Computers/Commodore64/_VicIINewVideoProvider.cs
rename to BizHawk.Emulation/Computers/Commodore64/VicIINewVideoProvider.cs
index 04d995808c..0aee9357ad 100644
--- a/BizHawk.Emulation/Computers/Commodore64/_VicIINewVideoProvider.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/VicIINewVideoProvider.cs
@@ -5,7 +5,7 @@ using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64
{
- public partial class VicIINew : IVideoProvider
+ public partial class VicII : IVideoProvider
{
private int[] videoBuffer;
private int videoBufferHeight;
diff --git a/BizHawk.Emulation/Computers/Commodore64/_VicIIRegs.cs b/BizHawk.Emulation/Computers/Commodore64/VicIIRegs.cs
similarity index 95%
rename from BizHawk.Emulation/Computers/Commodore64/_VicIIRegs.cs
rename to BizHawk.Emulation/Computers/Commodore64/VicIIRegs.cs
index aebeb32a6b..abd7619466 100644
--- a/BizHawk.Emulation/Computers/Commodore64/_VicIIRegs.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/VicIIRegs.cs
@@ -5,9 +5,9 @@ using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64
{
- public partial class VicIINew : IVideoProvider
+ public partial class VicII : IVideoProvider
{
- private class VicIINewSprite
+ private class VicIISprite
{
// internal regs
public int MC;
@@ -69,7 +69,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
private int spriteData;
private int spritePixel;
private bool spritePriority;
- private VicIINewSprite[] sprites;
+ private VicIISprite[] sprites;
private bool advanceX;
private bool badline;
@@ -109,9 +109,9 @@ namespace BizHawk.Emulation.Computers.Commodore64
private void InitRegs()
{
// init sprites
- sprites = new VicIINewSprite[8];
+ sprites = new VicIISprite[8];
for (int i = 0; i < 8; i++)
- sprites[i] = new VicIINewSprite();
+ sprites[i] = new VicIISprite();
// init buffers
plotterDataBuffer = new int[plotterDelay];
diff --git a/BizHawk.Emulation/Computers/Commodore64/VicMem.cs b/BizHawk.Emulation/Computers/Commodore64/VicMem.cs
deleted file mode 100644
index 635327106a..0000000000
--- a/BizHawk.Emulation/Computers/Commodore64/VicMem.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace BizHawk.Emulation.Computers.Commodore64
-{
- public partial class VicII
- {
- public byte Peek(int addr)
- {
- addr &= 0x3F;
- return this[(uint)addr];
- }
-
- public void Poke(int addr, byte val)
- {
- addr &= 0x3F;
- this[(uint)addr] = val;
- }
-
- public byte Read(ushort addr)
- {
- byte result = 0xFF;
-
- addr &= 0x3F;
- switch (addr)
- {
- case 0x1E:
- // clear after read
- result = this[addr];
- this[addr] = 0x00;
- irqSpriteCollision = false;
- break;
- case 0x1F:
- // clear after read
- result = this[addr];
- this[addr] = 0x00;
- irqDataCollision = false;
- break;
- default:
- result = this[addr];
- break;
- }
-
- return result;
- }
-
- public void Write(ushort addr, byte val)
- {
- addr &= 0x3F;
- switch (addr)
- {
- case 0x19:
- // interrupt reg
- if ((val & 0x01) != 0x00)
- irqRaster = false;
- if ((val & 0x02) != 0x00)
- irqDataCollision = false;
- if ((val & 0x04) != 0x00)
- irqSpriteCollision = false;
- if ((val & 0x08) != 0x00)
- irqLightPen = false;
- break;
- case 0x1E:
- case 0x1F:
- // non writeable regs
- break;
- default:
- this[addr] = val;
- break;
- }
- }
- }
-}
diff --git a/BizHawk.Emulation/Computers/Commodore64/VicRegs.cs b/BizHawk.Emulation/Computers/Commodore64/VicRegs.cs
deleted file mode 100644
index 353e342957..0000000000
--- a/BizHawk.Emulation/Computers/Commodore64/VicRegs.cs
+++ /dev/null
@@ -1,721 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace BizHawk.Emulation.Computers.Commodore64
-{
- public partial class VicII
- {
- private class Sprite
- {
- public uint color;
- public bool dataCollision;
- public bool display;
- public bool dma;
- public bool enable;
- public bool exp;
- public uint mc;
- public uint mcBase;
- public bool mcChange;
- public bool multicolor;
- public bool priority;
- public uint ptr;
- public uint ptrinc;
- public bool spriteCollision;
- public uint x;
- public uint xShift;
- public uint xShiftSum;
- public bool xExpand;
- public uint y;
- public bool yExpand;
-
- public void SyncState(Serializer ser)
- {
- ser.Sync("color", ref color);
- ser.Sync("dataCollision", ref dataCollision);
- ser.Sync("display", ref display);
- ser.Sync("dma", ref dma);
- ser.Sync("enable", ref enable);
- ser.Sync("exp", ref exp);
- ser.Sync("mc", ref mc);
- ser.Sync("mcBase", ref mcBase);
- ser.Sync("mcChange", ref mcChange);
- ser.Sync("multicolor", ref multicolor);
- ser.Sync("priority", ref priority);
- ser.Sync("ptr", ref ptr);
- ser.Sync("ptrinc", ref ptrinc);
- ser.Sync("spriteCollision", ref spriteCollision);
- ser.Sync("x", ref x);
- ser.Sync("xShift", ref xShift);
- ser.Sync("xShiftSum", ref xShiftSum);
- ser.Sync("xExpand", ref xExpand);
- ser.Sync("y", ref y);
- ser.Sync("yExpand", ref yExpand);
- }
- }
-
- private bool ba;
- private uint backgroundColor0;
- private uint backgroundColor1;
- private uint backgroundColor2;
- private uint backgroundColor3;
- private bool badline;
- private bool badlineEnabled;
- private bool bitmapMode;
- private uint bitmapRam;
- private uint borderBottom;
- private uint borderColor;
- private uint borderLeft;
- private bool borderOnMain;
- private bool borderOnVertical;
- private bool borderOnVerticalEnable;
- private uint borderRight;
- private uint borderTop;
- private uint[] colorBuffer;
- private bool collisionEnabled;
- private bool columnSelect;
- private bool cycleFetchG;
- private bool cycleFetchP;
- private bool cycleFetchR;
- private bool cycleFetchS;
- private bool displayEnable;
- private bool enableIrqDataCollision;
- private bool enableIrqLightPen;
- private bool enableIrqRaster;
- private bool enableIrqSpriteCollision;
- private bool extraColorMode;
- private bool idle;
- private bool irq;
- private bool irqDataCollision;
- private bool irqLightPen;
- private bool irqRaster;
- private bool irqSpriteCollision;
- private uint lightPenX;
- private uint lightPenY;
- private bool multiColorMode;
- private uint phaseRead0;
- private uint phaseRead1;
- private uint prefetchCounter;
- private uint rasterCycle;
- private uint rasterIrqLine;
- private uint rasterLine;
- private uint rc;
- private ushort refreshAddr;
- private bool reset;
- private bool rowSelect;
- private uint spriteIndex;
- private uint spriteMultiColor0;
- private uint spriteMultiColor1;
- private Sprite[] sprites;
- private uint vc;
- private uint vcbase;
- private uint[] videoBuffer;
- private uint videoRam;
- private uint vmli;
- private uint xScroll;
- private uint yScroll;
- private uint ySmooth;
-
- public void SyncState(Serializer ser)
- {
- ser.Sync("ba", ref ba);
- ser.Sync("backgroundColor0", ref backgroundColor0);
- ser.Sync("backgroundColor1", ref backgroundColor1);
- ser.Sync("backgroundColor2", ref backgroundColor2);
- ser.Sync("backgroundColor3", ref backgroundColor3);
- ser.Sync("badline", ref badline);
- ser.Sync("badlineEnabled", ref badlineEnabled);
- ser.Sync("bitmapMode", ref bitmapMode);
- ser.Sync("bitmapRam", ref bitmapRam);
- ser.Sync("borderBottom", ref borderBottom);
- ser.Sync("borderColor", ref borderColor);
- ser.Sync("borderLeft", ref borderLeft);
- ser.Sync("borderOnMain", ref borderOnMain);
- ser.Sync("borderOnVertical", ref borderOnVertical);
- ser.Sync("borderOnVerticalEnable", ref borderOnVerticalEnable);
- ser.Sync("borderRight", ref borderRight);
- ser.Sync("borderTop", ref borderTop);
- ser.Sync("collisionEnabled", ref collisionEnabled);
- ser.Sync("columnSelect", ref columnSelect);
- ser.Sync("cycleFetchG", ref cycleFetchG);
- ser.Sync("cycleFetchP", ref cycleFetchP);
- ser.Sync("cycleFetchR", ref cycleFetchR);
- ser.Sync("cycleFetchS", ref cycleFetchS);
- ser.Sync("displayEnable", ref displayEnable);
- ser.Sync("enableIrqDataCollision", ref enableIrqDataCollision);
- ser.Sync("enableIrqLightPen", ref enableIrqLightPen);
- ser.Sync("enableIrqRaster", ref enableIrqRaster);
- ser.Sync("enableIrqSpriteCollision", ref enableIrqSpriteCollision);
- ser.Sync("extraColorMode", ref extraColorMode);
- ser.Sync("idle", ref idle);
- ser.Sync("irq", ref irq);
- ser.Sync("irqDataCollision", ref irqDataCollision);
- ser.Sync("irqLightPen", ref irqLightPen);
- ser.Sync("irqRaster", ref irqRaster);
- ser.Sync("irqSpriteCollision", ref irqSpriteCollision);
- ser.Sync("lightPenX", ref lightPenX);
- ser.Sync("lightPenY", ref lightPenY);
- ser.Sync("multiColorMode", ref multiColorMode);
- ser.Sync("phaseRead0", ref phaseRead0);
- ser.Sync("phaseRead1", ref phaseRead1);
- ser.Sync("rasterCycle", ref rasterCycle);
- ser.Sync("rasterIrqLine", ref rasterIrqLine);
- ser.Sync("rasterLine", ref rasterLine);
- ser.Sync("rc", ref rc);
- ser.Sync("refreshAddr", ref refreshAddr);
- ser.Sync("reset", ref reset);
- ser.Sync("rowSelect", ref rowSelect);
- ser.Sync("spriteIndex", ref spriteIndex);
- ser.Sync("spriteMultiColor0", ref spriteMultiColor0);
- ser.Sync("spriteMultiColor1", ref spriteMultiColor1);
- ser.Sync("vc", ref vc);
- ser.Sync("vcbase", ref vcbase);
- ser.Sync("videoBuffer", ref videoBuffer, false);
- ser.Sync("videoRam", ref videoRam);
- ser.Sync("vmli", ref vmli);
- ser.Sync("xScroll", ref xScroll);
- ser.Sync("yScroll", ref yScroll);
- ser.Sync("ySmooth", ref ySmooth);
-
- for (int i = 0; i < 8; i++)
- {
- ser.BeginSection("sprites" + i.ToString());
- sprites[i].SyncState(ser);
- ser.EndSection();
- }
- }
-
- private byte this[uint addr]
- {
- get
- {
- byte result;
-
- switch (addr & 0x3F)
- {
- case 0x00: result = Reg00; break;
- case 0x01: result = Reg01; break;
- case 0x02: result = Reg02; break;
- case 0x03: result = Reg03; break;
- case 0x04: result = Reg04; break;
- case 0x05: result = Reg05; break;
- case 0x06: result = Reg06; break;
- case 0x07: result = Reg07; break;
- case 0x08: result = Reg08; break;
- case 0x09: result = Reg09; break;
- case 0x0A: result = Reg0A; break;
- case 0x0B: result = Reg0B; break;
- case 0x0C: result = Reg0C; break;
- case 0x0D: result = Reg0D; break;
- case 0x0E: result = Reg0E; break;
- case 0x0F: result = Reg0F; break;
- case 0x10: result = Reg10; break;
- case 0x11: result = Reg11; break;
- case 0x12: result = Reg12; break;
- case 0x13: result = Reg13; break;
- case 0x14: result = Reg14; break;
- case 0x15: result = Reg15; break;
- case 0x16: result = Reg16; break;
- case 0x17: result = Reg17; break;
- case 0x18: result = Reg18; break;
- case 0x19: result = Reg19; break;
- case 0x1A: result = Reg1A; break;
- case 0x1B: result = Reg1B; break;
- case 0x1C: result = Reg1C; break;
- case 0x1D: result = Reg1D; break;
- case 0x1E: result = Reg1E; break;
- case 0x1F: result = Reg1F; break;
- case 0x20: result = Reg20; break;
- case 0x21: result = Reg21; break;
- case 0x22: result = Reg22; break;
- case 0x23: result = Reg23; break;
- case 0x24: result = Reg24; break;
- case 0x25: result = Reg25; break;
- case 0x26: result = Reg26; break;
- case 0x27: result = Reg27; break;
- case 0x28: result = Reg28; break;
- case 0x29: result = Reg29; break;
- case 0x2A: result = Reg2A; break;
- case 0x2B: result = Reg2B; break;
- case 0x2C: result = Reg2C; break;
- case 0x2D: result = Reg2D; break;
- case 0x2E: result = Reg2E; break;
- default: result = 0xFF; break;
- }
- return result;
- }
- set
- {
- switch (addr & 0x3F)
- {
- case 0x00: Reg00 = value; break;
- case 0x01: Reg01 = value; break;
- case 0x02: Reg02 = value; break;
- case 0x03: Reg03 = value; break;
- case 0x04: Reg04 = value; break;
- case 0x05: Reg05 = value; break;
- case 0x06: Reg06 = value; break;
- case 0x07: Reg07 = value; break;
- case 0x08: Reg08 = value; break;
- case 0x09: Reg09 = value; break;
- case 0x0A: Reg0A = value; break;
- case 0x0B: Reg0B = value; break;
- case 0x0C: Reg0C = value; break;
- case 0x0D: Reg0D = value; break;
- case 0x0E: Reg0E = value; break;
- case 0x0F: Reg0F = value; break;
- case 0x10: Reg10 = value; break;
- case 0x11: Reg11 = value; break;
- case 0x12: Reg12 = value; break;
- case 0x15: Reg15 = value; break;
- case 0x16: Reg16 = value; break;
- case 0x17: Reg17 = value; break;
- case 0x18: Reg18 = value; break;
- case 0x19: Reg19 = value; break;
- case 0x1A: Reg1A = value; break;
- case 0x1B: Reg1B = value; break;
- case 0x1C: Reg1C = value; break;
- case 0x1D: Reg1D = value; break;
- case 0x1E: Reg1E = value; break;
- case 0x1F: Reg1F = value; break;
- case 0x20: Reg20 = value; break;
- case 0x21: Reg21 = value; break;
- case 0x22: Reg22 = value; break;
- case 0x23: Reg23 = value; break;
- case 0x24: Reg24 = value; break;
- case 0x25: Reg25 = value; break;
- case 0x26: Reg26 = value; break;
- case 0x27: Reg27 = value; break;
- case 0x28: Reg28 = value; break;
- case 0x29: Reg29 = value; break;
- case 0x2A: Reg2A = value; break;
- case 0x2B: Reg2B = value; break;
- case 0x2C: Reg2C = value; break;
- case 0x2D: Reg2D = value; break;
- case 0x2E: Reg2E = value; break;
- default: break;
- }
- }
- }
-
- private byte Reg00 {
- get { return (byte)(sprites[0].x & 0xFF); }
- set { sprites[0].x &= 0x100; sprites[0].x |= value; }
- }
- private byte Reg01 {
- get { return (byte)(sprites[0].y); }
- set { sprites[0].y = value; }
- }
- private byte Reg02 {
- get { return (byte)(sprites[1].x & 0xFF); }
- set { sprites[1].x &= 0x100; sprites[1].x |= value; }
- }
- private byte Reg03 {
- get { return (byte)(sprites[1].y); }
- set { sprites[1].y = value; }
- }
- private byte Reg04 {
- get { return (byte)(sprites[2].x & 0xFF); }
- set { sprites[2].x &= 0x100; sprites[2].x |= value; }
- }
- private byte Reg05 {
- get { return (byte)(sprites[2].y); }
- set { sprites[2].y = value; }
- }
- private byte Reg06 {
- get { return (byte)(sprites[3].x & 0xFF); }
- set { sprites[3].x &= 0x100; sprites[3].x |= value; }
- }
- private byte Reg07 {
- get { return (byte)(sprites[3].y); }
- set { sprites[3].y = value; }
- }
- private byte Reg08 {
- get { return (byte)(sprites[4].x & 0xFF); }
- set { sprites[4].x &= 0x100; sprites[4].x |= value; }
- }
- private byte Reg09 {
- get { return (byte)(sprites[4].y); }
- set { sprites[4].y = value; }
- }
- private byte Reg0A {
- get { return (byte)(sprites[5].x & 0xFF); }
- set { sprites[5].x &= 0x100; sprites[5].x |= value; }
- }
- private byte Reg0B {
- get { return (byte)(sprites[5].y); }
- set { sprites[5].y = value; }
- }
- private byte Reg0C {
- get { return (byte)(sprites[6].x & 0xFF); }
- set { sprites[6].x &= 0x100; sprites[6].x |= value; }
- }
- private byte Reg0D {
- get { return (byte)(sprites[6].y); }
- set { sprites[6].y = value; }
- }
- private byte Reg0E {
- get { return (byte)(sprites[7].x & 0xFF); }
- set { sprites[7].x &= 0x100; sprites[7].x |= value; }
- }
- private byte Reg0F {
- get { return (byte)(sprites[7].y); }
- set { sprites[7].y = value; }
- }
- private byte Reg10 {
- get
- {
- return (byte)(
- ((sprites[0].x & 0x100) >> 8) |
- ((sprites[1].x & 0x100) >> 7) |
- ((sprites[2].x & 0x100) >> 6) |
- ((sprites[3].x & 0x100) >> 5) |
- ((sprites[4].x & 0x100) >> 4) |
- ((sprites[5].x & 0x100) >> 3) |
- ((sprites[6].x & 0x100) >> 2) |
- ((sprites[7].x & 0x100) >> 1));
- }
- set
- {
- uint val = value;
- sprites[0].x = (sprites[0].x & 0xFF) | ((val & 0x01) << 8);
- sprites[1].x = (sprites[1].x & 0xFF) | ((val & 0x02) << 7);
- sprites[2].x = (sprites[2].x & 0xFF) | ((val & 0x04) << 6);
- sprites[3].x = (sprites[3].x & 0xFF) | ((val & 0x08) << 5);
- sprites[4].x = (sprites[4].x & 0xFF) | ((val & 0x10) << 4);
- sprites[5].x = (sprites[5].x & 0xFF) | ((val & 0x20) << 3);
- sprites[6].x = (sprites[6].x & 0xFF) | ((val & 0x40) << 2);
- sprites[7].x = (sprites[7].x & 0xFF) | ((val & 0x80) << 1);
- }
- }
- private byte Reg11 {
- get
- {
- return (byte)(
- (yScroll & 0x07) |
- (columnSelect ? (uint)0x08 : (uint)0x00) |
- (displayEnable ? (uint)0x10 : (uint)0x00) |
- (bitmapMode ? (uint)0x20 : (uint)0x00) |
- (extraColorMode ? (uint)0x40 : (uint)0x00) |
- ((rasterLine & 0x100) >> 1));
- }
- set
- {
- yScroll = (uint)value & 0x07;
- columnSelect = ((value & 0x08) != 0);
- displayEnable = ((value & 0x10) != 0);
- bitmapMode = ((value & 0x20) != 0);
- extraColorMode = ((value & 0x40) != 0);
- rasterIrqLine &= 0x100;
- rasterIrqLine |= (uint)(value & 0x80) << 1;
- }
- }
- private byte Reg12 {
- get { return (byte)(rasterLine & 0xFF); }
- set { rasterIrqLine &= 0x100; rasterIrqLine |= value; }
- }
- private byte Reg13 {
- get { return (byte)((lightPenX >> 1) & 0xFF); }
- }
- private byte Reg14 {
- get { return (byte)(lightPenY & 0xFF); }
- }
- private byte Reg15 {
- get
- {
- return (byte)(
- (sprites[0].enable ? 0x01 : 0x00) |
- (sprites[1].enable ? 0x02 : 0x00) |
- (sprites[2].enable ? 0x04 : 0x00) |
- (sprites[3].enable ? 0x08 : 0x00) |
- (sprites[4].enable ? 0x10 : 0x00) |
- (sprites[5].enable ? 0x20 : 0x00) |
- (sprites[6].enable ? 0x40 : 0x00) |
- (sprites[7].enable ? 0x80 : 0x00));
- }
- set
- {
- sprites[0].enable = ((value & 0x01) != 0);
- sprites[1].enable = ((value & 0x02) != 0);
- sprites[2].enable = ((value & 0x04) != 0);
- sprites[3].enable = ((value & 0x08) != 0);
- sprites[4].enable = ((value & 0x10) != 0);
- sprites[5].enable = ((value & 0x20) != 0);
- sprites[6].enable = ((value & 0x40) != 0);
- sprites[7].enable = ((value & 0x80) != 0);
- }
- }
- private byte Reg16 {
- get
- {
- return (byte)(
- (xScroll & 0x07) |
- (columnSelect ? (uint)0x08 : (uint)0x00) |
- (multiColorMode ? (uint)0x10 : (uint)0x00) |
- (reset ? (uint)0x20 : (uint)0x00) |
- (0xC0));
- }
- set
- {
- xScroll = (uint)value & 0x07;
- columnSelect = ((value & 0x08) != 0);
- multiColorMode = ((value & 0x10) != 0);
- reset = ((value & 0x20) != 0);
- }
- }
- private byte Reg17 {
- get
- {
- return (byte)(
- (sprites[0].yExpand ? 0x01 : 0x00) |
- (sprites[1].yExpand ? 0x02 : 0x00) |
- (sprites[2].yExpand ? 0x04 : 0x00) |
- (sprites[3].yExpand ? 0x08 : 0x00) |
- (sprites[4].yExpand ? 0x10 : 0x00) |
- (sprites[5].yExpand ? 0x20 : 0x00) |
- (sprites[6].yExpand ? 0x40 : 0x00) |
- (sprites[7].yExpand ? 0x80 : 0x00));
- }
- set
- {
- sprites[0].yExpand = ((value & 0x01) != 0);
- sprites[1].yExpand = ((value & 0x02) != 0);
- sprites[2].yExpand = ((value & 0x04) != 0);
- sprites[3].yExpand = ((value & 0x08) != 0);
- sprites[4].yExpand = ((value & 0x10) != 0);
- sprites[5].yExpand = ((value & 0x20) != 0);
- sprites[6].yExpand = ((value & 0x40) != 0);
- sprites[7].yExpand = ((value & 0x80) != 0);
- }
- }
- private byte Reg18 {
- get { return (byte)((videoRam << 4) | (bitmapRam << 1) | 0x1); }
- set { videoRam = ((uint)(value & 0xF0)) >> 4; bitmapRam = ((uint)(value & 0x0E)) >> 1; }
- }
- private byte Reg19 {
- get
- {
- return (byte)(
- (irqRaster ? (uint)0x01 : (uint)0x00) |
- (irqDataCollision ? (uint)0x02 : (uint)0x00) |
- (irqSpriteCollision ? (uint)0x04 : (uint)0x00) |
- (irqLightPen ? 0x08 : (uint)0x00) |
- (irq ? (uint)0x80 : (uint)0x00) |
- (0x70));
- }
- set
- {
- irqRaster = ((value & 0x01) != 0);
- irqDataCollision = ((value & 0x02) != 0);
- irqSpriteCollision = ((value & 0x04) != 0);
- irqLightPen = ((value & 0x08) != 0);
- }
- }
- private byte Reg1A {
- get
- {
- return (byte)(
- (enableIrqRaster ? (uint)0x01 : (uint)0x00) |
- (enableIrqDataCollision ? (uint)0x02 : (uint)0x00) |
- (enableIrqSpriteCollision ? (uint)0x04 : (uint)0x00) |
- (enableIrqLightPen ? 0x08 : (uint)0x00) |
- (0xF0));
- }
- set
- {
- enableIrqRaster = ((value & 0x01) != 0);
- enableIrqDataCollision = ((value & 0x02) != 0);
- enableIrqSpriteCollision = ((value & 0x04) != 0);
- enableIrqLightPen = ((value & 0x08) != 0);
- }
- }
- private byte Reg1B {
- get
- {
- return (byte)(
- (sprites[0].priority ? 0x01 : 0x00) |
- (sprites[1].priority ? 0x02 : 0x00) |
- (sprites[2].priority ? 0x04 : 0x00) |
- (sprites[3].priority ? 0x08 : 0x00) |
- (sprites[4].priority ? 0x10 : 0x00) |
- (sprites[5].priority ? 0x20 : 0x00) |
- (sprites[6].priority ? 0x40 : 0x00) |
- (sprites[7].priority ? 0x80 : 0x00));
- }
- set
- {
- sprites[0].priority = ((value & 0x01) != 0);
- sprites[1].priority = ((value & 0x02) != 0);
- sprites[2].priority = ((value & 0x04) != 0);
- sprites[3].priority = ((value & 0x08) != 0);
- sprites[4].priority = ((value & 0x10) != 0);
- sprites[5].priority = ((value & 0x20) != 0);
- sprites[6].priority = ((value & 0x40) != 0);
- sprites[7].priority = ((value & 0x80) != 0);
- }
- }
- private byte Reg1C {
- get
- {
- return (byte)(
- (sprites[0].multicolor ? 0x01 : 0x00) |
- (sprites[1].multicolor ? 0x02 : 0x00) |
- (sprites[2].multicolor ? 0x04 : 0x00) |
- (sprites[3].multicolor ? 0x08 : 0x00) |
- (sprites[4].multicolor ? 0x10 : 0x00) |
- (sprites[5].multicolor ? 0x20 : 0x00) |
- (sprites[6].multicolor ? 0x40 : 0x00) |
- (sprites[7].multicolor ? 0x80 : 0x00));
- }
- set
- {
- sprites[0].multicolor = ((value & 0x01) != 0);
- sprites[1].multicolor = ((value & 0x02) != 0);
- sprites[2].multicolor = ((value & 0x04) != 0);
- sprites[3].multicolor = ((value & 0x08) != 0);
- sprites[4].multicolor = ((value & 0x10) != 0);
- sprites[5].multicolor = ((value & 0x20) != 0);
- sprites[6].multicolor = ((value & 0x40) != 0);
- sprites[7].multicolor = ((value & 0x80) != 0);
- }
- }
- private byte Reg1D {
- get
- {
- return (byte)(
- (sprites[0].xExpand ? 0x01 : 0x00) |
- (sprites[1].xExpand ? 0x02 : 0x00) |
- (sprites[2].xExpand ? 0x04 : 0x00) |
- (sprites[3].xExpand ? 0x08 : 0x00) |
- (sprites[4].xExpand ? 0x10 : 0x00) |
- (sprites[5].xExpand ? 0x20 : 0x00) |
- (sprites[6].xExpand ? 0x40 : 0x00) |
- (sprites[7].xExpand ? 0x80 : 0x00));
- }
- set
- {
- sprites[0].xExpand = ((value & 0x01) != 0);
- sprites[1].xExpand = ((value & 0x02) != 0);
- sprites[2].xExpand = ((value & 0x04) != 0);
- sprites[3].xExpand = ((value & 0x08) != 0);
- sprites[4].xExpand = ((value & 0x10) != 0);
- sprites[5].xExpand = ((value & 0x20) != 0);
- sprites[6].xExpand = ((value & 0x40) != 0);
- sprites[7].xExpand = ((value & 0x80) != 0);
- }
- }
- private byte Reg1E {
- get
- {
- return (byte)(
- (sprites[0].spriteCollision ? 0x01 : 0x00) |
- (sprites[1].spriteCollision ? 0x02 : 0x00) |
- (sprites[2].spriteCollision ? 0x04 : 0x00) |
- (sprites[3].spriteCollision ? 0x08 : 0x00) |
- (sprites[4].spriteCollision ? 0x10 : 0x00) |
- (sprites[5].spriteCollision ? 0x20 : 0x00) |
- (sprites[6].spriteCollision ? 0x40 : 0x00) |
- (sprites[7].spriteCollision ? 0x80 : 0x00));
- }
- set
- {
- sprites[0].spriteCollision = ((value & 0x01) != 0);
- sprites[1].spriteCollision = ((value & 0x02) != 0);
- sprites[2].spriteCollision = ((value & 0x04) != 0);
- sprites[3].spriteCollision = ((value & 0x08) != 0);
- sprites[4].spriteCollision = ((value & 0x10) != 0);
- sprites[5].spriteCollision = ((value & 0x20) != 0);
- sprites[6].spriteCollision = ((value & 0x40) != 0);
- sprites[7].spriteCollision = ((value & 0x80) != 0);
- }
- }
- private byte Reg1F {
- get
- {
- return (byte)(
- (sprites[0].dataCollision ? 0x01 : 0x00) |
- (sprites[1].dataCollision ? 0x02 : 0x00) |
- (sprites[2].dataCollision ? 0x04 : 0x00) |
- (sprites[3].dataCollision ? 0x08 : 0x00) |
- (sprites[4].dataCollision ? 0x10 : 0x00) |
- (sprites[5].dataCollision ? 0x20 : 0x00) |
- (sprites[6].dataCollision ? 0x40 : 0x00) |
- (sprites[7].dataCollision ? 0x80 : 0x00));
- }
- set
- {
- sprites[0].dataCollision = ((value & 0x01) != 0);
- sprites[1].dataCollision = ((value & 0x02) != 0);
- sprites[2].dataCollision = ((value & 0x04) != 0);
- sprites[3].dataCollision = ((value & 0x08) != 0);
- sprites[4].dataCollision = ((value & 0x10) != 0);
- sprites[5].dataCollision = ((value & 0x20) != 0);
- sprites[6].dataCollision = ((value & 0x40) != 0);
- sprites[7].dataCollision = ((value & 0x80) != 0);
- }
- }
- private byte Reg20 {
- get { return (byte)(borderColor | 0xF0); }
- set { borderColor = (uint)value & 0x0F; }
- }
- private byte Reg21 {
- get { return (byte)(backgroundColor0 | 0xF0); }
- set { backgroundColor0 = (uint)value & 0x0F; }
- }
- private byte Reg22 {
- get { return (byte)(backgroundColor1 | 0xF0); }
- set { backgroundColor1 = (uint)value & 0x0F; }
- }
- private byte Reg23 {
- get { return (byte)(backgroundColor2 | 0xF0); }
- set { backgroundColor2 = (uint)value & 0x0F; }
- }
- private byte Reg24 {
- get { return (byte)(backgroundColor3 | 0xF0); }
- set { backgroundColor3 = (uint)value & 0x0F; }
- }
- private byte Reg25 {
- get { return (byte)(spriteMultiColor0 | 0xF0); }
- set { spriteMultiColor0 = (uint)value & 0x0F; }
- }
- private byte Reg26 {
- get { return (byte)(spriteMultiColor1 | 0xF0); }
- set { spriteMultiColor1 = (uint)value & 0x0F; }
- }
- private byte Reg27 {
- get { return (byte)(sprites[0].color | 0xF0); }
- set { sprites[0].color = (uint)value & 0x0F; }
- }
- private byte Reg28 {
- get { return (byte)(sprites[1].color | 0xF0); }
- set { sprites[1].color = (uint)value & 0x0F; }
- }
- private byte Reg29 {
- get { return (byte)(sprites[2].color | 0xF0); }
- set { sprites[2].color = (uint)value & 0x0F; }
- }
- private byte Reg2A {
- get { return (byte)(sprites[3].color | 0xF0); }
- set { sprites[3].color = (uint)value & 0x0F; }
- }
- private byte Reg2B {
- get { return (byte)(sprites[4].color | 0xF0); }
- set { sprites[4].color = (uint)value & 0x0F; }
- }
- private byte Reg2C {
- get { return (byte)(sprites[5].color | 0xF0); }
- set { sprites[5].color = (uint)value & 0x0F; }
- }
- private byte Reg2D {
- get { return (byte)(sprites[6].color | 0xF0); }
- set { sprites[6].color = (uint)value & 0x0F; }
- }
- private byte Reg2E {
- get { return (byte)(sprites[7].color | 0xF0); }
- set { sprites[7].color = (uint)value & 0x0F; }
- }
-
- }
-
-}
diff --git a/BizHawk.Emulation/Computers/Commodore64/_VicState.cs b/BizHawk.Emulation/Computers/Commodore64/VicState.cs
similarity index 95%
rename from BizHawk.Emulation/Computers/Commodore64/_VicState.cs
rename to BizHawk.Emulation/Computers/Commodore64/VicState.cs
index 3002301d0a..a834217524 100644
--- a/BizHawk.Emulation/Computers/Commodore64/_VicState.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/VicState.cs
@@ -5,7 +5,7 @@ using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64
{
- public partial class VicIINew : IVideoProvider
+ public partial class VicII : IVideoProvider
{
public void SyncState(Serializer ser)
{
diff --git a/BizHawk.Emulation/Computers/Commodore64/VicVideoProvider.cs b/BizHawk.Emulation/Computers/Commodore64/VicVideoProvider.cs
deleted file mode 100644
index 6368b31f3f..0000000000
--- a/BizHawk.Emulation/Computers/Commodore64/VicVideoProvider.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace BizHawk.Emulation.Computers.Commodore64
-{
- public partial class VicII : IVideoProvider
- {
- private static int[] palette =
- {
- Colors.ARGB(0x00, 0x00, 0x00),
- Colors.ARGB(0xFF, 0xFF, 0xFF),
- Colors.ARGB(0x68, 0x37, 0x2B),
- Colors.ARGB(0x70, 0xA4, 0xB2),
- Colors.ARGB(0x6F, 0x3D, 0x86),
- Colors.ARGB(0x58, 0x8D, 0x43),
- Colors.ARGB(0x35, 0x28, 0x79),
- Colors.ARGB(0xB8, 0xC7, 0x6F),
- Colors.ARGB(0x6F, 0x4F, 0x25),
- Colors.ARGB(0x43, 0x39, 0x00),
- Colors.ARGB(0x9A, 0x67, 0x59),
- Colors.ARGB(0x44, 0x44, 0x44),
- Colors.ARGB(0x6C, 0x6C, 0x6C),
- Colors.ARGB(0x9A, 0xD2, 0x84),
- Colors.ARGB(0x6C, 0x5E, 0xB5),
- Colors.ARGB(0x95, 0x95, 0x95)
- };
-
- private int[] screenBuffer;
- private uint screenHeight;
- private uint screenOffset;
- private uint screenOffsetX;
- private uint screenOffsetY;
- private bool screenOffsetVisibleX;
- private bool screenOffsetVisibleY;
- private uint screenWidth;
- private uint visibleBottom;
- private uint visibleHeight;
- private uint visibleLeft;
- private uint visibleRight;
- private uint visibleTop;
- private uint visibleWidth;
-
- public int BackgroundColor
- {
- get { return Colors.ARGB(0, 0, 0); }
- }
-
- public int BufferHeight
- {
- get { return (int)visibleHeight; }
- }
-
- public int BufferWidth
- {
- get { return (int)visibleWidth; }
- }
-
- public int[] GetVideoBuffer()
- {
- return screenBuffer;
- }
-
- public int VirtualWidth
- {
- get { return BufferWidth; }
- }
-
- private void WritePixel(uint pixel)
- {
- if (screenOffsetX == visibleLeft)
- screenOffsetVisibleX = true;
- else if (screenOffsetX == visibleRight)
- screenOffsetVisibleX = false;
-
- if (screenOffsetY == visibleTop)
- screenOffsetVisibleY = true;
- else if (screenOffsetY == visibleBottom)
- screenOffsetVisibleY = false;
-
- if (screenOffsetVisibleX && screenOffsetVisibleY)
- screenBuffer[screenOffset] = palette[pixel];
-
- screenOffset++;
- screenOffsetX++;
- if (screenOffsetX == screenWidth)
- {
- screenOffsetX = 0;
- screenOffsetY++;
- if (screenOffsetY == screenHeight)
- {
- screenOffsetY = 0;
- screenOffset = 0;
- }
- }
- }
- }
-}