Author: hbelusca
Date: Tue Jun 9 12:47:58 2015
New Revision: 68088
URL:
http://svn.reactos.org/svn/reactos?rev=68088&view=rev
Log:
[NTVDM]: Fix INT 10h, AH=09h/0Ah by correctly advancing the write position (but scrolling
is not supported in those functions), and make VidBiosDrawGlyph support using or not the
attribute byte (for text modes only).
Modified:
trunk/reactos/subsystems/mvdm/ntvdm/bios/vidbios.c
Modified: trunk/reactos/subsystems/mvdm/ntvdm/bios/vidbios.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/bios…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/bios/vidbios.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/bios/vidbios.c [iso-8859-1] Tue Jun 9 12:47:58
2015
@@ -2561,7 +2561,7 @@
return TRUE;
}
-static VOID VidBiosDrawGlyph(WORD CharData, BYTE Page, BYTE Row, BYTE Column)
+static VOID VidBiosDrawGlyph(WORD CharData, BOOLEAN UseAttr, BYTE Page, BYTE Row, BYTE
Column)
{
switch (Bda->VideoMode)
{
@@ -2576,8 +2576,7 @@
Page * Bda->VideoPageSize +
(Row * Bda->ScreenColumns + Column) *
sizeof(WORD)),
(LPVOID)&CharData,
- sizeof(WORD));
-
+ UseAttr ? sizeof(WORD) : sizeof(BYTE));
break;
}
@@ -2831,7 +2830,7 @@
/* Erase the existing character */
CharData = MAKEWORD(' ', Attribute);
- VidBiosDrawGlyph(CharData, Page, Row, Column);
+ VidBiosDrawGlyph(CharData, TRUE, Page, Row, Column);
}
else if (Character == '\t')
{
@@ -2857,10 +2856,8 @@
{
/* Default character */
- /* Write the character */
- VidBiosDrawGlyph(CharData, Page, Row, Column);
-
- /* Advance the cursor */
+ /* Write the character and advance the cursor */
+ VidBiosDrawGlyph(CharData, TRUE, Page, Row, Column);
Column++;
}
@@ -2957,7 +2954,7 @@
/* Read Character and Attribute at Cursor Position */
case 0x08:
{
- WORD CharacterData;
+ WORD CharData;
BYTE Page = getBH();
DWORD Offset;
@@ -2972,11 +2969,11 @@
/* Read from the video memory */
EmulatorReadMemory(&EmulatorContext,
TO_LINEAR(TEXT_VIDEO_SEG, Offset),
- (LPVOID)&CharacterData,
+ (LPVOID)&CharData,
sizeof(WORD));
/* Return the character data in AX */
- setAX(CharacterData);
+ setAX(CharData);
break;
}
@@ -2986,21 +2983,40 @@
/* Write Character only (PCjr: + Attribute) at Cursor Position */
case 0x0A:
{
- WORD CharacterData = MAKEWORD(getAL(), getBL());
- BYTE Page = getBH();
- DWORD Counter = getCX();
+ WORD Counter = getCX();
+ WORD CharData = MAKEWORD(getAL(), getBL());
+ BOOLEAN UseAttr = (getAH() == 0x09);
+ BYTE Page = getBH();
+ BYTE Row, Column;
/* Check if the page exists */
if (Page >= BIOS_MAX_PAGES) break;
+ /* Get the cursor location */
+ // VidBiosGetCursorPosition(&Row, &Column, Page);
+ Row = HIBYTE(Bda->CursorPosition[Page]);
+ Column = LOBYTE(Bda->CursorPosition[Page]);
+
/* Write to video memory a certain number of times */
- while (Counter > 0)
+ while (Counter-- > 0)
{
- VidBiosDrawGlyph(CharacterData,
- CharacterData,
- HIBYTE(Bda->CursorPosition[Page]),
- LOBYTE(Bda->CursorPosition[Page]));
- Counter--;
+ /* Write the character and advance the position */
+ VidBiosDrawGlyph(CharData, UseAttr, Page, Row, Column);
+ Column++;
+
+ /* Check if it passed the end of the row */
+ if (Column >= Bda->ScreenColumns)
+ {
+ /* Return to the first column and go to the next line */
+ Column = 0;
+ Row++;
+ }
+
+ /* Contrary to the "Teletype Output" function, the screen is
not scrolled */
+ if (Row > Bda->ScreenRows)
+ {
+ Row = Bda->ScreenRows;
+ }
}
break;