Atari 2600 - restrict the access level of a bunch of things, and some slight reorg

This commit is contained in:
adelikat 2014-12-24 15:24:25 +00:00
parent 6c0a0401a9
commit 85730524ef
3 changed files with 56 additions and 52 deletions

View File

@ -15,18 +15,18 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private DCFilter _dcfilter;
private MapperBase _mapper;
public byte[] Ram;
internal byte[] Ram;
public byte[] Rom { get; private set; }
public MOS6502X Cpu { get; private set; }
public M6532 M6532 { get; private set; }
internal byte[] Rom { get; private set; }
internal MOS6502X Cpu { get; private set; }
internal M6532 M6532 { get; private set; }
public int LastAddress;
public int DistinctAccessCount;
internal int LastAddress;
internal int DistinctAccessCount;
private bool _frameStartPending = true;
public byte BaseReadMemory(ushort addr)
internal byte BaseReadMemory(ushort addr)
{
addr = (ushort)(addr & 0x1FFF);
if ((addr & 0x1080) == 0)
@ -42,7 +42,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
return Rom[addr & 0x0FFF];
}
public byte BasePeekMemory(ushort addr)
internal byte BasePeekMemory(ushort addr)
{
addr = (ushort)(addr & 0x1FFF);
if ((addr & 0x1080) == 0)
@ -58,7 +58,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
return Rom[addr & 0x0FFF];
}
public void BaseWriteMemory(ushort addr, byte value)
internal void BaseWriteMemory(ushort addr, byte value)
{
if (addr != LastAddress)
{
@ -81,7 +81,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
}
}
public void BasePokeMemory(ushort addr, byte value)
internal void BasePokeMemory(ushort addr, byte value)
{
addr = (ushort)(addr & 0x1FFF);
if ((addr & 0x1080) == 0)
@ -98,7 +98,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
}
}
public byte ReadMemory(ushort addr)
internal byte ReadMemory(ushort addr)
{
if (addr != LastAddress)
{
@ -113,14 +113,14 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
return temp;
}
public byte PeekMemory(ushort addr)
internal byte PeekMemory(ushort addr)
{
var temp = _mapper.ReadMemory((ushort)(addr & 0x1FFF));
return temp;
}
public void WriteMemory(ushort addr, byte value)
internal void WriteMemory(ushort addr, byte value)
{
if (addr != LastAddress)
{
@ -133,12 +133,12 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
MemoryCallbacks.CallWrites(addr);
}
public void PokeMemory(ushort addr, byte value)
internal void PokeMemory(ushort addr, byte value)
{
_mapper.PokeMemory((ushort)(addr & 0x1FFF), value);
}
public void ExecFetch(ushort addr)
private void ExecFetch(ushort addr)
{
MemoryCallbacks.CallExecutes(addr);
}
@ -157,7 +157,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
}
}
public void RebootCore()
private void RebootCore()
{
// Regenerate mapper here to make sure its state is entirely clean
switch (_game.GetOptionsDict()["m"])
@ -325,7 +325,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
get { return _pal ? DisplayType.PAL : Common.DisplayType.NTSC; }
}
public void HardReset()
private void HardReset()
{
Ram = new byte[128];
_mapper.HardReset();
@ -345,22 +345,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
Cpu.PC = (ushort)(ReadMemory(0x1FFC) + (ReadMemory(0x1FFD) << 8)); // set the initial PC
}
public void CycleAdvance()
{
StartFrameCond();
Cycle();
FinishFrameCond();
}
public void ScanlineAdvance()
{
StartFrameCond();
int currentLine = _tia.LineCount;
while (_tia.LineCount == currentLine)
Cycle();
FinishFrameCond();
}
public void FrameAdvance(bool render, bool rendersound)
{
StartFrameCond();
@ -369,7 +353,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
FinishFrameCond();
}
public void VFrameAdvance() // advance up to 500 lines looking for end of video frame
private void VFrameAdvance() // advance up to 500 lines looking for end of video frame
// after vsync falling edge, continues to end of next line
{
bool frameend = false;
@ -422,7 +406,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
_mapper.ClockCpu();
}
public byte ReadControls1(bool peek)
internal byte ReadControls1(bool peek)
{
InputCallbacks.Call();
byte value = 0xFF;
@ -441,7 +425,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
return value;
}
public byte ReadControls2(bool peek)
internal byte ReadControls2(bool peek)
{
InputCallbacks.Call();
byte value = 0xFF;
@ -460,7 +444,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
return value;
}
public byte ReadConsoleSwitches(bool peek)
internal byte ReadConsoleSwitches(bool peek)
{
byte value = 0xFF;
bool select = Controller["Select"];

View File

@ -147,5 +147,40 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
/*0xE0*/ 0,1,0,0,2,2,2,0,0,0,0,0,3,3,3,0,
/*0xF0*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0
};
#region Currently Unused Debug hooks
private void ScanlineAdvance()
{
StartFrameCond();
int currentLine = _tia.LineCount;
while (_tia.LineCount == currentLine)
Cycle();
FinishFrameCond();
}
private void CycleAdvance()
{
StartFrameCond();
Cycle();
FinishFrameCond();
}
private int CurrentScanLine
{
get { return _tia.LineCount; }
}
private bool IsVsync
{
get { return _tia.IsVSync; }
}
private bool IsVBlank
{
get { return _tia.IsVBlank; }
}
#endregion
}
}

View File

@ -93,21 +93,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
}
};
public int CurrentScanLine
{
get { return _tia.LineCount; }
}
public bool IsVsync
{
get { return _tia.IsVSync; }
}
public bool IsVBlank
{
get { return _tia.IsVBlank; }
}
public CompactGameInfo GenerateGameDbEntry()
{
return new CompactGameInfo