Now On My Playground

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Locked
User avatar
Nathan
Member
Member
Posts: 201
Joined: Sun Jul 19, 2009 1:48 pm
Location: Brazil
Contact:

Now On My Playground

Post by Nathan »

Hello,
If you see my post history, i was learning Assembly and trying to develop an OS, then i remember that Linux(That i use) was developed in C, but i know C++, then i want to know how i can build a boot loader, that boots a compiled C++ source code and the second thing is: You can post the code of a Hello World OS in C++, just for use as template, after i will be as my own, and stop asking stupid questions only because i don't know the basics of Assembly. A normal Hello World is here:

Code: Select all

#include <iostream>
using namespace std;

int main() {
   cout << "Hello, World";
  return 0;
}
How i can do this code, but for an OS, not to run in an OS, but to be an OS.

Thanks,
Nathan Paulino Campos
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Now On My Playground

Post by pcmattman »

C++ and C++ Bare Bones.

Oh, and Beginner Mistakes.

Basically, you can't use cout (or any static object for that matter) without writing it all - support code, and the classes themselves - yourself.
User avatar
Nathan
Member
Member
Posts: 201
Joined: Sun Jul 19, 2009 1:48 pm
Location: Brazil
Contact:

Re: Now On My Playground

Post by Nathan »

Thanks pcmattman, but you can post the code of a simple Hello World OS?

Thanks!
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Now On My Playground

Post by pcmattman »

No, I can't. You can actually try learning and perhaps even do it yourself, rather than copying and pasting code from other people.
User avatar
Nathan
Member
Member
Posts: 201
Joined: Sun Jul 19, 2009 1:48 pm
Location: Brazil
Contact:

Re: Now On My Playground

Post by Nathan »

I just want the code of a Hello World OS, because i know C++ for Linux and Windows, copy, move, merge and my own interpreter, this is one of the things that i developed.

Thanks!
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Now On My Playground

Post by pcmattman »

If you really know C++ you shouldn't have a problem in taking a day or two to step back, learn a little, and then build it yourself. You've got all the time in the world, why rush the most important steps of this project?
User avatar
xvedejas
Member
Member
Posts: 168
Joined: Thu Jun 04, 2009 5:01 pm

Re: Now On My Playground

Post by xvedejas »

Nathan wrote:I just want the code of a Hello World OS, because i know C++ for Linux and Windows, copy, move, merge and my own interpreter, this is one of the things that i developed.

Thanks!
Nathan, it's a lot more than that. It's not nearly that simple. To realize how much more it is than that, please look at the wiki.
User avatar
Nathan
Member
Member
Posts: 201
Joined: Sun Jul 19, 2009 1:48 pm
Location: Brazil
Contact:

Re: Now On My Playground

Post by Nathan »

Ok, but the only thing that i want is a C++ Hello World OS, because the boot in Assembly i know.

Thanks!
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Now On My Playground

Post by neon »

IIRC you already know how to develop a "Hello World OS" - just boot and display a message.

To go into C code isn't that hard, but is beyond a 'hello world OS'. All you need to do is get the C program in memory and execute its entry point to run it. The specific details of it depends on your design (there are different ways to get it into memory) and file format (elf and pe are very different to parse.)
Last edited by neon on Sun Aug 23, 2009 6:32 pm, edited 1 time in total.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Now On My Playground

Post by pcmattman »

Have a look on the wiki at the C Bare Bones, the C++ Bare Bones, the C++ article itself (which has a wealth of kernel-specific information). Learn from the wiki, and build your OS. For the most part the very core of your C++ OS will be the same as the core for a C OS.
User avatar
Nathan
Member
Member
Posts: 201
Joined: Sun Jul 19, 2009 1:48 pm
Location: Brazil
Contact:

Re: Now On My Playground

Post by Nathan »

Ok, reading now!
Locked