home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_04 / 2n04034a < prev    next >
Text File  |  1991-02-26  |  749b  |  43 lines

  1. /*
  2. **    Test code for the FDC routine in floppy.c.
  3. */
  4. #include    <stdio.h>
  5. #include    "floppy.h"
  6. #include    "delay.h"
  7.  
  8. static char buffer[512];
  9.  
  10. int
  11. main(void)
  12. {
  13.     unsigned rc;
  14.  
  15.     /* Setup FDC */
  16.     calibrateDelay();
  17.     fdcSetDriveParms(0x0c, 0x0f, 0x02);
  18.     fdcReset();
  19.  
  20.     /* Select drive 0, and recalibrate it */
  21.     fdcSelectDrive(0);
  22.     rc = fdcRecalibrate();
  23.     printf("fdcRecalibrate() == %u\n", rc);
  24.  
  25.     /* Read in sector 1 from head 0 */
  26.     rc = fdcSeek(0, 0);
  27.     printf("fdcSeek(0, 0) == %u\n", rc);
  28.     rc = fdcReadSectors(1, 1, buffer);
  29.     printf("fdcReadSectors(1, 1, buffer) == %u\n", rc);
  30.  
  31.     fdcResetParms();
  32.  
  33.     {
  34.         FILE *fd;
  35.  
  36.         fd = fopen("tmp.dat", "wb");
  37.         fwrite(buffer, 1, sizeof(buffer), fd);
  38.         fclose(fd);
  39.     }
  40.  
  41.     return 0;
  42. }
  43.