Wednesday 28 September 2011


BIOS/DOS CALLS – FILE MANIPULATION
AIM:
To open a file using DOS calls.
ALGORITHM:
1.      Initialize the data segment, file name and the message to be displayed.
2.      Set the file attribute to create a file using a DOS call.
3.      If the file is unable t o create a file display the message 
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
FILENAME DB “SAMPLE.DAT”, “$”
MSG DB 0DH, 0AH, “FILE NOT CREATED”, ODH, OAH, “$”
DATA ENDS
CODE SEGMENT
START:          MOV AX, DATA
                        MOV DS, AX
                        MOV DX, OFFSET FILENAME
                        MOV CX, 00H
                        MOV AH, 3CH
                        INT 21H
                        JNC LOOP1
                        MOV AX, DATA
                        MOV DS, AX
                        MOV DX, OFFSET MSG
                        MOV AH, 09H
                        INT 21H
LOOP1           MOV AH, 4CH
                        INT 21H
CODE ENDS
END START
RESULT:
    Thus the file manipulation using DOS calls is written and executed.

0 comments:

Post a Comment