-Reverted disassembly printout as it'll now match up with my comparison.

-Fixed the branching disassembly; the direction just negates the offset and the second parameter only belongs to BEXT. All of my sources contradict each other, but this seems sensible.
This commit is contained in:
brandman211 2012-07-24 05:29:24 +00:00
parent 817b202192
commit b96e014327
2 changed files with 9 additions and 6 deletions

View File

@ -14,7 +14,7 @@ namespace BizHawk.Emulation.CPUs.CP1610
addrToAdvance = 1; addrToAdvance = 1;
byte dest, src, mem; byte dest, src, mem;
int decle2, decle3; int decle2, decle3;
int cond; int cond, ext;
ushort addr, offset; ushort addr, offset;
string result = ""; string result = "";
int opcode = ReadMemory(pc) & 0x3FF; int opcode = ReadMemory(pc) & 0x3FF;
@ -717,7 +717,8 @@ namespace BizHawk.Emulation.CPUs.CP1610
case 0x23F: case 0x23F:
offset = ReadMemory((ushort)(pc + 1)); offset = ReadMemory((ushort)(pc + 1));
cond = opcode & 0x15; cond = opcode & 0x15;
if ((opcode & 0x16) != 0) ext = opcode & 0x16;
if (ext != 0)
result = "BEXT"; result = "BEXT";
else else
{ {
@ -775,9 +776,11 @@ namespace BizHawk.Emulation.CPUs.CP1610
} }
if (cond != 0x8) if (cond != 0x8)
{ {
if (((opcode >> 5) & 0x1) != 0)
offset = (ushort)-offset;
result += string.Format(" ${0:X4}", offset); result += string.Format(" ${0:X4}", offset);
if (cond != 0x0) if (ext != 0)
result += ", " + ((opcode >> 5) & 0x1); result += string.Format(", ${0:X1}", opcode & 0x8);
} }
addrToAdvance = 2; addrToAdvance = 2;
return result; return result;

View File

@ -43,12 +43,12 @@ namespace BizHawk.Emulation.CPUs.CP1610
while (PendingCycles > 0) while (PendingCycles > 0)
{ {
int addrToAdvance; int addrToAdvance;
int opcode = ReadMemory(RegisterPC++) & 0x3FF;
if (logging) if (logging)
{ {
log.WriteLine("{0:X3} ({1})", opcode, Disassemble((ushort)(RegisterPC - 1), out addrToAdvance)); log.WriteLine(Disassemble(RegisterPC, out addrToAdvance));
log.Flush(); log.Flush();
} }
int opcode = ReadMemory(RegisterPC++) & 0x3FF;
switch (opcode) switch (opcode)
{ {
case 0x000: // HLT case 0x000: // HLT