home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / misc.swg / 0201_BASM Write Time Unit.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-08-30  |  2.0 KB  |  61 lines

  1.  
  2. (*
  3. {***********************************************************************
  4. * WRITE_TIME:                                                          *
  5. *                                                                      *
  6. * Very fast, can it be done any faster, routine to plonk the current   *
  7. * system time into a variable and to write it out as header for any    *
  8. * data that might follow...                                            *
  9. *                                                                      *
  10. * Note: Requires {$G+} directive                                       *
  11. *                                                                      *
  12. * (C) Copyright Robert AH Prins, 1995. All rights reserved.            *
  13. *                                                                      *
  14. * May be copied, used and distributed freely for non-profit purposes,  *
  15. * including the inclusion in shareware, provided credit is given.      *
  16. ***********************************************************************}
  17. *)
  18.  
  19. procedure write_time;
  20. const
  21.   wt_time: string[14] = '00:00:00.00 - ';
  22.  
  23. begin
  24.   asm
  25.     mov   ax, $2c00
  26.     int   $21
  27.     mov   bx, "00"
  28.     mov   al, ch                  {hours}
  29.     aam
  30.     rol   ax, 8
  31.     or    ax, bx
  32.     cmp   al, bl                  {<-  delete these four}
  33.     jne   @1                      {<-  lines if you want}
  34.     mov   al, " "                 {<-  leading zeroes in}
  35.   @1:                             {<-  the hours        }
  36.     mov   word ptr wt_time(1), ax
  37.     mov   al, cl                  {minutes}
  38.     aam
  39.     rol   ax, 8
  40.     or    ax, bx
  41.     mov   word ptr wt_time[4], ax
  42.     mov   al, dh                  {seconds}
  43.     aam
  44.     rol   ax, 8
  45.     or    ax, bx
  46.     mov   word ptr wt_time[7], ax
  47.     mov   al, dl                  {hundreds of seconds}
  48.     aam
  49.     rol   ax, 8
  50.     or    ax, bx
  51.     mov   word ptr wt_time[10], ax
  52.   end;
  53.  
  54.   write(wt_time);
  55. end; {write_time}
  56.  
  57. Regards,
  58.  
  59. Robert AH Prins <nlklmpum@ibmmail.com>
  60.  
  61.