public void handler(int offset, int data) {
            int bankaddress;

            int banks[]
                    = {
                        0, 0, 0, 0, 0, 1, 0, 1, 0, 0,
                        0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
                        1, 0, 1, 1, 1, 1, 1, 1, 1, 1
                    };
            UBytePtr RAM = memory_region(REGION_CPU1);

            bankcontrol[offset] = data;
            if (offset == 0) {
                if (data < 1 || data > 30) {
                    if (errorlog != null) {
                        fprintf(errorlog, "unknown bank select %02x\n", data);
                    }
                    return;
                }
                bankaddress = 0x10000 + (banks[data - 1] * 0x2000);
                cpu_setbank(1, new UBytePtr(RAM, bankaddress));
            } else {
                if (bankcontrol[0] == 0x01 && data == 0x0d) /* special case for service mode */ {
                    ldrun2_bankswap = 2;
                } else {
                    ldrun2_bankswap = 0;
                }
            }
        }