Wednesday, 30 May 2018

Machine Language - Machine Language Of Microprocessors

Machine Language - Machine Language Of Microprocessors!!! 



Machine Language


• The number of bits that form the “word” of a  Microprocessor is fixed for that particular  processor.
– These bits define a maximum number of combinations.
• For example an 8-bit Microprocessor can have at most 28 = 256 different combinations.





• However, in most Microprocessors, not all of these combinations are used.
– Certain patterns are chosen and assigned specific meanings.
– Each of these patterns forms an instruction for the microprocessor.
– The complete set of patterns makes up the Microprocessor’s machine language.


The 8085 Machine Language


• The 8085 (from Intel) is an 8-bit microprocessor.
– The 8085 uses a total of 246 bit patterns to form its instruction set.
– These 246 patterns represent only 74 instructions.
• The reason for the difference is that some (actually most) instructions have multiple different formats.
– Because it is very difficult to enter the bit patterns correctly, they are usually entered in hexadecimal instead of binary.
• For example, the combination 0011 1100 which translates into “increment the number in the register called the accumulator”,  is usually entered as 3C.



Assembly Language


• Entering the instructions using hexadecimal is quite  easier than entering the binary combinations.
– However, it still is difficult to understand what a program  written in hexadecimal does.
– So, each company defines a symbolic code for the instructions.
– These codes are called “mnemonics”.
– The mnemonic for each instruction is usually a group of  letters that suggest the operation performed.


• Using the same example from before,
– 00111100 translates to 3C in hexadecimal (OPCODE)
– Its mnemonic is: “INR A”.
– INR stands for “increment register” and A is short for  accumulator.
• Another example is: 1000 0000,
– Which translates to 80 in hexadecimal.
– Its mnemonic is “ADD B”.
– “Add register B to the accumulator and keep the result in the
accumulator”.




• It is important to remember that a machine  language and its associated assembly language are completely machine dependent.
– In other words, they are not transferable from one  microprocessor to a different one.
• For example, Motorolla has an 8-bit
microprocessor called the 6800.
– The 8085 machine language is very different from that  of the 6800. So is the assembly language.
– A program written for the 8085 cannot be executed on  the 6800 and vice versa.

Assembling” The Program


• How does assembly language get translated into  machine language?
– There are two ways:
– 1st there is “hand assembly”.
• The programmer translates each assembly language instruction  into its equivalent hexadecimal code (machine language). Then  the hexadecimal code is entered into memory.
– The other possibility is a program called an  “assembler”, which does the translation automatically.

0 comments: