public CpuRunner(MainWindowViewModel mainWindowViewModel, Chip8Cpu cpu, Display display) { _display = display; _cpu = cpu; _mainWindowViewModel = mainWindowViewModel; _stopwatch = new Stopwatch(); _displayAdapter = new DisplayAdapter(); _cancellationTokenSource = new CancellationTokenSource(); }
public void SetUp() { _display = new Mock<IDisplay>(); _randomizer = new Mock<IRandomizer>(); _keyboard = new Mock<IKeyboard>(); _bcdConverter = new Mock<IBcdConverter>(); _instructionDecoder = new Mock<IInstructionDecoder>(); _timerClock = new Mock<ITimerClock>(); _cpu = new Chip8Cpu(_display.Object, _randomizer.Object, _keyboard.Object, _bcdConverter.Object, _instructionDecoder.Object, _timerClock.Object); }
private void CreateCpu(byte[] buffer) { var display = new Display(); var randomizer = new Randomizer(); var wpfKeyboard = new WpfKeyboard(View); var bcdConverter = new BcdConverter(); var instructionDecoder = new InstructionDecoder(); var timerClock = new TimerClock(); var chip8Cpu = new Chip8Cpu(display, randomizer, wpfKeyboard, bcdConverter, instructionDecoder, timerClock); Array.Copy(buffer, 0, chip8Cpu.State.Memory, 0x200, buffer.Length); chip8Cpu.State.ProgramCounter = 0x200; _cpuRunner = new CpuRunner(this, chip8Cpu, display); _cpuRunner.Start(); }