From b83bb1901d6403cb9e2211aef31957575a185c0a Mon Sep 17 00:00:00 2001 From: brandman211 Date: Sun, 5 Aug 2012 05:59:55 +0000 Subject: [PATCH] -When neither the cartridge nor hardware responds to a read, it now returns 0xFFFF instead of throwing an exception. -I will now assume that 0x7000 is not mapped for the sake of continuing on. I will need to implement a mapper system shortly though. --Did the same thing for 0x4800. -AND@, MOVR, CMP enabled. -Made the logging separator generate before an instruction instead of after the register states. This is quite petty, but I don't like the separator at the end of the file. I hit an infinite loop, and I'm very very certain it's happening because I don't have an interrupt system yet. Time to stop avoiding that! --- BizHawk.Emulation/CPUs/CP1610/CP1610.cs | 2 -- BizHawk.Emulation/CPUs/CP1610/Execute.cs | 5 ++--- BizHawk.Emulation/Consoles/Intellivision/Cartridge.cs | 10 +++++++--- .../Consoles/Intellivision/Intellivision.cs | 2 +- BizHawk.Emulation/Consoles/Intellivision/MemoryMap.cs | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/BizHawk.Emulation/CPUs/CP1610/CP1610.cs b/BizHawk.Emulation/CPUs/CP1610/CP1610.cs index 14aa393b4b..f93ce3bb73 100644 --- a/BizHawk.Emulation/CPUs/CP1610/CP1610.cs +++ b/BizHawk.Emulation/CPUs/CP1610/CP1610.cs @@ -39,8 +39,6 @@ namespace BizHawk.Emulation.CPUs.CP1610 log.WriteLine("O = {0:X4}", FlagO); log.WriteLine("I = {0:X4}", FlagI); log.WriteLine("D = {0:X4}", FlagD); - log.WriteLine("------"); - log.WriteLine(); log.Flush(); } } diff --git a/BizHawk.Emulation/CPUs/CP1610/Execute.cs b/BizHawk.Emulation/CPUs/CP1610/Execute.cs index b7cee1e7c3..b707577a29 100644 --- a/BizHawk.Emulation/CPUs/CP1610/Execute.cs +++ b/BizHawk.Emulation/CPUs/CP1610/Execute.cs @@ -43,6 +43,8 @@ namespace BizHawk.Emulation.CPUs.CP1610 if (logging) { int addrToAdvance; + log.WriteLine("------"); + log.WriteLine(); log.WriteLine(Disassemble(RegisterPC, out addrToAdvance)); log.Flush(); } @@ -545,7 +547,6 @@ namespace BizHawk.Emulation.CPUs.CP1610 case 0x0BD: case 0x0BE: case 0x0BF: - throw new NotImplementedException(); src = (byte)((opcode >> 3) & 0x7); dest = (byte)(opcode & 0x7); result = Register[src]; @@ -1521,7 +1522,6 @@ namespace BizHawk.Emulation.CPUs.CP1610 case 0x345: case 0x346: case 0x347: - throw new NotImplementedException(); dest = (byte)(opcode & 0x7); addr = ReadMemory(RegisterPC++); dest_value = Register[dest]; @@ -1702,7 +1702,6 @@ namespace BizHawk.Emulation.CPUs.CP1610 case 0x3BD: case 0x3BE: case 0x3BF: - throw new NotImplementedException(); mem = (byte)((opcode >> 3) & 0x7); dest = (byte)(opcode & 0x7); // Auto-decrement the stack pointer if it's the memory register. diff --git a/BizHawk.Emulation/Consoles/Intellivision/Cartridge.cs b/BizHawk.Emulation/Consoles/Intellivision/Cartridge.cs index 79900fdd20..537c6bdd45 100644 --- a/BizHawk.Emulation/Consoles/Intellivision/Cartridge.cs +++ b/BizHawk.Emulation/Consoles/Intellivision/Cartridge.cs @@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision public int Parse(byte[] Rom) { - // TODO: Fix. + // TODO: Determine which loading method, if either, is correct. int index = 0; // Combine every two bytes into a word. while (index + 1 < Rom.Length) @@ -53,7 +53,9 @@ namespace BizHawk.Emulation.Consoles.Intellivision // OK if no ECS. return Data[dest]; else if (addr == 0x4800) - return Data[dest]; + // return Data[dest]; + // For now, assume unmapped. TODO: Fix. + return null; else return Data[dest]; case 0x5000: @@ -67,7 +69,9 @@ namespace BizHawk.Emulation.Consoles.Intellivision dest = (addr - 0x7000) + 0x4C00; if (addr == 0x7000) // OK if no ECS. - return Data[dest]; + // return Data[dest]; + // For now, assume unmapped. TODO: Fix. + return null; else if (addr <= 0x77FF) // OK if no ECS. return Data[dest]; diff --git a/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs b/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs index cec93f67de..3d950932e3 100644 --- a/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs +++ b/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs @@ -61,7 +61,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision public void FrameAdvance(bool render) { - Cpu.Execute(999); // execute some cycles. this will do nothing useful until a memory mapper is created. + Cpu.Execute(9999999); } diff --git a/BizHawk.Emulation/Consoles/Intellivision/MemoryMap.cs b/BizHawk.Emulation/Consoles/Intellivision/MemoryMap.cs index bbe05a2cc3..223bf98d08 100644 --- a/BizHawk.Emulation/Consoles/Intellivision/MemoryMap.cs +++ b/BizHawk.Emulation/Consoles/Intellivision/MemoryMap.cs @@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision { public sealed partial class Intellivision { - private const string INVALID = "Invalid memory address."; + private const ushort UNMAPPED = 0xFFFF; private ushort[] STIC_Registers = new ushort[64]; private ushort[] Scratchpad_RAM = new ushort[240]; @@ -146,7 +146,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision if (cart != null) return (ushort)cart; else if (core == null) - throw new ArgumentException(INVALID); + return UNMAPPED; return (ushort)core; }