BetaArchive Logo
Total Current Archive Size: 4765.54GB in 15409 files
Navigation Home Screenshots Image Uploader Server Info FTP Servers Wiki Forum RSS Feed Rules Please Donate
UP: 5d, 7h, 38m | CPU: 4% | MEM: 4815MB of 12279MB used
{The community for beta collectors}

Post new topic Reply to topic  [ 23 posts ] 
Author Message
 PostPost subject: Programming Language Advice        Posted: Mon Oct 03, 2011 2:38 am 
1337 Beta Collector
1337 Beta Collector
User avatar
Offline

Joined
Tue May 03, 2011 2:08 am

Posts
1414

Location
New Tokyo-3

Favourite OS
Windows 8 RP
Hey, all. I'm seriously considering starting my own custom OS, and I was wondering if there is any one "best" language to work from scratch in. I realize this is a huge commitment, and I'm going to take the time to learn what I'm doing, but I'd like some advice on where to start. The only solid goal I have in mind right now is that I want to write a 32- or 64-bit OS.

_________________
My brother had a book he would hold with pride/A little red cover with a broken spine/On the back he hand wrote a quote inside/"When the rich wage war, it's the poor who die"


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 2:39 am 
Guru Beta Collector
Guru Beta Collector
User avatar
Offline

Joined
Mon Apr 25, 2011 5:33 pm

Posts
843

Location
C:/Windows/System32/twinUI.dll

Favourite OS
W8B1 Build 8134
I could use the same advice :cool:


Top  Profile  WWW  YIM
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 2:42 am 
Guru Beta Collector
Guru Beta Collector
Offline

Joined
Fri Mar 28, 2008 11:34 am

Posts
904
I recommend this site here: http://www.osdever.net/
It has a few papers you'll find useful.

_________________
I'm a Xerox Alto, and the GUI was my idea


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 2:46 am 
1337 Beta Collector
1337 Beta Collector
User avatar
Offline

Joined
Tue May 03, 2011 2:08 am

Posts
1414

Location
New Tokyo-3

Favourite OS
Windows 8 RP
lucas93 wrote:
I recommend this site here: http://www.osdever.net/
It has a few papers you'll find useful.

Thanks. I'll take a look.

_________________
My brother had a book he would hold with pride/A little red cover with a broken spine/On the back he hand wrote a quote inside/"When the rich wage war, it's the poor who die"


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 3:38 am 
Pro Beta Collector
Pro Beta Collector
Offline

Joined
Sat May 15, 2010 1:59 am

Posts
455

Location
Virginia, North America

Favourite OS
Longhorn 4074
My advice personally...

ASM, C++.

gogogo.

_________________
Deus damnaret eam!


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 3:43 am 
1337 Beta Collector
1337 Beta Collector
User avatar
Offline

Joined
Tue May 03, 2011 2:08 am

Posts
1414

Location
New Tokyo-3

Favourite OS
Windows 8 RP
Jecag wrote:
My advice personally...

ASM, C++.

gogogo.

I was planning on investigating C++ already, actually. I looked at ASM, but had trouble making any sense of it. I may have to give it another look...

_________________
My brother had a book he would hold with pride/A little red cover with a broken spine/On the back he hand wrote a quote inside/"When the rich wage war, it's the poor who die"


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 4:26 am 
Newbie Beta Collector
Newbie Beta Collector
Offline

Joined
Mon Oct 03, 2011 4:00 am

Posts
1

Favourite OS
5.1.2600, SP2
Very low level programming would be done in assembler language of some type - you might try learning this by debugging or reversing open source code - lots of books on the subject. Knowledge of C language is also fundamental.


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 9:05 am 
Amateur Beta Collector
Amateur Beta Collector
Offline

Joined
Tue Sep 21, 2010 12:47 pm

Posts
220

