Create a new file using assembly programming.


Write a program to create a file assembly program.

 Write a assembly program to create a file.

 Create a new file using assembly programming.

Program:-

;create file

printstring macro msg

mov ah,09h

mov dx,offset msg

int 21h

endm

data segment

imsg db 13,10,"Enter name of the file to create:$"

smsg db 13,10," !! File created Success  $"

fmsg db 13,10," !! File creation Faliure !!$"

dname db 20 dup(0)

data ends

 code segment

assume cs:code,ds:data

 start:

mov ax,data

mov ds,ax

printstring imsg

mov si,offset dname
ri:

 mov ah,1

int 21h

cmp al,13

je crd

mov [si],al

inc si

jmp ri

 

crd:

 mov ah,3ch

 mov cx,00h

 mov dx,offset dname

 int 21h

jnc succ

printstring fmsg

jmp exit

succ:printstring smsg

exit:

mov ah,4ch

int 21h

code ends

end start

No comments:

Post a Comment