From d1984194f3b9f794ca2e353b81680be235be89bf Mon Sep 17 00:00:00 2001 From: malc Date: Fri, 6 Nov 2009 03:46:12 +0300 Subject: [PATCH] vga: Respect Line Compare Register in text modes Unbreaks setup screen of Act1/PL Signed-off-by: malc --- hw/vga.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/vga.c b/hw/vga.c index 95a7650f3c..5d09037811 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -1267,9 +1267,9 @@ static rgb_to_pixel_dup_func *rgb_to_pixel_dup_table[NB_DEPTHS] = { static void vga_draw_text(VGACommonState *s, int full_update) { int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr; - int cx_min, cx_max, linesize, x_incr; + int cx_min, cx_max, linesize, x_incr, line; uint32_t offset, fgcol, bgcol, v, cursor_offset; - uint8_t *d1, *d, *src, *s1, *dest, *cursor_ptr; + uint8_t *d1, *d, *src, *dest, *cursor_ptr; const uint8_t *font_ptr, *font_base[2]; int dup9, line_offset, depth_index; uint32_t *palette; @@ -1301,7 +1301,6 @@ static void vga_draw_text(VGACommonState *s, int full_update) 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); @@ -1354,9 +1353,11 @@ static void vga_draw_text(VGACommonState *s, int full_update) dest = ds_get_data(s->ds); linesize = ds_get_linesize(s->ds); ch_attr_ptr = s->last_ch_attr; + line = 0; + offset = s->start_addr * 4; for(cy = 0; cy < height; cy++) { d1 = dest; - src = s1; + src = s->vram_ptr + offset; cx_min = width; cx_max = -1; for(cx = 0; cx < width; cx++) { @@ -1419,7 +1420,14 @@ static void vga_draw_text(VGACommonState *s, int full_update) (cx_max - cx_min + 1) * cw, cheight); } dest += linesize * cheight; - s1 += line_offset; + if (line >= s->line_compare) { + line -= s->line_compare; + offset = 0; + } + else { + offset += line_offset; + line += cheight; + } } } -- 2.11.0