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.inputRead = false;
board.PollInput(); board.PollInput();
board.cpu.LagCycles = 0;
for (int count = 0; count < cyclesPerFrame; count++) 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)); //Console.WriteLine("CPUPC: " + C64Util.ToHex(board.cpu.PC, 4) + " 1541PC: " + C64Util.ToHex(disk.PC, 4));
int test = board.cpu.LagCycles;
CoreComm.DriveLED = DriveLED; CoreComm.DriveLED = DriveLED;
} }

View File

@ -14,6 +14,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
// ------------------------------------ // ------------------------------------
MOS6502X cpu; MOS6502X cpu;
int lagCycles;
bool pinNMILast; bool pinNMILast;
LatchedPort port; LatchedPort port;
bool thisNMI; bool thisNMI;
@ -83,6 +84,22 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
cpu.ExecuteOne(); cpu.ExecuteOne();
pinNMILast = thisNMI; pinNMILast = thisNMI;
} }
else
{
lagCycles++;
}
}
public int LagCycles
{
get
{
return lagCycles;
}
set
{
lagCycles = value;
}
} }
// ------------------------------------ // ------------------------------------

View File

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

View File

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

View File

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