private void RunSpriteHitTest(string rom) { IEmulator emulator = this.GetInstance(); emulator.LoadFile(rom); IMemoryBus cpuBus = (IMemoryBus)emulator.Components.First(c => c.Name == "CPU Bus"); IComponentWithBreakpoints cpuBusBP = (IComponentWithBreakpoints)cpuBus; bool testComplete = false; // This is kind of a hack - the test ROMs set 0xF8 to the number of the test that failed, or 1 // if all tests pass, but it's incremented as the tests run. To determine when the test run // is over, look for a write to 0x07F1, which happens in the routine that prints the results, // and check 0xF8 at that point. IMemoryBreakpoint memBP = (IMemoryBreakpoint)cpuBusBP.CreateBreakpoint("MemoryBreakpoint"); memBP.TargetAddress = 0x07F1; memBP.AccessType = AccessType.Write; memBP.BreakpointHit += (sender, e) => { testComplete = true; }; memBP.Enabled = true; base.RunEmulator(emulator, () => !testComplete); byte value = cpuBus.Read(0xF8); if (value != 1) { // Non-zero value other than 1 indicates failure Assert.Fail("Test #{0} failed!", value); } }
public void RemoveMemoryBreakpoint(IMemoryBreakpoint breakpoint) { throw new NotImplementedException(); }