private void reallyPlotPixel(int x, int y, boolean isBG, boolean isSpr) {
       
    	int val = 0; // background color
        if (isBG) {
            val = getBGPixelIndex(x, y);
        } else {
            // When  BG rendering is off, we display color index 0
            // unless the PPU is currently pointing at $3Fxx in which case that value is
            // NOT WORKING!!!
            if ((_loopyV & 0x3F00) == 0x3F00) {
                val = _loopyV & 0x1F;
                if ((val & 0x13) == 0x10) {
                    val ^= 0x10; // mirrored entries
                }
            }
        }
        int palIndex = val;

        if (val % 4 == 0) {
            palIndex = 0;
        }
        if (isSpr) {
            int val2 = calcSprite(x, y, (val % 4));
            if (val2 % 4 == 0) {
                val2 = 0;
            }
            if ((val % 4 == 0) || val2 != 0) {
                palIndex = val2;
            }
        }
        byte palColor = _mem.getCHRMemory(0x3F00 + palIndex);
        _display.plot(x, y, (palColor & 0xFF), isMonochrome, isRedIntensified, isGreenIntensified, isBlueIntensified);
    }