C64: Fixed a misspelling in timer constant name. Added method to track lag cycles from VIC.

This commit is contained in:
saxxonpike 2013-12-10 07:04:44 +00:00
parent 4d770ab0f3
commit 20e8ddf673
5 changed files with 28 additions and 8 deletions

View File

@ -96,6 +96,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
{
board.inputRead = false;
board.PollInput();
board.cpu.LagCycles = 0;
for (int count = 0; count < cyclesPerFrame; count++)
{
@ -133,6 +134,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
//Console.WriteLine("CPUPC: " + C64Util.ToHex(board.cpu.PC, 4) + " 1541PC: " + C64Util.ToHex(disk.PC, 4));
int test = board.cpu.LagCycles;
CoreComm.DriveLED = DriveLED;
}

View File

@ -14,6 +14,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
// ------------------------------------
MOS6502X cpu;
int lagCycles;
bool pinNMILast;
LatchedPort port;
bool thisNMI;
@ -78,13 +79,29 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
if (!thisNMI && pinNMILast)
cpu.NMI = true;
if (ReadAEC())
{
cpu.ExecuteOne();
pinNMILast = thisNMI;
}
if (ReadAEC())
{
cpu.ExecuteOne();
pinNMILast = thisNMI;
}
else
{
lagCycles++;
}
}
public int LagCycles
{
get
{
return lagCycles;
}
set
{
lagCycles = value;
}
}
// ------------------------------------
public ushort PC

View File

@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
{
const int baResetCounter = 7;
const int pipelineUpdateVc = 1;
const int pipelineChkSprChunch = 2;
const int pipelineChkSprCrunch = 2;
const int pipelineUpdateMcBase = 4;
const int pipelineChkBrdL1 = 8;
const int pipelineChkBrdL0 = 16;
@ -169,7 +169,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
if (parseact != 0)
{
if ((parseact & pipelineChkSprChunch) != 0)
if ((parseact & pipelineChkSprCrunch) != 0)
{
foreach (SpriteGenerator spr in sprites)
{

View File

@ -213,6 +213,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
if (bufOffset == bufLength)
bufOffset = 0;
}
pixBuffer[pixBufferIndex] = pixel;
pixBufferIndex++;

View File

@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
static int[] TimingBuilder_Cycle14Act = new int[]
{
pipelineUpdateVc, 0,
pipelineChkSprChunch, 0,
pipelineChkSprCrunch, 0,
pipelineUpdateMcBase, 0,
};
static int[] TimingBuilder_Cycle55Act = new int[]