I downloaded a Japanese MS-DOS bootdisk (I'm not giving out any links because this is probably not very legal) and started experimenting. Let me report my findings.
It seems that there is just one special API function for double byte character sets, 6300h: http://www.ctyme.com/intr/rb-3142.htm http://www.ctyme.com/intr/rb-3143.htm It returns a table of ranges of valid DBCS leading bytes. This allows applications to detect that it is reading DBCS characters as opposed to ASCII or JIS X 0201 (an 8-bit encoding with ASCII in the lower half and katakana in the upper half). An application then simply uses standard DOS functions for everything, for example INT 21h/AH=1 for input and INT 21h/AH=2 for output. DOS of course does not supply any special string functions, so it is up to the application to do any string processing. Open Watcom, for example, has a header file called jstring.h which includes Japanese equivalents of string.h and other functions, for example jishira, which checks whether a character is a hiragana character. I wrote a simple program that reads standard input and returns katakana characters from it: #include <jstring.h> #include <stdio.h> int main () { JCHAR Buffer[1024]; // JCHAR is same as char (semantic difference) JSTRING BufferAsStr; // JSTRING is same as JCHAR* int Ch; // Result from getchar unsigned int i; JMOJI Moji; // 16-bit Japanese (or any DBCS) character // Read from standard input into buffer. // This part would be the same for a non-DBCS program. i = 0; for(;;) { Ch = getchar(); if(Ch == EOF) break; Buffer[i++] = Ch; if(i == sizeof(Buffer) - 1) break; } Buffer[i] = '\0'; // Now go through the string and output only katakana characters. BufferAsStr = Buffer; i = 0; for(;;) { // jgetmoji takes a pointer into a string and returns the character // at that position as a JMOJI, and a pointer to the next character. BufferAsStr = jgetmoji(BufferAsStr, &Moji); if(*BufferAsStr == '\0') break; if(jiskana(Moji)) // If it's a katakana character, output it. { putchar(Moji >> 8); // Couldn't find a nicer way, but it works. putchar(Moji & 0xFF); } } return 0; } I executed DIR /? | <name of program> and got back ディレクトリサブディレクトリファイルドライブ and so on. So, what needs to be done? 1. INT 21h/AX=6300h has to be implemented. 2. INT 21h/AH=1 (and all other input functions) has to be modified so that if a double byte character is entered, it returns the first byte and remembers the second byte to return it in the next call. 3. INT 21h/AH=2 (and all other output functions) has to be modified so that if it detects a leading byte of a double byte character, it has to remember it and wait until the next call, when it gets the second byte, to print the character. 4. A keyboard layout has to be made. I have no idea how keyboard layouts work in DOS, so I can't say much. 5. A font has to be made. Perhaps the GNU Unifont could be converted? 6. Probably the hardest part: all FreeDOS packages, or at least basic ones (FreeCOM, FIND, SORT, EDIT), have to be updated to support double byte characters. Adding support for Japanese (and Korean and Chinese, because the mechanism is the same) would probably not be that difficult, but it would take a long time to modify everything to support it. Matej Horvat http://matejhorvat.si/ PS: I just wrote all that and found this: http://nokonoko365.cocolog-nifty.com/blogfile/freedos/index.html Is that third party software for Japanese support or what? ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user