Fix Int 21h AH=38h bugs noted by Arkady

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/branches/UNSTABLE@1079 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Luchezar Georgiev 2004-12-30 15:59:38 +00:00
parent 79be05f804
commit c93f67a15b

View File

@ -728,8 +728,7 @@ dispatch:
*/ */
UBYTE FAR *retp = MK_FP(r->cs, r->ip); UBYTE FAR *retp = MK_FP(r->cs, r->ip);
if (retp[0] == 0x3d && /* cmp ax, xxyy */ if (retp[0] == 0x3d) /* cmp ax, xxyy */
retp[3] == 0x74) /* jne error */
{ {
lr.AX = *(UWORD FAR *)&retp[1]; lr.AX = *(UWORD FAR *)&retp[1];
} }
@ -833,18 +832,18 @@ dispatch:
/* Get/Set Country Info */ /* Get/Set Country Info */
case 0x38: case 0x38:
{ {
if (lr.AL != 0xff) UWORD ccode = lr.AL != 0xFF ? lr.AL : lr.BX;
lr.BX = lr.AL;
if (0xffff == lr.DX) if (0xffff == lr.DX)
{ {
/* Set Country Code */ /* Set Country Code */
rc = DosSetCountry(lr.BX); rc = DosSetCountry(ccode);
} }
else else
{ {
/* Get Country Information */ /* Get Country Information */
rc = DosGetCountryInformation(lr.BX ? lr.BX : NLS_DEFAULT, FP_DS_DX); rc = DosGetCountryInformation(ccode ? ccode : NLS_DEFAULT, FP_DS_DX);
if (rc >= SUCCESS)
lr.BX = ccode ? ccode : nlsPackageHardcoded.cntry;
} }
goto short_check; goto short_check;
} }
@ -959,7 +958,6 @@ dispatch:
DosMemLargest(&lr.BX); DosMemLargest(&lr.BX);
if (DosMemCheck() != SUCCESS) if (DosMemCheck() != SUCCESS)
panic("MCB chain corrupted"); panic("MCB chain corrupted");
goto error_exit;
} }
lr.AX++; /* DosMemAlloc() returns seg of MCB rather than data */ lr.AX++; /* DosMemAlloc() returns seg of MCB rather than data */
break; break;
@ -970,7 +968,6 @@ dispatch:
{ {
if (DosMemCheck() != SUCCESS) if (DosMemCheck() != SUCCESS)
panic("MCB chain corrupted"); panic("MCB chain corrupted");
goto error_exit;
} }
break; break;
@ -990,7 +987,6 @@ dispatch:
#endif #endif
if (DosMemCheck() != SUCCESS) if (DosMemCheck() != SUCCESS)
panic("after 4a: MCB chain corrupted"); panic("after 4a: MCB chain corrupted");
goto error_exit;
} }
lr.AX = lr.ES; /* Undocumented MS-DOS behaviour expected by BRUN45! */ lr.AX = lr.ES; /* Undocumented MS-DOS behaviour expected by BRUN45! */
break; break;
@ -1118,8 +1114,7 @@ dispatch:
switch (lr.AL) switch (lr.AL)
{ {
case 0x00: case 0x00:
lr.AL = mem_access_mode; lr.AX = mem_access_mode;
lr.AH = 0;
break; break;
case 0x01: case 0x01:
@ -1204,9 +1199,7 @@ dispatch:
case 0x09: case 0x09:
rc = remote_printredir(lr.DX, Int21AX); rc = remote_printredir(lr.DX, Int21AX);
CLEAR_CARRY_FLAG(); CLEAR_CARRY_FLAG();
if (rc != SUCCESS) goto short_check;
goto error_exit;
break;
/* Set Extended Error */ /* Set Extended Error */
case 0x0a: case 0x0a:
@ -1315,7 +1308,8 @@ dispatch:
lr.DS = FP_SEG(p); lr.DS = FP_SEG(p);
lr.SI = FP_OFF(p); lr.SI = FP_OFF(p);
} }
lr.AL = 0x00; else
lr.AL = 0;
#if 0 #if 0
/* not really supported, but will pass. */ /* not really supported, but will pass. */