Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
GetCurDir
 Map                                       Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
;* 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:PBYTE
 
        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
        .IF     carry?
        inc     ax                      ; Set error code to 1
        .ENDIF
        ret
 
GetCurDir ENDP
                                    -♦-