home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / t / talkpas.zip / INITSPD.ASM < prev    next >
Assembly Source File  |  1989-04-22  |  2KB  |  54 lines

  1. title    InitSpeed
  2. ; computes machine performance index
  3. ;        Michael Day
  4. ;        released to public domain by authors 
  5. ;        as of 22 April 1989
  6.  
  7. CODE     segment public 
  8.          assume CS:CODE, DS:CODE
  9.          public InitSpeed
  10.  
  11. ; Outputs sound sample beginning at address Start, and continuing for
  12. ; Count bytes.
  13.  
  14. ; function InitSpeed:word;
  15. InitSpeed  proc  far  
  16.          sti                ;insure ints are on
  17.          push   DS          ;save DS 
  18.          mov    AX,0040H    ;BIOS data segment 
  19.          mov    DS,AX       ;into DS 
  20.          mov    DI,6CH      ;offset for lsh of timer 
  21.          mov    AL,[DI]     ;get lsb of timer 
  22.          xor    CX,CX       ;initialize large count 
  23.          xor    DX,DX       ;(longint version) 
  24.          call   Subr        ;loop until timer changes 
  25.          mov    AL,[DI]     ;get new timer value 
  26.          xor    CX,CX       ;initialize large count 
  27.          xor    DX,DX       ;(longint version) 
  28.          call   Subr        ;call delay subr 
  29.          pop    DS          ;restore DS 
  30.          mov    AX,CX       ;count to lsh of dividnd 
  31.          not    AX          ;AX=count for 55 msec 
  32.          mov    CX,55       ;msec per timer tick 
  33.          div    CX          ;compute count for 1 msec 
  34.          ret                ;returns count in AX 
  35. InitSpeed  endp
  36.  
  37.  
  38. ;-------------------------------------------------
  39. ; wait for tick count to happen
  40. Subr:
  41.          cmp    AL,[DI]     ;check if timer changed 
  42.          jnz    SubEnd      ;quit after 1 timer tick 
  43.          loop   subr        ;count and loop 
  44.          inc    DX          ;overflow into dx
  45.          cmp    DX,54       ;check if too far
  46.          jb     subr        ;go for full count
  47. SubEnd:
  48.          ret                ;return from local subr 
  49.  
  50. CODE     ends  
  51.          end
  52.  
  53.  
  54.