Esempio n. 1
0
        public static void Assert(this IDirectMemoryAccess <BusData8> memory,
                                  ushort address, byte expected)
        {
            var actual = memory[address];

            actual.ToByte().Should().Be(expected, "at address: " + address);
        }
Esempio n. 2
0
        public static string GetString <DataT>(this IDirectMemoryAccess <DataT> memory,
                                               int address, int length = -1)
            where DataT : BusData
        {
            var  builder = new StringBuilder();
            bool stop    = false;

            do
            {
                var c = (char)memory[address].ToByte();

                if (c == 0)
                {
                    stop = true;
                }
                else
                {
                    builder.Append(c);
                }

                address++;

                if (length == 0)
                {
                    stop = true;
                }
            }while (!stop);

            return(builder.ToString());
        }
Esempio n. 3
0
        public static void Set <DataT>(this IDirectMemoryAccess <DataT> memory,
                                       int address, byte value)
            where DataT : BusData, new()
        {
            var data = new DataT();

            data.Write(value);

            memory[address] = data;
        }
Esempio n. 4
0
 public MemoryWriter(IDirectMemoryAccess <DataT> memory)
 {
     _memory = memory;
 }
Esempio n. 5
0
 public static void Set(this IDirectMemoryAccess <BusData8> memory,
                        ushort address, byte value)
 {
     memory[address] = new BusData8(value);
 }
Esempio n. 6
0
 public static uint GetInt <DataT>(this IDirectMemoryAccess <DataT> memory,
                                   int address)
     where DataT : BusData
 {
     return(memory[address].ToUInt32());
 }
Esempio n. 7
0
 public static DataT Get <DataT>(this IDirectMemoryAccess <DataT> memory,
                                 int address)
     where DataT : BusData
 {
     return(memory[address]);
 }