home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / drdobbs / 1986 / 03 / weislst1.mar < prev    next >
Text File  |  1986-03-31  |  4KB  |  111 lines

  1. ;--------------------------------------------;
  2. ; Weissman/Dr. Dobbs submission Listing 1:   ;
  3. ; Assembler BIOS diskette read test program. ;
  4. ;--------------------------------------------;
  5.  
  6. ;----------------------------------------;
  7. ; Assembler code to test diskette times, ;
  8. ; reading 16 tracks through INT 13.      ;
  9. ; 10/1/85 Gregg Weissman                 ;
  10. ;         E-X-E Software Systems         ;
  11. ;----------------------------------------;
  12.  
  13. HI_RES_TIMER    equ 1
  14.  
  15. ; Set this to 1 if you implement
  16. ; the 1024 tick/sec AT timer.
  17. ; It will return time in 1k'ths of
  18. ; a second.  If using the usual IBM
  19. ; 18.2 ticks per second timer, set to 0
  20. ; and receive counts at that rate.
  21.  
  22. if HI_RES_TIMER
  23.  
  24.   GET_TIME      equ 10h                 ; Define the proper AH function value
  25.                                         ; For int 1ah
  26. else
  27.  
  28.   GET_TIME      equ 0
  29.  
  30. endif
  31.  
  32.  
  33.         ;----------------------------------------;
  34.         ; Start the test code:                   ;
  35.         ;----------------------------------------;
  36.  
  37. CODE segment
  38. assume cs:code,ds:code,es:code,ss:code
  39.  
  40.         org     80h
  41.  
  42. TIME_LO dw      ?                       ; Time accumulator out of the way.
  43. TIME_HI dw      ?
  44.  
  45.         org 100h
  46.  
  47. START:  ;------------------------------------------;
  48.         ; First, read a dummy sector to start the  ;
  49.         ; diskette: this way motor start time will ;
  50.         ; not affect the timings.                  ;
  51.         ;------------------------------------------;
  52.  
  53.         mov     ax,0201h                ; Read, 1 sector.
  54.         mov     cx,1                    ; Starting @ track 0, sector 1
  55.         mov     dx,1                    ; Side 0, diskette B:
  56.         mov     bx,offset DATA_AREA
  57.         int     13h                     ; Perform the op.
  58.         jb      STOP                    ; Error: abort.
  59.  
  60.         ;----------------------------------------;
  61.         ; Now, get the time of day and perform   ;
  62.         ; the test.  Read 32 tracks, 16 cyl's.   ;
  63.         ;----------------------------------------;
  64.  
  65.         cli
  66.         mov     ah,GET_TIME
  67.         int     1ah
  68.         mov     TIME_LO,dx
  69.         mov     TIME_HI,cx
  70.         sti
  71.         xor     bp,bp                   ; Set a register to count reads.
  72.         mov     di,290                  ; number of sectors total in testfile.
  73.         mov     dx,1                    ; disk B:
  74.         mov     cx,0001                 ; Start at trk 0, sect 1
  75.         mov     bx,offset DATA_AREA
  76. SIDE_1:
  77.         mov     al,9
  78.         cmp     di,al                   ; Number not mod 9, might do partial
  79.         jnb     N2                      ;   read on last track.
  80.         mov     ax,di                   ; Move partial read value into al
  81. N2:
  82.         mov     ah,2                    ; Read disk function code into AH
  83.         int     13h                     ; Perform disk read.
  84.         jb      STOP                    ; Error: don't bother with re-try.
  85.  
  86.         sub     di,9                    ; Subtract default count of sectors.
  87.         jbe     DONE                    ; We're done if di <= 0
  88.         inc     bp                      ; Count the op. to verify number done.
  89.         xor     dh,1                    ; Flip sides.
  90.         jne     SIDE_1                  ; If we flipped to side 1, do it.
  91.         inc     ch                      ;   else bump to next track (cylinder)
  92.         jmp     SIDE_1                  ;   and go back for more.
  93. DONE:
  94.         mov     ah,GET_TIME             ; OK, stop the clock.
  95.         int     1ah
  96.         sub     dx,TIME_LO              ; Get end_time - Start_time.
  97.         sbb     cx,TIME_HI
  98. STOP:
  99.         ;  WARNING!
  100.         ;  This program does not return to DOS!
  101.         ;  Do not run this except under DEBUG!
  102.  
  103.         int 3                           ; DEBUG breaks here, read time in DX
  104.                                         ; BP=20h and Carry Clear if no errors.
  105. org     200h
  106.  
  107. DATA_AREA       label byte
  108.  
  109. CODE    ends
  110. end     START
  111.