title: Run C program after bootloader
body: <p>I'm building a simple kernel for future tests applications, like MEMTEST and others.</p>
  
  <p>So, what I have right now is the bootloader.
  What i need to do is load another file that I'll compile put in the second sector of the floppy disk and then run.</p>
  
  <p>So, how can I load the rest of the floppy into RAM and then run?</p>
  
  <p>You don't need to be 100% accurate, I just need to know and learn the necessary interrupts and "functions" to do that I need :)</p>
  
  <p>just to share the bootloader:</p>
  
  <pre><code>[BITS 16] ;set 16bit mode
  [ORG 0x7C00] ; address location where the program will run
  
  jmp main ;start on main
  
  main:
      mov si,hstr ; put the pointer into si register
      call printstr ;print hstr
  
      ;call load_kernel
      ;here we gonna load kernel into memory and then we will run it.
  
      mov si,mstr ; put the pointer into si register
      call printstr ;print mstr
      jmp hold ;idle the CPU
  
  
  hold:
      hlt ;idle CPU
  
  printstr:
      ;This will write in TTY char that will be loaded into al 8bit register.
      lodsb ;load into al
      cmp al,0 ; set flag if al is 0
      jnz print ; if isnt equal to 0 then jump to print
      ret ;else return to main
  print: ;print the char
      mov ah,0x0E ;set the ah before calling the video interrupt
      int 10h ;here we go
      jmp printstr ;jump back
      ;
  
  hstr db "Loading ...",13,10,0 ;define the strings. 13 is ASCII, 10 for new line, 0 is the null terminator
  mstr db "CPU is now idle!",13,10,0
  
  times 510 - ($-$$) db 0 ;fill the rest of the sector(less 2 last bytes) with 0's. 510-(here-start)=free space with 0's
  dw 0xAA55               ;the last 2 bytes of the sector with AA55 signature. means that is the bootloader.
  </code></pre>