static void vga_precise_update_retrace_info(VGAState *s)

{

    int htotal_chars;

    int hretr_start_char;

    int hretr_skew_chars;

    int hretr_end_char;



    int vtotal_lines;

    int vretr_start_line;

    int vretr_end_line;



    int div2, sldiv2, dots;

    int clocking_mode;

    int clock_sel;

    const int hz[] = {25175000, 28322000, 25175000, 25175000};

    int64_t chars_per_sec;

    struct vga_precise_retrace *r = &s->retrace_info.precise;



    htotal_chars = s->cr[0x00] + 5;

    hretr_start_char = s->cr[0x04];

    hretr_skew_chars = (s->cr[0x05] >> 5) & 3;

    hretr_end_char = s->cr[0x05] & 0x1f;



    vtotal_lines = (s->cr[0x06]

                    | (((s->cr[0x07] & 1) | ((s->cr[0x07] >> 4) & 2)) << 8)) + 2

        ;

    vretr_start_line = s->cr[0x10]

        | ((((s->cr[0x07] >> 2) & 1) | ((s->cr[0x07] >> 6) & 2)) << 8)

        ;

    vretr_end_line = s->cr[0x11] & 0xf;





    div2 = (s->cr[0x17] >> 2) & 1;

    sldiv2 = (s->cr[0x17] >> 3) & 1;



    clocking_mode = (s->sr[0x01] >> 3) & 1;

    clock_sel = (s->msr >> 2) & 3;

    dots = (s->msr & 1) ? 8 : 9;



    chars_per_sec = hz[clock_sel] / dots;



    htotal_chars <<= clocking_mode;



    r->total_chars = vtotal_lines * htotal_chars;

    if (r->freq) {

        r->ticks_per_char = ticks_per_sec / (r->total_chars * r->freq);

    } else {

        r->ticks_per_char = ticks_per_sec / chars_per_sec;

    }



    r->vstart = vretr_start_line;

    r->vend = r->vstart + vretr_end_line + 1;



    r->hstart = hretr_start_char + hretr_skew_chars;

    r->hend = r->hstart + hretr_end_char + 1;

    r->htotal = htotal_chars;



#if 0

    printf (

        "hz=%f\n"

        "htotal = %d\n"

        "hretr_start = %d\n"

        "hretr_skew = %d\n"

        "hretr_end = %d\n"

        "vtotal = %d\n"

        "vretr_start = %d\n"

        "vretr_end = %d\n"

        "div2 = %d sldiv2 = %d\n"

        "clocking_mode = %d\n"

        "clock_sel = %d %d\n"

        "dots = %d\n"

        "ticks/char = %lld\n"

        "\n",

        (double) ticks_per_sec / (r->ticks_per_char * r->total_chars),

        htotal_chars,

        hretr_start_char,

        hretr_skew_chars,

        hretr_end_char,

        vtotal_lines,

        vretr_start_line,

        vretr_end_line,

        div2, sldiv2,

        clocking_mode,

        clock_sel,

        hz[clock_sel],

        dots,

        r->ticks_per_char

        );

#endif

}

static void vga_precise_update_retrace_info(VGAState *s)

