.model small
.stack
.data
buffer db "I'm writing.",'$'
file db "myfile.txt",0
.code
mov ax,@data
mov ds,ax
mov dx, offset file
;mov al,0 ;Open file (read-Only)
mov al,1 ; Write only
;mov al,2 ; Read & Write
mov ah,3dh ; Load File handler and store in ax
int 21h
mov cx,10 ; no. of bytes to be written. I want only first 10 bytes to be written in my already created file
mov bx,ax ; Move file Handler to bx
mov dx,offset buffer ; load offset of string which is to be written to file
mov ah,40h
int 21h
mov ah,4ch
int 21h
end
.stack
.data
buffer db "I'm writing.",'$'
file db "myfile.txt",0
.code
mov ax,@data
mov ds,ax
mov dx, offset file
;mov al,0 ;Open file (read-Only)
mov al,1 ; Write only
;mov al,2 ; Read & Write
mov ah,3dh ; Load File handler and store in ax
int 21h
mov cx,10 ; no. of bytes to be written. I want only first 10 bytes to be written in my already created file
mov bx,ax ; Move file Handler to bx
mov dx,offset buffer ; load offset of string which is to be written to file
mov ah,40h
int 21h
mov ah,4ch
int 21h
end
No comments:
Post a Comment