Professional Documents
Culture Documents
SATYARAJ RANJAN
REG. NO – 19BCB0140
Solution :-
AIM:- To create a file and store data of size 16 bytes using emu8086.
PROCEDURE:-
1. START
2. First Initialize all models and stack.
3. In the Data Segment initialize filename as ‘19BCE0059_DA5.txt’. 4.
Initialize a variable ‘filehandle’ that will store the location of the file.
5. Initialize a msg to be displayed to “Enter the Data” and a buffer to
store 16 bytes of Data (the data to be written in the file).
6. Create a New file by using the Service no. 3CH .
7. Store the offset address of the fname into DX
8. Use interrupt 21H.
9. Address of File which is stored in the AX is moved to ‘fhandle’.
10. Display the message in the emulator screen and enter the Data
to write in the TXT file.
11. The message is stored in the buffer and the address is incremented
using si register.
12. Close the file.
13. Exit
14. END
CODE :-
.model small
.stack 100h
.data
fname db '19BCB0140_DA5.txt',0
fhandle dw ?
msg db 'Enter the Data: $'
buffer db 16 dup('$')
.code
main proc
mov ax,@data
mov ds, ax
fhandle,ax
;Display Msg
lea dx,msg
mov ah,09h
int 21h
mov si,0
mov cx,0
again:
mov ah,01h
int 21h
cmp al,13
je exit
mov
buffer[si],al inc
si
inc cx
jmp again
exit:
;Close a file
mov ah,3eh
mov bx,fhandle
int 21h
;EXIT
mov ah,4ch
int 21h
main endp
end main
OUTPUT :-
After Taking Input from The User :-