Module 4 · 13 min read · Free chapter
8085 and 8086 microprocessors: architecture, instructions, timing and interrupts
The 8085 is an 8-bit processor with a 16-bit address bus (64 KB), five flags and multiplexed AD₀–AD₇ split by ALE. Instructions take T-states: opcode fetch 4, memory read or write 3, so MVI takes 7. Its interrupts run from TRAP (0024H, non-maskable) down to INTR. The 16-bit 8086 reaches 1 MB with segment × 16 + offset.
Start from zero: a computer on a chip
A microprocessor is the central processing unit of a computer built on a single chip. It fetches instructions from memory, decodes them and executes them, one after another. It talks to memory and input/output devices over three sets of wires: the address bus, the data bus and the control bus.
Intel's 8085 of 1976 was an 8-bit processor that ran on a single +5 V supply. It became the standard teaching processor in India and is still used in laboratory kits. The 8086 of 1978 was a 16-bit processor whose instruction set grew into the x86 family that runs most laptops today.
This chapter covers the 8085's architecture, instructions and addressing modes, timing diagrams and delay loops, interrupts and interfacing. It then compares the 8086, with its segmented memory and instruction queue.
The general ideas of addressing modes, data paths and pipelining are treated for computer science in computer organisation. Here the focus is on the actual chips that exams name.
Why it matters. 8085 timing, interrupt vectors and addressing modes are steady questions in ESE, RRB JE and state AE papers, and the UPSC Electrical optional lists the whole topic.
8085 architecture and pins
The 8085 has an 8-bit data bus and a 16-bit address bus, so it can address bytes, that is 64 KB. To save pins on its 40-pin package, the lower 8 address lines share pins with the data bus as –.
In the first clock period of each machine cycle these pins carry the low address byte, and the ALE (address latch enable) signal goes high. An external latch such as the 74LS373 captures the address on ALE's falling edge, freeing the pins to carry data for the rest of the cycle. The upper address byte – has its own pins.
The programmer sees these registers:
- Accumulator A, the 8-bit register used in almost every arithmetic and logic operation.
- Six 8-bit general registers B, C, D, E, H and L, usable as 16-bit pairs BC, DE and HL; HL usually holds a memory address.
- A 16-bit stack pointer (SP) and program counter (PC).
- A flag register with five flags: Sign (S), Zero (Z), Auxiliary Carry (AC), Parity (P) and Carry (CY).
The ALU works on the accumulator and a temporary register, and the flags record the result. Z is set when the result is zero, CY on a carry or borrow out of bit 7, P when the result has an even number of 1s, S when bit 7 is 1, and AC on a carry from bit 3 to bit 4 for BCD arithmetic.
Key control pins are RD and WR (active low), IO/M (high for I/O, low for memory), status lines and , READY for slow memories, and HOLD/HLDA for direct memory access. A 6 MHz crystal is divided by 2 inside, giving a 3 MHz operating clock.
Why it matters. Bus widths, memory size, the five flags and the role of ALE are among the most asked 8085 one-markers.
Instructions and addressing modes
An 8085 instruction has a one-byte opcode, sometimes followed by one or two bytes of data or address. So instructions are 1, 2 or 3 bytes long. A 16-bit value is stored low byte first, so LDA 2050H is stored as 3A, 50, 20.
Instructions fall into five groups:
- Data transfer: MOV, MVI, LDA, STA, LXI, LHLD, SHLD, XCHG, IN, OUT. These do not change flags.
- Arithmetic: ADD, ADI, ADC, SUB, SUI, SBB, INR, DCR, INX, DCX, DAD, DAA.
- Logical: ANA, ORA, XRA, CMP, CMA, RLC, RRC, RAL, RAR.
- Branch: JMP, conditional jumps (JZ, JNZ, JC, JNC and others), CALL, RET, RST.
- Machine control: HLT, NOP, EI, DI, SIM, RIM.
The addressing mode says where the operand is:
- Immediate: the data is in the instruction, as in MVI A, 32H.
- Register: the data is in a register, as in MOV A, B.
- Direct: the instruction gives the memory address, as in LDA 2050H.
- Register indirect: a register pair holds the address, as in MOV A, M (address in HL) or LDAX B.
- Implied (implicit): the operand is understood, as in CMA, which complements A.
Worked example. A program adds the bytes at 2050H and 2051H and stores the sum at 2052H: LXI H, 2050H; MOV A, M; INX H; ADD M; INX H; MOV M, A; HLT. It uses immediate, register indirect and implied modes, and ADD M sets CY if the sum exceeds FFH.
Why it matters. "Identify the addressing mode", instruction byte counts and the flags an instruction affects are classic one-mark questions.
Machine cycles, timing diagrams and delay loops
Every instruction is carried out in one or more machine cycles, each a single bus operation. Each machine cycle lasts a few T-states, where one T-state is one clock period. At 3 MHz a T-state is about 0.333 μs.
The basic machine cycles and their lengths are:
| Machine cycle | T-states | IO/M, , |
|---|---|---|
| Opcode fetch | 4 (6 for some) | 0, 1, 1 |
| Memory read | 3 | 0, 1, 0 |
| Memory write | 3 | 0, 0, 1 |
| I/O read | 3 | 1, 1, 0 |
| I/O write | 3 | 1, 0, 1 |
In an opcode fetch, T1 puts the PC on the address bus with ALE high, T2 and T3 read the opcode with RD low, and T4 decodes it. Instructions such as INX, DCX, PUSH and CALL need an extra two T-states in the fetch for internal 16-bit work.
Adding the cycles gives an instruction's time. MVI A, data is an opcode fetch plus one memory read, T-states. LDA addr is T-states. A conditional jump such as JNZ takes 10 T-states when it jumps and 7 when it does not, because it skips reading the second address byte.
A delay loop wastes a known number of T-states:
MVI C, N; LOOP: DCR C; JNZ LOOP
Its total is T-states, because the last JNZ falls through in 7.
Worked example. With at 3 MHz, the loop takes T-states, or ms. A longer delay nests one loop inside another, or uses a 16-bit register pair counted down with DCX and tested with an OR.
Why it matters. Counting T-states and computing loop delays is the most common 8085 numerical in ESE and AE papers.
Stack, interrupts and interfacing
The stack is an area of memory used last-in, first-out. PUSH rp decrements SP by 2 and stores a register pair; POP reverses it. CALL pushes the return address and jumps; RET pops it back into PC. SP is usually loaded near the top of RAM with LXI SP, because the stack grows downwards.
An interrupt lets a device stop the program, get service and let it resume. The 8085 has five hardware interrupts, listed from highest priority:
| Interrupt | Vector | Triggering | Maskable? |
|---|---|---|---|
| TRAP | 0024H | edge and level | no |
| RST 7.5 | 003CH | rising edge | yes |
| RST 6.5 | 0034H | level | yes |
| RST 5.5 | 002CH | level | yes |
| INTR | from device | level | yes |
The vectored interrupts jump to fixed addresses, eight times their number: . INTR is non-vectored: the processor replies with and the device supplies an instruction, usually a one-byte RST n, which vectors to .
EI and DI enable and disable all maskable interrupts. SIM sets individual masks for RST 5.5, 6.5 and 7.5 and can reset the 7.5 latch; RIM reads the masks and pending interrupts. TRAP cannot be masked and is used for power-fail alarms.
Memory interfacing connects chips into the 64 KB space. A chip with locations needs address lines; the remaining high lines go to a decoder that enables one chip at a time. For example, an 8 KB chip uses –, and a 3-to-8 decoder on – can select eight such chips.
For devices, I/O-mapped I/O uses IN and OUT with an 8-bit port address, giving 256 input and 256 output ports and IO/M = 1. Memory-mapped I/O gives devices memory addresses, so every memory instruction works on them but they use up memory space. Programmable peripheral chips such as the 8255 parallel port, 8253/8254 timer, 8259 interrupt controller and 8237 DMA controller extend the system.
Why it matters. Interrupt priorities, vector addresses, SIM/RIM and the number of address lines for a memory chip are standard questions.
The 8086: segmentation and the instruction queue
The 8086 is a 16-bit processor: its registers and data bus are 16 bits wide. Its address bus has 20 bits, reaching bytes, that is 1 MB. Since no register is 20 bits wide, the 8086 builds addresses by segmentation.
Memory is viewed as segments of up to 64 KB. A 16-bit segment register gives the segment's start, shifted left four bits, and a 16-bit offset gives the position within it:
There are four segment registers: CS (code, used with IP), DS (data), SS (stack, used with SP and BP) and ES (extra, used by string instructions).
Worked example. With CS = 2000H and IP = 0150H, the next instruction is fetched from . The same physical address can be reached by other segment–offset pairs, such as 2010H:0050H.
Inside, the 8086 is split into two units that work in parallel. The bus interface unit (BIU) holds the segment registers, IP and an address adder, and keeps a 6-byte instruction queue filled by prefetching code. The execution unit (EU) decodes and executes instructions from the queue using the general registers and ALU. This overlap of fetch and execute is an early form of pipelining.
The general registers are AX, BX, CX and DX (each splits into 8-bit halves such as AH and AL), plus SP, BP, SI and DI. There are nine flags: six status flags (CF, PF, AF, ZF, SF, OF) and three control flags, TF (trap, for single-stepping), DF (direction, for string operations) and IF (interrupt enable).
The 8086 runs in minimum mode for a single-processor system, generating bus control signals itself, or maximum mode for multiprocessor systems with an 8288 bus controller and a coprocessor such as the 8087. Its interrupt vector table fills the first 1 KB of memory, 00000H to 003FFH, with 256 four-byte entries; type is at address .
Why it matters. Physical-address calculation, the BIU–EU split and the 8086 versus 8085 comparison are regular ESE and AE questions.
Descriptive lens
Written papers ask about this topic in four ways:
- Draw and explain the architecture of the 8085, including the role of ALE and the flag register.
- Classify 8085 instructions and addressing modes with examples, and write short programs.
- Draw timing diagrams of machine cycles and compute instruction times and delay loops.
- Explain 8085 interrupts and memory or I/O interfacing, and compare the 8085 with the 8086, including segmentation and the instruction queue.
Practice questions (our own, not previous-year questions).
- Draw the timing diagram of the instruction MVI A, 45H stored at 2000H, and explain the signals in each T-state. (12 marks)
- Write an 8085 program to generate a delay of about 10 ms using a 16-bit register pair, with a 3 MHz clock. Show the T-state count. (15 marks)
- Explain the interrupt structure of the 8085. How does the INTR interrupt differ from RST 7.5? (10 marks)
Answer plan for question 2.
- Use LXI B, N; LOOP: DCX B; MOV A, C; ORA B; JNZ LOOP, because DCX does not set the zero flag.
- Count T-states: LXI is 10, and each pass costs , with the last JNZ taking 7.
- The total is T-states.
- For 10 ms at 0.333 μs per T-state, about 30 000 T-states are needed, so .
- Note that the actual delay shifts slightly with the exact clock, and nested 8-bit loops are an alternative.
Quick revision
- 8085: 8-bit data, 16-bit address (64 KB), +5 V, 3 MHz from a 6 MHz crystal, 40 pins.
- – multiplexed; ALE latches the low address byte.
- Registers A, BC, DE, HL, SP, PC; five flags S, Z, AC, P, CY.
- Instructions are 1, 2 or 3 bytes; five groups; data transfer leaves flags alone.
- Modes: immediate, register, direct, register indirect, implied.
- Opcode fetch 4 T (6 for some), memory and I/O read or write 3 T each.
- MVI 7 T, LDA/STA 13 T, JNZ 10 T taken or 7 T not; loop MVI–DCR–JNZ is T.
- Interrupts: TRAP 0024H (non-maskable) > RST 7.5 003CH > 6.5 0034H > 5.5 002CH > INTR.
- -location chip uses address lines; I/O-mapped gives 256 ports.
- 8086: 16-bit, 20-bit address (1 MB), physical = segment × 16 + offset, 6-byte queue, nine flags, vectors at .