diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 123d45d138..b82a14a5ea 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -159,10 +159,11 @@ + - + diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.GraphicsGenerator.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.GraphicsGenerator.cs new file mode 100644 index 0000000000..fa096918f5 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.GraphicsGenerator.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BizHawk.Emulation.Computers.Commodore64.MOS +{ + sealed public partial class Vic + { + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Parse.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Parse.cs index 5425d99366..59c76d0233 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Parse.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Parse.cs @@ -7,23 +7,23 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS { sealed public partial class Vic { - public const int baResetCounter = 7; - public const int pipelineUpdateVc = 1; - public const int pipelineChkSprChunch = 2; - public const int pipelineUpdateMcBase = 4; - public const int pipelineChkBrdL1 = 8; - public const int pipelineChkBrdL0 = 16; - public const int pipelineChkSprDma = 32; - public const int pipelineChkBrdR0 = 64; - public const int pipelineChkSprExp = 128; - public const int pipelineChkBrdR1 = 256; - public const int pipelineChkSprDisp = 512; - public const int pipelineUpdateRc = 1024; - public const int pipelineHBlankL = 0x10000000; - public const int pipelineHBlankR = 0x20000000; - public const int pipelineHoldX = 0x40000000; - public const int rasterIrqLine0Cycle = 1; - public const int rasterIrqLineXCycle = 0; + const int baResetCounter = 7; + const int pipelineUpdateVc = 1; + const int pipelineChkSprChunch = 2; + const int pipelineUpdateMcBase = 4; + const int pipelineChkBrdL1 = 8; + const int pipelineChkBrdL0 = 16; + const int pipelineChkSprDma = 32; + const int pipelineChkBrdR0 = 64; + const int pipelineChkSprExp = 128; + const int pipelineChkBrdR1 = 256; + const int pipelineChkSprDisp = 512; + const int pipelineUpdateRc = 1024; + const int pipelineHBlankL = 0x10000000; + const int pipelineHBlankR = 0x20000000; + const int pipelineHoldX = 0x40000000; + const int rasterIrqLine0Cycle = 1; + const int rasterIrqLineXCycle = 0; int parseaddr; int parsecycleBAsprite0; @@ -131,7 +131,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS // fetch S if (sprites[parsecycleFetchSpriteIndex].dma) { - Sprite spr = sprites[parsecycleFetchSpriteIndex]; + SpriteGenerator spr = sprites[parsecycleFetchSpriteIndex]; parseaddr = (spr.mc | (spr.pointer << 6)); spr.sr <<= 8; spr.sr |= ReadMemory(parseaddr); @@ -172,7 +172,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS { if ((parseact & pipelineChkSprChunch) != 0) { - foreach (Sprite spr in sprites) + foreach (SpriteGenerator spr in sprites) { if (spr.yCrunch) spr.mcbase += 2; @@ -184,7 +184,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS else if ((parseact & pipelineChkSprDisp) != 0) { - foreach (Sprite spr in sprites) + foreach (SpriteGenerator spr in sprites) { spr.mc = spr.mcbase; if (spr.dma && spr.y == (rasterLine & 0xFF)) @@ -196,7 +196,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS else if ((parseact & pipelineChkSprDma) != 0) { - foreach (Sprite spr in sprites) + foreach (SpriteGenerator spr in sprites) { if (spr.enable && spr.y == (rasterLine & 0xFF) && !spr.dma) { @@ -209,7 +209,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS else if ((parseact & pipelineChkSprExp) != 0) { - foreach (Sprite spr in sprites) + foreach (SpriteGenerator spr in sprites) { if (spr.yExpand) spr.yCrunch ^= true; @@ -218,7 +218,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS else if ((parseact & pipelineUpdateMcBase) != 0) { - foreach (Sprite spr in sprites) + foreach (SpriteGenerator spr in sprites) { if (spr.yCrunch) { diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Registers.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Registers.cs index 3625be0f54..99ebcacd3f 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Registers.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Registers.cs @@ -7,7 +7,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS { sealed public partial class Vic { - public byte Peek(int addr) { return ReadRegister((addr & 0x3F)); diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Render.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Render.cs index b2e5d711b1..2f187495d2 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Render.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Render.cs @@ -11,8 +11,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS int ecmPixel; int pixel; int pixelData; - //int pixelOwner; - Sprite pixelOwner; + SpriteGenerator pixelOwner; int sprData; int sprPixel; int srC = 0; @@ -137,9 +136,8 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS srSync <<= 1; // render sprite - //pixelOwner = 8; pixelOwner = null; - foreach (Sprite spr in sprites) + foreach (SpriteGenerator spr in sprites) { sprData = 0; sprPixel = pixel; diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Sprite.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.SpriteGenerator.cs similarity index 59% rename from BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Sprite.cs rename to BizHawk.Emulation/Computers/Commodore64/MOS/Vic.SpriteGenerator.cs index 19c7e64834..03708ea3ff 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.Sprite.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.SpriteGenerator.cs @@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS { sealed public partial class Vic { - sealed class Sprite + sealed class SpriteGenerator { public bool collideData; public bool collideSprite; @@ -56,26 +56,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS public void SyncState(Serializer ser) { - ser.Sync("collideData", ref collideData); - ser.Sync("collideSprite", ref collideSprite); - ser.Sync("color", ref color); - ser.Sync("display", ref display); - ser.Sync("dma", ref dma); - ser.Sync("enable", ref enable); - ser.Sync("mc", ref mc); - ser.Sync("mcbase", ref mcbase); - ser.Sync("multicolor", ref multicolor); - ser.Sync("multicolorCrunch", ref multicolorCrunch); - ser.Sync("pointer", ref pointer); - ser.Sync("priority", ref priority); - ser.Sync("shiftEnable", ref shiftEnable); - ser.Sync("sr", ref sr); - ser.Sync("x", ref x); - ser.Sync("xCrunch", ref xCrunch); - ser.Sync("xExpand", ref xExpand); - ser.Sync("y", ref y); - ser.Sync("yCrunch", ref yCrunch); - ser.Sync("yExpand", ref yExpand); + SaveState.SyncObject(ser, this); } } } diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.State.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.State.cs index 7cbb959810..f321885db8 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.State.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.State.cs @@ -72,7 +72,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS bool rowSelect; int spriteMulticolor0; int spriteMulticolor1; - Sprite[] sprites; + SpriteGenerator[] sprites; int sr; int srMask; int srMask0; diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.cs index 66e9dc2133..1011c3c5dd 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/Vic.cs @@ -41,9 +41,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS buf = new int[bufWidth * bufHeight]; bufLength = buf.Length; - sprites = new Sprite[8]; + sprites = new SpriteGenerator[8]; for (int i = 0; i < 8; i++) - sprites[i] = new Sprite(); + sprites[i] = new SpriteGenerator(); bufferC = new int[40]; bufferG = new int[40];