home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / TIMEFNS.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-05-30  |  2.4 KB  |  137 lines

  1.         page    58,132
  2.  
  3. ; time.asm
  4. ; contains: fastdate(),fasttime(),fetchtime()
  5. ;
  6.         include    model.h
  7.         include    prologue.h
  8.         include equ.h
  9.  
  10.         pseg    fastdate
  11.  
  12. ;==>--    int fastdate(td)
  13. ;
  14. ;;    ARGUMENTS:
  15. ;      (struct TIMEDATE *)    td    -    points to time date structure
  16. ;
  17. ;;    DESCRIPTION:
  18. ;      Get system time and put in structure
  19. ;
  20. ;;    RETURNS:
  21. ;      Day of month 0..31
  22. ;
  23. ;;    AUTHOR:
  24. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  25. ;;;
  26.     cproc    fastdate
  27.     mov    ah,2ah            ;dos get date function
  28.     int    21h
  29.     if    _LDATA
  30.      push    ds
  31.      lds    bx,parm1_
  32.     else
  33.      mov    bx,parm1_
  34.     endif
  35.     mov    [bx+year],cx        ;save year
  36.     xor    ah,ah
  37.     mov    al,dh            ;ax=month
  38.     mov    [bx+month],ax
  39.     mov    al,dl            ;ax=day
  40.     mov    [bx+day],ax        ;return with day in ax
  41.     if    _LDATA
  42.      pop    ds
  43.     endif
  44.     cproce
  45.  
  46. ;==>--    int fasttime(td)
  47. ;
  48. ;;    ARGUMENTS:
  49. ;      (struct TIMEDATE *)    td    -    points to time date structure
  50. ;
  51. ;;    DESCRIPTION:
  52. ;     Get system time and put in structure
  53. ;
  54. ;;    RETURNS:
  55. ;      day of week (0..6)
  56. ;
  57. ;;    AUTHOR:
  58. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  59. ;;;
  60.     cproc    fasttime
  61.     mov    ah,2ch            ;get time function
  62.     int    21h
  63.     if    _LDATA
  64.      push    ds
  65.      lds    bx,parm1_
  66.     else
  67.      mov    bx,parm1_
  68.     endif
  69.     xor    ah,ah
  70.     mov    al,ch            ;ax=hour
  71.     mov    [bx+hours],ax
  72.     mov    al,cl            ;ax=minutes
  73.     mov    [bx+minutes],ax
  74.     mov    al,dh            ;ax=seconds
  75.     mov    [bx+seconds],ax
  76.     mov    al,dl            ;ax=hundredths/sec
  77.     mov    [bx+hsecs],ax
  78.     if    _LDATA
  79.      pop    ds
  80.     endif
  81.     mov    ah,2ah
  82.     int    21h            ;get date (day of week to AL)
  83.     xor    ah,ah
  84.     cproce
  85.  
  86. ;==>--    int fetchtime(td)
  87. ;
  88. ;;    ARGUMENTS:
  89. ;      (struct TIMEDATE *)    td    -    points to time date structure
  90. ;
  91. ;;    DESCRIPTION:
  92. ;      Get system date and time to structure
  93. ;
  94. ;;    RETURNS:
  95. ;      day of week, 0=Sun, 1=Mon etc.
  96. ;
  97. ;;    AUTHOR:
  98. ;      Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
  99. ;;;
  100.     cproc    fetchtime,,fetchtim
  101.     mov    ah,2ch            ;get time function
  102.     int    21h
  103.     if    _LDATA
  104.      push    ds
  105.      lds    bx,parm1_
  106.     else
  107.      mov    bx,parm1_
  108.     endif
  109.     xor    ah,ah
  110.     mov    al,ch            ;ax=hour
  111.     mov    [bx+hours],ax
  112.     mov    al,cl            ;ax=minutes
  113.     mov    [bx+minutes],ax
  114.     mov    al,dh            ;ax=seconds
  115.     mov    [bx+seconds],ax
  116.     mov    al,dl            ;ax=hundredths/sec
  117.     mov    [bx+hsecs],ax
  118.     push    bx
  119.     mov    ah,2ah            ;dos get date function
  120.     int    21h
  121.     pop    bx
  122.     push    ax
  123.     mov    [bx+year],cx        ;save year
  124.     xor    ah,ah
  125.     mov    al,dh            ;ax=month
  126.     mov    [bx+month],ax
  127.     mov    al,dl            ;ax=day
  128.     mov    [bx+day],ax
  129.     pop    ax
  130.     xor    ah,ah            ;return with day of week in ax
  131.     if    _LDATA
  132.      pop    ds
  133.     endif
  134.     cproce
  135.     endps
  136.     end
  137.