public CPU(MemorySpace.Memory memory) { this._memory = memory; this._interruptController = new InterruptController(this._memory); // Initialize registers Reset(); ResetBreakpoints(); }
/// <summary> /// Class constructor. /// </summary> public SerialController(InterruptController interruptController, Memory memory) { this.interruptController = interruptController; this.memory = memory; // Always try to serial connect for now SerialAdapter uart = new UARTSerialAdapter(); var connections = uart.Discover(); if(connections.Length > 0) { // Connect to the first one, this is awesome! uart.Connect(connections[0]); this.adapter = uart; return; } }
/// <summary> /// Class constructor. /// Initializes cpu and memory. /// </summary> public GameBoy() { _state.Run = false; _stopwatch = new Stopwatch(); _memory = new MemorySpace.Memory(); _cpu = new CPUSpace.CPU(this._memory); _interruptController = this._cpu._interruptController; _display = new Display(this._interruptController, this._memory); _apu = new AudioSpace.APU(this, this._memory, 44000, 2, 2); _serial = new SerialSpace.SerialController(this._interruptController, this._memory); _disassembler = new Disassembler(_cpu, _memory); // Events _cpu.BreakpointFound += BreakpointHandler; _cpu.InterruptHappened += InterruptHandler; _display.FrameReady += FrameReadyHandler; InternalReset(false); }
/// <summary> /// Display constructor. /// </summary> /// <param name="interruptController">A reference to the interrupt controller.</param> /// <param name="Memory">A reference to the memory.</param> public Display(InterruptController interruptController, Memory memory) { _interruptController = interruptController; _memory = memory; _disDef = new DisplayDefinition(); _state = new State(); GeneratePixelLookupTable(); Reset(); }