[NTVDM]: Introduce a echo state for INT 21h, AH=01h and AH=3Fh.

svn path=/trunk/; revision=63297
This commit is contained in:
Hermès Bélusca-Maïto 2014-05-14 18:50:29 +00:00
parent 3396b21b26
commit dea92c0361
3 changed files with 19 additions and 8 deletions

View file

@ -40,6 +40,9 @@ static BYTE DosAllocStrategy = DOS_ALLOC_BEST_FIT;
static BOOLEAN DosUmbLinked = FALSE; static BOOLEAN DosUmbLinked = FALSE;
static WORD DosErrorLevel = 0x0000; static WORD DosErrorLevel = 0x0000;
/* Echo state for INT 21h, AH = 01h and AH = 3Fh */
BOOLEAN DoEcho = FALSE;
/* PRIVATE FUNCTIONS **********************************************************/ /* PRIVATE FUNCTIONS **********************************************************/
/* /*
@ -1434,8 +1437,9 @@ VOID WINAPI DosInt21h(LPWORD Stack)
case 0x01: case 0x01:
{ {
// FIXME: Under DOS 2+, input / output handle may be redirected!!!! // FIXME: Under DOS 2+, input / output handle may be redirected!!!!
DoEcho = TRUE;
Character = DosReadCharacter(DOS_INPUT_HANDLE); Character = DosReadCharacter(DOS_INPUT_HANDLE);
DosPrintCharacter(DOS_OUTPUT_HANDLE, Character); DoEcho = FALSE;
// /* Let the BOP repeat if needed */ // /* Let the BOP repeat if needed */
// if (getCF()) break; // if (getCF()) break;
@ -1576,6 +1580,8 @@ VOID WINAPI DosInt21h(LPWORD Stack)
while (Count < InputBuffer->MaxLength) while (Count < InputBuffer->MaxLength)
{ {
// FIXME!! This function should interpret backspaces etc...
/* Try to read a character (wait) */ /* Try to read a character (wait) */
Character = DosReadCharacter(DOS_INPUT_HANDLE); Character = DosReadCharacter(DOS_INPUT_HANDLE);
@ -2051,10 +2057,14 @@ VOID WINAPI DosInt21h(LPWORD Stack)
case 0x3F: case 0x3F:
{ {
WORD BytesRead = 0; WORD BytesRead = 0;
WORD ErrorCode = DosReadFile(getBX(), WORD ErrorCode;
SEG_OFF_TO_PTR(getDS(), getDX()),
getCX(), DoEcho = TRUE;
&BytesRead); ErrorCode = DosReadFile(getBX(),
SEG_OFF_TO_PTR(getDS(), getDX()),
getCX(),
&BytesRead);
DoEcho = FALSE;
if (ErrorCode == ERROR_SUCCESS) if (ErrorCode == ERROR_SUCCESS)
{ {

View file

@ -160,6 +160,8 @@ typedef struct _DOS_EXEC_PARAM_BLOCK
#pragma pack(pop) #pragma pack(pop)
extern BOOLEAN DoEcho;
/* FUNCTIONS ******************************************************************/ /* FUNCTIONS ******************************************************************/
extern CALLBACK16 DosContext; extern CALLBACK16 DosContext;

View file

@ -167,15 +167,14 @@ WORD DosReadFile(WORD FileHandle, LPVOID Buffer, WORD Count, LPWORD BytesRead)
/* Retrieve the character in AL (scan code is in AH) */ /* Retrieve the character in AL (scan code is in AH) */
Character = getAL(); Character = getAL();
// FIXME: Sometimes we need echo, some other times not. if (DoEcho) DosPrintCharacter(DOS_OUTPUT_HANDLE, Character);
// DosPrintCharacter(DOS_OUTPUT_HANDLE, Character);
((PCHAR)Buffer)[BytesRead32] = Character; ((PCHAR)Buffer)[BytesRead32] = Character;
/* Stop on first carriage return */ /* Stop on first carriage return */
if (Character == '\r') if (Character == '\r')
{ {
// DosPrintCharacter(DOS_OUTPUT_HANDLE, '\n'); if (DoEcho) DosPrintCharacter(DOS_OUTPUT_HANDLE, '\n');
break; break;
} }