Loading

Kategory:

Understanding Processor Architecture: Machine and Assembly Language

Bookmark and Share
The processor understands only the machine language, whose instructions consist of strings of 1s and 0s. Machine language is closely related to the assembly language. We prefer to use the assembly language rather than the machine language. Programming in the assembly language also requires knowledge about the processor architecture.

Assembly language programming is referred to low-level programming because each assembly language instruction performs a much lower-level task compared to an instruction in a high-level language. Assembly language instructions are processor specification dependents. For example, a program written in the Intel assembly language cannot be executed on the PowerPC processor.

Here are some IA-32 assembly language examples:
inc result
mov class_size, 45
and mask1, 128
add marks, 10

The first instruction increments the variable result. This assembly language instruction is equivalent to
result++;

in C. The second instruction initializes class_size to 45. The equivalent statement in C is

class_size = 45;

The third instruction performs the bitwise and operation on mask1 and can be expressed in C as

mask1 = mask1 & 128;

The last instruction updates marks by adding 10. In C, this is equivalent to
marks = marks + 10;

We can translate the assembly language instructions to the equivalent machine language instructions. Machine language instructions are written in the hexadecimal number system. Here are some IA-32 machine language examples:

Thanks for reading: Understanding Processor Architecture: Machine and Assembly Language
Related Posts Plugin for WordPress, Blogger...