From b960a239218ba8fcb95772e6268bec6f3ff30538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 2 Mar 2014 18:41:22 +0000 Subject: [PATCH] [NTVDM]: Fix INT 10h, AH=8h,9h,Ah ; remove AH=12h because it corresponds to video "alternate function select" (and not scroll window). Stubplement INT 10h, AH=13h. svn path=/branches/ntvdm/; revision=62381 --- subsystems/ntvdm/bios/bios32/vidbios32.c | 86 ++++++++++++++---------- 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/subsystems/ntvdm/bios/bios32/vidbios32.c b/subsystems/ntvdm/bios/bios32/vidbios32.c index 336f6b0d018..126738c6d2c 100644 --- a/subsystems/ntvdm/bios/bios32/vidbios32.c +++ b/subsystems/ntvdm/bios/bios32/vidbios32.c @@ -1152,7 +1152,7 @@ static VOID WINAPI VidBiosVideoService(LPWORD Stack) break; } - /* Get Cursor Position */ + /* Get Cursor Position and Shape */ case 0x03: { /* Make sure the selected video page exists */ @@ -1191,22 +1191,20 @@ static VOID WINAPI VidBiosVideoService(LPWORD Stack) /* Call the internal function */ VidBiosScrollWindow((getAH() == 0x06) ? SCROLL_DIRECTION_UP - : SCROLL_DIRECTION_DOWN, - getAL(), - Rectangle, - Bda->VideoPage, - getBH()); + : SCROLL_DIRECTION_DOWN, + getAL(), + Rectangle, + Bda->VideoPage, + getBH()); break; } - /* Read/Write Character From Cursor Position */ + /* Read Character and Attribute at Cursor Position */ case 0x08: - case 0x09: - case 0x0A: { - WORD CharacterData = MAKEWORD(getAL(), getBL()); - BYTE Page = getBH(); + WORD CharacterData; + BYTE Page = getBH(); DWORD Offset; /* Check if the page exists */ @@ -1214,27 +1212,47 @@ static VOID WINAPI VidBiosVideoService(LPWORD Stack) /* Find the offset of the character */ Offset = Page * Bda->VideoPageSize + - (HIBYTE(Bda->CursorPosition[Page]) * Bda->ScreenColumns + + (HIBYTE(Bda->CursorPosition[Page]) * Bda->ScreenColumns + LOBYTE(Bda->CursorPosition[Page])) * 2; - if (getAH() == 0x08) - { - /* Read from the video memory */ - EmulatorReadMemory(&EmulatorContext, - TO_LINEAR(TEXT_VIDEO_SEG, Offset), - (LPVOID)&CharacterData, - sizeof(WORD)); + /* Read from the video memory */ + EmulatorReadMemory(&EmulatorContext, + TO_LINEAR(TEXT_VIDEO_SEG, Offset), + (LPVOID)&CharacterData, + sizeof(WORD)); - /* Return the character in AX */ - setAX(CharacterData); - } - else + /* Return the character data in AX */ + setAX(CharacterData); + + break; + } + + /* Write Character and Attribute at Cursor Position */ + case 0x09: + /* Write Character only (PCjr: + Attribute) at Cursor Position */ + case 0x0A: + { + WORD CharacterData = MAKEWORD(getAL(), getBL()); + BYTE Page = getBH(); + DWORD Offset, Counter = getCX(); + + /* Check if the page exists */ + if (Page >= BIOS_MAX_PAGES) break; + + /* Find the offset of the character */ + Offset = Page * Bda->VideoPageSize + + (HIBYTE(Bda->CursorPosition[Page]) * Bda->ScreenColumns + + LOBYTE(Bda->CursorPosition[Page])) * 2; + + /* Write to video memory a certain number of times */ + while (Counter > 0) { - /* Write to video memory */ EmulatorWriteMemory(&EmulatorContext, TO_LINEAR(TEXT_VIDEO_SEG, Offset), (LPVOID)&CharacterData, - (getBH() == 0x09) ? sizeof(WORD) : sizeof(BYTE)); + (getAH() == 0x09) ? sizeof(WORD) : sizeof(BYTE)); + Offset += 2; + Counter--; } break; @@ -1460,18 +1478,18 @@ static VOID WINAPI VidBiosVideoService(LPWORD Stack) break; } - /* Scroll Window */ + /* Alternate Function Select */ case 0x12: { - SMALL_RECT Rectangle = { getCL(), getCH(), getDL(), getDH() }; - - /* Call the internal function */ - VidBiosScrollWindow(getBL(), - getAL(), - Rectangle, - Bda->VideoPage, - DEFAULT_ATTRIBUTE); + DPRINT1("BIOS Function INT 12h (Alternate Function Select), BX = 0x%04X NOT IMPLEMENTED\n", + getBX()); + break; + } + /* Write String */ + case 0x13: + { + DPRINT1("BIOS Function INT 13h (Write String) is UNIMPLEMENTED\n"); break; }