public int readFromPalette(int address) {
        address &= 0x1F;

        if (address == 0x10) {
            return bgPalette[0];
        } else if ((address & 0x10) != 0) {
            return sprPalette[address & 0x0F];
        } else {
            return bgPalette[address & 0x0F];
        }
    }