Ejemplo n.º 1
0
        public InputController(Interconnect interconnect, InterruptController interruptController, IInputSource inputSource)
        {
            _interruptController = interruptController;
            _inputSource         = inputSource;

            interconnect.AddAddressHandler(0xFF00, this);
        }
Ejemplo n.º 2
0
        public Timer(SystemClock clock, Interconnect interconnect, InterruptController interruptController)
            : base(clock)
        {
            _interruptController = interruptController;

            interconnect.AddAddressHandler(0xFF04, 0xFF07, this);
        }
Ejemplo n.º 3
0
        private uint _vblankClock;                  // counter of clock cycles elapsed in current scanline in vblank

        public LCDController(SystemClock clock, Interconnect interconnect, InterruptController interruptController, IVideoFrameSink frameSink)
            : base(clock)
        {
            _interconnect        = interconnect;
            _interruptController = interruptController;
            _frameSink           = frameSink;

            _interconnect.AddAddressHandler(0xFF40, 0xFF4B, this); // control registers
            _interconnect.AddAddressHandler(0x8000, 0x9FFF, this); // vram
            _interconnect.AddAddressHandler(0xFE00, 0xFE9F, this); // oam

            _screenData = new byte[ScreenWidth * ScreenHeight];

            _vram = new byte[0x2000];

            _tileCache = new byte[384][];

            for (int i = 0; i < _tileCache.Length; i++)
            {
                _tileCache[i] = new byte[64];
            }

            _tileCacheInvalid = new bool[384];

            _oam    = new byte[0xA0];
            _oamDma = default(OamDma);

            _backgroundPalette = new byte[4];

            _spritePalette = new byte[2][]
            {
                new byte[4],
                new byte[4]
            };
        }
        public SerialCommunicationController(SystemClock clock, Interconnect interconnect, InterruptController interruptController)
            : base(clock)
        {
            _interruptController = interruptController;

            interconnect.AddAddressHandler(0xFF01, 0xFF02, this);

            // internal shift clock is 8192Hz
            _internalShiftClockInterval = SystemClock.ClockFrequency / 8192;

            _internalClock = true;
        }
Ejemplo n.º 5
0
        public GameBoy(IVideoFrameSink frameSink, IInputSource inputSource)
        {
            Clock        = new SystemClock();
            Interconnect = new Interconnect();

            Interconnect.AddAddressHandler(0x0000, 0x00FF, new BootRom());
            Memory = new SystemMemory(Interconnect);

            InterruptController = new InterruptController(Interconnect);

            CPU      = new SM83(Clock, Interconnect, InterruptController);
            Timer    = new Timer(Clock, Interconnect, InterruptController);
            SerialIO = new SerialCommunicationController(Clock, Interconnect, InterruptController);
            LCD      = new LCDController(Clock, Interconnect, InterruptController, frameSink);
            PSG      = new SoundController(Clock, Interconnect);
            Input    = new InputController(Interconnect, InterruptController, inputSource);
        }