views:

106

answers:

3

What's the relationship between machine language and assembly language programming?

+1  A: 

Both are implementation-specific and deal with the individual instructions to the processor, but machine-code is slightly lower level, represented to the human programmer as a series of numbers, and almost always in pure binary.

Assembly, on the other hand, is written symbolically, not in pure binary. It is designed to be read by the human programmer and then converted to machine code binary, but still works with individual instructions.

Wikipedia sums it up well:

A much more readable rendition of machine language, called assembly language, uses mnemonic codes to refer to machine code instructions, rather than simply using the instructions' numeric values. For example, on the Zilog Z80 processor, the machine code 00000101, which causes the CPU to decrement the B processor register, would be represented in assembly language as DEC B.

Spencer Nelson
+4  A: 

Assembly language was invented to make it easier for humans to write machine language.

Assembly language:

MOV AX,1

Machine language:

B8 01 00    ; B8 = copy two bytes into AX   0001 = value to copy

Notice that the assembly language hides turning 0100 into 0001 - this processor is "little endian"

An important difference is that Assembly language offers labels:

JMP next_thing

Machine language:

EB FC         ; EB = jump, FC = current address - 4 bytes

Before assembly, you had to calculate the jump offset by hand.

egrunin
A: 

Assembly language is a human-readable representation for machine language.

Stephen Canon