1. Gyanastra
  2. Computer Organisation and Architecture
  3. UGC NET: Microprocessors: 8085 and 8086
  4. 8085 Architecture and Programming
Free lesson, no account needed 10 min read 8 practice questions after it
Asked in past papers6 times
  • ISRO20112008
  • UGC NET2017201620152014

Computer Organisation and Architecture · UGC NET: Microprocessors: 8085 and 8086

8085 Architecture and Programming

Overview

The Intel 8085 is an 8-bit general-purpose microprocessor that improved on the 8080 by using a single +5 V supply and a multiplexed address/data bus.
In UGC NET Computer Science, this topic tests the fixed architecture numbers, register and flag behaviour, and the ability to trace short assembly-language programs.
It sits in the computer organisation and architecture area, and assumes you already know binary and hexadecimal arithmetic, basic logic gates, and the idea of stored-program execution.
The exam expects precise factual recall plus careful step-by-step execution of 8085 instructions.

Key concepts

  • 8085 is an 8-bit NMOS microprocessor. “8-bit” means the ALU, data bus, and accumulator are each 8 bits wide.
  • Address bus is 16 bits (A15A_{15}–A0A_0), so it directly addresses 216=65,5362^{16}=65{,}536 bytes = 64 KB of memory.
  • Data bus is 8 bits (D7D_7–D0D_0) and bidirectional. The lower address bits AD0AD_0–AD7AD_7 are multiplexed with the data bus.
  • Power supply: single +5 V DC. Clock frequency is typically 3 MHz (maximum about 3.03 MHz).
  • Registers: Accumulator A (8-bit), general-purpose B, C, D, E, H, L (8-bit each; pairs BC, DE, HL), Program Counter PC (16-bit), Stack Pointer SP (16-bit), Instruction Register IR (8-bit), and flags S, Z, AC, P, CY.
  • Flags:
    • S (Sign): equals the MSB of the result.
    • Z (Zero): 1 if the result is zero.
    • AC (Auxiliary Carry): carry from bit 3 to bit 4.
    • P (Parity): 1 if the result has an even number of 1s.
    • CY (Carry): carry out of bit 7 in addition, or borrow in subtraction.
  • ALU performs 8-bit arithmetic and logical operations.
    The processing unit contains the ALU; the instruction unit contains the instruction register, decoder, and timing-and-control logic; the storage and interface unit contains general-purpose registers and memory/I/O interfaces.
  • Interrupts: TRAP (non-maskable, highest priority), RST 7.5, RST 6.5, RST 5.5, and INTR. Serial input/output uses SID and SOD.
  • Addressing modes: immediate (MVI), register (MOV A,B), direct (LDA addr), indirect (MOV A,M), and implied (CMA).
  • Instruction sizes: 1-byte (MOV, ADD, INR), 2-byte (MVI, ADI, OUT), 3-byte (LXI, LDA, JMP).
  • DAD rp performs 16-bit addition: HL←HL+rpHL \leftarrow HL + rp, where rp is BC (DAD B), DE (DAD D), HL (DAD H), or SP (DAD SP). Only CY is affected.
  • OUT port sends the accumulator A to an 8-bit output port. IN port reads an input port into A.
  • INR/DCR affect S, Z, P, AC but do not affect CY.
  • Logical instructions ANA, ORA, XRA clear CY; S, Z, P are affected and AC is undefined.
  • Rotate instructions RLC, RRC, RAL, RAR affect only the CY flag.

How it works

The 8085 follows the stored-program instruction cycle:

  1. PC holds the address of the next instruction. The CPU places this address on the address bus and reads the opcode from memory into the instruction register.
  2. The instruction decoder interprets the opcode. If the instruction needs additional bytes (operand), the CPU fetches them and increments PC accordingly.
  3. The ALU or register-transfer path executes the operation. Results are written to the specified register or memory, and the flags are updated according to the instruction type.
  4. PC is incremented to the next instruction, unless a jump or call changes it.

