public void PPU_Palette_LoadedCorrectly_Instr_Test_V5() { var engine = new Engine.Main.Engine(Path.Combine(Environment.CurrentDirectory, "TestRoms", "instr_test-v5", "01-basics.nes")); var steps = 0; while (steps < 126352) { engine.Step(); steps++; } Assert.AreEqual(0x0F,engine.PictureProcessingUnit.ReadPPUMemory(0x3f00), "0X3F00 must be 0x0F"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f01), "0X3F01 must be 0x30"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f02), "0X3F02 must be 0x30"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f03), "0X3F03 must be 0x30"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f04), "0X3F04 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f05), "0X3F05 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f06), "0X3F06 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f07), "0X3F07 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f08), "0X3F08 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f09), "0X3F09 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0a), "0X3F0a must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0b), "0X3F0b must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0c), "0X3F0c must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0d), "0X3F0d must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0e), "0X3F0e must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0f), "0X3F0f must be 0x0F"); }
public void PPU_Palette_LoadedCorrectly_Nes_Test_Rom() { var path = Utilities.GetTestPath("nestest", "nestest.nes"); var engine = new Engine.Main.Engine(path); var steps = 0; while (steps < 124262) { engine.Step(); steps++; } Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f00), "0X3F00"); Assert.AreEqual(0x06, engine.PictureProcessingUnit.ReadPPUMemory(0x3f01), "0X3F01"); Assert.AreEqual(0x12, engine.PictureProcessingUnit.ReadPPUMemory(0x3f02), "0X3F02"); Assert.AreEqual(0x33, engine.PictureProcessingUnit.ReadPPUMemory(0x3f03), "0X3F03"); Assert.AreEqual(0x33, engine.PictureProcessingUnit.ReadPPUMemory(0x3f04), "0X3F04"); Assert.AreEqual(0x06, engine.PictureProcessingUnit.ReadPPUMemory(0x3f05), "0X3F05"); Assert.AreEqual(0x12, engine.PictureProcessingUnit.ReadPPUMemory(0x3f06), "0X3F06"); Assert.AreEqual(0x33, engine.PictureProcessingUnit.ReadPPUMemory(0x3f07), "0X3F07"); Assert.AreEqual(0x38, engine.PictureProcessingUnit.ReadPPUMemory(0x3f08), "0X3F08"); Assert.AreEqual(0x06, engine.PictureProcessingUnit.ReadPPUMemory(0x3f09), "0X3F09"); Assert.AreEqual(0x12, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0a), "0X3F0a"); Assert.AreEqual(0x33, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0b), "0X3F0b"); Assert.AreEqual(0x3A, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0c), "0X3F0c"); Assert.AreEqual(0x06, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0d), "0X3F0d"); Assert.AreEqual(0x12, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0e), "0X3F0e"); Assert.AreEqual(0x33, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0f), "0X3F0f"); }
public void PPU_NameTables_LoadedCorrectly_DK_Rom() { var romName = "Donkey Kong (JU).nes"; var path = Utilities.GetTestPath("roms", romName); if (!File.Exists(path)) { Assert.Inconclusive($"Unable to find rom {romName}"); } var engine = new Engine.Main.Engine(path); var steps = 0; while (steps < 154262) { engine.Step(); steps++; } for (var i = 0x2000; i < 0x2083; i++) { Assert.AreEqual(0x24, engine.PictureProcessingUnit.ReadPPUMemory(i), i.ToString("X")); } }
public static string RunTest(string fileName, string folder) { var engine = new Engine.Main.Engine(Path.Combine(Environment.CurrentDirectory, "TestRoms", folder, fileName)); var steps = 0; while (steps < 31000 || engine.Processor.ReadMemoryValueWithoutCycle(0x6000) >= 0x80) { engine.Step(); steps++; if (engine.Processor.ReadMemoryValueWithoutCycle(0x6000) > 0x00 && engine.Processor.ReadMemoryValueWithoutCycle(0x6000) < 0x80) break; } var testOutput = new List<byte>(); var startAddress = 0x6004; while (true) { testOutput.Add(engine.Processor.ReadMemoryValueWithoutCycle(startAddress)); if (System.Text.Encoding.ASCII.GetString(testOutput.ToArray()).Contains("\n\0")) { break; } startAddress++; } return System.Text.Encoding.ASCII.GetString(testOutput.ToArray()); }
public static string RunTest(string fileName, string folder) { var engine = new Engine.Main.Engine(GetTestPath(folder, fileName)); var steps = 0; while (steps < 31000 || engine.Processor.ReadMemoryValueWithoutCycle(0x6000) >= 0x80) { engine.Step(); steps++; if (engine.Processor.ReadMemoryValueWithoutCycle(0x6000) > 0x00 && engine.Processor.ReadMemoryValueWithoutCycle(0x6000) < 0x80) { break; } } var testOutput = new List <byte>(); var startAddress = 0x6004; while (true) { testOutput.Add(engine.Processor.ReadMemoryValueWithoutCycle(startAddress)); if (System.Text.Encoding.ASCII.GetString(testOutput.ToArray()).Contains("\n\0")) { break; } startAddress++; } return(System.Text.Encoding.ASCII.GetString(testOutput.ToArray())); }
public void PPU_Palette_LoadedCorrectly_Nes_Test_Rom() { var engine = new Engine.Main.Engine(Path.Combine(Environment.CurrentDirectory, "TestRoms", "nestest", "nestest.nes")); var steps = 0; while (steps < 124262) { engine.Step(); steps++; } Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f00), "0X3F00"); Assert.AreEqual(0x06, engine.PictureProcessingUnit.ReadPPUMemory(0x3f01), "0X3F01"); Assert.AreEqual(0x12, engine.PictureProcessingUnit.ReadPPUMemory(0x3f02), "0X3F02"); Assert.AreEqual(0x33, engine.PictureProcessingUnit.ReadPPUMemory(0x3f03), "0X3F03"); Assert.AreEqual(0x33, engine.PictureProcessingUnit.ReadPPUMemory(0x3f04), "0X3F04"); Assert.AreEqual(0x06, engine.PictureProcessingUnit.ReadPPUMemory(0x3f05), "0X3F05"); Assert.AreEqual(0x12, engine.PictureProcessingUnit.ReadPPUMemory(0x3f06), "0X3F06"); Assert.AreEqual(0x33, engine.PictureProcessingUnit.ReadPPUMemory(0x3f07), "0X3F07"); Assert.AreEqual(0x38, engine.PictureProcessingUnit.ReadPPUMemory(0x3f08), "0X3F08"); Assert.AreEqual(0x06, engine.PictureProcessingUnit.ReadPPUMemory(0x3f09), "0X3F09"); Assert.AreEqual(0x12, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0a), "0X3F0a"); Assert.AreEqual(0x33, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0b), "0X3F0b"); Assert.AreEqual(0x3A, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0c), "0X3F0c"); Assert.AreEqual(0x06, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0d), "0X3F0d"); Assert.AreEqual(0x12, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0e), "0X3F0e"); Assert.AreEqual(0x33, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0f), "0X3F0f"); }
public void PPU_Palette_LoadedCorrectly_Instr_Test_V5() { var path = Utilities.GetTestPath("instr_test-v5", "01-basics.nes"); var engine = new Engine.Main.Engine(path); var steps = 0; while (steps < 126352) { engine.Step(); steps++; } Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f00), "0X3F00 must be 0x0F"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f01), "0X3F01 must be 0x30"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f02), "0X3F02 must be 0x30"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f03), "0X3F03 must be 0x30"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f04), "0X3F04 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f05), "0X3F05 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f06), "0X3F06 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f07), "0X3F07 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f08), "0X3F08 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f09), "0X3F09 must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0a), "0X3F0a must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0b), "0X3F0b must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0c), "0X3F0c must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0d), "0X3F0d must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0e), "0X3F0e must be 0x0F"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0f), "0X3F0f must be 0x0F"); }
public void PPU_Palette_LoadedCorrectly_DK_Rom() { var romName = "Donkey Kong (JU).nes"; var path = Utilities.GetTestPath("roms", romName); if (!File.Exists(path)) { Assert.Inconclusive($"Unable to find rom {romName}"); } var engine = new Engine.Main.Engine(path); var steps = 0; while (steps < 40000) { engine.Step(); steps++; } Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f00), "0X3F00"); Assert.AreEqual(0x2C, engine.PictureProcessingUnit.ReadPPUMemory(0x3f01), "0X3F01"); Assert.AreEqual(0x38, engine.PictureProcessingUnit.ReadPPUMemory(0x3f02), "0X3F02"); Assert.AreEqual(0x12, engine.PictureProcessingUnit.ReadPPUMemory(0x3f03), "0X3F03"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f04), "0X3F04"); Assert.AreEqual(0x27, engine.PictureProcessingUnit.ReadPPUMemory(0x3f05), "0X3F05"); Assert.AreEqual(0x27, engine.PictureProcessingUnit.ReadPPUMemory(0x3f06), "0X3F06"); Assert.AreEqual(0x27, engine.PictureProcessingUnit.ReadPPUMemory(0x3f07), "0X3F07"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f08), "0X3F08"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f09), "0X3F09"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0a), "0X3F0a"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0b), "0X3F0b"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0c), "0X3F0c"); Assert.AreEqual(0x0, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0d), "0X3F0d"); Assert.AreEqual(0x0, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0e), "0X3F0e"); Assert.AreEqual(0x0, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0f), "0X3F0f"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F10), "0X3F10"); Assert.AreEqual(0x25, engine.PictureProcessingUnit.ReadPPUMemory(0x3F11), "0X3F11"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F12), "0X3F12"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F13), "0X3F13"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F14), "0X3F14"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F15), "0X3F15"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F16), "0X3F16"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F17), "0X3F17"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F18), "0X3F18"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F19), "0X3F19"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1a), "0X3F1a"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1b), "0X3F1b"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1c), "0X3F1c"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1d), "0X3F1d"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1e), "0X3F1e"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1f), "0X3F1f"); }
public void PPU_Palette_LoadedCorrectly_DK_Rom() { var engine = new Engine.Main.Engine(Path.Combine("F:", "roms", "Donkey Kong (JU).nes")); var steps = 0; while (steps < 40000) { engine.Step(); steps++; } Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f00), "0X3F00"); Assert.AreEqual(0x2C, engine.PictureProcessingUnit.ReadPPUMemory(0x3f01), "0X3F01"); Assert.AreEqual(0x38, engine.PictureProcessingUnit.ReadPPUMemory(0x3f02), "0X3F02"); Assert.AreEqual(0x12, engine.PictureProcessingUnit.ReadPPUMemory(0x3f03), "0X3F03"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f04), "0X3F04"); Assert.AreEqual(0x27, engine.PictureProcessingUnit.ReadPPUMemory(0x3f05), "0X3F05"); Assert.AreEqual(0x27, engine.PictureProcessingUnit.ReadPPUMemory(0x3f06), "0X3F06"); Assert.AreEqual(0x27, engine.PictureProcessingUnit.ReadPPUMemory(0x3f07), "0X3F07"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f08), "0X3F08"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f09), "0X3F09"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0a), "0X3F0a"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0b), "0X3F0b"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0c), "0X3F0c"); Assert.AreEqual(0x0, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0d), "0X3F0d"); Assert.AreEqual(0x0, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0e), "0X3F0e"); Assert.AreEqual(0x0, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0f), "0X3F0f"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F10), "0X3F10"); Assert.AreEqual(0x25, engine.PictureProcessingUnit.ReadPPUMemory(0x3F11), "0X3F11"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F12), "0X3F12"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F13), "0X3F13"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F14), "0X3F14"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F15), "0X3F15"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F16), "0X3F16"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F17), "0X3F17"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F18), "0X3F18"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F19), "0X3F19"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1a), "0X3F1a"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1b), "0X3F1b"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1c), "0X3F1c"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1d), "0X3F1d"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1e), "0X3F1e"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1f), "0X3F1f"); }
public void PPU_VBL_NMI_Tests(string fileName, int totalSteps) { var engine = new Engine.Main.Engine(Path.Combine(Environment.CurrentDirectory, "TestRoms", "vbl_nmi_timing", fileName)); var steps = 0; while (steps < totalSteps) { engine.Step(); steps++; } var result = engine.PictureProcessingUnit.ReadPPUMemory(0x20C2); Assert.AreEqual(80, result, "Nametable at 0x20c2 was not Set to P"); }
public void Nestest_Matches() { var path = Utilities.GetTestPath("nestest", "nestest.nes"); var engine = new Engine.Main.Engine(path); //Changing the Initial PC to 0xC000 engine.Processor.WriteMemoryValueWithoutCycle(65532, 0); engine.Processor.Reset(); var testData = LoadTestData("nestest", "nestest.csv"); var steps = 1; while (steps < 5002) //Can't run the full test, since past this point unofficial op codes show up. { engine.Step(); Assert.AreEqual(testData[steps].ProgramCounter, engine.Processor.ProgramCounter, string.Format("Step {0} PC: ", steps)); Assert.AreEqual(testData[steps].Accumulator, engine.Processor.Accumulator, string.Format("Step {0} Accumulator: ", steps)); Assert.AreEqual(testData[steps].XRegister, engine.Processor.XRegister, string.Format("Step {0} XRegister: ", steps)); Assert.AreEqual(testData[steps].YRegister, engine.Processor.YRegister, string.Format("Step {0} YRegister: ", steps)); Assert.AreEqual(testData[steps].Flags, (byte) ((engine.Processor.CarryFlag ? 0x01 : 0) + (engine.Processor.ZeroFlag ? 0x02 : 0) + (engine.Processor.DisableInterruptFlag ? 0x04 : 0) + (engine.Processor.DecimalFlag ? 8 : 0) + (0) + 0x20 + (engine.Processor.OverflowFlag ? 0x40 : 0) + (engine.Processor.NegativeFlag ? 0x80 : 0)), string.Format("Step {0} Flag:", steps)); Assert.AreEqual(testData[steps].StackPointer, engine.Processor.StackPointer, string.Format("Step {0} StackPointer: ", steps)); Assert.AreEqual(testData[steps].CycleCount, engine.PictureProcessingUnit.CycleCount, string.Format("Step {0} CycleCount: ", steps)); Assert.AreEqual(testData[steps].ScanLine, engine.PictureProcessingUnit.ScanLine, string.Format("Step {0} ScanLine: ", steps)); steps++; } }
public void PPU_NameTables_LoadedCorrectly_DK_Rom() { var engine = new Engine.Main.Engine(Path.Combine("F:", "roms", "Donkey Kong (JU).nes")); var steps = 0; while (steps < 154262) { engine.Step(); steps++; } for (var i = 0x2000; i < 0x2083; i++) { Assert.AreEqual(0x24, engine.PictureProcessingUnit.ReadPPUMemory(i), i.ToString("X")); } }
public void Misc_PPU_Tests(string fileName, int totalSteps) { var path = Utilities.GetTestPath("misc_ppu_tests", fileName); var engine = new Engine.Main.Engine(path); var steps = 0; while (steps < totalSteps) { engine.Step(); steps++; } var result = engine.PictureProcessingUnit.ReadPPUMemory(0x20a4); Assert.AreEqual(49, result, "Nametable at 0x20c2 was not Set to P"); }
public void PPU_VBL_NMI_Tests(string fileName, int totalSteps) { var path = Utilities.GetTestPath("vbl_nmi_timing", fileName); var engine = new Engine.Main.Engine(path); var steps = 0; while (steps < totalSteps) { engine.Step(); steps++; } var result = engine.PictureProcessingUnit.ReadPPUMemory(0x20C2); Assert.AreEqual(80, result, "Nametable at 0x20c2 was not Set to P"); }
public void PPU_Sprite_Hit_Tests(string fileName) { var path = Utilities.GetTestPath("sprite_hit_tests_2005.10.05", fileName); var engine = new Engine.Main.Engine(path); var steps = 0; while (steps < 250000) { engine.Step(); steps++; } var result = engine.PictureProcessingUnit.ReadPPUMemory(0x20C2); Assert.AreEqual(80, result, "Nametable at 0x20c2 was not Set to P"); }
public void Nestest_Matches() { var engine = new Engine.Main.Engine(Path.Combine(Environment.CurrentDirectory, "TestRoms", "nestest", "nestest.nes")); //Changing the Initial PC to 0xC000 engine.Processor.WriteMemoryValueWithoutCycle(65532, 0); engine.Processor.Reset(); var testData = LoadTestData("nestest", "nestest.csv"); var steps = 1; while (steps < 5002) //Can't run the full test, since past this point unofficial op codes show up. { engine.Step(); Assert.AreEqual(testData[steps].ProgramCounter, engine.Processor.ProgramCounter, string.Format("Step {0} PC: ", steps)); Assert.AreEqual(testData[steps].Accumulator, engine.Processor.Accumulator, string.Format("Step {0} Accumulator: ", steps)); Assert.AreEqual(testData[steps].XRegister, engine.Processor.XRegister, string.Format("Step {0} XRegister: ", steps)); Assert.AreEqual(testData[steps].YRegister, engine.Processor.YRegister, string.Format("Step {0} YRegister: ", steps)); Assert.AreEqual(testData[steps].Flags, (byte) ((engine.Processor.CarryFlag ? 0x01 : 0) + (engine.Processor.ZeroFlag ? 0x02 : 0) + (engine.Processor.DisableInterruptFlag ? 0x04 : 0) + (engine.Processor.DecimalFlag ? 8 : 0) + (0) + 0x20 + (engine.Processor.OverflowFlag ? 0x40 : 0) + (engine.Processor.NegativeFlag ? 0x80 : 0)), string.Format("Step {0} Flag:", steps)); Assert.AreEqual(testData[steps].StackPointer, engine.Processor.StackPointer, string.Format("Step {0} StackPointer: ", steps)); Assert.AreEqual(testData[steps].CycleCount, engine.PictureProcessingUnit.CycleCount, string.Format("Step {0} CycleCount: ", steps)); Assert.AreEqual(testData[steps].ScanLine, engine.PictureProcessingUnit.ScanLine, string.Format("Step {0} ScanLine: ", steps)); steps++; } }
public void Misc_PPU_Tests(string fileName, int totalSteps) { var engine = new Engine.Main.Engine(Path.Combine(Environment.CurrentDirectory, "TestRoms", "misc_ppu_tests", fileName)); var steps = 0; while (steps < totalSteps) { if (steps == 253298) { var x = 1; var y = x; } engine.Step(); steps++; } var result = engine.PictureProcessingUnit.ReadPPUMemory(0x20a4); Assert.AreEqual(49, result, "Nametable at 0x20c2 was not Set to P"); }
public void Misc_PPU_Tests(string fileName, int totalSteps) { var engine = new Engine.Main.Engine(Path.Combine(Environment.CurrentDirectory, "TestRoms", "misc_ppu_tests", fileName)); var steps = 0; while (steps < totalSteps) { if (steps == 253298) { var x = 1; var y = x; } engine.Step(); steps++; } var result = engine.PictureProcessingUnit.ReadPPUMemory(0x20a4); Assert.AreEqual(49, result, "Nametable at 0x20c2 was not Set to P"); }
public void PPU_NameTables_LoadedCorrectly_DK_Rom() { var engine = new Engine.Main.Engine(Path.Combine("F:", "roms", "Donkey Kong (JU).nes")); var steps = 0; while (steps < 154262) { engine.Step(); steps++; } for (var i = 0x2000; i < 0x2083; i++) { Assert.AreEqual(0x24, engine.PictureProcessingUnit.ReadPPUMemory(i), i.ToString("X")); } }
public void PPU_VBL_NMI_Tests(string fileName, int totalSteps) { var engine = new Engine.Main.Engine(Path.Combine(Environment.CurrentDirectory, "TestRoms", "vbl_nmi_timing", fileName)); var steps = 0; while (steps < totalSteps) { engine.Step(); steps++; } var result = engine.PictureProcessingUnit.ReadPPUMemory(0x20C2); Assert.AreEqual(80, result, "Nametable at 0x20c2 was not Set to P"); }
public void PPU_Palette_LoadedCorrectly_DK_Rom() { var engine = new Engine.Main.Engine(Path.Combine("F:", "roms", "Donkey Kong (JU).nes")); var steps = 0; while (steps < 40000) { engine.Step(); steps++; } Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f00), "0X3F00"); Assert.AreEqual(0x2C, engine.PictureProcessingUnit.ReadPPUMemory(0x3f01), "0X3F01"); Assert.AreEqual(0x38, engine.PictureProcessingUnit.ReadPPUMemory(0x3f02), "0X3F02"); Assert.AreEqual(0x12, engine.PictureProcessingUnit.ReadPPUMemory(0x3f03), "0X3F03"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f04), "0X3F04"); Assert.AreEqual(0x27, engine.PictureProcessingUnit.ReadPPUMemory(0x3f05), "0X3F05"); Assert.AreEqual(0x27, engine.PictureProcessingUnit.ReadPPUMemory(0x3f06), "0X3F06"); Assert.AreEqual(0x27, engine.PictureProcessingUnit.ReadPPUMemory(0x3f07), "0X3F07"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f08), "0X3F08"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f09), "0X3F09"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0a), "0X3F0a"); Assert.AreEqual(0x30, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0b), "0X3F0b"); Assert.AreEqual(0x0F, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0c), "0X3F0c"); Assert.AreEqual(0x0, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0d), "0X3F0d"); Assert.AreEqual(0x0, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0e), "0X3F0e"); Assert.AreEqual(0x0, engine.PictureProcessingUnit.ReadPPUMemory(0x3f0f), "0X3F0f"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F10), "0X3F10"); Assert.AreEqual(0x25, engine.PictureProcessingUnit.ReadPPUMemory(0x3F11), "0X3F11"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F12), "0X3F12"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F13), "0X3F13"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F14), "0X3F14"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F15), "0X3F15"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F16), "0X3F16"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F17), "0X3F17"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F18), "0X3F18"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F19), "0X3F19"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1a), "0X3F1a"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1b), "0X3F1b"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1c), "0X3F1c"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1d), "0X3F1d"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1e), "0X3F1e"); Assert.AreEqual(0x00, engine.PictureProcessingUnit.ReadPPUMemory(0x3F1f), "0X3F1f"); }