static void vga_draw_text(VGAState *s, int full_update)

{

    int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr;

    int cx_min, cx_max, linesize, x_incr;

    uint32_t offset, fgcol, bgcol, v, cursor_offset;

    uint8_t *d1, *d, *src, *s1, *dest, *cursor_ptr;

    const uint8_t *font_ptr, *font_base[2];

    int dup9, line_offset, depth_index;

    uint32_t *palette;

    uint32_t *ch_attr_ptr;

    vga_draw_glyph8_func *vga_draw_glyph8;

    vga_draw_glyph9_func *vga_draw_glyph9;



    vga_dirty_log_stop(s);



    /* compute font data address (in plane 2) */

    v = s->sr[3];

    offset = (((v >> 4) & 1) | ((v << 1) & 6)) * 8192 * 4 + 2;

    if (offset != s->font_offsets[0]) {

        s->font_offsets[0] = offset;

        full_update = 1;

    }

    font_base[0] = s->vram_ptr + offset;



    offset = (((v >> 5) & 1) | ((v >> 1) & 6)) * 8192 * 4 + 2;

    font_base[1] = s->vram_ptr + offset;

    if (offset != s->font_offsets[1]) {

        s->font_offsets[1] = offset;

        full_update = 1;

    }

    if (s->plane_updated & (1 << 2)) {

        /* if the plane 2 was modified since the last display, it

           indicates the font may have been modified */

        s->plane_updated = 0;

        full_update = 1;

    }

    full_update |= update_basic_params(s);



    line_offset = s->line_offset;

    s1 = s->vram_ptr + (s->start_addr * 4);



    vga_get_text_resolution(s, &width, &height, &cw, &cheight);

    x_incr = cw * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);

    if ((height * width) > CH_ATTR_SIZE) {

        /* better than nothing: exit if transient size is too big */

        return;

    }



    if (width != s->last_width || height != s->last_height ||

        cw != s->last_cw || cheight != s->last_ch || s->last_depth) {

        s->last_scr_width = width * cw;

        s->last_scr_height = height * cheight;

        qemu_console_resize(s->ds, s->last_scr_width, s->last_scr_height);

        s->last_depth = 0;

        s->last_width = width;

        s->last_height = height;

        s->last_ch = cheight;

        s->last_cw = cw;

        full_update = 1;

    }

    s->rgb_to_pixel =

        rgb_to_pixel_dup_table[get_depth_index(s->ds)];

    full_update |= update_palette16(s);

    palette = s->last_palette;

    x_incr = cw * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);



    cursor_offset = ((s->cr[0x0e] << 8) | s->cr[0x0f]) - s->start_addr;

    if (cursor_offset != s->cursor_offset ||

        s->cr[0xa] != s->cursor_start ||

        s->cr[0xb] != s->cursor_end) {

      /* if the cursor position changed, we update the old and new

         chars */

        if (s->cursor_offset < CH_ATTR_SIZE)

            s->last_ch_attr[s->cursor_offset] = -1;

        if (cursor_offset < CH_ATTR_SIZE)

            s->last_ch_attr[cursor_offset] = -1;

        s->cursor_offset = cursor_offset;

        s->cursor_start = s->cr[0xa];

        s->cursor_end = s->cr[0xb];

    }

    cursor_ptr = s->vram_ptr + (s->start_addr + cursor_offset) * 4;



    depth_index = get_depth_index(s->ds);

    if (cw == 16)

        vga_draw_glyph8 = vga_draw_glyph16_table[depth_index];

    else

        vga_draw_glyph8 = vga_draw_glyph8_table[depth_index];

    vga_draw_glyph9 = vga_draw_glyph9_table[depth_index];



    dest = ds_get_data(s->ds);

    linesize = ds_get_linesize(s->ds);

    ch_attr_ptr = s->last_ch_attr;

    for(cy = 0; cy < height; cy++) {

        d1 = dest;

        src = s1;

        cx_min = width;

        cx_max = -1;

        for(cx = 0; cx < width; cx++) {

            ch_attr = *(uint16_t *)src;

            if (full_update || ch_attr != *ch_attr_ptr) {

                if (cx < cx_min)

                    cx_min = cx;

                if (cx > cx_max)

                    cx_max = cx;

                *ch_attr_ptr = ch_attr;

#ifdef WORDS_BIGENDIAN

                ch = ch_attr >> 8;

                cattr = ch_attr & 0xff;

#else

                ch = ch_attr & 0xff;

                cattr = ch_attr >> 8;

#endif

                font_ptr = font_base[(cattr >> 3) & 1];

                font_ptr += 32 * 4 * ch;

                bgcol = palette[cattr >> 4];

                fgcol = palette[cattr & 0x0f];

                if (cw != 9) {

                    vga_draw_glyph8(d1, linesize,

                                    font_ptr, cheight, fgcol, bgcol);

                } else {

                    dup9 = 0;

                    if (ch >= 0xb0 && ch <= 0xdf && (s->ar[0x10] & 0x04))

                        dup9 = 1;

                    vga_draw_glyph9(d1, linesize,

                                    font_ptr, cheight, fgcol, bgcol, dup9);

                }

                if (src == cursor_ptr &&

                    !(s->cr[0x0a] & 0x20)) {

                    int line_start, line_last, h;

                    /* draw the cursor */

                    line_start = s->cr[0x0a] & 0x1f;

                    line_last = s->cr[0x0b] & 0x1f;

                    /* XXX: check that */

                    if (line_last > cheight - 1)

                        line_last = cheight - 1;

                    if (line_last >= line_start && line_start < cheight) {

                        h = line_last - line_start + 1;

                        d = d1 + linesize * line_start;

                        if (cw != 9) {

                            vga_draw_glyph8(d, linesize,

                                            cursor_glyph, h, fgcol, bgcol);

                        } else {

                            vga_draw_glyph9(d, linesize,

                                            cursor_glyph, h, fgcol, bgcol, 1);

                        }

                    }

                }

            }

            d1 += x_incr;

            src += 4;

            ch_attr_ptr++;

        }

        if (cx_max != -1) {

            dpy_update(s->ds, cx_min * cw, cy * cheight,

                       (cx_max - cx_min + 1) * cw, cheight);

        }

        dest += linesize * cheight;

        s1 += line_offset;

    }

}

