Esempio n. 1
0
 public SpriteHandler(
     IPPUMemoryMap ppuMemoryMap,
     PPURegisters registers,
     PaletteHandler paletteHandler)
 {
     this.registers      = registers;
     this.ppuMemoryMap   = ppuMemoryMap;
     this.paletteHandler = paletteHandler;
 }
Esempio n. 2
0
        public BackgroundHandler(
            IPPUMemoryMap ppuMemoryMap,
            PPURegisters registers,
            PPUInternalRegisters internalRegisters,
            ScrollHandler scrollHandler,
            PaletteHandler paletteHandler)
        {
            this.registers         = registers;
            this.ppuMemoryMap      = ppuMemoryMap;
            this.scrollHandler     = scrollHandler;
            this.paletteHandler    = paletteHandler;
            this.internalRegisters = internalRegisters;

            foreach (var patternTable in this.ppuMemoryMap.GetMemorySegments <PatternTable>())
            {
                if (patternTable.Range.Min == 0x0000)
                {
                    this.patternTable0 = patternTable;
                }
                else if (patternTable.Range.Min == 0x1000)
                {
                    this.patternTable1 = patternTable;
                }
            }

            foreach (var nameTable in this.ppuMemoryMap.GetMemorySegments <Nametable>())
            {
                if (nameTable.Range.Min == 0x2000)
                {
                    this.nameTable0 = nameTable;
                }
                else if (nameTable.Range.Min == 0x2400)
                {
                    this.nameTable1 = nameTable;
                }
                else if (nameTable.Range.Min == 0x2800)
                {
                    this.nameTable2 = nameTable;
                }
                else if (nameTable.Range.Min == 0x2C00)
                {
                    this.nameTable3 = nameTable;
                }
            }
        }