bochs-emu / Bochs

Bochs - Cross Platform x86 Emulator Project
https://bochs.sourceforge.io/
GNU Lesser General Public License v2.1
876 stars 102 forks source link

Image corruption in WinMode program with CL-GD5446 #359

Open Vort opened 1 week ago

Vort commented 1 week ago

After WinMode program from CL-GD5446 driver v1.31 is started with regular Windows 3.11 VGA driver and VGABIOS-lgpl-latest-cirrus, it displays wrong colors:

image

When BIOS is changed to cl-gd5446_pci_vga_bios_version_1.31.u2, colors become correct: image

Version: 85c58ff

Vort commented 17 hours ago

I figured out what is going wrong here: vgabios call ah4F al15 bx0001 cx0000 dx0000 changes sequencer index to 0x08 and never restores it to its original value. In case of WinMode program, value for index before BIOS call is set to 0x02. If I add such hack, image corruption disappear (but I think proper restoring should be done instead):

diff --git a/vgabios/clext.c b/vgabios/clext.c
index 8be7cb2..b7a3cdc 100644
--- a/vgabios/clext.c
+++ b/vgabios/clext.c
@@ -1989,6 +1989,9 @@ cirrus_vesa_15h_01:
   call cirrus_ddc_send_status
   loop cirrus_vesa_15h_01
   call cirrus_ddc_stop
+  mov  dx, #0x3c4
+  mov  al, #0x02
+  out  dx, al
   pop  di
   pop  cx
   mov  ax, #0x004f