home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / TURBOPAS / TP-UTIL.ARK / DOSVERSN.SRC < prev    next >
Text File  |  1986-01-06  |  2KB  |  55 lines

  1. {->>>>DOSVersion<<<<-------------------------------------------}
  2. {                                                              }
  3. { Filename: DOSVERSN.SRC -- Last modified 10/20/85             }
  4. {                                                              }
  5. { This routine returns the current DOS version as a real       }
  6. { number.  It uses DOS call 48.  If you are using DOS 2.1 it   }
  7. { will return the value 2.1.  If you need to test only the     }
  8. { major or minor portions of the DOS version number, pull the  }
  9. { real number value apart with the Frac and Int functions:     }
  10. {                                                              }
  11. { MajorDOSVersion := Int(DOSVersion);                          }
  12. { MinorDOSVersion := Frac(DOSVersion);                         }
  13. {--------------------------------------------------------------}
  14.  
  15. FUNCTION DOSVersion : Real;
  16.  
  17. TYPE
  18.   Reg     = RECORD
  19.               CASE Boolean OF
  20.                 False : (Word : Integer);
  21.                 True  : (LoByte,HiByte : Byte)
  22.             END;
  23.  
  24.   Regpack = RECORD
  25.               AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : Reg
  26.             END;
  27.  
  28.   String15 = String[15];
  29.  
  30. VAR
  31.   I             : Integer;
  32.   R             : Real;
  33.   Dummy1,Dummy2 : String15;
  34.   Registers     : Regpack;
  35.  
  36. BEGIN
  37.   Registers.AX.HiByte := 48;
  38.   MSDOS(Registers);
  39.   WITH Registers DO
  40.     BEGIN
  41.       Str(AX.LoByte,Dummy1);
  42.       Str(AX.HiByte,Dummy2);
  43.     END;
  44.   Dummy1 := Dummy1 + '.' + Dummy2;
  45.   Val(Dummy1,R,I);
  46.   DOSVersion := R
  47. END;
  48. eal;
  49.  
  50. BEGIN
  51.   WITH T DO TimeToSeconds := (Hours * 3600) + (Minutes * 60) +
  52.     Seconds + (Hundredths * 0.01);
  53. END;
  54.  
  55. B