mov dx, seg Dir
mov ds, dx
mov dx, offset Dir ;ds:dx points to name of new directory
mov ah, 3Bh ;Change Current Directory
int 21h
jc error_handler ;carry set means error
Change Current Directory (Function 3Bh) changes the current directory to a specified path.
Dir
Points to a zero-terminated ASCII string that specifies the new current directory. This string must be a valid MS-DOS directory name and cannot contain wildcards.
If a drive other than the default drive is specified as part of the new directory path, this function changes the current directory on that drive but does not change the default drive. Set Default Drive (Function 0Eh) can be used to change the default drive.
If the function is successful, the carry flag is clear. Otherwise, the carry flag is set and the AX register contains an error value, which may be 0003h (ERROR_PATH_NOT_FOUND).
Function 0Eh Set Default Drive
Function 47h Get Current Directory