private static void WriteBytes(State state, ushort addr, IEnumerable<byte> bytes) { foreach (var b in bytes) state.Memory[addr++] = b; // add the final NUL character state.Memory[addr] = 0; }
public byte Execute(State state) { var code = state.GetByte(); var action = actions[code]; if (action != null) action(state); return code; }
private static byte[] ReadBytes(State state, ushort addr) { var bytes = new List<byte>(); byte b; while ((b = state.Memory[addr++]) != 0) bytes.Add(b); return bytes.ToArray(); }
public void SetUp() { io = new Mock<LineIO>(); sut = new StatementDecoder(io.Object); state = new State { Memory = new byte[65536], Registers = new ushort[8], StackPointer = 0, ProgramCounter = 0, }; }
public Machine(State state, Decoder decoder) { this.state = state; this.decoder = decoder; }