public static void Assert(this IDirectMemoryAccess <BusData8> memory, ushort address, byte expected) { var actual = memory[address]; actual.ToByte().Should().Be(expected, "at address: " + address); }
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()); }
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; }
public MemoryWriter(IDirectMemoryAccess <DataT> memory) { _memory = memory; }
public static void Set(this IDirectMemoryAccess <BusData8> memory, ushort address, byte value) { memory[address] = new BusData8(value); }
public static uint GetInt <DataT>(this IDirectMemoryAccess <DataT> memory, int address) where DataT : BusData { return(memory[address].ToUInt32()); }
public static DataT Get <DataT>(this IDirectMemoryAccess <DataT> memory, int address) where DataT : BusData { return(memory[address]); }