void CPUWrapper::TestJump(int opcode) { if (testType == IMM_8) { lastImm8Arg = processor->ReadImm8Arg(); } else if (testType == IMM_16) { lastImm16Arg = processor->ReadImm16Arg(); } Instruction *instruction = processor->instructions[opcode]; instruction->Call(); assert(instruction->GetDuration() == expectedCyclesVarying); assert(PC() == expectedPC); CheckFlags(); }
void CPUWrapper::TestInstruction(int opcode) { ushort oldPC = PC(); if (testType == IMM_8) { lastImm8Arg = processor->ReadImm8Arg(); } else if (testType == IMM_16) { lastImm16Arg = processor->ReadImm16Arg(); } Instruction *instruction = processor->instructions[opcode]; instruction->Call(); assert(instruction->GetDuration() == expectedCycles[opcode]); assert(oldPC + expectedPCAdvance[opcode] == PC()); CheckFlags(); }
Instruction *CPU::InvokeInstruction(int opcode) { Instruction *instruction; if (opcode == 0xcb) { opcode = 0x100 + ReadByte(PC + 1); } instruction = instructions[opcode]; // std::string pcStr = int_to_hex(PC); instruction->Call(); instrCounter++; /*std::ofstream file; file.open("outputPKMN.txt", std::ios::app | std::ios::out); file << pcStr << "\t" << instruction->ToString() << std::endl; file.close();*/ return instruction; }