Wednesday, August 28, 2013

AMP Program No. 4



To develop an assembly language program of DOS INT 21H using function 3CH (create file)

     The  DOS provides two methods of file handling:
  1. FCB(file control block)
  2. Handle functions
     Handle functions support hierarchical file structure
     When the program wishes to open or create a file using handle functions it passes the address of the string specifying the file to MS – DOS.

     Function 3Ch : create file 
This interrupt creates a new file in the designated or default directory on the designated or default disk drive.
For its occurrence AH must be loaded with 3Ch
It returns a handle* into the AX register, which can be used by the program for subsequent access to the file
The following registers are also used while creating a file(see details on pg. 22)
* A handle is a 16 bit number assigned by DOS when a file is created or opened which uniquely identifies the file.


AH = 3Ch
CX = file attribute bits
                00 = normal
                01 = read only
                02 = hidden file
                03 = system file
                DS:DX = segment : offset of file name
     If function is successful
Carry flag = clear
AX = handle
     If function failed
Carry flag = set
AX = error code