예제 #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");
        }
예제 #2
0
 public static void ClearScreen()
 {
     x = 0;
     y = 0;
     videoMemory.Fill(fill);
     SetReadPos(0);
     writeY = 0;
     SetCursor(x, y);
 }
예제 #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);
            }
        }
예제 #4
0
 public HBAPRDTEntry(uint aAddress, uint aEntry)
 {
     xAddress = aAddress;
     xEntry   = aEntry;
     xBlock   = new MemoryBlock(aAddress + (0x10 * xEntry), 0x10);
     xBlock.Fill(0);
 }
예제 #5
0
 public HBACommandHeader(uint aAddress, uint aSlot)
 {
     xAddress = aAddress;
     xSlot    = aSlot;
     xBlock   = new MemoryBlock(aAddress + (32 * aSlot), 0x20);
     xBlock.Fill(0);
 }
예제 #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);
     }
 }
예제 #7
0
파일: Driver.cs 프로젝트: daniel500013/CGUI
 internal void DoubleBuffer_Clear(uint color)
 {
     Video_Memory.Fill(FrameSize, FrameSize, color);
 }
예제 #8
0
 public void ClearVRAM(uint value)
 {
     LinearFrameBuffer.Fill(value);
 }
예제 #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);
 }
예제 #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);
 }
예제 #11
0
 public FISRegisterH2D(uint aAddress)
 {
     xAddress = aAddress;
     xBlock   = new MemoryBlock(aAddress, 20);
     xBlock.Fill(0);
 }