-Fixed the calculation for the O Flag...not messing with that bit-math anymore.

-Set the pending cycles for setting Sr1 to 14934 - 3791 instead of adding it. This working makes NO sense in my opinion, and I'm sure it will break as the number of interrupts increases, but for now, it matches up.

The newest issue is reading PSG registers which have not been set. Cool, expecting this to work without doing anything would be silly, so I've gotten somewhere!
This commit is contained in:
brandman211 2012-12-17 07:17:18 +00:00
parent 7ad002d5ce
commit 0b7f68fcb7
3 changed files with 11 additions and 21 deletions

View File

@ -20,7 +20,7 @@ namespace BizHawk.Emulation.CPUs.CP1610
public Func<ushort, ushort> ReadMemory;
public Func<ushort, ushort, bool> WriteMemory;
private static bool Logging = false;
private static bool Logging = true;
private static StreamWriter Log;
static CP1610()
@ -94,13 +94,7 @@ namespace BizHawk.Emulation.CPUs.CP1610
Log.WriteLine("INTRM = {0}", IntRM);
Log.WriteLine("BUSRQ = {0}", BusRq);
Log.WriteLine("BUSAK = {0}", BusAk);
/*
Log.WriteLine("MSYNC = {0}", MSync);
Log.WriteLine("0x28 = {0}", ReadMemory(0x28));
Log.WriteLine("0x29 = {0}", ReadMemory(0x29));
Log.WriteLine("0x2A = {0}", ReadMemory(0x2A));
Log.WriteLine("0x2B = {0}", ReadMemory(0x2B));
*/
// Log.WriteLine("MSYNC = {0}", MSync);
Log.Flush();
}
}

View File

@ -24,7 +24,13 @@ namespace BizHawk.Emulation.CPUs.CP1610
private void Calc_FlagO_Add(int op1, int op2, int result)
{
FlagO = (((op1 ^ result) & (op1 ^ op2) & 0x8000) != 0);
bool op1_neg = ((op1 & 0x8000) != 0);
bool op2_neg = ((op2 & 0x8000) != 0);
bool result_neg = ((op1 & 0x8000) != 0);
FlagO = (
(op1_neg && op2_neg && !result_neg) ||
(!op1_neg && !op2_neg && result_neg)
);
}
private void Calc_FlagS(int result)

View File

@ -53,16 +53,6 @@ namespace BizHawk.Emulation.Consoles.Intellivision
Sst = value;
}
public int GetPendingCycles()
{
return PendingCycles;
}
public void AddPendingCycles(int cycles)
{
PendingCycles += cycles;
}
public ushort? ReadSTIC(ushort addr)
{
switch (addr & 0xF000)
@ -187,11 +177,11 @@ namespace BizHawk.Emulation.Consoles.Intellivision
Sr1 = !Sr1;
if (Sr1)
{
AddPendingCycles(14934 - 3791);
PendingCycles = 14934 - 3791;
}
else
{
AddPendingCycles(3791);
PendingCycles += 3791;
}
}
}