Exemple #1
0
        public void nestest()
        {
            var           stream  = File.OpenRead(@".\nes-test-roms\other\nestest.nes");
            ConsoleSystem console = ConsoleSystem.LoadFromInesStream(stream);

            console.LogWriteLineAction = output.WriteLine;

            // Jump to "automation mode" address:
            console.CPU.Jump(0xC000);

            // Run until CPU halts:
            console.Run();

            // Ensure that all tests passed:
            output.WriteLine($"$02: {console.Memory.Peek(0x02):X2} $03: {console.Memory.Peek(0x03):X2}");
            Assert.Equal(0, console.Memory.Peek(0x02));
            Assert.Equal(0, console.Memory.Peek(0x03));
        }
Exemple #2
0
        private void blarggTest(string testPath)
        {
            var           stream  = File.OpenRead($@".\nes-test-roms\{testPath}");
            ConsoleSystem console = ConsoleSystem.LoadFromInesStream(stream);

            console.LogWriteLineAction = output.WriteLine;

            // Run until test completes:
            var continueStatuses = new byte[] { 0x00, 0x80 };

            console.ShouldHalt = () =>
                                 (console.Memory.Peek(0x6001) != 0x00) &&                 // test started?
                                 !continueStatuses.Contains(console.Memory.Peek(0x6000)); // test not finished?
            console.Run();

            // Ensure that all tests passed:
            output.WriteLine($"$6000: {console.Memory.Peek(0x6000):X2}");
            output.WriteLine($"$6004: {console.Memory.PeekString(0x6004)}");
            Assert.Equal(0, console.Memory.Peek(0x6000));
        }