mov si, seg CurDir
mov ds, si
mov si, offset CurDir ;ds:si points to buffer to receive current dir
mov dl, Drive ;0 = default, 1 = A, 2 = B, etc.
mov ah, 47h ;Get Current Directory
int 21h
jc error_handler ;carry set means error
Get Current Directory (Function 47h) returns the path of the current directory on the specified drive.
CurDir
Points to a buffer where the current path on the specified drive is to be placed. The buffer should be large enough to contain the largest possible MS-DOS path (64 bytes).
Drive
Specifies the drive number (0 = default, 1 = A, 2 = B, etc.).
If the function is successful, the carry flag is clear and the CurDir buffer is filled in with the current default path on the specified drive. Otherwise, the carry flag is set and the AX register contains an error value, which may be 000Fh (ERROR_INVALID_DRIVE).
This function copies to the specified buffer a zero-terminated ASCII string that identifies the current directory. The string consists of one or more directory names separated by backslashes (\). The path string does not include the drive letter and does not start with a leading backslash.
Function 3Bh Change Current Directory