home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / nfsrc21.zip / DOSVER.PRG < prev    next >
Text File  |  1991-08-16  |  2KB  |  91 lines

  1. /*
  2.  * File......: DOSVER.PRG
  3.  * Author....: Glenn Scott
  4.  * Date......: $Date:   15 Aug 1991 23:02:24  $
  5.  * Revision..: $Revision:   1.2  $
  6.  * Log file..: $Logfile:   E:/nanfor/src/dosver.prv  $
  7.  * 
  8.  * This is an original work by Glenn Scott and is placed in the
  9.  * public domain.
  10.  *
  11.  * Modification history:
  12.  * ---------------------
  13.  *
  14.  * $Log:   E:/nanfor/src/dosver.prv  $
  15.  * 
  16.  *    Rev 1.2   15 Aug 1991 23:02:24   GLENN
  17.  * Forest Belt proofread/edited/cleaned up doc
  18.  * 
  19.  *    Rev 1.1   12 Jun 1991 02:38:24   GLENN
  20.  * Documentation mod and removal of reference to constant INT86_SUCCESS.
  21.  * Checked for ft_int86() compatibility.
  22.  * 
  23.  *    Rev 1.0   01 Apr 1991 01:01:14   GLENN
  24.  * Nanforum Toolkit
  25.  *
  26.  */
  27.  
  28.  
  29. /*  $DOC$
  30.  *  $FUNCNAME$
  31.  *     FT_DOSVER
  32.  *  $CATEGORY$
  33.  *     DOS/BIOS
  34.  *  $ONELINER$
  35.  *     Return the current DOS major and minor version as a string
  36.  *  $SYNTAX$
  37.  *     FT_DOSVER() -> <cVersion>
  38.  *  $ARGUMENTS$
  39.  *     None
  40.  *  $RETURNS$
  41.  *     A character string with the major version number first, a 
  42.  *     period ("."), then the minor version number (e.g., "3.30")
  43.  *  $DESCRIPTION$
  44.  *
  45.  *     FT_DOSVER() invokes DOS interrupt 21h, service 30 in order to
  46.  *     return the current DOS version.  It does this by setting up 
  47.  *     an array corresponding to machine registers and then calling
  48.  *     the toolkit function FT_INT86().
  49.  *
  50.  *     It returns a character string corresponding to the DOS 
  51.  *     version, as follows:  The major version, a period ("."), then
  52.  *     the minor version.
  53.  *
  54.  *
  55.  *  $EXAMPLES$
  56.  *
  57.  *      FUNCTION main()
  58.  *      RETURN QOut( "Dos version: " + FT_DOSVER() )
  59.  *
  60.  *  $END$
  61.  */
  62.  
  63. #include "FTINT86.CH"
  64.  
  65. #define DOS        33
  66. #define DOSVER     48
  67.  
  68.  
  69. #ifdef FT_TEST
  70.   FUNCTION MAIN()
  71.   QOut( "Dos version: " + FT_DOSVER() )
  72.   return ( nil )
  73. #endif
  74.  
  75. FUNCTION FT_DOSVER()
  76.   local aRegs[ INT86_MAX_REGS ]
  77.   local cResult := ""
  78.  
  79.   aRegs[ AX ] = MAKEHI( DOSVER )
  80.   if FT_INT86( DOS, aRegs )
  81.      cResult := alltrim( str( LOWBYTE( aRegs[ AX ] ) ) ) + "." + ;
  82.                 alltrim( str( HIGHBYTE( aRegs[ AX ] ) ) )
  83.   endif
  84.  
  85. RETURN ( cResult )
  86.  
  87.  
  88.      
  89.  
  90.  
  91.