Professional Documents
Culture Documents
.MODEL SMALL
.DATA
Fname db “myfile.txt”,0
Handle dw ?
Msg1 db ‘error’,’$’
Msg2 db ‘success’,’$’
Msg3 db ‘hello hi’,’$’
.CODE
start:
MOV AX,@DATA
MOV DS, AX
Mov cx,0
Mov dx,offset fname
Mov ah,3ch
Int 21h
Jc err
Mov handle,ax
Mov ah,09h
Mov dx,offset msg2
Int 21h
Mov bx,handle
Mov cx,09h
Lea dx,msg3
Mov ah,40h
Int 21h
Jmp k
Err:mov ah,09h
Lea dx, msg1
Int 21h
K:mov ah,4ch
Int 21h
END start
End
.MODEL SMALL
.DATA
Fname db “myfile.txt”,0
Handle dw ?
Msg3 db ‘hello hi’,’$’
.CODE
start:
MOV AX,@DATA
MOV DS, AX
Mov al,1
Mov dx,offset fname
Mov ah,3dh
Int 21h
Mov handle,ax
Mov bx,handle
Mov cx,09h
Lea dx,msg3
Mov ah,40h
Int 21h
mov ah,4ch
Int 21h
END start
End
Mov handle,ax
Mov bx,handle
Mov cx,09h
Mov dx,offset buff
Mov ah,3fh
Int 21h
mov ah,4ch
Int 21h
END start
End