public NesEngine(TvFormat tvFormat, PaletteFormat plFormat) { AutoSaveSram = true; Debug.WriteLine(this, "Initializeing the nes emulation engine...", DebugStatus.None); TvFormat = tvFormat; //Initialize Engine Memory = new Memory.Memory(this); Cpu = new Cpu(Memory, tvFormat, this); Cpu.PauseToggle += CpuPauseToggle; Ppu = new Ppu(tvFormat, plFormat, this); Debug.WriteLine(this, "Nes initialized ok.", DebugStatus.Cool); }
private Xy GetXy(int offset, int desl, int multi = 1) { offset -= 0x8010; var ppu = new Ppu(TvFormat.Ntsc, new PaletteFormat(), null); var w = 128*multi; return new Xy { X = ppu.GetX(offset, desl, multi), Y = ppu.GetY(offset, w, multi) }; }
public void TestPpuCoord() { var ppu = new Ppu(TvFormat.Ntsc, new PaletteFormat(), null); //Multiplicador 1 Assert.AreEqual(new Xy(0,0), GetXy(0x8010,0)); Assert.AreEqual(new Xy(1, 0), GetXy(0x8010, 1)); Assert.AreEqual(new Xy(2, 0), GetXy(0x8010, 2)); Assert.AreEqual(new Xy(3, 0), GetXy(0x8010, 3)); Assert.AreEqual(new Xy(4, 0), GetXy(0x8010, 4)); Assert.AreEqual(new Xy(5, 0), GetXy(0x8010, 5)); Assert.AreEqual(new Xy(6, 0), GetXy(0x8010, 6)); Assert.AreEqual(new Xy(7, 0), GetXy(0x8010, 7)); Assert.AreEqual(new Xy(48, 136), GetXy(0x9170, 0)); Assert.AreEqual(new Xy(80, 128), GetXy(0x90B0, 0)); Assert.AreEqual(new Xy(320, 512), GetXy(0x90B0, 0, 4)); Assert.AreEqual(new Xy(48, 136), GetXy(0x9170, 0)); Assert.AreEqual(new Xy(192, 544), GetXy(0x9170, 0, 4)); }