home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / C / C-FDC / VERTRACK.C < prev    next >
Text File  |  1986-08-01  |  1KB  |  57 lines

  1. /*
  2.  *     Verify a track
  3.  *
  4.  *     Accepts:    drive: 0 = A:, 1 = B:
  5.  *            head: 0 / 1
  6.  *            start_sect: starting sector
  7.  *            max_sect: maximum # of sectors to check
  8.  *            buf: buffer holding informtion to verify
  9.  *            start_sect and max_sect can be 1 - 8, 1 - 9, 1 - 15.
  10.  *
  11.  *    Returns 0 if successful, -1 on error with errno set with DOS return
  12.  */
  13.  
  14.  
  15.  
  16. #include <stdio.h>
  17. #include <dos.h>
  18. #include "fdc.h"
  19.  
  20. int vertrack(drive, head, track, start_sect, max_sect, buf)
  21. int drive, head, track, start_sect, max_sect;
  22. char *buf;
  23. {
  24.  
  25.     int i;
  26.     char *advance;
  27.     struct REGVAL r;
  28.     extern int errno;
  29.  
  30.     advance = buf;                 /* starting buff pointer */
  31.     r.ax = VERIFYTR | max_sect;
  32.     r.es = getds();
  33.     r.bx = advance;
  34.     r.cx = (track << 8) | start_sect; 
  35.     r.dx = (head << 8) | drive;
  36. #if 0
  37.     for(i = 1; i <= max_sect; ++i) {
  38.         if(sysint(DISKINT, &r, &r) & 1) {
  39.             errno = (int)(r.ax >> 8);
  40.             return(i);
  41.         }
  42.         ++r.cx;                    /* advance to next sector */
  43.         advance += secsize[sec_type];
  44.     }
  45. #endif
  46.     if (sysint(DISKINT, &r, &r) & 1) {
  47.         errno = (int)(r.ax >> 8);
  48.         return(-1);
  49.     }
  50.     return(0);
  51. }
  52.         
  53.  
  54.     
  55.  
  56.  
  57.