From c6cf18061f152305ae0c1c48206e63c1bab06c07 Mon Sep 17 00:00:00 2001 From: brandman211 Date: Fri, 10 Aug 2012 20:40:34 +0000 Subject: [PATCH] Scratchpad RAM, Graphics ROM, and Graphics RAM are apparently all 8-bit. --- .../Consoles/Intellivision/Intellivision.cs | 12 ++-- .../Consoles/Intellivision/MemoryMap.cs | 62 +++++++++---------- .../Consoles/Intellivision/PSG.cs | 6 +- .../Consoles/Intellivision/STIC.cs | 32 +++++----- 4 files changed, 56 insertions(+), 56 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs b/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs index 61cc62d8b8..03edb888f5 100644 --- a/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs +++ b/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs @@ -15,7 +15,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision STIC Stic; PSG Psg; - public void LoadExecutive_ROM() + public void LoadExecutiveRom() { FileStream fs = new FileStream("C:/erom.int", FileMode.Open, FileAccess.Read); BinaryReader r = new BinaryReader(fs); @@ -23,18 +23,18 @@ namespace BizHawk.Emulation.Consoles.Intellivision 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++]); + ExecutiveRom[index / 2] = (ushort)((erom[index++] << 8) | erom[index++]); r.Close(); fs.Close(); } - public void LoadGraphics_ROM() + public void LoadGraphicsRom() { 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]; + GraphicsRom[index] = grom[index]; r.Close(); fs.Close(); } @@ -43,8 +43,8 @@ namespace BizHawk.Emulation.Consoles.Intellivision { Rom = rom; Game = game; - LoadExecutive_ROM(); - LoadGraphics_ROM(); + LoadExecutiveRom(); + LoadGraphicsRom(); Cart = new Intellicart(); if (Cart.Parse(Rom) == -1) { diff --git a/BizHawk.Emulation/Consoles/Intellivision/MemoryMap.cs b/BizHawk.Emulation/Consoles/Intellivision/MemoryMap.cs index 36f0830657..f3b1aab9f8 100644 --- a/BizHawk.Emulation/Consoles/Intellivision/MemoryMap.cs +++ b/BizHawk.Emulation/Consoles/Intellivision/MemoryMap.cs @@ -9,11 +9,11 @@ namespace BizHawk.Emulation.Consoles.Intellivision { private const ushort UNMAPPED = 0xFFFF; - private ushort[] Scratchpad_RAM = new ushort[240]; - private ushort[] System_RAM = new ushort[352]; - private ushort[] Executive_ROM = new ushort[4096]; // TODO: Intellivision II support? - private ushort[] Graphics_ROM = new ushort[2048]; - private ushort[] Graphics_RAM = new ushort[512]; + private byte[] ScratchpadRam = new byte[240]; + private ushort[] SystemRam = new ushort[352]; + private ushort[] ExecutiveRom = new ushort[4096]; // TODO: Intellivision II support? + private byte[] GraphicsRom = new byte[2048]; + private byte[] GraphicsRam = new byte[512]; public ushort ReadMemory(ushort addr) { @@ -31,12 +31,12 @@ namespace BizHawk.Emulation.Consoles.Intellivision // Unoccupied. break; else if (addr <= 0x01EF) - core = Scratchpad_RAM[addr - 0x0100]; + core = (ushort)(ScratchpadRam[addr - 0x0100] & 0x00FF); else if (addr <= 0x01FF) // PSG. break; else if (addr <= 0x035F) - core = System_RAM[addr - 0x0200]; + core = SystemRam[addr - 0x0200]; else if (addr <= 0x03FF) // TODO: Garbage values for Intellivision II. break; @@ -45,24 +45,24 @@ namespace BizHawk.Emulation.Consoles.Intellivision break; break; case 0x1000: - core = Executive_ROM[addr - 0x1000]; + core = ExecutiveRom[addr - 0x1000]; break; case 0x3000: if (addr <= 0x37FF) // TODO: OK only during VBlank Period 2. - core = Graphics_ROM[addr - 0x3000]; + core = (byte)(GraphicsRom[addr - 0x3000] & 0x00FF); else if (addr <= 0x39FF) // TODO: OK only during VBlank Period 2. - core = Graphics_RAM[addr - 0x3800]; + core = (byte)(GraphicsRam[addr - 0x3800] & 0x00FF); else if (addr <= 0x3BFF) // TODO: OK only during VBlank Period 2. - core = Graphics_RAM[addr - 0x3A00]; + core = (byte)(GraphicsRam[addr - 0x3A00] & 0x00FF); else if (addr <= 0x3DFF) // TODO: OK only during VBlank Period 2. - core = Graphics_RAM[addr - 0x3C00]; + core = (byte)(GraphicsRam[addr - 0x3C00] & 0x00FF); else // TODO: OK only during VBlank Period 2. - core = Graphics_RAM[addr - 0x3E00]; + core = (byte)(GraphicsRam[addr - 0x3E00] & 0x00FF); break; case 0x7000: if (addr <= 0x77FF) @@ -140,7 +140,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision break; else if (addr <= 0x01EF) { - Scratchpad_RAM[addr - 0x0100] = value; + ScratchpadRam[addr - 0x0100] = (byte)(value & 0x00FF); return true; } else if (addr <= 0x01FF) @@ -150,7 +150,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision } else if (addr <= 0x035F) { - System_RAM[addr - 0x0200] = value; + SystemRam[addr - 0x0200] = value; return true; } else if (addr <= 0x03FF) @@ -170,25 +170,25 @@ namespace BizHawk.Emulation.Consoles.Intellivision else if (addr <= 0x39FF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0x3800] = value; + GraphicsRam[addr - 0x3800] = (byte)(value & 0x00FF); return true; } else if (addr <= 0x3BFF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0x3A00] = value; + GraphicsRam[addr - 0x3A00] = (byte)(value & 0x00FF); return true; } else if (addr <= 0x3DFF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0x3C00] = value; + GraphicsRam[addr - 0x3C00] = (byte)(value & 0x00FF); return true; } else { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0x3E00] = value; + GraphicsRam[addr - 0x3E00] = (byte)(value & 0x00FF); return true; } case 0x7000: @@ -198,25 +198,25 @@ namespace BizHawk.Emulation.Consoles.Intellivision else if (addr <= 0x79FF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr & 0x01FF] = value; + GraphicsRam[addr & 0x01FF] = (byte)(value & 0x00FF); return true; } else if (addr <= 0x7BFF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr & 0x01FF] = value; + GraphicsRam[addr & 0x01FF] = (byte)(value & 0x00FF); return true; } else if (addr <= 0x7DFF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr & 0x01FF] = value; + GraphicsRam[addr & 0x01FF] = (byte)(value & 0x00FF); return true; } else { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr & 0x01FF] = value; + GraphicsRam[addr & 0x01FF] = (byte)(value & 0x00FF); return true; } case 0x9000: @@ -228,25 +228,25 @@ namespace BizHawk.Emulation.Consoles.Intellivision else if (addr <= 0xB9FF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0xB800] = value; + GraphicsRam[addr - 0xB800] = (byte)(value & 0x00FF); return true; } else if (addr <= 0xBBFF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0xBA00] = value; + GraphicsRam[addr - 0xBA00] = (byte)(value & 0x00FF); return true; } else if (addr <= 0xBDFF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0xBC00] = value; + GraphicsRam[addr - 0xBC00] = (byte)(value & 0x00FF); return true; } else { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0xBE00] = value; + GraphicsRam[addr - 0xBE00] = (byte)(value & 0x00FF); return true; } case 0xF000: @@ -256,25 +256,25 @@ namespace BizHawk.Emulation.Consoles.Intellivision else if (addr <= 0xF9FF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0xF800] = value; + GraphicsRam[addr - 0xF800] = (byte)(value & 0x00FF); return true; } else if (addr <= 0xFBFF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0xFA00] = value; + GraphicsRam[addr - 0xFA00] = (byte)(value & 0x00FF); return true; } else if (addr <= 0xFDFF) { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0xFC00] = value; + GraphicsRam[addr - 0xFC00] = (byte)(value & 0x00FF); return true; } else { // TODO: OK only during VBlank Period 2. - Graphics_RAM[addr - 0xFE00] = value; + GraphicsRam[addr - 0xFE00] = (byte)(value & 0x00FF); return true; } } diff --git a/BizHawk.Emulation/Consoles/Intellivision/PSG.cs b/BizHawk.Emulation/Consoles/Intellivision/PSG.cs index a358d4612c..991ca4b24e 100644 --- a/BizHawk.Emulation/Consoles/Intellivision/PSG.cs +++ b/BizHawk.Emulation/Consoles/Intellivision/PSG.cs @@ -7,12 +7,12 @@ namespace BizHawk.Emulation.Consoles.Intellivision { public sealed class PSG { - private ushort[] Registers = new ushort[16]; + private ushort[] Register = new ushort[16]; public ushort? ReadPSG(ushort addr) { if (addr >= 0x01F0 && addr <= 0x01FF) - return Registers[addr - 0x01F0]; + return Register[addr - 0x01F0]; return null; } @@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision { if (addr >= 0x01F0 && addr <= 0x01FF) { - Registers[addr - 0x01F0] = value; + Register[addr - 0x01F0] = value; return true; } return false; diff --git a/BizHawk.Emulation/Consoles/Intellivision/STIC.cs b/BizHawk.Emulation/Consoles/Intellivision/STIC.cs index 030dfba4ae..78e1b223f3 100644 --- a/BizHawk.Emulation/Consoles/Intellivision/STIC.cs +++ b/BizHawk.Emulation/Consoles/Intellivision/STIC.cs @@ -7,8 +7,8 @@ namespace BizHawk.Emulation.Consoles.Intellivision { public sealed class STIC { - private ushort[] Registers = new ushort[64]; - private bool FGBG = false; + private bool Sr1, Sr2, Fgbg = false; + private ushort[] Register = new ushort[64]; public ushort? ReadSTIC(ushort addr) { @@ -19,19 +19,19 @@ namespace BizHawk.Emulation.Consoles.Intellivision { // TODO: OK only during VBlank Period 1. if (addr == 0x0021) - FGBG = false; - return Registers[addr]; + Fgbg = false; + return Register[addr]; } else if (addr <= 0x007F) // TODO: OK only during VBlank Period 2. - return Registers[addr - 0x0040]; + return Register[addr - 0x0040]; break; case 0x4000: if (addr <= 0x403F) { // TODO: OK only during VBlank Period 1. if (addr == 0x4021) - FGBG = false; + Fgbg = false; } break; case 0x8000: @@ -39,7 +39,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision { // TODO: OK only during VBlank Period 1. if (addr == 0x8021) - FGBG = false; + Fgbg = false; } break; case 0xC000: @@ -47,7 +47,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision { // TODO: OK only during VBlank Period 1. if (addr == 0xC021) - FGBG = false; + Fgbg = false; } break; } @@ -63,8 +63,8 @@ namespace BizHawk.Emulation.Consoles.Intellivision { // TODO: OK only during VBlank Period 1. if (addr == 0x0021) - FGBG = true; - Registers[addr] = value; + Fgbg = true; + Register[addr] = value; return true; } else if (addr <= 0x007F) @@ -76,8 +76,8 @@ namespace BizHawk.Emulation.Consoles.Intellivision { // TODO: OK only during VBlank Period 1. if (addr == 0x4021) - FGBG = true; - Registers[addr - 0x4000] = value; + Fgbg = true; + Register[addr - 0x4000] = value; return true; } break; @@ -86,8 +86,8 @@ namespace BizHawk.Emulation.Consoles.Intellivision { // TODO: OK only during VBlank Period 1. if (addr == 0x8021) - FGBG = true; - Registers[addr & 0x003F] = value; + Fgbg = true; + Register[addr & 0x003F] = value; return true; } break; @@ -96,8 +96,8 @@ namespace BizHawk.Emulation.Consoles.Intellivision { // TODO: OK only during VBlank Period 1. if (addr == 0xC021) - FGBG = true; - Registers[addr - 0xC000] = value; + Fgbg = true; + Register[addr - 0xC000] = value; return true; } break;