
History
    98/07/24 First Release
    98/10/19 Input corrections.  dos_seek argument
    99/09/28 English version

Title    onHand/Ruputer PsDOS Interface Command List

Header File Name
    psdos.h


      The following is a list of C library functions that are created in order to call DOS system call services from C programs.  Please note that the contents enclosed by [] are the feature of MS-DOS.  Among these functions, there are some functions that when an error occurs, the error information is set to "int DOSerr", which is a global variable within a library.

[Note] When you call a function that accesses to the flash memory, you may receive an error of low voltage.  However, if you access to the flash memory by using the redirect feature of handle copy, such error cannot be detected.
    The low voltage error code is -2 (0xfffe).
--------------------------------------------------------------------------------

dos_seldrv  ...  drive selection                                [INT21H / 0EH]

    ***** Syntax *****
        int     dos_seldrv(int  drv) {}

            Function value:  Possible drive number
            Parameter:
                int     drv;    Drive number (0=A, 1=B .....)

    ***** Feature *****
        Select a defalut drive.

    ***** Information *****
        A Drive : MROM fixed area
        B Drive : Flash memory




dos_getcdrvno   ...  Reading of the current drive number          [INT21H / 19H]

    ***** Syntax *****  
        int     dos_getcdrvno() {}

            Function value:  Currently selected drive (0=A,1=B...)

    ***** Feature *****
        Read the currently selected drive.




dos_setdta  ...  Setting of the disk transfer address (DTA)        [INT21H / 1AH]

    ***** Syntax *****
        void    dos_setdta(dtap) {}

            Function value:  None
            Parameter:
                void    *dtap;  DTA area address

    ***** Feature *****
        Specify the position of DTA that is used for input/output operation of a disk.




dos_getcdrive ...  Acquisition of the current drive data.              [INT21H / 1BH]

    ***** Syntax *****
        void    dos_getcdrive(drvp) {}

            Function value:  None
            Parameter:
                void    *drvp;  Current drive data setting area pointer
                    The followings are the setting area of the drive data (Word unit).

                    15                                  0
                    +-----------------------------------+
                    |  Sector number per 1 cluster      | 0
                    +-----------------------------------+
                    |  Byte per 1 sector                | 2
                    +-----------------------------------+
                    |  Cluster number per 1 drive       | 4
                    +-----------------------------------+
                    |                                   | 6
                    +-      FAT ID. address            -+
                    |                                   | 8
                    +---------------------------------- +

    ***** Feature *****  
        Acquire the current drive data.




dos_gettdrive ...  Acquisition of drive data                      [INT21H / 1CH]

    ***** Syntax *****
        void    dos_gettdrive( drv, drvp) {}

            Function value:  None
            Parameter:
                int     drv     Drive number (0=current,1=A, 2=B,...)
                void    *drvp;  Drive data setting area pointer
                    The followings are the setting area of the drive data (Word unit).

                    15                                  0
                    +-----------------------------------+
                    |  Sector number per 1 cluster      | 0
                    +-----------------------------------+
                    |  Byte per 1 sector                | 2
                    +-----------------------------------+
                    |  Cluster per 1 drive              | 4
                    +-----------------------------------+
                    |                                   | 6
                    +-      FAT ID. address            -+
                    |                                   | 8
                    +-----------------------------------+

    ***** Feature *****  
        Acquire the drive data of the specified drive.




dos_setvector   ...  Setting of the interruption vector                 [INT21H / 25H]

    ***** Syntax *****
        void    dos_setvector(vecno, func) {}

            Function value:  None
            Parameter:
                int     vecno;      Interruption vector number
                void    (*func)();  Entry address of the interruption process routine

    ***** Feature *****  
        Set the interruption vector.




