Exemple #1
0
        internal void LoadRow(DataRow row, CPU cpu, Memory memory, GameBoy gameboy)
        {
            // We load the Registers
              cpu.Registers.A = GetByte(row["Ai"]);
              cpu.Registers.F = GetByte(row["Fi"]);
              cpu.Registers.B = GetByte(row["Bi"]);
              cpu.Registers.C = GetByte(row["Ci"]);
              cpu.Registers.D = GetByte(row["Di"]);
              cpu.Registers.E = GetByte(row["Ei"]);
              cpu.Registers.H = GetByte(row["Hi"]);
              cpu.Registers.L = GetByte(row["Li"]);
              cpu.Registers.PC = GetUShort(row["PCi"]);
              cpu.Registers.SP = GetUShort(row["SPi"]);

              // We load the rom
              ushort memoryAddress = 0x0000;
              int columnCount = row.Table.Columns.Count;
              int romColumnIndex = row.Table.Columns["ROM"].Ordinal;

              // Create a dummy cartridge
              var cartridgeData = new byte[columnCount - romColumnIndex];

              for (int columnIndex = romColumnIndex;
              columnIndex < columnCount;
              columnIndex++, memoryAddress++)
              {
            var element = row[columnIndex];
            if (element is System.DBNull) { break; }
            var value = Convert.ToByte((String)element, 16);
            cartridgeData[memoryAddress] = value;
              }

              gameboy.LoadCartridge("test", cartridgeData);
        }
        public void GameBoyConstructorWorks()
        {
            // Arrange
              GameBoy gb;

              // Act
              gb = new GameBoy();

              // Assert
        }
Exemple #3
0
        public void TestInstructionsViaExcel()
        {
            // Arrange
              var gameboy = new GameBoy();
              var memory = (Memory)gameboy.Memory;
              var cpu = (CPU)gameboy.CPU;

              var row = TestContext.DataRow;
              LoadRow(row, cpu, memory, gameboy);

              // Act
              var steps = (int)row["Steps"];
              for (int i = 0;
               i < steps;
               i++)
              {
            cpu.DetermineStep(true);
              }

              // Assert
              TestFlagsAndMemory(row, cpu);
        }