Commodore64: Renamed Sprite to SpriteGenerator. Created GraphicsGenerator file, with plans to isolate the background graphics generation (as it is a separate logical unit within the chip itself.)

This commit is contained in:
saxxonpike 2013-08-26 20:07:50 +00:00
parent 54c205ffe7
commit 1e8569be97
8 changed files with 43 additions and 53 deletions

View File

@ -159,10 +159,11 @@
<Compile Include="Computers\Commodore64\MOS\Sid.Voice.cs" />
<Compile Include="Computers\Commodore64\MOS\UserPort.cs" />
<Compile Include="Computers\Commodore64\MOS\Vic.cs" />
<Compile Include="Computers\Commodore64\MOS\Vic.GraphicsGenerator.cs" />
<Compile Include="Computers\Commodore64\MOS\Vic.Parse.cs" />
<Compile Include="Computers\Commodore64\MOS\Vic.Registers.cs" />
<Compile Include="Computers\Commodore64\MOS\Vic.Render.cs" />
<Compile Include="Computers\Commodore64\MOS\Vic.Sprite.cs" />
<Compile Include="Computers\Commodore64\MOS\Vic.SpriteGenerator.cs" />
<Compile Include="Computers\Commodore64\MOS\Vic.State.cs" />
<Compile Include="Computers\Commodore64\MOS\Vic.TimingBuilder.cs" />
<Compile Include="Computers\Commodore64\MOS\Vic.VideoProvider.cs" />

View File

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

View File

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

View File

@ -7,7 +7,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
{
sealed public partial class Vic
{
public byte Peek(int addr)
{
return ReadRegister((addr & 0x3F));

View File

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

View File

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

View File

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

View File

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