Short notes

8085 Instruction Set Short Notes

Writing an 8085 program to add two 8-bit numbers stored at 2000H and 2001H and store the result at 2002H uses three instruction groups: data transfer (LDA to fetch), arithmetic (ADD M after loading HL), and data transfer again (STA to store). That simple program exercises the most common instructions in the 8085 set, and every university practical exam has a variation of it — understanding which flags are affected by ADD versus MOV is what separates correct answers from wrong ones.

EEE, ECE, EI

How it works

The 8085 instruction set has 246 instructions divided into five groups: data transfer (MOV, MVI, LXI, LDA, STA, LHLD, SHLD, XCHG, LDAX, STAX — none of these affect flags), arithmetic (ADD, ADC, SUB, SBB, INR, DCR, INX, DCX, DAD — INR/DCR do not affect CY flag), logical (ANA, ORA, XRA, CMP, CMA, CMC — ANA sets AC, clears CY), branch (JMP, JZ, JNZ, JC, JNC, CALL, RET, conditional variants), and machine control (HLT, NOP, EI, DI, RIM, SIM).

Key points to remember

Key instruction facts: ADD r adds register r to A and affects all five flags. INR r increments r but does NOT affect the carry flag — a very common trap. CMP r subtracts r from A without storing the result, setting flags for conditional jump decisions. DAD rp adds the 16-bit register pair to HL, affects only the CY flag. RLC rotates A left, copying bit 7 to bit 0 and to CY. RAL rotates A left through carry. SIM and RIM are used for masking RST 5.5/6.5/7.5 interrupts and reading interrupt status. All branch instructions are 3 bytes (1 opcode + 2 address bytes); conditional calls (CC, CNC, etc.) are also 3 bytes.

Exam tip

The examiner always asks you to write an 8085 program for tasks like finding the largest element in an array or BCD addition, and trace through it with register contents — draw a register trace table showing A, flags, and memory contents after each instruction.

More Microprocessors notes