home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / section5 / fxn4408h.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-11  |  1.6 KB  |  33 lines

  1.         ;************************************************************;
  2.         ;                                                            ;
  3.         ;      Function 44H, Subfunction 08H:                        ;
  4.         ;                    IOCTL Removable Block Device Query      ;
  5.         ;                                                            ;
  6.         ;      int ioctl_block_fixed(drive_ltr)                      ;
  7.         ;          int drive_ltr;                                    ;
  8.         ;                                                            ;
  9.         ;      Returns -1 for all errors, 1 if disk is fixed (not    ;
  10.         ;      removable), 0 if disk is not fixed.                   ;
  11.         ;                                                            ;
  12.         ;************************************************************;
  13.  
  14. cProc   ioctl_block_fixed,PUBLIC
  15. parmB   drive_ltr
  16. cBegin
  17.         mov     bl,drive_ltr    ; Get drive letter.
  18.         or      bl,bl           ; Leave 0 alone.
  19.         jz      ibch
  20.         and     bl,not 20h      ; Convert letter to uppercase.
  21.         sub     bl,'A'-1        ; Convert to drive number: 'A' = 1,
  22.                                 ; 'B' = 2, etc.
  23. ibch:
  24.         mov     ax,4408h        ; Set function code, Subfunction 08H.
  25.         int     21h             ; Call MS-DOS.
  26.         jnc     ibchx           ; Branch if no error, AX = 0 or 1.
  27.         cmp     ax,1            ; Treat error code of 1 as "disk is
  28.                                 ; fixed."
  29.         je      ibchx
  30.         mov     ax,-1           ; Return -1 for other errors.
  31. ibchx:
  32. cEnd
  33.