static void vga_putcharxy(DisplayState *ds, int x, int y, int ch,

                          TextAttributes *t_attrib)

{

    uint8_t *d;

    const uint8_t *font_ptr;

    unsigned int font_data, linesize, xorcol, bpp;

    int i;

    unsigned int fgcol, bgcol;



#ifdef DEBUG_CONSOLE

    printf("x: %2i y: %2i", x, y);

    console_print_text_attributes(t_attrib, ch);

#endif



    if (t_attrib->invers) {

        bgcol = color_table[t_attrib->bold][t_attrib->fgcol];

        fgcol = color_table[t_attrib->bold][t_attrib->bgcol];

    } else {

        fgcol = color_table[t_attrib->bold][t_attrib->fgcol];

        bgcol = color_table[t_attrib->bold][t_attrib->bgcol];

    }



    bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;

    d = ds_get_data(ds) +

        ds_get_linesize(ds) * y * FONT_HEIGHT + bpp * x * FONT_WIDTH;

    linesize = ds_get_linesize(ds);

    font_ptr = vgafont16 + FONT_HEIGHT * ch;

    xorcol = bgcol ^ fgcol;

    switch(ds_get_bits_per_pixel(ds)) {

    case 8:

        for(i = 0; i < FONT_HEIGHT; i++) {

            font_data = *font_ptr++;

            if (t_attrib->uline

                && ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) {

                font_data = 0xFFFF;

            }

            ((uint32_t *)d)[0] = (dmask16[(font_data >> 4)] & xorcol) ^ bgcol;

            ((uint32_t *)d)[1] = (dmask16[(font_data >> 0) & 0xf] & xorcol) ^ bgcol;

            d += linesize;

        }

        break;

    case 16:

    case 15:

        for(i = 0; i < FONT_HEIGHT; i++) {

            font_data = *font_ptr++;

            if (t_attrib->uline

                && ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) {

                font_data = 0xFFFF;

            }

            ((uint32_t *)d)[0] = (dmask4[(font_data >> 6)] & xorcol) ^ bgcol;

            ((uint32_t *)d)[1] = (dmask4[(font_data >> 4) & 3] & xorcol) ^ bgcol;

            ((uint32_t *)d)[2] = (dmask4[(font_data >> 2) & 3] & xorcol) ^ bgcol;

            ((uint32_t *)d)[3] = (dmask4[(font_data >> 0) & 3] & xorcol) ^ bgcol;

            d += linesize;

        }

        break;

    case 32:

        for(i = 0; i < FONT_HEIGHT; i++) {

            font_data = *font_ptr++;

            if (t_attrib->uline && ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) {

                font_data = 0xFFFF;

            }

            ((uint32_t *)d)[0] = (-((font_data >> 7)) & xorcol) ^ bgcol;

            ((uint32_t *)d)[1] = (-((font_data >> 6) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[2] = (-((font_data >> 5) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[3] = (-((font_data >> 4) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[4] = (-((font_data >> 3) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[5] = (-((font_data >> 2) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[6] = (-((font_data >> 1) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[7] = (-((font_data >> 0) & 1) & xorcol) ^ bgcol;

            d += linesize;

        }

        break;

    }

}

static void vga_putcharxy(DisplayState *ds, int x, int y, int ch,

                          TextAttributes *t_attrib)

{

    uint8_t *d;

    const uint8_t *font_ptr;

    unsigned int font_data, linesize, xorcol, bpp;

    int i;

    unsigned int fgcol, bgcol;



#ifdef DEBUG_CONSOLE

    printf("x: %2i y: %2i", x, y);

    console_print_text_attributes(t_attrib, ch);

#endif



    if (t_attrib->invers) {

        bgcol = color_table[t_attrib->bold][t_attrib->fgcol];

        fgcol = color_table[t_attrib->bold][t_attrib->bgcol];

    } else {

        fgcol = color_table[t_attrib->bold][t_attrib->fgcol];

        bgcol = color_table[t_attrib->bold][t_attrib->bgcol];

    }



    bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;

    d = ds_get_data(ds) +

        ds_get_linesize(ds) * y * FONT_HEIGHT + bpp * x * FONT_WIDTH;

    linesize = ds_get_linesize(ds);

    font_ptr = vgafont16 + FONT_HEIGHT * ch;

    xorcol = bgcol ^ fgcol;

    switch(ds_get_bits_per_pixel(ds)) {

    case 8:

        for(i = 0; i < FONT_HEIGHT; i++) {

            font_data = *font_ptr++;

            if (t_attrib->uline

                && ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) {

                font_data = 0xFFFF;

            }

            ((uint32_t *)d)[0] = (dmask16[(font_data >> 4)] & xorcol) ^ bgcol;

            ((uint32_t *)d)[1] = (dmask16[(font_data >> 0) & 0xf] & xorcol) ^ bgcol;

            d += linesize;

        }

        break;

    case 16:

    case 15:

        for(i = 0; i < FONT_HEIGHT; i++) {

            font_data = *font_ptr++;

            if (t_attrib->uline

                && ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) {

                font_data = 0xFFFF;

            }

            ((uint32_t *)d)[0] = (dmask4[(font_data >> 6)] & xorcol) ^ bgcol;

            ((uint32_t *)d)[1] = (dmask4[(font_data >> 4) & 3] & xorcol) ^ bgcol;

            ((uint32_t *)d)[2] = (dmask4[(font_data >> 2) & 3] & xorcol) ^ bgcol;

            ((uint32_t *)d)[3] = (dmask4[(font_data >> 0) & 3] & xorcol) ^ bgcol;

            d += linesize;

        }

        break;

    case 32:

        for(i = 0; i < FONT_HEIGHT; i++) {

            font_data = *font_ptr++;

            if (t_attrib->uline && ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) {

                font_data = 0xFFFF;

            }

            ((uint32_t *)d)[0] = (-((font_data >> 7)) & xorcol) ^ bgcol;

            ((uint32_t *)d)[1] = (-((font_data >> 6) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[2] = (-((font_data >> 5) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[3] = (-((font_data >> 4) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[4] = (-((font_data >> 3) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[5] = (-((font_data >> 2) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[6] = (-((font_data >> 1) & 1) & xorcol) ^ bgcol;

            ((uint32_t *)d)[7] = (-((font_data >> 0) & 1) & xorcol) ^ bgcol;

            d += linesize;

        }

        break;

    }

}

                font_data = 0xFFFF;                 font_data = 0xFFFF;                 font_data = 0xFFFF;
static void FUNC_0(DisplayState *VAR_0, int VAR_1, int VAR_2, int VAR_3,

                          TextAttributes *VAR_4)

{

    uint8_t *d;

    const uint8_t *VAR_5;

    unsigned int VAR_6, VAR_7, VAR_8, VAR_9;

    int VAR_10;

    unsigned int VAR_11, VAR_12;



#ifdef DEBUG_CONSOLE

    printf("VAR_1: %2i VAR_2: %2i", VAR_1, VAR_2);

    console_print_text_attributes(VAR_4, VAR_3);

#endif



    if (VAR_4->invers) {

        VAR_12 = color_table[VAR_4->bold][VAR_4->VAR_11];

        VAR_11 = color_table[VAR_4->bold][VAR_4->VAR_12];

    } else {

        VAR_11 = color_table[VAR_4->bold][VAR_4->VAR_11];

        VAR_12 = color_table[VAR_4->bold][VAR_4->VAR_12];

    }



    VAR_9 = (ds_get_bits_per_pixel(VAR_0) + 7) >> 3;

    d = ds_get_data(VAR_0) +

        ds_get_linesize(VAR_0) * VAR_2 * FONT_HEIGHT + VAR_9 * VAR_1 * FONT_WIDTH;

    VAR_7 = ds_get_linesize(VAR_0);

    VAR_5 = vgafont16 + FONT_HEIGHT * VAR_3;

    VAR_8 = VAR_12 ^ VAR_11;

    switch(ds_get_bits_per_pixel(VAR_0)) {

    case 8:

        for(VAR_10 = 0; VAR_10 < FONT_HEIGHT; VAR_10++) {

            VAR_6 = *VAR_5++;

            if (VAR_4->uline

                && ((VAR_10 == FONT_HEIGHT - 2) || (VAR_10 == FONT_HEIGHT - 3))) {

                VAR_6 = 0xFFFF;

            }

            ((uint32_t *)d)[0] = (dmask16[(VAR_6 >> 4)] & VAR_8) ^ VAR_12;

            ((uint32_t *)d)[1] = (dmask16[(VAR_6 >> 0) & 0xf] & VAR_8) ^ VAR_12;

            d += VAR_7;

        }

        break;

    case 16:

    case 15:

        for(VAR_10 = 0; VAR_10 < FONT_HEIGHT; VAR_10++) {

            VAR_6 = *VAR_5++;

            if (VAR_4->uline

                && ((VAR_10 == FONT_HEIGHT - 2) || (VAR_10 == FONT_HEIGHT - 3))) {

                VAR_6 = 0xFFFF;

            }

            ((uint32_t *)d)[0] = (dmask4[(VAR_6 >> 6)] & VAR_8) ^ VAR_12;

            ((uint32_t *)d)[1] = (dmask4[(VAR_6 >> 4) & 3] & VAR_8) ^ VAR_12;

            ((uint32_t *)d)[2] = (dmask4[(VAR_6 >> 2) & 3] & VAR_8) ^ VAR_12;

            ((uint32_t *)d)[3] = (dmask4[(VAR_6 >> 0) & 3] & VAR_8) ^ VAR_12;

            d += VAR_7;

        }

        break;

    case 32:

        for(VAR_10 = 0; VAR_10 < FONT_HEIGHT; VAR_10++) {

            VAR_6 = *VAR_5++;

            if (VAR_4->uline && ((VAR_10 == FONT_HEIGHT - 2) || (VAR_10 == FONT_HEIGHT - 3))) {

                VAR_6 = 0xFFFF;

            }

            ((uint32_t *)d)[0] = (-((VAR_6 >> 7)) & VAR_8) ^ VAR_12;

            ((uint32_t *)d)[1] = (-((VAR_6 >> 6) & 1) & VAR_8) ^ VAR_12;

            ((uint32_t *)d)[2] = (-((VAR_6 >> 5) & 1) & VAR_8) ^ VAR_12;

            ((uint32_t *)d)[3] = (-((VAR_6 >> 4) & 1) & VAR_8) ^ VAR_12;

            ((uint32_t *)d)[4] = (-((VAR_6 >> 3) & 1) & VAR_8) ^ VAR_12;

            ((uint32_t *)d)[5] = (-((VAR_6 >> 2) & 1) & VAR_8) ^ VAR_12;

            ((uint32_t *)d)[6] = (-((VAR_6 >> 1) & 1) & VAR_8) ^ VAR_12;

            ((uint32_t *)d)[7] = (-((VAR_6 >> 0) & 1) & VAR_8) ^ VAR_12;

            d += VAR_7;

        }

        break;

    }

}

static void FUNC_0(DisplayState *VAR_0, int VAR_1, int VAR_2, int VAR_3,
TextAttributes *VAR_4)
{ uint8_t *d; const uint8_t *VAR_5; unsigned int VAR_6, VAR_7, VAR_8, VAR_9; int VAR_10; unsigned int VAR_11, VAR_12; #ifdef DEBUG_CONSOLE
printf("VAR_1: %2i VAR_2: %2i", VAR_1, VAR_2); console_print_text_attributes(VAR_4, VAR_3); #endif
if (VAR_4->invers) { VAR_12 = color_table[VAR_4->bold][VAR_4->VAR_11]; VAR_11 = color_table[VAR_4->bold][VAR_4->VAR_12]; } else { VAR_11 = color_table[VAR_4->bold][VAR_4->VAR_11]; VAR_12 = color_table[VAR_4->bold][VAR_4->VAR_12]; } VAR_9 = (ds_get_bits_per_pixel(VAR_0) + 7) >> 3; d = ds_get_data(VAR_0) +
ds_get_linesize(VAR_0) * VAR_2 * FONT_HEIGHT + VAR_9 * VAR_1 * FONT_WIDTH; VAR_7 = ds_get_linesize(VAR_0); VAR_5 = vgafont16 + FONT_HEIGHT * VAR_3; VAR_8 = VAR_12 ^ VAR_11; switch(ds_get_bits_per_pixel(VAR_0)) { case 8:
for(VAR_10 = 0; VAR_10 < FONT_HEIGHT; VAR_10++) { VAR_6 = *VAR_5++; if (VAR_4->uline
&& ((VAR_10 == FONT_HEIGHT - 2) || (VAR_10 == FONT_HEIGHT - 3))) { VAR_6 = 0xFFFF; } ((uint32_t *)d)[0] = (dmask16[(VAR_6 >> 4)] & VAR_8) ^ VAR_12; ((uint32_t *)d)[1] = (dmask16[(VAR_6 >> 0) & 0xf] & VAR_8) ^ VAR_12; d += VAR_7; } break; case 16:
case 15:
for(VAR_10 = 0; VAR_10 < FONT_HEIGHT; VAR_10++) { VAR_6 = *VAR_5++; if (VAR_4->uline
&& ((VAR_10 == FONT_HEIGHT - 2) || (VAR_10 == FONT_HEIGHT - 3))) { VAR_6 = 0xFFFF; } ((uint32_t *)d)[0] = (dmask4[(VAR_6 >> 6)] & VAR_8) ^ VAR_12; ((uint32_t *)d)[1] = (dmask4[(VAR_6 >> 4) & 3] & VAR_8) ^ VAR_12; ((uint32_t *)d)[2] = (dmask4[(VAR_6 >> 2) & 3] & VAR_8) ^ VAR_12; ((uint32_t *)d)[3] = (dmask4[(VAR_6 >> 0) & 3] & VAR_8) ^ VAR_12; d += VAR_7; } break; case 32:
for(VAR_10 = 0; VAR_10 < FONT_HEIGHT; VAR_10++) { VAR_6 = *VAR_5++; if (VAR_4->uline && ((VAR_10 == FONT_HEIGHT - 2) || (VAR_10 == FONT_HEIGHT - 3))) { VAR_6 = 0xFFFF; } ((uint32_t *)d)[0] = (-((VAR_6 >> 7)) & VAR_8) ^ VAR_12; ((uint32_t *)d)[1] = (-((VAR_6 >> 6) & 1) & VAR_8) ^ VAR_12; ((uint32_t *)d)[2] = (-((VAR_6 >> 5) & 1) & VAR_8) ^ VAR_12; ((uint32_t *)d)[3] = (-((VAR_6 >> 4) & 1) & VAR_8) ^ VAR_12; ((uint32_t *)d)[4] = (-((VAR_6 >> 3) & 1) & VAR_8) ^ VAR_12; ((uint32_t *)d)[5] = (-((VAR_6 >> 2) & 1) & VAR_8) ^ VAR_12; ((uint32_t *)d)[6] = (-((VAR_6 >> 1) & 1) & VAR_8) ^ VAR_12; ((uint32_t *)d)[7] = (-((VAR_6 >> 0) & 1) & VAR_8) ^ VAR_12; d += VAR_7; } break; } }