Wednesday, September 25, 2013

AMP Program No.8



Write  an  assignment   on  directory  functions  3BH  (Change  Directory),  47H(Get  current directory)  of  DOS  INT  21Hand  program  to  simulate  CD  (Change   directory)   and  PWD (Present Working Directory)  commands. 

Function 3BH : Change  Directory/Set current directory
This function is used to  change the directory in which we are working.
But before we change our directory the subdirectory should be created, else error will occur.
AH register must be preloaded with 3bh, the path must be pointed by DS : DX registers.
Eg: If we give the path C:\TASM\BIN\ABC in our program and we are currently working in C:\tasm\bin, the path will be changed as above.
Eg: If we try to give a root directory such as C:\abc and abc is a directory created in C drive the path will be changed and C:\abc will be displayed on dos screen.
If the function is successful:
Carry flag = clear; else
Carry flag = set ; AX = error code

Function 47H : Get  current directory
With the help of this function the path is returned in which we are working
The path is returned in a buffer which needs to be created in data segment
Eg: On execution of above function TASM\BIN is returned in the buffer, if we are currently working in C:\TASM\BIN
AH register must be preloaded with 47h, DL must be loaded with drive number (always 0 for default directory)
If function is successful:
Carry flag = clear ; else
Carry flag = set ; AX = error code

No comments:

Post a Comment