TIA: Implemented player copy mode 0x06

M6532: Added an interrupt register
This commit is contained in:
pjgat09 2012-03-14 21:57:10 +00:00
parent 3c267db54c
commit a55bdd1a69
2 changed files with 30 additions and 0 deletions

View File

@ -13,6 +13,10 @@ namespace BizHawk.Emulation.Consoles.Atari
public int timerStartValue;
public int timerFinishedCycles;
public int timerShift;
bool interruptEnabled = false;
bool interruptTriggered = false;
Atari2600 core;
@ -47,6 +51,8 @@ namespace BizHawk.Emulation.Consoles.Atari
// Calculate the current value on the timer
int timerCurrentValue = timerFinishedCycles - Cpu.TotalExecutedCycles;
interruptTriggered = false;
// If the timer has not finished, shift the value down for the game
if (Cpu.TotalExecutedCycles < timerFinishedCycles)
{
@ -55,6 +61,7 @@ namespace BizHawk.Emulation.Consoles.Atari
// Other wise, return the last 8 bits from how long ago it triggered
else
{
interruptTriggered = true;
return (byte)(timerCurrentValue & 0xFF);
}
}
@ -78,6 +85,17 @@ namespace BizHawk.Emulation.Consoles.Atari
{
}
else if (maskedAddr == 0x05) // interrupt
{
if ((timerFinishedCycles - Cpu.TotalExecutedCycles >= 0)|| (interruptEnabled && interruptTriggered))
{
return 0x00;
}
else
{
return 0x80;
}
}
}
}
@ -109,6 +127,8 @@ namespace BizHawk.Emulation.Consoles.Atari
timerFinishedCycles = timerStartValue + Cpu.TotalExecutedCycles;
Console.WriteLine("6532 timer write: " + maskedAddr.ToString("x"));
interruptEnabled = ((addr & 0x08) != 0);
}
else
{

View File

@ -445,6 +445,11 @@ namespace BizHawk.Emulation.Consoles.Atari
player0copy1 = 16;
player0copy2 = 32;
break;
case 0x06:
player0copies = 2;
player0copy1 = 32;
player0copy2 = 64;
break;
}
}
else if (maskedAddr == 0x05) // NUSIZ1
@ -468,6 +473,11 @@ namespace BizHawk.Emulation.Consoles.Atari
player1copy1 = 16;
player1copy2 = 32;
break;
case 0x06:
player1copies = 2;
player1copy1 = 32;
player1copy2 = 64;
break;
}
}
else if (maskedAddr == 0x06) // COLUP0