.model small .code org 100h start: mov ah, 3ch mov cx, 0 mov dx, offset fname2 int 21h mov di, offset handle2 mov [di], ax mov ax, 3d00h mov dx, offset fname int 21h mov di, offset handle mov [di], ax mov ah, 3fh mov bx, [di] mov cx, 500 mov dx, offset string int 21h mov cx, ax mov si, cx mov word ptr string[si], 0A0Dh mov di, 2 sub cx, 2 reading: mov si, cx cmp word ptr string[si], 0A0Dh je lineend jmp normal lineend: mov ah, 40h mov si, offset handle2 mov bx, [si] mov si, cx PUSH cx mov cx, di mov dx, offset string add dx, si add dx, 2 int 21h POP cx mov di, 0 normal: inc di loop reading ;------------------------------ mov ah, 40h mov si, offset handle2 mov bx, [si] mov si, cx mov cx, di add cx, 2 mov dx, offset string add dx, si int 21h mov ah, 3eh mov di, offset handle mov bx, [di] int 21h mov ah, 3eh mov di, offset handle2 mov bx, [di] int 21h int 20h fname db 'inp.txt',0 fname2 db 'out.txt',0 handle dw ? handle2 dw ? cool dw 0A0Dh string db 501 dup (?) end start