Favourite OS
IRIX 5.3 XFS 12/94
maybe you should think about what your OS should look like, what it shall support and how it is programmed. there is no sense writing a kernel that prints "Hello world" and calling this an OS, when there is no way of loading some kind of program, and then you should provide some interfaces for programs to start/stop, access hardware, ...

before starting to read programming tutorials, you should better start here


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 6:21 pm 
1337 Beta Collector
1337 Beta Collector
User avatar
Offline

Joined
Tue Dec 15, 2009 8:56 pm

Posts
2300

Location
England, UK

Favourite OS
NeXTSTEP 5.1/Windows NT
Seeing as C++ is down, I'll suggest .NET.

_________________
#nttalk - the only sensible option for discussion of betas and more! Don't delay, join today at irc.alphachat.net #nttalk!


Top  Profile  WWW
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 6:28 pm 
Newbie Beta Collector
Newbie Beta Collector
Offline

Joined
Sat Aug 28, 2010 5:11 pm

Posts
43

Location
Berlin

Favourite OS
UNIX v6, Plan 9
Assembly for the low level stuff obviously, otherwise C.

_________________
RIP dmr.


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 6:58 pm 
1337 Beta Collector
1337 Beta Collector
Offline

Joined
Sat Nov 28, 2009 4:05 pm

