title: NASM - error: label or instruction expected at start of line
body: <p>I haven't written assembly code since Debug in MS-DOS 3.31 so <em>NASM</em> and the concept of using labels as variables in machine code is completely new to me. I'm using Visual Studio 2015 with Asmdude syntax highlighter. I'm using <em>NASM</em> version <code>2.12.01 compiled on Mar 17 2016</code></p>
  
  <p>I'm currently reading a PDF on operating system development called <a href="https://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf" rel="nofollow">Writing a Simple Operating System from Scratch</a>. I'm following one of the examples and I can't get the example to assemble. </p>
  
  <p>Please forgive the antiquated code structure, I find it easier to read this way.</p>
  
  <pre><code>                    [BITS 16]
                      [ORG 0x7C00]
                      MOV BP, 0x8000 ; Set the base of the stack a little above where BIOS
                      MOV SP, BP ; loads our boot sector - so it won 't overwrite us.
  ProgramOrigin:      MOV BX, StartText ; Put startup text into BX
                      CALL PrintString ;Call PrintString Function
                      JMP EndProgram ;Continue to end of program
  PrintString:        PUSHA ; Push all registers onto stack 
                      MOV AH, 0x0E ; BIOS Teletype
  NextChar:           MOV AL, [BX] ; Move the contents of memory segment at address in BX into AL
                      CMP AL, 0x00 ; if (AL == 00) it is the end of the string
                      JE EndPrint ; End function
                      INT 0x10 ;Interrupt to print character to screen
                      ADD BX, 1 ;ELSE increment address in BX
                      JMP nextChar ;Repeat
  EndPrint:           POPA ;Return original Register values 
                      RET ;Return from function
  StartText:          DB 'Kernel v0.01', 0x00
  errText:            DB 'Error', 0x00
  notFoundText:       DB 'Not Found', 0x00
  EndProgram:         times 510 -($-$$) DB 0
                      DW 0xAA55
  </code></pre>
  
  <p>I did add some of my own code for the PrintString function, but I think I did that correctly because it worked in debug on my DOS VM</p>