.model small
.code
org 100h
start:	
	mov ah, 0ah
	mov dx,	offset smax
	int 21h	
	mov bx,	offset sreal
	mov bl, byte ptr [bx]
	mov bh,	0
	mov filename[bx],0
	mov ax,	03d00h
	mov dx,	offset filename
	int 21h
	jc error
	mov di,	1
	mov bx,	ax
	mov cx, 1
	mov dx,	offset char
loop1:	mov ah,	3fh
	int 21h
	cmp ax, 0
	je fileend
	cmp char, 0dh
	jne loop1
	inc di
	jmp loop1
fileend:
	mov ah,	3eh
	int 21h		
; Int 2 Str
	mov ax, di
	mov si,	4
	mov di, 2
	mov cx,	10000
	mov word ptr numlines[0], 0D0Ah

loop2:	xor dx,	dx
	div cx
	cmp al,	0
	je dbad	

	add al, '0'
	mov numlines[di], al
	inc di
	
dbad:	PUSH dx
	mov ax,	cx
	mov bx,	10
	xor dx,	dx
	div bx
	mov cx, ax
	POP ax
	dec si
	jne loop2
;			
	add al, '0'
	mov numlines[di], al
	inc di
	mov word ptr numlines[di], 0D0Ah
	mov numlines[di+2], '$'

	mov ah, 09h
	mov dx, offset numlines
	int 21h

error:
  	int 20h
char		db ?
smax		db 13
sreal		db ?
filename	db 14 dup (?)
numlines	db 10 dup (?) 
end start