home *** CD-ROM | disk | FTP | other *** search
- /*
- * ====================================================================
- * MOVABLE.C - function to test device by number: 0=current, 1=A, 2=B,...
- * Returns: int 0: removable, int 1: fixed
- * ====================================================================
- */
- #include <dos.h>
- #include <stdio.h>
- #include <ctype.h>
- #define DEBUG 0
- #if DEBUG
- #include <string.h>
- #endif
- #if DEBUG
- int main (int argc, char * argv[])
- #else
- int movable (int drv) /* value: 1-26 */
- #endif
- { int rc; int carry =0 ;
- #if DEBUG
- int drv;
- char st[10] = "removable";
- drv = toupper(argv[1][0]) - 'A'+1;
- #endif
- asm push ds ;
- asm push dx ;
- asm mov ah,44h ;
- asm mov al,08h ;
- asm mov bl,drv ;
- asm int 21h ;
- asm jnc OK ;
- asm mov carry,80h ;
- OK:
- asm mov rc,ax ;
- asm pop dx ;
- asm pop ds ;
- #if DEBUG
- if (rc) strcpy(st,"fixed");
- printf("MOVABLE reports device %d is %s\n",drv,st);
- #endif
- rc |= carry;
- return rc;
- }