title: Unable to read a sector using int13H using custom Bootloader
body: <p>Recently i was learning x86 assembly and for practice decided to roll up my own Boot loader. Before working with int13H in the bootloader itself i decided to give a try on reading a sector ( logical 19) on floppy disk. But unfortunately after writing down the code and running it on QEMU no data was loaded  itself. I guess i might be wrong somewhere . Here is my code .</p>
  
  <pre><code>read_sector:
      mov     ah,02H                  ; Function code to Read Sector
      mov     al,01                   ; Read one sector
      lea     bx,[SECTOR]             ; Address of input buffer
      mov     ch,00                   ; Track 0
      mov     cl,02                   ; Sector 1
      mov     dh,01                   ; Head number 1
      mov     dl,00                   ; Drive Number ( 0 - Floppy)
      int     13H                     ; call the routine
      mov     ah,0EH
      add     al,48
      int     10H
      ret
  </code></pre>
  
  <p>To make things clear i am actually reading:</p>
  
  <p>Logical sector 19:
  Track- 0
  Head -1 
  Sector- 2</p>
  
  <p>In the code SECTOR represents a label using which i get access to write as well as read the input data from sector.</p>
  
  <p>My print function ( Pretty basic) code:</p>
  
  <pre><code>print:
  
      mov al,03H
      int 10H
      .repeat:
          lodsb
          mov ah,0EH
          cmp al,0
          je  .done
          int  10H
          jmp .repeat     
      .done:
          ret
  </code></pre>
  
  <p>Sorry for the  minor things left in the code  :(</p>
  
  <p>Regarding calling this function and accessing(printing) the data here is the code.</p>
  
  <pre><code>    call    read_sector 
      mov     si,[SECTOR]
  </code></pre>
  
  <p>But running it shows nothing on the screen . I also referred to the Ralf Brown files and checked out everything on ( int 13H fun:02H). i also checked the return code in ax and carry flag and the carry flag was set indicating a successful read. With no other sources in my mind the first place to refer was stack overflow. I would be extremely thankful if anyone helps me out. </p>