title: Problems with outputting newline characters to a file
body: <p>I am writing a <em>DOS</em> program to make a file and write into it. I have to write the data in two different lines. Here is my code:</p>
  
  <pre><code>.model tiny
  .486
  .data
  
  fname db 'file5.txt',0
  handle dw ?
  msg db 'Prashant Pandey 2014A7PS100G'
  
  .code
  .startup
  mov ah,3eh
  mov bx,handle
  int 21h
  
  mov ah,3ch      ;the 4 lines from now open an new non-existing.3ch is used to open a new file
  lea dx,fname
  mov cl,2h
  int 21h
  mov handle,ax
  
  mov ah,40h      ;these 4 lines write to the already opened file
  mov bx,handle
  mov cx,28h
  lea dx,msg
  int 21h
  
  ; new line
  mov dx,13
  mov ah,2
  int 21h  
  mov dx,10
  mov ah,2
  int 21h
  
  mov ah,40h      ;these 4 lines write to the already opened file
  mov bx,handle
  mov cx,28h
  lea dx,msg
  int 21h 
  
  mov ah,3eh
  mov bx,handle
  int 21h
  
  .exit
  end
  </code></pre>
  
  <p>I am using <em>MASM</em> and <em>DOSBOX</em>. The problem is although the program prints the data in two different lines, but before the 2nd line, it also prints some weird characters and then prints the string msg. What is wrong with this program, and how can I fix it?</p>