public void ADDA_oADD() { TestContext.WriteLine("ADDA / oADD"); const byte OP_ADDA = 0x8B; const byte ADD_VALUE_1 = 0xFF; const byte ADD_VALUE_2 = 0xFF; cpu.set("flags", 0x00); // add command in reverse order readMemoryAddress = new List <byte>() { ADD_VALUE_2, OP_ADDA, RESET_VECTOR_VALUE_LO, RESET_VECTOR_VALUE_HI }; cpu.reset(); cpu.regA = ADD_VALUE_1; cpu.step(); Assert.That(readMemoryAddressAccess[0], Is.EqualTo(RESET_VECTOR_OFFSET_LO)); Assert.That(readMemoryAddressAccess[1], Is.EqualTo(RESET_VECTOR_OFFSET_HI)); Assert.That(readMemoryAddressAccess[2], Is.EqualTo(EXPECTED_RESET_READ_OFFSET_LO)); Assert.That(readMemoryAddressAccess[3], Is.EqualTo(EXPECTED_RESET_READ_OFFSET_HI)); Assert.That(cpu.regA, Is.EqualTo(254)); Assert.That(cpu.tickCount, Is.EqualTo(2)); Assert.That(cpu.flagsToString(), Is.EqualTo("eFHINzvC")); }
private void flagCheckTest(InstructionData testData) { cpu.reset(); cpu.set("flags", 0xFF); cpu.step(); for (var x = 0; x < testData.flags.Length; x++) { var flag = testData.flags[x]; var mask = EXPECTED_FLAG_MAP[x]; switch (flag) { case FLAG_CLEAR: Assert.That(cpu.regCC & mask, Is.EqualTo(0)); break; case FLAG_SET: Assert.IsTrue((cpu.regCC & mask) > 0); break; case FLAG_UNAFFECTED: var unaffectedFlag = (byte)(cpu.regCC & mask); TestContext.WriteLine("offset: {0}, {1}, mask: {2}", x, unaffectedFlag, mask); Assert.IsTrue(unaffectedFlag > 0); break; default: break; } } }