Moved internal context macros out of winnt.h.
Added SET_AX etc. macros to avoid non-portable pointer manipulations.
This commit is contained in:
parent
c08aa31f4e
commit
3fa613cf61
|
@ -40,6 +40,7 @@
|
|||
#include "flatthunk.h"
|
||||
#include "heap.h"
|
||||
#include "module.h"
|
||||
#include "miscemu.h"
|
||||
#include "selectors.h"
|
||||
#include "stackframe.h"
|
||||
#include "task.h"
|
||||
|
@ -1459,8 +1460,8 @@ void WINAPI C16ThkSL01(CONTEXT86 *context)
|
|||
else
|
||||
{
|
||||
WORD *stack = MapSL( MAKESEGPTR(context->SegSs, LOWORD(context->Esp)) );
|
||||
DX_reg(context) = HIWORD(td->apiDB[targetNr].errorReturnValue);
|
||||
AX_reg(context) = LOWORD(td->apiDB[targetNr].errorReturnValue);
|
||||
SET_DX( context, HIWORD(td->apiDB[targetNr].errorReturnValue) );
|
||||
SET_AX( context, LOWORD(td->apiDB[targetNr].errorReturnValue) );
|
||||
context->Eip = stack[2];
|
||||
context->SegCs = stack[3];
|
||||
context->Esp += td->apiDB[targetNr].nrArgBytes + 4;
|
||||
|
@ -1858,10 +1859,10 @@ void WINAPI CBClientGlueSL( CONTEXT86 *context )
|
|||
LPWORD stackLin = MapSL( stackSeg );
|
||||
SEGPTR glue, *glueTab;
|
||||
|
||||
stackLin[3] = BP_reg( context );
|
||||
stackLin[2] = SI_reg( context );
|
||||
stackLin[1] = DI_reg( context );
|
||||
stackLin[0] = context->SegDs;
|
||||
stackLin[3] = (WORD)context->Ebp;
|
||||
stackLin[2] = (WORD)context->Esi;
|
||||
stackLin[1] = (WORD)context->Edi;
|
||||
stackLin[0] = (WORD)context->SegDs;
|
||||
|
||||
context->Ebp = OFFSETOF( stackSeg ) + 6;
|
||||
context->Esp = OFFSETOF( stackSeg ) - 4;
|
||||
|
@ -1882,7 +1883,7 @@ void WINAPI CBClientThunkSL( CONTEXT86 *context )
|
|||
{
|
||||
/* Call 32-bit relay code */
|
||||
|
||||
LPWORD args = MapSL( MAKESEGPTR( context->SegSs, BP_reg( context ) ) );
|
||||
LPWORD args = MapSL( MAKESEGPTR( context->SegSs, LOWORD(context->Ebp) ) );
|
||||
FARPROC proc = CBClientRelay32[ args[2] ][ args[1] ];
|
||||
|
||||
context->Eax = CALL32_CBClient( proc, args, &context->Esi );
|
||||
|
@ -1896,7 +1897,7 @@ void WINAPI CBClientThunkSLEx( CONTEXT86 *context )
|
|||
{
|
||||
/* Call 32-bit relay code */
|
||||
|
||||
LPWORD args = MapSL( MAKESEGPTR( context->SegSs, BP_reg( context ) ) );
|
||||
LPWORD args = MapSL( MAKESEGPTR( context->SegSs, LOWORD(context->Ebp) ) );
|
||||
FARPROC proc = CBClientRelay32[ args[2] ][ args[1] ];
|
||||
INT nArgs;
|
||||
LPWORD stackLin;
|
||||
|
@ -1905,9 +1906,9 @@ void WINAPI CBClientThunkSLEx( CONTEXT86 *context )
|
|||
|
||||
/* Restore registers saved by CBClientGlueSL */
|
||||
stackLin = (LPWORD)((LPBYTE)CURRENT_STACK16 + sizeof(STACK16FRAME) - 4);
|
||||
BP_reg( context ) = stackLin[3];
|
||||
SI_reg( context ) = stackLin[2];
|
||||
DI_reg( context ) = stackLin[1];
|
||||
context->Ebp = (context->Ebp & ~0xffff) | stackLin[3];
|
||||
SET_SI( context, stackLin[2] );
|
||||
SET_DI( context, stackLin[1] );
|
||||
context->SegDs = stackLin[0];
|
||||
context->Esp += 16+nArgs;
|
||||
|
||||
|
@ -2064,7 +2065,7 @@ void WINAPI Catch16( LPCATCHBUF lpbuf, CONTEXT86 *context )
|
|||
lpbuf[6] = context->SegDs;
|
||||
lpbuf[7] = 0;
|
||||
lpbuf[8] = context->SegSs;
|
||||
AX_reg(context) = 0; /* Return 0 */
|
||||
SET_AX( context, 0 ); /* Return 0 */
|
||||
}
|
||||
|
||||
|
||||
|
@ -2080,7 +2081,7 @@ void WINAPI Throw16( LPCATCHBUF lpbuf, INT16 retval, CONTEXT86 *context )
|
|||
STACK32FRAME *frame32;
|
||||
TEB *teb = NtCurrentTeb();
|
||||
|
||||
AX_reg(context) = retval;
|
||||
SET_AX( context, retval );
|
||||
|
||||
/* Find the frame32 corresponding to the frame16 we are jumping to */
|
||||
pFrame = THREAD_STACK16(teb);
|
||||
|
|
|
@ -59,7 +59,7 @@ static WORD Inthandler02hVar = 1;
|
|||
|
||||
static void WIN87_ClearCtrlWord( CONTEXT86 *context )
|
||||
{
|
||||
AX_reg(context) = 0;
|
||||
SET_AX( context, 0 );
|
||||
if (Installed)
|
||||
#ifdef __i386__
|
||||
__asm__("fclex");
|
||||
|
@ -72,7 +72,7 @@ static void WIN87_ClearCtrlWord( CONTEXT86 *context )
|
|||
static void WIN87_SetCtrlWord( CONTEXT86 *context )
|
||||
{
|
||||
CtrlWord_1 = AX_reg(context);
|
||||
AX_reg(context) &= 0xff3c;
|
||||
context->Eax &= ~0x00c3;
|
||||
if (Installed) {
|
||||
CtrlWord_Internal = AX_reg(context);
|
||||
#ifdef __i386__
|
||||
|
@ -91,7 +91,7 @@ void WIN87_Init( CONTEXT86 *context )
|
|||
#endif
|
||||
}
|
||||
StackBottom = StackTop;
|
||||
AX_reg(context) = 0x1332;
|
||||
SET_AX( context, 0x1332 );
|
||||
WIN87_SetCtrlWord(context);
|
||||
WIN87_ClearCtrlWord(context);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ void WINAPI WIN87_fpmath( CONTEXT86 *context )
|
|||
InstallIntVecs02hAnd75h();
|
||||
#endif
|
||||
WIN87_Init(context);
|
||||
AX_reg(context) = 0;
|
||||
SET_AX( context, 0 );
|
||||
break;
|
||||
|
||||
case 1: /* Init Emulator */
|
||||
|
@ -144,7 +144,7 @@ void WINAPI WIN87_fpmath( CONTEXT86 *context )
|
|||
break;
|
||||
|
||||
case 5: /* return internal control word in AX */
|
||||
AX_reg(context) = CtrlWord_1;
|
||||
SET_AX( context, CtrlWord_1 );
|
||||
break;
|
||||
|
||||
case 6: /* round top of stack to integer using method AX & 0x0C00 */
|
||||
|
@ -179,21 +179,20 @@ void WINAPI WIN87_fpmath( CONTEXT86 *context )
|
|||
/* FIXME: could someone who really understands asm() fix this please? --AJ */
|
||||
/* __asm__("fistp %0;wait" : "=m" (dw) : : "memory"); */
|
||||
TRACE("On top of stack was %ld\n",dw);
|
||||
AX_reg(context) = LOWORD(dw);
|
||||
DX_reg(context) = HIWORD(dw);
|
||||
SET_AX( context, LOWORD(dw) );
|
||||
SET_DX( context, HIWORD(dw) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 8: /* restore internal status words from emulator status word */
|
||||
AX_reg(context) = 0;
|
||||
SET_AX( context, 0 );
|
||||
if (Installed) {
|
||||
#ifdef __i386__
|
||||
__asm__("fstsw %0;wait" : "=m" (StatusWord_1));
|
||||
#endif
|
||||
AL_reg(context) = (BYTE)StatusWord_1 & 0x3f;
|
||||
SET_AL( context, (BYTE)StatusWord_1 & 0x3f );
|
||||
}
|
||||
AX_reg(context) |= StatusWord_2;
|
||||
AX_reg(context) &= 0x1fff;
|
||||
context->Eax = (context->Eax | StatusWord_2) & ~0xe000;
|
||||
StatusWord_2 = AX_reg(context);
|
||||
break;
|
||||
|
||||
|
@ -202,12 +201,12 @@ void WINAPI WIN87_fpmath( CONTEXT86 *context )
|
|||
break;
|
||||
|
||||
case 10: /* dunno. but looks like returning nr. of things on stack in AX */
|
||||
AX_reg(context) = 0;
|
||||
SET_AX( context, 0 );
|
||||
break;
|
||||
|
||||
case 11: /* just returns the installed flag in DX:AX */
|
||||
DX_reg(context) = 0;
|
||||
AX_reg(context) = Installed;
|
||||
SET_DX( context, 0 );
|
||||
SET_AX( context, Installed );
|
||||
break;
|
||||
|
||||
case 12: /* save AX in some internal state var */
|
||||
|
@ -216,7 +215,8 @@ void WINAPI WIN87_fpmath( CONTEXT86 *context )
|
|||
|
||||
default: /* error. Say that loud and clear */
|
||||
FIXME("unhandled switch %d\n",BX_reg(context));
|
||||
AX_reg(context) = DX_reg(context) = 0xFFFF;
|
||||
SET_AX( context, 0xFFFF );
|
||||
SET_DX( context, 0xFFFF );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -248,4 +248,3 @@ void WINAPI WIN87_WinEm87Save(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
|
|||
FIXME("(%p,%d), stub !\n",
|
||||
pWin87EmSaveArea,cbWin87EmSaveArea);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "windef.h"
|
||||
#include "module.h"
|
||||
#include "miscemu.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dll);
|
||||
|
|
|
@ -148,6 +148,8 @@ typedef struct
|
|||
|
||||
#define DOS_DATASEG_OFF(xxx) FIELD_OFFSET(DOS_DATASEG, xxx)
|
||||
|
||||
DWORD DOS_LOLSeg;
|
||||
|
||||
struct _DOS_LISTOFLISTS * DOSMEM_LOL()
|
||||
{
|
||||
return PTR_REAL_TO_LIN(HIWORD(DOS_LOLSeg),0);
|
||||
|
|
|
@ -219,12 +219,12 @@ void WINAPI DOSVM_ASPIHandler( CONTEXT86 *context )
|
|||
|
||||
*p = DPMI_AllocInternalRMCB(ASPI_DOS_func);
|
||||
TRACE("allocated real mode proc %p\n", *p);
|
||||
AX_reg(context) = CX_reg(context);
|
||||
SET_AX( context, CX_reg(context) );
|
||||
|
||||
return;
|
||||
}
|
||||
error_exit:
|
||||
/* Return some error... General Failure sounds okay */
|
||||
AX_reg(context) = ERROR_GEN_FAILURE;
|
||||
SET_AX( context, ERROR_GEN_FAILURE );
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ typedef void (*DOSRELAY)(CONTEXT86*,void*);
|
|||
|
||||
extern WORD DOSVM_psp; /* psp of current DOS task */
|
||||
extern WORD DOSVM_retval; /* return value of previous DOS task */
|
||||
extern DWORD DOS_LOLSeg;
|
||||
|
||||
#if defined(linux) && defined(__i386__)
|
||||
#define MZ_SUPPORTED
|
||||
|
@ -74,6 +75,7 @@ extern int DOSDEV_Read(DWORD dev, DWORD buf, int buflen);
|
|||
extern int DOSDEV_Write(DWORD dev, DWORD buf, int buflen, int verify);
|
||||
extern int DOSDEV_IoctlRead(DWORD dev, DWORD buf, int buflen);
|
||||
extern int DOSDEV_IoctlWrite(DWORD dev, DWORD buf, int buflen);
|
||||
extern struct _DOS_LISTOFLISTS * DOSMEM_LOL();
|
||||
|
||||
/* dma.c */
|
||||
extern int DMA_Transfer(int channel,int reqlength,void* buffer);
|
||||
|
|
|
@ -93,14 +93,14 @@ static void DOSVM_Int10Handler_VESA( CONTEXT86 *context )
|
|||
memcpy(CTX_SEG_OFF_TO_LIN(context,context->SegEs,context->Edi),
|
||||
(char *)BIOS_SYS + DOSMEM_GetBiosSysStructOffset(OFF_VESAINFO),
|
||||
sizeof(VESAINFO));
|
||||
AL_reg(context) = 0x4f;
|
||||
AH_reg(context) = 0x00; /* 0x00 = successful 0x01 = failed */
|
||||
SET_AL( context, 0x4f );
|
||||
SET_AH( context, 0x00 ); /* 0x00 = successful 0x01 = failed */
|
||||
break;
|
||||
|
||||
case 0x01: /* GET SuperVGA MODE INFORMATION */
|
||||
FIXME("VESA GET SuperVGA Mode Information - Not supported\n");
|
||||
AL_reg(context) = 0x4f;
|
||||
AH_reg(context) = 0x01; /* 0x00 = successful 0x01 = failed */
|
||||
SET_AL( context, 0x4f );
|
||||
SET_AH( context, 0x01 ); /* 0x00 = successful 0x01 = failed */
|
||||
break;
|
||||
|
||||
case 0x02: /* SET SuperVGA VIDEO MODE */
|
||||
|
@ -240,14 +240,14 @@ static void DOSVM_Int10Handler_VESA( CONTEXT86 *context )
|
|||
FIXME("VESA Set Video Mode (0x%x) - Not Supported\n", BX_reg(context));
|
||||
}
|
||||
data->VideoMode = BX_reg(context);
|
||||
AL_reg(context) = 0x4f;
|
||||
AH_reg(context) = 0x00;
|
||||
SET_AL( context, 0x4f );
|
||||
SET_AH( context, 0x00 );
|
||||
break;
|
||||
|
||||
case 0x03: /* VESA SuperVGA BIOS - GET CURRENT VIDEO MODE */
|
||||
AL_reg(context) = 0x4f;
|
||||
AH_reg(context) = 0x00; /* should probly check if a vesa mode has ben set */
|
||||
BX_reg(context) = data->VideoMode;
|
||||
SET_AL( context, 0x4f );
|
||||
SET_AH( context, 0x00 ); /* should probly check if a vesa mode has ben set */
|
||||
SET_BX( context, data->VideoMode );
|
||||
break;
|
||||
|
||||
case 0x04: /* VESA SuperVGA BIOS - SAVE/RESTORE SuperVGA VIDEO STATE */
|
||||
|
@ -264,20 +264,20 @@ static void DOSVM_Int10Handler_VESA( CONTEXT86 *context )
|
|||
*/
|
||||
switch(BH_reg(context)) {
|
||||
case 0x00: /* select video memory window */
|
||||
AL_reg(context) = 0x4f; /* function supported */
|
||||
SET_AL( context, 0x4f ); /* function supported */
|
||||
if(BL_reg(context) == 0) {
|
||||
VGA_SetWindowStart(DX_reg(context) * 64 * 1024);
|
||||
AH_reg(context) = 0x00; /* status: successful */
|
||||
SET_AH( context, 0x00 ); /* status: successful */
|
||||
} else
|
||||
AH_reg(context) = 0x01; /* status: failed */
|
||||
SET_AH( context, 0x01 ); /* status: failed */
|
||||
break;
|
||||
case 0x01: /* get video memory window */
|
||||
AL_reg(context) = 0x4f; /* function supported */
|
||||
SET_AL( context, 0x4f ); /* function supported */
|
||||
if(BL_reg(context) == 0) {
|
||||
DX_reg(context) = VGA_GetWindowStart() / 64 / 1024;
|
||||
AH_reg(context) = 0x00; /* status: successful */
|
||||
SET_DX( context, VGA_GetWindowStart() / 64 / 1024 );
|
||||
SET_AH( context, 0x00 ); /* status: successful */
|
||||
} else
|
||||
AH_reg(context) = 0x01; /* status: failed */
|
||||
SET_AH( context, 0x01 ); /* status: failed */
|
||||
break;
|
||||
default:
|
||||
INT_BARF( context, 0x10 );
|
||||
|
@ -321,7 +321,7 @@ static void DOSVM_Int10Handler_VESA( CONTEXT86 *context )
|
|||
/* There's no reason to really support this */
|
||||
/* is there?....................(A.C.) */
|
||||
TRACE("Just report the video not hercules compatible\n");
|
||||
DX_reg(context) = 0xffff;
|
||||
SET_DX( context, 0xffff );
|
||||
break;
|
||||
|
||||
case 0xff: /* Turn VESA ON/OFF */
|
||||
|
@ -358,7 +358,7 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
|
|||
}
|
||||
|
||||
/* FIXME: Should we keep the bit 7 in the Bios Data memory? */
|
||||
AL_reg(context) &= ~0x80;
|
||||
context->Eax &= ~0x80;
|
||||
|
||||
switch (AL_reg(context)) {
|
||||
case 0x00: /* 40x25 */
|
||||
|
@ -437,17 +437,17 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
|
|||
unsigned row, col;
|
||||
|
||||
TRACE("Get cursor position and size (page %d)\n", BH_reg(context));
|
||||
CX_reg(context) = data->VideoCursorType;
|
||||
SET_CX( context, data->VideoCursorType );
|
||||
BIOS_GetCursorPos(data,BH_reg(context),&col,&row);
|
||||
DH_reg(context) = row;
|
||||
DL_reg(context) = col;
|
||||
SET_DH( context, row );
|
||||
SET_DL( context, col );
|
||||
TRACE("Cursor Position: %d %d\n", DH_reg(context), DL_reg(context));
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x04: /* READ LIGHT PEN POSITION */
|
||||
FIXME("Read Light Pen Position - Not Supported\n");
|
||||
AH_reg(context) = 0x00; /* Not down */
|
||||
SET_AH( context, 0x00 ); /* Not down */
|
||||
break;
|
||||
|
||||
case 0x05: /* SELECT ACTIVE DISPLAY PAGE */
|
||||
|
@ -483,13 +483,16 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
|
|||
{
|
||||
FIXME("Read character and attribute at cursor position -"
|
||||
" Can't read from non-0 page\n");
|
||||
AL_reg(context) = ' '; /* That page is blank */
|
||||
AH_reg(context) = 7;
|
||||
SET_AL( context, ' ' ); /* That page is blank */
|
||||
SET_AH( context, 7 );
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE ascii, attr;
|
||||
TRACE("Read Character and Attribute at Cursor Position\n");
|
||||
VGA_GetCharacterAtCursor(&AL_reg(context), &AH_reg(context));
|
||||
VGA_GetCharacterAtCursor(&ascii, &attr);
|
||||
SET_AL( context, ascii );
|
||||
SET_AH( context, attr );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -563,9 +566,9 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
|
|||
case 0x0f: /* GET CURRENT VIDEO MODE */
|
||||
TRACE("Get current video mode\n");
|
||||
/* Note: This should not be a constant value. */
|
||||
AL_reg(context) = data->VideoMode;
|
||||
AH_reg(context) = data->VideoColumns;
|
||||
BH_reg(context) = 0; /* Display page 0 */
|
||||
SET_AL( context, data->VideoMode );
|
||||
SET_AH( context, data->VideoColumns );
|
||||
SET_BH( context, 0 ); /* Display page 0 */
|
||||
break;
|
||||
|
||||
case 0x10:
|
||||
|
@ -595,11 +598,11 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
|
|||
case 0x07: /* GET INDIVIDUAL PALETTE REGISTER - A.C.*/
|
||||
TRACE("Get Individual Palette Register 0x0%x\n",BL_reg(context));
|
||||
/* BL is register to read [ 0-15 ] BH is return value */
|
||||
BH_reg(context) = VGA_GetColor16((int)BL_reg(context));
|
||||
SET_BH( context, VGA_GetColor16((int)BL_reg(context)) );
|
||||
break;
|
||||
case 0x08: /* READ OVERSCAN (BORDER COLOR) REGISTER - A.C. */
|
||||
TRACE("Read Overscan (Border Color) Register \n");
|
||||
BH_reg(context) = VGA_GetColor16(16);
|
||||
SET_BH( context, VGA_GetColor16(16) );
|
||||
break;
|
||||
case 0x09: /* READ ALL PALETTE REGISTERS AND OVERSCAN REGISTER - A.C.*/
|
||||
TRACE("Read All Palette Registers and Overscan Register \n");
|
||||
|
@ -719,11 +722,9 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
|
|||
switch BL_reg(context) {
|
||||
case 0x10: /* GET EGA INFO */
|
||||
TRACE("EGA info requested\n");
|
||||
BH_reg(context) = 0x00; /* Color screen */
|
||||
BL_reg(context) =
|
||||
data->ModeOptions >> 5; /* EGA memory size */
|
||||
CX_reg(context) =
|
||||
data->FeatureBitsSwitches;
|
||||
SET_BH( context, 0x00 ); /* Color screen */
|
||||
SET_BL( context, data->ModeOptions >> 5 ); /* EGA memory size */
|
||||
SET_CX( context, data->FeatureBitsSwitches );
|
||||
break;
|
||||
case 0x20: /* ALTERNATE PRTSC */
|
||||
FIXME("Install Alternate Print Screen - Not Supported\n");
|
||||
|
@ -767,9 +768,9 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
|
|||
switch AL_reg(context) {
|
||||
case 0x00: /* GET DISPLAY COMBINATION CODE */
|
||||
TRACE("Get Display Combination Code\n");
|
||||
AX_reg(context) = 0x001a;
|
||||
BL_reg(context) = 0x08; /* VGA w/ color analog display */
|
||||
BH_reg(context) = 0x00; /* No secondary hardware */
|
||||
SET_AX( context, 0x001a );
|
||||
SET_BL( context, 0x08 ); /* VGA w/ color analog display */
|
||||
SET_BH( context, 0x00 ); /* No secondary hardware */
|
||||
break;
|
||||
case 0x01: /* SET DISPLAY COMBINATION CODE */
|
||||
FIXME("Set Display Combination Code - Not Supported\n");
|
||||
|
@ -785,7 +786,7 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
|
|||
TRACE("Get functionality/state information\n");
|
||||
if (BX_reg(context) == 0x0)
|
||||
{
|
||||
AL_reg(context) = 0x1b;
|
||||
SET_AL( context, 0x1b );
|
||||
/* Copy state information structure to ES:DI */
|
||||
memcpy(CTX_SEG_OFF_TO_LIN(context,context->SegEs,context->Edi),
|
||||
(char *)BIOS_SYS + DOSMEM_GetBiosSysStructOffset(OFF_VIDEOSTATE),sizeof(VIDEOSTATE));
|
||||
|
@ -800,7 +801,7 @@ void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
|
|||
/* There's no reason to really support this */
|
||||
/* is there?....................(A.C.) */
|
||||
TRACE("Just report the video not hercules compatible\n");
|
||||
DX_reg(context) = 0xffff;
|
||||
SET_DX( context, 0xffff );
|
||||
break;
|
||||
|
||||
case 0x4f: /* VESA */
|
||||
|
|
|
@ -51,13 +51,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(int);
|
|||
|
||||
void WINAPI DOSVM_Int16Handler( CONTEXT86 *context )
|
||||
{
|
||||
BYTE ascii, scan;
|
||||
switch AH_reg(context) {
|
||||
|
||||
case 0x00: /* Get Keystroke */
|
||||
/* Returns: AH = Scan code
|
||||
AL = ASCII character */
|
||||
TRACE("Get Keystroke\n");
|
||||
DOSVM_Int16ReadChar(&AL_reg(context), &AH_reg(context), FALSE);
|
||||
DOSVM_Int16ReadChar(&ascii, &scan, FALSE);
|
||||
SET_AL( context, ascii );
|
||||
SET_AH( context, scan );
|
||||
break;
|
||||
|
||||
case 0x01: /* Check for Keystroke */
|
||||
|
@ -65,12 +68,14 @@ void WINAPI DOSVM_Int16Handler( CONTEXT86 *context )
|
|||
/* AH = Scan code */
|
||||
/* AL = ASCII character */
|
||||
TRACE("Check for Keystroke\n");
|
||||
if (!DOSVM_Int16ReadChar(&AL_reg(context), &AH_reg(context), TRUE))
|
||||
if (!DOSVM_Int16ReadChar(&ascii, &scan, TRUE))
|
||||
{
|
||||
SET_ZFLAG(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_AL( context, ascii );
|
||||
SET_AH( context, scan );
|
||||
RESET_ZFLAG(context);
|
||||
}
|
||||
/* don't miss the opportunity to break some tight timing loop in DOS
|
||||
|
@ -79,24 +84,24 @@ void WINAPI DOSVM_Int16Handler( CONTEXT86 *context )
|
|||
break;
|
||||
|
||||
case 0x02: /* Get Shift Flags */
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
|
||||
if (GetAsyncKeyState(VK_RSHIFT))
|
||||
AL_reg(context) |= 0x01;
|
||||
context->Eax |= 0x01;
|
||||
if (GetAsyncKeyState(VK_LSHIFT))
|
||||
AL_reg(context) |= 0x02;
|
||||
context->Eax |= 0x02;
|
||||
if (GetAsyncKeyState(VK_LCONTROL) || GetAsyncKeyState(VK_RCONTROL))
|
||||
AL_reg(context) |= 0x04;
|
||||
context->Eax |= 0x04;
|
||||
if (GetAsyncKeyState(VK_LMENU) || GetAsyncKeyState(VK_RMENU))
|
||||
AL_reg(context) |= 0x08;
|
||||
context->Eax |= 0x08;
|
||||
if (GetAsyncKeyState(VK_SCROLL))
|
||||
AL_reg(context) |= 0x10;
|
||||
context->Eax |= 0x10;
|
||||
if (GetAsyncKeyState(VK_NUMLOCK))
|
||||
AL_reg(context) |= 0x20;
|
||||
context->Eax |= 0x20;
|
||||
if (GetAsyncKeyState(VK_CAPITAL))
|
||||
AL_reg(context) |= 0x40;
|
||||
context->Eax |= 0x40;
|
||||
if (GetAsyncKeyState(VK_INSERT))
|
||||
AL_reg(context) |= 0x80;
|
||||
context->Eax |= 0x80;
|
||||
TRACE("Get Shift Flags: returning 0x%02x\n", AL_reg(context));
|
||||
break;
|
||||
|
||||
|
@ -107,7 +112,7 @@ void WINAPI DOSVM_Int16Handler( CONTEXT86 *context )
|
|||
case 0x09: /* Get Keyboard Functionality */
|
||||
FIXME("Get Keyboard Functionality - Not Supported\n");
|
||||
/* As a temporary measure, say that "nothing" is supported... */
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
break;
|
||||
|
||||
case 0x0a: /* Get Keyboard ID */
|
||||
|
@ -118,7 +123,9 @@ void WINAPI DOSVM_Int16Handler( CONTEXT86 *context )
|
|||
TRACE("Get Enhanced Keystroke - Partially supported\n");
|
||||
/* Returns: AH = Scan code
|
||||
AL = ASCII character */
|
||||
DOSVM_Int16ReadChar(&AL_reg(context), &AH_reg(context), FALSE);
|
||||
DOSVM_Int16ReadChar(&ascii, &scan, FALSE);
|
||||
SET_AL( context, ascii );
|
||||
SET_AH( context, scan );
|
||||
break;
|
||||
|
||||
|
||||
|
@ -127,12 +134,14 @@ void WINAPI DOSVM_Int16Handler( CONTEXT86 *context )
|
|||
/* AH = Scan code */
|
||||
/* AL = ASCII character */
|
||||
TRACE("Check for Enhanced Keystroke - Partially supported\n");
|
||||
if (!DOSVM_Int16ReadChar(&AL_reg(context), &AH_reg(context), TRUE))
|
||||
if (!DOSVM_Int16ReadChar(&ascii, &scan, TRUE))
|
||||
{
|
||||
SET_ZFLAG(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_AL( context, ascii );
|
||||
SET_AH( context, scan );
|
||||
RESET_ZFLAG(context);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -38,13 +38,13 @@ void WINAPI DOSVM_Int17Handler( CONTEXT86 *context )
|
|||
{
|
||||
case 0x01: /* PRINTER - INITIALIZE */
|
||||
FIXME("Initialize Printer - Not Supported\n");
|
||||
AH_reg(context) = 0; /* time out */
|
||||
SET_AH( context, 0 ); /* time out */
|
||||
break;
|
||||
case 0x02: /* PRINTER - GET STATUS */
|
||||
FIXME("Get Printer Status - Not Supported\n");
|
||||
break;
|
||||
default:
|
||||
AH_reg(context) = 0; /* time out */
|
||||
SET_AH( context, 0 ); /* time out */
|
||||
INT_BARF( context, 0x17 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ void WINAPI DOSVM_Int21Handler_Ioctl( CONTEXT86 *context )
|
|||
CX_reg(context), DX_reg(context));
|
||||
if (!CX_reg(context))
|
||||
{
|
||||
AX_reg(context) = 1;
|
||||
SET_AX( context, 1 );
|
||||
SET_CFLAG(context);
|
||||
break;
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ void WINAPI DOSVM_Int21Handler_Ioctl( CONTEXT86 *context )
|
|||
*/
|
||||
void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
||||
{
|
||||
BYTE ascii;
|
||||
RESET_CFLAG(context); /* Not sure if this is a good idea */
|
||||
|
||||
if(AH_reg(context) == 0x0c) /* FLUSH BUFFER AND READ STANDARD INPUT */
|
||||
|
@ -91,7 +92,7 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
|||
if(al != 0x01 && al != 0x06 && al != 0x07 && al != 0x08 && al != 0x0a)
|
||||
return;
|
||||
|
||||
AH_reg(context) = al;
|
||||
SET_AH( context, al );
|
||||
}
|
||||
|
||||
switch(AH_reg(context))
|
||||
|
@ -103,9 +104,10 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
|||
|
||||
case 0x01: /* READ CHARACTER FROM STANDARD INPUT, WITH ECHO */
|
||||
TRACE("DIRECT CHARACTER INPUT WITH ECHO\n");
|
||||
DOSVM_Int16ReadChar(&AL_reg(context), NULL, FALSE);
|
||||
DOSVM_Int16ReadChar(&ascii, NULL, FALSE);
|
||||
SET_AL( context, ascii );
|
||||
DOSVM_PutChar(AL_reg(context));
|
||||
break;
|
||||
break;
|
||||
|
||||
case 0x02: /* WRITE CHARACTER TO STANDARD OUTPUT */
|
||||
TRACE("Write Character to Standard Output\n");
|
||||
|
@ -119,21 +121,20 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
|||
TRACE("Direct Console Input\n");
|
||||
if (scan) {
|
||||
/* return pending scancode */
|
||||
AL_reg(context) = scan;
|
||||
SET_AL( context, scan );
|
||||
RESET_ZFLAG(context);
|
||||
scan = 0;
|
||||
} else {
|
||||
char ascii;
|
||||
if (DOSVM_Int16ReadChar(&ascii,&scan,TRUE)) {
|
||||
DOSVM_Int16ReadChar(&ascii,&scan,FALSE);
|
||||
/* return ASCII code */
|
||||
AL_reg(context) = ascii;
|
||||
SET_AL( context, ascii );
|
||||
RESET_ZFLAG(context);
|
||||
/* return scan code on next call only if ascii==0 */
|
||||
if (ascii) scan = 0;
|
||||
} else {
|
||||
/* nothing pending, clear everything */
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
SET_ZFLAG(context);
|
||||
scan = 0; /* just in case */
|
||||
}
|
||||
|
@ -147,22 +148,24 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
|||
case 0x07: /* DIRECT CHARACTER INPUT WITHOUT ECHO */
|
||||
/* FIXME: Use DOSDEV_Peek/Read(DOSDEV_Console(),...) !! */
|
||||
TRACE("DIRECT CHARACTER INPUT WITHOUT ECHO\n");
|
||||
DOSVM_Int16ReadChar(&AL_reg(context), NULL, FALSE);
|
||||
DOSVM_Int16ReadChar(&ascii, NULL, FALSE);
|
||||
SET_AL( context, ascii );
|
||||
break;
|
||||
|
||||
case 0x08: /* CHARACTER INPUT WITHOUT ECHO */
|
||||
/* FIXME: Use DOSDEV_Peek/Read(DOSDEV_Console(),...) !! */
|
||||
TRACE("CHARACTER INPUT WITHOUT ECHO\n");
|
||||
DOSVM_Int16ReadChar(&AL_reg(context), NULL, FALSE);
|
||||
DOSVM_Int16ReadChar(&ascii, NULL, FALSE);
|
||||
SET_AL( context, ascii );
|
||||
break;
|
||||
|
||||
case 0x0b: /* GET STDIN STATUS */
|
||||
{
|
||||
BIOSDATA *data = BIOS_DATA;
|
||||
if(data->FirstKbdCharPtr == data->NextKbdCharPtr)
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
else
|
||||
AL_reg(context) = 0xff;
|
||||
SET_AL( context, 0xff );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -176,7 +179,7 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
|||
{
|
||||
FARPROC16 addr = DOSVM_GetRMHandler( AL_reg(context) );
|
||||
context->SegEs = SELECTOROF(addr);
|
||||
BX_reg(context) = OFFSETOF(addr);
|
||||
SET_BX( context, OFFSETOF(addr) );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -203,7 +206,7 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
|||
if (!MZ_Exec( context, CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx),
|
||||
AL_reg(context), CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Ebx) ))
|
||||
{
|
||||
AX_reg(context) = GetLastError();
|
||||
SET_AX( context, GetLastError() );
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
break;
|
||||
|
@ -215,7 +218,7 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
|||
|
||||
case 0x4d: /* GET RETURN CODE */
|
||||
TRACE("GET RETURN CODE (ERRORLEVEL)\n");
|
||||
AX_reg(context) = DOSVM_retval;
|
||||
SET_AX( context, DOSVM_retval );
|
||||
DOSVM_retval = 0;
|
||||
break;
|
||||
|
||||
|
@ -228,14 +231,14 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
|||
TRACE("GET CURRENT PROCESS ID (GET PSP ADDRESS)\n");
|
||||
/* FIXME: should we return the original DOS PSP upon */
|
||||
/* Windows startup ? */
|
||||
BX_reg(context) = DOSVM_psp;
|
||||
SET_BX( context, DOSVM_psp );
|
||||
break;
|
||||
|
||||
case 0x52: /* "SYSVARS" - GET LIST OF LISTS */
|
||||
TRACE("SYSVARS - GET LIST OF LISTS\n");
|
||||
{
|
||||
context->SegEs = HIWORD(DOS_LOLSeg);
|
||||
BX_reg(context) = FIELD_OFFSET(DOS_LISTOFLISTS, ptr_first_DPB);
|
||||
SET_BX( context, FIELD_OFFSET(DOS_LISTOFLISTS, ptr_first_DPB) );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -243,7 +246,7 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
|
|||
TRACE("GET CURRENT PSP ADDRESS\n");
|
||||
/* FIXME: should we return the original DOS PSP upon */
|
||||
/* Windows startup ? */
|
||||
BX_reg(context) = DOSVM_psp;
|
||||
SET_BX( context, DOSVM_psp );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -51,8 +51,8 @@ void WINAPI DOSVM_Int33Handler( CONTEXT86 *context )
|
|||
switch (LOWORD(context->Eax)) {
|
||||
case 0x00:
|
||||
TRACE("Reset mouse driver and request status\n");
|
||||
AX_reg(context) = 0xFFFF; /* installed */
|
||||
BX_reg(context) = 3; /* # of buttons */
|
||||
SET_AX( context, 0xFFFF ); /* installed */
|
||||
SET_BX( context, 3 ); /* # of buttons */
|
||||
memset( &mouse_info, 0, sizeof(mouse_info) );
|
||||
/* Set the default mickey/pixel ratio */
|
||||
mouse_info.HMPratio = 8;
|
||||
|
@ -67,9 +67,9 @@ void WINAPI DOSVM_Int33Handler( CONTEXT86 *context )
|
|||
case 0x03:
|
||||
TRACE("Return mouse position and button status: (%ld,%ld) and %ld\n",
|
||||
mouse_info.x, mouse_info.y, mouse_info.but);
|
||||
BX_reg(context) = mouse_info.but;
|
||||
CX_reg(context) = mouse_info.x;
|
||||
DX_reg(context) = mouse_info.y;
|
||||
SET_BX( context, mouse_info.but );
|
||||
SET_CX( context, mouse_info.x );
|
||||
SET_DX( context, mouse_info.y );
|
||||
break;
|
||||
case 0x04:
|
||||
FIXME("Position mouse cursor\n");
|
||||
|
@ -78,17 +78,17 @@ void WINAPI DOSVM_Int33Handler( CONTEXT86 *context )
|
|||
TRACE("Return Mouse button press Information for %s mouse button\n",
|
||||
BX_reg(context) ? "right" : "left");
|
||||
if (BX_reg(context)) {
|
||||
BX_reg(context) = mouse_info.rbcount;
|
||||
SET_BX( context, mouse_info.rbcount );
|
||||
mouse_info.rbcount = 0;
|
||||
CX_reg(context) = mouse_info.rlastx;
|
||||
DX_reg(context) = mouse_info.rlasty;
|
||||
SET_CX( context, mouse_info.rlastx );
|
||||
SET_DX( context, mouse_info.rlasty );
|
||||
} else {
|
||||
BX_reg(context) = mouse_info.lbcount;
|
||||
SET_BX( context, mouse_info.lbcount );
|
||||
mouse_info.lbcount = 0;
|
||||
CX_reg(context) = mouse_info.llastx;
|
||||
DX_reg(context) = mouse_info.llasty;
|
||||
SET_CX( context, mouse_info.llastx );
|
||||
SET_DX( context, mouse_info.llasty );
|
||||
}
|
||||
AX_reg(context) = mouse_info.but;
|
||||
SET_AX( context, mouse_info.but );
|
||||
break;
|
||||
case 0x07:
|
||||
FIXME("Define horizontal mouse cursor range\n");
|
||||
|
@ -104,8 +104,8 @@ void WINAPI DOSVM_Int33Handler( CONTEXT86 *context )
|
|||
break;
|
||||
case 0x0B:
|
||||
TRACE("Read Mouse motion counters\n");
|
||||
CX_reg(context) = (mouse_info.x - mouse_info.oldx) * (mouse_info.HMPratio / 8);
|
||||
DX_reg(context) = (mouse_info.y - mouse_info.oldy) * (mouse_info.VMPratio / 8);
|
||||
SET_CX( context, (mouse_info.x - mouse_info.oldx) * (mouse_info.HMPratio / 8) );
|
||||
SET_DX( context, (mouse_info.y - mouse_info.oldy) * (mouse_info.VMPratio / 8) );
|
||||
mouse_info.oldx = mouse_info.x;
|
||||
mouse_info.oldy = mouse_info.y;
|
||||
break;
|
||||
|
|
|
@ -118,20 +118,20 @@ static void EMS_alloc( CONTEXT86 *context )
|
|||
hindex++;
|
||||
|
||||
if(hindex == EMS_MAX_HANDLES) {
|
||||
AH_reg(context) = 0x85; /* status: no more handles available */
|
||||
SET_AH( context, 0x85 ); /* status: no more handles available */
|
||||
} else {
|
||||
int pages = BX_reg(context);
|
||||
void *buffer = HeapAlloc( GetProcessHeap(), 0, pages * EMS_PAGE_SIZE );
|
||||
|
||||
if(!buffer) {
|
||||
AH_reg(context) = 0x88; /* status: insufficient pages available */
|
||||
SET_AH( context, 0x88 ); /* status: insufficient pages available */
|
||||
} else {
|
||||
EMS_record->handle[hindex].address = buffer;
|
||||
EMS_record->handle[hindex].pages = pages;
|
||||
EMS_record->used_pages += pages;
|
||||
|
||||
DX_reg(context) = hindex; /* handle to allocated memory*/
|
||||
AH_reg(context) = 0; /* status: ok */
|
||||
SET_DX( context, hindex ); /* handle to allocated memory*/
|
||||
SET_AH( context, 0 ); /* status: ok */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ static void EMS_access_name( CONTEXT86 *context )
|
|||
char *ptr;
|
||||
int hindex = DX_reg(context);
|
||||
if(hindex < 0 || hindex >= EMS_MAX_HANDLES) {
|
||||
AH_reg(context) = 0x83; /* invalid handle */
|
||||
SET_AH( context, 0x83 ); /* invalid handle */
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -154,13 +154,13 @@ static void EMS_access_name( CONTEXT86 *context )
|
|||
case 0x00: /* get name */
|
||||
ptr = PTR_REAL_TO_LIN(context->SegEs, DI_reg(context));
|
||||
memcpy(ptr, EMS_record->handle[hindex].name, 8);
|
||||
AH_reg(context) = 0;
|
||||
SET_AH( context, 0 );
|
||||
break;
|
||||
|
||||
case 0x01: /* set name */
|
||||
ptr = PTR_REAL_TO_LIN(context->SegDs, SI_reg(context));
|
||||
memcpy(EMS_record->handle[hindex].name, ptr, 8);
|
||||
AH_reg(context) = 0;
|
||||
SET_AH( context, 0 );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -241,7 +241,7 @@ static void EMS_map_multiple( CONTEXT86 *context )
|
|||
status = 0x8f; /* status: undefined subfunction */
|
||||
}
|
||||
|
||||
AH_reg(context) = status;
|
||||
SET_AH( context, status );
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -255,12 +255,12 @@ static void EMS_free( CONTEXT86 *context )
|
|||
int i;
|
||||
|
||||
if(hindex < 0 || hindex >= EMS_MAX_HANDLES) {
|
||||
AH_reg(context) = 0x83; /* status: invalid handle */
|
||||
SET_AH( context, 0x83 ); /* status: invalid handle */
|
||||
return;
|
||||
}
|
||||
|
||||
if(!EMS_record->handle[hindex].address) {
|
||||
AH_reg(context) = 0; /* status: ok */
|
||||
SET_AH( context, 0 ); /* status: ok */
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ static void EMS_free( CONTEXT86 *context )
|
|||
HeapFree( GetProcessHeap(), 0, EMS_record->handle[hindex].address );
|
||||
EMS_record->handle[hindex].address = 0;
|
||||
|
||||
AH_reg(context) = 0; /* status: ok */
|
||||
SET_AH( context, 0 ); /* status: ok */
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -293,7 +293,7 @@ static void EMS_save_context( CONTEXT86 *context )
|
|||
EMS_record->mapping_save_area[h][i].logical_page = EMS_record->mapping[i].logical_page;
|
||||
}
|
||||
|
||||
AX_reg(context) = 0; /* status: ok */
|
||||
SET_AX( context, 0 ); /* status: ok */
|
||||
}
|
||||
|
||||
|
||||
|
@ -312,12 +312,12 @@ static void EMS_restore_context( CONTEXT86 *context )
|
|||
int logical_page = EMS_record->mapping_save_area[handle][i].logical_page;
|
||||
|
||||
if(EMS_map( i, hindex, logical_page )) {
|
||||
AX_reg(context) = 0x8e; /* status: restore of mapping context failed */
|
||||
SET_AX( context, 0x8e ); /* status: restore of mapping context failed */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AX_reg(context) = 0; /* status: ok */
|
||||
SET_AX( context, 0 ); /* status: ok */
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -330,23 +330,23 @@ void WINAPI DOSVM_Int67Handler( CONTEXT86 *context )
|
|||
switch AH_reg(context) {
|
||||
|
||||
case 0x40: /* EMS - GET MANAGER STATUS */
|
||||
AH_reg(context) = 0; /* status: ok */
|
||||
SET_AH( context, 0 ); /* status: ok */
|
||||
break;
|
||||
|
||||
case 0x41: /* EMS - GET PAGE FRAME SEGMENT */
|
||||
EMS_init();
|
||||
BX_reg(context) = EMS_record->frame_selector; /* segment of page frame */
|
||||
AH_reg(context) = 0; /* status: ok */
|
||||
SET_BX( context, EMS_record->frame_selector ); /* segment of page frame */
|
||||
SET_AH( context, 0 ); /* status: ok */
|
||||
break;
|
||||
|
||||
case 0x42: /* EMS - GET NUMBER OF PAGES */
|
||||
EMS_init();
|
||||
/* unallocated 16k pages */
|
||||
BX_reg(context) = EMS_MAX_PAGES - EMS_record->used_pages;
|
||||
SET_BX( context, EMS_MAX_PAGES - EMS_record->used_pages );
|
||||
/* total number of 16k pages */
|
||||
DX_reg(context) = EMS_MAX_PAGES;
|
||||
SET_DX( context, EMS_MAX_PAGES );
|
||||
/* status: ok */
|
||||
AH_reg(context) = 0;
|
||||
SET_AH( context, 0 );
|
||||
break;
|
||||
|
||||
case 0x43: /* EMS - GET HANDLE AND ALLOCATE MEMORY */
|
||||
|
@ -356,7 +356,7 @@ void WINAPI DOSVM_Int67Handler( CONTEXT86 *context )
|
|||
|
||||
case 0x44: /* EMS - MAP MEMORY */
|
||||
EMS_init();
|
||||
AH_reg(context) = EMS_map( AL_reg(context), DX_reg(context), BX_reg(context) );
|
||||
SET_AH( context, EMS_map( AL_reg(context), DX_reg(context), BX_reg(context) ) );
|
||||
break;
|
||||
|
||||
case 0x45: /* EMS - RELEASE HANDLE AND MEMORY */
|
||||
|
@ -365,8 +365,8 @@ void WINAPI DOSVM_Int67Handler( CONTEXT86 *context )
|
|||
break;
|
||||
|
||||
case 0x46: /* EMS - GET EMM VERSION */
|
||||
AL_reg(context) = 0x40; /* version 4.0 */
|
||||
AH_reg(context) = 0; /* status: ok */
|
||||
SET_AL( context, 0x40 ); /* version 4.0 */
|
||||
SET_AH( context, 0 ); /* status: ok */
|
||||
break;
|
||||
|
||||
case 0x47: /* EMS - SAVE MAPPING CONTEXT */
|
||||
|
@ -385,8 +385,8 @@ void WINAPI DOSVM_Int67Handler( CONTEXT86 *context )
|
|||
break;
|
||||
|
||||
case 0x4b: /* EMS - GET NUMBER OF EMM HANDLES */
|
||||
BX_reg(context) = EMS_MAX_HANDLES; /* EMM handles */
|
||||
AH_reg(context) = 0; /* status: ok */
|
||||
SET_BX( context, EMS_MAX_HANDLES ); /* EMM handles */
|
||||
SET_AH( context, 0 ); /* status: ok */
|
||||
break;
|
||||
|
||||
case 0x4c: /* EMS - GET PAGES OWNED BY HANDLE */
|
||||
|
@ -423,11 +423,11 @@ void WINAPI DOSVM_Int67Handler( CONTEXT86 *context )
|
|||
if(AL_reg(context) == 0x01) {
|
||||
EMS_init();
|
||||
/* unallocated raw pages */
|
||||
BX_reg(context) = EMS_MAX_PAGES - EMS_record->used_pages;
|
||||
SET_BX( context, EMS_MAX_PAGES - EMS_record->used_pages );
|
||||
/* total number raw pages */
|
||||
DX_reg(context) = EMS_MAX_PAGES;
|
||||
SET_DX( context, EMS_MAX_PAGES );
|
||||
/* status: ok */
|
||||
AH_reg(context) = 0;
|
||||
SET_AH( context, 0 );
|
||||
} else
|
||||
INT_BARF(context,0x67);
|
||||
break;
|
||||
|
@ -454,7 +454,7 @@ void WINAPI EMS_Ioctl_Handler( CONTEXT86 *context )
|
|||
switch AL_reg(context) {
|
||||
case 0x00: /* IOCTL - GET DEVICE INFORMATION */
|
||||
RESET_CFLAG(context); /* operation was successful */
|
||||
DX_reg(context) = 0x4080; /* bit 14 (support ioctl read) and
|
||||
SET_DX( context, 0x4080 ); /* bit 14 (support ioctl read) and
|
||||
* bit 7 (is_device) */
|
||||
break;
|
||||
|
||||
|
@ -471,7 +471,7 @@ void WINAPI EMS_Ioctl_Handler( CONTEXT86 *context )
|
|||
|
||||
case 0x07: /* IOCTL - GET OUTPUT STATUS */
|
||||
RESET_CFLAG(context); /* operation was successful */
|
||||
AL_reg(context) = 0xff; /* device is ready */
|
||||
SET_AL( context, 0xff ); /* device is ready */
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -61,9 +61,9 @@ void WINAPI XMS_Handler( CONTEXT86 *context )
|
|||
{
|
||||
case 0x00: /* Get XMS version number */
|
||||
TRACE("get XMS version number\n");
|
||||
AX_reg(context) = 0x0200; /* 2.0 */
|
||||
BX_reg(context) = 0x0000; /* internal revision */
|
||||
DX_reg(context) = 0x0001; /* HMA exists */
|
||||
SET_AX( context, 0x0200 ); /* 2.0 */
|
||||
SET_BX( context, 0x0000 ); /* internal revision */
|
||||
SET_DX( context, 0x0001 ); /* HMA exists */
|
||||
break;
|
||||
case 0x08: /* Query Free Extended Memory */
|
||||
{
|
||||
|
@ -71,25 +71,25 @@ void WINAPI XMS_Handler( CONTEXT86 *context )
|
|||
|
||||
TRACE("query free extended memory\n");
|
||||
GlobalMemoryStatus( &status );
|
||||
AX_reg(context) = DX_reg(context) = status.dwAvailVirtual >> 10;
|
||||
SET_DX( context, status.dwAvailVirtual >> 10 );
|
||||
SET_AX( context, status.dwAvailVirtual >> 10 );
|
||||
TRACE("returning largest %dK, total %dK\n", AX_reg(context), DX_reg(context));
|
||||
}
|
||||
break;
|
||||
case 0x09: /* Allocate Extended Memory Block */
|
||||
TRACE("allocate extended memory block (%dK)\n",
|
||||
DX_reg(context));
|
||||
DX_reg(context) = GlobalAlloc16(GMEM_MOVEABLE,
|
||||
(DWORD)DX_reg(context)<<10);
|
||||
AX_reg(context) = DX_reg(context) ? 1 : 0;
|
||||
if (!DX_reg(context)) BL_reg(context) = 0xA0; /* out of memory */
|
||||
SET_DX( context, GlobalAlloc16(GMEM_MOVEABLE, (DWORD)DX_reg(context)<<10) );
|
||||
SET_AX( context, DX_reg(context) ? 1 : 0 );
|
||||
if (!DX_reg(context)) SET_BL( context, 0xA0 ); /* out of memory */
|
||||
break;
|
||||
case 0x0a: /* Free Extended Memory Block */
|
||||
TRACE("free extended memory block %04x\n",DX_reg(context));
|
||||
if(!DX_reg(context) || GlobalFree16(DX_reg(context))) {
|
||||
AX_reg(context) = 0; /* failure */
|
||||
BL_reg(context) = 0xa2; /* invalid handle */
|
||||
SET_AX( context, 0 ); /* failure */
|
||||
SET_BL( context, 0xa2 ); /* invalid handle */
|
||||
} else
|
||||
AX_reg(context) = 1; /* success */
|
||||
SET_AX( context, 1 ); /* success */
|
||||
break;
|
||||
case 0x0b: /* Move Extended Memory Block */
|
||||
{
|
||||
|
@ -106,8 +106,8 @@ void WINAPI XMS_Handler( CONTEXT86 *context )
|
|||
}
|
||||
default:
|
||||
INT_BARF( context, 0x31 );
|
||||
AX_reg(context) = 0x0000; /* failure */
|
||||
BL_reg(context) = 0x80; /* function not implemented */
|
||||
SET_AX( context, 0x0000 ); /* failure */
|
||||
SET_BL( context, 0x80 ); /* function not implemented */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -349,8 +349,8 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context )
|
|||
|
||||
if (call->arg_types[0] & ARG_REGISTER)
|
||||
DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
|
||||
AX_reg(context), BX_reg(context), CX_reg(context),
|
||||
DX_reg(context), SI_reg(context), DI_reg(context),
|
||||
(WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
|
||||
(WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
|
||||
(WORD)context->SegEs, context->EFlags );
|
||||
|
||||
SYSLEVEL_CheckNotLevel( 2 );
|
||||
|
@ -379,8 +379,8 @@ void RELAY_DebugCallFrom16Ret( CONTEXT86 *context, int ret_val )
|
|||
DPRINTF("retval=none ret=%04x:%04x ds=%04x\n",
|
||||
(WORD)context->SegCs, LOWORD(context->Eip), (WORD)context->SegDs);
|
||||
DPRINTF(" AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
|
||||
AX_reg(context), BX_reg(context), CX_reg(context),
|
||||
DX_reg(context), SI_reg(context), DI_reg(context),
|
||||
(WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
|
||||
(WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
|
||||
(WORD)context->SegEs, context->EFlags );
|
||||
}
|
||||
else if (call->arg_types[0] & ARG_RET16)
|
||||
|
@ -427,9 +427,9 @@ void RELAY_DebugCallTo16( LPVOID target, int nb_args, BOOL reg_func )
|
|||
DPRINTF(") ss:sp=%04x:%04x", SELECTOROF(teb->cur_stack),
|
||||
OFFSETOF(teb->cur_stack) );
|
||||
DPRINTF(" ax=%04x bx=%04x cx=%04x dx=%04x si=%04x di=%04x bp=%04x es=%04x fs=%04x\n",
|
||||
AX_reg(context), BX_reg(context), CX_reg(context),
|
||||
DX_reg(context), SI_reg(context), DI_reg(context),
|
||||
BP_reg(context), (WORD)context->SegEs, (WORD)context->SegFs );
|
||||
(WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
|
||||
(WORD)context->Edx, (WORD)context->Esi, (WORD)context->Edi,
|
||||
(WORD)context->Ebp, (WORD)context->SegEs, (WORD)context->SegFs );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -468,8 +468,8 @@ void RELAY_DebugCallTo16Ret( BOOL reg_func, int ret_val )
|
|||
SELECTOROF(NtCurrentTeb()->cur_stack),
|
||||
OFFSETOF(NtCurrentTeb()->cur_stack));
|
||||
DPRINTF(" ax=%04x bx=%04x cx=%04x dx=%04x bp=%04x sp=%04x\n",
|
||||
AX_reg(context), BX_reg(context), CX_reg(context),
|
||||
DX_reg(context), BP_reg(context), LOWORD(context->Esp));
|
||||
(WORD)context->Eax, (WORD)context->Ebx, (WORD)context->Ecx,
|
||||
(WORD)context->Edx, (WORD)context->Ebp, (WORD)context->Esp );
|
||||
}
|
||||
|
||||
SYSLEVEL_CheckNotLevel( 2 );
|
||||
|
|
|
@ -330,14 +330,16 @@ void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT86 *context) {
|
|||
if (max!=ret->dll->funs[ret->ordinal].nrofargs)
|
||||
DPRINTF(" ...");
|
||||
DPRINTF(") retval = %04x:%04x ret=%04x:%04x\n",
|
||||
DX_reg(context),AX_reg(context),HIWORD(ret->origreturn),LOWORD(ret->origreturn)
|
||||
(WORD)context->Edx,(WORD)context->Eax,
|
||||
HIWORD(ret->origreturn),LOWORD(ret->origreturn)
|
||||
);
|
||||
HeapFree(GetProcessHeap(),0,ret->args);
|
||||
ret->args = NULL;
|
||||
} else
|
||||
DPRINTF("RET %s.%ld: %s() retval = %04x:%04x ret=%04x:%04x\n",
|
||||
ret->dll->name,ret->ordinal,ret->dll->funs[ret->ordinal].name,
|
||||
DX_reg(context),AX_reg(context),HIWORD(ret->origreturn),LOWORD(ret->origreturn)
|
||||
(WORD)context->Edx,(WORD)context->Eax,
|
||||
HIWORD(ret->origreturn),LOWORD(ret->origreturn)
|
||||
);
|
||||
ret->origreturn = NULL; /* mark as empty */
|
||||
}
|
||||
|
|
|
@ -163,9 +163,6 @@ extern WORD DOSMEM_xms_seg;
|
|||
extern WORD DOSMEM_dpmi_seg;
|
||||
extern WORD DOSMEM_dpmi_sel;
|
||||
|
||||
extern DWORD DOS_LOLSeg;
|
||||
extern struct _DOS_LISTOFLISTS * DOSMEM_LOL();
|
||||
|
||||
extern BOOL DOSMEM_Init(BOOL);
|
||||
extern void DOSMEM_Tick(WORD timer);
|
||||
extern WORD DOSMEM_AllocSelector(WORD);
|
||||
|
@ -277,4 +274,45 @@ extern char IO_pp_init(void);
|
|||
LOWORD((context)->Ecx), LOWORD((context)->Edx), LOWORD((context)->Esi), \
|
||||
LOWORD((context)->Edi), (WORD)(context)->SegDs, (WORD)(context)->SegEs )
|
||||
|
||||
/* Macros for easier access to i386 context registers */
|
||||
|
||||
#define AX_reg(context) ((WORD)(context)->Eax)
|
||||
#define BX_reg(context) ((WORD)(context)->Ebx)
|
||||
#define CX_reg(context) ((WORD)(context)->Ecx)
|
||||
#define DX_reg(context) ((WORD)(context)->Edx)
|
||||
#define SI_reg(context) ((WORD)(context)->Esi)
|
||||
#define DI_reg(context) ((WORD)(context)->Edi)
|
||||
|
||||
#define AL_reg(context) ((BYTE)(context)->Eax)
|
||||
#define AH_reg(context) ((BYTE)((context)->Eax >> 8))
|
||||
#define BL_reg(context) ((BYTE)(context)->Ebx)
|
||||
#define BH_reg(context) ((BYTE)((context)->Ebx >> 8))
|
||||
#define CL_reg(context) ((BYTE)(context)->Ecx)
|
||||
#define CH_reg(context) ((BYTE)((context)->Ecx >> 8))
|
||||
#define DL_reg(context) ((BYTE)(context)->Edx)
|
||||
#define DH_reg(context) ((BYTE)((context)->Edx >> 8))
|
||||
|
||||
#define SET_CFLAG(context) ((context)->EFlags |= 0x0001)
|
||||
#define RESET_CFLAG(context) ((context)->EFlags &= ~0x0001)
|
||||
#define SET_ZFLAG(context) ((context)->EFlags |= 0x0040)
|
||||
#define RESET_ZFLAG(context) ((context)->EFlags &= ~0x0040)
|
||||
#define ISV86(context) ((context)->EFlags & 0x00020000)
|
||||
|
||||
#define SET_AX(context,val) ((context)->Eax = ((context)->Eax & ~0xffff) | (WORD)(val))
|
||||
#define SET_BX(context,val) ((context)->Ebx = ((context)->Ebx & ~0xffff) | (WORD)(val))
|
||||
#define SET_CX(context,val) ((context)->Ecx = ((context)->Ecx & ~0xffff) | (WORD)(val))
|
||||
#define SET_DX(context,val) ((context)->Edx = ((context)->Edx & ~0xffff) | (WORD)(val))
|
||||
#define SET_SI(context,val) ((context)->Esi = ((context)->Esi & ~0xffff) | (WORD)(val))
|
||||
#define SET_DI(context,val) ((context)->Edi = ((context)->Edi & ~0xffff) | (WORD)(val))
|
||||
|
||||
#define SET_AL(context,val) ((context)->Eax = ((context)->Eax & ~0xff) | (BYTE)(val))
|
||||
#define SET_BL(context,val) ((context)->Ebx = ((context)->Ebx & ~0xff) | (BYTE)(val))
|
||||
#define SET_CL(context,val) ((context)->Ecx = ((context)->Ecx & ~0xff) | (BYTE)(val))
|
||||
#define SET_DL(context,val) ((context)->Edx = ((context)->Edx & ~0xff) | (BYTE)(val))
|
||||
|
||||
#define SET_AH(context,val) ((context)->Eax = ((context)->Eax & ~0xff00) | (((BYTE)(val)) << 8))
|
||||
#define SET_BH(context,val) ((context)->Ebx = ((context)->Ebx & ~0xff00) | (((BYTE)(val)) << 8))
|
||||
#define SET_CH(context,val) ((context)->Ecx = ((context)->Ecx & ~0xff00) | (((BYTE)(val)) << 8))
|
||||
#define SET_DH(context,val) ((context)->Edx = ((context)->Edx & ~0xff00) | (((BYTE)(val)) << 8))
|
||||
|
||||
#endif /* __WINE_MISCEMU_H */
|
||||
|
|
|
@ -1084,32 +1084,6 @@ typedef CONTEXT *PCONTEXT;
|
|||
|
||||
#ifdef __WINE__
|
||||
|
||||
/* Macros for easier access to i386 context registers */
|
||||
|
||||
#define AX_reg(context) (*(WORD*)&(context)->Eax)
|
||||
#define BX_reg(context) (*(WORD*)&(context)->Ebx)
|
||||
#define CX_reg(context) (*(WORD*)&(context)->Ecx)
|
||||
#define DX_reg(context) (*(WORD*)&(context)->Edx)
|
||||
#define SI_reg(context) (*(WORD*)&(context)->Esi)
|
||||
#define DI_reg(context) (*(WORD*)&(context)->Edi)
|
||||
#define BP_reg(context) (*(WORD*)&(context)->Ebp)
|
||||
|
||||
#define AL_reg(context) (*(BYTE*)&(context)->Eax)
|
||||
#define AH_reg(context) (*((BYTE*)&(context)->Eax + 1))
|
||||
#define BL_reg(context) (*(BYTE*)&(context)->Ebx)
|
||||
#define BH_reg(context) (*((BYTE*)&(context)->Ebx + 1))
|
||||
#define CL_reg(context) (*(BYTE*)&(context)->Ecx)
|
||||
#define CH_reg(context) (*((BYTE*)&(context)->Ecx + 1))
|
||||
#define DL_reg(context) (*(BYTE*)&(context)->Edx)
|
||||
#define DH_reg(context) (*((BYTE*)&(context)->Edx + 1))
|
||||
|
||||
#define SET_CFLAG(context) ((context)->EFlags |= 0x0001)
|
||||
#define RESET_CFLAG(context) ((context)->EFlags &= ~0x0001)
|
||||
#define SET_ZFLAG(context) ((context)->EFlags |= 0x0040)
|
||||
#define RESET_ZFLAG(context) ((context)->EFlags &= ~0x0040)
|
||||
#define ISV86(context) ((context)->EFlags & 0x00020000)
|
||||
|
||||
|
||||
/* Macros to retrieve the current context */
|
||||
|
||||
#ifdef __i386__
|
||||
|
|
|
@ -1135,7 +1135,7 @@ void WINAPI SwitchStackBack16( CONTEXT86 *context )
|
|||
|
||||
/* Pop bp from the previous stack */
|
||||
|
||||
BP_reg(context) = *(WORD *)MapSL(pData->old_ss_sp);
|
||||
context->Ebp = (context->Ebp & ~0xffff) | *(WORD *)MapSL(pData->old_ss_sp);
|
||||
pData->old_ss_sp += sizeof(WORD);
|
||||
|
||||
/* Switch back to the old stack */
|
||||
|
|
|
@ -169,8 +169,7 @@ static void call_timer_proc16( WORD timer )
|
|||
context.Eip = OFFSETOF( proc );
|
||||
context.Ebp = OFFSETOF( NtCurrentTeb()->cur_stack )
|
||||
+ (WORD)&((STACK16FRAME*)0)->bp;
|
||||
|
||||
AX_reg( &context ) = timer;
|
||||
context.Eax = timer;
|
||||
|
||||
wine_call_to_16_regs_short( &context, 0 );
|
||||
}
|
||||
|
@ -247,4 +246,3 @@ void WINAPI Restore80x87State16( const char *ptr )
|
|||
__asm__(".byte 0x66; frstor %0" : : "m" (ptr) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -91,8 +91,6 @@ WORD DOSMEM_xms_seg;
|
|||
WORD DOSMEM_dpmi_seg;
|
||||
WORD DOSMEM_dpmi_sel;
|
||||
|
||||
DWORD DOS_LOLSeg;
|
||||
|
||||
/***********************************************************************
|
||||
* DOSMEM_MemoryTop
|
||||
*
|
||||
|
|
70
msdos/dpmi.c
70
msdos/dpmi.c
|
@ -344,8 +344,8 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
|
|||
}
|
||||
else
|
||||
{
|
||||
CX_reg(context) = HIWORD(W32S_WINE2APP(dw));
|
||||
DX_reg(context) = LOWORD(W32S_WINE2APP(dw));
|
||||
SET_CX( context, HIWORD(W32S_WINE2APP(dw)) );
|
||||
SET_DX( context, LOWORD(W32S_WINE2APP(dw)) );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -373,9 +373,9 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
|
|||
|
||||
case 0x000a: /* Allocate selector alias */
|
||||
TRACE("allocate selector alias (0x%04x)\n",BX_reg(context));
|
||||
if (!(AX_reg(context) = AllocCStoDSAlias16( BX_reg(context) )))
|
||||
if (!SET_AX( context, AllocCStoDSAlias16( BX_reg(context) )))
|
||||
{
|
||||
AX_reg(context) = 0x8011; /* descriptor unavailable */
|
||||
SET_AX( context, 0x8011 ); /* descriptor unavailable */
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
break;
|
||||
|
@ -401,18 +401,18 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
|
|||
|
||||
case 0x000d: /* Allocate specific LDT descriptor */
|
||||
FIXME("allocate descriptor (0x%04x), stub!\n",BX_reg(context));
|
||||
AX_reg(context) = 0x8011; /* descriptor unavailable */
|
||||
SET_AX( context, 0x8011 ); /* descriptor unavailable */
|
||||
SET_CFLAG(context);
|
||||
break;
|
||||
case 0x0100: /* Allocate DOS memory block */
|
||||
TRACE("allocate DOS memory block (0x%x paragraphs)\n",BX_reg(context));
|
||||
dw = GlobalDOSAlloc16((DWORD)BX_reg(context)<<4);
|
||||
if (dw) {
|
||||
AX_reg(context) = HIWORD(dw);
|
||||
DX_reg(context) = LOWORD(dw);
|
||||
SET_AX( context, HIWORD(dw) );
|
||||
SET_DX( context, LOWORD(dw) );
|
||||
} else {
|
||||
AX_reg(context) = 0x0008; /* insufficient memory */
|
||||
BX_reg(context) = DOSMEM_Available()>>4;
|
||||
SET_AX( context, 0x0008 ); /* insufficient memory */
|
||||
SET_BX( context, DOSMEM_Available()>>4 );
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
break;
|
||||
|
@ -420,7 +420,7 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
|
|||
TRACE("free DOS memory block (0x%04x)\n",DX_reg(context));
|
||||
dw = GlobalDOSFree16(DX_reg(context));
|
||||
if (!dw) {
|
||||
AX_reg(context) = 0x0009; /* memory block address invalid */
|
||||
SET_AX( context, 0x0009 ); /* memory block address invalid */
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
break;
|
||||
|
@ -436,8 +436,8 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
|
|||
case 0x0204: /* Get protected mode interrupt vector */
|
||||
TRACE("get protected mode interrupt handler (0x%02x), stub!\n",BL_reg(context));
|
||||
dw = (DWORD)INT_GetPMHandler( BL_reg(context) );
|
||||
CX_reg(context) = HIWORD(dw);
|
||||
DX_reg(context) = LOWORD(dw);
|
||||
SET_CX( context, HIWORD(dw) );
|
||||
SET_DX( context, LOWORD(dw) );
|
||||
break;
|
||||
|
||||
case 0x0205: /* Set protected mode interrupt vector */
|
||||
|
@ -470,23 +470,23 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
|
|||
case 0x0305: /* Get State Save/Restore Addresses */
|
||||
TRACE("get state save/restore addresses\n");
|
||||
/* we probably won't need this kind of state saving */
|
||||
AX_reg(context) = 0;
|
||||
SET_AX( context, 0 );
|
||||
/* real mode: just point to the lret */
|
||||
BX_reg(context) = DOSMEM_wrap_seg;
|
||||
SET_BX( context, DOSMEM_wrap_seg );
|
||||
context->Ecx = 2;
|
||||
/* protected mode: don't have any handler yet... */
|
||||
FIXME("no protected-mode dummy state save/restore handler yet\n");
|
||||
SI_reg(context) = 0;
|
||||
SET_SI( context, 0 );
|
||||
context->Edi = 0;
|
||||
break;
|
||||
|
||||
case 0x0306: /* Get Raw Mode Switch Addresses */
|
||||
TRACE("get raw mode switch addresses\n");
|
||||
/* real mode, point to standard DPMI return wrapper */
|
||||
BX_reg(context) = DOSMEM_wrap_seg;
|
||||
SET_BX( context, DOSMEM_wrap_seg );
|
||||
context->Ecx = 0;
|
||||
/* protected mode, point to DPMI call wrapper */
|
||||
SI_reg(context) = DOSMEM_dpmi_sel;
|
||||
SET_SI( context, DOSMEM_dpmi_sel );
|
||||
context->Edi = 8; /* offset of the INT 0x31 call */
|
||||
break;
|
||||
case 0x0400: /* Get DPMI version */
|
||||
|
@ -495,10 +495,10 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
|
|||
SYSTEM_INFO si;
|
||||
|
||||
GetSystemInfo(&si);
|
||||
AX_reg(context) = 0x005a; /* DPMI version 0.90 */
|
||||
BX_reg(context) = 0x0005; /* Flags: 32-bit, virtual memory */
|
||||
CL_reg(context) = si.wProcessorLevel;
|
||||
DX_reg(context) = 0x0102; /* Master/slave interrupt controller base*/
|
||||
SET_AX( context, 0x005a ); /* DPMI version 0.90 */
|
||||
SET_BX( context, 0x0005 ); /* Flags: 32-bit, virtual memory */
|
||||
SET_CL( context, si.wProcessorLevel );
|
||||
SET_DX( context, 0x0102 ); /* Master/slave interrupt controller base*/
|
||||
break;
|
||||
}
|
||||
case 0x0500: /* Get free memory information */
|
||||
|
@ -519,11 +519,13 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
|
|||
TRACE("allocate memory block (%ld)\n",MAKELONG(CX_reg(context),BX_reg(context)));
|
||||
if (!(ptr = (BYTE *)DPMI_xalloc(MAKELONG(CX_reg(context), BX_reg(context)))))
|
||||
{
|
||||
AX_reg(context) = 0x8012; /* linear memory not available */
|
||||
SET_AX( context, 0x8012 ); /* linear memory not available */
|
||||
SET_CFLAG(context);
|
||||
} else {
|
||||
BX_reg(context) = SI_reg(context) = HIWORD(W32S_WINE2APP(ptr));
|
||||
CX_reg(context) = DI_reg(context) = LOWORD(W32S_WINE2APP(ptr));
|
||||
SET_BX( context, HIWORD(W32S_WINE2APP(ptr)) );
|
||||
SET_CX( context, LOWORD(W32S_WINE2APP(ptr)) );
|
||||
SET_SI( context, HIWORD(W32S_WINE2APP(ptr)) );
|
||||
SET_DI( context, LOWORD(W32S_WINE2APP(ptr)) );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -541,11 +543,13 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
|
|||
(void *)W32S_APP2WINE(MAKELONG(DI_reg(context),SI_reg(context))),
|
||||
MAKELONG(CX_reg(context),BX_reg(context)))))
|
||||
{
|
||||
AX_reg(context) = 0x8012; /* linear memory not available */
|
||||
SET_AX( context, 0x8012 ); /* linear memory not available */
|
||||
SET_CFLAG(context);
|
||||
} else {
|
||||
BX_reg(context) = SI_reg(context) = HIWORD(W32S_WINE2APP(ptr));
|
||||
CX_reg(context) = DI_reg(context) = LOWORD(W32S_WINE2APP(ptr));
|
||||
SET_BX( context, HIWORD(W32S_WINE2APP(ptr)) );
|
||||
SET_CX( context, LOWORD(W32S_WINE2APP(ptr)) );
|
||||
SET_SI( context, HIWORD(W32S_WINE2APP(ptr)) );
|
||||
SET_DI( context, LOWORD(W32S_WINE2APP(ptr)) );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -571,8 +575,8 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
|
|||
|
||||
case 0x0604: /* Get page size */
|
||||
TRACE("get pagesize\n");
|
||||
BX_reg(context) = 0;
|
||||
CX_reg(context) = getpagesize();
|
||||
SET_BX( context, 0 );
|
||||
SET_CX( context, getpagesize() );
|
||||
break;
|
||||
|
||||
case 0x0702: /* Mark page as demand-paging candidate */
|
||||
|
@ -587,20 +591,20 @@ void WINAPI INT_Int31Handler( CONTEXT86 *context )
|
|||
FIXME("map real to linear (0x%08lx)\n",MAKELONG(CX_reg(context),BX_reg(context)));
|
||||
if(!(ptr=DOSMEM_MapRealToLinear(MAKELONG(CX_reg(context),BX_reg(context)))))
|
||||
{
|
||||
AX_reg(context) = 0x8021;
|
||||
SET_AX( context, 0x8021 );
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
BX_reg(context) = HIWORD(W32S_WINE2APP(ptr));
|
||||
CX_reg(context) = LOWORD(W32S_WINE2APP(ptr));
|
||||
SET_BX( context, HIWORD(W32S_WINE2APP(ptr)) );
|
||||
SET_CX( context, LOWORD(W32S_WINE2APP(ptr)) );
|
||||
RESET_CFLAG(context);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
INT_BARF( context, 0x31 );
|
||||
AX_reg(context) = 0x8001; /* unsupported function */
|
||||
SET_AX( context, 0x8001 ); /* unsupported function */
|
||||
SET_CFLAG(context);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -98,6 +98,5 @@ void WINAPI INT_Int11Handler( CONTEXT86 *context )
|
|||
if (parallelports > 3) /* 2 bits -- maximum value = 3 */
|
||||
parallelports=3;
|
||||
|
||||
AX_reg(context) = (diskdrives << 6) | (serialports << 9) |
|
||||
(parallelports << 14) | 0x02;
|
||||
SET_AX( context, (diskdrives << 6) | (serialports << 9) | (parallelports << 14) | 0x02 );
|
||||
}
|
||||
|
|
|
@ -11,5 +11,5 @@
|
|||
*/
|
||||
void WINAPI INT_Int12Handler( CONTEXT86 *context )
|
||||
{
|
||||
AX_reg(context) = 640;
|
||||
SET_AX( context, 640 );
|
||||
}
|
||||
|
|
|
@ -41,13 +41,13 @@ void WINAPI INT_Int15Handler( CONTEXT86 *context )
|
|||
switch(DX_reg(context))
|
||||
{
|
||||
case 0x0: /* read joystick switches */
|
||||
AL_reg(context) = 0x0; /* all switches open */
|
||||
SET_AL( context, 0x0 ); /* all switches open */
|
||||
break;
|
||||
case 0x1: /* read joystick position */
|
||||
AX_reg(context) = 0x0;
|
||||
BX_reg(context) = 0x0;
|
||||
CX_reg(context) = 0x0;
|
||||
DX_reg(context) = 0x0;
|
||||
SET_AX( context, 0x0 );
|
||||
SET_BX( context, 0x0 );
|
||||
SET_CX( context, 0x0 );
|
||||
SET_DX( context, 0x0 );
|
||||
break;
|
||||
default:
|
||||
INT_BARF( context, 0x15 );
|
||||
|
@ -59,7 +59,7 @@ void WINAPI INT_Int15Handler( CONTEXT86 *context )
|
|||
break;
|
||||
|
||||
case 0x88: /* get size of memory above 1 M */
|
||||
AX_reg(context) = 64; /* FIXME: are 64K ok? */
|
||||
SET_AX( context, 64 ); /* FIXME: are 64K ok? */
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -68,8 +68,8 @@ void WINAPI INT_Int15Handler( CONTEXT86 *context )
|
|||
context->SegEs = 0xf000;
|
||||
else
|
||||
context->SegEs = DOSMEM_BiosSysSeg;
|
||||
BX_reg(context) = 0xe6f5;
|
||||
AH_reg(context) = 0x0;
|
||||
SET_BX( context, 0xe6f5 );
|
||||
SET_AH( context, 0x0 );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
case 0xc2:
|
||||
|
@ -89,16 +89,16 @@ void WINAPI INT_Int15Handler( CONTEXT86 *context )
|
|||
INT_BARF( context, 0x15 );
|
||||
break;
|
||||
}
|
||||
AH_reg(context) = 0x00; /* successful */
|
||||
SET_AH( context, 0x00 ); /* successful */
|
||||
break;
|
||||
case 0x02: /* Set Sampling Rate */
|
||||
/* BH = sampling rate */
|
||||
FIXME("Set Sampling Rate - not implemented\n");
|
||||
AH_reg(context) = 0x00; /* successful */
|
||||
SET_AH( context, 0x00 ); /* successful */
|
||||
break;
|
||||
case 0x04: /* Get Pointing Device Type */
|
||||
FIXME("Get Pointing Device Type - not implemented\n");
|
||||
BH_reg(context) = 0x01;/*Device id FIXME what is it supposed to be?*/
|
||||
SET_BH( context, 0x01 );/*Device id FIXME what is it supposed to be?*/
|
||||
break;
|
||||
default:
|
||||
INT_BARF( context, 0x15 );
|
||||
|
|
|
@ -75,9 +75,9 @@ void WINAPI INT_Int1aHandler( CONTEXT86 *context )
|
|||
{
|
||||
case 0x00:
|
||||
ticks = INT1A_GetTicksSinceMidnight();
|
||||
CX_reg(context) = HIWORD(ticks);
|
||||
DX_reg(context) = LOWORD(ticks);
|
||||
AX_reg(context) = 0; /* No midnight rollover */
|
||||
SET_CX( context, HIWORD(ticks) );
|
||||
SET_DX( context, LOWORD(ticks) );
|
||||
SET_AX( context, 0 ); /* No midnight rollover */
|
||||
TRACE("int1a: AH=00 -- ticks=%ld\n", ticks);
|
||||
break;
|
||||
|
||||
|
@ -85,17 +85,17 @@ void WINAPI INT_Int1aHandler( CONTEXT86 *context )
|
|||
ltime = time(NULL);
|
||||
bdtime = localtime(<ime);
|
||||
|
||||
CX_reg(context) = (BIN_TO_BCD(bdtime->tm_hour)<<8) |
|
||||
BIN_TO_BCD(bdtime->tm_min);
|
||||
DX_reg(context) = (BIN_TO_BCD(bdtime->tm_sec)<<8);
|
||||
SET_CX( context, (BIN_TO_BCD(bdtime->tm_hour)<<8) |
|
||||
BIN_TO_BCD(bdtime->tm_min) );
|
||||
SET_DX( context, (BIN_TO_BCD(bdtime->tm_sec)<<8) );
|
||||
|
||||
case 0x04:
|
||||
ltime = time(NULL);
|
||||
bdtime = localtime(<ime);
|
||||
CX_reg(context) = (BIN_TO_BCD(bdtime->tm_year/100)<<8) |
|
||||
BIN_TO_BCD((bdtime->tm_year-1900)%100);
|
||||
DX_reg(context) = (BIN_TO_BCD(bdtime->tm_mon)<<8) |
|
||||
BIN_TO_BCD(bdtime->tm_mday);
|
||||
SET_CX( context, (BIN_TO_BCD(bdtime->tm_year/100)<<8) |
|
||||
BIN_TO_BCD((bdtime->tm_year-1900)%100) );
|
||||
SET_DX( context, (BIN_TO_BCD(bdtime->tm_mon)<<8) |
|
||||
BIN_TO_BCD(bdtime->tm_mday) );
|
||||
break;
|
||||
|
||||
/* setting the time,date or RTC is not allow -EB */
|
||||
|
|
330
msdos/int21.c
330
msdos/int21.c
|
@ -217,10 +217,10 @@ static int INT21_GetFreeDiskSpace( CONTEXT86 *context )
|
|||
*root += DOS_GET_DRIVE( DL_reg(context) );
|
||||
if (!GetDiskFreeSpaceA( root, &cluster_sectors, §or_bytes,
|
||||
&free_clusters, &total_clusters )) return 0;
|
||||
AX_reg(context) = cluster_sectors;
|
||||
BX_reg(context) = free_clusters;
|
||||
CX_reg(context) = sector_bytes;
|
||||
DX_reg(context) = total_clusters;
|
||||
SET_AX( context, cluster_sectors );
|
||||
SET_BX( context, free_clusters );
|
||||
SET_CX( context, sector_bytes );
|
||||
SET_DX( context, total_clusters );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ static int INT21_GetDriveAllocInfo( CONTEXT86 *context )
|
|||
if (!heap && !INT21_CreateHeap()) return 0;
|
||||
heap->mediaID = 0xf0;
|
||||
context->SegDs = DosHeapHandle;
|
||||
BX_reg(context) = (int)&heap->mediaID - (int)heap;
|
||||
SET_BX( context, (int)&heap->mediaID - (int)heap );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -277,13 +277,13 @@ static void GetDrivePB( CONTEXT86 *context, int drive )
|
|||
{
|
||||
if (FillInDrivePB( drive ))
|
||||
{
|
||||
AL_reg(context) = 0x00;
|
||||
SET_AL( context, 0x00 );
|
||||
context->SegDs = SELECTOROF(dpbsegptr);
|
||||
BX_reg(context) = OFFSETOF(dpbsegptr);
|
||||
SET_BX( context, OFFSETOF(dpbsegptr) );
|
||||
}
|
||||
else
|
||||
{
|
||||
AX_reg(context) = 0x00ff;
|
||||
SET_AX( context, 0x00ff );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,13 +300,13 @@ static void ioctlGetDeviceInfo( CONTEXT86 *context )
|
|||
/* DOS device ? */
|
||||
if ((dev = DOSFS_GetDeviceByHandle( DosFileHandleToWin32Handle(BX_reg(context)) )))
|
||||
{
|
||||
DX_reg(context) = dev->flags;
|
||||
SET_DX( context, dev->flags );
|
||||
return;
|
||||
}
|
||||
|
||||
/* it seems to be a file */
|
||||
curr_drive = DRIVE_GetCurrentDrive();
|
||||
DX_reg(context) = 0x0140 + curr_drive + ((curr_drive > 1) ? 0x0800 : 0);
|
||||
SET_DX( context, 0x0140 + curr_drive + ((curr_drive > 1) ? 0x0800 : 0) );
|
||||
/* no floppy */
|
||||
/* bits 0-5 are current drive
|
||||
* bit 6 - file has NOT been written..FIXME: correct?
|
||||
|
@ -380,7 +380,7 @@ static BOOL ioctlGenericBlkDevReq( CONTEXT86 *context )
|
|||
RESET_CFLAG(context);
|
||||
else
|
||||
{
|
||||
AX_reg(context) = 0x1e; /* read fault */
|
||||
SET_AX( context, 0x1e ); /* read fault */
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ static BOOL ioctlGenericBlkDevReq( CONTEXT86 *context )
|
|||
|
||||
case 0x72:
|
||||
/* Trail on error implementation */
|
||||
AX_reg(context) = GetDriveType16(BL_reg(context)) == DRIVE_UNKNOWN ? 0x0f : 0x01;
|
||||
SET_AX( context, GetDriveType16(BL_reg(context)) == DRIVE_UNKNOWN ? 0x0f : 0x01 );
|
||||
SET_CFLAG(context); /* Seems to be set all the time */
|
||||
break;
|
||||
|
||||
|
@ -435,7 +435,7 @@ static void INT21_ParseFileNameIntoFCB( CONTEXT86 *context )
|
|||
WCHAR fcbW[12];
|
||||
INT buffer_len, len;
|
||||
|
||||
AL_reg(context) = 0xff; /* failed */
|
||||
SET_AL( context, 0xff ); /* failed */
|
||||
|
||||
TRACE("filename: '%s'\n", filename);
|
||||
|
||||
|
@ -462,28 +462,27 @@ static void INT21_ParseFileNameIntoFCB( CONTEXT86 *context )
|
|||
*fcb = 0;
|
||||
TRACE("FCB: '%s'\n", fcb + 1);
|
||||
|
||||
AL_reg(context) =
|
||||
((strchr(filename, '*')) || (strchr(filename, '$'))) != 0;
|
||||
SET_AL( context, ((strchr(filename, '*')) || (strchr(filename, '$'))) != 0 );
|
||||
|
||||
/* point DS:SI to first unparsed character */
|
||||
SI_reg(context) += (int)s - (int)filename;
|
||||
SET_SI( context, context->Esi + (int)s - (int)filename );
|
||||
}
|
||||
|
||||
static void INT21_GetSystemDate( CONTEXT86 *context )
|
||||
{
|
||||
SYSTEMTIME systime;
|
||||
GetLocalTime( &systime );
|
||||
CX_reg(context) = systime.wYear;
|
||||
DX_reg(context) = (systime.wMonth << 8) | systime.wDay;
|
||||
AX_reg(context) = systime.wDayOfWeek;
|
||||
SET_CX( context, systime.wYear );
|
||||
SET_DX( context, (systime.wMonth << 8) | systime.wDay );
|
||||
SET_AX( context, systime.wDayOfWeek );
|
||||
}
|
||||
|
||||
static void INT21_GetSystemTime( CONTEXT86 *context )
|
||||
{
|
||||
SYSTEMTIME systime;
|
||||
GetLocalTime( &systime );
|
||||
CX_reg(context) = (systime.wHour << 8) | systime.wMinute;
|
||||
DX_reg(context) = (systime.wSecond << 8) | (systime.wMilliseconds / 10);
|
||||
SET_CX( context, (systime.wHour << 8) | systime.wMinute );
|
||||
SET_DX( context, (systime.wSecond << 8) | (systime.wMilliseconds / 10) );
|
||||
}
|
||||
|
||||
/* Many calls translate a drive argument like this:
|
||||
|
@ -504,8 +503,8 @@ char *INT21_DriveName(int drive)
|
|||
}
|
||||
static BOOL INT21_CreateFile( CONTEXT86 *context )
|
||||
{
|
||||
AX_reg(context) = _lcreat16( CTX_SEG_OFF_TO_LIN(context, context->SegDs,
|
||||
context->Edx ), CX_reg(context) );
|
||||
SET_AX( context, _lcreat16( CTX_SEG_OFF_TO_LIN(context, context->SegDs,
|
||||
context->Edx ), CX_reg(context) ) );
|
||||
return (AX_reg(context) == (WORD)HFILE_ERROR16);
|
||||
}
|
||||
|
||||
|
@ -520,11 +519,11 @@ static HFILE16 _lcreat16_uniq( LPCSTR path, INT attr )
|
|||
|
||||
static void OpenExistingFile( CONTEXT86 *context )
|
||||
{
|
||||
AX_reg(context) = _lopen16( CTX_SEG_OFF_TO_LIN(context, context->SegDs,context->Edx),
|
||||
AL_reg(context) );
|
||||
SET_AX( context, _lopen16( CTX_SEG_OFF_TO_LIN(context, context->SegDs,context->Edx),
|
||||
AL_reg(context) ));
|
||||
if (AX_reg(context) == (WORD)HFILE_ERROR16)
|
||||
{
|
||||
AX_reg(context) = GetLastError();
|
||||
SET_AX( context, GetLastError() );
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
}
|
||||
|
@ -535,8 +534,8 @@ static BOOL INT21_ExtendedOpenCreateFile(CONTEXT86 *context )
|
|||
BYTE action = DL_reg(context);
|
||||
|
||||
/* Shuffle arguments to call OpenExistingFile */
|
||||
AL_reg(context) = BL_reg(context);
|
||||
DX_reg(context) = SI_reg(context);
|
||||
SET_AL( context, BL_reg(context) );
|
||||
SET_DX( context, SI_reg(context) );
|
||||
/* BX,CX and DX should be preserved */
|
||||
OpenExistingFile(context);
|
||||
|
||||
|
@ -549,7 +548,7 @@ static BOOL INT21_ExtendedOpenCreateFile(CONTEXT86 *context )
|
|||
if ((action & 0x07) == 0)
|
||||
{
|
||||
_lclose16( AX_reg(context) );
|
||||
AX_reg(context) = 0x0050; /*File exists*/
|
||||
SET_AX( context, 0x0050 ); /*File exists*/
|
||||
SET_CFLAG(context);
|
||||
WARN("extended open/create: failed because file exists \n");
|
||||
}
|
||||
|
@ -560,7 +559,7 @@ static BOOL INT21_ExtendedOpenCreateFile(CONTEXT86 *context )
|
|||
{
|
||||
_lclose16( AX_reg(context) );
|
||||
WARN("extended open/create: failed, trunc on ro file\n");
|
||||
AX_reg(context) = 0x000C; /*Access code invalid*/
|
||||
SET_AX( context, 0x000C ); /*Access code invalid*/
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
else
|
||||
|
@ -569,16 +568,16 @@ static BOOL INT21_ExtendedOpenCreateFile(CONTEXT86 *context )
|
|||
if (_lclose16( AX_reg(context) ))
|
||||
{
|
||||
WARN("extended open/create: close before trunc failed\n");
|
||||
AX_reg(context) = 0x0019; /*Seek Error*/
|
||||
CX_reg(context) = 0;
|
||||
SET_AX( context, 0x0019 ); /*Seek Error*/
|
||||
SET_CX( context, 0 );
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
/* Shuffle arguments to call CreateFile */
|
||||
|
||||
TRACE("extended open/create: Truncating\n");
|
||||
AL_reg(context) = BL_reg(context);
|
||||
SET_AL( context, BL_reg(context) );
|
||||
/* CX is still the same */
|
||||
DX_reg(context) = SI_reg(context);
|
||||
SET_DX( context, SI_reg(context) );
|
||||
bExtendedError = INT21_CreateFile(context);
|
||||
|
||||
if (context->EFlags & 0x0001) /*no file open, flags set */
|
||||
|
@ -591,14 +590,14 @@ static BOOL INT21_ExtendedOpenCreateFile(CONTEXT86 *context )
|
|||
}
|
||||
else uReturnCX = 0x1;
|
||||
|
||||
CX_reg(context) = uReturnCX;
|
||||
SET_CX( context, uReturnCX );
|
||||
}
|
||||
else /* file does not exist */
|
||||
{
|
||||
RESET_CFLAG(context); /* was set by OpenExistingFile(context) */
|
||||
if ((action & 0xF0)== 0)
|
||||
{
|
||||
CX_reg(context) = 0;
|
||||
SET_CX( context, 0 );
|
||||
SET_CFLAG(context);
|
||||
WARN("extended open/create: failed, file dosen't exist\n");
|
||||
}
|
||||
|
@ -606,16 +605,16 @@ static BOOL INT21_ExtendedOpenCreateFile(CONTEXT86 *context )
|
|||
{
|
||||
/* Shuffle arguments to call CreateFile */
|
||||
TRACE("extended open/create: Creating\n");
|
||||
AL_reg(context) = BL_reg(context);
|
||||
SET_AL( context, BL_reg(context) );
|
||||
/* CX should still be the same */
|
||||
DX_reg(context) = SI_reg(context);
|
||||
SET_DX( context, SI_reg(context) );
|
||||
bExtendedError = INT21_CreateFile(context);
|
||||
if (context->EFlags & 0x0001) /*no file open, flags set */
|
||||
{
|
||||
WARN("extended open/create: create failed\n");
|
||||
return bExtendedError;
|
||||
}
|
||||
CX_reg(context) = 2;
|
||||
SET_CX( context, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -656,7 +655,7 @@ static int INT21_FindFirst( CONTEXT86 *context )
|
|||
dta->unixPath = NULL;
|
||||
if (!DOSFS_GetFullName( pathW, FALSE, &full_name ))
|
||||
{
|
||||
AX_reg(context) = GetLastError();
|
||||
SET_AX( context, GetLastError() );
|
||||
SET_CFLAG(context);
|
||||
return 0;
|
||||
}
|
||||
|
@ -675,7 +674,7 @@ static int INT21_FindFirst( CONTEXT86 *context )
|
|||
HeapFree( GetProcessHeap(), 0, dta->unixPath );
|
||||
dta->unixPath = NULL;
|
||||
SetLastError( ERROR_FILE_NOT_FOUND );
|
||||
AX_reg(context) = ERROR_FILE_NOT_FOUND;
|
||||
SET_AX( context, ERROR_FILE_NOT_FOUND );
|
||||
SET_CFLAG(context);
|
||||
return 0;
|
||||
}
|
||||
|
@ -741,7 +740,7 @@ static BOOL INT21_CreateTempFile( CONTEXT86 *context )
|
|||
sprintf( p, "wine%04x.%03d", (int)getpid(), counter );
|
||||
counter = (counter + 1) % 1000;
|
||||
|
||||
if ((AX_reg(context) = _lcreat16_uniq( name, 0 )) != (WORD)HFILE_ERROR16)
|
||||
if ((SET_AX( context, _lcreat16_uniq( name, 0 ))) != (WORD)HFILE_ERROR16)
|
||||
{
|
||||
TRACE("created %s\n", name );
|
||||
return TRUE;
|
||||
|
@ -763,7 +762,7 @@ static BOOL INT21_GetCurrentDirectory( CONTEXT86 *context )
|
|||
}
|
||||
WideCharToMultiByte(CP_OEMCP, 0, DRIVE_GetDosCwd(drive), -1, ptr, 64, NULL, NULL);
|
||||
ptr[63] = 0; /* ensure 0 termination */
|
||||
AX_reg(context) = 0x0100; /* success return code */
|
||||
SET_AX( context, 0x0100 ); /* success return code */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -773,11 +772,11 @@ static void INT21_GetDBCSLeadTable( CONTEXT86 *context )
|
|||
if (heap || INT21_CreateHeap())
|
||||
{ /* return an empty table just as DOS 4.0+ does */
|
||||
context->SegDs = DosHeapHandle;
|
||||
SI_reg(context) = (int)&heap->DummyDBCSLeadTable - (int)heap;
|
||||
SET_SI( context, (int)&heap->DummyDBCSLeadTable - (int)heap );
|
||||
}
|
||||
else
|
||||
{
|
||||
AX_reg(context) = 0x1; /* error */
|
||||
SET_AX( context, 0x1 ); /* error */
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
}
|
||||
|
@ -939,7 +938,7 @@ static void fLock( CONTEXT86 * context )
|
|||
if (!LockFile(DosFileHandleToWin32Handle(BX_reg(context)),
|
||||
MAKELONG(DX_reg(context),CX_reg(context)), 0,
|
||||
MAKELONG(DI_reg(context),SI_reg(context)), 0)) {
|
||||
AX_reg(context) = GetLastError();
|
||||
SET_AX( context, GetLastError() );
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
break;
|
||||
|
@ -952,12 +951,12 @@ static void fLock( CONTEXT86 * context )
|
|||
if (!UnlockFile(DosFileHandleToWin32Handle(BX_reg(context)),
|
||||
MAKELONG(DX_reg(context),CX_reg(context)), 0,
|
||||
MAKELONG(DI_reg(context),SI_reg(context)), 0)) {
|
||||
AX_reg(context) = GetLastError();
|
||||
SET_AX( context, GetLastError() );
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
return;
|
||||
default:
|
||||
AX_reg(context) = 0x0001;
|
||||
SET_AX( context, 0x0001 );
|
||||
SET_CFLAG(context);
|
||||
return;
|
||||
}
|
||||
|
@ -981,8 +980,8 @@ INT21_networkfunc (CONTEXT86 *context)
|
|||
while (len < 15)
|
||||
dst[len++] = ' ';
|
||||
dst[15] = 0;
|
||||
CH_reg(context) = 1; /* Valid */
|
||||
CL_reg(context) = 1; /* NETbios number??? */
|
||||
SET_CH( context, 1 ); /* Valid */
|
||||
SET_CL( context, 1 ); /* NETbios number??? */
|
||||
TRACE("returning %s\n", debugstr_an (dst, 16));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1114,10 +1113,10 @@ static void INT21_GetExtendedError( CONTEXT86 *context )
|
|||
}
|
||||
TRACE("GET EXTENDED ERROR code 0x%02x class 0x%02x action 0x%02x locus %02x\n",
|
||||
error, class, action, locus );
|
||||
AX_reg(context) = error;
|
||||
BH_reg(context) = class;
|
||||
BL_reg(context) = action;
|
||||
CH_reg(context) = locus;
|
||||
SET_AX( context, error );
|
||||
SET_BH( context, class );
|
||||
SET_BL( context, action );
|
||||
SET_CH( context, locus );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -1147,7 +1146,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
{
|
||||
TRACE("FLUSH BUFFER AND READ STANDARD INPUT\n");
|
||||
/* no flush here yet */
|
||||
AH_reg(context) = AL_reg(context);
|
||||
SET_AH( context, AL_reg(context) );
|
||||
}
|
||||
|
||||
if (AH_reg(context)>=0x2f) {
|
||||
|
@ -1200,7 +1199,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
Maybe we should check for non-'$' strings, but DOS doesn't. */
|
||||
while (*p != '$') p++;
|
||||
_hwrite16( 1, data, (int)p - (int)data);
|
||||
AL_reg(context) = '$'; /* yes, '$' (0x24) gets returned in AL */
|
||||
SET_AL( context, '$' ); /* yes, '$' (0x24) gets returned in AL */
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1230,7 +1229,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
case 0x1e:
|
||||
case 0x20:
|
||||
case 0x6b: /* NULL FUNCTION */
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
break;
|
||||
|
||||
case 0x5c: /* "FLOCK" - RECORD LOCKING */
|
||||
|
@ -1245,7 +1244,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
case 0x0e: /* SELECT DEFAULT DRIVE */
|
||||
TRACE("SELECT DEFAULT DRIVE %d\n", DL_reg(context));
|
||||
DRIVE_SetCurrentDrive( DL_reg(context) );
|
||||
AL_reg(context) = MAX_DOS_DRIVES;
|
||||
SET_AL( context, MAX_DOS_DRIVES );
|
||||
break;
|
||||
|
||||
case 0x11: /* FIND FIRST MATCHING FILE USING FCB */
|
||||
|
@ -1253,13 +1252,13 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx));
|
||||
if (!INT21_FindFirstFCB(context))
|
||||
{
|
||||
AL_reg(context) = 0xff;
|
||||
SET_AL( context, 0xff );
|
||||
break;
|
||||
}
|
||||
/* else fall through */
|
||||
|
||||
case 0x12: /* FIND NEXT MATCHING FILE USING FCB */
|
||||
AL_reg(context) = INT21_FindNextFCB(context) ? 0x00 : 0xff;
|
||||
SET_AL( context, INT21_FindNextFCB(context) ? 0x00 : 0xff );
|
||||
break;
|
||||
|
||||
case 0x13: /* DELETE FILE USING FCB */
|
||||
|
@ -1271,7 +1270,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
break;
|
||||
|
||||
case 0x19: /* GET CURRENT DEFAULT DRIVE */
|
||||
AL_reg(context) = DRIVE_GetCurrentDrive();
|
||||
SET_AL( context, DRIVE_GetCurrentDrive() );
|
||||
break;
|
||||
|
||||
case 0x1a: /* SET DISK TRANSFER AREA ADDRESS */
|
||||
|
@ -1283,12 +1282,12 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
break;
|
||||
|
||||
case 0x1b: /* GET ALLOCATION INFORMATION FOR DEFAULT DRIVE */
|
||||
DL_reg(context) = 0;
|
||||
if (!INT21_GetDriveAllocInfo(context)) AX_reg(context) = 0xffff;
|
||||
SET_DL( context, 0 );
|
||||
if (!INT21_GetDriveAllocInfo(context)) SET_AX( context, 0xffff );
|
||||
break;
|
||||
|
||||
case 0x1c: /* GET ALLOCATION INFORMATION FOR SPECIFIC DRIVE */
|
||||
if (!INT21_GetDriveAllocInfo(context)) AX_reg(context) = 0xffff;
|
||||
if (!INT21_GetDriveAllocInfo(context)) SET_AX( context, 0xffff );
|
||||
break;
|
||||
|
||||
case 0x1f: /* GET DRIVE PARAMETER BLOCK FOR DEFAULT DRIVE */
|
||||
|
@ -1310,7 +1309,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
case 0x2b: /* SET SYSTEM DATE */
|
||||
FIXME("SetSystemDate(%02d/%02d/%04d): not allowed\n",
|
||||
DL_reg(context), DH_reg(context), CX_reg(context) );
|
||||
AL_reg(context) = 0; /* Let's pretend we succeeded */
|
||||
SET_AL( context, 0 ); /* Let's pretend we succeeded */
|
||||
break;
|
||||
|
||||
case 0x2c: /* GET SYSTEM TIME */
|
||||
|
@ -1321,7 +1320,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
FIXME("SetSystemTime(%02d:%02d:%02d.%02d): not allowed\n",
|
||||
CH_reg(context), CL_reg(context),
|
||||
DH_reg(context), DL_reg(context) );
|
||||
AL_reg(context) = 0; /* Let's pretend we succeeded */
|
||||
SET_AL( context, 0 ); /* Let's pretend we succeeded */
|
||||
break;
|
||||
|
||||
case 0x2f: /* GET DISK TRANSFER AREA ADDRESS */
|
||||
|
@ -1329,22 +1328,21 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
{
|
||||
TDB *pTask = TASK_GetCurrent();
|
||||
context->SegEs = SELECTOROF( pTask->dta );
|
||||
BX_reg(context) = OFFSETOF( pTask->dta );
|
||||
SET_BX( context, OFFSETOF( pTask->dta ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x30: /* GET DOS VERSION */
|
||||
TRACE("GET DOS VERSION %s requested\n",
|
||||
(AL_reg(context) == 0x00)?"OEM number":"version flag");
|
||||
AX_reg(context) = (HIWORD(GetVersion16()) >> 8) |
|
||||
(HIWORD(GetVersion16()) << 8);
|
||||
SET_AX( context, (HIWORD(GetVersion16()) >> 8) | (HIWORD(GetVersion16()) << 8) );
|
||||
#if 0
|
||||
AH_reg(context) = 0x7;
|
||||
AL_reg(context) = 0xA;
|
||||
SET_AH( context, 0x7 );
|
||||
SET_AL( context, 0xA );
|
||||
#endif
|
||||
|
||||
BX_reg(context) = 0x00FF; /* 0x123456 is Wine's serial # */
|
||||
CX_reg(context) = 0x0000;
|
||||
SET_BX( context, 0x00FF ); /* 0x123456 is Wine's serial # */
|
||||
SET_CX( context, 0x0000 );
|
||||
break;
|
||||
|
||||
case 0x31: /* TERMINATE AND STAY RESIDENT */
|
||||
|
@ -1363,7 +1361,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
case 0x00: /* GET CURRENT EXTENDED BREAK STATE */
|
||||
TRACE("GET CURRENT EXTENDED BREAK STATE\n");
|
||||
INT21_ReadConfigSys();
|
||||
DL_reg(context) = DOSCONF_config.brk_flag;
|
||||
SET_DL( context, DOSCONF_config.brk_flag );
|
||||
break;
|
||||
|
||||
case 0x01: /* SET EXTENDED BREAK STATE */
|
||||
|
@ -1378,27 +1376,26 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
/* ugly coding in order to stay reentrant */
|
||||
if (DL_reg(context))
|
||||
{
|
||||
DL_reg(context) = DOSCONF_config.brk_flag;
|
||||
SET_DL( context, DOSCONF_config.brk_flag );
|
||||
DOSCONF_config.brk_flag = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
DL_reg(context) = DOSCONF_config.brk_flag;
|
||||
SET_DL( context, DOSCONF_config.brk_flag );
|
||||
DOSCONF_config.brk_flag = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x05: /* GET BOOT DRIVE */
|
||||
TRACE("GET BOOT DRIVE\n");
|
||||
DL_reg(context) = 3;
|
||||
SET_DL( context, 3 );
|
||||
/* c: is Wine's bootdrive (a: is 1)*/
|
||||
break;
|
||||
|
||||
case 0x06: /* GET TRUE VERSION NUMBER */
|
||||
TRACE("GET TRUE VERSION NUMBER\n");
|
||||
BX_reg(context) = (HIWORD(GetVersion16() >> 8)) |
|
||||
(HIWORD(GetVersion16() << 8));
|
||||
DX_reg(context) = 0x00;
|
||||
SET_BX( context, (HIWORD(GetVersion16() >> 8)) | (HIWORD(GetVersion16() << 8)) );
|
||||
SET_DX( context, 0x00 );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1411,7 +1408,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
TRACE("GET ADDRESS OF INDOS FLAG\n");
|
||||
if (!heap) INT21_CreateHeap();
|
||||
context->SegEs = DosHeapHandle;
|
||||
BX_reg(context) = (int)&heap->InDosFlag - (int)heap;
|
||||
SET_BX( context, (int)&heap->InDosFlag - (int)heap );
|
||||
break;
|
||||
|
||||
case 0x35: /* GET INTERRUPT VECTOR */
|
||||
|
@ -1419,14 +1416,14 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
{
|
||||
FARPROC16 addr = INT_GetPMHandler( AL_reg(context) );
|
||||
context->SegEs = SELECTOROF(addr);
|
||||
BX_reg(context) = OFFSETOF(addr);
|
||||
SET_BX( context, OFFSETOF(addr) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x36: /* GET FREE DISK SPACE */
|
||||
TRACE("GET FREE DISK SPACE FOR DRIVE %s\n",
|
||||
INT21_DriveName( DL_reg(context)));
|
||||
if (!INT21_GetFreeDiskSpace(context)) AX_reg(context) = 0xffff;
|
||||
if (!INT21_GetFreeDiskSpace(context)) SET_AX( context, 0xffff );
|
||||
break;
|
||||
|
||||
case 0x37:
|
||||
|
@ -1436,13 +1433,13 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
{
|
||||
case 0x00: /* "SWITCHAR" - GET SWITCH CHARACTER */
|
||||
TRACE("SWITCHAR - GET SWITCH CHARACTER\n");
|
||||
AL_reg(context) = 0x00; /* success*/
|
||||
DL_reg(context) = switchchar;
|
||||
SET_AL( context, 0x00 ); /* success*/
|
||||
SET_DL( context, switchchar );
|
||||
break;
|
||||
case 0x01: /*"SWITCHAR" - SET SWITCH CHARACTER*/
|
||||
TRACE("SWITCHAR - SET SWITCH CHARACTER\n");
|
||||
switchchar = DL_reg(context);
|
||||
AL_reg(context) = 0x00; /* success*/
|
||||
SET_AL( context, 0x00 ); /* success*/
|
||||
break;
|
||||
default: /*"AVAILDEV" - SPECIFY \DEV\ PREFIX USE*/
|
||||
INT_BARF( context, 0x21 );
|
||||
|
@ -1454,7 +1451,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
case 0x38: /* GET COUNTRY-SPECIFIC INFORMATION */
|
||||
TRACE("GET COUNTRY-SPECIFIC INFORMATION for country 0x%02x\n",
|
||||
AL_reg(context));
|
||||
AX_reg(context) = 0x02; /* no country support available */
|
||||
SET_AX( context, 0x02 ); /* no country support available */
|
||||
SET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -1507,7 +1504,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
|
||||
case 0x3e: /* "CLOSE" - CLOSE FILE */
|
||||
TRACE("CLOSE handle %d\n",BX_reg(context));
|
||||
bSetDOSExtendedError = ((AX_reg(context) = _lclose16( BX_reg(context) )) != 0);
|
||||
bSetDOSExtendedError = ((SET_AX( context, _lclose16( BX_reg(context) )) != 0) );
|
||||
break;
|
||||
|
||||
case 0x3f: /* "READ" - READ FROM FILE OR DEVICE */
|
||||
|
@ -1525,7 +1522,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
MAKESEGPTR( context->SegDs, context->Edx ),
|
||||
CX_reg(context) );
|
||||
if (result == -1) bSetDOSExtendedError = TRUE;
|
||||
else AX_reg(context) = (WORD)result;
|
||||
else SET_AX( context, (WORD)result );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1538,7 +1535,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
context->Edx ),
|
||||
CX_reg(context) );
|
||||
if (result == -1) bSetDOSExtendedError = TRUE;
|
||||
else AX_reg(context) = (WORD)result;
|
||||
else SET_AX( context, (WORD)result );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1561,8 +1558,8 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
if (status == -1) bSetDOSExtendedError = TRUE;
|
||||
else
|
||||
{
|
||||
AX_reg(context) = LOWORD(status);
|
||||
DX_reg(context) = HIWORD(status);
|
||||
SET_AX( context, LOWORD(status) );
|
||||
SET_DX( context, HIWORD(status) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1573,11 +1570,10 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
case 0x00:
|
||||
TRACE("GET FILE ATTRIBUTES for %s\n",
|
||||
(LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx));
|
||||
AX_reg(context) = (WORD)GetFileAttributesA(
|
||||
CTX_SEG_OFF_TO_LIN(context, context->SegDs,
|
||||
context->Edx));
|
||||
SET_AX( context, GetFileAttributesA( CTX_SEG_OFF_TO_LIN(context, context->SegDs,
|
||||
context->Edx)));
|
||||
if (AX_reg(context) == 0xffff) bSetDOSExtendedError = TRUE;
|
||||
else CX_reg(context) = AX_reg(context);
|
||||
else SET_CX( context, AX_reg(context) );
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
|
@ -1621,7 +1617,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
/* for (i=0;i<CX_reg(context);i++)
|
||||
fprintf(stdnimp,"%02x ",dataptr[i]);
|
||||
fprintf(stdnimp,"\n");*/
|
||||
AX_reg(context)=CX_reg(context);
|
||||
SET_AX( context, context->Ecx );
|
||||
break;
|
||||
}
|
||||
case 0x08: /* Check if drive is removable. */
|
||||
|
@ -1631,14 +1627,14 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
{
|
||||
case DRIVE_UNKNOWN:
|
||||
SetLastError( ERROR_INVALID_DRIVE );
|
||||
AX_reg(context) = ERROR_INVALID_DRIVE;
|
||||
SET_AX( context, ERROR_INVALID_DRIVE );
|
||||
SET_CFLAG(context);
|
||||
break;
|
||||
case DRIVE_REMOVABLE:
|
||||
AX_reg(context) = 0; /* removable */
|
||||
SET_AX( context, 0 ); /* removable */
|
||||
break;
|
||||
default:
|
||||
AX_reg(context) = 1; /* not removable */
|
||||
SET_AX( context, 1 ); /* not removable */
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -1650,14 +1646,14 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
{
|
||||
case DRIVE_UNKNOWN:
|
||||
SetLastError( ERROR_INVALID_DRIVE );
|
||||
AX_reg(context) = ERROR_INVALID_DRIVE;
|
||||
SET_AX( context, ERROR_INVALID_DRIVE );
|
||||
SET_CFLAG(context);
|
||||
break;
|
||||
case DRIVE_REMOTE:
|
||||
DX_reg(context) = (1<<9) | (1<<12); /* remote */
|
||||
SET_DX( context, (1<<9) | (1<<12) ); /* remote */
|
||||
break;
|
||||
default:
|
||||
DX_reg(context) = 0; /* FIXME: use driver attr here */
|
||||
SET_DX( context, 0 ); /* FIXME: use driver attr here */
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -1667,7 +1663,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
/* returns DX, bit 15 set if remote, bit 14 set if date/time
|
||||
* not set on close
|
||||
*/
|
||||
DX_reg(context) = 0;
|
||||
SET_DX( context, 0 );
|
||||
break;
|
||||
|
||||
case 0x0d:
|
||||
|
@ -1679,7 +1675,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
case 0x0e: /* get logical drive mapping */
|
||||
TRACE("IOCTL - GET LOGICAL DRIVE MAP for drive %s\n",
|
||||
INT21_DriveName( BL_reg(context)));
|
||||
AL_reg(context) = 0; /* drive has no mapping - FIXME: may be wrong*/
|
||||
SET_AL( context, 0 ); /* drive has no mapping - FIXME: may be wrong*/
|
||||
break;
|
||||
|
||||
case 0x0F: /* Set logical drive mapping */
|
||||
|
@ -1691,7 +1687,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
if ( ! DRIVE_SetLogicalMapping ( drive, drive+1 ) )
|
||||
{
|
||||
SET_CFLAG(context);
|
||||
AX_reg(context) = 0x000F; /* invalid drive */
|
||||
SET_AX( context, 0x000F ); /* invalid drive */
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1705,7 +1701,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
|
||||
TRACE("GET DR-DOS VERSION requested\n");
|
||||
|
||||
AX_reg(context) = 0x0001; /* Invalid function */
|
||||
SET_AX( context, 0x0001 ); /* Invalid function */
|
||||
SET_CFLAG(context); /* Error */
|
||||
SetLastError( ERROR_INVALID_FUNCTION );
|
||||
break;
|
||||
|
@ -1724,9 +1720,9 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
DosFileHandleToWin32Handle(BX_reg(context)),
|
||||
GetCurrentProcess(), &handle,
|
||||
0, TRUE, DUPLICATE_SAME_ACCESS )))
|
||||
AX_reg(context) = HFILE_ERROR16;
|
||||
SET_AX( context, HFILE_ERROR16 );
|
||||
else
|
||||
AX_reg(context) = Win32HandleToDosFileHandle(handle);
|
||||
SET_AX( context, Win32HandleToDosFileHandle(handle) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1750,19 +1746,19 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
{
|
||||
mem= DOSMEM_GetBlock((DWORD)BX_reg(context)<<4,NULL);
|
||||
if (mem)
|
||||
AX_reg(context) = DOSMEM_MapLinearToDos(mem)>>4;
|
||||
SET_AX( context, DOSMEM_MapLinearToDos(mem)>>4 );
|
||||
}
|
||||
else
|
||||
{
|
||||
mem = (LPVOID)GlobalDOSAlloc16(BX_reg(context)<<4);
|
||||
if (mem)
|
||||
AX_reg(context) = (DWORD)mem&0xffff;
|
||||
SET_AX( context, (DWORD)mem&0xffff );
|
||||
}
|
||||
if (!mem)
|
||||
{
|
||||
SET_CFLAG(context);
|
||||
AX_reg(context) = 0x0008; /* insufficient memory */
|
||||
BX_reg(context) = DOSMEM_Available()>>4;
|
||||
SET_AX( context, 0x0008 ); /* insufficient memory */
|
||||
SET_BX( context, DOSMEM_Available()>>4 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1783,7 +1779,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
{
|
||||
TRACE("FREE MEMORY failed\n");
|
||||
SET_CFLAG(context);
|
||||
AX_reg(context) = 0x0009; /* memory block address invalid */
|
||||
SET_AX( context, 0x0009 ); /* memory block address invalid */
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1796,19 +1792,19 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
LPVOID *mem = DOSMEM_ResizeBlock(DOSMEM_MapDosToLinear(context->SegEs<<4),
|
||||
BX_reg(context)<<4,NULL);
|
||||
if (mem)
|
||||
AX_reg(context) = DOSMEM_MapLinearToDos(mem)>>4;
|
||||
SET_AX( context, DOSMEM_MapLinearToDos(mem)>>4 );
|
||||
else {
|
||||
SET_CFLAG(context);
|
||||
AX_reg(context) = 0x0008; /* insufficient memory */
|
||||
BX_reg(context) = DOSMEM_Available()>>4; /* not quite right */
|
||||
SET_AX( context, 0x0008 ); /* insufficient memory */
|
||||
SET_BX( context, DOSMEM_Available()>>4 ); /* not quite right */
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x4b: /* "EXEC" - LOAD AND/OR EXECUTE PROGRAM */
|
||||
TRACE("EXEC %s\n", (LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx ));
|
||||
AX_reg(context) = WinExec16( CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx ),
|
||||
SW_NORMAL );
|
||||
SET_AX( context, WinExec16( CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx ),
|
||||
SW_NORMAL ));
|
||||
if (AX_reg(context) < 32) SET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -1828,34 +1824,39 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
if (!INT21_FindNext(context))
|
||||
{
|
||||
SetLastError( ERROR_NO_MORE_FILES );
|
||||
AX_reg(context) = ERROR_NO_MORE_FILES;
|
||||
SET_AX( context, ERROR_NO_MORE_FILES );
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
else AX_reg(context) = 0; /* OK */
|
||||
else SET_AX( context, 0 ); /* OK */
|
||||
break;
|
||||
case 0x51: /* GET PSP ADDRESS */
|
||||
TRACE("GET CURRENT PROCESS ID (GET PSP ADDRESS)\n");
|
||||
/* FIXME: should we return the original DOS PSP upon */
|
||||
/* Windows startup ? */
|
||||
BX_reg(context) = GetCurrentPDB16();
|
||||
SET_BX( context, GetCurrentPDB16() );
|
||||
break;
|
||||
case 0x62: /* GET PSP ADDRESS */
|
||||
/* FIXME: should we return the original DOS PSP upon */
|
||||
/* Windows startup ? */
|
||||
BX_reg(context) = GetCurrentPDB16();
|
||||
SET_BX( context, GetCurrentPDB16() );
|
||||
break;
|
||||
|
||||
case 0x52: /* "SYSVARS" - GET LIST OF LISTS */
|
||||
TRACE("SYSVARS - GET LIST OF LISTS\n");
|
||||
#if 0
|
||||
{
|
||||
context->SegEs = LOWORD(DOS_LOLSeg);
|
||||
BX_reg(context) = FIELD_OFFSET(DOS_LISTOFLISTS, ptr_first_DPB);
|
||||
SET_BX( context, FIELD_OFFSET(DOS_LISTOFLISTS, ptr_first_DPB) );
|
||||
}
|
||||
#endif
|
||||
FIXME("LOLSeg broken for now\n");
|
||||
context->SegEs = 0;
|
||||
SET_BX( context, 0 );
|
||||
break;
|
||||
|
||||
case 0x54: /* Get Verify Flag */
|
||||
TRACE("Get Verify Flag - Not Supported\n");
|
||||
AL_reg(context) = 0x00; /* pretend we can tell. 00h = off 01h = on */
|
||||
SET_AL( context, 0x00 ); /* pretend we can tell. 00h = off 01h = on */
|
||||
break;
|
||||
|
||||
case 0x56: /* "RENAME" - RENAME FILE */
|
||||
|
@ -1877,8 +1878,13 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
BX_reg(context));
|
||||
if (!GetFileTime( DosFileHandleToWin32Handle(BX_reg(context)), NULL, NULL, &filetime ))
|
||||
bSetDOSExtendedError = TRUE;
|
||||
else FileTimeToDosDateTime( &filetime, &DX_reg(context),
|
||||
&CX_reg(context) );
|
||||
else
|
||||
{
|
||||
WORD date, time;
|
||||
FileTimeToDosDateTime( &filetime, &date, &time );
|
||||
SET_DX( context, date );
|
||||
SET_CX( context, time );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1903,10 +1909,10 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
switch (AL_reg(context))
|
||||
{
|
||||
case 0x00:
|
||||
AX_reg(context) = 1;
|
||||
SET_AX( context, 1 );
|
||||
break;
|
||||
case 0x02:
|
||||
AX_reg(context) = 0;
|
||||
SET_AX( context, 0 );
|
||||
break;
|
||||
case 0x01:
|
||||
case 0x03:
|
||||
|
@ -1923,9 +1929,9 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
case 0x5b: /* CREATE NEW FILE */
|
||||
TRACE("CREATE NEW FILE 0x%02x for %s\n", CX_reg(context),
|
||||
(LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx));
|
||||
bSetDOSExtendedError = ((AX_reg(context) =
|
||||
bSetDOSExtendedError = ((SET_AX( context,
|
||||
_lcreat16_uniq( CTX_SEG_OFF_TO_LIN(context, context->SegDs,context->Edx),
|
||||
CX_reg(context) )) == (WORD)HFILE_ERROR16);
|
||||
CX_reg(context) ))) == (WORD)HFILE_ERROR16);
|
||||
break;
|
||||
|
||||
case 0x5d: /* NETWORK */
|
||||
|
@ -1978,7 +1984,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
CTX_SEG_OFF_TO_LIN(context, context->SegEs,
|
||||
context->Edi),NULL))
|
||||
bSetDOSExtendedError = TRUE;
|
||||
else AX_reg(context) = 0;
|
||||
else SET_AX( context, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2012,11 +2018,11 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
TRACE("\tget pointer to collating sequence table\n");
|
||||
dataptr[0] = 0x06;
|
||||
*(DWORD*)(dataptr+1) = MAKELONG(DOSMEM_CollateTable & 0xFFFF,DOSMEM_AllocSelector(DOSMEM_CollateTable>>16));
|
||||
CX_reg(context) = 258;/*FIXME: size of table?*/
|
||||
SET_CX( context, 258 );/*FIXME: size of table?*/
|
||||
break;
|
||||
case 0x20:
|
||||
TRACE("\tConvert char to uppercase\n");
|
||||
DL_reg(context) = toupper(DL_reg(context));
|
||||
SET_DL( context, toupper(DL_reg(context)) );
|
||||
break;
|
||||
case 0x21:
|
||||
TRACE("\tconvert string to uppercase with length\n");
|
||||
|
@ -2043,7 +2049,8 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
{
|
||||
case 0x01:
|
||||
TRACE("GET GLOBAL CODE PAGE TABLE\n");
|
||||
DX_reg(context) = BX_reg(context) = CodePage;
|
||||
SET_BX( context, CodePage );
|
||||
SET_DX( context, CodePage );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
case 0x02:
|
||||
|
@ -2074,14 +2081,14 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
TRACE("GET DISK SERIAL NUMBER for drive %s\n",
|
||||
INT21_DriveName(BL_reg(context)));
|
||||
if (!INT21_GetDiskSerialNumber(context)) bSetDOSExtendedError = TRUE;
|
||||
else AX_reg(context) = 0;
|
||||
else SET_AX( context, 0 );
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
TRACE("SET DISK SERIAL NUMBER for drive %s\n",
|
||||
INT21_DriveName(BL_reg(context)));
|
||||
if (!INT21_SetDiskSerialNumber(context)) bSetDOSExtendedError = TRUE;
|
||||
else AX_reg(context) = 1;
|
||||
else SET_AX( context, 1 );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -2097,7 +2104,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
/* not supported on anything but Win95 */
|
||||
TRACE("LONG FILENAME functions supported only by win95\n");
|
||||
SET_CFLAG(context);
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
} else
|
||||
switch(AL_reg(context))
|
||||
{
|
||||
|
@ -2137,9 +2144,8 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
{
|
||||
case 0x00: /* Get file attributes */
|
||||
TRACE("\tretrieve attributes\n");
|
||||
CX_reg(context) = (WORD)GetFileAttributesA(
|
||||
CTX_SEG_OFF_TO_LIN(context, context->SegDs,
|
||||
context->Edx));
|
||||
SET_CX( context, GetFileAttributesA( CTX_SEG_OFF_TO_LIN(context, context->SegDs,
|
||||
context->Edx)));
|
||||
if (CX_reg(context) == 0xffff) bSetDOSExtendedError = TRUE;
|
||||
break;
|
||||
case 0x01:
|
||||
|
@ -2153,7 +2159,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
FIXME("Unimplemented long file name function:\n");
|
||||
INT_BARF( context, 0x21 );
|
||||
SET_CFLAG(context);
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -2167,10 +2173,10 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
TRACE(" LONG FILENAME - FIND FIRST MATCHING FILE for %s\n",
|
||||
(LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs,context->Edx));
|
||||
/* FIXME: use attributes in CX */
|
||||
if ((AX_reg(context) = FindFirstFile16(
|
||||
if ((SET_AX( context, FindFirstFile16(
|
||||
CTX_SEG_OFF_TO_LIN(context, context->SegDs,context->Edx),
|
||||
(WIN32_FIND_DATAA *)CTX_SEG_OFF_TO_LIN(context, context->SegEs,
|
||||
context->Edi)))
|
||||
context->Edi))))
|
||||
== INVALID_HANDLE_VALUE16)
|
||||
bSetDOSExtendedError = TRUE;
|
||||
break;
|
||||
|
@ -2189,7 +2195,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
DWORD filename_len, flags;
|
||||
|
||||
TRACE("LONG FILENAME - GET VOLUME INFORMATION for drive having root dir '%s'.\n", driveroot);
|
||||
AX_reg(context) = 0;
|
||||
SET_AX( context, 0 );
|
||||
if (!GetVolumeInformationA( driveroot, NULL, 0, NULL, &filename_len,
|
||||
&flags, buffer, 8 ))
|
||||
{
|
||||
|
@ -2197,9 +2203,9 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
SET_CFLAG(context);
|
||||
break;
|
||||
}
|
||||
BX_reg(context) = flags | 0x4000; /* support for LFN functions */
|
||||
CX_reg(context) = filename_len;
|
||||
DX_reg(context) = MAX_PATH; /* FIXME: which len if DRIVE_SHORT_NAMES ? */
|
||||
SET_BX( context, flags | 0x4000 ); /* support for LFN functions */
|
||||
SET_CX( context, filename_len );
|
||||
SET_DX( context, MAX_PATH ); /* FIXME: which len if DRIVE_SHORT_NAMES ? */
|
||||
}
|
||||
break;
|
||||
case 0xa1: /* Find close */
|
||||
|
@ -2217,7 +2223,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
CTX_SEG_OFF_TO_LIN(context, context->SegEs,
|
||||
context->Edi), 67))
|
||||
bSetDOSExtendedError = TRUE;
|
||||
else AX_reg(context) = 0;
|
||||
else SET_AX( context, 0 );
|
||||
break;
|
||||
case 0x02: /* Get canonical long filename or path */
|
||||
if (!GetFullPathNameA
|
||||
|
@ -2226,13 +2232,13 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
CTX_SEG_OFF_TO_LIN(context, context->SegEs,
|
||||
context->Edi),NULL))
|
||||
bSetDOSExtendedError = TRUE;
|
||||
else AX_reg(context) = 0;
|
||||
else SET_AX( context, 0 );
|
||||
break;
|
||||
default:
|
||||
FIXME("Unimplemented long file name function:\n");
|
||||
INT_BARF( context, 0x21 );
|
||||
SET_CFLAG(context);
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -2252,7 +2258,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
))
|
||||
) {
|
||||
SET_CFLAG(context);
|
||||
AL_reg(context) = GetLastError();
|
||||
SET_AL( context, GetLastError() );
|
||||
}
|
||||
break;
|
||||
case 0x41: /* Delete file */
|
||||
|
@ -2263,7 +2269,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
context->Edx)
|
||||
)) {
|
||||
SET_CFLAG(context);
|
||||
AL_reg(context) = GetLastError();
|
||||
SET_AL( context, GetLastError() );
|
||||
}
|
||||
break;
|
||||
case 0x56: /* Move (rename) file */
|
||||
|
@ -2274,7 +2280,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
if (!MoveFileA(fn1, fn2))
|
||||
{
|
||||
SET_CFLAG(context);
|
||||
AL_reg(context) = GetLastError();
|
||||
SET_AL( context, GetLastError() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2282,7 +2288,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
FIXME("Unimplemented long file name function:\n");
|
||||
INT_BARF( context, 0x21 );
|
||||
SET_CFLAG(context);
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -2293,7 +2299,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
AX_reg(context));
|
||||
WARN(" returning unimplemented\n");
|
||||
SET_CFLAG(context);
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
break;
|
||||
|
||||
case 0x73: /* MULTIPLEXED: Win95 OSR2/Win98 FAT32 calls */
|
||||
|
@ -2320,7 +2326,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
WARN("Get Extended DPB: buffer lengths incorrect\n");
|
||||
WARN("CX = %lx, buffer[0] = %x\n", context->Ecx, *buffer);
|
||||
SET_CFLAG(context);
|
||||
AL_reg(context) = 0x18; /* bad buffer length */
|
||||
SET_AL( context, 0x18 ); /* bad buffer length */
|
||||
}
|
||||
|
||||
/* buffer checks out */
|
||||
|
@ -2354,12 +2360,12 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
edpb->root_cluster = 0;
|
||||
|
||||
RESET_CFLAG(context); /* clear carry */
|
||||
AX_reg(context) = 0;
|
||||
SET_AX( context, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
AX_reg(context) = 0x00ff;
|
||||
SET_CFLAG(context);
|
||||
SET_AX( context, 0x00ff );
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -2369,7 +2375,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
case 0x05: /* extended absolute disk read/write */
|
||||
FIXME("Unimplemented FAT32 int32 function %04x\n", AX_reg(context));
|
||||
SET_CFLAG(context);
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2388,7 +2394,7 @@ void WINAPI DOS3Call( CONTEXT86 *context )
|
|||
|
||||
if( bSetDOSExtendedError ) /* set general error condition */
|
||||
{
|
||||
AX_reg(context) = GetLastError();
|
||||
SET_AX( context, GetLastError() );
|
||||
SET_CFLAG(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void WINAPI INT_Int25Handler( CONTEXT86 *context )
|
|||
if (!DRIVE_IsValid(LOBYTE(context->Eax)))
|
||||
{
|
||||
SET_CFLAG(context);
|
||||
AX_reg(context) = 0x0201; /* unknown unit */
|
||||
SET_AX( context, 0x0201 ); /* unknown unit */
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -70,4 +70,3 @@ void WINAPI INT_Int25Handler( CONTEXT86 *context )
|
|||
DRIVE_RawRead(LOBYTE(context->Eax), begin, length, dataptr, TRUE);
|
||||
RESET_CFLAG(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ void WINAPI INT_Int26Handler( CONTEXT86 *context )
|
|||
if (!DRIVE_IsValid(LOBYTE(context->Eax)))
|
||||
{
|
||||
SET_CFLAG(context);
|
||||
AX_reg(context) = 0x0201; /* unknown unit */
|
||||
SET_AX( context, 0x0201 ); /* unknown unit */
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
|
|||
switch(AH_reg(context))
|
||||
{
|
||||
case 0x10:
|
||||
AL_reg(context) = 0xff; /* share is installed */
|
||||
SET_AL( context, 0xff ); /* share is installed */
|
||||
break;
|
||||
|
||||
case 0x11: /* Network Redirector / IFSFUNC */
|
||||
|
@ -93,7 +93,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
|
|||
case 0x04:
|
||||
case 0x06:
|
||||
context->SegEs = 0x0001;
|
||||
DI_reg(context) = 0x0000;
|
||||
SET_DI( context, 0x0000 );
|
||||
break;
|
||||
case 0x08:
|
||||
FIXME("No real-mode handler for errors yet! (bye!)\n");
|
||||
|
@ -125,12 +125,12 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
|
|||
{
|
||||
case 0x00: /* XMS v2+ installation check */
|
||||
WARN("XMS is not fully implemented\n");
|
||||
AL_reg(context) = 0x80;
|
||||
SET_AL( context, 0x80 );
|
||||
break;
|
||||
case 0x10: /* XMS v2+ get driver address */
|
||||
{
|
||||
context->SegEs = DOSMEM_xms_seg;
|
||||
BX_reg(context) = 0;
|
||||
SET_BX( context, 0 );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -138,7 +138,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
|
|||
}
|
||||
#else
|
||||
FIXME("check for XMS (not supported)\n");
|
||||
AL_reg(context) = 0x42; /* != 0x80 */
|
||||
SET_AL( context, 0x42 ); /* != 0x80 */
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -194,7 +194,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
|
|||
switch(LOBYTE(context->Eax))
|
||||
{
|
||||
case 0x01: /* check if redirected drive */
|
||||
AL_reg(context) = 0; /* not redirected */
|
||||
SET_AL( context, 0 ); /* not redirected */
|
||||
break;
|
||||
default:
|
||||
INT_BARF( context, 0x2f );
|
||||
|
@ -204,7 +204,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
|
|||
switch (LOBYTE(context->Eax))
|
||||
{
|
||||
case 0x0: /* Low-level Netware installation check AL=0 not installed.*/
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
break;
|
||||
case 0x20: /* Get VLM Call Address */
|
||||
/* return nothing -> NetWare not installed */
|
||||
|
@ -215,7 +215,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
|
|||
}
|
||||
break;
|
||||
case 0xb7: /* append */
|
||||
AL_reg(context) = 0; /* not installed */
|
||||
SET_AL( context, 0 ); /* not installed */
|
||||
break;
|
||||
case 0xb8: /* network */
|
||||
switch (LOBYTE(context->Eax))
|
||||
|
@ -229,7 +229,7 @@ void WINAPI INT_Int2fHandler( CONTEXT86 *context )
|
|||
}
|
||||
break;
|
||||
case 0xbd: /* some Novell network install check ??? */
|
||||
AX_reg(context) = 0xa5a5; /* pretend to have Novell IPX installed */
|
||||
SET_AX( context, 0xa5a5 ); /* pretend to have Novell IPX installed */
|
||||
break;
|
||||
case 0xbf: /* REDIRIFS.EXE */
|
||||
switch (LOBYTE(context->Eax))
|
||||
|
@ -298,15 +298,13 @@ static void do_int2f_16( CONTEXT86 *context )
|
|||
switch(LOBYTE(context->Eax))
|
||||
{
|
||||
case 0x00: /* Windows enhanced mode installation check */
|
||||
AX_reg(context) = (GetWinFlags16() & WF_ENHANCED) ?
|
||||
LOWORD(GetVersion16()) : 0;
|
||||
SET_AX( context, (GetWinFlags16() & WF_ENHANCED) ? LOWORD(GetVersion16()) : 0 );
|
||||
break;
|
||||
|
||||
case 0x0a: /* Get Windows version and type */
|
||||
AX_reg(context) = 0;
|
||||
BX_reg(context) = (LOWORD(GetVersion16()) << 8) |
|
||||
(LOWORD(GetVersion16()) >> 8);
|
||||
CX_reg(context) = (GetWinFlags16() & WF_ENHANCED) ? 3 : 2;
|
||||
SET_AX( context, 0 );
|
||||
SET_BX( context, (LOWORD(GetVersion16()) << 8) | (LOWORD(GetVersion16()) >> 8) );
|
||||
SET_CX( context, (GetWinFlags16() & WF_ENHANCED) ? 3 : 2 );
|
||||
break;
|
||||
|
||||
case 0x0b: /* Identify Windows-aware TSRs */
|
||||
|
@ -331,7 +329,7 @@ static void do_int2f_16( CONTEXT86 *context )
|
|||
* *doesn't* use 100% CPU...
|
||||
*/
|
||||
Sleep(55); /* just wait 55ms (one "timer tick") for now. */
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
break;
|
||||
|
||||
case 0x81: /* Begin critical section. */
|
||||
|
@ -348,7 +346,7 @@ static void do_int2f_16( CONTEXT86 *context )
|
|||
* According to Ralf Brown's Interrupt List, never return 0. But it
|
||||
* seems to work okay (returning 0), just to be sure we return 1.
|
||||
*/
|
||||
BX_reg(context) = 1; /* VM 1 is probably the System VM */
|
||||
SET_BX( context, 1 ); /* VM 1 is probably the System VM */
|
||||
break;
|
||||
|
||||
case 0x84: /* Get device API entry point */
|
||||
|
@ -359,25 +357,25 @@ static void do_int2f_16( CONTEXT86 *context )
|
|||
if (!addr) /* not supported */
|
||||
ERR("Accessing unknown VxD %04x - Expect a failure now.\n", BX_reg(context) );
|
||||
context->SegEs = SELECTOROF(addr);
|
||||
DI_reg(context) = OFFSETOF(addr);
|
||||
SET_DI( context, OFFSETOF(addr) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x86: /* DPMI detect mode */
|
||||
AX_reg(context) = 0; /* Running under DPMI */
|
||||
SET_AX( context, 0 ); /* Running under DPMI */
|
||||
break;
|
||||
|
||||
case 0x87: /* DPMI installation check */
|
||||
{
|
||||
SYSTEM_INFO si;
|
||||
GetSystemInfo(&si);
|
||||
AX_reg(context) = 0x0000; /* DPMI Installed */
|
||||
BX_reg(context) = 0x0001; /* 32bits available */
|
||||
CL_reg(context) = si.wProcessorLevel;
|
||||
DX_reg(context) = 0x005a; /* DPMI major/minor 0.90 */
|
||||
SI_reg(context) = 0; /* # of para. of DOS extended private data */
|
||||
SET_AX( context, 0x0000 ); /* DPMI Installed */
|
||||
SET_BX( context, 0x0001 ); /* 32bits available */
|
||||
SET_CL( context, si.wProcessorLevel );
|
||||
SET_DX( context, 0x005a ); /* DPMI major/minor 0.90 */
|
||||
SET_SI( context, 0 ); /* # of para. of DOS extended private data */
|
||||
context->SegEs = DOSMEM_dpmi_seg;
|
||||
DI_reg(context) = 0; /* ES:DI is DPMI switch entry point */
|
||||
SET_DI( context, 0 ); /* ES:DI is DPMI switch entry point */
|
||||
break;
|
||||
}
|
||||
case 0x8a: /* DPMI get vendor-specific API entry point. */
|
||||
|
@ -477,17 +475,17 @@ static void MSCDEX_Handler(CONTEXT86* context)
|
|||
}
|
||||
}
|
||||
TRACE("Installation check: %d cdroms, starting at %d\n", count, drive);
|
||||
BX_reg(context) = count;
|
||||
CX_reg(context) = (drive < 26) ? drive : 0;
|
||||
SET_BX( context, count );
|
||||
SET_CX( context, (drive < 26) ? drive : 0 );
|
||||
break;
|
||||
|
||||
case 0x0B: /* drive check */
|
||||
AX_reg(context) = is_cdrom(CX_reg(context));
|
||||
BX_reg(context) = 0xADAD;
|
||||
SET_AX( context, is_cdrom(CX_reg(context)) );
|
||||
SET_BX( context, 0xADAD );
|
||||
break;
|
||||
|
||||
case 0x0C: /* get version */
|
||||
BX_reg(context) = 0x020a;
|
||||
SET_BX( context, 0x020a );
|
||||
TRACE("Version number => %04x\n", BX_reg(context));
|
||||
break;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ void WINAPI INT_Int4bHandler( CONTEXT86 *context )
|
|||
if(AL_reg(context) != 0x02) /* if not install check */
|
||||
{
|
||||
SET_CFLAG(context);
|
||||
AL_reg(context) = 0x0f; /* function is not implemented */
|
||||
SET_AL( context, 0x0f ); /* function is not implemented */
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -35,6 +35,6 @@ void WINAPI NetBIOSCall16( CONTEXT86 *context )
|
|||
BYTE* ptr;
|
||||
ptr = MapSL( MAKESEGPTR(context->SegEs,BX_reg(context)) );
|
||||
FIXME("(%p): command code %02x (ignored)\n",context, *ptr);
|
||||
AL_reg(context) = *(ptr+0x01) = 0xFB; /* NetBIOS emulator not found */
|
||||
*(ptr+0x01) = 0xFB; /* NetBIOS emulator not found */
|
||||
SET_AL( context, 0xFB );
|
||||
}
|
||||
|
||||
|
|
44
msdos/vxd.c
44
msdos/vxd.c
|
@ -72,13 +72,13 @@ void WINAPI VXD_VMM ( CONTEXT86 *context )
|
|||
switch(service)
|
||||
{
|
||||
case 0x0000: /* version */
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
case 0x026d: /* Get_Debug_Flag '/m' */
|
||||
case 0x026e: /* Get_Debug_Flag '/n' */
|
||||
AL_reg(context) = 0;
|
||||
SET_AL( context, 0 );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -102,13 +102,13 @@ void WINAPI VXD_PageFile( CONTEXT86 *context )
|
|||
{
|
||||
case 0x00: /* get version, is this windows version? */
|
||||
TRACE("returning version\n");
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
case 0x01: /* get swap file info */
|
||||
TRACE("VxD PageFile: returning swap file info\n");
|
||||
AX_reg(context) = 0x00; /* paging disabled */
|
||||
SET_AX( context, 0x00 ); /* paging disabled */
|
||||
context->Ecx = 0; /* maximum size of paging file */
|
||||
/* FIXME: do I touch DS:SI or DS:DI? */
|
||||
RESET_CFLAG(context);
|
||||
|
@ -145,7 +145,7 @@ void WINAPI VXD_Reboot ( CONTEXT86 *context )
|
|||
switch(service)
|
||||
{
|
||||
case 0x0000: /* version */
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -166,7 +166,7 @@ void WINAPI VXD_VDD ( CONTEXT86 *context )
|
|||
switch(service)
|
||||
{
|
||||
case 0x0000: /* version */
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -187,7 +187,7 @@ void WINAPI VXD_VMD ( CONTEXT86 *context )
|
|||
switch(service)
|
||||
{
|
||||
case 0x0000: /* version */
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -209,8 +209,8 @@ void WINAPI VXD_VXDLoader( CONTEXT86 *context )
|
|||
{
|
||||
case 0x0000: /* get version */
|
||||
TRACE("returning version\n");
|
||||
AX_reg(context) = 0x0000;
|
||||
DX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, 0x0000 );
|
||||
SET_DX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -218,21 +218,21 @@ void WINAPI VXD_VXDLoader( CONTEXT86 *context )
|
|||
FIXME("load device %04lx:%04x (%s)\n",
|
||||
context->SegDs, DX_reg(context),
|
||||
debugstr_a(MapSL(MAKESEGPTR(context->SegDs, DX_reg(context)))));
|
||||
AX_reg(context) = 0x0000;
|
||||
SET_AX( context, 0x0000 );
|
||||
context->SegEs = 0x0000;
|
||||
DI_reg(context) = 0x0000;
|
||||
SET_DI( context, 0x0000 );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
case 0x0002: /* unload device */
|
||||
FIXME("unload device (%08lx)\n", context->Ebx);
|
||||
AX_reg(context) = 0x0000;
|
||||
SET_AX( context, 0x0000 );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
default:
|
||||
VXD_BARF( context, "VXDLDR" );
|
||||
AX_reg(context) = 0x000B; /* invalid function number */
|
||||
SET_AX( context, 0x000B ); /* invalid function number */
|
||||
SET_CFLAG(context);
|
||||
break;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ void WINAPI VXD_Shell( CONTEXT86 *context )
|
|||
{
|
||||
case 0x0000:
|
||||
TRACE("returning version\n");
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
context->Ebx = 1; /* system VM Handle */
|
||||
break;
|
||||
|
||||
|
@ -310,7 +310,7 @@ void WINAPI VXD_Shell( CONTEXT86 *context )
|
|||
|
||||
/* the new Win95 shell API */
|
||||
case 0x0100: /* get version */
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
break;
|
||||
|
||||
case 0x0104: /* retrieve Hook_Properties list */
|
||||
|
@ -344,7 +344,7 @@ void WINAPI VXD_Comm( CONTEXT86 *context )
|
|||
{
|
||||
case 0x0000: /* get version */
|
||||
TRACE("returning version\n");
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -368,7 +368,7 @@ void WINAPI VXD_Timer( CONTEXT86 *context )
|
|||
switch(service)
|
||||
{
|
||||
case 0x0000: /* version */
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -404,7 +404,7 @@ void WINAPI VXD_TimerAPI ( CONTEXT86 *context )
|
|||
switch(service)
|
||||
{
|
||||
case 0x0000: /* version */
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -415,7 +415,7 @@ void WINAPI VXD_TimerAPI ( CONTEXT86 *context )
|
|||
CreateSystemTimer( 55, System_Time_Tick );
|
||||
}
|
||||
|
||||
AX_reg(context) = System_Time_Selector;
|
||||
SET_AX( context, System_Time_Selector );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -436,7 +436,7 @@ void WINAPI VXD_ConfigMG ( CONTEXT86 *context )
|
|||
switch(service)
|
||||
{
|
||||
case 0x0000: /* version */
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -457,7 +457,7 @@ void WINAPI VXD_Enable ( CONTEXT86 *context )
|
|||
switch(service)
|
||||
{
|
||||
case 0x0000: /* version */
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
@ -478,7 +478,7 @@ void WINAPI VXD_APM ( CONTEXT86 *context )
|
|||
switch(service)
|
||||
{
|
||||
case 0x0000: /* version */
|
||||
AX_reg(context) = VXD_WinVersion();
|
||||
SET_AX( context, VXD_WinVersion() );
|
||||
RESET_CFLAG(context);
|
||||
break;
|
||||
|
||||
|
|
|
@ -1080,8 +1080,8 @@ static DWORD VxDCall_VWin32( DWORD service, CONTEXT86 *context )
|
|||
|
||||
TRACE("Int31/DPMI dispatch(%08lx)\n", callnum);
|
||||
|
||||
AX_reg(context) = callnum;
|
||||
CX_reg(context) = parm;
|
||||
SET_AX( context, callnum );
|
||||
SET_CX( context, parm );
|
||||
INT_Int31Handler(context);
|
||||
|
||||
return LOWORD(context->Eax);
|
||||
|
|
|
@ -369,11 +369,11 @@ void WINAPI keybd_event16( CONTEXT86 *context )
|
|||
{
|
||||
DWORD dwFlags = 0;
|
||||
|
||||
if (AH_reg(context) & 0x80) dwFlags |= KEYEVENTF_KEYUP;
|
||||
if (BH_reg(context) & 1 ) dwFlags |= KEYEVENTF_EXTENDEDKEY;
|
||||
if (HIBYTE(context->Eax) & 0x80) dwFlags |= KEYEVENTF_KEYUP;
|
||||
if (HIBYTE(context->Ebx) & 0x01) dwFlags |= KEYEVENTF_EXTENDEDKEY;
|
||||
|
||||
keybd_event( AL_reg(context), BL_reg(context),
|
||||
dwFlags, MAKELONG(SI_reg(context), DI_reg(context)) );
|
||||
keybd_event( LOBYTE(context->Eax), LOBYTE(context->Ebx),
|
||||
dwFlags, MAKELONG(LOWORD(context->Esi), LOWORD(context->Edi)) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -401,8 +401,8 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
|
|||
*/
|
||||
void WINAPI mouse_event16( CONTEXT86 *context )
|
||||
{
|
||||
mouse_event( AX_reg(context), BX_reg(context), CX_reg(context),
|
||||
DX_reg(context), MAKELONG(SI_reg(context), DI_reg(context)) );
|
||||
mouse_event( LOWORD(context->Eax), LOWORD(context->Ebx), LOWORD(context->Ecx),
|
||||
LOWORD(context->Edx), MAKELONG(context->Esi, context->Edi) );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
Loading…
Reference in New Issue