home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / LATTIC_3.LZH / EXAMPLES / FLOPFMT.C < prev    next >
C/C++ Source or Header  |  1990-05-14  |  651b  |  35 lines

  1. /*
  2.  * Format a single-sided floppy with n-sector skewing
  3.  *
  4.  * lc -L flopfmt.c
  5.  *
  6.  * Copyright (c) 1990 HiSoft
  7.  */
  8.  
  9. #include <osbind.h>
  10. #include <stdio.h>
  11. #include <string.h>
  12.  
  13. int main(void)
  14. {
  15.     static char buf[8192];
  16.     int trk;
  17.     short skew[]={2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9};
  18.     int n=2;
  19.     
  20.     for (trk=0; trk<80; trk++)
  21.     {
  22.         printf("\rFormatting track %02d",trk);
  23.         if (Flopfmt(buf,&skew[8-(trk*n%9)],0,9,trk,0,-1,0x87654321,0xe5e5))
  24.             printf("\nError on track %02d\n",trk);
  25.     }
  26.     memset(buf,0,9*512);
  27.     
  28.     Flopwr(buf,0L,0,1,0,0,9);
  29.     Flopwr(buf,0L,0,1,1,0,9);
  30.  
  31.     Protobt(buf,0x01000000L,2,0);
  32.  
  33.     Flopwr(buf,0L,0,1,0,0,1);
  34. }
  35.