Esempio n. 1
0
        static unsafe void TestMemoryBlock(MemoryBlock memoryBlock)
        {
            uint[] values = new uint[] { 1, 101, 2 ^ 16 + 2, int.MaxValue };
            memoryBlock.Write32(values);
            uint[] read = new uint[4];
            memoryBlock.Read32(read);
            for (int i = 0; i < 4; i++)
            {
                if (values[i] != read[i])
                {
                    Assert.Fail($"Values read differ at {i}. Expected: {values[i]} Actual: {read[i]}");
                }
            }
            Assert.Succeed("Writing and reading uints works");
            byte *ptr = (byte *)memoryBlock.Base;

            Assert.AreEqual(1, *ptr, "Expected 1 in first byte of memory block when checking using pointer");
            Assert.AreEqual(0, *(ptr + 3), "Expected 0 in fourth byte of memory block when checking using pointer");
            byte[] valueBytes = new byte[] { 1, 0, 0, 0 };
            byte[] readByte   = new byte[4];
            memoryBlock.Read8(readByte);
            Assert.AreEqual(valueBytes, readByte, "Reading bytes works");
            valueBytes[0] = 65;
            valueBytes[1] = 127;
            memoryBlock.Write8(valueBytes);
            memoryBlock.Read8(readByte);
            Assert.AreEqual(valueBytes, readByte, "Writing bytes works");
            memoryBlock.Fill(101);
            memoryBlock.Read8(readByte);
            Assert.AreEqual(new byte[] { 101, 101, 101, 101 }, readByte, "Filling works");
            values = new uint[] { 0x65656565, 987893745, 0x65656565, 0x65656565 };
            memoryBlock.Fill(4, 1, 987893745);
            memoryBlock.Read32(read);
            Assert.AreEqual(values, read, "Using Fill(int, int, int) works");
        }
Esempio n. 2
0
 public static void ClearScreen()
 {
     x = 0;
     y = 0;
     videoMemory.Fill(fill);
     SetReadPos(0);
     writeY = 0;
     SetCursor(x, y);
 }
Esempio n. 3
0
        // clear screen
        public static void Clear(byte color)
        {
            uint i = 0;

            // text mode
            if (IsTextMode)
            {
                for (i = 0; i < (Width * Height) * 2; i += 2)
                {
                    Buffer[i] = 0x20; Buffer[i + 1] = color;
                }
            }
            // graphics mode
            else if (!IsTextMode && !IsDoubleBuffered)
            {
                for (i = 0; i < Width * Height; i++)
                {
                    Buffer[i] = color;
                }
            }
            // double buffered graphics mode
            else if (!IsTextMode && IsDoubleBuffered)
            {
                BackBuffer.Fill(color);
            }
        }
Esempio n. 4
0
 public HBAPRDTEntry(uint aAddress, uint aEntry)
 {
     xAddress = aAddress;
     xEntry   = aEntry;
     xBlock   = new MemoryBlock(aAddress + (0x10 * xEntry), 0x10);
     xBlock.Fill(0);
 }
Esempio n. 5
0
 public HBACommandHeader(uint aAddress, uint aSlot)
 {
     xAddress = aAddress;
     xSlot    = aSlot;
     xBlock   = new MemoryBlock(aAddress + (32 * aSlot), 0x20);
     xBlock.Fill(0);
 }
Esempio n. 6
0
 public HBACommandTable(uint aAddress, uint aPRDTCount)
 {
     xAddress = aAddress;
     xBlock   = new MemoryBlock(aAddress, 0x80);
     xBlock.Fill(0);
     PRDTEntry = new HBAPRDTEntry[aPRDTCount];
     for (uint i = 0; i < aPRDTCount; i++)
     {
         PRDTEntry[i] = new HBAPRDTEntry(aAddress + 0x80, i);
     }
 }
Esempio n. 7
0
 internal void DoubleBuffer_Clear(uint color)
 {
     Video_Memory.Fill(FrameSize, FrameSize, color);
 }
Esempio n. 8
0
 public void ClearVRAM(uint value)
 {
     LinearFrameBuffer.Fill(value);
 }
Esempio n. 9
0
 /// <summary>
 /// Initialize AHCI instance.
 /// </summary>
 /// <param name="aSectorSize">A sector size.</param>
 public AHCI(uint aSectorSize)
 {
     DataBlock = new Core.MemoryBlock(0x0046C000, aSectorSize * 1024);
     DataBlock.Fill(0);
 }
Esempio n. 10
0
 /// <summary>
 /// Clear screen to specified color.
 /// </summary>
 /// <param name="color">Color.</param>
 /// <exception cref="Exception">Thrown on memory access violation.</exception>
 /// <exception cref="NotImplementedException">Thrown if VMWare SVGA 2 has no rectange copy capability</exception>
 public void Clear(uint color)
 {
     VideoMemory.Fill(FrameSize, FrameSize, color);
 }
Esempio n. 11
0
 public FISRegisterH2D(uint aAddress)
 {
     xAddress = aAddress;
     xBlock   = new MemoryBlock(aAddress, 20);
     xBlock.Fill(0);
 }