home *** CD-ROM | disk | FTP | other *** search
- ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- ;
- ; Name - VOLLABEL.ASM
- ;
- ; Revised - 07/22/90 03:25pm
- ;
- ; Purpose - Allows a new VOLUME label to be assigned to a disk(ette)
- ; from within Microsoft QuickBASIC V 4 +.
- ;
- ; This routine should be DECLAREd in your program as an external
- ; SUB routine, via the QuickBASIC statement -
- ;
- ; DECLARE SUB NewLabel( Drive%, NewName$)
- ;
- ; NOTES : The NewLabel string MUST end with a CHR$(0).
- ; It may NOT contain ANY CHARACTERS other than the Letters a-z,
- ; A-Z, and the blank space character.
- ;
- ; However, if the New VOLUME LABEL is > 8 characters long,
- ; the ninth character must be a period.
- ; The period may then be followed by up to 3 more characters
- ; (much the same as any DOS file name).
- ;
- ; The Drive parameter MUST be > 0, with Drive A: = 1,
- ; Drive B: = 2, etc.
- ;
- ; This REQUIRES DOS V3.0 or higher to work at all
- ;
- ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
- .MODEL MEDIUM,BASIC
-
- .DATA
-
- DTALabel DB 0FFH,5 DUP(0),08,01,11 DUP(3Fh),26 DUP(0)
-
- .CODE
-
- SetNewVolumeLabel PROC DRIVENMBR:word, VOLNAME:word
-
- mov BX,DRIVENMBR ; Put address of Drive parm into BX
- mov AX,[BX] ; Put drive number into AL
-
- cmp AX,1 ; Be sure the new DTA to be set up
- ; will use the proper drive specifier!
- je Dont_Change_Drive
-
- mov SI,OFFSET DTALabel
- add SI,07 ; Point at Drive specifier of DTALabel
- mov [SI],AL ; Put In new drive specifier
-
- Dont_Change_Drive:
-
- mov DX,OFFSET DTALabel
- mov AH,11h ; "FIND FIRST MATCH" (using FCB -
- ; the "old original" DOS method)
- int 21h
-
- cmp AL,0FFh ; If NO prev. label, just make NEW one
- je Write_New_Label
-
- mov AH,13h ; Otherwise, delete the current volume label
- int 21h
-
- Write_New_Label:
-
- mov BX,VOLNAME ; Put the address of the STRING
- ; DESCRIPTOR of VOLNAME into BX
- mov DX,[BX+2] ; DX = offset of the start of VOLNAME
- mov AH,5Bh ; DOS V3.0+ CREATe file function
- mov CX,08 ; The CREATEd file will bear the
- ; attribute value of a VOLUME LABEL
- int 21h
-
- mov BX,AX ; Put the file handle of the new
- ; volume label into BX
- mov AH,3Eh ; Close the new VOLUME LABEL file as
- int 21h ; you would any other new file
- ret
-
- SetNewVolumeLabel ENDP
- END
-
- ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++