In this article we will discuss about instruction format of microprocessor. Microprocessor performs a task by executing a program written for that program. Program is a set of instructions script to solve one or more problems. Instructions are the directions which a microprocessor follows to perform a task or part of a task.
The language which a computer understands is a computer language. Broadly computer language are subdivide into two parts. These are high level language and low level language. Low level language is machine specific. It is divided as machine language and assembly language.
Machine language is the only one language which a machine can understand. Instructions in this language are scripts in binary codes as a specific bit pattern. The computer interprets this bit pattern as an instruction to perform a specific task. The entire program is a sequence of the binary numbers. There are some basic problems with this machine language. It is a machine friendly language but not user friendly. Debugging is another problem associates with machine language.
To overcome above problems, programmers develop another way in which instructions are scripts in English alphabets. This new language is known as assembly language. The instruction in this language are termed as mnemonics. As we know that microprocessor can only understand the machine language. So, mnemonics are translated into machine language. Some manually or some by a program known as assembler.
Though assembly language is user friendly but it is still machine dependent. To short out this problem, a programmer develops another language known as high level language. Instructions written in this language are called statements. This language is machine independent. The examples of such language are C, C++, PASCAL, COBOL, and FORTRAN, etc.
In this article we will discuss only Instruction Format. Addressing modes, Instruction set and Instruction code are in later articles.
An instruction (instruction format) is a command to the microprocessor to perform a given task on a particular data. Each instruction (instruction format) is of two parts. One is task to be performed, called the operation code or opcode and the second one is the data to be operated on, called the operand. The operands or data can be specified in different ways. It may include an 8-bit or 16-bit data, an internal register. a memory location, or 8-bit or 16-bit address. In some instructions, the operand is implicit.
Instruction Word Size
The 8085 instruction set is of three groups according to word size:
- One-word or one-byte instructions.
- Two-word or two-byte instructions.
- Three-word or three-byte instructions.
In the 8085 microprocessor, byte and words are synonymous because it is an 8-bit microprocessor. But, instructions are commonly referred to in terms of bytes rather than words.
A one-byte instruction includes a opcode and a operand in the same byte. Operand(s) are internal registers and are in the instruction in form of codes. If there is no numeral present in the instruction then that instruction will be of one-byte, for example, MOV C, A, RAL, and ADD B, etc. Table M.1 shows examples of one-byte instruction.
|Task||Opcode||Operand||Binary Code||Hex code|
|Copy the content of accumulator in|
the register C.
|MOV||C, A||0100 1111||4FH|
|Add the contents of register B to|
the contents of the accumulator.
|Invert each bit in the accumulator.||CMA||None||0010||2FH|
Table M.1 shows the example of one-byte instruction
These instructions are of one-byte performing three different tasks. In the first instruction, operand and registers are specified. In the second instruction, the operand B is specific and the accumulator is not there. Similarly, in the third instruction, the accumulator is assume to be the implicit operand. These instructions are in 8-bit binary format in the memory and each requires one memory location.
In a two-byte instruction, the first byte specifies the operation code and second byte specifies the operand. Source operand is a data byte and immediately following the opcode. If an 8-bit numeral is present in the instruction then that instruction will be of two-byte. Here, the numeral may be a data or an address. For example, in MVI A, 35H and IN 29H, etc. In a two-byte instruction, the first byte will be the opcode and the second byte will be for the numeral present in the instruction.
|Task||Opcode||Operand||Binary code||Hex code|
|Load an 8-bit data byte|
in the accumulator.
| MVI|| A 35H||0011 1110|
|3EH First byte|
35H Second byte
Table M.2 shows the example of two-byte instruction
In a three-byte instruction, the first byte specifies the opcode, and the following two bytes specify the 16-bit operand. The second byte is the low-order operand and the third byte is the high-order operand. If a 16-bit numeral is present in the instruction then that instruction will be of three-byte. Here, the numeral may be a data or an address, for example, in LXI H,3500H and STA 2500H, etc.
|Task||Opcode||Operand||Binary code||Hex code|
|Transfer the program |
sequence to the memory
| JMP|| 2550H||1100 0011|
|C3 First byte|
50 Second byte
25 Third byte
Table M.3 shows the example of three-byte instruction
In the case of microprocessor, the instruction or operation are specified by using specific bit pattern unique for each instruction. These bit patterns contain all the information about operation, register used, memory to. The register and register pair are specified by using certain combination of bits. These combinations of bits are in table below.
Table M.4 shows Bit combination of Registers
|AF or SP||11|
Table M.5 shows Bit combination of Registers
Read also: Microprocessor Introduction