             baseY = 128 + tileY * 28
             for tileX in [0...8]
                 baseX = tileX << 5
-                color = @$readPalette 0x3F00 | (tileY << 3) | tileX
+                color = @ppuMemory.readPalette (tileY << 3) | tileX
                 @renderPaletteTile baseX, baseY, color
         undefined
 

                bitPosition = columnNumber ^ 0x07
                colorSelect1 =  (patternBuffer0 >> bitPosition) & 0x01
                colorSelect2 = ((patternBuffer1 >> bitPosition) & 0x01) << 1
                color = @$readPalette 0x3F00 | colorSelect2 | colorSelect1
                @setFramePixelOnPosition x, y, color
        undefined


        @supressNMI = false     # Whether to supress NMI generation
        @nmiDelay = 0           # Number of cycles after which NMI is generated
        @oddFrame = false       # Whether odd frame is being rendered
        @spriteCount = 0        # Total number of sprites on current scanline
        @spriteNumber = 0       # Number of currently fetched sprite
        @spriteCache = (0 for [0..261])         # Preprocesed sprite data for current scanline (cycle -> sprite rendered on that cycle)