For 8-bit addition, let the accumulator be AA and the operand be xx. The CPU computes A+xA+x, stores the lower 8 bits in A, and sets:

  • CY = 1 if A+x>255A+x>255;
  • Z = 1 if the lower 8 bits are zero;
  • S = bit 7 of the result;
  • AC = 1 if there is a carry from bit 3 to bit 4;
  • P = 1 if the result has an even number of 1s.

For subtraction, A←A−xA \leftarrow A-x. CY becomes 1 if a borrow occurs, i.e. if A<xA<x. The other flags follow the 8-bit result.

A common loop uses DCX B, MOV A,B, ORA C, JNZ. DCX B decrements the 16-bit pair BC. ORA C sets A to B ∣ CB \,\vert\, C, so Z becomes 1 only when BC = 0000H. Hence the loop body runs as many times as the initial value of BC, provided BC starts non-zero.

DAD is the only 16-bit addition instruction in the basic 8085 set. It adds a register pair to HL and stores the result in HL. Thus DAD H doubles HL, while DAD D computes HL = HL + DE.

OUT port transfers only the accumulator to the port. Other registers are not sent unless they have been copied into A first.

Figure. Notice how the CPU connects through the 8-bit data bus and 16-bit address bus to 64 KB memory and 256 I/O ports. The timing and control unit links to the instruction register decoder, while the ALU and register array support execution.

Formulas

  • Memory address space: 216=655362^{16}=65536 bytes = 64 KB.
  • I/O port space: 28=2562^8=256 input and 256 output ports.
  • 8-bit addition: A←(A+x) mod 256A \leftarrow (A+x) \bmod 256; CY=1CY=1 if A+x>255A+x>255.
  • Zero flag: Z=1Z=1 iff result =0=0.
  • Sign flag: S=1S=1 iff bit 7 of result =1=1.
  • Parity: P=1P=1 iff the number of 1s in the result is even.
  • Auxiliary carry: AC=1AC=1 iff carry from bit 3 to bit 4 occurs.
  • DAD: HL←(HL+rp) mod 65536HL \leftarrow (HL+rp) \bmod 65536; CY=1CY=1 if HL+rp>65535HL+rp>65535.
  • 8-bit subtraction: A←(A−x) mod 256A \leftarrow (A-x) \bmod 256; CY=1CY=1 if A<xA<x (borrow).

Worked examples

Example 1 (addition and flags). Add 87H87_H and 79H79_H in the 8085.
87H=1000 0111287_H=1000\,0111_2, 79H=0111 1001279_H=0111\,1001_2. Sum:
1000 0111+0111 1001=1 0000 00002=100H1000\,0111 + 0111\,1001 = 1\,0000\,0000_2 = 100_H.
The lower 8 bits are 00H00_H, so A = 00H00_H. CY = 1. Z = 1 because the result is zero. S = 0 because bit 7 is 0. AC = 1 because the lower nibbles 7+9=167+9=16 produce a carry from bit 3 to bit 4. The result 00H00_H has zero 1s, which is even, so P = 1. Final flags: S=0, Z=1, AC=1, P=1, CY=1.

Example 2 (program trace with loop).

MVI A,42H
MVI B,05H
LOP: ADD B
DCR B
JNZ LOP
ADI 25H
HLT

Trace: initially A=42H42_H, B=05H05_H.

IterationB before ADDA before ADDA after ADDB after DCRJNZ taken?
105H42H47H04Hyes
204H47H4BH03Hyes
303H4BH4EH02Hyes
402H4EH50H01Hyes
501H50H51H00Hno

After the loop A=51H51_H. Then ADI 25H gives 51H+25H=76H51_H+25_H=76_H. Final accumulator = 76H.

Example 3 (output port).

MVI B,82H
MOV A,B
MOV C,A
MVI D,37H
OUT PORT1
HLT

MVI B,82H sets B=82H82_H. MOV A,B copies 82H82_H to A. MOV C,A copies 82H82_H to C. MVI D,37H sets D=37H37_H. OUT PORT1 sends the contents of A to PORT1. Therefore the output at PORT1 is 82H. The value 37H37_H in D is not sent.

