-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, bool> 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();
}
}
}

View File

@ -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);

View File

@ -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"; }

View File

@ -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()
{