cumulative mode bugs

This commit is contained in:
edmccard 2012-03-30 15:10:01 -04:00
parent cd8500dbcd
commit 04662745b0
3 changed files with 10 additions and 7 deletions

View File

@ -231,6 +231,7 @@ class Cmos(bool strict, bool cumulative) : Cpu!(strict, cumulative)
peek(0xFFFF);
peek(0xFFFF);
peek(0xFFFF);
static if (cumulative) tick(totalCycles);
}
/* JMP ($$$$) */

View File

@ -69,10 +69,10 @@ class Cpu(bool strict, bool cumulative) : CpuBase!(strict, cumulative)
{
if (signalActive) handleSignals();
opcodePC = programCounter;
opcode = read(programCounter++);
static if (cumulative) totalCycles = 0;
else finalCycle = false;
opcodePC = programCounter;
opcode = read(programCounter++);
/+ TODO: call sync delegate +/
@ -241,6 +241,7 @@ class Cpu(bool strict, bool cumulative) : CpuBase!(strict, cumulative)
/+ TODO: call stack overflow delegate +/
}
final void pushWord(ushort val)
{
push(val >> 8);
@ -471,8 +472,8 @@ class Cpu(bool strict, bool cumulative) : CpuBase!(strict, cumulative)
static string SimpleOpcode(string name, string opcode, string action)
{
string code = "peek(programCounter);\n";
static if (cumulative) code ~= "tick(totalCycles);\n";
code ~= (action == "") ? "" : (action ~ ";");
static if (cumulative) code ~= "tick(totalCycles);\n";
return "override void opcode" ~ opcode ~ "()\n{\n" ~ code ~ "\n}\n";
}
@ -484,9 +485,9 @@ class Cpu(bool strict, bool cumulative) : CpuBase!(strict, cumulative)
static string RegisterOpcode(string name, string opcode, string action)
{
string code = "peek(programCounter);\n";
code ~= UpdateNZ(action);
static if (cumulative) code ~= "tick(totalCycles);\n";
return "override void opcode" ~ opcode ~ "()\n{\n" ~
code ~ UpdateNZ(action) ~ "}\n";
return "override void opcode" ~ opcode ~ "()\n{\n" ~ code ~ "}\n";
}
static string BranchOpcode(string name, string opcode, string action)

View File

@ -68,6 +68,7 @@ class NmosUndoc(bool strict, bool cumulative) : NmosBase!(strict, cumulative)
{
string type = (rw == "Write") ? "true" : "false";
string modes = "[[\"" ~ name ~ "\", \"" ~ rw ~ "\"], \n";
string index = (name[2] == 'X') ? "Y" : "X";
for (int op = 0; op < opcodes.length; ++op)
{
int opcode = opcodes[op];
@ -87,7 +88,7 @@ class NmosUndoc(bool strict, bool cumulative) : NmosBase!(strict, cumulative)
modes ~= "IndirectY("~ type ~ ")";
break;
case 5:
modes ~= "ZeropageX()";
modes ~= "Zeropage" ~ index ~ "()";
break;
case 7:
modes ~= "AbsoluteY(" ~ type ~ ")";
@ -183,7 +184,7 @@ class NmosUndoc(bool strict, bool cumulative) : NmosBase!(strict, cumulative)
"LAX", "Read", [0xA3, 0xA7, 0xAF, 0xB3, 0xB7, 0xBF])),
Read("accumulator = xIndex =")));
mixin(Opcode(mixin(UndocAddress(
"SAX", "Write", [0x83, 0x87, 0x8F, 0x97])),
"SAX", "Write", [0x83, 0x87, 0x97, 0x8F])),
Write("accumulator & xIndex")));
mixin(Opcode(mixin(Type1Address(