Create DOS Subdirectory

From CometWiki

Revision as of 09:59, 13 June 2009 by Badge (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Create DOS Subdirectory (MKDIR)

Syntax:

DOSFC(AX-value, CX-value, subdirectory-name) EXCP=statement-label  

Entry:

 AX-value = "@3900@"
 CX-value = "@0000@"

Return:
If an exception occurs, byte 2 of the AX field will contain the DOS error code (in hex).

Discussion:
The DOSFC function call can be used to create a DOS subdirectory. This function requires that the AX-value be set to "@3900@", the CX-value be set to null, and the subdirectory-name contain the name of the new DOS subdirectory. After the DOSFC function is successfully executed, the new directory will exist. Note: The new directory does not automatically become the current directory. A different function call is required to make the new directory into the current directory. (See "Change Current DOS Subdirectory" above.)

Example:

 ! S SMKDIR,DSK
 ! O MKDIR,DSK
 ! L T00,E
 ! R QMONITOR
 !
 !==========  CREATE DOS SUBDIRECTORY (MKDIR) ====================
 !
 LENGTH 2 & LOCAL AX$,BX$,CX$,DX$        ! Define registers
 LENGTH 64 & LOCAL DIRECTORY$            ! Define directory name
 !
 LENGTH  3 & LOCAL DOSCODE$              ! Define DOS error code
 LENGTH 37 & LOCAL DOSMESSAGE$           ! Define DOS message
 !
 1000 FORMAT DOSMESSAGE$                 ! File input format
 !
 100 FORMAT (ET)                         ! Screen format
 !
 CLEAR                                   ! Initialize variables
 PRINT (0,100)                           ! Set typewriter mode
 !
 PRINT (0) "ENTER DIRECTORY NAME:"       ! Display prompt
 INPUT (0) DIRECTORY$                    ! Enter directory name
 IF DIRECTORY$ = "" THEN RUN "QMONITOR"  ! If null, then stop
 !
 AX$ = "@3900@"                          ! Set AX to "MAKE DIREC."
 CX$ = "@0000@"                          ! Set CX register to null
 !
 DOSFC(AX$,CX$,DIRECTORY$) EXCP=EXCEPTION  ! Perform DOSFC call
 !
 PRINT (0) DIRECTORY$;" CREATED SUCCESSFULLY."
 INPUT (0) ""
 RUN "QMONITOR"
 !
 EXCEPTION:                              ! Exception routine
 PRINT (0) "DIRECTORY NOT CREATED."      ! Display message
 OPEN (1) "QERCOMET"                     ! Open error file
 DOSCODE$ = "D" + HEXASC(SUB(AX$,2,1))   ! Construct key to file
 READ (1,1000) KEY=DOSCODE$              ! Read error record
 PRINT (0) "DOS error code: ";DOSCODE$   ! Display DOS error code
 PRINT (0) DOSMESSAGE$                   ! Display error message
 INPUT (0) ""                            ! Hold
 CLOSE (1)                               ! Close error file
 RUN "QMONITOR"                          ! Exit
 END
Personal tools