Index: subsystems/ntvdm/hardware/vga.c =================================================================== --- subsystems/ntvdm/hardware/vga.c (révision 63182) +++ subsystems/ntvdm/hardware/vga.c (copie de travail) @@ -1123,7 +1123,8 @@ DWORD AddressSize = VgaGetAddressSize(); DWORD Address = MAKEWORD(VgaCrtcRegisters[VGA_CRTC_START_ADDR_LOW_REG], VgaCrtcRegisters[VGA_CRTC_START_ADDR_HIGH_REG]); - DWORD ScanlineSize = (DWORD)VgaCrtcRegisters[VGA_CRTC_OFFSET_REG] * 2; + /**/DWORD AddressBase = Address;/**/ + DWORD ScanlineSize = (DWORD)VgaCrtcRegisters[VGA_CRTC_OFFSET_REG] /* * AddressSize */ * 2; /* * If console framebuffer is NULL, that means something went wrong @@ -1295,8 +1296,18 @@ } } + /// HACK for CGA !!!!!! /// + if ((VgaGcRegisters[VGA_GC_MODE_REG] & VGA_GC_MODE_SHIFTREG) && + ((VgaAcRegisters[VGA_AC_CONTROL_REG] & VGA_AC_CONTROL_8BIT) == 0)) + { + Address = AddressBase + ((i+1)%2!=0 ? /*(Resolution.Y+3)*ScanlineSize/2 + 36*/ 4096 : 0) + ((i+1)/2)*ScanlineSize; + } + else + { /* Move to the next scanline */ - Address += ScanlineSize; + // Address += ScanlineSize; + Address = AddressBase + (i+1)*ScanlineSize; + } } /* @@ -1350,7 +1361,8 @@ CONSOLE_CURSOR_INFO CursorInfo; BYTE CursorStart = VgaCrtcRegisters[VGA_CRTC_CURSOR_START_REG] & 0x3F; BYTE CursorEnd = VgaCrtcRegisters[VGA_CRTC_CURSOR_END_REG] & 0x1F; - DWORD ScanlineSize = (DWORD)VgaCrtcRegisters[VGA_CRTC_OFFSET_REG] * 2; + // DWORD AddressSize = VgaGetAddressSize(); + DWORD ScanlineSize = (DWORD)VgaCrtcRegisters[VGA_CRTC_OFFSET_REG] /* * AddressSize */ * 2; BYTE TextSize = 1 + (VgaCrtcRegisters[VGA_CRTC_MAX_SCAN_LINE_REG] & 0x1F); WORD Location = MAKEWORD(VgaCrtcRegisters[VGA_CRTC_CURSOR_LOC_LOW_REG], VgaCrtcRegisters[VGA_CRTC_CURSOR_LOC_HIGH_REG]); @@ -1378,8 +1390,6 @@ Position.X = (SHORT)(Location % ScanlineSize); Position.Y = (SHORT)(Location / ScanlineSize); - DPRINT1("VgaUpdateTextCursor: X = %d ; Y = %d\n", Position.X, Position.Y); - /* Update the physical cursor */ SetConsoleCursorInfo(TextConsoleBuffer, &CursorInfo); SetConsoleCursorPosition(TextConsoleBuffer, Position); @@ -1685,12 +1695,24 @@ /* Halve the vertical resolution */ Resolution.Y >>= 1; } +#if 1 // This is OK else { /* Divide the vertical resolution by the maximum scan line (== font size in text mode) */ Resolution.Y /= MaximumScanLine; } +#else // This was old code... + /* Divide the vertical resolution by the maximum scan line (== font size in text mode) */ + Resolution.Y /= MaximumScanLine; + /// HACK for CGA !!!!!! /// + if ((VgaGcRegisters[VGA_GC_MODE_REG] & VGA_GC_MODE_SHIFTREG) && + ((VgaAcRegisters[VGA_AC_CONTROL_REG] & VGA_AC_CONTROL_8BIT) == 0)) + { + Resolution.Y *= 2; + } +#endif + /* Return the resolution */ return Resolution; }