title: Segmentation fault assembly
body: <p>I am getting a segmentation fault for the following assembly code which simply prints out a message though the printing is handled by a separate function so I'm quite sure I'm not allocating the right space on the stack for the message and the length.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>section .data
      print_msg:      DB "H", 10, 0
      len:            equ $-print_msg 
      print_msg2:     DB "BYE WORLD", 10, 0
      len2:           equ $-print_msg2
  
  
  section .text
  
      global main
  
  main:
      push ebp
      mov ebp, esp
  
      push DWORD len
      push print_msg
      call _write
  
      push DWORD len2
      push print_msg2
      call _write
  
      leave
      ret
  
  _write:
      push ebp
      mov ebp, esp   
  
      push ebx
      mov eax, 4
      mov ebx, 1
      mov ecx, [ebp+8]
      mov edx, [ebp+12]
      int 80h
      pop ebx
  
      leave 
      ret
  </code></pre>