static void vga_get_text_resolution(VGACommonState *s, int *pwidth, int *pheight,

                                    int *pcwidth, int *pcheight)

{

    int width, cwidth, height, cheight;



    /* total width & height */

    cheight = (s->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1;

    cwidth = 8;

    if (!(s->sr[VGA_SEQ_CLOCK_MODE] & VGA_SR01_CHAR_CLK_8DOTS)) {

        cwidth = 9;

    }

    if (s->sr[VGA_SEQ_CLOCK_MODE] & 0x08) {

        cwidth = 16; /* NOTE: no 18 pixel wide */

    }

    width = (s->cr[VGA_CRTC_H_DISP] + 1);

    if (s->cr[VGA_CRTC_V_TOTAL] == 100) {

        /* ugly hack for CGA 160x100x16 - explain me the logic */

        height = 100;

    } else {

        height = s->cr[VGA_CRTC_V_DISP_END] |

            ((s->cr[VGA_CRTC_OVERFLOW] & 0x02) << 7) |

            ((s->cr[VGA_CRTC_OVERFLOW] & 0x40) << 3);

        height = (height + 1) / cheight;

    }



    *pwidth = width;

    *pheight = height;

    *pcwidth = cwidth;

    *pcheight = cheight;

}

static void vga_get_text_resolution(VGACommonState *s, int *pwidth, int *pheight,

                                    int *pcwidth, int *pcheight)

{

    int width, cwidth, height, cheight;



    

    cheight = (s->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1;

    cwidth = 8;

    if (!(s->sr[VGA_SEQ_CLOCK_MODE] & VGA_SR01_CHAR_CLK_8DOTS)) {

        cwidth = 9;

    }

    if (s->sr[VGA_SEQ_CLOCK_MODE] & 0x08) {

        cwidth = 16; 

    }

    width = (s->cr[VGA_CRTC_H_DISP] + 1);

    if (s->cr[VGA_CRTC_V_TOTAL] == 100) {

        

        height = 100;

    } else {

        height = s->cr[VGA_CRTC_V_DISP_END] |

            ((s->cr[VGA_CRTC_OVERFLOW] & 0x02) << 7) |

            ((s->cr[VGA_CRTC_OVERFLOW] & 0x40) << 3);

        height = (height + 1) / cheight;

    }



    *pwidth = width;

    *pheight = height;

    *pcwidth = cwidth;

    *pcheight = cheight;

}

    if (!(s->sr[VGA_SEQ_CLOCK_MODE] & VGA_SR01_CHAR_CLK_8DOTS)) {     if (s->sr[VGA_SEQ_CLOCK_MODE] & 0x08) {
static void FUNC_0(VGACommonState *VAR_0, int *VAR_1, int *VAR_2,

                                    int *VAR_3, int *VAR_4)

{

    int VAR_5, VAR_6, VAR_7, VAR_8;



    

    VAR_8 = (VAR_0->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1;

    VAR_6 = 8;

    if (!(VAR_0->sr[VGA_SEQ_CLOCK_MODE] & VGA_SR01_CHAR_CLK_8DOTS)) {

        VAR_6 = 9;

    }

    if (VAR_0->sr[VGA_SEQ_CLOCK_MODE] & 0x08) {

        VAR_6 = 16; 

    }

    VAR_5 = (VAR_0->cr[VGA_CRTC_H_DISP] + 1);

    if (VAR_0->cr[VGA_CRTC_V_TOTAL] == 100) {

        

        VAR_7 = 100;

    } else {

        VAR_7 = VAR_0->cr[VGA_CRTC_V_DISP_END] |

            ((VAR_0->cr[VGA_CRTC_OVERFLOW] & 0x02) << 7) |

            ((VAR_0->cr[VGA_CRTC_OVERFLOW] & 0x40) << 3);

        VAR_7 = (VAR_7 + 1) / VAR_8;

    }



    *VAR_1 = VAR_5;

    *VAR_2 = VAR_7;

    *VAR_3 = VAR_6;

    *VAR_4 = VAR_8;

}

static void FUNC_0(VGACommonState *VAR_0, int *VAR_1, int *VAR_2,
int *VAR_3, int *VAR_4)
{ int VAR_5, VAR_6, VAR_7, VAR_8; VAR_8 = (VAR_0->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1; VAR_6 = 8; if (!(VAR_0->sr[VGA_SEQ_CLOCK_MODE] & VGA_SR01_CHAR_CLK_8DOTS)) { VAR_6 = 9; } if (VAR_0->sr[VGA_SEQ_CLOCK_MODE] & 0x08) { VAR_6 = 16; } VAR_5 = (VAR_0->cr[VGA_CRTC_H_DISP] + 1); if (VAR_0->cr[VGA_CRTC_V_TOTAL] == 100) { VAR_7 = 100; } else { VAR_7 = VAR_0->cr[VGA_CRTC_V_DISP_END] |
((VAR_0->cr[VGA_CRTC_OVERFLOW] & 0x02) << 7) |
((VAR_0->cr[VGA_CRTC_OVERFLOW] & 0x40) << 3); VAR_7 = (VAR_7 + 1) / VAR_8; } *VAR_1 = VAR_5; *VAR_2 = VAR_7; *VAR_3 = VAR_6; *VAR_4 = VAR_8; }