title: x86 assembly directly write to VGA simple OS
body: <p>I made simple code, that should write to VGA memory.</p>
  
  <pre><code>org 07c00h
    mov eax,0xb8000
    mov bx,msg
    call printstr
  printstr:
  
  
    mov al,byte[bx]
    mov byte[eax],al
    inc eax
    mov byte[eax],1
    inc eax
    inc bx
    cmp byte[bx],0
    je end
    jmp printstr
  
  end:
    jmp end
  msg: db "Hello world!",0
  times 510-($-$$) db 0
  dw 0xaa55
  </code></pre>
  
  <p>But instead of writing "Hello world" it does this when i run it in QEMU.
  I assembled that using NASM.
  <a href="http://2imgs.com/cbd3f2d80b" rel="nofollow">Image</a></p>
  
  <p>I want to overwrite first 12 chars at first line with "Hello world!".</p>
  
  <p>Does anybody know why its giving me this result?</p>