public void Setup()
        {
            _byteFactory = TestUtils.CreateByteFactory();
            _fullByte    = _byteFactory.Create(255);

            Instruction = _byteFactory.Create(0);
            Flags       = new Caez();

            var cpuPinStates = new CpuPinStates(TestUtils.CreateClock(), TestUtils.CreateStepper(), Instruction, Flags,
                                                TestUtils.CreateAnd(), TestUtils.CreateOr(), TestUtils.CreateNot(), TestUtils.CreateDecoder(),
                                                _byteFactory);

            var bus = new Bus <IByte>(new BusMessage <IByte> {
                Data = new Byte(), Name = "Bus"
            });
            var ioBus = new Bus <IByte>(new BusMessage <IByte> {
                Data = new Byte(), Name = "IoBus"
            });
            var byteRegisterFactory = TestUtils.CreateByteRegisterFactory();
            var ram           = TestUtils.CreateRam(bus);
            var computerState = new ComputerState(byteRegisterFactory, ram, TestUtils.CreateBus1Factory(),
                                                  new ArithmeticLogicUnitFactory(), TestUtils.CreateCaezRegisterFactory(), new BitRegisterFactory(TestUtils.CreateMemoryGateFactory()), bus, ioBus);

            _sut = new Computer(cpuPinStates, computerState);
        }
 public void Setup()
 {
     _clock      = TestUtils.CreateClock();
     _stepper    = TestUtils.CreateStepper();
     Instruction = new Byte();
     Caez        = new Caez();
     _sut        = new CpuPinStates(_clock, _stepper, Instruction, Caez, new And(), TestUtils.CreateOr(), TestUtils.CreateNot(),
                                    TestUtils.CreateDecoder(), TestUtils.CreateByteFactory());
 }
예제 #3
0
        public void Step()
        {
            var pinStates = CpuPinStates.Step(ComputerState.Ir.Output, ComputerState.Flags.Output);

            ComputerState.UpdatePins(pinStates);
            Apply();

            if (pinStates.ClockOutput.AllOff)
            {
                ComputerState.Bus.UpdateData(new BusMessage <IByte> {
                    Data = new Byte(), Name = "Bus"
                });
            }
        }