From 765cdc072a51df01ea9c1a3914b5fbc2f103eb53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 6 Jun 2015 13:21:25 +0000 Subject: [PATCH] [NTVDM]: Update the character height value in the BDA each time we set up a different graphics font. Also, update the ScreenRows variable accordingly (taken from dosbox). svn path=/trunk/; revision=68039 --- reactos/subsystems/mvdm/ntvdm/bios/vidbios.c | 75 ++++++++++++++++++-- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/reactos/subsystems/mvdm/ntvdm/bios/vidbios.c b/reactos/subsystems/mvdm/ntvdm/bios/vidbios.c index 342c6d6728a..3ded8b6ee4c 100644 --- a/reactos/subsystems/mvdm/ntvdm/bios/vidbios.c +++ b/reactos/subsystems/mvdm/ntvdm/bios/vidbios.c @@ -3068,6 +3068,8 @@ VOID WINAPI VidBiosVideoService(LPWORD Stack) { switch (getAL()) { + // FIXME: At the moment we support only graphics-mode functions! + /* Set User 8x8 Graphics Chars (Setup INT 1Fh Vector) */ case 0x20: { @@ -3077,11 +3079,56 @@ VOID WINAPI VidBiosVideoService(LPWORD Stack) break; } + /* Set User Graphics Characters */ + case 0x21: + { + // /* Write the font to the VGA font plane */ + // VgaWriteFont(0, Font8x8, ARRAYSIZE(Font8x8) / VGA_FONT_CHARACTERS); + + /* Update the BIOS INT 43h vector */ + ((PULONG)BaseAddress)[0x43] = MAKELONG(getBP(), getES()); + + /* Update BDA */ + Bda->CharacterHeight = getCX(); + switch (getBL()) + { + case 0x00: Bda->ScreenRows = getDL()-1; break; + case 0x01: Bda->ScreenRows = 13; break; + case 0x03: Bda->ScreenRows = 42; break; + case 0x02: + default : Bda->ScreenRows = 24; break; + } + + break; + } + + /* Setup ROM 8x14 Font for Graphics Mode */ + case 0x22: + { + /* Write the default font to the VGA font plane */ + VgaWriteFont(0, Font8x14, ARRAYSIZE(Font8x14) / VGA_FONT_CHARACTERS); + + /* Update the BIOS INT 43h vector */ + // Far pointer to the 8x14 characters 00h-... + ((PULONG)BaseAddress)[0x43] = MAKELONG(FONT_8x14_OFFSET, VIDEO_BIOS_DATA_SEG); + + /* Update BDA */ + Bda->CharacterHeight = 14; + switch (getBL()) + { + case 0x00: Bda->ScreenRows = getDL()-1; break; + case 0x01: Bda->ScreenRows = 13; break; + case 0x03: Bda->ScreenRows = 42; break; + case 0x02: + default : Bda->ScreenRows = 24; break; + } + + break; + } + /* Setup ROM 8x8 Font for Graphics Mode */ case 0x23: { - // FIXME: Use BL and DL for the number of screen rows - /* Write the default font to the VGA font plane */ VgaWriteFont(0, Font8x8, ARRAYSIZE(Font8x8) / VGA_FONT_CHARACTERS); @@ -3089,14 +3136,23 @@ VOID WINAPI VidBiosVideoService(LPWORD Stack) // Far pointer to the 8x8 characters 00h-... ((PULONG)BaseAddress)[0x43] = MAKELONG(FONT_8x8_OFFSET, VIDEO_BIOS_DATA_SEG); + /* Update BDA */ + Bda->CharacterHeight = 8; + switch (getBL()) + { + case 0x00: Bda->ScreenRows = getDL()-1; break; + case 0x01: Bda->ScreenRows = 13; break; + case 0x03: Bda->ScreenRows = 42; break; + case 0x02: + default : Bda->ScreenRows = 24; break; + } + break; } /* Setup ROM 8x16 Font for Graphics Mode */ case 0x24: { - // FIXME: Use BL and DL for the number of screen rows - /* Write the default font to the VGA font plane */ VgaWriteFont(0, Font8x16, ARRAYSIZE(Font8x16) / VGA_FONT_CHARACTERS); @@ -3104,6 +3160,17 @@ VOID WINAPI VidBiosVideoService(LPWORD Stack) // Far pointer to the 8x16 characters 00h-... ((PULONG)BaseAddress)[0x43] = MAKELONG(FONT_8x16_OFFSET, VIDEO_BIOS_DATA_SEG); + /* Update BDA */ + Bda->CharacterHeight = 16; + switch (getBL()) + { + case 0x00: Bda->ScreenRows = getDL()-1; break; + case 0x01: Bda->ScreenRows = 13; break; + case 0x03: Bda->ScreenRows = 42; break; + case 0x02: + default : Bda->ScreenRows = 24; break; + } + break; }