home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / S12334.ZIP / SETDRIVE.ASM < prev    next >
Assembly Source File  |  1989-03-20  |  976b  |  38 lines

  1. ;----- SetDrive.Asm - sets the default drive
  2.  
  3. ;Syntax -
  4. ;
  5.  
  6. ;   CALL SetDrive(Drive$)
  7. ;   where Drive$ = "A" or "a" or "B", etc.
  8.  
  9. .286
  10. .Model Medium, Basic
  11. .Code
  12.     Extrn DosSelectDisk:Proc ;declare the OS/2 call as external
  13.  
  14. SetDrive Proc, Drive:Ptr
  15.  
  16.     Mov  SI,Drive         ;put Drive$ descriptor address into SI
  17.     Cmp  Word Ptr [SI],0  ;is Drive$ null?
  18.     Jz   Exit             ;yes, ignore the request
  19.  
  20.     Mov  SI,[SI+02]       ;put address of Drive$ data in SI
  21.     Mov  DL,[SI]          ;put ASC(Drive$) into DL
  22.  
  23.     Cmp  DL,'a'           ;is it below "a"?
  24.     Jb   Continue         ;yes, skip
  25.     Sub  DL,32            ;no, convert to upper case
  26.  
  27. Continue:
  28.     Sub  DL,64            ;"A" now equals 1, "B" = 2, etc.
  29.     Xor  DH,DH            ;clear DH so we can use all of DX
  30.     Push DX               ;push drive number
  31.     Call DosSelectDisk    ;call OS/2
  32.  
  33. Exit:
  34.     Ret                   ;return to BASIC
  35.  
  36. SetDrive Endp
  37. End
  38.