home *** CD-ROM | disk | FTP | other *** search
- ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- ;
- ; Name : GetPath.ASM - This is a QB4 SUB which places the fully
- ; qualified DOS pathname for the current default drive and path
- ; into a STRING variable which you define within QB.
- ;
- ; Revised : 07/07/90 08:49am
- ;
- ; Notes : - The single parameter passed to this SUB is a STRING
- ; which has ALREADY BEEN DEFINED within QB4.
- ; - The definition is a STRING of 67 blank spaces.
- ; - When finished, the passed STRING will contain the drive
- ; spec followed by ":\" and the rest of the DOS path.
- ; - The STRING will be padded as needed with blank spaces
- ; (i.e., CHR$(32) characters) so that you can use RTRIM$.
- ; - The rightmost character will NOT be a "\", so add that
- ; within your CALLing program if you need it.
-
- ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
- .MODEL MEDIUM,BASIC
- .CODE
-
- GetPath PROC USES SI,TEXTHOLDER:WORD
-
- mov BX,TEXTHOLDER
- mov SI,[BX+2] ; SI = start of passed STRING
- mov CX,[BX] ; CX = the LEN of passed STRING parm
- cmp CX,67 ; The passed STRING MUST be long enough!!
- jb LeaveGetPath
-
- mov AH,19h
- int 21h ; This results in the current drive
- ; spec being returned in AL
- mov DL,AL
- inc DL ; Store the drive spec for later INT
-
- add AL,65 ; Convert drive spec to ASCII character
- mov [SI],AL
- inc SI
- mov byte ptr[SI],':' ; Add in the colon
- inc SI
- mov byte ptr[SI],'\' ; Add in the backslash
- inc SI ; SI past the "\" character to proceed
- push SI
- mov AH,47h
- int 21h
- pop SI
- mov CX,64
-
- ClearTrailingZERO:
-
- cmp byte ptr[SI],0
- jne JustDoLoop
- mov byte ptr[SI],20h
- jmp short LeaveGetPath
-
- JustDoLoop:
-
- inc SI
- loop ClearTrailingZero
-
- LeaveGetPath:
-
- ret
-
- GetPath ENDP
- END
-
- ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++