Posts
2360
Incredible low level i.e. critical loading stuff in ASM, can't be done anywhere else. Write as much of the backbone of the OS in C as you can. You'll be kicking yourself if it's all ASM and you can't make sense of it / make it work (only write the ASM where there's no way of doing it in C basically).


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 9:43 pm 
Amateur Beta Collector
Amateur Beta Collector
Offline

Joined
Tue Sep 21, 2010 12:47 pm

Posts
220

Favourite OS
IRIX 5.3 XFS 12/94
I wouldn't suggest writing in interpreted/JITed highlevel languages such as Java or .Net, you had to write quite a lot of lowlevel stuff to accommodate a runtime for this code, which probably exceeds your knowledge when you don't have any architectural idea until now


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 10:43 pm 
1337 Beta Collector
1337 Beta Collector
User avatar
Offline

Joined
Tue Apr 15, 2008 12:13 am

Posts
1008

Location
With Waldo

Favourite OS
Windows 7 RTM
neonsonicboy wrote:
Incredible low level i.e. critical loading stuff in ASM, can't be done anywhere else. Write as much of the backbone of the OS in C as you can. You'll be kicking yourself if it's all ASM and you can't make sense of it / make it work (only write the ASM where there's no way of doing it in C basically).

I think this is your best advice. I would also say, I think you can use some C++ instead of C sometimes, but you have to ask your self, what are you writing (what is it's purpose and what will it look like). ASM, in my opinion, is extremely hard to learn, so you have to decide if it is worth learning in your case. If it is not, or things just aren't clicking for you once you start, my advice would be to work on a modification for an OS that is already made.

_________________
Image


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Mon Oct 03, 2011 10:51 pm 
1337 Beta Collector
1337 Beta Collector
User avatar
Offline

Joined
Tue May 03, 2011 2:08 am

Posts
1414

Location
New Tokyo-3

Favourite OS
Windows 8 RP
I'll learn as much ASM as I need to to create a base. If I wanted to modify an existing OS I'd just use Linux, after all.

_________________
My brother had a book he would hold with pride/A little red cover with a broken spine/On the back he hand wrote a quote inside/"When the rich wage war, it's the poor who die"


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Tue Oct 04, 2011 2:23 pm 
1337 Beta Collector
1337 Beta Collector
User avatar
Offline

Joined
Thu Apr 14, 2011 12:50 pm

Posts
1777
MikeOS is an open-source assembly operating system. you may take a look.


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Tue Oct 04, 2011 4:28 pm 
Newbie Beta Collector
Newbie Beta Collector
Offline

Joined
Sat Aug 28, 2010 5:11 pm

Posts
43

Location
Berlin

Favourite OS
UNIX v6, Plan 9
If you're interested, you might enjoy "Lions' Commentary on UNIX 6th Edition" by John Lions. It really is a classic (I'm reading it right now and am almost finished) and contains the whole source code of the Unix version 6 kernel, which ran on PDP-11s. The code quality is superb (although an older, more "liberal" C dialect is used) and it's great fun to read; it's not easy though...programming operating systems isn't a piece of cake.

_________________
RIP dmr.


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Tue Oct 04, 2011 4:33 pm 
1337 Beta Collector
1337 Beta Collector
User avatar
Offline

Joined
Tue May 03, 2011 2:08 am

Posts
1414

Location
New Tokyo-3

Favourite OS
Windows 8 RP
I'm aware of this. Any idea where I might find a copy of this book? In real life, that is. Not Internet retailers.

_________________
My brother had a book he would hold with pride/A little red cover with a broken spine/On the back he hand wrote a quote inside/"When the rich wage war, it's the poor who die"


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Tue Oct 04, 2011 4:59 pm 
Pro Beta Collector
Pro Beta Collector
User avatar
Offline

Joined
Thu Jul 01, 2010 1:08 pm

Posts
397

Location
Over here!

Favourite OS
AMI BIOS
soulman wrote:
Seeing as C++ is down, I'll suggest .NET.

.NET needs runtime libraries, so you can't write a CustomOS in it, until you'll write an independent compiler(like Singularity is using).
___

I really suggest the Assembler, as you need it for bootloader if you won't use GRUB(just like me). If you want to start with OSDeving - start from 16-bit real-mode first, it will teach you the basics, then, you can switch to Protected Mode, where you are entirely on your own(no interrupts, goodbye BIOS :-) ), own drivers, own everything. So... If you are not curious how it works (I am writing pmode system for this, of course...), you need a really big motivation.

For additional reference, visit wiki.osdev.org, there are some bare-bones for real mode system (512 bytes is a little bit too small, next challenge - roll it into two-stage system :) ), try to read FreeDOS code. If you want to make a PMode OS in ASM - MenuetOS code reading. If you want to just real-mode - try MikeOS for reference.

MugenFox wrote:
neonsonicboy wrote:
Incredible low level i.e. critical loading stuff in ASM, can't be done anywhere else. Write as much of the backbone of the OS in C as you can. You'll be kicking yourself if it's all ASM and you can't make sense of it / make it work (only write the ASM where there's no way of doing it in C basically).

I think this is your best advice. I would also say, I think you can use some C++ instead of C sometimes, but you have to ask your self, what are you writing (what is it's purpose and what will it look like). ASM, in my opinion, is extremely hard to learn, so you have to decide if it is worth learning in your case. If it is not, or things just aren't clicking for you once you start, my advice would be to work on a modification for an OS that is already made.


ASM is not that really hard to learn. It depends on your determination.

_________________
Image
Helping you help us help you help us all.
21686148-6449-6E6F-744E-656564454649


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Wed Oct 05, 2011 4:57 pm 
Amateur Beta Collector
Amateur Beta Collector
User avatar
Offline

Joined
Thu Aug 09, 2007 3:56 pm

Posts
176

Location
Serbia

Favourite OS
Windows Lupus Project
ASM and C definitely. http://www.osdever.net is a great resource for getting some stuff together. I recommend readding through open-source codes to see how people have done stuff - BUT do write your own code from scratch, recycle, don't just C/P pieces of code, learn what it does, investigate, see how it can be done better.

You should always know that writting a usable OS is not a one man job, although it can be done, it's a matter of time, dedication and knowlegde, and you can accomplish more with a team than on your own. Rely on the community if you're making an open-source project too.

_________________
May our software be open-source, and our women closed-source.


Top  Profile  WWW  ICQ  YIM
 PostPost subject: Re: Programming Language Advice        Posted: Sat Oct 08, 2011 7:58 pm 
Newbie Beta Collector
Newbie Beta Collector
Offline

Joined
Sat Aug 28, 2010 5:11 pm

Posts
43

Location
Berlin

Favourite OS
UNIX v6, Plan 9
evangelikevin wrote:
I'm aware of this. Any idea where I might find a copy of this book? In real life, that is. Not Internet retailers.

Nope, I bought my copy from amazon. But you can download the book [1] and the source code listing [2].

[1] http://www.lemis.com/grog/Documentation/Lions/
[2] http://v6.cuzuco.com/

_________________
RIP dmr.


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Sat Oct 08, 2011 8:06 pm 
1337 Beta Collector
1337 Beta Collector
User avatar
Offline

Joined
Tue May 03, 2011 2:08 am

Posts
1414

Location
New Tokyo-3

Favourite OS
Windows 8 RP
aap wrote:
Nope, I bought my copy from amazon. But you can download the book [1] and the source code listing [2].

[1] http://www.lemis.com/grog/Documentation/Lions/
[2] http://v6.cuzuco.com/

Awesome! Downloading now. (chuckle) If I'm LUCKY, I'll have a very, VERY basic OS running by next summer. We'll see how it goes.

_________________
My brother had a book he would hold with pride/A little red cover with a broken spine/On the back he hand wrote a quote inside/"When the rich wage war, it's the poor who die"


Top  Profile
 PostPost subject: Re: Programming Language Advice        Posted: Tue Oct 11, 2011 2:10 am 
Amateur Beta Collector
Amateur Beta Collector
User avatar
Offline

Joined
Fri Dec 24, 2010 11:12 pm

Posts
179

Location
/dev/chair

Favourite OS
DreckigOS v0.007 Alpha
I'd say to keep it simple all ASM.
That's what I uses for OS Dev because it runs fast and is fast to write once you get all the subroutines you need written.

_________________
GAT C++++$
DreckigOS - Now bigger and better:
https://github.com/WizardOfHaas/DreckigOS


Top  Profile  WWW
 PostPost subject: Re: Programming Language Advice        Posted: Tue Oct 11, 2011 8:29 pm 
Newbie Beta Collector
Newbie Beta Collector
Offline

Joined
Sun Sep 18, 2011 10:08 am

Posts
20

Favourite OS
Longhorn 4051
You will need to learn some ASM. ASM is not hard to learn, its actually one of the simplest imperative language. The hard thing is to figure out how to use the primitives to get the things done.

1) Figuring out what instructions are there and the "usual" way to use them. Reading other people's (commented!) asm code is a good place to start go get a hang of how things are usually done. You don't need to know all instructions, but be familiar with instructions for moving data between registers and memory, the adressing modes, branching (jmp, call and conditional instructions like je="jump on equal", jne="jump on not equal" etc.), the arithmetic instructions (add, sub, mul, div), bit operations (shift left and right) and logical operations (and/or/not/xor) and for the latter group realize what you use them for (i.e. setting/clearing/toggling bits etc.).

2) Another important thing to understand is the whole Intel architecture and segments, paging etc.

A good resource for all these things are the Intel manuals:

http://www.intel.com/content/www/us/en/ ... nuals.html

Especially the first few chapters of "Basic architecture", followed by the first few chapters of the System Programming Guide is a good place to understand the overall architecture.

I would recommend C over C++ at least for the initial part. C++ introduces its own headaches such as requiring more of the C runtime library to be working (by inserting function calls in your code). The linker and naming conventions are more complex making interoperability with your ASM bits that much harder. This is usually not a problem in plain C. I recommend the NASM (Netwide Assembler) due to its ease of use and ability to easily output objects in all kinds of formats (including "plain" binary, i.e. no headers etc.).


Top  Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ] 




Who is online

Users browsing this forum: No registered users and 0 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

Search for:
Jump to:  

All views expressed in these forums are those of the author and do not necessarily represent the views of the BetaArchive site owner.

Powered by phpBB® Forum Software © phpBB Group

Copyright © 2006-2013

 

Sitemap | XML | RSS