Esempio n. 1
0
        public Gpu(IDisplay display, InterruptManager interruptManager, Dma dma, Ram oamRam, bool gbc)
        {
            _r                = new MemoryRegisters(GpuRegister.Values().ToArray());
            _lcdc             = new Lcdc();
            _interruptManager = interruptManager;
            _gbc              = gbc;
            _videoRam0        = new Ram(0x8000, 0x2000);
            _videoRam1        = gbc ? new Ram(0x8000, 0x2000) : null;
            _oamRam           = oamRam;
            _dma              = dma;

            _bgPalette  = new ColorPalette(0xff68);
            _oamPalette = new ColorPalette(0xff6a);
            _oamPalette.FillWithFf();

            _oamSearchPhase     = new OamSearch(oamRam, _lcdc, _r);
            _pixelTransferPhase = new PixelTransfer(_videoRam0, _videoRam1, oamRam, display, _lcdc, _r, gbc, _bgPalette,
                                                    _oamPalette);
            _hBlankPhase = new HBlankPhase();
            _vBlankPhase = new VBlankPhase();

            _mode  = Mode.OamSearch;
            _phase = _oamSearchPhase.Start();

            _display = display;
        }
Esempio n. 2
0
 public OamSearch(IAddressSpace oemRam, Lcdc lcdc, MemoryRegisters registers)
 {
     this._oemRam    = oemRam;
     this._registers = registers;
     this._lcdc      = lcdc;
     _sprites        = new SpritePosition[10];
 }
Esempio n. 3
0
        public PixelFifoTests()
        {
            var r = new MemoryRegisters(GpuRegister.Values.OfType <MemoryRegisters.IRegister>());

            r.Put(GpuRegister.BGP, 0b11100100);
            fifo = new DmgPixelFifo(new NullDisplay(), r);
        }
        public void SetUp()
        {
            var registers = new MemoryRegisters(GpuRegister.Values().ToArray());

            registers.Put(GpuRegister.Bgp, 0b11100100);
            _fifo = new DmgPixelFifo(new NullDisplay(), registers);
        }
Esempio n. 5
0
 public Fetcher(IPixelFifo fifo, IAddressSpace videoRam0, IAddressSpace videoRam1, IAddressSpace oemRam, Lcdc lcdc,
                MemoryRegisters registers, bool gbc)
 {
     _gbc       = gbc;
     _fifo      = fifo;
     _videoRam0 = videoRam0;
     _videoRam1 = videoRam1;
     _oemRam    = oemRam;
     _r         = registers;
     _lcdc      = lcdc;
 }
Esempio n. 6
0
        public PixelTransfer(IAddressSpace videoRam0, IAddressSpace videoRam1, IAddressSpace oemRam, IDisplay display,
                             Lcdc lcdc, MemoryRegisters r, bool gbc, ColorPalette bgPalette, ColorPalette oamPalette)
        {
            _r    = r;
            _lcdc = lcdc;
            _gbc  = gbc;

            _fifo = gbc
                ? (IPixelFifo) new ColorPixelFifo(lcdc, display, bgPalette, oamPalette)
                : new DmgPixelFifo(display, r);

            _fetcher = new Fetcher(_fifo, videoRam0, videoRam1, oemRam, lcdc, r, gbc);
        }
 public DmgPixelFifo(IDisplay display, MemoryRegisters registers)
 {
     _display   = display;
     _registers = registers;
 }