static void toaplan2_voffs_w(int offset, int data, int controller) {
        toaplan2_voffs[controller] = data;

        /* Layers are seperated by ranges in the offset */
        switch (data & 0xfc00) {
            case 0x0400:
            case 0x0000:
                bg_offs[controller] = (data & 0x7ff) * 2;
                break;
            case 0x0c00:
            case 0x0800:
                fg_offs[controller] = (data & 0x7ff) * 2;
                break;
            case 0x1400:
            case 0x1000:
                top_offs[controller] = (data & 0x7ff) * 2;
                break;
            case 0x1800:
                sprite_offs[controller] = (data & 0x3ff) * 2;
                break;
            default:
                if (errorlog != null) {
                    fprintf(errorlog, "Hmmm, unknown video controller %01x layer being selected (%08x)\n", controller, data);
                }
                data &= 0x1800;
                if ((data & 0x1800) == 0x0000) {
                    bg_offs[controller] = (data & 0x7ff) * 2;
                }
                if ((data & 0x1800) == 0x0800) {
                    fg_offs[controller] = (data & 0x7ff) * 2;
                }
                if ((data & 0x1800) == 0x1000) {
                    top_offs[controller] = (data & 0x7ff) * 2;
                }
                if ((data & 0x1800) == 0x1800) {
                    sprite_offs[controller] = (data & 0x3ff) * 2;
                }
                break;
        }
    }