Printing memory in c
-
- Posts: 9
- Joined: Tue Jul 17, 2012 11:09 am
Printing memory in c
I've been reading through the babysteps tutorials; does anyone have an example c function that works similarly to the example in babystep 8?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Printing memory in c
Code: Select all
printf("%x", your_number_here);
-
- Posts: 9
- Joined: Tue Jul 17, 2012 11:09 am
Re: Printing memory in c
stdio.h isn't really available otherwise I would've thought of that.
Re: Printing memory in c
There are numerous possible solutions to this problem, depending on your situation:
1. I know assembly, but not C
- Learn C
2. I don't know assembly, but know C
- Learn assembly
3. I don't know either assembly or C
- Learn C and assembly
4. I know both assembly and C
- Think about the problem some more
1. I know assembly, but not C
- Learn C
2. I don't know assembly, but know C
- Learn assembly
3. I don't know either assembly or C
- Learn C and assembly
4. I know both assembly and C
- Think about the problem some more
-
- Posts: 9
- Joined: Tue Jul 17, 2012 11:09 am
Re: Printing memory in c
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. If the example was written in any higher level language I wouldn't have a problem. Giving stupid answers like that helps no one and makes you sound like a douche.
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: Printing memory in c
Yo:
Whom have you paid in here? Name one person on this forum you are paying, whether in cash or kind.
If you can't name anyone, then let it dawn on you that this is a special interest group kept together only by common interest, and it is highly vulnerable to decay due to proliferation of laziness. This special interest group has no funding or committee. If you don't like it, then don't use it. Don't call anyone here a douche. When you start paying me money, I'll give you detailed answers to supplement your lack of reading and preparedness.
You might have noticed by now that the key problem you have is that nobody is obliged to help you. Good job. Now work within the parameters given you, or seek some other source for help. Nobody here owes you anything...douche.
--Peace out
gravaera
Whom have you paid in here? Name one person on this forum you are paying, whether in cash or kind.
If you can't name anyone, then let it dawn on you that this is a special interest group kept together only by common interest, and it is highly vulnerable to decay due to proliferation of laziness. This special interest group has no funding or committee. If you don't like it, then don't use it. Don't call anyone here a douche. When you start paying me money, I'll give you detailed answers to supplement your lack of reading and preparedness.
You might have noticed by now that the key problem you have is that nobody is obliged to help you. Good job. Now work within the parameters given you, or seek some other source for help. Nobody here owes you anything...douche.
--Peace out
gravaera
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
-
- Posts: 9
- Joined: Tue Jul 17, 2012 11:09 am
Re: Printing memory in c
I didn't say he was a douche, I simply said that the rude way he replied made him sound like one and didn't help either of us. Obviously I'm not paying anyone in these forums and we all know that. But no one is. The point of forums such as these is to ask questions, to receive help, and to give help out of the goodness of your own heart, not for money. If this forum is full of people like you who think that they should only give helpful answers to people who pay them then maybe I'm wasting my time and the Internet is descending into anarchy (heh not like it hasn't already).
Re: Printing memory in c
You're right. But if you want a question answered, you first need to put in some work of your own.letrstotheprez wrote:The point of forums such as these is to ask questions, to receive help, and to give help out of the goodness of your own heart, not for money.
-
- Posts: 9
- Joined: Tue Jul 17, 2012 11:09 am
Re: Printing memory in c
Trust me, I spent time on it but apparently I need to include all of my failed attempts in my original question for people to not think I'm a useless idiot trying to copy other people's work.
Re: Printing memory in c
letrstotheprez, I think you dismissed combuster's answer too quickly. The answer, in c, is printf. If you don't have stdio.h available, you will need to port or write your own printf. It is the first step to success.
If a trainstation is where trains stop, what is a workstation ?
-
- Posts: 9
- Joined: Tue Jul 17, 2012 11:09 am
Re: Printing memory in c
Yes I know but doing that would still require being able to do this. I have a basic printing function but it currently doesn't do the format part of printf() which, to fully implement, I would need to know how to do what I'm asking. Obviously I want to learn something here or else I would just have copied down the asm exactly and complained when it wouldn't work perfectly with the functions I do have. (thanks for speaking reasonably)
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Printing memory in c
There's two other things that aren't apparently obvious:
- C doesn't do registers, only variables. You can't print a register's value without resorting to at least some assembly.
- There is an entire page about Printing To Screen, including number conversions and varargs.
- C doesn't do registers, only variables. You can't print a register's value without resorting to at least some assembly.
- There is an entire page about Printing To Screen, including number conversions and varargs.
-
- Posts: 9
- Joined: Tue Jul 17, 2012 11:09 am
Re: Printing memory in c
Thank you, that will definitely be helpful. I saw that page a while back but I guess I missed it in my search.
Re: Printing memory in c
No, it's not.letrstotheprez wrote:The point of forums such as these is to ask questions, to receive help
The purpose of this forum is to have a place where OS developers can talk about OS development. Nowhere is the word "help" mentioned on the front page. The use of the word "questions" in this section's description should not be taken as a statement of purpose for the site as a whole. Individual section descriptions are meant as a guide for separation of content into different sections. This question has nothing to do with OS development. It's like going to a Ferrari forum to get directions to the nearest Italian restaurant.
-
- Member
- Posts: 255
- Joined: Tue Jun 15, 2010 9:27 am
- Location: Flyover State, United States
- Contact:
Re: Printing memory in c
Frankly if you are doing OS development and C is your language of choice, you should know enough to be able to implement a user mode printf function.letrstotheprez wrote:Yes I know but doing that would still require being able to do this. I have a basic printing function but it currently doesn't do the format part of printf() which, to fully implement, I would need to know how to do what I'm asking. Obviously I want to learn something here or else I would just have copied down the asm exactly and complained when it wouldn't work perfectly with the functions I do have. (thanks for speaking reasonably)