Redirect DOS writes to stdout/console to DOSVM_PutChar.

oldstable
Jukka Heinonen 2002-04-03 02:34:45 +00:00 committed by Alexandre Julliard
parent f31c3e3898
commit 7e94af47aa
4 changed files with 40 additions and 5 deletions

View File

@ -79,6 +79,7 @@ extern BYTE WINAPI DOSVM_Int09ReadScan(BYTE*ascii);
/* int10.c */
extern void WINAPI DOSVM_Int10Handler(CONTEXT86*);
extern void WINAPI DOSVM_PutChar(BYTE ascii);
/* int16.c */
extern void WINAPI DOSVM_Int16Handler(CONTEXT86*);

View File

@ -27,6 +27,7 @@
#include "vga.h"
#include "wine/debug.h"
#include "console.h"
#include "dosexe.h"
WINE_DEFAULT_DEBUG_CHANNEL(int);
@ -548,7 +549,7 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
case 0x0e: /* TELETYPE OUTPUT */
TRACE("Teletype Output\n");
CONSOLE_Write(AL_reg(context), 0, 0, 0);
DOSVM_PutChar(AL_reg(context));
break;
case 0x0f: /* GET CURRENT VIDEO MODE */
@ -826,3 +827,22 @@ static void scroll_window(int direction, char lines, char row1,
}
}
/**********************************************************************
* DOSVM_PutChar
*
*/
void WINAPI DOSVM_PutChar(BYTE ascii)
{
BIOSDATA *data = DOSMEM_BiosData();
unsigned xpos, ypos;
TRACE("char: 0x%02x\n", ascii);
// FIXME: Update VGA text buffers here...
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), &ascii, 1, NULL, NULL);
VGA_GetCursorPos(&xpos, &ypos);
BIOS_SetCursorPos(data, 0, xpos, ypos);
}

View File

@ -92,7 +92,7 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
case 0x02: /* WRITE CHARACTER TO STANDARD OUTPUT */
TRACE("Write Character to Standard Output\n");
CONSOLE_Write(DL_reg(context), 0, 0, 0);
DOSVM_PutChar(DL_reg(context));
break;
case 0x06: /* DIRECT CONSOLE IN/OUTPUT */
@ -123,7 +123,7 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
}
} else {
TRACE("Direct Console Output\n");
CONSOLE_Write(DL_reg(context), 0, 0, 0);
DOSVM_PutChar(DL_reg(context));
}
break;
@ -163,6 +163,20 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
}
break;
case 0x40: /* WRITE TO FILE OR DEVICE */
/* Writes to stdout are handled here. */
if (BX_reg(context) == 1) {
BYTE *ptr = CTX_SEG_OFF_TO_LIN(context,
context->SegDs,
context->Edx);
int i;
for(i=0; i<CX_reg(context); i++)
DOSVM_PutChar(ptr[i]);
} else
DOS3Call( context );
break;
case 0x44: /* IOCTL */
DOSVM_Int21Handler_Ioctl( context );
break;

View File

@ -24,6 +24,7 @@
#include "console.h"
#include "miscemu.h"
#include "dosexe.h"
/**********************************************************************
* DOSVM_Int29Handler
@ -33,6 +34,5 @@
void WINAPI DOSVM_Int29Handler( CONTEXT86 *context )
{
/* Yes, it seems that this is really all this interrupt does. */
CONSOLE_Write(AL_reg(context), 0, 0, 0);
DOSVM_PutChar(AL_reg(context));
}