// This source file contains the main algorithm for the Kernel.
// Written in C and written by Daniel Lopez

//Global variable, containing the pointer to the video memory.gcc 
volatile char* videomem = (volatile char*) 0xB800;
void print_string(int color, char* string)
{
	
	while(*string != 0)
	{
		*videomem = *string; // Assign each character to memory location 0xB800.
		*videomem++;	
		string++;
		*videomem = color;
		videomem++;
	}
	
}
int string_length(char* string) // This subroutine determines a string's length but not including the null terminating character.
{
	int length = 0;
	while(*string++)
	{
		length++;
	}
	return length;
}
void reverse_string(char* string, char* reversed_string) // This subroutine reverses a char array.
{
	int length = string_length(string) + 1;
	while(length == 0) // Loops until the length is equal to zero.
	{
		*reversed_string = string[length];
		length--;
		reversed_string++;
	}

}
dmain(void)
{
	print_string(8, "This is my first kernel!\n\nWelcome!");
}