Thursday, September 8, 2016

Comparison of High Level Language, Assembly Language and Machine Language

Relation between Assembly Language and Machine Language

Assembly Language

Machine Language

Assembly language is a numeric language. It is only understood by the systems CPU.

All processors understand same machine language e.g. x86 processors.

It has mnemonics like add, mov, etc.

Every machine language instruction corresponds to the single assembly language instruction.

Table 1.2 relation between AL and ML

Differences between High Level languages and Assembly Language | High Level Language vs Assembly Language

Assembly language is different from higher level languages like java, C++, etc. in many ways, let’s discuss them one by one:

  1. High level languages like java, C++, etc. have one to many relationship with machine code and assembly language. One statement of java or C++ expands into many assembly language commands.
  2. For Example: we have following two instructions in C++ and when they are converted in assembly language, number of instructions is 5. So, there is a one to many relationship for the high level languages with the assembly language.

    C++ code

    Assembly code

    Int varY;
    Int varX = (varY + 14) * 13;

    mov edx, vary
    add edx,14
    mov ecx,13
    imul ecx
    mov varX,edx

    Table 1.2 C++ and assembly language difference

  3. Programs written using high level languages like c#, etc. have the ability to run on just any computer but the assembly language is written for that exact processor family.
  4. High level language is converted into assembly language and then into machine code as shown below in the diagram.
  5. assembly language vs high level language

  6. Assembly language can control the machine code better as compared to high level languages.
  7. Manipulation of bits is easier in assembly language as compared to high level languages.
  8. Assembly language can access any memory but the high level languages can’t.
  9. As high level languages are structures, so they are easy to maintain as compared to assembly language.
  10. In high level languages the executable code is huge and hence it sometimes not efficient. But the assembly language is more efficient as it has smaller executable code.
  11. The assembly language programmer must know about the hardware such as registers, etc. but the high level language programmer doesn’t need to know such kind of stuff.
  12. In assembly language we deal with the pointers at the physical level but in the high level languages the pointers details are hidden.

Applications of Assembly Language | Advantages of Assembly Language

There are number of applications of assembly language:
Different programming languages are used to make different applications or sometimes a part of the application. There are few applications like: hardware interface, device drivers, etc. are written using assembly. But the scientific, commercial, etc. applications are written more efficiently in high level languages. Following are the various applications that are made using assembly language. Hence, it is used:

  1. For writing business apps. Which are used at single/multiple organization platforms.
  2. For drivers which are used in hardware devices like: VGA drivers etc. as they have to effect directly to the computer’s hardware.
  3. In developing games played on computer systems. As, they have to utilize specific amount of memory to deal with a specific event.
  4. Also for embedded systems.
  5. In bios of the system for boot code.

Assembly Language favored over High Level Languages

Assembly Language is favored over a lot of applications as compared to high level languages. Following are the few examples of it:

Hardware device drivers

While writing programs for the drivers of the systems (hardware devices) assembly language is preferred as the assembly can directly access the hardware. As the programs for the drivers are short hence they are fast and effective.

Embedded Systems

Embedded system programs should be written in assembly language so that the program could run fast.

Computer Games

Games require some specific amount of memory locations and the direct access to the computer’s hardware which is provided by the assembly language but not by the high level languages.


No comments :

Post a Comment

Note: Only a member of this blog may post a comment.

Copyright 2017. All Rights Reserved. Privacy Policy / Terms And Conditions / Sitemap / Contact