home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / FORTRAN / SUPERT87.ZIP / RMTIME.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-12-15  |  1.5 KB  |  79 lines

  1. ;
  2. ; subroutine time: assembly language routine to allow the acquisition
  3. ; of the current value of the system clock
  4. ;
  5. ; fortran call is : call time(hours,mins,secs,hsecs) 
  6. ;
  7. ; where j = hour:minute, i = secs:hsecs
  8. ;
  9. ;
  10. ;    interface to IBM professional fortran 1.0
  11.  
  12. stack_size    equ    6    ; number of bytes needed on stack
  13.  
  14. data        segment
  15.         db    'time    '
  16. sp_save    dw    ?
  17.         dd    time
  18.         dd    0
  19. data        ends
  20.  
  21.  
  22.  
  23. ;
  24. code        segment    'code'
  25.         assume    cs:code,ds:data,es:nothing,ss:nothing
  26.         public    time
  27. time        proc        far
  28.  
  29.  
  30. ;----------execute Profort standard entry linkage--------------------
  31.  
  32.         push    ds
  33.         sub    bp,stack_size+6
  34.         mov    ax,data
  35.         mov    ds,ax
  36.         mov    sp_save,sp
  37.         mov    sp,bp
  38. ;---------------------------------------------------------------------
  39.  
  40.         mov    ah,2ch
  41.         int    21h            ; get time
  42.  
  43. ;    es:[bx] =    &hours
  44. ;    es:4[bx] =    &mins
  45. ;    es:8[bx] =  &secs
  46. ;    es:12[bx] =    &hsecs
  47.  
  48. ;    format returned by dos is dh(secs),dl(hsecs),ch(hours),cl(mins)
  49.  
  50.         lds    si,es:[bx]
  51.         xor    ax,ax            ; zero ax
  52.         mov    al,ch
  53.         mov    [si],ax        ; store hours
  54.         lds    si,es:4[bx]
  55.         mov    al,cl
  56.         mov    [si],ax        ; store mins
  57.         mov    al,dh
  58.         lds    si,es:8[bx]
  59.         mov    [si],ax        ; store secs
  60.         mov    al,dl
  61.         lds    si,es:12[bx]
  62.         mov    [si],ax        ; store hsecs
  63.  
  64.  
  65. ;-------------perform exit linkage------------------------------------
  66.  
  67.         add    sp,stack_size+2
  68.         ret
  69. ;---------------------------------------------------------------------
  70.  
  71. time        endp
  72. code        ends
  73.         end
  74.  
  75. stack        segment word stack 'stack'
  76.         db    stack_size dup(?)
  77. stack        ends
  78.         end
  79.