PHY 452 · Electronics
Our notes
2 min readInstruction set
The list of operations a processor understands. Written in assembly language (mnemonics) and converted by an assembler into machine code (hexadecimal bytes).
Groups of instructions (8085 examples)
| Group | Examples | Meaning |
|---|---|---|
| Data transfer | MOV B,A; MVI A,05H; LDA 2050H; STA 2051H | copy data between registers and memory |
| Arithmetic | ADD B; SUB C; INR A; DCR B | add, subtract, increment, decrement |
| Logical | ANA B; ORA C; XRA A; CMA; CMP B | AND, OR, XOR, complement, compare |
| Branch | JMP; JZ; JNZ; JC; CALL; RET | jumps, conditional jumps, subroutines |
| Control | HLT; NOP; EI; DI | halt, no operation, interrupts |
Addressing modes
- Immediate: the data is in the instruction (MVI A,05H).
- Register: between registers (MOV B,A).
- Direct: the memory address is given (LDA 2050H).
- Indirect: the address is in a register pair (MOV A,M uses the address in HL).
- Implied: the operand is understood (CMA complements A).
Flowcharts
Before writing code, draw a flowchart: ovals for start and end, rectangles for processes, diamonds for decisions, parallelograms for input and output, arrows for flow. It makes loops and decisions clear.
Program 1: add two numbers
Add 05H and 03H and store the result at memory address 2050H.
- MVI A,05H (load 05H into A)
- MVI B,03H (load 03H into B)
- ADD B (A = A + B = 08H)
- STA 2050H (store A at 2050H)
- HLT (stop)
After running, address 2050H holds 08H.
Program 2: add numbers in memory
- LDA 2050H (A = first number)
- MOV B,A
- LDA 2051H (A = second number)
- ADD B
- STA 2052H (result)
- HLT
If the sum exceeds FFH, the carry flag is set; a fuller program stores the carry too.
Program 3: a loop (count down from 5)
- MVI B,05H
- LOOP: DCR B (B = B - 1; sets the zero flag when B reaches 0)
- JNZ LOOP (repeat while B is not zero)
- HLT
Loops like this make time delays: each pass takes a known number of clock cycles.
Program 4: find the larger of two numbers
- LDA 2050H; MOV B,A; LDA 2051H
- CMP B (compare A with B; carry set if A < B)
- JNC STORE (if A ≥ B, A is larger)
- MOV A,B
- STORE: STA 2052H
- HLT
Control programs
A program that reads a temperature through an ADC, compares it with a set value (CMP) and switches a fan through an output port (OUT) is a simple control program, the basis of embedded systems.
Exams usually ask
- Classify instructions with examples; explain addressing modes.
- Write a simple program with its flowchart.
Common mistake
Forgetting HLT at the end, or confusing MVI (move immediate data) with MOV (copy between registers).
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
No reading links here yet
Our team adds free books, videos and practice for each topic, and opens every link before it goes up.