-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.
This commit is contained in:
brandman211 2012-09-05 04:42:49 +00:00
parent 60e267dd91
commit 1a760096bc
4 changed files with 42 additions and 44 deletions

View File

@ -19,13 +19,13 @@ namespace BizHawk.Emulation.CPUs.CP1610
public Func<ushort, ushort> ReadMemory; public Func<ushort, ushort> ReadMemory;
public Func<ushort, ushort, bool> WriteMemory; public Func<ushort, ushort, bool> WriteMemory;
private static bool logging = true; private static bool Logging = false;
private static StreamWriter log; private static StreamWriter Log;
static CP1610() static CP1610()
{ {
if (logging) if (Logging)
log = new StreamWriter("log_CP1610.txt"); Log = new StreamWriter("log_CP1610.txt");
} }
public void Reset() public void Reset()
@ -65,23 +65,23 @@ namespace BizHawk.Emulation.CPUs.CP1610
public void LogData() public void LogData()
{ {
if (!logging) if (!Logging)
return; return;
for (int register = 0; register <= 5; register++) for (int register = 0; register <= 5; register++)
log.WriteLine("R{0:d} = {1:X4}", register, Register[register]); Log.WriteLine("R{0:d} = {1:X4}", register, Register[register]);
log.WriteLine("SP = {0:X4}", RegisterSP); Log.WriteLine("SP = {0:X4}", RegisterSP);
log.WriteLine("PC = {0:X4}", RegisterPC); Log.WriteLine("PC = {0:X4}", RegisterPC);
log.WriteLine("S = {0}", FlagS); Log.WriteLine("S = {0}", FlagS);
log.WriteLine("C = {0}", FlagC); Log.WriteLine("C = {0}", FlagC);
log.WriteLine("Z = {0}", FlagZ); Log.WriteLine("Z = {0}", FlagZ);
log.WriteLine("O = {0}", FlagO); Log.WriteLine("O = {0}", FlagO);
log.WriteLine("I = {0}", FlagI); Log.WriteLine("I = {0}", FlagI);
log.WriteLine("D = {0}", FlagD); Log.WriteLine("D = {0}", FlagD);
log.WriteLine("INTRM = {0}", IntRM); Log.WriteLine("INTRM = {0}", IntRM);
log.WriteLine("BUSRQ = {0}", BusRq); Log.WriteLine("BUSRQ = {0}", BusRq);
log.WriteLine("BUSAK = {0}", BusAk); Log.WriteLine("BUSAK = {0}", BusAk);
log.WriteLine("MSYNC = {0}", MSync); Log.WriteLine("MSYNC = {0}", MSync);
log.Flush(); Log.Flush();
} }
} }
} }

View File

@ -98,12 +98,12 @@ namespace BizHawk.Emulation.CPUs.CP1610
*/ */
if (FlagI && Interruptible && !IntRM && !Interrupted) if (FlagI && Interruptible && !IntRM && !Interrupted)
{ {
if (logging) if (Logging)
{ {
log.WriteLine("------"); Log.WriteLine("------");
log.WriteLine(); Log.WriteLine();
log.WriteLine("Interrupt"); Log.WriteLine("Interrupt");
log.Flush(); Log.Flush();
} }
Interrupted = true; Interrupted = true;
Interruptible = false; Interruptible = false;
@ -111,13 +111,13 @@ namespace BizHawk.Emulation.CPUs.CP1610
RegisterPC = INTERRUPT; RegisterPC = INTERRUPT;
return 28; return 28;
} }
if (logging) if (Logging)
{ {
int addrToAdvance; int addrToAdvance;
log.WriteLine("------"); Log.WriteLine("------");
log.WriteLine(); Log.WriteLine();
log.WriteLine(Disassemble(RegisterPC, out addrToAdvance)); Log.WriteLine(Disassemble(RegisterPC, out addrToAdvance));
log.Flush(); Log.Flush();
} }
byte dest, src, mem; byte dest, src, mem;
ushort dest_value, src_value, mem_read, addr, addr_read, offset; ushort dest_value, src_value, mem_read, addr, addr_read, offset;
@ -227,7 +227,6 @@ namespace BizHawk.Emulation.CPUs.CP1610
case 0x01D: case 0x01D:
case 0x01E: case 0x01E:
case 0x01F: case 0x01F:
throw new NotImplementedException();
dest = (byte)(opcode & 0x7); dest = (byte)(opcode & 0x7);
result = (Register[dest] ^ 0xFFFF); result = (Register[dest] ^ 0xFFFF);
Calc_FlagS(result); Calc_FlagS(result);
@ -470,7 +469,6 @@ namespace BizHawk.Emulation.CPUs.CP1610
case 0x06D: case 0x06D:
case 0x06E: case 0x06E:
case 0x06F: case 0x06F:
throw new NotImplementedException();
dest = (byte)(opcode & 0x3); dest = (byte)(opcode & 0x3);
dest_value = Register[dest]; dest_value = Register[dest];
sign = dest_value & 0x8000; sign = dest_value & 0x8000;
@ -1776,7 +1774,6 @@ namespace BizHawk.Emulation.CPUs.CP1610
case 0x3FD: case 0x3FD:
case 0x3FE: case 0x3FE:
case 0x3FF: case 0x3FF:
throw new NotImplementedException();
mem = (byte)((opcode >> 3) & 0x7); mem = (byte)((opcode >> 3) & 0x7);
dest = (byte)(opcode & 0x7); dest = (byte)(opcode & 0x7);
mem_read = Indirect_Get(mem); mem_read = Indirect_Get(mem);

View File

@ -78,6 +78,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision
public void FrameAdvance(bool render) public void FrameAdvance(bool render)
{ {
Frame++;
Cpu.AddPendingCycles(14394 + 3791); Cpu.AddPendingCycles(14394 + 3791);
while (Cpu.GetPendingCycles() > 0) while (Cpu.GetPendingCycles() > 0)
{ {
@ -88,11 +89,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision
} }
} }
public IVideoProvider VideoProvider { get { return Stic; } }
// This is all crap to worry about later.
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
@ -101,12 +98,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision
} }
public IController Controller { get; set; } public IController Controller { get; set; }
public int Frame { get; set; }
public int Frame
{
get { return 0; }
}
public int LagCount public int LagCount
{ {
@ -115,6 +107,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision
} }
public bool IsLagFrame { get { return false; } } public bool IsLagFrame { get { return false; } }
public string SystemId public string SystemId
{ {
get { return "INTV"; } get { return "INTV"; }

View File

@ -5,13 +5,21 @@ using System.Text;
namespace BizHawk.Emulation.Consoles.Intellivision namespace BizHawk.Emulation.Consoles.Intellivision
{ {
public sealed class STIC public sealed class STIC : IVideoProvider
{ {
private bool Sr1, Sr2, Sst, Fgbg = false; private bool Sr1, Sr2, Sst, Fgbg = false;
private ushort[] Register = new ushort[64]; private ushort[] Register = new ushort[64];
public int TotalExecutedCycles; public int TotalExecutedCycles;
public int PendingCycles; 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() public void Reset()
{ {