Category : C++ Source Code
Archive   : VCCRT2.ZIP
Filename : SETDRIVE.ASM

 
Output of file : SETDRIVE.ASM contained in archive : VCCRT2.ZIP
page ,132
title setdrive - contains the _dos_setdrive() function
;***
;setdrive.asm - contains _dos_setdrive()
;
; Copyright (c) 1987-1992, Microsoft Corporation. All rights reserved.
;
;Purpose:
; This module contains the _dos_setdrive() function.
;
;*******************************************************************************

include version.inc
.xlist
include cmacros.inc
include msdos.inc
.list

sBegin code

assumes cs,code

page
;***
;unsigned _dos_setdrive(drive, p_ndrive) - change default drive (1=A:, 2=B:, etc.)
;
;Purpose:
; The function "_dos_setdrive" allows the user to change
; the current default drive, via INT 21H function 0EH.
; It also returns the number of valid drives in the system.
;
; NOTE: INT 21h Function 19h accepts (0=A:, 1=B:, etc.) but
; _dos_setdrive() uses values (1=A:, 2=B:, etc.) consistent
; with other DOS functions.
;
;Entry:
; unsigned drive; drive to be the default
; unsigned * p_ndrives; address to store drive
;
;Exit:
;
;Uses:
;
;Exceptions:
;
;*******************************************************************************

cProc _dos_setdrive,,<>

parmB _drive ; drive to be default drive
parmDP _p_ndrives ; address to store number of valid drives

cBegin

mov dl,(_drive)
dec dx
callos selectdisk ; set current drive

mov ah,0
if sizeD
les bx,(_p_ndrives)
mov es:[bx],ax
else
mov bx,(_p_ndrives)
mov [bx],ax
endif
xor ax,ax ; Do NOT return something useful --

ifdef _WINDOWS
cEnd
else
pop bp
ret
cEnd
endif


sEnd

end


  3 Responses to “Category : C++ Source Code
Archive   : VCCRT2.ZIP
Filename : SETDRIVE.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/