Page 2 of 2
Re: Printing memory in c
Posted: Tue Jul 17, 2012 6:20 pm
by letrstotheprez
Or I'm doing os development because it's fun and I want a challenge to help me learn even faster.
Re: Printing memory in c
Posted: Tue Jul 17, 2012 9:41 pm
by Tosi
letrstotheprez wrote:Or I'm doing os development because it's fun and I want a challenge to help me learn even faster.
If OS dev. is one of your first projects then you are going to run into some big trouble sooner or later as I did when I first started.
If you just want to know how to write formatted output, then there is no reason to go through all the pain of writing even a basic kernel to do it, just write a function that uses putchar or puts to write the information once you've formatted. Then it can run in user-mode where it is much easier to debug.
Re: Printing memory in c
Posted: Tue Jul 17, 2012 11:56 pm
by Antti
letrstotheprez wrote:I've been reading through the babysteps tutorials; does anyone have an example c function that works similarly to the example in
babystep 8?
This post is not an actual answer to you question but I would like to introduce an approach that might help you with this. This also applies to the low-level programming in general.
Try to learn to visualize how basic
C code snippets usually get translated to the assembly (for example, gcc with -S switch is quite handy). After doing that for a while, you will have a good understanding what is the relation between C and the assembly. That helps really much.
letrstotheprez wrote:I know both but assembly is still new enough to me that it's hard to translate it to c because they're so vastly different.
They are different language, of course, but I think that they are not vastly different. They are both rather low-level.
Dennis Ritchie wrote:[C has] the power of assembly language and the convenience of ... assembly language.
Re: Printing memory in c
Posted: Wed Jul 18, 2012 2:46 pm
by letrstotheprez
I'm looking much farther into printf() now and deciding how I plan to implement it.
I know I'm going to run into challenges with this project but I'm hoping that I will because I enjoy them. This is the reason why I like programming; it gives me an opportunity to work through problems and forces me to learn a lot as I go.
Re: Printing memory in c
Posted: Wed Jul 18, 2012 2:53 pm
by iansjack
Here you go:
http://www.sparetimelabs.com/tinyprintf/index.html. It took about 30 seconds on Google to find that.
Google is a great resource; learn to use it wisely and you will have all the answers. And if it takes a little longer than 30 seconds you'll probably learn a great deal more than you intended. If you want to be at all successful in OS development you are going to learn how to do simple research - else, how are you going to do the hard stuff?