OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 1:44 pm

All times are UTC - 6 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: How to write a "Hello World" in C?
PostPosted: Tue Dec 13, 2016 12:30 pm 
Offline

Joined: Tue Dec 13, 2016 6:04 am
Posts: 2
Hello World! My name is Nikita. i'm new. Help me please,how to write a "Hello World" in C

_________________
I am not catnikita255, do not confuse me and him.


Top
 Profile  
 
 Post subject: Re: How to write a "Hello World" in C?
PostPosted: Tue Dec 13, 2016 1:15 pm 
Offline

Joined: Thu Jul 31, 2014 3:43 pm
Posts: 1
http://wiki.osdev.org/Bare_Bones

You should read through the wiki, you can learn a lot from it.


Top
 Profile  
 
 Post subject: Re: How to write a "Hello World" in C?
PostPosted: Tue Dec 13, 2016 1:40 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
By "Hello, World!", I am assuming you mean a HW boot loader or OS stub, rather than the general question of how to use C. If it is the latter, then I would recommend moving this inquiry to the General Programming sub-forum.

As jmziprick stated, you should review the Bare Bones example in the Wiki. However, I would go further and give you a number of links to read (if you haven't done so already), just to get you up to speed on what you will need to know when working in the OS dev space:

Getting Started
How To Ask Questions
FAQ

Required Knowledge
Beginner Mistakes (the "deadlines" section in particular)
What order should I make things in
Code Management

How kernel, compiler, and C library work together
Using Programming Languages other than C

Real Mode, especially the section on memory addressing, and Segmentation
Memory Map, Detecting Memory and A20 Line
BIOS, and Boot Sequence
Interrupts
Bootloader and Rolling Your Own Bootloader
FAT and SFS

While this is a lot of reading, it simply reflects the due diligence that any OS-devver needs to go through in order to get anywhere. OS development, even as a simple project, is not amenable to the Stack Overflow cut-and-paste model of software development; you really need to understand a fair amount of the concepts and principles before writing any code, and the examples given in tutorials and forum posts generally are exactly that. Copying an existing code snippet without at least a basic idea of what it is doing simply won't do. While learning itself is an iterative process - you learn one thing, try it out, see what worked and what didn't, read some more, etc. - in this case a basic foundation is needed at the start. Without a solid understanding of at least some of the core ideas before starting, you simply can't get very far in OS dev.


Hopefully, this won't scare you off; it isn't nearly as bad as it sounds. It just takes a lot of patience and a bit of effort, a little at a time.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: How to write a "Hello World" in C?
PostPosted: Wed Dec 14, 2016 5:50 am 
Offline
Member
Member
User avatar

Joined: Fri Apr 03, 2015 9:41 am
Posts: 492
Info that you provided is useful for newbies, but not for him. I know him personally and he won't really understand the wiki. I think that it was a mistake to providing him with link to OSDev :(

Nope, I don't want to offend you, Nikita. I just say that you shall learn C in userspace first.

_________________
Developing U365.
Source:
only testing: http://gitlab.com/bps-projs/U365/tree/testing

OSDev newbies can copy any code from my repositories, just leave a notice that this code was written by U365 development team, not by you.


Top
 Profile  
 
 Post subject: Re: How to write a "Hello World" in C?
PostPosted: Wed Dec 14, 2016 9:37 am 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
I think I might just start with learning Assembly before I touched C.

A "Hello World" OS in Assembly is just a few lines of code.

A "Hello World" program in C requires you to understand C, the compiler, the linker, and probably GRUB as well.

Just a thought...

_________________
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott


Top
 Profile  
 
 Post subject: Re: How to write a "Hello World" in C?
PostPosted: Thu Dec 15, 2016 1:46 am 
Offline
Member
Member

Joined: Sun Feb 01, 2009 6:11 am
Posts: 1070
Location: Germany
Wrong approach, he should start with neither an OS in assembly nor an OS in C. Someone who has never programmed, needs to start in userspace. And for doing that, assembly requires understanding a lot of low-level details like registers, memory addresses, system calls, etc. while C is comparatively straightforward for simple tasks.

_________________
Developer of tyndur - community OS of Lowlevel (German)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 564 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group