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

              return code;
        }
예제 #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();
        }
예제 #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,
       };
 }
예제 #5
0
파일: Machine.cs 프로젝트: njmube/public
 public Machine(State state, Decoder decoder)
 {
     this.state = state;
       this.decoder = decoder;
 }