title: How to print strings using bios interrupts
body: <p>I am working on an assigment on creating an operating system using some assembly functions and 16 bit C compiler. My task is to print strings on screen using 0x10 interrupt. Since interrupts can be called in assembly file, I have been provided with an assembly file which contains a function called interrupt which takes five arguments : the interrupt number, and the interrupt parameters passed in the <code>AX</code>, <code>BX</code>, <code>CX</code>, and <code>DX</code>. 
  For example, to print 'Q' with the provided function, I need to write like this:</p>
  
  <pre><code>char al = 'Q'
  char ah = 0xE
  int ax = ah*256+al;
  interrupt(0x10,ax,0,0,0);
  </code></pre>
  
  <p>OR, simply:</p>
  
  <pre><code>interrupt(0x10,0xE*256+'Q',0,0,0);
  </code></pre>
  
  <p>in a <em>C</em> program called <code>kernel.c</code></p>
  
  <p>My task is to write a function <code>printString(char *chars)</code> in <em>C</em> which takes a string and prints it on screen using the discussed assembly function. </p>
  
  <p>I have done it this way: </p>
  
  <pre><code>void printString(char * chars){
  int i = 0; 
  int l = length(chars);
   for(; i &lt; l; i++){
     interrupt(0x10,0xE*256+chars[i],0,0,0);
   }
  }
  </code></pre>
  
  <p>but it prints the string multiple times instead of printing one time.
  when I try to print "Hello World", it's printed 11 times, because it contains 11 characters, same is the case with other strings.</p>