title: I am trying to use a function in Assembly, but it wont work
body: <p>I am trying to make a basic OS with assembly. But this doesn't work. I don't know why. I'm a beginner by the way. The thing I want to do is to have print_string, use the function to print out boot_string.
  Code:</p>
  
  <pre><code>    BITS 16
  start:
      mov ax, 07C0h
      mov ax, 288
      mov ss, ax
      mov sp, 4096
  
      mov ax, 07C0h
      mov ds, ax
      mov si, text_string
      call print_string
      jmp $         ; INFINITE LOOP
  
  
  
  print_string:
      mov ax, boot_string
  .repeat:
      lodsb
      cmp al, 0
      je .done
      int 10h
      jmp .repeat
  .done:
      ret
  
  
  
      times 510-($-$$) db 0
      dw 0xAA55
  boot_string    db 'Starting Operating System...', 0
  </code></pre>
  
  <p>But when I compile this it gives this error;</p>
  
  <pre><code>nasm -f bin -o os.bin os.asm
  os.asm:13: error: symbol `text_string' undefined
  os.asm:19: error: label `print_string' changed during code generation [- 
  w+error=label-redef-late]
  os.asm:21: error: label `print_string.repeat' changed during code generation [- 
  w+error=label-redef-late]
  os.asm:28: error: label `print_string.done' changed during code generation [- 
  w+error=label-redef-late]
  make: *** [Makefile:2: nasm] Error 1
  </code></pre>
  
  <p>I would be really happy if anyone can help me solve this. And if you know any sites about OS development, please give the URL so I can check them as well ^_^</p>