update 6502 core generator legit-like

This commit is contained in:
zeromus 2011-02-27 09:49:53 +00:00
parent c5febf8e20
commit 4e85d82f14
2 changed files with 32 additions and 21 deletions

View File

@ -748,10 +748,6 @@ FlagT = true;// this seems wrong
PendingCycles -= 4; TotalExecutedCycles += 4;
break;
case 0xAD: // LDA addr
if (this_pc == 0x800A)
{
int zzz = 9;
}
A = ReadMemory(ReadWord(PC)); PC += 2;
P = (byte)((P & 0x7D) | TableNZ[A]);
PendingCycles -= 4; TotalExecutedCycles += 4;

View File

@ -329,10 +329,25 @@ namespace M6502
w.WriteLine(" while (PendingCycles > 0)");
w.WriteLine(" {");
w.WriteLine(" if (NMI)");
w.WriteLine(" {");
w.WriteLine(" WriteMemory((ushort)(S-- + 0x100), (byte)(PC >> 8));");
w.WriteLine(" WriteMemory((ushort)(S-- + 0x100), (byte)PC);");
w.WriteLine(" byte oldP = P;");
w.WriteLine(" FlagB = false;");
w.WriteLine(" FlagT = true;");
w.WriteLine(" WriteMemory((ushort)(S-- + 0x100), P);");
w.WriteLine(" P = oldP;");
w.WriteLine(" FlagI = true;");
w.WriteLine(" PC = ReadWord(NMIVector);");
w.WriteLine(" PendingCycles -= 7;");
w.WriteLine(" NMI = false;");
w.WriteLine(" }");
w.WriteLine("");
w.WriteLine("if(debug) Console.WriteLine(State());");
// TODO interrupts, halt state, shit like that
w.WriteLine(" ushort this_pc = PC;");
w.WriteLine(" byte opcode = ReadMemory(PC++);");
w.WriteLine(" switch (opcode)");
w.WriteLine(" {");