X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=subsystems%2Fntvdm%2Fvga.c;h=d4616a789b25dab55464c94a34ea5c0ee41d99be;hp=17f6f18ae57d1627ae8ececd869d80b8f06d6aba;hb=0043c2f37785f45d909d5e64cc9a02fa1b6342ef;hpb=516653f4477bfa6d125faf0b9034ef1dcc6c4018 diff --git a/subsystems/ntvdm/vga.c b/subsystems/ntvdm/vga.c index 17f6f18ae57..d4616a789b2 100644 --- a/subsystems/ntvdm/vga.c +++ b/subsystems/ntvdm/vga.c @@ -488,12 +488,22 @@ static VOID VgaChangeMode(VOID) if (!(VgaGcRegisters[VGA_GC_MISC_REG] & VGA_GC_MISC_NOALPHA)) { /* Enter new text mode */ - if (!VgaEnterTextMode(&Resolution)) return; + if (!VgaEnterTextMode(&Resolution)) + { + DisplayMessage(L"An unexpected VGA error occurred while switching into text mode."); + VdmRunning = FALSE; + return; + } } else { /* Enter 8-bit graphics mode */ - if (!VgaEnterGraphicsMode(&Resolution)) return; + if (!VgaEnterGraphicsMode(&Resolution)) + { + DisplayMessage(L"An unexpected VGA error occurred while switching into graphics mode."); + VdmRunning = FALSE; + return; + } } /* Trigger a full update of the screen */ @@ -516,6 +526,12 @@ static VOID VgaUpdateFramebuffer(VOID) + VgaCrtcRegisters[VGA_CRTC_START_ADDR_LOW_REG]; DWORD ScanlineSize = (DWORD)VgaCrtcRegisters[VGA_CRTC_OFFSET_REG] * 2; + /* + * If console framebuffer is NULL, that means something went wrong + * earlier and this is the final display refresh. + */ + if (ConsoleFramebuffer == NULL) return; + /* Check if this is text mode or graphics mode */ if (VgaGcRegisters[VGA_GC_MISC_REG] & VGA_GC_MISC_NOALPHA) { @@ -574,6 +590,11 @@ static VOID VgaUpdateFramebuffer(VOID) { /* Check if this is 16 or 256 color mode */ if (VgaAcRegisters[VGA_AC_CONTROL_REG] & VGA_AC_CONTROL_8BIT) + { + // TODO: NOT IMPLEMENTED + DPRINT1("8-bit interleaved mode is not implemented!\n"); + } + else { /* * 2 bits shifted from plane 0 and 2 for the first 4 pixels, @@ -581,7 +602,7 @@ static VOID VgaUpdateFramebuffer(VOID) */ BYTE LowPlaneData = VgaMemory[((j / 4) % 2) * VGA_BANK_SIZE + (Address + (j / 4)) * AddressSize]; - BYTE HighPlaneData = VgaMemory[(((j / 4) % 2) + 1) * VGA_BANK_SIZE + BYTE HighPlaneData = VgaMemory[(((j / 4) % 2) + 2) * VGA_BANK_SIZE + (Address + (j / 4)) * AddressSize]; /* Extract the two bits from each plane */ @@ -591,11 +612,6 @@ static VOID VgaUpdateFramebuffer(VOID) /* Combine them into the pixel */ PixelData = LowPlaneData | (HighPlaneData << 2); } - else - { - // TODO: NOT IMPLEMENTED - DPRINT1("8-bit interleaved mode is not implemented!\n"); - } } else {