qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <bonzini@gnu.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] vga: fix CGA 640x200 mode
Date: Sat,  8 Aug 2015 15:11:09 +0200	[thread overview]
Message-ID: <1439039469-438-4-git-send-email-bonzini@gnu.org> (raw)
In-Reply-To: <1439039469-438-1-git-send-email-bonzini@gnu.org>

SeaBIOS programs the CGA 2-color 640x200 mode with 0xC1 in the maximum
scan line register.  Ordinarily, this would mean 100 vertical lines,
but the CGA modes ignore bits 4:0 (DOSBox's BIOS also uses 0xC1).
Unfortunately, the test used to catch CGA modes worked for 4-color
320x200 graphics, but not for the 2-color 640x200 mode.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
---
 hw/display/vga.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/display/vga.c b/hw/display/vga.c
index 19dcb6b..7d4e1b0 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -1442,12 +1442,11 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
 
     shift_control = (s->gr[VGA_GFX_MODE] >> 5) & 3;
     double_scan = (s->cr[VGA_CRTC_MAX_SCAN] >> 7);
-    if (shift_control != 1) {
+    if (s->cr[VGA_CRTC_MODE] & 1) {
         multi_scan = (((s->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1) << double_scan)
             - 1;
     } else {
         /* in CGA modes, multi_scan is ignored */
-        /* XXX: is it correct ? */
         multi_scan = double_scan;
     }
     multi_run = multi_scan;
-- 
2.4.3

      parent reply	other threads:[~2015-08-08 13:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-08 13:11 [Qemu-devel] [PATCH 0/3] vga: first round of hardware emulation fixes Paolo Bonzini
2015-08-08 13:11 ` [Qemu-devel] [PATCH 1/3] vga: mask addresses in non-VESA modes to 256k Paolo Bonzini
2015-08-08 13:11 ` [Qemu-devel] [PATCH 2/3] vga: remove unused macros Paolo Bonzini
2015-08-08 13:11 ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439039469-438-4-git-send-email-bonzini@gnu.org \
    --to=bonzini@gnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).