qa.hlp (Table of Contents; Topic list)
GetCurDir
   Example  Back  Contents  Index
──────────────────────────────────────────────────────────────────────────────
 
;* GetCurDir - Gets the current directory of default drive.
;*
;* Shows:   DOS Function - 47h (Get Current Directory)
;*
;* Params:  spec - Pointer to 64-byte buffer to receive directory
;*          path. Path terminates with 0 but does not include
;*          drive and does not begin with backslash.
;*
;* Return:  Short integer with error code
;*          0 if successful
;*          1 if delete error or subdirectory not empty
 
GetCurDir PROC \
        USES ds si, \
        spec:PTR BYTE
 
        LoadPtr ds, si, spec            ; DS:SI = spec address
        mov     ah, 47h                 ; AH = function number
        sub     dl, dl                  ; DL = current drive (0)
        int     21h                     ; Get Current Directory
        mov     ax, 0                   ; Set error code, keep flags
        jnc     exit                    ; Exit if successful
        inc     ax                      ; Else set error code to 1
exit:   ret
 
GetCurDir ENDP
                                    -♦-