public int handler(int controller) {
            if ((spriteram_new[controller] = new UBytePtr(TOAPLAN2_SPRITERAM_SIZE)) == null) {
                return 1;
            }
            memset(spriteram_new[controller], 0, TOAPLAN2_SPRITERAM_SIZE);

            if ((spriteram_next[controller] = new UBytePtr(TOAPLAN2_SPRITERAM_SIZE)) == null) {
                spriteram_new[controller] = null;
                return 1;
            }
            memset(spriteram_next[controller], 0, TOAPLAN2_SPRITERAM_SIZE);

            if ((spriteram_now[controller] = new UBytePtr(TOAPLAN2_SPRITERAM_SIZE)) == null) {
                spriteram_next[controller] = null;
                spriteram_new[controller] = null;
                return 1;
            }
            memset(spriteram_now[controller], 0, TOAPLAN2_SPRITERAM_SIZE);

            if ((topvideoram[controller] = new UBytePtr(TOAPLAN2_TOP_VRAM_SIZE)) == null) {
                spriteram_now[controller] = null;
                spriteram_next[controller] = null;
                spriteram_new[controller] = null;
                return 1;
            }
            memset(topvideoram[controller], 0, TOAPLAN2_TOP_VRAM_SIZE);

            if ((fgvideoram[controller] = new UBytePtr(TOAPLAN2_FG_VRAM_SIZE)) == null) {
                topvideoram[controller] = null;
                spriteram_now[controller] = null;
                spriteram_next[controller] = null;
                spriteram_new[controller] = null;
                return 1;
            }
            memset(fgvideoram[controller], 0, TOAPLAN2_FG_VRAM_SIZE);

            if ((bgvideoram[controller] = new UBytePtr(TOAPLAN2_BG_VRAM_SIZE)) == null) {
                fgvideoram[controller] = null;
                topvideoram[controller] = null;
                spriteram_now[controller] = null;
                spriteram_next[controller] = null;
                spriteram_new[controller] = null;
                return 1;
            }
            memset(bgvideoram[controller], 0, TOAPLAN2_BG_VRAM_SIZE);

            if (controller == 0) {
                error_level |= create_tilemaps_0();
            }
            if (controller == 1) {
                error_level |= create_tilemaps_1();
            }
            return error_level;
        }