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

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;      Function 57H: Get/Set Date/Time of File               ;
  4.         ;                                                            ;
  5.         ;      long file_date_time(handle,func,packdate,packtime)    ;
  6.         ;           int handle,func,packdate,packtime;               ;
  7.         ;                                                            ;
  8.         ;      Returns a long -1 for all errors, otherwise packs     ;
  9.         ;      date and time into a long integer,                    ;
  10.         ;      date in high word, time in low word.                  ;
  11.         ;                                                            ;
  12.         ;************************************************************;
  13.  
  14. cProc   file_date_time,PUBLIC
  15. parmW   handle
  16. parmB   func
  17. parmW   packdate
  18. parmW   packtime
  19. cBegin
  20.         mov     bx,handle       ; Get handle.
  21.         mov     al,func         ; Get function: 0 = read, 1 = write.
  22.         mov     dx,packdate     ; Get date (if present).
  23.         mov     cx,packtime     ; Get time (if present).
  24.         mov     ah,57h          ; Set function code.
  25.         int     21h             ; Call MS-DOS.
  26.         mov     ax,cx           ; Set DX:AX = date/time, assuming no
  27.                                 ; error.
  28.         jnb     dt_ok           ; Branch if no error.
  29.         mov     ax,-1           ; Return -1 for errors.
  30.         cwd                     ; Extend the -1 into DX.
  31. dt_ok:
  32. cEnd
  33.