public void RLC() { cpu = new CPU(mmu, regs); regs.PC = 0xc000; regs.SetAllRegs(0x85); //put the test data into memory. for (int i = 0; i < 8; i++) { mmu.wb((ushort)(0xc000 + i), (byte)i); // push the RLC instructions into memory. } cpu.Tick(0xcb); Assert.That(regs.B, Is.EqualTo(0xb)); cpu.Tick(0xcb); Assert.That(regs.C, Is.EqualTo(0xb)); cpu.Tick(0xcb); Assert.That(regs.D, Is.EqualTo(0xb)); cpu.Tick(0xcb); Assert.That(regs.E, Is.EqualTo(0xb)); cpu.Tick(0xcb); Assert.That(regs.H, Is.EqualTo(0xb)); cpu.Tick(0xcb); Assert.That(regs.L, Is.EqualTo(0xb)); //the HL register mmu.wb(0xc150, 0x85); regs.HL = 0xc150; cpu.Tick(0xcb); Assert.That(mmu.rb(0xc150), Is.EqualTo(0xb)); //Finally a register. cpu.Tick(0xcb); Assert.That(regs.A, Is.EqualTo(0xb)); }
static void TestPattern() { GPU.reset(); GPU._bgon = 1; // turn Background on GPU._lcdon = 1; // turn LCD on GPU._winon = 1; // turn Window on GPU._xscrl = 0; GPU._yscrl = 0; // tile pattern tables are 0x8000 => 0x8FFF, or 0x8800 => 0x97FF // set tile 0 to all 0 for (int i = 0; i < 4; i++) { MMU.wb(0x8000 + i, 0); // low bit MMU.wb(0x8001 + i, 0); // high bit } // set tile 1 to all 1 MMU.wb(0x8002, 0xFF); // low bit MMU.wb(0x8003, 0); // high bit // set tile 2 to all 2 MMU.wb(0x8004, 0x00); // low bit MMU.wb(0x8005, 0xFF); // high bit // set tile 3 to all 3 MMU.wb(0x8004, 0xFF); // low bit MMU.wb(0x8005, 0xFF); // high bit // set the background tiles to all be tile 3 (all 0x3) // Map Display Select Mode 0 0x9800 => 0x9BFF (32 * 32) for (int i = 0; i < 32 * 32; i++) { MMU.wb(0x9800 + i, i % 4); } GPU.RenderTiles(); }