The addressing modes in 8085 Microprocessor are the ways in which it accesses memory or registers to retrieve or store data during processing. Before moving to topic, let’s see instruction and word size.
- An instruction is a command to the microprocessor to perform a given task on a specified data.
- Each instruction has two parts: one is task to be performed, called the operation code (opcode), and the second is the data to be operated on, called the operand.
- The operand (or data) can be specified in various ways. It may include 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 in 8085
The 8085-instruction set is classified into the following three groups according to word size:
- One-word or 1-byte instructions
- Two-word or 2-byte instructions
- Three-word or 3-byte instructions
In the 8085, “byte” and “word” are synonymous because it is an 8-bit microprocessor. However, instructions are commonly referred to in terms of bytes rather than words.
A 1-byte instruction includes the opcode and operand in the same byte. Operand(s) are internal register and are coded into the instruction.
MOV rd, rs
rd ← rs copies contents of rs into rd.
Coded as 01111000 = 78H = 170 octal (octal was used extensively in instruction design of such processors).
A ← A + r
In a two-byte instruction, the first byte specifies the operation code and the second byte specifies the operand. Source operand is a data byte immediately following the opcode.
r ← data
Example: MVI A,30H
coded as 3EH 30H as two contiguous bytes. This is an example of immediate addressing.
A ← A + data
In a three-byte instruction, the first byte specifies the opcode, and the following two bytes specify the 16-bit address.
Note that the second byte is the low-order address and the third byte is the high-order address.
opcode + data byte + data byte
LXI rp, data16
rp is one of the pairs of registers B-C, D-E, H-L used as 16-bit registers. The two data bytes are 16-bit data in L-H order of significance.
rp ← data16
LXI H,0520H coded as 21H 20H 50H in three bytes. This is also immediate addressing.
Addressing Modes in 8085 Microprocessor
- Every instruction of a program has to operate on a data.
- The method of specifying the data to be operated by the instruction is called Addressing. and its addressing modes are the ways in which it accesses memory or registers to retrieve or store data during processing.
- The 8085 has the following 5 different types of addressing.
- Immediate Addressing
- Direct Addressing
- Register Addressing
- Register Indirect Addressing
- Implicit Addressing
- In immediate addressing mode, the data is specified in the instruction itself. The data will be a part of the program instruction.
- EX. MVI B, 3EH – Move the data 3EH given in the instruction to B register; LXI SP, 2700H.
- In direct addressing mode, the address of the data is specified in the instruction. The data will be in memory.
- In this addressing mode, the program instructions and data can be stored in different memory.
- EX. LDA 1050H – Load the data available in memory location 1050H in to accumulator; SHLD 3000H
- In this addressing mode, the operand is in one of the registers of the microprocessor. In register addressing mode, the instruction specifies the name of the register in which the data is available.
- EX. MOV A, B – Move the content of B register to A register; SPHL; ADD C.
Register Indirect Addressing:
- In register indirect addressing mode, the instruction specifies the name of the register in which the address of the data is available. Here the data will be in memory and the address will be in the register pair.
- EX. MOV A, M – The memory data addressed by H L pair is moved to A register. LDAX B.
In implied addressing mode, the instruction itself specifies the data to be operated.
CMA – Complement the content of accumulator; RAL