8085 instructions and programming.
An instruction is a command given to the Microprocessor to perform a particular task on particular data .
Example move a,b
It is a binary pattern design inside the Microprocessor to perform particular process. Any instructions consist of two parts.
1 op Code.
2 data or operand.
Which specifies the data to be operated
For ex:– mov C,A.
In this instruction we are trying to copy the contents of accumulator register to register C this instruction has two parts that is move and C,A
1st part mov is called op. code which specifies that data is to move
2nd part that is C,A is called the operands that is data of A register to be copied to C register. The binary code for this instruction is 4FH that is 01001111(binary form) available from 8085 set. Which is converted into hexadecimal that is 4FH.
Instruction and data format in8085 :– 8085 is a 8 bit Microprocessor that means it can handle 8 bits of data also the memory location of 8085 is designed to have 8 bit data. If a 16 bit data is to be stored it is stored in either following ways:–
1. By using a pair of register where each register can hold 8 bit data BC,DE,HL
2. It can be also be stored into consecutive memory location pointed by HL pair register.
3. In some instructions only one register is specified the content of that register is one of the operand but the other operand is accumulator.
Types of instruction:–
1–1byte instructions
2–2byte instructions
3–3byte instructions
Depending upon the length of the machine code of the instructions
The instructions can be classified into 3 types.
1. 1byte instruction :– one byte instruction include the operation code and the operand in the same byte that is 8 bits so the length if the machine code for such instructions is of one byte.
Examples:– of these types of instruction
Mov C,A mov is the op code and C,A is operands and the machine code is 01001111.
ADD B ,A
A=A+B
AND machine code is 80H and in binary 10000000.
CMA compliments of accumulator register.
Op code is CMA and operands is null
And machine code is 2FH and binary is 00101111.
2. 2byte instructions:– In a two byte instruction the 1 st byte specifics the op cod e and 2nd bit is operands which consist of 8 bits and or 8bits for address
For examples:– MVI A,324 (MOVE IMMEDIATE) in this instruction the op code is MVI which is of 8 bits. And operands which contains 8 bit data.
Example IN 02 (input ,read)
Opcode is IN and operands is 02.
3. 3 byte instructions :– in the 2 byte instruction the 1st byte specifies the op code whereas 2nd and 3rd specifies 16 bit data.
For example:-JMP 2050
In this instruction the op code is JMP abd the operands is 2050 that meand the machine code consist of 3 byte 1st byte represents the op code and 2nd and 3rd byte represents address. 50 is higher bits then 20
Addressing modes:–
Data which is to be operated is stored in the memory location or successive memory locations each instructions required certain data for its operation. There are various techniques to specify the addresses of data. These techniques are called addressing modes.
8085 has following the addressing modes
1. immediate addressing modes.
2. register addressing modes
3. direct addressing modes
4. indirect addressing modes
5. implicit addressing modes
1. Immediate addressing modes :– in this mode the e data is specified in the instruction itself but the data can be of 8 bits or 16 bits. The data is contained in the memory bytes following the op code byte instruction. The op code byte instruction with letter I (immediate) fall under this category along with the operand/data which can be of 8 bit or 16 bits. This type of instructions can be of 2 bytes or 3 bytes.
Example:– MVI A, 05H
2. Register addressing modes:– in this mode the instruction specifies the general purpose register in which the data is located that is data to be loaded stored in the registers rather than memory. In this addresses mode is op code ,destination register and source register. Due to this addressing mode there is faster execution. Instruction in this mode generally 1 byte.
Example:– MOV A,B in which op code is MOV and operands are A,B and it is of 1 byte.
ADD B
3. Direct addressing mode:-– in this mode the address where data is found is specified directly the 2nd and 3rd byte may contain the memory address. These type of instructions are generally of 3bytes or 2 bytes
Example:– STA 2400H (STORE ACCUMULATOR).
In this instruction it will store the content of accumulator in the memory location whose address is 2400H
IN 02 Reads the contents of input port.
4. Indirect addressing mode:– In this mode the memory address is specified indirectly by the content of register pair
The example of
LDAX B 2400H
In this instruction we will move the content of memory location whose address is contents of BC register pair to the accumulator in this instruction the data specifies indirectly in the BC register pair.
5.Implicit addressing modes :– In some instructions operands is fixed or need not to be specified the addressing mode for this is known as implicit a
Example :– CMA (COMPLIMENT ACCUMULATOR)
CMA IN THIS OP code is CMA and operand is null this instruction means compliment the contents of accumulator.