示例#1
0
 /// <summary>
 /// PPUが持つVRAMへデータを書き込む。
 /// </summary>
 /// <param name="data"></param>
 private void WriteVideoRamData(byte data)
 {
     if (currentVideoRamAddress >= 0x2000)
     {
         if (0x3f00 <= currentVideoRamAddress && currentVideoRamAddress < 0x4000)
         {
             // パレットテーブルへの書き込み
             var address = (Address)(currentVideoRamAddress & 0x1F);
             paletteRam.Write(address, data);
         }
         else
         {
             // ネームテーブル、属性テーブルへの書き込み
             // 0x3000 - 0x3EFF間のミラーリングを考慮
             var address = 0x3000 <= currentVideoRamAddress && currentVideoRamAddress < 0x3F00
                ? (Address)(currentVideoRamAddress - 0x3000)
                : (Address)(currentVideoRamAddress - 0x2000);
             videoRam.Write(address, data);
         }
     }
     else
     {
         // TODO キャラクタRAMへの書き込み
     }
     currentVideoRamAddress += controlRegister.AddressIncrement;
 }
示例#2
0
文件: CpuBus.cs 项目: nixjoe/SharpNES
        public void Write(Address address, byte data)
        {
            switch (address & 0xE000)
            {
            case 0x0000:
                // WRAM
                wram.Write(address, data);
                return;

            case 0x2000:
                // PPU
                ppu.Write(address, data);
                return;

            case 0x4000:
                // APU, Controller I/O
                return;

            case 0x6000:
                return;

            case 0x8000:
            case 0xC000:
                // Program RAM?
                return;

            default:
                throw new ArgumentException("Trying to access an address not included in the specification.");
            }
        }
示例#3
0
 /// <summary>
 /// スプライトRAMにデータを書き込む。
 /// </summary>
 /// <param name="data"></param>
 private void WriteSpriteRamData(byte data)
 {
     spriteRam.Write(currentVideoRamAddress, data);
     currentVideoRamAddress += 0x01;
 }