A hand made printf()
So, today didn't go exactly as I planned ( I had hoped to reach the Memory Management section today ), but still there is some progress.
So today was the day I got to implement my own custom "printf()" function. Yay! Even though the function is absolutely shitty, it does what it should, print a string to the screen.
There were two ways to proceed, I naturally went for the simpler one [ Not that I am afraid :) ]. So, to print a character on the screen, we have to use what is called the "FRAMEBUFFER".
It is basically a memory address, where we can write data and that is displayed on the screen. Umm, that's basically it. I just created a function that takes in the index of where to write on framebuffer ( 1st char, 2nd char etc. ), and with character, we can set it's foreground and background color too.
Then I created another print method, that takes in a "char*" that is a string ( shh! C doesn't have the concept of string yet ), and the length of that string. Then it calls the above mentioned code for each character.
That may seem like very little work ( It was not ), Still it is not the progress I would have wanted.
No worries, Let's hit it tomorrow, because for now, GTA calls.
Comments
Post a Comment