#include "stdint.h"

uint16_t *cposition = (uint16_t*) 0xB8000; //current position in text memory
uint32_t i;

void clrscrn()//clear the screen
{
   uchar_t *texmem = (uchar_t*)0xB8000;
   for(i = 0,i<0xBFFFF,i++;)
{
     *texmem = 0x20;
     texmem++;
   };
   cposition = 0xB8000;
   return; 
};

void bprint(uchar_t color,uchar_t *string)//print function that allows you to choose the color of your text "string is the chars to be printed
{
  uchar_t *texmem = (uchar_t*)cposition;//textmode video memory
for(i = 1, i<sizeof(string),i++;)
{
  *texmem = color;
  texmem++;
  cposition++;
  if(cposition>0xBFFF)//if we are not writing to video memory clear the screen and jump back to begining
  {
     clrscrn();//clear the screen and reset video memory
  }
};
  return;
};



void outb(uchar_t in, uint16_t outp)//output byte to port
{
	asm("outb %%al,%%dx"
	    : /*none to pass*/
	    :"a" (in),"d" (outp));
	return;
};

uint16_t inb(uint16_t inp)//input byte from port
{
   uchar_t ret;
   asm("inb %%dx,%%al" : : "d" (inp), "a" (ret));
   return ret;
}; 