Example 4 (loop count).

LXI B,0007H
LOP: DCX B
MOV A,B
ORA C
JNZ LOP

Initially BC=0007H0007_H. Each iteration decrements BC by 1 with DCX B. MOV A,B and ORA C set A to B∨CB \lor C. When BC becomes 0000H0000_H, both B and C are zero, so A=0, Z=1, and JNZ is not taken. Starting from 7, the loop body executes 7 times: after the 7th decrement BC becomes 0.

Comparison

ComponentSizeRole
Data bus8 bitsTransfers one byte at a time
Address bus16 bitsAddresses 64 KB memory
Accumulator8 bitsMain arithmetic register; source for OUT
ALU8 bitsPerforms 8-bit arithmetic and logic
Program Counter16 bitsHolds next instruction address
Stack Pointer16 bitsPoints to top of stack
General registers6 × 8 bitsB, C, D, E, H, L
Flags5 bitsS, Z, AC, P, CY
InstructionOperation
DAD BHL = HL + BC
DAD DHL = HL + DE
DAD HHL = HL + HL
DAD SPHL = HL + SP
Instruction typeCYSZPAC
ADD/SUB/ADI/SUIaffectedaffectedaffectedaffectedaffected
INR/DCRnot affectedaffectedaffectedaffectedaffected
ANA/ORA/XRAclearedaffectedaffectedaffectedundefined
DADaffectednot affectednot affectednot affectednot affected
RLC/RRC/RAL/RARaffectednot affectednot affectednot affectednot affected

Revision summary

  • 8085 has an 8-bit ALU, 8-bit data bus, 16-bit address bus, and single +5 V supply.
  • Memory space is 64 KB; I/O space is 256 ports.
  • OUT sends only the accumulator; IN reads only into the accumulator.
  • DAD H performs HL = HL + HL; DAD D performs HL = HL + DE.
  • INR and DCR never change CY; logical instructions clear CY.
  • XRA A makes A=0, Z=1, P=1, CY=0.
  • A loop with DCX B, ORA C, JNZ runs as many times as the initial value of BC.
  • AC is the carry from bit 3 to bit 4, not the overall carry.
  • PC holds the next instruction address; SP holds the stack top address.
  • RAR rotates right through carry; RAL rotates left through carry.

Previous-year exam insights

  • Direct factual questions ask for bus width, ALU width, power supply, and register sizes; memorise the numbers.
  • Program-tracing questions give a short sequence and ask for the final accumulator, output port value, or loop count; trace every instruction in a table.
  • Flag questions require independent computation of S, Z, AC, P, and CY; do not assume one flag implies another.
  • DAD questions test the operand code: DAD H doubles HL, DAD D adds DE to HL.
  • Match-the-list questions use the three units: processing unit → ALU; instruction unit → timing and control; storage/interface unit → general-purpose registers.
  • Common traps: sending a non-accumulator register to OUT; counting a loop one time too many or too few; forgetting that DCR does not affect carry; treating AC as the overall carry.
  • Check first which register is written, which flag is affected, and whether the instruction is 8-bit or 16-bit.

Practice at PARIKSHA

You are ready for the PARIKSHA tests of this sub-topic when you can:

  • State the width of the ALU, data bus, address bus, accumulator, PC, and SP in the 8085.
  • Name all flags, registers, register pairs, and hardware interrupts.
  • Compute the accumulator and all five flags after an 8-bit addition or subtraction.
  • Trace a short 8085 program with a loop and write the final value of every register used.
  • Identify which DAD instruction implements a given 16-bit addition.
  • Determine the exact value sent to an output port by an OUT instruction.
  • Count how many times a DCX/ORA/JNZ loop executes.
  • Match processing, instruction, and storage/interface units with their components.
  • Explain why INR and DCR do not affect the carry flag and why logical instructions clear it.

Attempt the sub-topic test first, then the subject test.

Pages 1–2 of 2