dos_fparse  ...  Analysis of the file name                            [INT21H / 29H]
 
   ***** Syntax *****
        int     dos_fparse(fcbp, name, ctrl) {}

            Function value:  0:wildcard is not used
                             1:wildcard is used
                            -1:Drive name is invalid
            Parameter:
                unsigned char   *fcbp;  Pointer to 36 byte area
                char            *name;  Address of string to be analyzed
                int             ctrl;   Code that controls the analysis operation

    ***** Feature *****  
        Examine the effectiveness of the file name that is specified in name.  If it is valid, create its FCB.




dos_getdate ...  Acquisition of date                                 [INT21H / 2AH]

    ***** Syntax *****
        void    dos_getdate(pdow, pmonth, pday, pyear) {}

            Function value:  None
            Parameter:
                char    *pdow;      Day of week  (0=Sun 1=Mon 2=Tue...)
                char    *pmonth;    Month (1-12)
                char    *pday;      Day   (1-31)
                int     *pyear;     Year  (1980-2079)

    ***** Feature *****  
        Acquire the current system data.




dos_setdate ...  Setting of data                                 [INT21H / 2BH]

    ***** Syntax *****
        int     dos_setdate(month, day, year) {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally, invalid date
            Parameter:
                char    pmonth; Month (1-12)
                char    pday;   Day   (1-31)
                int     pyear;  Year  (1980-2079)

    ***** Feature *****  
        Set the date.




dos_gettime ...  Acquire the time                                  [INT21H / 2CH]

    ***** Syntax *****
        void    dos_gettime(phour, pmin, psec, phund) {}

            Function value:  None
            Parameter:
                char    *phour; Hour    (0-23)
                char    *pmin;  Minute  (0-59)
                char    *psec;  Second  (0-59)
                char    *phund; 0.01 second (Empty) 

    ***** Feature *****  
        Acquire the current system time




dos_settime ...  Setting of time                                  [INT21H / 2DH]

    ***** Syntax *****
        int     dos_settime(hour, min, sec, hund) {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally, invalid time
            Parameter:
                char    hour;   Hour   (0-23)
                char    min;    Minute (0-59)
                char    sec;    Second (0-59)
                char    hund;   0.01 second (Ignored)

    ***** Feature *****  
        Settng of time




dos_getdta  ...  Acquire DTA address                           [INT21H / 2FH]

    ***** Syntax *****
        void    *dos_getdta() {}

            Function value:  DTA address

    ***** Feature *****  
        Acquire DTA address




dos_version ...  Acquire DOS version number                   [INT21H / 30H]

    ***** Syntax *****
        void    dos_version(vdatp) {}

            Function value:  None
            Parameter:
                char    *vdatp; Version data setting area
                The following is the version data setting area (Byte).
                7                                0
                +--------------------------------+
                | Integer part of version number |
                +--------------------------------+
                | Decimal part of version number |
                +--------------------------------+
                | OEM number                     |
                +--------------------------------+
                | dummy                          |
                +--------------------------------+
                | User number (0-7bit)           |
                +--------------------------------+
                | User number (8-15bit)          |
                +--------------------------------+
                | User number (16-23bit)         |
                +--------------------------------+
                | dummy(fill with 0)             |
                +--------------------------------+

    ***** Feature *****  
        Acquire DOS version number.




dos_procresident    ...  Termination of resident of process                  [INT21H / 31H]

    ***** Syntax *****
        void    dos_procresident(exitcode, nparas) {}

            Function value:  None
            Parameter:
                int             exitcode;   Return code
                unsigned long   nparas;     Program size for resident in memory
    ***** Feature *****  
        Terminate the process and return the control to the parent process.  However, the terminated process should have the resident memory.




dos_getvector   ...  Acquire interruption vector                    [INT21H / 35H]

    ***** Syntax *****
        typedef void (*FCP)();  
        FCP     dos_getvector(intnum) {}

            Function value:  Address of interruption handler
            Parameter:
                int     intnum;     Interruption vector number

    ***** Feature *****  
        Return an address of interruption vector handler.




dos_dfspace     ...  Acquire the remaining capacity of a disk                [INT21H / 36H]

    ***** Syntax *****
        int     dos_dfspace(dno, dfdata) {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally, drive number invalid
            Parameter:
                int     dno;  Drive number (0=Current drive, 1=A,2=B,..)
                int     *dfdata;    Setting area of the disk information
              The following is the setting area of the disk information (Word unit).
                15                                  0
                +-----------------------------------+
                |  Sector per 1 cluster             |
                +-----------------------------------+
                |  Possible cluster number          |
                +-----------------------------------+
                |  Byte per 1 sector                |
                +-----------------------------------+
                |  Cluster number existed in a drive|
                +-----------------------------------+

    ***** Feature *****  
        Return the disk capacity information.

        Example  Calculation of free space byte
                 :
                int dfdata[4];
                long val;

                /* Calculation of Flash Disk capacity (Byte) */
                dos_dfspace(2,dfdata);
                val = ( (long)dfdata[1] * (long)dfdata[0] * (long)dfdata[2] );
                 :




dos_mkdir   ...  Make directory                          [INT21H / 39H]

    ***** Syntax *****
        int     dos_mkdir(dname) {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally
            Parameter:
                char    *dname;     Address of path name

    ***** Feature *****
        Make directory of the specified path name. 
        When it is terminated abnormally, the following error messages are set in "DOSerr".
            3: No path name can be found.
            5: No free space, same file or directory exists.
           -2: Low voltage




dos_rmdir   ...  Delete directory                          [INT21H / 3AH]

    ***** Syntax *****
        int     dos_rmdir(dname) {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally
            Parameter:
                char    *dname;     Address of path name

    ***** Feature *****  
        Delete a directory of the specified path name. 
              When it is terminated abnormally, the following error messages are set in "DOSerr".
                   3: No path name can be found.
                   5: No free space for the specified directory or the specified place is not a directory but a root directory.
                  16: The current directory is specified.
                  -2: Low voltage




dos_chdir   ...  Change the current directory                  [INT21H / 3BH]

    ***** Syntax *****
        int     dos_chdir(dname) {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally
            Parameter:
                char    *dname;     Address of path name

    ***** Feature *****  
        Change the directory of the specified path name to the current directory.
         When it is terminated abnormally, the following error messages are set in "DOSerr".
               3: No path name can be found.
              -2: Low voltage




dos_create  ...  Create a file by using handle              [INT21H / 3CH]

    ***** Note *****
            Usually use dos_fcreate() in rupsys library.

    ***** Syntax *****
        int     dos_create(pfilepath, attr) {}

            Function value:  -1:Terminate abnormally
                  Other than -1:File handle
            Parameter:
                char    *pfilepath; File path name
                int     attr;       File attribute

    ***** Feature *****  
        Create a file and return its handle.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
                   3: No path name can be found.
                   4: Too many files are opened.
                   5: The access is rejected.
                  -2: Low voltage




dos_open    ...  Open a file by using handle          [INT21H / 3DH]

    ***** Note *****
            Usually use dos_fopen() in rupsys library.

    ***** Syntax *****
        int     dos_open(pfilepath, mode) {}

            Function value:  -1:Terminate abnormally
                  Other than -1:File handle
            Parameter:
                char    *pfilepath; File path name
                int     mode;       Open mode of a file (0:Read,  
                                    1:Write,  2:Read/Write)

    ***** Feature *****  
        Open a file and return its handle.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               2: No file can be found.
               3: No path name can be found.
               4: Too many files are opened.
               5: The access is rejected.
              12: The access code is invalid
              -2: Low voltage




dos_close   ...  Close a file by using handle          [INT21H / 3EH]

    ***** Note *****
            Usually use dos_fclose() in rupsys library.

    ***** Syntax *****
        int     dos_close(handle) {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally
            Parameter:
                int     handle;     File handle

    ***** Feature *****  
        Close a file that is referred by the specified handle.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               6: Handle number is invalid.
              -2: Low voltage




dos_read    ...  Read file/device by using handle  [INT21H / 3FH]

    ***** Note *****
            Usually use dos_fread() in rupsys library.

    ***** Syntax *****
        int     dos_read(handle, pbuffer, nbytes) {}

            Function value:           -1:Terminate abnormally
                           Other than -1:Read byte
            Parameter:
                int     handle;     Handle number
                char    *buffer;    Read buffer address
                int     nbytes;     Read byte (less than 32K byte)

    ***** Feature *****  
        Read from file/device that is referred by the specified handle.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               5: The access is rejected.
               6: The handle is invalid.
              -2: Low voltage




dos_write   ...  Write file/device by using handle    [INT21H / 40H]

    ***** Note *****
            Usually use dos_fwrite() in rupsys library.

    ***** Syntax *****
        int     dos_write(handle, pbuffer, nbytes) {}

            Function value:           -1:Terminate abnormally
                           Other than -1:Write byte
            Parameter:
                int     handle;     Handle number
                char    *buffer;    Write buffer address
                int     nbytes;     Write byte (less than 32K byte)

    ***** Feature *****  
        Write to file/device that is referred by the specified handle.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               5: The access is rejected.
               6: The handle is invalid.
              -2: Low voltage

    ***** Note *****
        Please call bi_vwrflush function at the end of the process routine of flush write operation dos_write,dos_fwrite.

        Example
             :
            EVENTTABLE table;
            int fp;

            /* New file create process routine */
            if ( (fp = dos_fcrnew( ALARMINI ))<0 ) return;

            /* initialized by \0 */
            memset( (char *)&table, '\0', sizeof(EVENTTABLE) );

            /* File write process routine */
            dos_fwrite( fp, (char *)&table ,sizeof(EVENTTABLE) );
            dos_fwrite( fp, (char *)&table ,sizeof(EVENTTABLE) );
            dos_fwrite( fp, (char *)&table ,sizeof(EVENTTABLE) );
            dos_fwrite( fp, (char *)&table ,sizeof(EVENTTABLE) );

            /* File handle close */
            dos_fclose( fp );

            /* Flush of flash memory */
            bi_vwrflush();       /* bi_wrflush(1); + Voltage check feature */
             :




dos_delete  ...  Delete file                              [INT21H / 41H]

    ***** Note *****
            Usually use dos_fdelete() in rupsys library.

    ***** Syntax *****
        int     dos_delete(pfilepath) {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally
            Parameter:
                char    *pfilepathr;    File path name

    ***** Feature *****  
        Delete the specified file.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               2: No file can be found.
               3: No path can be found.
               5: The access is rejected.
              -2: Low voltage




dos_seek    ...  Move a file pointer                      [INT21H / 42H]

    ***** Note *****
            Usually use dos_fseek() in rupsys library.

    ***** Syntax *****
        long    dos_seek(handle, mode, offset) {}

            Function value:           -1:Terminate abnormally
                           Other than -1:Position of new pointer
            Parameter:
                int     handle; Handle number
                int     mode    Mode  0=Byte offset from the beginning of the file
                                        1= Byte offset from the current position of the file pointer
                                        2= Byte offset from the end of the file
                long offset;    Offset value that a pointer is moved

    ***** Feature *****  
        Set the file pointer position that corresponds to the specified handle.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               1: The function is invalid (mode is not 0, 1 or 2)
               6: The handle is invalid.
              -2: Low voltage




dos_fattr   ...  Acquire/set of file attribute                    [INT21H / 43H]

    ***** Syntax *****
        int     dos_fattr(pfilepath, func, attr) {}

            Function value:           -1:Terminate abnormally
                           Other than -1:File attribute
            Parameter:
                char    *pfilepath; File path name
                int     func;       Feature  (0:Attribute acquisition  1:Attribute setting)
                int     attr;       File attribute
                            bit  0:  Read only file
                            bit  1:  Invisible file
                            bit  2:  System file
                            bit  3:  Volume file
                            bit  4:  Directory
                            bit  5:  Archive

    ***** Feature *****  
        Acqurire/Set of file attribute
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               1: The function is invalid (func is other than 0/1)
               2: No file can be found.
               3: No path can be found.
               5: The access is rejected.
              -2: Low voltage




dos_dup_hnd     ...  copy of file handle                [INT21H / 45H]

    ***** Syntax *****
        int     dos_dup_hnd(handle) {}

            Function value:           -1:Terminate abnormally,
                           Other than -1:New handle number
            Parameter:
                int     handle; Opened file/device handle

    ***** Feature *****  
        For currently opened file/device handle, obtain new handle.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               4: Too many files are opened.
               6: The handle is invalid.
              -2: Low voltage




dos_dup_hndsp   ...  Copy to the specified file handle      [INT21H / 46H]

    ***** Syntax *****
        int     dos_dup_hndsp(existhandle, newhandle) {}

            Function value:       0:Terminate normally
                           except 0:Terminate abnormally
            Parameter:
                int     existhandle;    Open handle that is the original for copy
                int     openhandle;     New open handle to be created

    ***** Feature *****  
        Copy the open handle to new handle.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               4: Too many files are opened.
               6: The handle is invalid.
              -2: Low voltage




dos_getcdir ...      Read the current directory          [INT21H / 47H]

    ***** Syntax *****
        int     dos_getcdir(drv, pass) {}

            Function value:       0:Terminate normally
                           except 0:Terminate abnormally
            Parameter:
                int     drv;    Drive number
                char    *pass;  Buffer where a path name is stored (at least 64 bytes)

    ***** Feature *****  
        Acquire the current path.




dos_execute     ...  Load of a program and execution                [INT21H / 4BH]

    ***** Syntax *****
        int     dos_execute(func, prog, pcmdtail) {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally
            Parameter:
                int     func;   Function code
                                0:Read a program and execute it.
                                3:Read a program
                char    *prog;      Program path name
                char    *pcmtail;   Parameter block address

                                    func=0
                    +----------------------------------------+
                    | Reserved (Pointer to the environment)  | 0
                    +----------------------------------------+
                    | Pointer of contents of PSP+80H         | 4
                    +----------------------------------------+
                    |     50H                                | 8
                    +----------------------------------------+
                    |     60H                                | 12
                    +----------------------------------------+

                                    func=3
                    +----------------------------------------+
                    | Load address of a file                 | 0
                    +----------------------------------------+
                    | Reserved (relocate factor)             | 4
                    +----------------------------------------+

    ***** Feature *****  
        Load of a program and execution
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               2: No file can be found.
               3: No path can be found.
               5: The access is rejected.
               8: Out of memory.
              10: The environment is invalid.
              11: The format is invalid.
              -2: Low voltage

            Example
                /* For information about psp related information, refer to dos_get_psp command as shown below. */
                typedef struct {
                    char    *config;
                    char    *psp80h;
                    char    *psp50h;
                    char    *psp60h;
                } PSP;

                int main(void)
                {
                    int rst;
                    PSP psp;

                    /* Initialization of PSP pointer area */
                    memset((char *)&psp,0,sizeof(PSP));

                    /* Setting to PSP  Inherit the environment of parent process */
                    psp.psp80h =  (char *)dos_get_psp() + 0x80;

                    rst = dos_execute(0,"copro.exf",(char*)&psp);
                    return 0;
                 }




dos_exit    ...  Terminate the process with a return code          [INT21H / 4CH]

    ***** Syntax *****
        void    dos_exit(retcode) {}

            Function value:  None
            Parameter:
                int     retcode;    Return code

    ***** Feature *****  
        Terminate the current process and return the return code to the parent process.




dos_child_ret       ...  Acquire the return code of the child      [INT21H / 4DH]

    ***** Syntax *****
        int     dos_child_ret(fway) {}

            Function value:  Return code that is passed from the child 
            Parameter:
                int     *fway;  Termination method
                                0:Normal termination
                                1:Termination by CTRL-C 
                                2:Termination by a fatal error handler
                                3:Resident termination

    ***** Feature *****  
        When the child process is terminated, acquire the termination method and return code.

            Example
                /**** main.exf ****/
                int main(void)
                {
                    int fway;   /* Termination method */
                    int retcode;/* Return code */
                    PSP psp;

                    /* Initialization of PSP pointer area */
                    memset((char *)&psp,0,sizeof(PSP));

                    /* Setting to PSP  Inherit the environment of parent process */
                    psp.psp80h =  (char *)dos_get_psp() + 0x80;

                    /* Child process execution */
                    dos_execute(0,"copro.exf",(char*)&psp);

                    /* Acquire the return code of the child process */
                    retcode = dos_child_ret(&fway);

                    return 0;
                }

                /**** copro.exf ****/
                int main(void)
                {
                    /* The child process returns the button input value as a return code */
                    int btn;
                    btn=bi_getbtn();
                    dos_exit(btn);
                    return 0;
                }




dos_fnd_first       ...  Search of the first file                [INT21H / 4EH]

    ***** Syntax *****
        int     dos_fnd_first(path, attr) {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally
            Parameter:
                char    *path;  File path name
                int     attr;   Attribute

    ***** Feature *****  
        First, search files to be matched.
                The following information is returned on DTA
                +-------------------------------+
                | Reserved (22Bytes)            |  0
                +-------------------------------+
                | Write time (2Bytes)           | 22
                +-------------------------------+
                | Write date (2Bytes)           | 24
                +-------------------------------+
                | File size (4Bytes)            | 26
                +-------------------------------+
                | File attribute (1Byte)        | 30
                +-------------------------------+
                |Packed Name of ASCIZ (13Bytes) | 31
                +-------------------------------+



        When it is terminated abnormally, the following error messages are set in "DOSerr".
               2: No file can be found.
               3: No path name can be found.
              18: No file.  No match.

        Example  The extension in "B:\\system" directory searches "TMP" and delete it.

             :
            char DTA[44];
            char TMPfile[13];
            char Delfile[25]="B:\\SYSTEM\\";

            dos_setdta(DTA);        /*  Setting of DTA  */
            memset(TMPfile,0,13);   /*  Initialization of stored area   */
            if( !dos_fnd_first( "B:\\SYSTEM\\*.TMP",0x3f ) ){
                strncpy( TMPfile,&DTA[31],13 );
                strcat( Delfile,TMPfile );
                dos_delete( Delfile );
                while( !dos_fnd_next() ){   /* Refer to the following dos_fnd_next commands */
                    memset( TMPfile,0,13 ); /*  Initialization of stored area   */
                    memset( Delfile,0,25 );
                    strcat( Delfile,"B:\\SYSTEM\\" );
                    strncpy( TMPfile,&DTA[31],13 );
                    strcat( Delfile,TMPfile );
                    dos_delete( Delfile );
                }
            }
             :




dos_fnd_next        ...  Search next file                  [INT21H / 4FH]

    ***** Syntax *****
        int     dos_fnd_next() {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally(No match)

    ***** Feature *****  
        Search the next match file.  dos_fnd_first should be called before the search.




dos_rename  ...  Rename a file                            [INT21H / 56H]

    ***** Syntax *****
        int     dos_rename(oldpath, newpath) {}

            Function value:  0:Terminate normally
                            -1:Terminate abnormally
            Parameter:
                char    *oldpath;   Existing file path name
                char    *newpath;   New file path name

    ***** Feature *****  
        Change a file name.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               2: No file can be found.
               3: No path can be found.
               5: The access is rejected.
              11: Device is not the same.
              -2: Low voltage




dos_fltime  ...  Date of file/Obtain time/Change            [INT21H / 57H]

    ***** Syntax *****
        long    dos_fltime(handle, func, packdate, packtime) {}

            Function value:           -1:Terminate abnormally
                           Other than -1:Obtained date/Time
            Parameter:
                int     handle;     Handle number
                int     func;       Function code
                                    0:Obtain data and time
                                    1:Setting of data and time
                int     packdate;   Setting of date
                int     packtime;   Setting of time

    ***** Feature *****  
        Date of file/obtain time/change
        When it is terminated abnormally, the following error messages are set in "DOSerr".
              -2: Low voltage




dos_exterr  ...  Obtain the extension error code                      [INT21H / 59H]

    ***** Syntax *****
        void    dos_exterr(err, class, action, locus) {}

            Function value:  None
            Parameter:
                int     *err;       Extension error code
                int     *class;     Error class
                int     *action;    Recommended correction
                int     *locus;     Place where an error occurs

    ***** Feature *****  
        Return the extension error information to the function call immediately before the execution.



dos_crtmp   ...  Create a temporary file                    [INT21H / 5AH]

    ***** Syntax *****
        int     dos_crtmp(path, attr) {}

            Function value:           -1:Terminate abnormally
                           Other than -1:Handle of a temporary file
            Parameter:
                char    *path;      Path name
                int     attr;       Attribute

    ***** Feature *****  
        Open a temporary file and return its handle.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               3: No path name can be found.
               4: Too many files are opened.
               5: The access is rejected.
              -2: Low voltage




dos_crnew   ...  Create a new file                          [INT21H / 5BH]

    ***** Note *****
        Usually use dos_fcrnew() in rupsys library.

    ***** Syntax *****
        int     dos_crnew(path, attr) {}

             Function value:           -1:Terminate abnormally
                            Other than -1:Handle of a new file
             Parameter:
                char    *path;      Path name
                int     attr;       Attribute

    ***** Feature *****  
        Create a new file and return its handle.
        When it is terminated abnormally, the following error messages are set in "DOSerr".
               3: No path can be found.
               4: Too many files are opened.
               5: The access is rejected.
              80: The same file name exists.
              -2: Low voltage



dos_get_psp     ...  Obtain the PSP address                       [INT21H / 62H]

    ***** Syntax *****
        void    *dos_get_psp() {}

            Function value:The segment address of PSP of the current process

    ***** Feature *****  
        Obtain the segment address of PSP of the current process

            typedef struct {
                char *config;   /* Use OS */
                char *psp80h;   /* Argument to main */
                char *psp50h;   /* Use OS */
                char *psp60h;   /* Use OS */
            }PSP;

            Parent process side
            static PSP psp;
            static char param[128]; /* input the contents of argument to main */

            psp.psp80h = (char*)&param[0];
            dos_execute(0,"xxxx.exf",(char*)&psp);


            Child process side
            char *psp;
            psp = (char*)dos_get_psp() + 0x80;
             /* The address that the contents of param[] of the parent process is copied can be obtained. */


    ***** Information *****
        Filer passes the Filer resource address and file name to PSP address+0x80 when dos_execute() is executed as follows.
        (Usually, a file name can be obtained by executing onHand/RuputerAPI getArg function.  Please use this function.)

                Address (hexadecimal ASCII) for SYSTEMCTL structure to param[0]-param[7]
                File name that param[8]-param[]!=NULL is subjected to start

            Example 1   Start "B:\hello.exf"
                    --> Obtained file name "B:\\HELLO.EXF"

            Example 2   Start "B:\pim\company.adr"
                    --> Start "B:\system\apps\adrview.exf" by Filer association
                    --> The file name that adrview.exf obtains is "B:\\PIM\\company.ADR"


===============================================================================
 Copyright (c) 1998-1999.  Seiko Instruments Inc.  All rights reserved. 
===============================================================================
