Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have heard that for interacting with hardware assembly is preferred on C. is that true?
Secondly I am learning Assembly and my professor is targeting Intel iAPX 8088, i wonder why he is still teaching such an old architecture in the presence of Core i generations, So please give me some guidance that am i going the right way?? Truly Thanks in Advance.
Posted
Updated 16-Jan-15 7:12am
v3
Comments
PIEBALDconsult 16-Jan-15 13:13pm    
Bearing in mind that C was created for writing portable operating systems because assembly was unsuited, if it's a course in assembly, use assembly.

Use C the most you can. Then if you can't do it with C (or there's a serious performance advantage) use assembly.
I think a it would be a daunting task for a single person to develop an entire OS using assembly (I guess it is a daunting task anyway..).
Of course the course (pardon the pun) is a bit outdated. However for learning the basics a simple architecture does a good job.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 16-Jan-15 16:32pm    
Pretty much agree (a 5), but I have to extra idea which I actually utilized a lot and know that they really work well; please see Solution 3.
—SA
"Depends" is about the best answer, I'm afraid.

C is "better" in that Operating Systems tend to be complex, and it's a lot easier to understand and modify "big" software that is written in a high level language than it is to do the same in assembler: as a rough guide, a "line" of C will be 1 to 20 "lines" of assembler.

But...a good assembler programmer can still beat any compiler for speed and / or compactness, and there are occasions when that is a significant factor.

So really, it's a case of "you pays your money, and you takes your choice" - but bear in mind that many C compilers will allow you to inline assembler code for "tight bits" if you need it.

Which way would I go? High level, probably. It really is hard to maintain large assembler projects, and that makes a big difference when you are the only person on the project as you will have to revisit code you wrote six months ago and try to understand it.

Why does he teach 8088? What assembler should he teach? :laugh: It's a good, simple assembler with enough features to be useful, but without the complexity that modern CISC processors have. Yes, he could teach something like PIC which is simple and more common - but that's hard to debug for beginners because everything is inside the chip and it's hard to get at. With the older stuff, you can stick an oscilloscope on the legs and look at what is happening! :laugh:
 
Share this answer
 
Comments
CPallini 16-Jan-15 18:17pm    
5.
Just couple of extra ideas:

Use C++, not C. You can still write the code which is exactly as low-level as C, with benefits of C++ where you can use them.

More importantly: even though some assembly is certainly required, some of your assembly code (actually, most of your assembly code) can be written in C++ inline assembly. This is a whole lot more convenient than using traditional assembler. For example, you can easily use declarations and functions written in C++, and a lot more. However, you can find some very advanced assembler; some are even object-oriented.

Take my experience: I was one of the very early implementors of threading (at the time when even Linux had processed but not yet threads) and real modern structured assembly handling (when it wasn't even introduced in C++, was only available in CLU and Ada, maybe somewhere else). Of course, it required direct manipulations with registers, stack and other memory. How do you thing I achieved that? In the core of it, mostly using Borland Object Pascal inline assembler, in object-oriented environment.

—SA
 
Share this answer
 
v2
Comments
CPallini 16-Jan-15 18:17pm    
5.
Sergey Alexandrovich Kryukov 16-Jan-15 18:18pm    
Thank you, Carlo.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900