home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / qb_pds / qb_lib / vollabel.asm < prev    next >
Encoding:
Assembly Source File  |  1990-07-22  |  3.3 KB  |  84 lines

  1. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. ;
  3. ;       Name    - VOLLABEL.ASM
  4. ;
  5. ;       Revised - 07/22/90 03:25pm
  6. ;
  7. ;       Purpose - Allows a new VOLUME label to be assigned to a disk(ette)
  8. ;               from within Microsoft QuickBASIC V 4 +.
  9. ;
  10. ;       This routine should be DECLAREd in your program as an external
  11. ;       SUB routine, via the QuickBASIC statement -
  12. ;
  13. ;                      DECLARE SUB NewLabel( Drive%, NewName$)
  14. ;
  15. ;       NOTES : The NewLabel string MUST end with a CHR$(0).
  16. ;               It may NOT contain ANY CHARACTERS other than the Letters a-z,
  17. ;               A-Z, and the blank space character.
  18. ;
  19. ;               However, if the New VOLUME LABEL is > 8 characters long,
  20. ;               the ninth character must be a period.
  21. ;               The period may then be followed by up to 3 more characters
  22. ;               (much the same as any DOS file name).
  23. ;
  24. ;               The Drive parameter MUST be > 0, with Drive A: = 1,
  25. ;               Drive B: = 2, etc.
  26. ;
  27. ;               This REQUIRES DOS V3.0 or higher to work at all
  28. ;
  29. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  30.  
  31.          .MODEL      MEDIUM,BASIC
  32.  
  33.          .DATA
  34.  
  35.          DTALabel    DB    0FFH,5 DUP(0),08,01,11 DUP(3Fh),26 DUP(0)
  36.  
  37.          .CODE
  38.  
  39. SetNewVolumeLabel       PROC    DRIVENMBR:word, VOLNAME:word
  40.  
  41.         mov     BX,DRIVENMBR            ; Put address of Drive parm into BX
  42.         mov     AX,[BX]                 ; Put drive number into AL
  43.  
  44.         cmp     AX,1                    ; Be sure the new DTA to be set up
  45.                                         ;  will use the proper drive specifier!
  46.         je      Dont_Change_Drive
  47.  
  48.         mov     SI,OFFSET DTALabel
  49.         add     SI,07                   ; Point at Drive specifier of DTALabel
  50.         mov     [SI],AL                 ; Put In new drive specifier
  51.  
  52. Dont_Change_Drive:
  53.  
  54.         mov     DX,OFFSET DTALabel
  55.         mov     AH,11h                  ; "FIND FIRST MATCH" (using FCB -
  56.                                         ;        the "old original" DOS method)
  57.         int     21h
  58.  
  59.         cmp     AL,0FFh                 ; If NO prev. label, just make NEW one
  60.         je      Write_New_Label
  61.  
  62.         mov     AH,13h                  ; Otherwise, delete the current volume label
  63.         int     21h
  64.  
  65. Write_New_Label:
  66.  
  67.         mov     BX,VOLNAME              ; Put the address of the STRING
  68.                                         ;       DESCRIPTOR of VOLNAME into BX
  69.         mov     DX,[BX+2]               ; DX = offset of the start of VOLNAME
  70.         mov     AH,5Bh                  ; DOS V3.0+ CREATe file function
  71.         mov     CX,08                   ; The CREATEd file will bear the
  72.                                         ;       attribute value of a VOLUME LABEL
  73.         int     21h
  74.  
  75.         mov     BX,AX                   ; Put the file handle of the new
  76.                                         ;       volume label into BX
  77.         mov     AH,3Eh                  ; Close the new VOLUME LABEL file as
  78.         int     21h                     ;       you would any other new file
  79.         ret
  80.  
  81. SetNewVolumeLabel       ENDP
  82.                         END
  83.  
  84. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++