/// <summary>
 /// Initializes a new instance of the <see cref="MemoryHandler"/> class.
 /// </summary>
 /// <param name="address">The address.</param>
 /// <param name="size">The size.</param>
 /// <param name="type">The type.</param>
 /// <param name="read8">The read8.</param>
 /// <param name="write8">The write8.</param>
 public MemoryHandler(uint address, uint size, uint type, MemoryDispatch.MemoryRead8 read8, MemoryDispatch.MemoryWrite8 write8)
 {
     Address = address;
     Size = size;
     Type = type;
     this.read8 = read8;
     this.write8 = write8;
 }
Beispiel #2
0
 /// <summary>
 /// Gets or sets the <see cref="System.Byte"/> at the specified index.
 /// </summary>
 /// <value></value>
 /// <returns></returns>
 public byte this[uint index]
 {
     get
     {
         return(MemoryDispatch.Read8((uint)(_address + index)));
     }
     set
     {
         MemoryDispatch.Write8((uint)(_address + index), value);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Writes the specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="value">The value.</param>
        /// <param name="count">The count.</param>
        public void Write32(uint index, uint value, byte count)
        {
            uint offset = _address + index;

            if (count == 1)
            {
                MemoryDispatch.Write8(offset, (byte)value);
                return;
            }

            while (count > 0)
            {
                MemoryDispatch.Write8(offset, (byte)(value & 0xFF));
                value = value >> 8;
                count--;
                offset++;
            }
        }
Beispiel #4
0
        /// <summary>
        /// Reads the specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="count">The count.</param>
        /// <returns></returns>
        public uint Read32(uint index, byte count)
        {
            uint offset = _address + index;
            uint value  = 0;

            if (count == 1)
            {
                return(MemoryDispatch.Read8(offset));
            }

            while (count > 0)
            {
                value = (value >> 8) | MemoryDispatch.Read8(offset);
                count--;
                offset++;
            }

            return(value);
        }
Beispiel #5
0
 /// <summary>
 /// Reads the specified index.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <returns></returns>
 public ushort Read16(uint index)
 {
     return(MemoryDispatch.Read16((uint)(_address + index)));
 }
Beispiel #6
0
 /// <summary>
 /// Writes the specified index.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="value">The value.</param>
 public void Write8(uint index, byte value)
 {
     MemoryDispatch.Write8((uint)(_address + index), value);
 }
Beispiel #7
0
 /// <summary>
 /// Reads the specified index.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <returns></returns>
 public byte Read8(uint index)
 {
     return(MemoryDispatch.Read8((uint)(_address + index)));
 }
Beispiel #8
0
 /// <summary>
 /// Writes the specified index.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="value">The value.</param>
 public void Write32(uint index, uint value)
 {
     MemoryDispatch.Write32((uint)(_address + index), value);
 }
Beispiel #9
0
 /// <summary>
 /// Reads the specified index.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <returns></returns>
 public uint Read24(uint index)
 {
     return(MemoryDispatch.Read24((uint)(_address + index)));
 }
Beispiel #10
0
 /// <summary>
 /// Writes the specified index.
 /// </summary>
 /// <param name="index">The index.</param>
 /// <param name="value">The value.</param>
 public void Write16(uint index, ushort value)
 {
     MemoryDispatch.Write16((uint)(_address + index), value);
 }
Beispiel #11
0
 /// <summary>
 /// Requests a block of memory from the kernel
 /// </summary>
 /// <param name="address">The address.</param>
 /// <param name="size">The size.</param>
 /// <returns></returns>
 public IMemory RequestMemory(uint address, uint size)
 {
     return(MemoryDispatch.RegisterMemory(address, size));
 }