-Made Executive ROM and Graphics ROM read-only. I still haven't made the memory map accessibility limited by the VBlank Period, but I'm assuming that should come way later.

-Initialized the memory devices with a tentative size that ignores the unofficial ranges.
-Masked addresses to match those sizes (That's my understanding of what the memory map needs to do based on other examples).
-Added the ICart interface.
-Started the Intellicart parser; got far enough to know that the files I'm working with are not Intellicarts. ^_^
This commit is contained in:
brandman211 2012-07-15 08:38:50 +00:00
parent bd1aaf7ff7
commit 4f9539b73c
5 changed files with 150 additions and 112 deletions

View File

@ -114,6 +114,7 @@
<Compile Include="Consoles\GB\Input.cs" /> <Compile Include="Consoles\GB\Input.cs" />
<Compile Include="Consoles\GB\MemoryMap.cs" /> <Compile Include="Consoles\GB\MemoryMap.cs" />
<Compile Include="Consoles\GB\GB.cs" /> <Compile Include="Consoles\GB\GB.cs" />
<Compile Include="Consoles\Intellivision\Intellicart.cs" />
<Compile Include="Consoles\Intellivision\Intellivision.cs" /> <Compile Include="Consoles\Intellivision\Intellivision.cs" />
<Compile Include="Consoles\Intellivision\MemoryMap.cs" /> <Compile Include="Consoles\Intellivision\MemoryMap.cs" />
<Compile Include="Consoles\Nintendo\NES\APU.cs" /> <Compile Include="Consoles\Nintendo\NES\APU.cs" />
@ -311,6 +312,7 @@
<Compile Include="Interfaces\Base Implementations\NullController.cs" /> <Compile Include="Interfaces\Base Implementations\NullController.cs" />
<Compile Include="Interfaces\Base Implementations\NullEmulator.cs" /> <Compile Include="Interfaces\Base Implementations\NullEmulator.cs" />
<Compile Include="Interfaces\CoreComms.cs" /> <Compile Include="Interfaces\CoreComms.cs" />
<Compile Include="Interfaces\ICart.cs" />
<Compile Include="Properties\svnrev.cs" /> <Compile Include="Properties\svnrev.cs" />
<Compile Include="QuickCollections.cs" /> <Compile Include="QuickCollections.cs" />
<Compile Include="Sound\CDAudio.cs" /> <Compile Include="Sound\CDAudio.cs" />

View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Consoles.Intellivision
{
public sealed partial class Intellivision : ICart
{
private ushort[] memory = new ushort[65536];
public void Parse()
{
// Check to see if the header is valid.
if (Rom[0] != 0xA8 || Rom[1] != (0xFF ^ Rom[2]))
throw new ArgumentException();
}
public ushort ReadMemory(ushort addr, out bool responded)
{
responded = false;
return 0;
}
public void WriteMemory(ushort addr, ushort value, out bool responded)
{
responded = false;
}
}
}

View File

@ -5,117 +5,118 @@ using BizHawk.Emulation.CPUs.CP1610;
namespace BizHawk.Emulation.Consoles.Intellivision namespace BizHawk.Emulation.Consoles.Intellivision
{ {
public sealed partial class Intellivision : IEmulator public sealed partial class Intellivision : IEmulator
{ {
byte[] Rom; byte[] Rom;
GameInfo Game; GameInfo Game;
CP1610 Cpu ; CP1610 Cpu;
public Intellivision(GameInfo game, byte[] rom) public Intellivision(GameInfo game, byte[] rom)
{ {
Rom = rom; Rom = rom;
Game = game; Game = game;
Parse();
Cpu = new CP1610();
Cpu.ReadMemory = ReadMemory; Cpu = new CP1610();
Cpu.WriteMemory = WriteMemory; Cpu.ReadMemory = ReadMemory;
Cpu.WriteMemory = WriteMemory;
Cpu.RegisterPC = 0x1000; Cpu.RegisterPC = 0x1000;
CoreOutputComm = new CoreOutputComm();
}
public void FrameAdvance(bool render) CoreOutputComm = new CoreOutputComm();
{ }
Cpu.Execute(999); // execute some cycles. this will do nothing useful until a memory mapper is created.
} public void FrameAdvance(bool render)
{
Cpu.Execute(999); // execute some cycles. this will do nothing useful until a memory mapper is created.
}
// This is all crap to worry about later. // This is all crap to worry about later.
public IVideoProvider VideoProvider { get { return new NullEmulator(); } } public IVideoProvider VideoProvider { get { return new NullEmulator(); } }
public ISoundProvider SoundProvider { get { return NullSound.SilenceProvider; } } public ISoundProvider SoundProvider { get { return NullSound.SilenceProvider; } }
public ControllerDefinition ControllerDefinition public ControllerDefinition ControllerDefinition
{ {
get { return null; } get { return null; }
} }
public IController Controller { get; set; } public IController Controller { get; set; }
public int Frame
{
get { return 0; }
}
public int LagCount public int Frame
{ {
get { return 0; } get { return 0; }
set { } }
}
public bool IsLagFrame { get { return false; } } public int LagCount
public string SystemId {
{ get { return 0; }
get { return "INTV"; } set { }
} }
public bool DeterministicEmulation { get; set; } public bool IsLagFrame { get { return false; } }
public string SystemId
{
get { return "INTV"; }
}
public byte[] SaveRam { get { return null; } } public bool DeterministicEmulation { get; set; }
public bool SaveRamModified public byte[] SaveRam { get { return null; } }
{
get { return false; }
set { }
}
public void ResetFrameCounter() public bool SaveRamModified
{ {
} get { return false; }
set { }
}
public void SaveStateText(TextWriter writer) public void ResetFrameCounter()
{ {
throw new NotImplementedException(); }
}
public void LoadStateText(TextReader reader) public void SaveStateText(TextWriter writer)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void SaveStateBinary(BinaryWriter writer) public void LoadStateText(TextReader reader)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void LoadStateBinary(BinaryReader reader) public void SaveStateBinary(BinaryWriter writer)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public byte[] SaveStateBinary() public void LoadStateBinary(BinaryReader reader)
{ {
return new byte[0]; throw new NotImplementedException();
} }
public CoreInputComm CoreInputComm { get; set; } public byte[] SaveStateBinary()
public CoreOutputComm CoreOutputComm { get; private set; } {
return new byte[0];
}
public IList<MemoryDomain> MemoryDomains public CoreInputComm CoreInputComm { get; set; }
{ public CoreOutputComm CoreOutputComm { get; private set; }
get { throw new NotImplementedException(); }
}
public MemoryDomain MainMemory public IList<MemoryDomain> MemoryDomains
{ {
get { throw new NotImplementedException(); } get { throw new NotImplementedException(); }
} }
public void Dispose() public MemoryDomain MainMemory
{ {
} get { throw new NotImplementedException(); }
} }
public void Dispose()
{
}
}
} }

View File

@ -7,13 +7,13 @@ namespace BizHawk.Emulation.Consoles.Intellivision
{ {
public sealed partial class Intellivision public sealed partial class Intellivision
{ {
private ushort[] STIC_Registers; private ushort[] STIC_Registers = new ushort[64];
private ushort[] Scratchpad_RAM; private ushort[] Scratchpad_RAM = new ushort[240];
private ushort[] PSG_Registers; private ushort[] PSG_Registers = new ushort[16];
private ushort[] System_RAM; private ushort[] System_RAM = new ushort[352];
private ushort[] Executive_ROM; private ushort[] Executive_ROM = new ushort[4096];
private ushort[] Graphics_ROM; private ushort[] Graphics_ROM = new ushort[2048];
private ushort[] Graphics_RAM; private ushort[] Graphics_RAM = new ushort[512];
public ushort ReadMemory(ushort addr) public ushort ReadMemory(ushort addr)
{ {
@ -21,19 +21,19 @@ namespace BizHawk.Emulation.Consoles.Intellivision
{ {
case 0x0000: case 0x0000:
if (addr >= 0x0100 && addr <= 0x01EF) if (addr >= 0x0100 && addr <= 0x01EF)
return Scratchpad_RAM[addr]; return Scratchpad_RAM[addr & 0x00EF];
if (addr >= 0x01F0 && addr <= 0x01FF) if (addr >= 0x01F0 && addr <= 0x01FF)
return PSG_Registers[addr]; return PSG_Registers[addr & 0x000F];
if (addr >= 0x0200 && addr <= 0x035F) if (addr >= 0x0200 && addr <= 0x035F)
return System_RAM[addr]; return System_RAM[addr & 0x015F];
break; break;
case 0x1000: case 0x1000:
return Executive_ROM[addr]; return Executive_ROM[addr & 0x0FFF];
case 0x3000: case 0x3000:
if (addr >= 0x3000 && addr <= 0x37FF) if (addr >= 0x3000 && addr <= 0x37FF)
return Graphics_ROM[addr]; return Graphics_ROM[addr & 0x07FF];
if (addr >= 0x3800 && addr <= 0x39FF) if (addr >= 0x3800 && addr <= 0x39FF)
return Graphics_RAM[addr]; return Graphics_RAM[addr & 0x01FF];
break; break;
} }
throw new NotImplementedException(); throw new NotImplementedException();
@ -46,32 +46,24 @@ namespace BizHawk.Emulation.Consoles.Intellivision
case 0x0000: case 0x0000:
if (addr >= 0x0100 && addr <= 0x01EF) if (addr >= 0x0100 && addr <= 0x01EF)
{ {
Scratchpad_RAM[addr] = value; Scratchpad_RAM[addr & 0x00EF] = value;
return; return;
} }
if (addr >= 0x01F0 && addr <= 0x01FF) if (addr >= 0x01F0 && addr <= 0x01FF)
{ {
PSG_Registers[addr] = value; PSG_Registers[addr & 0x000F] = value;
return; return;
} }
if (addr >= 0x0200 && addr <= 0x035F) if (addr >= 0x0200 && addr <= 0x035F)
{ {
System_RAM[addr] = value; System_RAM[addr & 0x015F] = value;
return; return;
} }
break; break;
case 0x1000:
Executive_ROM[addr] = value;
return;
case 0x3000: case 0x3000:
if (addr >= 0x3000 && addr <= 0x37FF)
{
Graphics_ROM[addr] = value;
return;
}
if (addr >= 0x3800 && addr <= 0x39FF) if (addr >= 0x3800 && addr <= 0x39FF)
{ {
Graphics_RAM[addr] = value; Graphics_RAM[addr & 0x01FF] = value;
return; return;
} }
break; break;

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk
{
public interface ICart
{
ushort ReadMemory(ushort addr, out bool responded);
void WriteMemory(ushort addr, ushort value, out bool responded);
}
}