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 (–), so it directly addresses bytes = 64 KB of memory.
- Data bus is 8 bits (–) and bidirectional. The lower address bits – 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: , 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,XRAclear CY; S, Z, P are affected and AC is undefined. - Rotate instructions
RLC,RRC,RAL,RARaffect only the CY flag.
How it works
The 8085 follows the stored-program instruction cycle:
- 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.
- The instruction decoder interprets the opcode. If the instruction needs additional bytes (operand), the CPU fetches them and increments PC accordingly.
- 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.
- PC is incremented to the next instruction, unless a jump or call changes it.
For 8-bit addition, let the accumulator be and the operand be . The CPU computes , stores the lower 8 bits in A, and sets:
- CY = 1 if ;
- 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, . CY becomes 1 if a borrow occurs, i.e. if . 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 , 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.
Drawing the diagram…
Formulas
- Memory address space: bytes = 64 KB.
- I/O port space: input and 256 output ports.
- 8-bit addition: ; if .
- Zero flag: iff result .
- Sign flag: iff bit 7 of result .
- Parity: iff the number of 1s in the result is even.
- Auxiliary carry: iff carry from bit 3 to bit 4 occurs.
- DAD: ; if .
- 8-bit subtraction: ; if (borrow).
Worked examples
Example 1 (addition and flags). Add and in the 8085.
, . Sum:
.
The lower 8 bits are , so A = . CY = 1. Z = 1 because the result is zero. S = 0 because bit 7 is 0. AC = 1 because the lower nibbles produce a carry from bit 3 to bit 4. The result 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=, B=.
| Iteration | B before ADD | A before ADD | A after ADD | B after DCR | JNZ taken? |
|---|---|---|---|---|---|
| 1 | 05H | 42H | 47H | 04H | yes |
| 2 | 04H | 47H | 4BH | 03H | yes |
| 3 | 03H | 4BH | 4EH | 02H | yes |
| 4 | 02H | 4EH | 50H | 01H | yes |
| 5 | 01H | 50H | 51H | 00H | no |
After the loop A=. Then ADI 25H gives . 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=. MOV A,B copies to A. MOV C,A copies to C. MVI D,37H sets D=. OUT PORT1 sends the contents of A to PORT1. Therefore the output at PORT1 is 82H. The value in D is not sent.
Example 4 (loop count).
LXI B,0007H
LOP: DCX B
MOV A,B
ORA C
JNZ LOP
Initially BC=. Each iteration decrements BC by 1 with DCX B. MOV A,B and ORA C set A to . When BC becomes , 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
| Component | Size | Role |
|---|---|---|
| Data bus | 8 bits | Transfers one byte at a time |
| Address bus | 16 bits | Addresses 64 KB memory |
| Accumulator | 8 bits | Main arithmetic register; source for OUT |
| ALU | 8 bits | Performs 8-bit arithmetic and logic |
| Program Counter | 16 bits | Holds next instruction address |
| Stack Pointer | 16 bits | Points to top of stack |
| General registers | 6 × 8 bits | B, C, D, E, H, L |
| Flags | 5 bits | S, Z, AC, P, CY |
| Instruction | Operation |
|---|---|
| DAD B | HL = HL + BC |
| DAD D | HL = HL + DE |
| DAD H | HL = HL + HL |
| DAD SP | HL = HL + SP |
| Instruction type | CY | S | Z | P | AC |
|---|---|---|---|---|---|
| ADD/SUB/ADI/SUI | affected | affected | affected | affected | affected |
| INR/DCR | not affected | affected | affected | affected | affected |
| ANA/ORA/XRA | cleared | affected | affected | affected | undefined |
| DAD | affected | not affected | not affected | not affected | not affected |
| RLC/RRC/RAL/RAR | affected | not affected | not affected | not affected | not 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.
OUTsends only the accumulator;INreads only into the accumulator.DAD Hperforms HL = HL + HL;DAD Dperforms HL = HL + DE.INRandDCRnever change CY; logical instructions clear CY.XRA Amakes A=0, Z=1, P=1, CY=0.- A loop with
DCX B,ORA C,JNZruns 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.
RARrotates right through carry;RALrotates 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.
DADquestions test the operand code:DAD Hdoubles HL,DAD Dadds 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 thatDCRdoes 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
DADinstruction implements a given 16-bit addition. - Determine the exact value sent to an output port by an
OUTinstruction. - Count how many times a
DCX/ORA/JNZloop executes. - Match processing, instruction, and storage/interface units with their components.
- Explain why
INRandDCRdo not affect the carry flag and why logical instructions clear it.
Attempt the sub-topic test first, then the subject test.