예제 #1
0
파일: Ppu.cs 프로젝트: Nyllcp/pNes
 public void WritePpuMemory(int address, byte data)
 {
     if (address < 0x3F00)
     {
         _cart.WriteCart(address, data);
     }
     else
     {
         if ((address & 0x10) != 0 && (address & 3) == 0)
         {
             address &= ~0x10;
         }
         paletteRam[address & 0x1F] = (byte)(data & 0x3F);
     }
 }
예제 #2
0
파일: Core.cs 프로젝트: Nyllcp/pNes
 public void WriteMemory(int address, byte data)
 {
     address &= 0xFFFF;
     if (address < 0x2000)
     {
         ram[address & 0x7FF] = data;
     }
     else if (address < 0x4000)
     {
         _ppu.WritePpuRegister(address, data);
     }
     else if (address < 0x4020)
     {
         //$4000-$4017	$0018	NES APU and I/O registers
         //$4018-$401F	$0008	APU and I/O functionality that is normally disabled.See CPU Test Mode.
         if (address == 0x4014)
         {
             _cpu.CycleCountStep += 514; //oam transfer stall cpu for 514 cycles
             _cpu.SetCycleCount(_cpu.GetCycleCount() + 514);
             _ppu.WritePpuRegister(address, data);
         }
         else if (address == 0x4016)
         {
             strobingPad     = ((data & 1) != 0) ? true : false;
             padShiftCounter = 0;
         }
         else
         {
             _apu.WriteApuRegister(address, data);
         }
     }
     else
     {
         //$4020-$FFFF $BFE0 Cartridge space: PRG ROM, PRG RAM, and mapper registers (See Note)
         _cart.WriteCart(address, data);
     }
 }