Beispiel #1
0
        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;
        }
Beispiel #2
0
        public byte Execute(State state)
        {
            var code = state.GetByte();
              var action = actions[code];
              if (action != null)
            action(state);

              return code;
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
 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,
       };
 }
Beispiel #5
0
 public Machine(State state, Decoder decoder)
 {
     this.state = state;
       this.decoder = decoder;
 }