Page 1 of 1

Do I need C?

Posted: Wed Jan 11, 2017 11:00 pm
by Seahorse
Besides Assembly, do I really need C in OSdev?

Can I just learn a different language for writing my code in?

I know you probably need to be able to read in C, but is there any other options, especially for a novice? I want to learn some new language I never touched before.

Re: Do I need C?

Posted: Wed Jan 11, 2017 11:26 pm
by Schol-R-LEA
The wiki's Languages page covers this subject in a reasonable amount of detail, actually. The general answer is, you will need to be able to read C to use most of the available learning resources, but for writing your own OS you should be able to use any language which meets the requirements laid out on that page (or rather, any language for which there is an implementation which meets them; this stipulation loosens those rules a bit, as it means that a subset or otherwise specialized compiler might be able usable where the standard versions would not be).

Mind you, there are others such as myself who take it even further and design their own language from the ground up specifically for their OS; see the Alta Lang archetype page, and maybe the CompilerDev site, for further information on this approach.

Re: Do I need C?

Posted: Wed Jan 11, 2017 11:27 pm
by Love4Boobies
No. You just need to figure out what your goals are and which language would be more suitable to achieve those goals. To give a couple of examples:
  • If I wanted to target a wide range of embedded platforms, I'd probably use C because it's the least terrible option. For all its misgivings, you can expect C to be available almost universally because good compilers for it are dirt cheap to implement.
  • If I wanted a highly reliable system, I would probably go for a functional language.
  • If I wanted a managed system, I would probably pick a safe language (Java and C# are the more popular options but there are alternatives).
  • If I wanted the system to to port existing software, I'd pick something that did not interfere with those goals.
  • If I had certain goals that are not reasonably met by existing languages, I would design my own.

Re: Do I need C?

Posted: Thu Jan 12, 2017 12:44 am
by DixiumOS
You don't. However, i recommend using C or other language that's not Assembly.

Assembly can be very hard, while C has a easier syntax, along with many more functions.

Re: Do I need C?

Posted: Thu Jan 12, 2017 3:30 am
by Love4Boobies
No, assembly is actually a much simpler language than C is as far as both syntax and semantics are concerned. Similarly, C is simpler than C++ or Java are. The point is that designers will sometimes move the complexities of software inside the language so that the development process becomes simpler (i.e., you have a complex language that does complex things on your behalf).

To make an analogy, think of a printing press. You could write a book by hand. In principle, that process is quite simple, just like assembly language. In practice, it's much faster to use a complex piece of machinery (the equivalent of what we vaguely call "higher-level" languages) that will produce the book for you. The resulting book will come out faster, is almost guaranteed to have less errors. As an added bonus, you can use the same printing press for many other books as well.

Re: Do I need C?

Posted: Fri Jan 13, 2017 6:36 am
by TheDev100
Nope, you don't need C.

Assembly is very good. It is more faster and lightweight. However, it won't support many architectures. There are many operating systems 100% fully written in Assembly like KolbriOS and MenuetOS.

If you are beginning Assembly, I suggest you learn MS-DOS debug assembly first from YouTube. There are also many references on Wikipedia. Search assembly fun or assembly tutorial kupala. This is how I learn.

Learn Intel syntax so it can run on i386 and x86 blah blah blah. It's quite popular. Use Intel's syntax.

Re: Do I need C?

Posted: Fri Jan 13, 2017 7:43 am
by dozniak
I hope I don't hit this forum's internal limit on ignore list, it's filling up so fast.

Re: Do I need C?

Posted: Fri Jan 13, 2017 8:45 am
by glauxosdever
Hi,

TheDev100 wrote:Assembly is very good. It is more faster and lightweight. However, it won't support many architectures.
Each architecture has its own assembly language. So, while it's true to say "A specific assembly language supports only one architecture", it's totally wrong to say "Assembly language supports only one architecture".
TheDev100 wrote:There are many operating systems 100% fully written in Assembly like KolbriOS and MenuetOS.
I must admit KolibriOS is impressive as an operating system, however it's hard for a team to write maintainable assembly code while keeping it optimised too.
TheDev100 wrote:If you are beginning Assembly, I suggest you learn MS-DOS debug assembly first from YouTube. There are also many references on Wikipedia. Search assembly fun or assembly tutorial kupala. This is how I learn.
Bad advice. MS-DOS assembly is by 25 years oudated (let's be optimist!) and it doesn't really teach you anything useful nowadays (even if you are writing a bootloader for BIOS, you can't use interrupt 0x21 that is present in most of assembly code for MS-DOS, so it's useless).
TheDev100 wrote:Learn Intel syntax so it can run on i386 and x86 blah blah blah. It's quite popular. Use Intel's syntax.
This is debatable. While I agree with you, you will find so much opposition from other people that we rather don't discuss it here.


Regards,
glauxosdever

Re: Do I need C?

Posted: Fri Jan 13, 2017 12:35 pm
by crunch
dozniak wrote:I hope I don't hit this forum's internal limit on ignore list, it's filling up so fast.
It's like going to the gym in January. You have all these new year's resolutioners coming in and doing exercises that are made up/should never be done and just taking up space and equipment. Luckily, the ones that weren't serious end up giving up after a month and everything goes back to normal. The ones who are serious ask questions, watch, and make an effort. And they're welcomed with open arms.

Lets hope we can say the same here.

Re: Do I need C?

Posted: Fri Jan 13, 2017 2:21 pm
by Seahorse
Bad advice. MS-DOS assembly is by 25 years oudated (let's be optimist!) and it doesn't really teach you anything useful nowadays (even if you are writing a bootloader for BIOS, you can't use interrupt 0x21 that is present in most of assembly code for MS-DOS, so it's useless).
Would you recommend something else? Why should it matter? There is still DOS emulators people use everyday.

Re: Do I need C?

Posted: Fri Jan 13, 2017 2:24 pm
by glauxosdever
Hi,

Mark12 wrote:
Bad advice. MS-DOS assembly is by 25 years oudated (let's be optimist!) and it doesn't really teach you anything useful nowadays (even if you are writing a bootloader for BIOS, you can't use interrupt 0x21 that is present in most of assembly code for MS-DOS, so it's useless).
Would you recommend something else? Why should it matter? There is still DOS emulators people use everyday.
I didn't know I'm running my software on top of a DOS emulator...

Seriously now, do you think that learning a 35-years old technology that got obsolete 25-years ago is going to do any good to the learner?


Regards,
glauxosdever

Re: Do I need C?

Posted: Fri Jan 13, 2017 2:25 pm
by matt11235
Mark12 wrote:Why should it matter?
His point was that MS-DOS is old cruft and can't really be applied to anything modern.

Re: Do I need C?

Posted: Fri Jan 13, 2017 3:36 pm
by Kevin
Mark12 wrote:Would you recommend something else? Why should it matter? There is still DOS emulators people use everyday.
DOS runs in Real Mode. If you want to learn how to program assembly in Real Mode, it can be a useful start. However, you can't write a modern OS (or any modern software) with that.