Atari 2600: Added support to read UDLR from controller

M6532: Gives controller data to game program
TIA: Fixed player reflecting error
This commit is contained in:
pjgat09 2012-03-12 21:16:38 +00:00
parent 8938290e36
commit b9a791ab30
3 changed files with 20 additions and 6 deletions

View File

@ -54,7 +54,6 @@ namespace BizHawk
// registers
// else
// ROM
public byte ReadMemory(ushort addr)
{
ushort maskedAddr = (ushort)(addr & 0x1FFF);
@ -112,7 +111,7 @@ namespace BizHawk
// Setup TIA
tia = new TIA(cpu, frameBuffer);
// Setup 6532
m6532 = new M6532(cpu, ram);
m6532 = new M6532(cpu, ram, this);
//setup the system state here. for instance..
// Read from the reset vector for where to start
@ -161,5 +160,16 @@ namespace BizHawk
//run one frame's worth of cpu cyclees (i.e. do the emulation!)
//this should generate the framebuffer as it goes.
}
public byte ReadControls1()
{
byte value = 0xFF;
if (Controller["P1 Up"]) value &= 0xEF;
if (Controller["P1 Down"]) value &= 0xDF;
if (Controller["P1 Left"]) value &= 0xBF;
if (Controller["P1 Right"]) value &= 0x7F;
return value;
}
}
}

View File

@ -13,11 +13,14 @@ namespace BizHawk.Emulation.Consoles.Atari
public int timerStartValue;
public int timerFinishedCycles;
public int timerShift;
Atari2600 core;
public M6532(MOS6507 cpu, byte[] ram)
public M6532(MOS6507 cpu, byte[] ram, Atari2600 core)
{
Cpu = cpu;
this.ram = ram;
this.core = core;
// Apparently this will break for some games (Solaris and H.E.R.O.). We shall see
timerFinishedCycles = 0;
@ -60,7 +63,8 @@ namespace BizHawk.Emulation.Consoles.Atari
Console.WriteLine("6532 register read: " + maskedAddr.ToString("x"));
if (maskedAddr == 0x00) // SWCHA
{
return 0xFF;
return core.ReadControls1();
//return 0xFF;
}
else if (maskedAddr == 0x01) // SWACNT
{

View File

@ -408,11 +408,11 @@ namespace BizHawk.Emulation.Consoles.Atari
}
else if (maskedAddr == 0x0B) // REFP0
{
player0.reflect = ((value & 0x04) != 0);
player0.reflect = ((value & 0x08) != 0);
}
else if (maskedAddr == 0x0C) // REFP1
{
player1.reflect = ((value & 0x04) != 0);
player1.reflect = ((value & 0x08) != 0);
}
else if (maskedAddr == 0x0D) // PF0
{