Creating OS [Noobie :D]

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.
CWood
Member
Member
Posts: 127
Joined: Sun Jun 20, 2010 1:21 pm

Re: Creating OS [Noobie :D]

Post by CWood »

fair enough, disregard my last comments about C...
rdos
Member
Member
Posts: 3308
Joined: Wed Oct 01, 2008 1:55 pm

Re: Creating OS [Noobie :D]

Post by rdos »

berkus wrote:edit: and by "abstract" I mean that you don't have access to osdev wiki C tutorials if you cannot understand C, so you have to figure all the basics out by yourself.
Fair enough. I didn't have access to any OS code whatsoever when I wrote my basic kernel, C or ASM, so yes, I did figure out the basics by reading the Intel processor manuals many times, especially the system programming guide.
rdos
Member
Member
Posts: 3308
Joined: Wed Oct 01, 2008 1:55 pm

Re: Creating OS [Noobie :D]

Post by rdos »

gerryg400 wrote:So, rdos, you are an asm fan, and prefer asm to C ?

Why didn't you say so before ? :)
I either use asm or C++. C has no place anywhere. It's lousy at low-level stuff, and it doesn't provide any of the OO concepts naturally.
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Creating OS [Noobie :D]

Post by neon »

rdos wrote:I write directly in asm because asm is superior to C
Right. How is it "superior" again?
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
rdos
Member
Member
Posts: 3308
Joined: Wed Oct 01, 2008 1:55 pm

Re: Creating OS [Noobie :D]

Post by rdos »

neon wrote:
rdos wrote:I write directly in asm because asm is superior to C
Right. How is it "superior" again?
Because it can do anything the processor could do. C can't.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Creating OS [Noobie :D]

Post by Brynet-Inc »

rdos wrote:Because it can do anything the processor could do. C can't.
EDIT: Removed 2015: Imageshack replaced all links with spam.
Last edited by Brynet-Inc on Fri Aug 28, 2015 8:56 pm, edited 1 time in total.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
rdos
Member
Member
Posts: 3308
Joined: Wed Oct 01, 2008 1:55 pm

Re: Creating OS [Noobie :D]

Post by rdos »

It's pathetic when people deny that anything that can be done in C/C++/C#/Java cannot also be done directly in asm, while the reverse is not true (an assembler can always do things that C cannot do).

I would at least have expected some arguments that code written for C is more maintainable, or easier to write, less error-prone, more portable, or whatever. But to deny that asm is superior in what can be done is just plain stupid.
User avatar
Chandra
Member
Member
Posts: 487
Joined: Sat Jul 17, 2010 12:45 am

Re: Creating OS [Noobie :D]

Post by Chandra »

rdos wrote:It's pathetic when people deny that anything that can be done in C/C++/C#/Java cannot also be done directly in asm, while the reverse is not true (an assembler can always do things that C cannot do).

I would at least have expected some arguments that code written for C is more maintainable, or easier to write, less error-prone, more portable, or whatever. But to deny that asm is superior in what can be done is just plain stupid.
I prefer sticking with C as much as possible but you've a valid argument here, everything that can be done in asm cannot be done in C. While C has its advantages over asm, it also a well known truth that every OS developer has at least hundred lines of code written in complete assembly . Asm is not forbiddable.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Creating OS [Noobie :D]

Post by neon »

You missed my point. Using assembly language is better then a high level language provided that the appropriate need comes along. If you want to stick with assembly language, go for it. But do not compare it with a high level language by saying its "superior" because its not. The reverse is also true.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
rdos
Member
Member
Posts: 3308
Joined: Wed Oct 01, 2008 1:55 pm

Re: Creating OS [Noobie :D]

Post by rdos »

neon wrote:You missed my point. Using assembly language is better then a high level language provided that the appropriate need comes along. If you want to stick with assembly language, go for it. But do not compare it with a high level language by saying its "superior" because its not. The reverse is also true.
In my original post, I wrote "asm or C++". When I want the advantages of high-level languages, I also want the advantages of OO programming, which is why I claimed C had no place. OTOH, I do have a C-language module in my OS right now (Intel's ACPICA), but it was only because I don't have time to convert it to C++. When I write my own complex device-drivers in higher-level languages, I'll first create a class-interface with base-classes, so I can use C++. I'll test this for new filesystems first, as these are very hard to code in asm.

Also, the user-mode library that comes with RDOS is a C++ library that encapsulates the OS-functions into a class-interface.

So I'm well aware of the advantages of higher-level languages.
guyfawkes
Member
Member
Posts: 93
Joined: Mon Jul 18, 2011 9:47 am

Re: Creating OS [Noobie :D]

Post by guyfawkes »

The time you have given to make a basic OS, is plenty of time if you know how to code well in that language.
There's a basic Dos clone, that runs old dos game's etc, that took less than 2 weeks to code.
akatchi
Posts: 9
Joined: Tue Oct 25, 2011 2:03 pm

Re: Creating OS [Noobie :D]

Post by akatchi »

guyfawkes wrote:The time you have given to make a basic OS, is plenty of time if you know how to code well in that language.
There's a basic Dos clone, that runs old dos game's etc, that took less than 2 weeks to code.
Thanks ^^ finally something i understand (i don't know anything about the asm > c discussions :3)
is it hard to code an os like that? well im learning c++ right know :3 and im also making a document about alot of things (this is like 60% of the grade you get for the total thing) when i finished it i gonna struggle with the programming :3
adsm
Posts: 8
Joined: Mon Sep 20, 2010 8:33 am

Re: Creating OS [Noobie :D]

Post by adsm »

death2all wrote:It is very possible to write entirely in asm. Just be sure to be able to convert from C to asm mentally (not actually that different, given how similar C is to asm...)
Isn't the sane way to convert from C to assembler just to use a C compiler?

Doing the same thing in your head is mental!

(I'm joking, I know what you mean. But it sounded like you were running the compile process in your head, rather than on a CPU. Now that's a cross-compiler...)
Post Reply