{

    int htotal_chars;

    int hretr_start_char;

    int hretr_skew_chars;

    int hretr_end_char;



    int vtotal_lines;

    int vretr_start_line;

    int vretr_end_line;



    int div2, sldiv2, dots;

    int clocking_mode;

    int clock_sel;

    const int hz[] = {25175000, 28322000, 25175000, 25175000};

    int64_t chars_per_sec;

    struct vga_precise_retrace *r = &s->retrace_info.precise;



    htotal_chars = s->cr[0x00] + 5;

    hretr_start_char = s->cr[0x04];

    hretr_skew_chars = (s->cr[0x05] >> 5) & 3;

    hretr_end_char = s->cr[0x05] & 0x1f;



    vtotal_lines = (s->cr[0x06]

                    | (((s->cr[0x07] & 1) | ((s->cr[0x07] >> 4) & 2)) << 8)) + 2

        ;

    vretr_start_line = s->cr[0x10]

        | ((((s->cr[0x07] >> 2) & 1) | ((s->cr[0x07] >> 6) & 2)) << 8)

        ;

    vretr_end_line = s->cr[0x11] & 0xf;





    div2 = (s->cr[0x17] >> 2) & 1;

    sldiv2 = (s->cr[0x17] >> 3) & 1;



    clocking_mode = (s->sr[0x01] >> 3) & 1;

    clock_sel = (s->msr >> 2) & 3;

    dots = (s->msr & 1) ? 8 : 9;



    chars_per_sec = hz[clock_sel] / dots;



    htotal_chars <<= clocking_mode;



    r->total_chars = vtotal_lines * htotal_chars;

    if (r->freq) {

        r->ticks_per_char = ticks_per_sec / (r->total_chars * r->freq);

    } else {

        r->ticks_per_char = ticks_per_sec / chars_per_sec;

    }



    r->vstart = vretr_start_line;

    r->vend = r->vstart + vretr_end_line + 1;



    r->hstart = hretr_start_char + hretr_skew_chars;

    r->hend = r->hstart + hretr_end_char + 1;

    r->htotal = htotal_chars;



#if 0

    printf (

        "hz=%f\n"

        "htotal = %d\n"

        "hretr_start = %d\n"

        "hretr_skew = %d\n"

        "hretr_end = %d\n"

        "vtotal = %d\n"

        "vretr_start = %d\n"

        "vretr_end = %d\n"

        "div2 = %d sldiv2 = %d\n"

        "clocking_mode = %d\n"

        "clock_sel = %d %d\n"

        "dots = %d\n"

        "ticks/char = %lld\n"

        "\n",

        (double) ticks_per_sec / (r->ticks_per_char * r->total_chars),

        htotal_chars,

        hretr_start_char,

        hretr_skew_chars,

        hretr_end_char,

        vtotal_lines,

        vretr_start_line,

        vretr_end_line,

        div2, sldiv2,

        clocking_mode,

        clock_sel,

        hz[clock_sel],

        dots,

        r->ticks_per_char

        );

#endif

}

    const int hz[] = {25175000, 28322000, 25175000, 25175000};     chars_per_sec = hz[clock_sel] / dots;         hz[clock_sel],
static void FUNC_0(VGAState *VAR_0)

{

    int VAR_1;

    int VAR_2;

    int VAR_3;

    int VAR_4;



    int VAR_5;

    int VAR_6;

    int VAR_7;



    int VAR_8, VAR_9, VAR_10;

    int VAR_11;

    int VAR_12;

    const int VAR_13[] = {25175000, 28322000, 25175000, 25175000};

    int64_t chars_per_sec;

    struct vga_precise_retrace *VAR_14 = &VAR_0->retrace_info.precise;



    VAR_1 = VAR_0->cr[0x00] + 5;

    VAR_2 = VAR_0->cr[0x04];

    VAR_3 = (VAR_0->cr[0x05] >> 5) & 3;

    VAR_4 = VAR_0->cr[0x05] & 0x1f;



    VAR_5 = (VAR_0->cr[0x06]

                    | (((VAR_0->cr[0x07] & 1) | ((VAR_0->cr[0x07] >> 4) & 2)) << 8)) + 2

        ;

    VAR_6 = VAR_0->cr[0x10]

        | ((((VAR_0->cr[0x07] >> 2) & 1) | ((VAR_0->cr[0x07] >> 6) & 2)) << 8)

        ;

    VAR_7 = VAR_0->cr[0x11] & 0xf;





    VAR_8 = (VAR_0->cr[0x17] >> 2) & 1;

    VAR_9 = (VAR_0->cr[0x17] >> 3) & 1;



    VAR_11 = (VAR_0->sr[0x01] >> 3) & 1;

    VAR_12 = (VAR_0->msr >> 2) & 3;

    VAR_10 = (VAR_0->msr & 1) ? 8 : 9;



    chars_per_sec = VAR_13[VAR_12] / VAR_10;



    VAR_1 <<= VAR_11;



    VAR_14->total_chars = VAR_5 * VAR_1;

    if (VAR_14->freq) {

        VAR_14->ticks_per_char = ticks_per_sec / (VAR_14->total_chars * VAR_14->freq);

    } else {

        VAR_14->ticks_per_char = ticks_per_sec / chars_per_sec;

    }



    VAR_14->vstart = VAR_6;

    VAR_14->vend = VAR_14->vstart + VAR_7 + 1;



    VAR_14->hstart = VAR_2 + VAR_3;

    VAR_14->hend = VAR_14->hstart + VAR_4 + 1;

    VAR_14->htotal = VAR_1;



#if 0

    printf (

        "VAR_13=%f\n"

        "htotal = %d\n"

        "hretr_start = %d\n"

        "hretr_skew = %d\n"

        "hretr_end = %d\n"

        "vtotal = %d\n"

        "vretr_start = %d\n"

        "vretr_end = %d\n"

        "VAR_8 = %d VAR_9 = %d\n"

        "VAR_11 = %d\n"

        "VAR_12 = %d %d\n"

        "VAR_10 = %d\n"

        "ticks/char = %lld\n"

        "\n",

        (double) ticks_per_sec / (VAR_14->ticks_per_char * VAR_14->total_chars),

        VAR_1,

        VAR_2,

        VAR_3,

        VAR_4,

        VAR_5,

        VAR_6,

        VAR_7,

        VAR_8, VAR_9,

        VAR_11,

        VAR_12,

        VAR_13[VAR_12],

        VAR_10,

        VAR_14->ticks_per_char

        );

#endif

}

