Commit be1c6deb authored by Jukka Heinonen's avatar Jukka Heinonen Committed by Alexandre Julliard

Move int21 country information handling to winedos.

Improve country information handling. Move collate table to upper memory.
parent 647c1a33
...@@ -162,7 +162,6 @@ typedef struct ...@@ -162,7 +162,6 @@ typedef struct
extern WORD DOSMEM_0000H; extern WORD DOSMEM_0000H;
extern WORD DOSMEM_BiosDataSeg; extern WORD DOSMEM_BiosDataSeg;
extern WORD DOSMEM_BiosSysSeg; extern WORD DOSMEM_BiosSysSeg;
extern DWORD DOSMEM_CollateTable;
/* msdos/dosmem.c */ /* msdos/dosmem.c */
extern BOOL DOSMEM_Init(BOOL); extern BOOL DOSMEM_Init(BOOL);
......
...@@ -50,8 +50,6 @@ WORD DOSMEM_0000H; /* segment at 0:0 */ ...@@ -50,8 +50,6 @@ WORD DOSMEM_0000H; /* segment at 0:0 */
WORD DOSMEM_BiosDataSeg; /* BIOS data segment at 0x40:0 */ WORD DOSMEM_BiosDataSeg; /* BIOS data segment at 0x40:0 */
WORD DOSMEM_BiosSysSeg; /* BIOS ROM segment at 0xf000:0 */ WORD DOSMEM_BiosSysSeg; /* BIOS ROM segment at 0xf000:0 */
DWORD DOSMEM_CollateTable;
/* use 2 low bits of 'size' for the housekeeping */ /* use 2 low bits of 'size' for the housekeeping */
#define DM_BLOCK_DEBUG 0xABE00000 #define DM_BLOCK_DEBUG 0xABE00000
...@@ -307,80 +305,6 @@ static void DOSMEM_FillBiosSegments(void) ...@@ -307,80 +305,6 @@ static void DOSMEM_FillBiosSegments(void)
} }
/*********************************************************************** /***********************************************************************
* DOSMEM_InitCollateTable
*
* Initialises the collate table (character sorting, language dependent)
*/
static void DOSMEM_InitCollateTable()
{
DWORD x;
unsigned char *tbl;
int i;
x = GlobalDOSAlloc16(258);
DOSMEM_CollateTable = MAKELONG(0,(x>>16));
tbl = DOSMEM_MapRealToLinear(DOSMEM_CollateTable);
*(WORD*)tbl = 0x100;
tbl += 2;
for ( i = 0; i < 0x100; i++) *tbl++ = i;
}
/***********************************************************************
* DOSMEM_InitErrorTable
*
* Initialises the error tables (DOS 5+)
*/
static void DOSMEM_InitErrorTable()
{
#if 0 /* no longer used */
DWORD x;
char *call;
/* We will use a snippet of real mode code that calls */
/* a WINE-only interrupt to handle moving the requested */
/* message into the buffer... */
/* FIXME - There is still something wrong... */
/* FIXME - Find hex values for opcodes...
(On call, AX contains message number
DI contains 'offset' (??)
Resturn, ES:DI points to counted string )
PUSH BX
MOV BX, AX
MOV AX, (arbitrary subfunction number)
INT (WINE-only interrupt)
POP BX
RET
*/
const int code = 4;
const int buffer = 80;
const int SIZE_TO_ALLOCATE = code + buffer;
/* FIXME - Complete rewrite of the table system to save */
/* precious DOS space. Now, we return the 0001:???? as */
/* DOS 4+ (??, it seems to be the case in MS 7.10) treats that */
/* as a special case and programs will use the alternate */
/* interface (a farcall returned with INT 24 (AX = 0x122e, DL = */
/* 0x08) which lets us have a smaller memory footprint anyway. */
x = GlobalDOSAlloc16(SIZE_TO_ALLOCATE);
DOSMEM_ErrorCall = MAKELONG(0,(x>>16));
DOSMEM_ErrorBuffer = DOSMEM_ErrorCall + code;
call = DOSMEM_MapRealToLinear(DOSMEM_ErrorCall);
memset(call, 0, SIZE_TO_ALLOCATE);
#endif
/* FIXME - Copy assembly into buffer here */
}
/***********************************************************************
* DOSMEM_InitMemory * DOSMEM_InitMemory
* *
* Initialises the DOS memory structures. * Initialises the DOS memory structures.
...@@ -480,8 +404,6 @@ BOOL DOSMEM_Init(BOOL dos_init) ...@@ -480,8 +404,6 @@ BOOL DOSMEM_Init(BOOL dos_init)
DOSMEM_FillBiosSegments(); DOSMEM_FillBiosSegments();
DOSMEM_FillIsrTable(); DOSMEM_FillIsrTable();
DOSMEM_InitMemory(); DOSMEM_InitMemory();
DOSMEM_InitCollateTable();
DOSMEM_InitErrorTable();
already_done = 1; already_done = 1;
} }
else if (dos_init && !already_mapped) else if (dos_init && !already_mapped)
......
...@@ -122,15 +122,12 @@ struct EDPB /* FAT32 extended Drive Parameter Block */ ...@@ -122,15 +122,12 @@ struct EDPB /* FAT32 extended Drive Parameter Block */
}; };
WORD CodePage = 437;
DWORD dpbsegptr; DWORD dpbsegptr;
struct DosHeap { struct DosHeap {
BYTE InDosFlag;
BYTE mediaID; BYTE mediaID;
BYTE biosdate[8]; BYTE biosdate[8];
struct DPB dpb; struct DPB dpb;
BYTE DummyDBCSLeadTable[6];
}; };
static struct DosHeap *heap; static struct DosHeap *heap;
static WORD DosHeapHandle; static WORD DosHeapHandle;
...@@ -153,9 +150,7 @@ static BOOL INT21_CreateHeap(void) ...@@ -153,9 +150,7 @@ static BOOL INT21_CreateHeap(void)
} }
heap = (struct DosHeap *) GlobalLock16(DosHeapHandle); heap = (struct DosHeap *) GlobalLock16(DosHeapHandle);
dpbsegptr = MAKESEGPTR(DosHeapHandle,(int)&heap->dpb-(int)heap); dpbsegptr = MAKESEGPTR(DosHeapHandle,(int)&heap->dpb-(int)heap);
heap->InDosFlag = 0;
strcpy(heap->biosdate, "01/01/80"); strcpy(heap->biosdate, "01/01/80");
memset(heap->DummyDBCSLeadTable, 0, 6);
return TRUE; return TRUE;
} }
...@@ -751,21 +746,6 @@ static BOOL INT21_GetCurrentDirectory( CONTEXT86 *context ) ...@@ -751,21 +746,6 @@ static BOOL INT21_GetCurrentDirectory( CONTEXT86 *context )
} }
static void INT21_GetDBCSLeadTable( CONTEXT86 *context )
{
if (heap || INT21_CreateHeap())
{ /* return an empty table just as DOS 4.0+ does */
context->SegDs = DosHeapHandle;
SET_SI( context, (int)&heap->DummyDBCSLeadTable - (int)heap );
}
else
{
SET_AX( context, 0x1 ); /* error */
SET_CFLAG(context);
}
}
static int INT21_GetDiskSerialNumber( CONTEXT86 *context ) static int INT21_GetDiskSerialNumber( CONTEXT86 *context )
{ {
BYTE *dataptr = CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx); BYTE *dataptr = CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx);
...@@ -1167,13 +1147,6 @@ void WINAPI INT_Int21Handler( CONTEXT86 *context ) ...@@ -1167,13 +1147,6 @@ void WINAPI INT_Int21Handler( CONTEXT86 *context )
} }
break; break;
case 0x34: /* GET ADDRESS OF INDOS FLAG */
TRACE("GET ADDRESS OF INDOS FLAG\n");
if (!heap) INT21_CreateHeap();
context->SegEs = DosHeapHandle;
SET_BX( context, (int)&heap->InDosFlag - (int)heap );
break;
case 0x36: /* GET FREE DISK SPACE */ case 0x36: /* GET FREE DISK SPACE */
TRACE("GET FREE DISK SPACE FOR DRIVE %s\n", TRACE("GET FREE DISK SPACE FOR DRIVE %s\n",
INT21_DriveName( DL_reg(context))); INT21_DriveName( DL_reg(context)));
...@@ -1639,76 +1612,6 @@ void WINAPI INT_Int21Handler( CONTEXT86 *context ) ...@@ -1639,76 +1612,6 @@ void WINAPI INT_Int21Handler( CONTEXT86 *context )
} }
break; break;
case 0x61: /* UNUSED */
case 0x63: /* misc. language support */
switch (AL_reg(context)) {
case 0x00: /* GET DOUBLE BYTE CHARACTER SET LEAD-BYTE TABLE */
INT21_GetDBCSLeadTable(context);
break;
}
break;
case 0x65:{/* GET EXTENDED COUNTRY INFORMATION */
BYTE *dataptr=CTX_SEG_OFF_TO_LIN(context, context->SegEs,context->Edi);
TRACE("GET EXTENDED COUNTRY INFORMATION code page %d country %d\n",
BX_reg(context), DX_reg(context));
switch (AL_reg(context)) {
case 0x01:
TRACE("\tget general internationalization info\n");
dataptr[0] = 0x1;
*(WORD*)(dataptr+1) = 41;
*(WORD*)(dataptr+3) = GetSystemDefaultLangID();
*(WORD*)(dataptr+5) = CodePage;
*(DWORD*)(dataptr+0x19) = 0; /* FIXME: ptr to case map routine */
break;
case 0x06:
TRACE("\tget pointer to collating sequence table\n");
dataptr[0] = 0x06;
*(DWORD*)(dataptr+1) = MAKELONG(DOSMEM_CollateTable & 0xFFFF,DOSMEM_AllocSelector(DOSMEM_CollateTable>>16));
SET_CX( context, 258 );/*FIXME: size of table?*/
break;
case 0x20:
TRACE("\tConvert char to uppercase\n");
SET_DL( context, toupper(DL_reg(context)) );
break;
case 0x21:
TRACE("\tconvert string to uppercase with length\n");
{
char *ptr = (char *)CTX_SEG_OFF_TO_LIN(context,context->SegDs,context->Edx);
WORD len = CX_reg(context);
while (len--) { *ptr = toupper(*ptr); ptr++; }
}
break;
case 0x22:
TRACE("\tConvert ASCIIZ string to uppercase\n");
_strupr( (LPSTR)CTX_SEG_OFF_TO_LIN(context,context->SegDs,context->Edx) );
break;
default:
TRACE("\tunimplemented function %d\n",AL_reg(context));
INT_BARF( context, 0x21 );
SET_CFLAG(context);
break;
}
break;
}
case 0x66: /* GLOBAL CODE PAGE TABLE */
switch (AL_reg(context))
{
case 0x01:
TRACE("GET GLOBAL CODE PAGE TABLE\n");
SET_BX( context, CodePage );
SET_DX( context, CodePage );
RESET_CFLAG(context);
break;
case 0x02:
TRACE("SET GLOBAL CODE PAGE TABLE active page %d system page %d\n",
BX_reg(context),DX_reg(context));
CodePage = BX_reg(context);
RESET_CFLAG(context);
break;
}
break;
case 0x68: /* "FFLUSH" - COMMIT FILE */ case 0x68: /* "FFLUSH" - COMMIT FILE */
case 0x6a: /* COMMIT FILE */ case 0x6a: /* COMMIT FILE */
TRACE("FFLUSH/COMMIT handle %d\n",BX_reg(context)); TRACE("FFLUSH/COMMIT handle %d\n",BX_reg(context));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment