User:Pancakes

From OSDev Wiki
Jump to: navigation, search

About Me

I like pancakes, bacon, butter, and syrup.

I like X86/X64 but they can be really complex, and a lot of their stuff is pages and pages deep and you know something fresh and new is always great. So I spend most of my time messing with stuff like ARM, MIPS (even if it is possibly dieing), or anything else. I recommend the book See Mips Run by Dominic Sweetman. Its a very good book about MIPS or really any RISC processor.

Some people may think (or would think if they knew, LOL) - "Why does he spend all this time throwing away information instead of stuffing it into some book and selling it to people". Well, I used to be just like a lot of you. Not all, because some of you are better than me. But, a many of you are just like I was almost 10 years ago. And, some legendary people who's names are to be forever etched into history gave me the knowledge through tutorials, documentation, and examples to write or even attempt to write system level software. Of, course I did not say their names would be remembered only etched into history. For you see no one may ever remember your contributions to the world, but they can never remove them no matter how hard they try. Because, with out them the time of present just would not be but instead something entirely different. I guess what I am trying to say is:

There are things in life you will do in order to help others even though you understand you may never be repaid for. A sacrifice if you will to others in return for the sacrifice someone made to you. --
"The greatest tyrannies are always perpetrated in the name of the noblest causes." -- Thomas Paine
"In the beginning of a change the patriot is a scarce man, and brave, and hated and scorned. When his cause succeeds, the timid join him, for then it costs nothing to be a patriot." -- Mark Twain
 ba45bc7b0f89aa3cb066fa8f3f4418ed
 19a33e4c4e76fb9a6feb164b430e421e
 626bfb3ff730aad32c329e0cbf90a14d
 7dfc957b5e001d216c1e23b9f1960c43
 68eca342c5d4beae1093962e6f115404
 34f872fcf7e34d303e020d639f8502ca
 21b1175165faec502ffca0cfa37ca8b2
 6bd05e4815a826eb78af229cdf3d51eb

Pages Under My Namespace

Pages

Printf Debugging Tool

Instead of banging your head trying to get it figured out. You can instead spend more time on figuring other things out. You need a implementation of putc for characters and puts for strings. Also just do the #include <stdarg.h> if you get compiler complaints about vararg structures.

/*
    Leonard Kevin McGuire Jr (www.kmcg3413.net) ([email protected])

    This code is so simple that there is NO reason to add some legal
    wording for copying. Just copy and paste it all you like.
*/

const char *itoh_map = "0123456789ABCDEF";

char* itoh(int i, char *buf)
{
	int		n;
	int		b;
	int		z;
	int		s;
	
	if (sizeof(void*) == 4)
		s = 8;
	if (sizeof(void*) == 8)
		s = 16;
	
	for (z = 0, n = (s - 1); n > -1; --n)
	{
		b = (i >> (n * 4)) & 0xf;
		buf[z] = itoh_map[b];
		++z;
	}
	buf[z] = 0;
	return buf;
}


void kprintf(const char *fmt, ...)
{
	const char 	*p;
	va_list 	argp;
	int 		i;
	char 		*s;
	char 		fmtbuf[256];

	va_start(argp, fmt);

	for(p = fmt; *p != '\0'; p++)
	{
		//kputc('w');
		if(*p != '%')
		{
			kputc(*p);
			continue;
		}

		switch(*++p)
			{
			case 'c':
				i = va_arg(argp, int);
				kputc(i);
				break;
			case 's':
				s = va_arg(argp, char *);
				kputs(s);
				break;
			case 'x':
				i = va_arg(argp, int);
				s = itoh(i, fmtbuf);
				kputs(s);
				break;
			case '%':
				kputc('%');
				break;
		}
	}
	va_end(argp);
}
Personal tools
Namespaces
Variants
Actions
Navigation
About
Toolbox