diff --git a/docs/history.txt b/docs/history.txt index 96e7640..a36d68d 100644 --- a/docs/history.txt +++ b/docs/history.txt @@ -342,13 +342,36 @@ (the last 2 changes proposed by Bart Oldeman) + Changes Eduardo * country.asm: added NLS uppercase/collating tables (437,850,857,858) - * inthndlr.c: added Int 2Fh/26-29h processing for NLSFUNC (with Lucho) + * inthndlr.c: + - added Int 2Fh/26-29h processing for NLSFUNC (with Lucho) + - DOS-63-00 returns DBCS table from the active NLS package, not the + harcoded one. + - DOS-65-23: DosYesNo() arg is now DX, not DL. * nls.c: MuxLoadPkg(), MuxGo() functions modified for NLSFUNC + - New macro getTable7() + - New functions nlsIsDBCS() (check if a byte is a dual byte char + leadbyte) and DosGetDBCS() (returns DBCS table from the active NLS + package) + - Add DBCS table to getTable() and fixes references to harcoded + UCASE and FUCASE tables. + - DosYesNo(): arg is now UWORD, not unsigned char. + - nlsYesNo(): Add DBCS support + - syscall_MUX14(): arg of nlsYesNo() is now CX instead of CL. + * nls.h: + - yeschar and nochar are now UWORD instead of UBYTE. + - NLS_FREEDOS_NLSFUNC_VERSION bumped to 0xFD02. + - Add a small comment. + * nls_hc.asm: YesChar and NoChar are now two bytes each. + * proto.h: + - DosYesNo(): Argument is now UWORD (dual byte) + - Add prototype for DosGetDBCS() + Changes Jeremy * config.txt - update to include all CONFIG.SYS options (except ANYDOS) * exeflat.c - show usage also when number of arguments incorrect + < many other changes to be added by Jeremy himself :-> + *** Sync - Stable Build 2035 *** 2004 May 30 - Build 2035 diff --git a/hdr/nls.h b/hdr/nls.h index 2e595ce..2ebfb72 100644 --- a/hdr/nls.h +++ b/hdr/nls.h @@ -269,6 +269,8 @@ * information itself; it is ignored when the user calls DOS-65-0x * to return such pointer. * NLS_REORDER_POINTERS is *enabled* by default. + * UPDATE: With NLS_REORDER_POINTERS, now table 7 (DBCS) is also + * expected to be located at a predictable index. -- eca */ /* Define if some user program possibly modifies the value of the internal @@ -289,7 +291,7 @@ /* What version of nlsInfo and accompanying associations Must be passed to NLSFUNC upon MUX-14-00 to identify the correct kernel to the tools. */ -#define NLS_FREEDOS_NLSFUNC_VERSION 0xFD01 +#define NLS_FREEDOS_NLSFUNC_VERSION 0xFD02 /* Represents a call to DOS-38 within DOS-65 handlers. Current implementation relys on 0x101! */ #define NLS_DOS_38 0x101 @@ -425,8 +427,8 @@ struct nlsPackage { /* the contents of one chain item of the MUX-14 processor does not require them and performs all actions itself, so that the kernel never tries to fetch this information itself. */ - UBYTE yeschar; /* yes / no character DOS-65-23 */ - UBYTE nochar; + UWORD yeschar; /* yes / no character DOS-65-23 */ + UWORD nochar; unsigned numSubfct; /* number of supported sub-functions */ struct nlsPointer nlsPointers[1]; /* grows dynamically */ }; @@ -570,8 +572,8 @@ struct csys_ccDefinition { /* country/codepage reference */ UWORD cntry, cp; is missing int flags; is NLS_FLAG_HARDCODED, if the kernel is to handle the data of its own - UBYTE yeschar; is filled - UBYTE nochar; is filled + UWORD yeschar; is filled + UWORD nochar; is filled unsigned numSubfct; is filled struct nlsPointer nlsPointers[1]; is filled the pointer member is the absolute diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index f2d9f16..d2ea990 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -1288,8 +1288,15 @@ dispatch: /* UNDOCUMENTED: Double byte and korean tables */ case 0x63: { - lr.DS = FP_SEG(&nlsDBCSHardcoded); - lr.SI = FP_OFF(&nlsDBCSHardcoded); + VOID FAR *p; + + if (lr.AL == 0) { + p = DosGetDBCS(); + lr.DS = FP_SEG(p); + lr.SI = FP_OFF(p); + } + lr.AL = 0x00; + #if 0 /* not really supported, but will pass. */ lr.AL = 0x00; /*jpp: according to interrupt list */ @@ -1326,7 +1333,7 @@ dispatch: DosUpFString(FP_DS_DX); break; case 0x23: /* check Yes/No response */ - lr.AX = DosYesNo(lr.DL); + lr.AX = DosYesNo(lr.DX); break; default: #ifdef NLS_DEBUG diff --git a/kernel/nls.c b/kernel/nls.c index 768a525..6173d37 100644 --- a/kernel/nls.c +++ b/kernel/nls.c @@ -75,9 +75,11 @@ struct nlsInfoBlock nlsInfo = { #ifdef NLS_REORDER_POINTERS #define getTable2(nls) ((nls)->nlsPointers[0].pointer) #define getTable4(nls) ((nls)->nlsPointers[1].pointer) +#define getTable7(nls) ((nls)->nlsPointers[4].pointer) #else #define getTable2(nls) getTable(2, (nls)) #define getTable4(nls) getTable(4, (nls)) +#define getTable7(nls) getTable(7, (nls)) #define NEED_GET_TABLE #endif /*== both chartables must be 128 bytes long and lower range is @@ -213,12 +215,15 @@ STATIC VOID FAR *getTable(UBYTE subfct, struct nlsPackage FAR * nls) switch (subfct) { case 2: - return &nlsUpHardcodedTable; + return &nlsUpcaseHardcoded; case 4: - return &nlsFnameUpHardcodedTable; + return &nlsFUpcaseHardcoded; /* case 5: return &nlsFnameTermHardcodedTable; */ /* case 6: return &nlsCollHardcodedTable; */ + case 7: + return &nlsDBCSHardcoded; } + return NULL; } #endif @@ -422,18 +427,41 @@ STATIC VOID xUpMem(struct nlsPackage FAR * nls, VOID FAR * str, muxBufGo(NLSFUNC_UPMEM, 0, nls->cp, nls->cntry, len, str); } -STATIC int nlsYesNo(struct nlsPackage FAR * nls, unsigned char ch) +STATIC BOOL nlsIsDBCS(UBYTE ch) { - log(("NLS: nlsYesNo(): in ch=%u (%c)\n", ch, ch > 32 ? ch : ' ')); - xUpMem(nls, MK_FP(_SS, &ch), 1); /* Upcase character */ - /* Cannot use DosUpChar(), because - maybe: nls != current NLS pkg - However: Upcase character within lowlevel - function to allow a yesNo() function - catched by external MUX-14 handler, which - does NOT upcase character. */ - log(("NLS: nlsYesNo(): upcased ch=%u (%c)\n", ch, ch > 32 ? ch : ' ')); + if (ch < 128) + return FALSE; /* No leadbyte is smaller than that */ + + { + UWORD FAR *t= ((struct nlsDBCS FAR*)getTable7(nlsInfo.actPkg))->dbcsTbl; + + for (; *t != 0; ++t) + if (ch >= (*t & 0xFF) && ch <= (*t >> 8)) + return TRUE; + } + + return FALSE; +} + +STATIC int nlsYesNo(struct nlsPackage FAR * nls, UWORD ch) +{ + /* Check if it is a dual byte character */ + if (!nlsIsDBCS(ch & 0xFF)) { + ch &= 0xFF; + log(("NLS: nlsYesNo(): in ch=%u (%c)\n", ch, ch > 32 ? (char)ch : ' ')); + xUpMem(nls, MK_FP(_SS, &ch), 1); /* Upcase character */ + /* Cannot use DosUpChar(), because + maybe: nls != current NLS pkg + However: Upcase character within lowlevel + function to allow a yesNo() function + catched by external MUX-14 handler, which + does NOT upcase character. */ + log(("NLS: nlsYesNo(): upcased ch=%u (%c)\n", ch, ch > 32 ? (char)ch : ' ')); + } + else + log(("NLS: nlsYesNo(): in ch=%u (DBCS)\n", ch)); + if (ch == nls->yeschar) return 1; if (ch == nls->nochar) @@ -445,7 +473,7 @@ STATIC int nlsYesNo(struct nlsPackage FAR * nls, unsigned char ch) ***** DOS API ****************************************************** ********************************************************************/ -BYTE DosYesNo(unsigned char ch) +BYTE DosYesNo(UWORD ch) /* returns: 0: ch == "No", 1: ch == "Yes", 2: ch crap */ { if (nlsInfo.actPkg->flags & NLS_FLAG_DIRECT_YESNO) @@ -490,7 +518,7 @@ VOID DosUpFMem(VOID FAR * str, unsigned len) log(("NLS: DosUpFMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str), FP_OFF(str))); for (c = 0; c < len; ++c) - printf("%c", str[c] > 32 ? str[c] : '.'); + printf("%c", ((char FAR *)str)[c] > 32 ? ((char FAR *)str)[c] : '.'); printf("\"\n"); #endif if (nlsInfo.actPkg->flags & NLS_FLAG_DIRECT_FUPCASE) @@ -605,6 +633,11 @@ COUNT DosSetCodepage(UWORD actCP, UWORD sysCP) return DE_INVLDDATA; } +VOID FAR *DosGetDBCS(void) +{ + return getTable7(nlsInfo.actPkg); +} + /******************************************************************** ***** MUX-14 API *************************************************** ********************************************************************/ @@ -655,7 +688,7 @@ UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS) case NLSFUNC_LOAD_PKG2: return nlsSetPackage(nls); case NLSFUNC_YESNO: - return nlsYesNo(nls, CL); + return nlsYesNo(nls, CX); case NLSFUNC_UPMEM: nlsUpMem(nls, MK_FP(ES, DI), CX); return SUCCESS; diff --git a/kernel/nls_hc.asm b/kernel/nls_hc.asm index adf04bc..7acee73 100644 --- a/kernel/nls_hc.asm +++ b/kernel/nls_hc.asm @@ -12,7 +12,7 @@ segment CONST2 GLOBAL _nlsPackageHardcoded _nlsPackageHardcoded: DB 000h, 000h, 000h, 000h, 001h, 000h, 0b5h, 001h - DB 00fh, 000h, 059h, 04eh, 006h, 000h + DB 00fh, 000h, 059h, 000h, 04eh, 000h, 006h, 000h DB 002h DW ?table2, SEG ?table2 DB 004h diff --git a/kernel/proto.h b/kernel/proto.h index 515e50f..e48266e 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -271,7 +271,7 @@ COUNT lfn_dir_read(COUNT handle, lfn_inode_ptr lip); COUNT lfn_dir_write(COUNT handle); /* nls.c */ -BYTE DosYesNo(unsigned char ch); +BYTE DosYesNo(UWORD ch); #ifndef DosUpMem VOID DosUpMem(VOID FAR * str, unsigned len); #endif @@ -290,6 +290,7 @@ COUNT DosSetCountry(UWORD cntry); #endif COUNT DosGetCodepage(UWORD * actCP, UWORD * sysCP); COUNT DosSetCodepage(UWORD actCP, UWORD sysCP); +VOID FAR *DosGetDBCS(void); UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS); /* prf.c */