コード例 #1
0
 /// <summary>
 /// Updates the key state.
 /// </summary>
 /// <param name="memory">The memory.</param>
 internal void Update(GbMemory memory)
 {
     if (((GetJoypad(this.prevKeys) & 0xF) == 0xF) && (GetJoypad(this.keys) & 0xF) != 0xF)
     {
         memory.IF |= 0x10;
     }
 }
コード例 #2
0
ファイル: Lcd.cs プロジェクト: izik1/JAGBE
        /// <summary>
        /// Initializes a new instance of the <see cref="Lcd"/> class.
        /// </summary>
        /// <param name="memory">The memory.</param>
        public Lcd(GbMemory memory)
        {
            for (int i = 0; i < this.displayMemory.Length; i++)
            {
                this.displayMemory[i] = WHITE;
            }

            this.mem = memory;
        }
コード例 #3
0
        public static void CopyRom(byte[] bootRom, byte[] cartRom, GbMemory mem)
        {
            Buffer.BlockCopy(bootRom, 0, mem.BootRom, 0, 0x100);
            if (mem.Rom.Length < cartRom.Length)
            {
                Logger.LogError("Given rom is bigger than it says it should be.");
                throw new InvalidOperationException();
            }

            Buffer.BlockCopy(cartRom, 0, mem.Rom, 0, cartRom.Length); // Buffer copy because I guess it might be faster?
            if (mem.Rom.Length > cartRom.Length)
            {
                Logger.LogWarning("Given rom is shorter than it says it is, 0xFF filling leftover space.");
                for (int i = cartRom.Length; i < mem.Rom.Length; i++)
                {
                    mem.Rom[i] = 0xFF;
                }
            }
        }
コード例 #4
0
ファイル: Opcode.cs プロジェクト: EBWeist/JAGBE
 /// <summary>
 /// Invokes the <see cref="function"/> of this instance with the given arguments.
 /// </summary>
 /// <param name="memory">The memory.</param>
 public int Invoke(GbMemory memory) => this.function(this, memory);
コード例 #5
0
ファイル: Cpu.cs プロジェクト: izik1/JAGBE
 /// <summary>
 /// Initializes a new instance of the <see cref="Cpu"/> class.
 /// </summary>
 /// <remarks>
 /// This constructor should be used when the ability to freely check the memory is needed, IE tests.
 /// </remarks>
 /// <param name="memory">The memory.</param>
 public Cpu(GbMemory memory) => this.memory = memory;