home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / d / d020_1_4 / 5.ddi / CLOCK / GETTIME.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-06-01  |  853 b   |  38 lines

  1. ; get the time more efficiently than cmerge and DOSCALL() do
  2.  
  3. ?PLM=0
  4. include cmacros.inc
  5.  
  6. time    struc
  7.         hour    dw  ?
  8.         minute  dw  ?
  9.         second  dw  ?
  10. time    ends
  11.  
  12. assumes CS,CODE
  13. assumes DS,DATA
  14.  
  15. sBegin   CODE
  16.  
  17. cProc   GetTime, <PUBLIC, NEAR>
  18.         parmW   pTime               ; pointer to the structure to fill
  19.  
  20. cBegin
  21.         mov     ax, 2c00h           ; get time
  22.         int     21h
  23.         mov     bx, pTime
  24.         cmp     ch, 12                  ; if hour <12
  25.         jl      lt12                    ; we're ok
  26.         sub     ch,12                   ; else adjust it
  27. lt12:
  28.         xor     ax,ax
  29.         mov     al,ch
  30.         mov     [bx].hour, ax
  31.         mov     al,cl
  32.         mov     [bx].minute, ax
  33.         mov     al,dh
  34.         mov     [bx].second, ax
  35. cEnd
  36. sEnd    CODE
  37.         END
  38.