static void FUNC_0(VGAState *VAR_0)
{ int VAR_1; int VAR_2; int VAR_3; int VAR_4; int VAR_5; int VAR_6; int VAR_7; int VAR_8, VAR_9, VAR_10; int VAR_11; int VAR_12; const int VAR_13[] = {25175000, 28322000, 25175000, 25175000}; int64_t chars_per_sec; struct vga_precise_retrace *VAR_14 = &VAR_0->retrace_info.precise; VAR_1 = VAR_0->cr[0x00] + 5; VAR_2 = VAR_0->cr[0x04]; VAR_3 = (VAR_0->cr[0x05] >> 5) & 3; VAR_4 = VAR_0->cr[0x05] & 0x1f; VAR_5 = (VAR_0->cr[0x06]
| (((VAR_0->cr[0x07] & 1) | ((VAR_0->cr[0x07] >> 4) & 2)) << 8)) + 2
; VAR_6 = VAR_0->cr[0x10]
| ((((VAR_0->cr[0x07] >> 2) & 1) | ((VAR_0->cr[0x07] >> 6) & 2)) << 8)
; VAR_7 = VAR_0->cr[0x11] & 0xf; VAR_8 = (VAR_0->cr[0x17] >> 2) & 1; VAR_9 = (VAR_0->cr[0x17] >> 3) & 1; VAR_11 = (VAR_0->sr[0x01] >> 3) & 1; VAR_12 = (VAR_0->msr >> 2) & 3; VAR_10 = (VAR_0->msr & 1) ? 8 : 9; chars_per_sec = VAR_13[VAR_12] / VAR_10; VAR_1 <<= VAR_11; VAR_14->total_chars = VAR_5 * VAR_1; if (VAR_14->freq) { VAR_14->ticks_per_char = ticks_per_sec / (VAR_14->total_chars * VAR_14->freq); } else { VAR_14->ticks_per_char = ticks_per_sec / chars_per_sec; } VAR_14->vstart = VAR_6; VAR_14->vend = VAR_14->vstart + VAR_7 + 1; VAR_14->hstart = VAR_2 + VAR_3; VAR_14->hend = VAR_14->hstart + VAR_4 + 1; VAR_14->htotal = VAR_1; #if 0
printf (
"VAR_13=%f\n"
"htotal = %d\n"
"hretr_start = %d\n"
"hretr_skew = %d\n"
"hretr_end = %d\n"
"vtotal = %d\n"
"vretr_start = %d\n"
"vretr_end = %d\n"
"VAR_8 = %d VAR_9 = %d\n"
"VAR_11 = %d\n"
"VAR_12 = %d %d\n"
"VAR_10 = %d\n"
"ticks/char = %lld\n"
"\n",
(double) ticks_per_sec / (VAR_14->ticks_per_char * VAR_14->total_chars),
VAR_1,
VAR_2,
VAR_3,
VAR_4,
VAR_5,
VAR_6,
VAR_7,
VAR_8, VAR_9,
VAR_11,
VAR_12,
VAR_13[VAR_12],
VAR_10,
VAR_14->ticks_per_char
); #endif
}