home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / C / C-FDC / DASD.C < prev    next >
Text File  |  1986-08-01  |  923b  |  50 lines

  1. /*
  2.  *    Get/Set DASD functions
  3.  *
  4.  *    getdasd() returns:    00 - drive not present
  5.  *                01 - diskette, no change line
  6.  *                02 - diskette, change line available
  7.  *                03 - fixed disk
  8.  *
  9.  *    setdasd() accepts a drive and type. The type is:
  10.  *                00 - not used
  11.  *                01 - 320/360 diskette in 320/360 drive
  12.  *                02 - 320/360 diskette in 1.2M drive
  13.  *                03 - 1.2M diskette in 1.2M drive                    
  14.  */
  15.  
  16. #include <stdio.h>
  17. #include <dos.h>
  18. #include "fdc.h"
  19.  
  20. int getdasd(int drive)
  21. {
  22.  
  23.     extern int errno;
  24.     struct REGVAL r;
  25.  
  26.     r.ax = READDASD;
  27.     r.dx = drive;
  28.     if(sysint(DISKINT, &r, &r) & 1) {
  29.         errno = (int)(r.ax >> 8);
  30.         return(-1);
  31.     } else {
  32.         return(r.ax & 0xff);
  33.     }
  34. }
  35.  
  36. int setdasd(int drive, int type)
  37. {
  38.     extern int errno;
  39.     struct REGVAL r;
  40.  
  41.     r.ax = SETDASD | type;
  42.     r.dx = drive;
  43.     if(sysint(DISKINT, &r, &r) & 1) {
  44.         errno = (int)(r.ax >> 8);
  45.         return(-1);
  46.     } else {
  47.         return(0);
  48.     }
  49. }
  50.