A DEVELOPMENT OF THAI KERNEL SYSTEM PORNPOTE SURIYAWONG Researcher Dept. of Computer Engineering Kasetsart University, Thailand YUEN POOVARAWAN Associate Professor Dept. of Computer Engineering Kasetsart University, Thailand CHAIYONG WONGCHAISUWAT Assistant Professor Dept. Of Computer Engineering Kasetsart University, Thailand SUMMARY This paper presents the design and development of the Thai K e r n e l S y s t e m ( T KS ) f o r a p p l i ca t i on t o T ha i d a ta p ro c e s s i ng activities. With the layered organization, TKS consists of several low-level service routines which can be accessed easily through system calls. As TKS is hardware independence, it can be mounted and applied on different computer systems. The proposed kernel written in the C and assembly language for 16-bit microcomputer is divided into three parts as follows:- Physical Device Driver (PDD), Logical Device Driver (LDD) and, Function calls and Library Functions (FCLF). With bit-image-graphic mode for Thai displaying, Thai software packages such as wo rd-processors, graphics, spreadsheets and databases which are accessed through the proposed TKS can be developed successfully with less time and effort. INTRODUCTION Recently a microcomputer has gained significant popularity especially as a personal use primarily due to its high performance and flexible software package. In Thailand, the characteristics of Thai language which are writter in 4 levels are unique and ambiguous. There is no clear punctuation or blank between words for Thai word separation. To use Thai software either locally self developed as Thai word-processors or modified from the imported packages as Lotus 1-2-3, dBASE etc, an enhanced CRT controller card and a specific driver are needed for Thai character displaying. With several incompatible hardware cards designed from different vendors, Thai application programs are individually developed. They are practically unable to run across or transfer between them. Due to the problem of hardware independence, the growth of Thai local software development is very difficult and limited. In the recent years, displaying Thai characters on bit image graphic mode has been developed to avoid the modification of hardware. However, with vendors’ different hardware configurations, Thai application software are still separately developed. Upgrading either hardware or operating systems causes the problems of software modification. To avoid the problems mentioned above, in this research, the system called “Thai Kernel System – TKS” based on the layered organization is proposed. The layering approach with system call interfacing between layers have been found in most modern operating systems i.e. UNIX [1], OS/2 [2] and in applications i.e. Graphical Kernel System, GKS [3,4]. The system service routines of TKS for Thai processing activities are provided to interface between the user program and I/O systems of keyboard, printer and video displays. Thai application programs under TKS are hardware independence and applicable to expand and mount on higher level machines. This paper presents the structure and applications of TKS, as wel as the possibility of the expansion of this proposed system. THE STRUCTURE OF TKS Thai Kernel system (TKS) is developed to solve the problem of incompatible that occurs in the usage of Thai language on computer. TKS is a set of function service routines for Thai data processing. The properties of the proposed TKS are listed below. 1. All service routines are easy to apply with specific function numbers called from the user program. 2. Basic I/O routines dealt with Thai language such as keyboard, printer and video functions are provided. 3. They can be easily modified and extended. 4. Only the lowest layer of TKS interacts directly with I/O devices to handle device-specific activities. User programs access devices by name under a layer of high level device independent I/O operations. Since the structure of TKS is in the lower level closed to the hardware for Thai data processing, it is divided as layered organization (Fig. 1) for ease of calling and applying effectively. Fig. 1. The Structure of TKS The lowest layer of TKS called Physical Device Driver (PDD) consists of a set of procedures performing the real work of carrying out the physical input and output operations and fielding interrupts. It is kept as small as possible so it can be easily ported into many kinds of machines. The upper layer above PDD called Logical Device Driver (LDD) is provided in TKS to carry out the redirection and piping of the physical devices. Finally, the highest layer called Function Call and Library Function (FCLF) is a collection of service routines of high-level operations for manipulating all Thai data processing. The proposed TKS is mainly implemented on portable C programming language for 16-bit microcomputer. Some portion of PDD is also written in assembly language for gaining the most effectiveness in speed and manipulating the hardware easily. For the near future, this proposed TKS will be upgraded and mounted on different operating systems and hardware configurations. PHYSICAL DEVICE DRIVER In TKS, the Physical Device Driver (PDD) manages input from the keyboard and output to the display screen and the printer. Since the PDD interacts directly with the hardware, the modification or reinstallation of hardware configurations causes this layer to be changed. Procedures in higher layers call routines in PDD through system calls with well-defined entry of a specific device number. Only video display, keyboard and printer have been installed in this current version of TKS. The video display installed in TKS shows characters on screen in virtual text mode for bit image graphics display. Twenty dots or scan lines will be used to display Thai language in 4 levels structure as shown in Fig. 2. The scan lines for tone marks, upper vowels, normal vowels and consonants, and lower vowels are proposed as 4, 4, 8 and 4 lines respectively. All characters width is assumed to be 8 dots equally. With the defined character size, the number of lines and columns for the different resolutions of video systems are carried out in Table 1. Fig. 2. Thai language structure for video displaying Table 1. Video Systems CGA MGA EGA MCGA VGA Video Display System Resolution 640x200 720x348 640x350 640x480 640x480 No. of Lines 10 17 17 24 24 No. of Columns 80 90 80 80 80 The input from keyboard is normally in ASCII codes. To receive Thai character in TISI code [5], the PDD of TKS will map the English ASCII code into Thai TISI code with table look-up approach. The appropriate table from two standard Thai keyboard types namely Pattachote and Gatmanee is selected prior to the table look-up mapping. The routine for keyboard inputting process is shown in Fig. 3. RECEIVE DATA FROM KEYBOARD IF THAI-KEYBOARD THEN IF PATTACHOTE THEN LOOK-UP IN PATTACHOTE TABLE ELSE LOOK-UP IN GATEMANEE TABLE ENDIF ENDIF RETURN DATA Fig. 3. Keyboard inputting algorithm The printer outputting concerns the status checking and the transferring of ASCII data in either English or Thai code to printer. The formats of PDD system call functions for video display, keyboard and printer are in the same form as follows:vdo_func(<function no.> [argument [,…]]) kbd_func(<function no.> [argument [,…]]) and_prn_func(<function no.> [argument [,…]]) where <function no.> is the specific number for each device functions. LOGICAL DEVICE DRIVER In TKS, the Logical Device Driver (LDD) manage input from and output to standard devices already defined in Table 2. The purpose of this layer is inserted in the system for the redirection and piping of physical devices as shown in Fig. 4 and 5. Table 2. Logical Device Name Stdin Stdout Stderr Stdaux Stdprn Standard Logical Devices Meaning Standard Standard Standard Standard Standard Input Output Error Display Auxiliary Printing Physical Devices Keyboard Video Display Video Display Communication Device Printer Fig. 5. Piping There may be two methods to redirect the standard devices for processing data either via operating systems or directly on devices. The method via operating systems is chosen in TKS due to its easiness in implementation. It functions as a filter to operating systems as shown in Fig. 6. Fig. 6. Method of Redirection in TKS The format of LDD system call functions for standard device is Ldd_func( <function no.>, <logical device>, [argument,…] ) where <function no.> refers to a specific device routine which is already defined in the PDD layer. LIBRARY FUNCTION AND APPLICATION Function Call and Library Function (FCLF) is a collection of procedures (functions) available for Thai data processing and other complex frequently used routines. The procedures putting in the library are more complex than the lower layers of LDD and PDD. They are two groups of procedures namely I/O system and Thai system. I/O system procedures are provided as abstract operations for user programs. They can be called or accessed by either a function number or a library function through the lower layer of physical devices. Thai system procedures are provided to manipulate all Thai data processing activities such as Thai searching, sorting and Thai language leveling etc. in the form of library functions. The proposed TKS has been used extensively as the system call interfacing for Thai microcomputer software packages under development at Kasetsart University. Those software packages are Thai word-processor, Thai spreadsheet, Thai database management system and Thai graphics software. It is shown that the development of application program accessed through this proposed TKS can be easily implemented with less time and effort. With the extended version of TKS that will be developed in the future, the application programs on 16-bit microcomputer now can be portable to higher-level machines with different operating systems. DISCUSSION AND CONCLUSION The Thai Kernel System TKS proposed in this research is the basic primitive operations as a system call services to work along with Thai Application programs. Under the environment of TKS, user programs can be run on several hardware configurations without any modification. The layered organization of the TKS is divided into three parts. The lower layer of physical device driver interacts directly with the I/O hardware. The next upper layer is logical device driver for redirection and piping the standard devices. The upper layer is a collection of I/O system procedures as function calls and Thai system procedures as library function. The current version of TKS is developed for 16 bit microcomputer under MS-DOS environment. The next move will be the implementation of proposed TKS on upper level machine of an engineering workstation. Under UNIX-based system. REFERENCE 1. M.J. Bach (1986), The Design of the UNIX Prentice-Hall, Englewood Cliffs, New Jersey. 2. E. Lacobucci California. 3. American National Standards Institute, Inc. (1985), Computer Graphics – Graphical Kernel (GKS) Gunctional Description, ANSI X3, 124, New York. 4. F.R.A. Hopgood, D.A. Duce, J.R. Gallop and D.C. Sutcliffe (1986), Introduction to the Graphical Kernel System (GKS), 2nd Edn, Academic Press Inc., London. 5. Thai Industrial Standard Institute (1986), TISI 620-1986 Thai Character Code for Computer, Bangkok, Thailand. (1988), OS/2 Programmer’s Operating Guide, System, McGraw-Hill,