From 79be05f804b00463885cdd37d613bf413938d365 Mon Sep 17 00:00:00 2001 From: Luchezar Georgiev Date: Wed, 29 Dec 2004 19:27:31 +0000 Subject: [PATCH] Remove hack in Int 21h AH=38h, revert bad change in _CmdInstall git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/branches/UNSTABLE@1078 6ac86273-5f31-0410-b378-82cca8765d1b --- docs/history.txt | 1 + kernel/config.c | 4 ++-- kernel/inthndlr.c | 33 +++++++++------------------------ 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/docs/history.txt b/docs/history.txt index e640cba..8845505 100644 --- a/docs/history.txt +++ b/docs/history.txt @@ -315,6 +315,7 @@ - set AX = ES after Int 21h/4Ah (undocumented but expected by BRUN45) (the last 2 changes needed to fix bugs discovered by Michael Devore) - added Int 2Fh/2Fh processing to set DOS version as per MS-DOS 4.0 + - optimised Int 21h/AH=38h Get Country Information, removed cntry hack * autoexec.bat now single-line for FreeCOM compatibility when EOL=LF * break.c: check_handle_break() return was undefined if no Ctrl-break * config.sys: all commands removed as they were close to defaults diff --git a/kernel/config.c b/kernel/config.c index 439a5ef..6a8e6c7 100644 --- a/kernel/config.c +++ b/kernel/config.c @@ -2073,8 +2073,8 @@ STATIC void _CmdInstall(PCStr p, int mode) if (len > sizeof args.ctBuffer - 2) len = sizeof args.ctBuffer - 2; /* trim too long line */ args.ctCount = (UBYTE)len; - args.ctBuffer[len-2] = '\r'; - args.ctBuffer[len-1] = '\0'; + args.ctBuffer[len] = '\r'; + args.ctBuffer[len+1] = '\0'; memcpy(args.ctBuffer, p, len); set_strategy(mode); diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index 53c6168..53b5598 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -106,8 +106,8 @@ VOID ASMCFUNC int21_syscall(iregs FAR * irp) irp->DH = version_flags; /* bit3:runs in ROM,bit 4: runs in HMA */ break; - case 0x03: /* DOS 7 does not set AL */ - case 0x07: /* neither here */ + /* case 0x03: */ /* DOS 7 does not set AL */ + /* case 0x07: */ /* neither here */ default: /* set AL=0xFF as error, NOT carry */ irp->AL = 0xff; @@ -124,10 +124,8 @@ VOID ASMCFUNC int21_syscall(iregs FAR * irp) case 0xfd: bDumpRdWrParms = !bDumpRdWrParms; break; -#endif /* Toggle DOS-C syscall trace dump */ -#ifdef DEBUG case 0xfe: bDumpRegs = !bDumpRegs; break; @@ -596,7 +594,6 @@ dispatch: default: #ifdef DEBUG printf("Unsupported INT21 AH = 0x%x, AL = 0x%x.\n", lr.AH, lr.AL); -#endif /* Fall through. */ /* CP/M compatibility functions */ @@ -608,6 +605,7 @@ dispatch: case 0x61: #endif case 0x6b: +#endif lr.AL = 0; break; @@ -731,10 +729,9 @@ dispatch: UBYTE FAR *retp = MK_FP(r->cs, r->ip); if (retp[0] == 0x3d && /* cmp ax, xxyy */ - (retp[3] == 0x75 || retp[3] == 0x74)) /* je/jne error */ + retp[3] == 0x74) /* jne error */ { - lr.AL = retp[1]; - lr.AH = retp[2]; + lr.AX = *(UWORD FAR *)&retp[1]; } #if TOM /* Disable the much rarer case to save code size. The only MS-DOS * utility featuring it is DOSKEY, and FreeCom almost replaces it @@ -836,30 +833,18 @@ dispatch: /* Get/Set Country Info */ case 0x38: { - UWORD cntry = lr.AL; - - if (cntry == 0xff) - cntry = lr.BX; + if (lr.AL != 0xff) + lr.BX = lr.AL; if (0xffff == lr.DX) { /* Set Country Code */ - rc = DosSetCountry(cntry); + rc = DosSetCountry(lr.BX); } else { - if (cntry == 0) - cntry--; /* Get Country Information */ - rc = DosGetCountryInformation(cntry, FP_DS_DX); - if (rc >= SUCCESS) - { - /* HACK FIXME */ - if (cntry == (UWORD) - 1) - cntry = 1; - /* END OF HACK */ - lr.AX = lr.BX = cntry; - } + rc = DosGetCountryInformation(lr.BX ? lr.BX : NLS_DEFAULT, FP_DS_DX); } goto short_check; }