public void writeChr(int address, int value) {
        if (!cartridge.canWriteChr())
            return;

        address &= 0x1FFF;
        value &= 0xFF;

        int bank = address >> CHR_BANK_SHIFT;
        int offset = address & CHR_BANK_MASK;
        int adrbank = chrBank[bank];

        chrMemory[(adrbank << CHR_BANK_SHIFT) + offset] = (byte) value;
    }