Is it worth to write my system (small) in Assembly entirely?

Programming, for all ages and all languages.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Is it worth to write my system (small) in Assembly entir

Post by gerryg400 »

Congdm wrote:In my opinion, the main purpose of learning is to correct wrong things.
I'm not sure why you have this opinion but it is incorrect. In engineering, you learn so that you don't repeat the mistakes of others. Our discipline cannot afford to have people making mistakes that others have made. There's just too much work to be done.
If a trainstation is where trains stop, what is a workstation ?
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: Is it worth to write my system (small) in Assembly entir

Post by Antti »

Sandras wrote:I say use C, like most do. And they do for a reason. It's portable AND fast.
I think that the portability is not an issue when writing a first small operating system because a vast amount of the C code being non-portable anyway. I am sure that this statement is debatable. Of course, aiming towards the portability is a good thing.
Congdm wrote:But for now, I decided to continue with Assembly. I consider that as a challenge to test my designing and programming skills.
That is fine and strong assembly skills are helpful in a long run even programming in high level languages. I have even written some machine language and I found it useful.

However, I think you should also consider this: if you setup a toolchain to support also C, you could at least say that your choice of using just the assembly has nothing to do with the laziness of setting up the toolchain.
gerryg400 wrote:In engineering, you learn so that you don't repeat the mistakes of others.
That is true but are we saying that writing an OS entirely in assembly is always a huge mistake? Is that an universal truth?
http://www.menuetos.net wrote:MenuetOS is an Operating System in development for the PC written entirely in 32/64 bit assembly language.
It is possible. However, I also do C.
User avatar
Combuster
Member
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: Is it worth to write my system (small) in Assembly entir

Post by Combuster »

I think this is a pretty good reasoning. I find it very important to keep in your head that nothing is perfect. To answer your "Is it worth to write my system (small) in Assembly entirely?" question:

NO
I say YES.

Because the gain you get is not necessarily the end result being a functioning, maintainable system, but for all the other learning moments you get in the process.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Is it worth to write my system (small) in Assembly entir

Post by Love4Boobies »

Congdm wrote:In my opinion, the main purpose of learning is to correct wrong things.
I specifically avoided that phrasing because sometimes you don't even know the wrong strategy yet so there's nothing to correct---however, as you learn more, you will want to know of ways of avoiding it. Also, that was my quote, not Nable's.
Combuster wrote:
I think this is a pretty good reasoning. I find it very important to keep in your head that nothing is perfect. To answer your "Is it worth to write my system (small) in Assembly entirely?" question:

NO
I say YES.

Because the gain you get is not necessarily the end result being a functioning, maintainable system, but for all the other learning moments you get in the process.
I guess I agree with this view but the original question seemed to put emphasis on the OS (or maybe learning how to write one) rather than the learning of something else. So my revised answer is: It depends on what you want to get out of it.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
iansjack
Member
Member
Posts: 4685
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Is it worth to write my system (small) in Assembly entir

Post by iansjack »

Well, the OP says that he is happier writing assembler than C. So if the intent was to learn more then the answer would definitely be "NO".
rdos
Member
Member
Posts: 3276
Joined: Wed Oct 01, 2008 1:55 pm

Re: Is it worth to write my system (small) in Assembly entir

Post by rdos »

There could be other design-choices that make it more realistic to write an OS in assembly. Such a design choice might be to exploit x86 segmentation, which is not an option with C-compilers for most of the OS code.

And portability is an overstated "feature". I've seen the drawback of it in lots of "portable code". It's taken me 3-4 weeks to port a unzip utility from Info-Zip that support various OSes and platforms. Given the specifications, it would have been faster to write it from scratch than to port it. The code is so full of strange macros, ifdefs and other junk that it is impossible to follow and understand, even in the presence of a decent debugger. So I would argue that portability and easy-to-read code are impossible to combine. I've not seen any evidence against this yet, and it probably applies just as well to OSes as to "portable" applications.

And, of course, it is possible to code a complex OS-project entirely in assembly. It's been done before.
User avatar
iansjack
Member
Member
Posts: 4685
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Is it worth to write my system (small) in Assembly entir

Post by iansjack »

The question wasn't whether it could be done (obviously it can) but whether it was worth it (debatable). As for segmentation - I know that is a favourite with you but it is a totally outdated technology. Anything that guides people away from using segmentation can only be a good thing.
Post Reply