bochs-emu / Bochs

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

Corrupted image in Windows 3.11 with Voodoo 3 #352

Closed Vort closed 1 month ago

Vort commented 1 month ago

After display mode is switched to 640x480x8 in Windows 3.11 with Velocity (Voodoo 3) drivers, window movement leaves trail of black dots:

image

At the same time, [VOODOO] bx_banshee_c::mem_read unsupported length 3 messages start to appear in log file.

Length 3 reads happen because of accesses crossing page boundary. Such change fixes this problem for me, but I don't know if it will work correctly for big endian hosts:

diff --git a/bochs/iodev/display/banshee.cc b/bochs/iodev/display/banshee.cc
index dd2d2b9e7..0169c769b 100644
--- a/bochs/iodev/display/banshee.cc
+++ b/bochs/iodev/display/banshee.cc
@@ -941,6 +941,10 @@ void bx_banshee_c::mem_read(bx_phy_address addr, unsigned len, void *data)
     case 2:
       *((Bit16u*)data) = (Bit16u)value;
       break;
+    case 3:
+      *((Bit16u*)data) = (Bit16u)value;
+      *((Bit8u*)data + 2) = (Bit8u)(value >> 16);
+      break;
     case 4:
       *((Bit32u*)data) = (Bit32u)value;
       break; 

Version: f5e3dd9

vruppert commented 1 month ago

Applied fix with some untested big endian code (byte-by-byte copy in reverse order looks okay to me).

Vort commented 1 month ago

Thanks.