-Loaded EROM / GROM.

-Fixed disassembly for JMP:
--Now it uses the parameter pc, not RegisterPC.
--I was loading both the second and third value from the second's address.
--Casting the calculated addresses to bytes when addresses are 16-bit was a bad idea.
--Removed a closing parenthesis I accidentally stuck in the formatting.

It seems that I've gotten far enough to use the Executive ROM as a test case! Now to go instruction by instruction and see if they work as planned and hope this will all eventually make something.
This commit is contained in:
brandman211 2012-07-19 00:05:08 +00:00
parent 198c60af88
commit e73c48219a
2 changed files with 30 additions and 4 deletions

View File

@ -15,7 +15,7 @@ namespace BizHawk.Emulation.CPUs.CP1610
byte register;
int second, third, op1, op2;
string result = "";
int opcode = ReadMemory(RegisterPC) & 0x3FF;
int opcode = ReadMemory(pc) & 0x3FF;
switch (opcode)
{
case 0x000:
@ -28,8 +28,8 @@ namespace BizHawk.Emulation.CPUs.CP1610
return "DIS";
case 0x004:
// 0000:0000:0000:0100 0000:00rr:aaaa:aaff 0000:00aa:aaaa:aaaa
second = ReadMemory((byte)(RegisterPC + 1));
third = ReadMemory((byte)(RegisterPC + 1));
second = ReadMemory((ushort)(pc + 1));
third = ReadMemory((ushort)(pc + 2));
// rr indicates the register into which to store the return address
register = (byte)(((second >> 8) & 0x3) + 4);
// ff indicates how to affect the Interrupt (I) flag in the CP1610
@ -53,7 +53,7 @@ namespace BizHawk.Emulation.CPUs.CP1610
}
if (register != 0x3)
result += " R" + register + ",";
result += string.Format(" ${0:X4})", op2);
result += string.Format(" ${0:X4}", op2);
bytesToAdvance = 3;
return result;
case 0x005:

View File

@ -12,10 +12,36 @@ namespace BizHawk.Emulation.Consoles.Intellivision
CP1610 Cpu;
public void LoadExecutive_ROM()
{
FileStream fs = new FileStream("C:/erom.int", FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
byte[] erom = r.ReadBytes(8192);
int index = 0;
// Combine every two bytes into a word.
while (index + 1 < erom.Length)
Executive_ROM[index / 2] = (ushort)((erom[index++] << 8) | erom[index++]);
r.Close();
fs.Close();
}
public void LoadGraphics_ROM()
{
FileStream fs = new FileStream("C:/grom.int", FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
byte[] grom = r.ReadBytes(2048);
for (int index = 0; index < grom.Length; index++)
Graphics_ROM[index] = grom[index];
r.Close();
fs.Close();
}
public Intellivision(GameInfo game, byte[] rom)
{
Rom = rom;
Game = game;
LoadExecutive_ROM();
LoadGraphics_ROM();
Parse();
Cpu = new CP1610();