home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / section5 / fxn2ch.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-11  |  1.8 KB  |  36 lines

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;             Function 2CH: Get Time                         ;
  4.         ;                                                            ;
  5.         ;             long get_time(phour,pmin,psec,phund)           ;
  6.         ;                  char *phour,*pmin,*psec,*phund;           ;
  7.         ;                                                            ;
  8.         ;             Returns the time packed into a long:           ;
  9.         ;                  low byte  = hundredths                    ;
  10.         ;                  next byte = seconds                       ;
  11.         ;                  next byte = minutes                       ;
  12.         ;                  next byte = hours                         ;
  13.         ;                                                            ;
  14.         ;************************************************************;
  15.  
  16. cProc   get_time,PUBLIC,ds
  17. parmDP  phour
  18. parmDP  pmin
  19. parmDP  psec
  20. parmDP  phund
  21. cBegin
  22.         mov     ah,2ch          ; Set function code.
  23.         int     21h             ; Get time from MS-DOS.
  24.         loadDP  ds,bx,phour     ; DS:BX = pointer to hour.
  25.         mov     [bx],ch         ; Return hour.
  26.         loadDP  ds,bx,pmin      ; DS:BX = pointer to min.
  27.         mov     [bx],cl         ; Return min.
  28.         loadDP  ds,bx,psec      ; DS:BX = pointer to sec.
  29.         mov     [bx],dh         ; Return sec.
  30.         loadDP  ds,bx,phund     ; DS:BX = pointer to hund.
  31.         mov     [bx],dl         ; Return hund.
  32.         mov     ax,dx           ; Pack seconds, hundredths, ...
  33.         mov     dx,cx           ; ... minutes, and hour into
  34.                                 ; return value.
  35. cEnd
  36.