From 1a760096bc93ec94b9d80feae8df2cc833ebd94e Mon Sep 17 00:00:00 2001 From: brandman211 Date: Wed, 5 Sep 2012 04:42:49 +0000 Subject: [PATCH] -Laid out the groundwork for the video provider. --VirtualHeight / Width will be useful due to how the scanlines are doubled on TVs, but for now, I will just be drawing to scale. -Enabled XOR@, SAR, and COMR. Advanced Dungeons & Dragons provided more test cases. -Noticed that Commando, as well as some other games, triggers a HLT. This should be looked into later. --- BizHawk.Emulation/CPUs/CP1610/CP1610.cs | 38 +++++++++---------- BizHawk.Emulation/CPUs/CP1610/Execute.cs | 23 +++++------ .../Consoles/Intellivision/Intellivision.cs | 15 ++------ .../Consoles/Intellivision/STIC.cs | 10 ++++- 4 files changed, 42 insertions(+), 44 deletions(-) diff --git a/BizHawk.Emulation/CPUs/CP1610/CP1610.cs b/BizHawk.Emulation/CPUs/CP1610/CP1610.cs index 1403ab718b..5e1ef8bb7a 100644 --- a/BizHawk.Emulation/CPUs/CP1610/CP1610.cs +++ b/BizHawk.Emulation/CPUs/CP1610/CP1610.cs @@ -19,13 +19,13 @@ namespace BizHawk.Emulation.CPUs.CP1610 public Func ReadMemory; public Func WriteMemory; - private static bool logging = true; - private static StreamWriter log; + private static bool Logging = false; + private static StreamWriter Log; static CP1610() { - if (logging) - log = new StreamWriter("log_CP1610.txt"); + if (Logging) + Log = new StreamWriter("log_CP1610.txt"); } public void Reset() @@ -65,23 +65,23 @@ namespace BizHawk.Emulation.CPUs.CP1610 public void LogData() { - if (!logging) + if (!Logging) return; for (int register = 0; register <= 5; register++) - log.WriteLine("R{0:d} = {1:X4}", register, Register[register]); - log.WriteLine("SP = {0:X4}", RegisterSP); - log.WriteLine("PC = {0:X4}", RegisterPC); - log.WriteLine("S = {0}", FlagS); - log.WriteLine("C = {0}", FlagC); - log.WriteLine("Z = {0}", FlagZ); - log.WriteLine("O = {0}", FlagO); - log.WriteLine("I = {0}", FlagI); - log.WriteLine("D = {0}", FlagD); - log.WriteLine("INTRM = {0}", IntRM); - log.WriteLine("BUSRQ = {0}", BusRq); - log.WriteLine("BUSAK = {0}", BusAk); - log.WriteLine("MSYNC = {0}", MSync); - log.Flush(); + Log.WriteLine("R{0:d} = {1:X4}", register, Register[register]); + Log.WriteLine("SP = {0:X4}", RegisterSP); + Log.WriteLine("PC = {0:X4}", RegisterPC); + Log.WriteLine("S = {0}", FlagS); + Log.WriteLine("C = {0}", FlagC); + Log.WriteLine("Z = {0}", FlagZ); + Log.WriteLine("O = {0}", FlagO); + Log.WriteLine("I = {0}", FlagI); + Log.WriteLine("D = {0}", FlagD); + Log.WriteLine("INTRM = {0}", IntRM); + Log.WriteLine("BUSRQ = {0}", BusRq); + Log.WriteLine("BUSAK = {0}", BusAk); + Log.WriteLine("MSYNC = {0}", MSync); + Log.Flush(); } } } diff --git a/BizHawk.Emulation/CPUs/CP1610/Execute.cs b/BizHawk.Emulation/CPUs/CP1610/Execute.cs index 73c5d3f90d..defff0dd43 100644 --- a/BizHawk.Emulation/CPUs/CP1610/Execute.cs +++ b/BizHawk.Emulation/CPUs/CP1610/Execute.cs @@ -98,12 +98,12 @@ namespace BizHawk.Emulation.CPUs.CP1610 */ if (FlagI && Interruptible && !IntRM && !Interrupted) { - if (logging) + if (Logging) { - log.WriteLine("------"); - log.WriteLine(); - log.WriteLine("Interrupt"); - log.Flush(); + Log.WriteLine("------"); + Log.WriteLine(); + Log.WriteLine("Interrupt"); + Log.Flush(); } Interrupted = true; Interruptible = false; @@ -111,13 +111,13 @@ namespace BizHawk.Emulation.CPUs.CP1610 RegisterPC = INTERRUPT; return 28; } - if (logging) + if (Logging) { int addrToAdvance; - log.WriteLine("------"); - log.WriteLine(); - log.WriteLine(Disassemble(RegisterPC, out addrToAdvance)); - log.Flush(); + Log.WriteLine("------"); + Log.WriteLine(); + Log.WriteLine(Disassemble(RegisterPC, out addrToAdvance)); + Log.Flush(); } byte dest, src, mem; ushort dest_value, src_value, mem_read, addr, addr_read, offset; @@ -227,7 +227,6 @@ namespace BizHawk.Emulation.CPUs.CP1610 case 0x01D: case 0x01E: case 0x01F: - throw new NotImplementedException(); dest = (byte)(opcode & 0x7); result = (Register[dest] ^ 0xFFFF); Calc_FlagS(result); @@ -470,7 +469,6 @@ namespace BizHawk.Emulation.CPUs.CP1610 case 0x06D: case 0x06E: case 0x06F: - throw new NotImplementedException(); dest = (byte)(opcode & 0x3); dest_value = Register[dest]; sign = dest_value & 0x8000; @@ -1776,7 +1774,6 @@ namespace BizHawk.Emulation.CPUs.CP1610 case 0x3FD: case 0x3FE: case 0x3FF: - throw new NotImplementedException(); mem = (byte)((opcode >> 3) & 0x7); dest = (byte)(opcode & 0x7); mem_read = Indirect_Get(mem); diff --git a/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs b/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs index bbf149a67e..a4daa0d722 100644 --- a/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs +++ b/BizHawk.Emulation/Consoles/Intellivision/Intellivision.cs @@ -78,6 +78,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision public void FrameAdvance(bool render) { + Frame++; Cpu.AddPendingCycles(14394 + 3791); while (Cpu.GetPendingCycles() > 0) { @@ -88,11 +89,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision } } - - - // This is all crap to worry about later. - - public IVideoProvider VideoProvider { get { return new NullEmulator(); } } + public IVideoProvider VideoProvider { get { return Stic; } } public ISoundProvider SoundProvider { get { return NullSound.SilenceProvider; } } public ControllerDefinition ControllerDefinition @@ -101,12 +98,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision } public IController Controller { get; set; } - - - public int Frame - { - get { return 0; } - } + public int Frame { get; set; } public int LagCount { @@ -115,6 +107,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision } public bool IsLagFrame { get { return false; } } + public string SystemId { get { return "INTV"; } diff --git a/BizHawk.Emulation/Consoles/Intellivision/STIC.cs b/BizHawk.Emulation/Consoles/Intellivision/STIC.cs index bc5d368c15..3748f9b5f2 100644 --- a/BizHawk.Emulation/Consoles/Intellivision/STIC.cs +++ b/BizHawk.Emulation/Consoles/Intellivision/STIC.cs @@ -5,13 +5,21 @@ using System.Text; namespace BizHawk.Emulation.Consoles.Intellivision { - public sealed class STIC + public sealed class STIC : IVideoProvider { private bool Sr1, Sr2, Sst, Fgbg = false; private ushort[] Register = new ushort[64]; public int TotalExecutedCycles; public int PendingCycles; + + public int[] FrameBuffer = new int[160 * 96]; + public int[] GetVideoBuffer() { return FrameBuffer; } + public int VirtualWidth { get { return 160; } } + public int BufferWidth { get { return 160; } } + public int VirtualHeight { get { return 192; } } + public int BufferHeight { get { return 96; } } + public int BackgroundColor { get { return 0; } } public void Reset() {