static void vga_draw_text(VGAState *s, int full_update)

{

    int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr;

    int cx_min, cx_max, linesize, x_incr;

    uint32_t offset, fgcol, bgcol, v, cursor_offset;

    uint8_t *d1, *d, *src, *s1, *dest, *cursor_ptr;

    const uint8_t *font_ptr, *font_base[2];

    int dup9, line_offset, depth_index;

    uint32_t *palette;

    uint32_t *ch_attr_ptr;

    vga_draw_glyph8_func *vga_draw_glyph8;

    vga_draw_glyph9_func *vga_draw_glyph9;



    vga_dirty_log_stop(s);



    

    v = s->sr[3];

    offset = (((v >> 4) & 1) | ((v << 1) & 6)) * 8192 * 4 + 2;

    if (offset != s->font_offsets[0]) {

        s->font_offsets[0] = offset;

        full_update = 1;

    }

    font_base[0] = s->vram_ptr + offset;



    offset = (((v >> 5) & 1) | ((v >> 1) & 6)) * 8192 * 4 + 2;

    font_base[1] = s->vram_ptr + offset;

    if (offset != s->font_offsets[1]) {

        s->font_offsets[1] = offset;

        full_update = 1;

    }

    if (s->plane_updated & (1 << 2)) {

        



        s->plane_updated = 0;

        full_update = 1;

    }

    full_update |= update_basic_params(s);



    line_offset = s->line_offset;

    s1 = s->vram_ptr + (s->start_addr * 4);



    vga_get_text_resolution(s, &width, &height, &cw, &cheight);

    x_incr = cw * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);

    if ((height * width) > CH_ATTR_SIZE) {

        

        return;

    }



    if (width != s->last_width || height != s->last_height ||

        cw != s->last_cw || cheight != s->last_ch || s->last_depth) {

        s->last_scr_width = width * cw;

        s->last_scr_height = height * cheight;

        qemu_console_resize(s->ds, s->last_scr_width, s->last_scr_height);

        s->last_depth = 0;

        s->last_width = width;

        s->last_height = height;

        s->last_ch = cheight;

        s->last_cw = cw;

        full_update = 1;

    }

    s->rgb_to_pixel =

        rgb_to_pixel_dup_table[get_depth_index(s->ds)];

    full_update |= update_palette16(s);

    palette = s->last_palette;

    x_incr = cw * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);



    cursor_offset = ((s->cr[0x0e] << 8) | s->cr[0x0f]) - s->start_addr;

    if (cursor_offset != s->cursor_offset ||

        s->cr[0xa] != s->cursor_start ||

        s->cr[0xb] != s->cursor_end) {

      



        if (s->cursor_offset < CH_ATTR_SIZE)

            s->last_ch_attr[s->cursor_offset] = -1;

        if (cursor_offset < CH_ATTR_SIZE)

            s->last_ch_attr[cursor_offset] = -1;

        s->cursor_offset = cursor_offset;

        s->cursor_start = s->cr[0xa];

        s->cursor_end = s->cr[0xb];

    }

    cursor_ptr = s->vram_ptr + (s->start_addr + cursor_offset) * 4;



    depth_index = get_depth_index(s->ds);

    if (cw == 16)

        vga_draw_glyph8 = vga_draw_glyph16_table[depth_index];

    else

        vga_draw_glyph8 = vga_draw_glyph8_table[depth_index];

    vga_draw_glyph9 = vga_draw_glyph9_table[depth_index];



    dest = ds_get_data(s->ds);

    linesize = ds_get_linesize(s->ds);

    ch_attr_ptr = s->last_ch_attr;

    for(cy = 0; cy < height; cy++) {

        d1 = dest;

        src = s1;

        cx_min = width;

        cx_max = -1;

        for(cx = 0; cx < width; cx++) {

            ch_attr = *(uint16_t *)src;

            if (full_update || ch_attr != *ch_attr_ptr) {

                if (cx < cx_min)

                    cx_min = cx;

                if (cx > cx_max)

                    cx_max = cx;

                *ch_attr_ptr = ch_attr;

#ifdef WORDS_BIGENDIAN

                ch = ch_attr >> 8;

                cattr = ch_attr & 0xff;

#else

                ch = ch_attr & 0xff;

                cattr = ch_attr >> 8;

#endif

                font_ptr = font_base[(cattr >> 3) & 1];

                font_ptr += 32 * 4 * ch;

                bgcol = palette[cattr >> 4];

                fgcol = palette[cattr & 0x0f];

                if (cw != 9) {

                    vga_draw_glyph8(d1, linesize,

                                    font_ptr, cheight, fgcol, bgcol);

                } else {

                    dup9 = 0;

                    if (ch >= 0xb0 && ch <= 0xdf && (s->ar[0x10] & 0x04))

                        dup9 = 1;

                    vga_draw_glyph9(d1, linesize,

                                    font_ptr, cheight, fgcol, bgcol, dup9);

                }

                if (src == cursor_ptr &&

                    !(s->cr[0x0a] & 0x20)) {

                    int line_start, line_last, h;

                    

                    line_start = s->cr[0x0a] & 0x1f;

                    line_last = s->cr[0x0b] & 0x1f;

                    

                    if (line_last > cheight - 1)

                        line_last = cheight - 1;

                    if (line_last >= line_start && line_start < cheight) {

                        h = line_last - line_start + 1;

                        d = d1 + linesize * line_start;

                        if (cw != 9) {

                            vga_draw_glyph8(d, linesize,

                                            cursor_glyph, h, fgcol, bgcol);

                        } else {

                            vga_draw_glyph9(d, linesize,

                                            cursor_glyph, h, fgcol, bgcol, 1);

                        }

                    }

                }

            }

            d1 += x_incr;

            src += 4;

            ch_attr_ptr++;

        }

        if (cx_max != -1) {

            dpy_update(s->ds, cx_min * cw, cy * cheight,

                       (cx_max - cx_min + 1) * cw, cheight);

        }

        dest += linesize * cheight;

        s1 += line_offset;

    }

}

    full_update |= update_basic_params(s);     if (width != s->last_width || height != s->last_height ||         cw != s->last_cw || cheight != s->last_ch || s->last_depth) {         s->last_scr_width = width * cw;         s->last_scr_height = height * cheight;         qemu_console_resize(s->ds, s->last_scr_width, s->last_scr_height);         s->last_depth = 0;         s->last_width = width;         s->last_height = height;         s->last_ch = cheight;         s->last_cw = cw;         full_update = 1;     full_update |= update_basic_params(s);         full_update = 1;         full_update = 1;         full_update = 1;         full_update = 1;
static void FUNC_0(VGAState *VAR_0, int VAR_1)

{

    int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;

    int VAR_11, VAR_12, VAR_13, VAR_14;

    uint32_t offset, fgcol, bgcol, v, cursor_offset;

    uint8_t *d1, *d, *src, *s1, *dest, *cursor_ptr;

    const uint8_t *VAR_15, *font_base[2];

    int VAR_16, VAR_17, VAR_18;

    uint32_t *palette;

    uint32_t *ch_attr_ptr;

    vga_draw_glyph8_func *vga_draw_glyph8;

    vga_draw_glyph9_func *vga_draw_glyph9;



    vga_dirty_log_stop(VAR_0);



    

    v = VAR_0->sr[3];

    offset = (((v >> 4) & 1) | ((v << 1) & 6)) * 8192 * 4 + 2;

    if (offset != VAR_0->font_offsets[0]) {

        VAR_0->font_offsets[0] = offset;

        VAR_1 = 1;

    }

    font_base[0] = VAR_0->vram_ptr + offset;



    offset = (((v >> 5) & 1) | ((v >> 1) & 6)) * 8192 * 4 + 2;

    font_base[1] = VAR_0->vram_ptr + offset;

    if (offset != VAR_0->font_offsets[1]) {

        VAR_0->font_offsets[1] = offset;

        VAR_1 = 1;

    }

    if (VAR_0->plane_updated & (1 << 2)) {

        



        VAR_0->plane_updated = 0;

        VAR_1 = 1;

    }

    VAR_1 |= update_basic_params(VAR_0);



    VAR_17 = VAR_0->VAR_17;

    s1 = VAR_0->vram_ptr + (VAR_0->start_addr * 4);



    vga_get_text_resolution(VAR_0, &VAR_9, &VAR_8, &VAR_5, &VAR_4);

    VAR_14 = VAR_5 * ((ds_get_bits_per_pixel(VAR_0->ds) + 7) >> 3);

    if ((VAR_8 * VAR_9) > CH_ATTR_SIZE) {

        

        return;

    }



    if (VAR_9 != VAR_0->last_width || VAR_8 != VAR_0->last_height ||

        VAR_5 != VAR_0->last_cw || VAR_4 != VAR_0->last_ch || VAR_0->last_depth) {

        VAR_0->last_scr_width = VAR_9 * VAR_5;

        VAR_0->last_scr_height = VAR_8 * VAR_4;

        qemu_console_resize(VAR_0->ds, VAR_0->last_scr_width, VAR_0->last_scr_height);

        VAR_0->last_depth = 0;

        VAR_0->last_width = VAR_9;

        VAR_0->last_height = VAR_8;

        VAR_0->last_ch = VAR_4;

        VAR_0->last_cw = VAR_5;

        VAR_1 = 1;

    }

    VAR_0->rgb_to_pixel =

        rgb_to_pixel_dup_table[get_depth_index(VAR_0->ds)];

    VAR_1 |= update_palette16(VAR_0);

    palette = VAR_0->last_palette;

    VAR_14 = VAR_5 * ((ds_get_bits_per_pixel(VAR_0->ds) + 7) >> 3);



    cursor_offset = ((VAR_0->cr[0x0e] << 8) | VAR_0->cr[0x0f]) - VAR_0->start_addr;

    if (cursor_offset != VAR_0->cursor_offset ||

        VAR_0->cr[0xa] != VAR_0->cursor_start ||

        VAR_0->cr[0xb] != VAR_0->cursor_end) {

      



        if (VAR_0->cursor_offset < CH_ATTR_SIZE)

            VAR_0->last_ch_attr[VAR_0->cursor_offset] = -1;

        if (cursor_offset < CH_ATTR_SIZE)

            VAR_0->last_ch_attr[cursor_offset] = -1;

        VAR_0->cursor_offset = cursor_offset;

        VAR_0->cursor_start = VAR_0->cr[0xa];

        VAR_0->cursor_end = VAR_0->cr[0xb];

    }

    cursor_ptr = VAR_0->vram_ptr + (VAR_0->start_addr + cursor_offset) * 4;



    VAR_18 = get_depth_index(VAR_0->ds);

    if (VAR_5 == 16)

        vga_draw_glyph8 = vga_draw_glyph16_table[VAR_18];

    else

        vga_draw_glyph8 = vga_draw_glyph8_table[VAR_18];

    vga_draw_glyph9 = vga_draw_glyph9_table[VAR_18];



    dest = ds_get_data(VAR_0->ds);

    VAR_13 = ds_get_linesize(VAR_0->ds);

    ch_attr_ptr = VAR_0->last_ch_attr;

    for(VAR_3 = 0; VAR_3 < VAR_8; VAR_3++) {

        d1 = dest;

        src = s1;

        VAR_11 = VAR_9;

        VAR_12 = -1;

        for(VAR_2 = 0; VAR_2 < VAR_9; VAR_2++) {

            VAR_10 = *(uint16_t *)src;

            if (VAR_1 || VAR_10 != *ch_attr_ptr) {

                if (VAR_2 < VAR_11)

                    VAR_11 = VAR_2;

                if (VAR_2 > VAR_12)

                    VAR_12 = VAR_2;

                *ch_attr_ptr = VAR_10;

#ifdef WORDS_BIGENDIAN

                VAR_6 = VAR_10 >> 8;

                VAR_7 = VAR_10 & 0xff;

#else

                VAR_6 = VAR_10 & 0xff;

                VAR_7 = VAR_10 >> 8;

#endif

                VAR_15 = font_base[(VAR_7 >> 3) & 1];

                VAR_15 += 32 * 4 * VAR_6;

                bgcol = palette[VAR_7 >> 4];

                fgcol = palette[VAR_7 & 0x0f];

                if (VAR_5 != 9) {

                    vga_draw_glyph8(d1, VAR_13,

                                    VAR_15, VAR_4, fgcol, bgcol);

                } else {

                    VAR_16 = 0;

                    if (VAR_6 >= 0xb0 && VAR_6 <= 0xdf && (VAR_0->ar[0x10] & 0x04))

                        VAR_16 = 1;

                    vga_draw_glyph9(d1, VAR_13,

                                    VAR_15, VAR_4, fgcol, bgcol, VAR_16);

                }

                if (src == cursor_ptr &&

                    !(VAR_0->cr[0x0a] & 0x20)) {

                    int VAR_19, VAR_20, VAR_21;

                    

                    VAR_19 = VAR_0->cr[0x0a] & 0x1f;

                    VAR_20 = VAR_0->cr[0x0b] & 0x1f;

                    

                    if (VAR_20 > VAR_4 - 1)

                        VAR_20 = VAR_4 - 1;

                    if (VAR_20 >= VAR_19 && VAR_19 < VAR_4) {

                        VAR_21 = VAR_20 - VAR_19 + 1;

                        d = d1 + VAR_13 * VAR_19;

                        if (VAR_5 != 9) {

                            vga_draw_glyph8(d, VAR_13,

                                            cursor_glyph, VAR_21, fgcol, bgcol);

                        } else {

                            vga_draw_glyph9(d, VAR_13,

                                            cursor_glyph, VAR_21, fgcol, bgcol, 1);

                        }

                    }

                }

            }

            d1 += VAR_14;

            src += 4;

            ch_attr_ptr++;

        }

        if (VAR_12 != -1) {

            dpy_update(VAR_0->ds, VAR_11 * VAR_5, VAR_3 * VAR_4,

                       (VAR_12 - VAR_11 + 1) * VAR_5, VAR_4);

        }

        dest += VAR_13 * VAR_4;

        s1 += VAR_17;

    }

}

static void FUNC_0(VGAState *VAR_0, int VAR_1)
{ int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; int VAR_11, VAR_12, VAR_13, VAR_14; uint32_t offset, fgcol, bgcol, v, cursor_offset; uint8_t *d1, *d, *src, *s1, *dest, *cursor_ptr; const uint8_t *VAR_15, *font_base[2]; int VAR_16, VAR_17, VAR_18; uint32_t *palette; uint32_t *ch_attr_ptr; vga_draw_glyph8_func *vga_draw_glyph8; vga_draw_glyph9_func *vga_draw_glyph9; vga_dirty_log_stop(VAR_0); v = VAR_0->sr[3]; offset = (((v >> 4) & 1) | ((v << 1) & 6)) * 8192 * 4 + 2; if (offset != VAR_0->font_offsets[0]) { VAR_0->font_offsets[0] = offset; VAR_1 = 1; } font_base[0] = VAR_0->vram_ptr + offset; offset = (((v >> 5) & 1) | ((v >> 1) & 6)) * 8192 * 4 + 2; font_base[1] = VAR_0->vram_ptr + offset; if (offset != VAR_0->font_offsets[1]) { VAR_0->font_offsets[1] = offset; VAR_1 = 1; } if (VAR_0->plane_updated & (1 << 2)) { VAR_0->plane_updated = 0; VAR_1 = 1; } VAR_1 |= update_basic_params(VAR_0); VAR_17 = VAR_0->VAR_17; s1 = VAR_0->vram_ptr + (VAR_0->start_addr * 4); vga_get_text_resolution(VAR_0, &VAR_9, &VAR_8, &VAR_5, &VAR_4); VAR_14 = VAR_5 * ((ds_get_bits_per_pixel(VAR_0->ds) + 7) >> 3); if ((VAR_8 * VAR_9) > CH_ATTR_SIZE) { return; } if (VAR_9 != VAR_0->last_width || VAR_8 != VAR_0->last_height ||
VAR_5 != VAR_0->last_cw || VAR_4 != VAR_0->last_ch || VAR_0->last_depth) { VAR_0->last_scr_width = VAR_9 * VAR_5; VAR_0->last_scr_height = VAR_8 * VAR_4; qemu_console_resize(VAR_0->ds, VAR_0->last_scr_width, VAR_0->last_scr_height); VAR_0->last_depth = 0; VAR_0->last_width = VAR_9; VAR_0->last_height = VAR_8; VAR_0->last_ch = VAR_4; VAR_0->last_cw = VAR_5; VAR_1 = 1; } VAR_0->rgb_to_pixel =
rgb_to_pixel_dup_table[get_depth_index(VAR_0->ds)]; VAR_1 |= update_palette16(VAR_0); palette = VAR_0->last_palette; VAR_14 = VAR_5 * ((ds_get_bits_per_pixel(VAR_0->ds) + 7) >> 3); cursor_offset = ((VAR_0->cr[0x0e] << 8) | VAR_0->cr[0x0f]) - VAR_0->start_addr; if (cursor_offset != VAR_0->cursor_offset ||
VAR_0->cr[0xa] != VAR_0->cursor_start ||
VAR_0->cr[0xb] != VAR_0->cursor_end) { if (VAR_0->cursor_offset < CH_ATTR_SIZE)
VAR_0->last_ch_attr[VAR_0->cursor_offset] = -1; if (cursor_offset < CH_ATTR_SIZE)
VAR_0->last_ch_attr[cursor_offset] = -1; VAR_0->cursor_offset = cursor_offset; VAR_0->cursor_start = VAR_0->cr[0xa]; VAR_0->cursor_end = VAR_0->cr[0xb]; } cursor_ptr = VAR_0->vram_ptr + (VAR_0->start_addr + cursor_offset) * 4; VAR_18 = get_depth_index(VAR_0->ds); if (VAR_5 == 16)
vga_draw_glyph8 = vga_draw_glyph16_table[VAR_18]; else
vga_draw_glyph8 = vga_draw_glyph8_table[VAR_18]; vga_draw_glyph9 = vga_draw_glyph9_table[VAR_18]; dest = ds_get_data(VAR_0->ds); VAR_13 = ds_get_linesize(VAR_0->ds); ch_attr_ptr = VAR_0->last_ch_attr; for(VAR_3 = 0; VAR_3 < VAR_8; VAR_3++) { d1 = dest; src = s1; VAR_11 = VAR_9; VAR_12 = -1; for(VAR_2 = 0; VAR_2 < VAR_9; VAR_2++) { VAR_10 = *(uint16_t *)src; if (VAR_1 || VAR_10 != *ch_attr_ptr) { if (VAR_2 < VAR_11)
VAR_11 = VAR_2; if (VAR_2 > VAR_12)
VAR_12 = VAR_2; *ch_attr_ptr = VAR_10; #ifdef WORDS_BIGENDIAN
VAR_6 = VAR_10 >> 8; VAR_7 = VAR_10 & 0xff; #else
VAR_6 = VAR_10 & 0xff; VAR_7 = VAR_10 >> 8; #endif
VAR_15 = font_base[(VAR_7 >> 3) & 1]; VAR_15 += 32 * 4 * VAR_6; bgcol = palette[VAR_7 >> 4]; fgcol = palette[VAR_7 & 0x0f]; if (VAR_5 != 9) { vga_draw_glyph8(d1, VAR_13,
VAR_15, VAR_4, fgcol, bgcol); } else { VAR_16 = 0; if (VAR_6 >= 0xb0 && VAR_6 <= 0xdf && (VAR_0->ar[0x10] & 0x04))
VAR_16 = 1; vga_draw_glyph9(d1, VAR_13,
VAR_15, VAR_4, fgcol, bgcol, VAR_16); } if (src == cursor_ptr &&
!(VAR_0->cr[0x0a] & 0x20)) { int VAR_19, VAR_20, VAR_21; VAR_19 = VAR_0->cr[0x0a] & 0x1f; VAR_20 = VAR_0->cr[0x0b] & 0x1f; if (VAR_20 > VAR_4 - 1)
VAR_20 = VAR_4 - 1; if (VAR_20 >= VAR_19 && VAR_19 < VAR_4) { VAR_21 = VAR_20 - VAR_19 + 1; d = d1 + VAR_13 * VAR_19; if (VAR_5 != 9) { vga_draw_glyph8(d, VAR_13,
cursor_glyph, VAR_21, fgcol, bgcol); } else { vga_draw_glyph9(d, VAR_13,
cursor_glyph, VAR_21, fgcol, bgcol, 1); } } } } d1 += VAR_14; src += 4; ch_attr_ptr++; } if (VAR_12 != -1) { dpy_update(VAR_0->ds, VAR_11 * VAR_5, VAR_3 * VAR_4,
(VAR_12 - VAR_11 + 1) * VAR_5, VAR_4); } dest += VAR_13 * VAR_4; s1 += VAR_17; } }