Electronics and Communication Engineering‹›⌂ 0:00 studied

Module 4 · 13 min read · Free chapter

8085 and 8086 microprocessors: architecture, instructions, timing and interrupts

In short

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.

What are you preparing for? We show the practice and previous year questions of your exam.

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 216=65 5362^{16} = 65\,536 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 AD0\text{AD}_0–AD7\text{AD}_7.

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 A8A_8–A15A_{15} 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 S0S_0 and S1S_1, 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, S1S_1, S0S_0
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, 4+3=74 + 3 = 7 T-states. LDA addr is 4+3+3+3=134 + 3 + 3 + 3 = 13 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 7+4N+10(N−1)+7=14N+47 + 4N + 10(N - 1) + 7 = 14N + 4 T-states, because the last JNZ falls through in 7.

Worked example. With N=255N = 255 at 3 MHz, the loop takes 14×255+4=357414 \times 255 + 4 = 3574 T-states, or 3574×0.333 μs≈1.193574 \times 0.333\ \mu\text{s} \approx 1.19 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: 7.5×8=60=3C167.5 \times 8 = 60 = 3\text{C}_{16}. INTR is non-vectored: the processor replies with INTA‾\overline{\text{INTA}} and the device supplies an instruction, usually a one-byte RST n, which vectors to 8n8n.

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 2n2^n locations needs nn address lines; the remaining high lines go to a decoder that enables one chip at a time. For example, an 8 KB chip uses A0A_0–A12A_{12}, and a 3-to-8 decoder on A13A_{13}–A15A_{15} 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 2202^{20} 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:

physical address=segment×16+offset\text{physical address} = \text{segment} \times 16 + \text{offset}

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 20000H+0150H=20150H20000\text{H} + 0150\text{H} = 20150\text{H}. 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 nn is at address 4n4n.

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:

  1. Draw and explain the architecture of the 8085, including the role of ALE and the flag register.
  2. Classify 8085 instructions and addressing modes with examples, and write short programs.
  3. Draw timing diagrams of machine cycles and compute instruction times and delay loops.
  4. 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).

  1. Draw the timing diagram of the instruction MVI A, 45H stored at 2000H, and explain the signals in each T-state. (12 marks)
  2. 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)
  3. 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 6+4+4+10=246 + 4 + 4 + 10 = 24, with the last JNZ taking 7.
  • The total is 10+24N−3=24N+710 + 24N - 3 = 24N + 7 T-states.
  • For 10 ms at 0.333 μs per T-state, about 30 000 T-states are needed, so N≈30 000−724≈1250=04E216N \approx \dfrac{30\,000 - 7}{24} \approx 1250 = 04\text{E}2_{16}.
  • 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.
  • AD0\text{AD}_0–AD7\text{AD}_7 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 14N+414N + 4 T.
  • Interrupts: TRAP 0024H (non-maskable) > RST 7.5 003CH > 6.5 0034H > 5.5 002CH > INTR.
  • 2n2^n-location chip uses nn 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 4n4n.

Check yourself

Exam-style questions on this chapter. Pick an answer to see the explanation. 0 of 12 answered

  1. How much memory can the 8085 address directly?

  2. In the 8085, the ALE signal is used to:

  3. How many flags does the 8085 flag register contain?

  4. The addressing mode of MOV A, M in the 8085 is:

  5. Which 8085 instruction changes a register pair but affects no flags?

  6. LDA 2050H is an instruction of length:

  7. How many T-states does STA 3000H take in the 8085?

  8. The loop MVI C, 0AH; L: DCR C; JNZ L runs on an 8085 at 3 MHz. Its duration is about:

  9. Which 8085 interrupt is non-maskable and has the highest priority?

  10. The vector address of RST 6.5 in the 8085 is:

  11. A 4 KB memory chip is interfaced to the 8085. How many address lines go directly to the chip?

  12. In the 8086, with DS = 3000H and an offset of 1234H, the physical address is:

Previous year questions

Previous year questions for UPSC CSE will appear here once each one is checked word for word against the official question paper.

Learn with AI

A tutor that asks instead of telling, a partner that argues the other side, and this chapter told through your own district.

Tell the tutor what you are stuck on. It will guide you with questions and give the answer after a few tries.

🙋 Raise a doubt or feedback

Stuck somewhere, or spotted a mistake? Write to the ExamHike team. We usually reply within a day, and you will see the reply on My progress.

Log in to ask a doubt or send feedback →

Frequently asked questions

What is the use of ALE in the 8085?

It goes high in the first T-state so an external latch captures the low address byte from AD₀–AD₇ before those pins carry data.

How many T-states does LDA take?

13: an opcode fetch of 4, two memory reads of 3 for the address, and one memory read of 3 for the data.

Which 8085 interrupt is non-maskable?

TRAP, with the highest priority and vector 0024H; RST 7.5, 6.5, 5.5 and INTR can all be masked or disabled.

How does the 8086 form a 20-bit address?

It shifts a 16-bit segment register left by four bits (multiplies by 16) and adds a 16-bit offset, so CS = 2000H and IP = 0150H give 20150H.

More in this module: Microprocessors and computer organisation

Official sources

Facts in this chapter were checked against these official sources.

  1. UPSC Civil Services Examination 2026 notice, Electrical Engineering optional, Paper II
  2. NPTEL Microprocessors and Microcontrollers (IIT Kharagpur, 108105102): 8085 and 8086 architecture, programming and interfacing