C/C++ vs Assembler?

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.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

C/C++ vs Assembler?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:42 pm, edited 2 times in total.
jrfritz

Re:C/C++ vs Assembler?

Post by jrfritz »

Do you know how long and hard it'd be to program a whole kernel in asm?

That's why they made UNIX in C!
jrfritz

Re:C/C++ vs Assembler?

Post by jrfritz »

A full printf in ASM would be about 12 pages most likly!
pskyboy

Re:C/C++ vs Assembler?

Post by pskyboy »

Your mad doing it in assembler, it will be much harder to do, take much longer and im betting you will get lost at points just because of the amoint of code you will have. Also i don't see why you think C/C++ is messy, in most cases it will be faster then ASM as unless your are a ASM Guru which you obviously arn't at the moment as you only know a little ASM. This is also debatable with a lot of people saying that modern c/c++ compilers do as good or even better job then an ASM guru, but that is debatable.

The one thing that is true is that a C compiler will probably produce better code then you until you learn alot more asm.

Peter
VitalDragon

Re:C/C++ vs Assembler?

Post by VitalDragon »

I use to like C/C++ until I started learning ASM ;) . Its much easier to do some stuff in ASM, I use ASM for everything now Win32, Console, DOS Programs. Its just recently that I found out about OS Programming (6 days ago). I'm going to write my whole OS in Assembler because it creates smaller files , and you see exactly what machine instructions you gave to the computer. However I'm not using NASM, NASM bloats files up, I'm using FASM.
hanoi

Re:C/C++ vs Assembler?

Post by hanoi »

They made UNIX in C to keep compatibility
if you want to write a kernel in asm, you should look for
Primula in http://Robert.zizi.org
jrfritz

Re:C/C++ vs Assembler?

Post by jrfritz »

Shouldn't this be better in the General Fourm?
Mr_Spam

Re:C/C++ vs Assembler?

Post by Mr_Spam »

i'd imagen that writing the whole thing in asm would take longer and be much more mental straining. after writing this bootloader, ive also really started to like asm. i'm also desiding to write the kernel in C or asm. it is also possiable to combine the 2....... write some parts in C, other parts in asm.....that probbily what i'll end up doing.
Madmonky1

Re:C/C++ vs Assembler?

Post by Madmonky1 »

I've decided to use assembly to. I don't care how easy c++ is, It's just never worked for me. Ive gotten text functions to work, but I tried graphics in djgpp for a while and it just didn't work. C++ is good for games, but I think in the long run asm will work best for my kernel. There seems to be fewer used assemblers for tutorials than C/C++ which is WAY less confusing to learn to do stuff with.
EDIT: Of course I am an OS n00b so if someone could help with djgpp It'd be greatly appreciated, and if I could do some in assembly and some in C/C++
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:C/C++ vs Assembler?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:43 pm, edited 1 time in total.
jrfritz

Re:C/C++ vs Assembler?

Post by jrfritz »

Well then...if ASCII are numbers...and when you push 'a' how does the asm printf know that the 'a' is a number or letter? Since they can interchange...
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:C/C++ vs Assembler?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:43 pm, edited 1 time in total.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:C/C++ vs Assembler?

Post by Pype.Clicker »

asm kernel, hu ? i had such f00l1sh 1d34 when i was about 18 ... then i learned C (i mean i *really* learned how to use it, not just the syntax of the for statement :), and i realized that once your reach a certain amount of complexity (such as AVL or Btrees, memory allocation algorithms, etc.) things simply cannot be done in ASM anymore ...
Just because the code become too huge, you lose the track of what you"re doing ... you find yourself unable to correct a bug without introducing 3 new bugz ...

nah, believe someone who tried. 90% of the ASM code you write will be rewritten in higher-level language soon or late ...
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:C/C++ vs Assembler?

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:43 pm, edited 1 time in total.
VitalDragon

Re:C/C++ vs Assembler?

Post by VitalDragon »

C/C++ is way too confusing when it comes to making an OS. Assembler is much easier to use for OS Developing. If you want to make an OS you'll have to learn Assembler anyway, plus anyone can make an OS in C/C++ but only a few can make an OS in pure assembler...


BTW Unix sucks.
Post Reply