home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / asmutil / zendisk2.zip / LTEST.ASM < prev    next >
Assembly Source File  |  1990-02-15  |  1KB  |  66 lines

  1. ;
  2. ; Program to measure performance of code that takes longer than
  3. ; 54 ms to execute.
  4. ; Link with LZTIMER.OBJ.
  5. ;
  6. ; By Michael Abrash 10/30/87
  7. ;
  8. stack    segment    para stack 'STACK'
  9.     db    512 dup(?)
  10. stack    ends
  11.  
  12. Code    segment    para public 'CODE'
  13.     assume    cs:Code, ds:code
  14.     extrn    ZTimerOn:near, ZTimerOff:near, ZTimerReport:near
  15. Start    proc    near
  16.     push    cs
  17.     pop    ds    ;point DS to the code segment
  18. ;
  19. ; Delay for 2-3 seconds, to let the Enter keystroke that started the
  20. ; program come back up.
  21. ;
  22.     mov    ah,2ch
  23.     int    21h        ;get the current time
  24.     mov    bh,dh        ;set the current time aside
  25. DelayLoop:
  26.     mov    ah,2ch
  27.     int    21h        ;get time
  28.     cmp    dh,bh        ;is the new seconds count less than
  29.                 ; the start seconds count?
  30.     jnb    CheckDelayTime    ;no
  31.     add    dh,60        ;yes, a minute must have turned over,
  32.                 ; so add one minute
  33. CheckDelayTime:
  34.     sub    dh,bh        ;get time that's passed
  35.     cmp    dh,3        ;has it been three seconds?
  36.     jb    DelayLoop    ;not yet
  37. ;
  38. ;Code under test starts here.
  39. ;*********************************************************************
  40. ;
  41. ; Start timing.
  42. ;
  43.     call    ZTimerOn
  44. ;
  45.     rept    10000
  46.     mul    ax
  47.     endm
  48. ;
  49. ; Stop timing.
  50. ;
  51.     call    ZTimerOff
  52. ;*********************************************************************
  53. ; Code under test ends here.
  54. ;
  55. ; Display the results.
  56. ;
  57.     call    ZTimerReport
  58. ;
  59. ; Terminate the program.
  60. ;
  61.     mov    ah,4ch
  62.     int    21h
  63. Start    endp
  64. Code    ends
  65.     end    Start
  66.