public NesPPU(NesBus bus) {
        this.bus = bus;

        generateTables();
        bus.setPPU(this);
        bus.mapWriter(0x2000, 0x2010, new PPUWriter(bus));
        bus.mapReader(0x2000, 0x2010, new PPUReader(bus));
        setMirroring(bus.getCartridge().getMirroring());

        mask = 0;
        control = 0;
        status = 0;
        address = 0;
        latch = 0;
        fineX = 0;

        /* cria a palheta de cores */
        nesColors = new int[64];
        for (int i = 0; i < 64; i++) {
            nesColors[i] = (paletteColors[i][0] << 16) |
                    (paletteColors[i][1] << 8) | paletteColors[i][2] | (255 << 24);
        }

        cachedData = 0xFF;

    }