Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

the power of assembly

Status
Not open for further replies.

neevor

Programmer
Aug 7, 2002
12
0
0
US
I am new to programing. I have had a little experiance with C and C++ but wanted to learn a language that was faster and closer to the computer. However, I was wondering how can assembler be closer to the computer than C when many assembler compilers are written in C?
 
Well, the fact that many assemblers are written in C doesn't necesarily mean that C is closer to the computer, it just means that many people find C to be better suited and easier to use for writing such things as operating systems, compilers and assemblers. By all means, you could write assemblers in perl if you'd like, and perl is nowhere near as close to the raw metal as C is.

The thing is that C is a semi-high level language with constructs such as loops, if-statements, complex datatypes and so on. In assembly you have to create such things yourself using eg. jump-instructions.

Every instruction in assembly normally corresponds to one instruction in the processor. This is not at all the way that C works (as you probably know). This means that you normally have to write much more code in assembly to get what you want done and you have to be much more aware of details in order not to shoot yourself in the foot. However it also means that you have far greater control of every detail in the program.

Sometime this is what you want, (I would say) most times it isn't.
 
It it not how, or in what language an assembler is written.
It's the binary code it produces.
If you code in normal 80x86 mnemonics, and assemble it
using an assembler written in C, it generates nearly the
same code as an assembler written in Pascal.
 
There are several levels of language described as GLs (Generation Lanuage). Each later GL is superior in human terms but further away from the CPU.

1GL - Machine Code - the raw opcodes that the CPU uses these were programmed using data cards like ticker tape into the computer. No preprogrammed functions.

2GL - Assembly - Nmemonics representing the opcodes give a humanised form of the opcodes. No preprogrammed functions.

3GL - Basic,Pascal,C,Fortran,Cobol and the like - each command repesents preprogrammed functions which consist of routines made of opcodes. Sometimes interpreted mostly compiled. More humainsed than a 2GL with alot of user friendly terminology.

4GL - SQL, DB4 - the source code is much like the a written sentance and can be read out loud and understood.

5GL - SET, SNET - a block and line environment where each block represents a neural node of functionality. the lines are paths of execution. this is suited for multi process environments with self learning code.

I still think assembly is the best because you are directly in control of the hardware and processor. For each level of generation you move away from assembly you invite a whole load of code and functionality that you may not require. However, if you require this functionality its best to choose the best suiting language ie if you are writing an assembler the functionality in C maybe best suiting.
"People who have nothing to say, say it too loud and have little knowledge. It's the quiet ones you need to worry about!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top