parent
7bff28bdee
commit
c230609656
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using BizHawk.Emulation.Common;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Components.CP1610
|
namespace BizHawk.Emulation.Cores.Components.CP1610
|
||||||
{
|
{
|
||||||
|
@ -13,6 +14,31 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
|
||||||
private const string UNEXPECTED_BEXT = "BEXT is an unexpected behavior; Intellivision not connected to the External"
|
private const string UNEXPECTED_BEXT = "BEXT is an unexpected behavior; Intellivision not connected to the External"
|
||||||
+ " Branch Condition Address pins (EBCA0-EBCA3).";
|
+ " Branch Condition Address pins (EBCA0-EBCA3).";
|
||||||
|
|
||||||
|
public int opcode;
|
||||||
|
|
||||||
|
public TraceInfo CP1610State(bool disassemble = true)
|
||||||
|
{
|
||||||
|
int notused;
|
||||||
|
|
||||||
|
return new TraceInfo
|
||||||
|
{
|
||||||
|
Disassembly = string.Format(
|
||||||
|
"{0:X4}: {1:X2} {2} ",
|
||||||
|
RegisterPC,
|
||||||
|
opcode,
|
||||||
|
disassemble ? Disassemble(RegisterPC, out notused) : "---").PadRight(26),
|
||||||
|
RegisterInfo = string.Format(
|
||||||
|
"Cy:{0} {1}{2}{3}{4}{5}{6}",
|
||||||
|
TotalExecutedCycles,
|
||||||
|
FlagS ? "S" : "s",
|
||||||
|
FlagC ? "C" : "c",
|
||||||
|
FlagZ ? "Z" : "z",
|
||||||
|
FlagO ? "O" : "o",
|
||||||
|
FlagI ? "I" : "i",
|
||||||
|
FlagD ? "D" : "d")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private void Calc_FlagC(int result)
|
private void Calc_FlagC(int result)
|
||||||
{
|
{
|
||||||
FlagC = ((result & 0x10000) != 0);
|
FlagC = ((result & 0x10000) != 0);
|
||||||
|
@ -139,7 +165,10 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
|
||||||
//int ones, carry;
|
//int ones, carry;
|
||||||
bool branch = false;
|
bool branch = false;
|
||||||
bool FlagD_prev = FlagD;
|
bool FlagD_prev = FlagD;
|
||||||
int opcode = ReadMemory(RegisterPC++) & 0x3FF;
|
opcode = ReadMemory(RegisterPC++) & 0x3FF;
|
||||||
|
|
||||||
|
if (TraceCallback != null)
|
||||||
|
TraceCallback(CP1610State());
|
||||||
switch (opcode)
|
switch (opcode)
|
||||||
{
|
{
|
||||||
case 0x000: // HLT
|
case 0x000: // HLT
|
||||||
|
@ -1464,22 +1493,22 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
|
||||||
case 0x305:
|
case 0x305:
|
||||||
case 0x306:
|
case 0x306:
|
||||||
case 0x307:
|
case 0x307:
|
||||||
throw new NotImplementedException();
|
// -------------------------------needs testing-------------------------------
|
||||||
//dest = (byte)(opcode & 0x7);
|
dest = (byte)(opcode & 0x7);
|
||||||
//addr = ReadMemory(RegisterPC++);
|
addr = ReadMemory(RegisterPC++);
|
||||||
//dest_value = Register[dest];
|
dest_value = Register[dest];
|
||||||
//addr_read = ReadMemory(addr);
|
addr_read = ReadMemory(addr);
|
||||||
//twos = (0xFFFF ^ addr_read) + 1;
|
twos = (0xFFFF ^ addr_read) + 1;
|
||||||
//result = dest_value + twos;
|
result = dest_value + twos;
|
||||||
//Calc_FlagC(result);
|
Calc_FlagC(result);
|
||||||
//Calc_FlagO_Add(dest_value, addr_read, result);
|
Calc_FlagO_Add(dest_value, addr_read, result);
|
||||||
//result &= 0xFFFF;
|
result &= 0xFFFF;
|
||||||
//Calc_FlagS(result);
|
Calc_FlagS(result);
|
||||||
//Calc_FlagZ(result);
|
Calc_FlagZ(result);
|
||||||
//Register[dest] = (ushort)result;
|
Register[dest] = (ushort)result;
|
||||||
//cycles = 10;
|
cycles = 10;
|
||||||
//Interruptible = true;
|
Interruptible = true;
|
||||||
//break;
|
break;
|
||||||
// SUB@
|
// SUB@
|
||||||
case 0x308:
|
case 0x308:
|
||||||
case 0x309:
|
case 0x309:
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "TODO";
|
return "CP1610: PC, machine code, mnemonic, operands, flags (SCZOID)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,5 +109,7 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
|
||||||
// Log.WriteLine("MSYNC = {0}", MSync);
|
// Log.WriteLine("MSYNC = {0}", MSync);
|
||||||
Log.Flush();
|
Log.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue