Add files via upload

This commit is contained in:
alyosha-tas 2017-05-24 20:40:02 -04:00 committed by GitHub
parent a2ab02f9d9
commit 7ce43e1438
4 changed files with 164 additions and 3 deletions

View File

@ -24,6 +24,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
_lagcount++;
}
maria.FrameAdvance();
}
public int Frame => _frame;
@ -45,7 +47,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
maria = null;
tia = null;
m6532 = null;
}
}
}

View File

@ -14,6 +14,12 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
[ServiceNotApplicable(typeof(ISettable<,>), typeof(IDriveLight))]
public partial class A7800Hawk : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable
{
// this register selects between 2600 and 7800 mode in the A7800
// however, we already have a 2600 emulator so this core will only be loading A7800 games
// furthermore, the location of the register is in the same place as TIA registers (0x0-0x1F)
// any writes to this location before the register is 'locked' will go to the register and not the TIA
public byte A7800_control_register;
// memory domains
public byte[] TIA_regs = new byte[0x20];
public byte[] Maria_regs = new byte[0x20];
@ -114,9 +120,12 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
private void HardReset()
{
A7800_control_register = 0;
tia.Reset();
cpu.Reset();
maria.Reset();
m6532 = new M6532();
}
/*

View File

@ -25,6 +25,9 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
public int VsyncNumerator => _frameHz;
public int VsyncDenominator => 1;
//Maria related variables
public int cycle;
public void FrameAdvance()
{
@ -32,7 +35,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
public void Reset()
{
cycle = 0;
}
}

View File

@ -0,0 +1,147 @@
using System;
using BizHawk.Common.BufferExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components.M6502;
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
public partial class A7800Hawk
{
public byte ReadMemory(int addr)
{
addr &= 0xFFFF;
if (addr < 0x0400) {
if ((addr & 0xFF) < 0x20)
{
// return TIA registers or control register if it is still unlocked
if ((A7800_control_register & 0x1) == 0 && (addr < 0x20))
{
return 0xFF; // TODO: what to return here?
}
else
{
return TIA_regs[addr]; // TODO: what to return here?
}
}
else if ((addr & 0xFF) < 0x40)
{
return Maria_regs[(addr & 0x3F) - 0x20];
}
else if (addr < 0x100)
{
// RAM block 0
return RAM[addr - 0x40 + 0x840];
}
else if (addr < 0x200)
{
// RAM block 1
return RAM[addr - 0x140 + 0x940];
}
else if (addr < 0x300)
{
return regs_6532[addr - 0x240];
}
else
{
return 0xFF; // what is mapped here?
}
}
else if (addr < 0x480)
{
return 0xFF; // cartridge space available
}
else if (addr < 0x500)
{
// this is where RAM for the 6532 resides for use in 2600 mode
return 0xFF;
}
else if (addr < 0x1800)
{
return 0xFF; // cartridge space available
}
else if (addr < 0x2800)
{
return RAM[addr - 0x1800];
}
else if (addr < 0x4000)
{
return RAM[addr - 0x2800 + 0x800];
}
else
{
return 0xFF; // cartridge and other OPSYS
}
}
public void WriteMemory(int addr, byte value)
{
addr &= 0xFFFF;
if (addr < 0x0400)
{
if ((addr & 0xFF) < 0x20)
{
// return TIA registers or control register if it is still unlocked
if ((A7800_control_register & 0x1) == 0 && (addr < 0x20))
{
A7800_control_register = value; // TODO: what to return here?
}
else
{
TIA_regs[addr] = value; // TODO: what to return here?
}
}
else if ((addr & 0xFF) < 0x40)
{
Maria_regs[(addr & 0x3F) - 0x20] = value;
}
else if (addr < 0x100)
{
// RAM block 0
RAM[addr - 0x40 + 0x840] = value;
}
else if (addr < 0x200)
{
// RAM block 1
RAM[addr - 0x140 + 0x940] = value;
}
else if (addr < 0x300)
{
regs_6532[addr - 0x240] = value;
}
else
{
// what is mapped here?
}
}
else if (addr < 0x480)
{
// cartridge space available
}
else if (addr < 0x500)
{
// this is where RAM for the 6532 resides for use in 2600 mode
// is it accessible in 7800 mode?
}
else if (addr < 0x1800)
{
// cartridge space available
}
else if (addr < 0x2800)
{
RAM[addr - 0x1800] = value;
}
else if (addr < 0x4000)
{
RAM[addr - 0x2800 + 0x800] = value;
}
else
{
// cartridge and other OPSYS
}
}
}
}