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

Tuesday, September 24, 2013

AMP Program No.6



Write an assignment on file function 43H (Set/Get file attribute) and 57h(set/get date and time) of DOS INT 21H and program to display the attributes.

Function 43H : Set/Get file attribute
With the help of this function we are able to set or get the file attributes
For its occurrence AH must be preloaded by 43H
The value of AL must be loaded according to our requirement:
If             AL = 0; get attribute
                AL = 1; set attribute
CX register must be loaded with the new attribute values
The file name must be pointed by DS : DX

Function 57h: Set/Get date and time

With the help of this function, we are able to set/get the creation date and time.
for its occurrence AH must be preloaded by 57h


The value of AL must be loaded according to our requirement:
If             AL = 0; get date and time
                AL = 1; set date and time

After successful execution, CX will contain the time and DX will contain the date

the time format is as follows:
bits (15-11) = hours
bits (10-5) = minutes
bits (4-0) = seconds

the date format is as follows:
bits (15-9) = year after 1980
bits (8-5) = month
bits (0-4) = date

Monday, September 23, 2013

AMP program No.7



Write an assignment on directory functions 39H (Create directory), 3AH (Delete directory) of DOS  INT  21H  and  program  to  simulate  MD  (Make  directory),  RD  (Remove  Directory) commands.

theory:


A directory is actually a folder which we create in our drives
A hierarchical structure is a one which consists of sub directories within directories
The root directory (main directory) contains files and other directories.
The work directory further contains directories and files.

Hence to access any file or sub directory we need to specify the particular path.




Function 39H: Create directory
This function is used to create a subdirectory in the current directory or a root directory in the particular drive.
Eg: when we give the path in the program as \ubaid, it will create a root directory in drive C.
Eg: when we give the path in the program C :\tasm\bin\ubaid, it will create a subdirectory in directory bin
For its occurrence AH must be loaded with 39H
The path must be pointed by DS : DX


Function 3AH : Delete directory
This function is used to delete a directory (root or subdirectory)
For its occurrence AH must be loaded with value 3AH
The directory name must be pointed with DS : DX
The directory must be empty for this function to complete successfully
If deleted successfully:
Carry flag = clear ; else

Carry flag = set ; AX = error code