public Gameboy( GameboyOptions options, Cartridge rom, IDisplay display, IController controller, ISoundOutput soundOutput, SerialEndpoint serialEndpoint) { _display = display; _gbc = rom.Gbc; SpeedMode = new SpeedMode(); var interruptManager = new InterruptManager(_gbc); _timer = new Timer(interruptManager, SpeedMode); Mmu = new Mmu(); var oamRam = new Ram(0xfe00, 0x00a0); _dma = new Dma(Mmu, oamRam, SpeedMode); _gpu = new Gpu(display, interruptManager, _dma, oamRam, _gbc); _hdma = new Hdma(Mmu); _sound = new Sound(soundOutput, _gbc); _serialPort = new SerialPort(interruptManager, serialEndpoint, SpeedMode); Mmu.AddAddressSpace(rom); Mmu.AddAddressSpace(_gpu); Mmu.AddAddressSpace(new Joypad(interruptManager, controller)); Mmu.AddAddressSpace(interruptManager); Mmu.AddAddressSpace(_serialPort); Mmu.AddAddressSpace(_timer); Mmu.AddAddressSpace(_dma); Mmu.AddAddressSpace(_sound); Mmu.AddAddressSpace(new Ram(0xc000, 0x1000)); if (_gbc) { Mmu.AddAddressSpace(SpeedMode); Mmu.AddAddressSpace(_hdma); Mmu.AddAddressSpace(new GbcRam()); Mmu.AddAddressSpace(new UndocumentedGbcRegisters()); } else { Mmu.AddAddressSpace(new Ram(0xd000, 0x1000)); } Mmu.AddAddressSpace(new Ram(0xff80, 0x7f)); Mmu.AddAddressSpace(new ShadowAddressSpace(Mmu, 0xe000, 0xc000, 0x1e00)); Cpu = new Cpu(Mmu, interruptManager, _gpu, display, SpeedMode); interruptManager.DisableInterrupts(false); if (!options.UseBootstrap) { InitiliseRegisters(); } }
public SerialPort(InterruptManager interruptManager, SerialEndpoint serialEndpoint, SpeedMode speedMode) { _interruptManager = interruptManager; _serialEndpoint = serialEndpoint; _speedMode = speedMode; }