             attributeAddress = attributeTableAddress + attributeNumber
             attribute = @read attributeAddress
             # Attribute has format $3322.1100. where 00, 11, 22, 33 are two upper color bits
-            # for one of 2x2 subarea of 4x4 tile area.
+            # for one of 2x2 subarea of the 4x4 tile area.
             # We have to find in which subarea are we in. This is decided by bit 1 of YYYYY and XXXXX values.
             subareaNumber = (@vramAddress >>> 5) & 0x02 | (@vramAddress >>> 1) & 0x01
             @colorBits43 = ((attribute >>> subareaNumber) & 0x03) << 2

        @scanline = -1 if @scanline is 262
        @vblankInProgress = 241 <= @scanline <= 260
        @cpu.nonMaskableInterrupt() if @scanline is 241 and @vblankGeneratesNMI

    readFrame: ->
        @framebuffer

    isFrameAvailable: ->
        true

    isRenderingInProgress: ->
        not @vblankInProgress and (@spritesVisible or @backgroundVisible)

    getMonochromeColorIndex: (index) ->
        index & 0x30    

module.exports = PPU

            @colorBit2Row = @read colorBit2RowAddress
        colorBit1 = (@colorBit1Row >>> @fineXScroll) & 0x01
        colorBit2 = ((@colorBit2Row >>> @fineXScroll) & 0x01) << 1
        # Optimization - we compute this only when coarse scroll X was incremented 4 times.
        if (@vramAddress & 0x0003) is 0 or @firstPixelIsRendered
            # We compute pointer to attribute table as $2.NN11.11YY.Y.XXX
            # where YYY and XXX are 3 upper bits of YYYYY and XXXXX.
            # Each attribute applies to area of 4x4 tiles (that's why we removed 2 lower bits of YYYYY and XXXXX).
