The Intel 8085 is an 8-bit general-purpose microprocessor introduced in 1976. It operates on a single +5V DC power supply and features an internal clock generator operating typically at 3.072 MHz (driven by an external 6.144 MHz crystal connected across pins X1 and X2). The CPU can directly access \(2^{16} = 65,536\) bytes (64 KB) of memory through its 16-bit address bus.
A. Register Organization
The 8085 programmer's model contains both general-purpose and special-purpose internal registers:
| Register |
Width |
Type |
Primary Architectural Function & Notes |
A (Accumulator) |
8-bit |
Special / Arithmetic |
Primary working register for all 8-bit arithmetic, logical, I/O, and load/store operations. Stores one operand and receives the ALU result. |
B, C, D, E, H, L |
8-bit each |
General Purpose |
Can be used individually as six 8-bit scratchpad registers or grouped as three 16-bit register pairs: BC, DE, and HL. |
H-L Pair (M Pointer) |
16-bit |
Data Pointer |
Default memory pointer register pair. In instructions referencing pseudo-register M (e.g. MOV A, M), the memory location accessed is [HL]. |
SP (Stack Pointer) |
16-bit |
Special Purpose |
Points to the current top of the stack located in external read/write RAM. Stack grows downwards toward lower memory addresses upon PUSH / CALL. |
PC (Program Counter) |
16-bit |
Sequencing |
Holds the 16-bit memory address of the next instruction byte to be fetched from memory. Automatically increments after each fetch cycle. |
W, Z |
8-bit each |
Internal Temporary |
Not accessible by programmer. Used internally by CPU control unit to hold 16-bit operand addresses during instruction execution (e.g. CALL, XCHG). |
B. Flag Register & Status Bits
The 8-bit Flag Register consists of five active status flip-flops updated by arithmetic and logical operations according to ALU results:
| Bit Position |
Flag Symbol |
Flag Name |
Set Condition (1) |
Reset Condition (0) |
| D7 |
S |
Sign Flag |
Set if most significant bit (D7) of result is 1 (negative number in 2's complement). |
Reset if bit D7 is 0 (positive result). |
| D6 |
Z |
Zero Flag |
Set if the complete ALU operation result equals exactly 00H. |
Reset if result is non-zero. |
| D4 |
AC |
Auxiliary Carry |
Set if there is a carry out of lower nibble bit D3 into upper nibble bit D4 (used by DAA for BCD arithmetic). |
Reset if no nibble carry occurs. |
| D2 |
P |
Parity Flag |
Set if the result contains an even number of 1s (even parity). |
Reset if parity is odd (odd number of 1s). |
| D0 |
CY |
Carry Flag |
Set if an arithmetic operation generates a carry out of bit D7 or requires a borrow during subtraction. |
Reset if no carry/borrow occurs. |
C. Multiplexed Address/Data Bus & Demultiplexing via ALE
To fit the 8085 processor into an economical 40-pin package, Intel designers multiplexed the lower 8 bits of the address bus with the 8-bit bidirectional data bus onto pins AD0–AD7:
Demultiplexing Mechanism:
• During the first T-state (T1) of any machine cycle, AD0–AD7 outputs the lower 8 bits of the memory address (\(A_0–A_7\)).
• Simultaneously, the CPU asserts the ALE (Address Latch Enable) pin HIGH.
• The falling edge of ALE strobes the address into an external octal transparent latch (such as the IC 74LS373), freezing the lower 8-bit address on the external bus for the rest of the machine cycle.
• During T2, T3, and T4 states, ALE stays LOW, and AD0–AD7 is released to carry bidirectional 8-bit data (\(D_0–D_7\)) between the CPU and memory or I/O devices.
D. Machine Cycles & Bus Timing States
Every instruction cycle consists of one or more Machine Cycles (M-cycles), and each machine cycle comprises several clock periods called T-states:
| Machine Cycle |
T-States |
IO/M' |
S1 |
S0 |
Active Control Signal |
Function Description |
Opcode Fetch (OF) |
4T or 6T |
0 |
1 |
1 |
RD' = 0 (T2-T3) |
Fetches 1-byte opcode from memory location pointed by PC. Decoding occurs in T4. |
Memory Read (MR) |
3T |
0 |
1 |
0 |
RD' = 0 (T2-T3) |
Reads 1 byte of operand data from memory location pointed by address bus. |
Memory Write (MW) |
3T |
0 |
0 |
1 |
WR' = 0 (T2-T3) |
Writes 1 byte from CPU register (e.g. Accumulator) to external memory. |
I/O Read (IOR) |
3T |
1 |
1 |
0 |
RD' = 0 |
Reads 1 byte of data from peripheral input port specified by 8-bit port address. |
I/O Write (IOW) |
3T |
1 |
0 |
1 |
WR' = 0 |
Transmits 1 byte from Accumulator to peripheral output device port. |
The Intel 8086 is a 16-bit microprocessor featuring a 16-bit internal data bus and a 20-bit address bus, enabling it to directly address \(2^{20} = 1,048,576\) bytes (1 Megabyte) of physical memory. The processor splits its internal operations into two independent processing units working concurrently in a pipeline:
The Pipelined Architecture:
• Bus Interface Unit (BIU): Responsible for all external bus transactions. Calculates 20-bit physical addresses, fetches instruction bytes from memory, and queues them into a 6-byte FIFO Instruction Stream Queue.
• Execution Unit (EU): Decodes and executes instructions fetched from the BIU queue. Contains the 16-bit ALU, general registers, and Flag register. Because the BIU continuously prefetches instruction bytes while the EU executes preceding instructions, bus latency is minimized.
A. 20-Bit Physical Address Calculation Formula
Because 8086 internal registers are 16 bits wide, a single register can only specify addresses up to \(2^{16} = 64\text{ KB}\). To form a 20-bit physical address across the full 1 MB address space, the 8086 uses Segmented Memory Addressing:
Physical Address = (Segment Register × 16) + Effective Offset
Physical Address = (Segment Register « 4) + Effective Offset
B. Step-by-Step Worked Physical Address Example
Sample Problem: Calculate the 20-bit physical memory address accessed when the Data Segment register contains DS = 2000H and the Source Index register contains SI = 0450H.
Step 1: Shift the 16-bit Segment value left by 4 bits (multiply by \(10\text{H} = 16\)):
Base Address = 2000H × 16 = 20000H
Step 2: Add the 16-bit Effective Address (Offset) to the Base Address:
Physical Address = 20000H + 0450H = 20450H
Result: The 8086 BIU places 20450H on address lines \(A_{19}–A_0\) to access the target byte.
C. Segment Registers & Default Pairings
| Segment Register |
Full Name |
Default Offset Pointer(s) |
Standard Usage in Real Mode |
CS |
Code Segment |
IP (Instruction Pointer) |
Holds base address of the 64 KB memory segment containing program executable code. |
DS |
Data Segment |
BX, SI, DI, Direct Address |
Holds base address of global variables, arrays, and program constants. |
SS |
Stack Segment |
SP (Stack Pointer), BP (Base Pointer) |
Holds base address of the runtime call stack, local variables, and subroutine frames. |
ES |
Extra Segment |
DI (Destination Index) |
Used by string primitive instructions (e.g. MOVSB, CMPSB) as target buffer segment. |
The Intel 8051 is an 8-bit microcontroller designed specifically for embedded control systems. Unlike microprocessors that adhere to a Von Neumann architecture (unified memory bus for program and data), the 8051 utilizes a Harvard Architecture with completely separated physical memory spaces and independent control signals:
- Program Memory (ROM): Up to 64 KB addressed via Program Counter (
PC) and read using the PSEN' (Program Store Enable) control strobe.
- External Data Memory (RAM): Up to 64 KB addressed via Data Pointer (
DPTR) and read/written using RD' and WR' control signals with the MOVX instruction.
- Internal Data Memory (RAM): 128 bytes on-chip accessed directly or indirectly using
MOV with 1-machine-cycle speed.
A. 128-Byte Internal RAM Memory Map
The 8051 internal RAM (\(00\text{H}\) to \(7F\text{H}\)) is structured into three functionally distinct zones:
| Hex Address Range |
Total Bytes |
Section Designation |
Internal Organization & Bit Addressing |
00H – 1FH |
32 Bytes |
4 Working Register Banks |
Divided into 4 banks (Bank 0, 1, 2, 3), each containing registers R0 through R7. Active bank is selected by bits RS1 and RS0 in the Program Status Word (PSW). |
20H – 2FH |
16 Bytes |
Bit-Addressable RAM |
Contains 128 individually addressable bits numbered 00H through 7FH. Bits can be directly set, cleared, or tested with bitwise instructions (e.g. SETB 05H, CLR 20.0, JB 00H, TARGET). |
30H – 7FH |
80 Bytes |
General-Purpose Scratchpad |
Standard byte-oriented RAM used for user variables, data buffers, and the default system Stack (Stack grows upwards from address \(07\text{H}\) by default). |
B. Special Function Registers (SFR) Map (80H–FFH)
The memory address space from \(80\text{H}\) to \(FF\text{H}\) contains control and status registers for on-chip peripherals. Only SFRs whose addresses end in 0H or 8H are bit-addressable:
| SFR Name |
Hex Address |
Bit Addressable? |
Primary Function & Notes |
ACC (A) |
E0H |
Yes |
Accumulator register used for all arithmetic, logical, and data movement operations. |
B |
F0H |
Yes |
Used alongside Accumulator during multiplication (MUL AB) and division (DIV AB). |
PSW |
D0H |
Yes |
Program Status Word containing flags: CY (Carry), AC (Aux Carry), F0, RS1, RS0, OV (Overflow), P (Parity). |
SP |
81H |
No |
8-bit Stack Pointer. Increments before pushing data (post-increment upon PUSH). Initialized to \(07\text{H}\) on reset. |
DPTR |
82H, 83H |
No |
16-bit Data Pointer composed of DPL (82H) and DPH (83H). Used to access external code and data memory. |
P0, P1, P2, P3 |
80H, 90H, A0H, B0H |
Yes |
Four 8-bit bidirectional parallel I/O ports. P0 and P2 multiplex external memory address/data buses when external RAM/ROM is connected. |
An addressing mode specifies the method by which the CPU determines the effective memory address or register location of an operand. Understanding addressing modes is crucial for writing efficient assembly programs:
| Addressing Mode |
Definition & Operand Source |
8085 Assembly Example |
8086 Assembly Example |
8051 Assembly Example |
| Immediate |
Operand value is encoded directly inside the instruction bytes following the opcode. |
MVI A, 45H
LXI H, 8050H |
MOV AX, 1234H
ADD BL, 05H |
MOV A, #25H
MOV DPTR, #8000H |
| Direct |
The 16-bit or 8-bit memory address of the operand is explicitly written in the instruction. |
LDA 8050H
STA 8060H |
MOV AX, [2000H]
MOV [0500H], CX |
MOV A, 30H
MOV 40H, A |
| Register |
Operands are stored in internal general-purpose CPU registers; no external bus access is needed. |
MOV A, B
ADD C |
MOV AX, BX
ADD CX, DX |
MOV A, R0
ADD A, R1 |
| Register Indirect |
The effective memory address of the operand is held in a register pair or pointer register. |
MOV A, M (HL points)
STAX B (BC points) |
MOV AX, [BX]
MOV [SI], DL |
MOV A, @R0
MOV @R1, #00H |
| Implied / Implicit |
Operand is inherently specified by the opcode itself without extra operand fields. |
CMA (Accumulator)
STC (Carry flag) |
CLC (Clear CF)
CBW (Convert Byte to Word) |
RLC A
SWAP A |
Experiment 1: 8-Bit Addition with Carry Storage (Intel 8085)
Aim: Write an 8085 assembly language program to add two 8-bit hexadecimal numbers stored at memory locations 8050H and 8051H. Store the 8-bit sum at 8052H and any carry generated at 8053H.
Algorithm:
1. Initialize register C to 00H to serve as the Carry counter.
2. Load the first 8-bit operand from address 8050H into Accumulator A using LDA 8050H.
3. Move the first operand into register B using MOV B, A.
4. Load the second 8-bit operand from address 8051H into Accumulator A using LDA 8051H.
5. Add register B to Accumulator using ADD B.
6. Check Carry Flag using conditional jump JNC SKIP_CARRY. If carry occurred, increment register C using INR C.
7. Store Accumulator (sum) at memory address 8052H using STA 8052H.
8. Move carry from register C to Accumulator using MOV A, C and store at 8053H using STA 8053H.
9. Terminate execution with HLT.
; Intel 8085 Assembly: 8-Bit Addition with Carry
MVI C, 00H ; Clear Carry counter C
LDA 8050H ; Load first operand into A
MOV B, A ; Store in register B
LDA 8051H ; Load second operand into A
ADD B ; A = A + B (ALU updates CY flag)
JNC STORE_SUM ; If CY=0, jump past carry increment
INR C ; CY=1: Increment carry counter
STORE_SUM:
STA 8052H ; Store 8-bit sum at 8052H
MOV A, C ; Move carry counter to A
STA 8053H ; Store carry at 8053H
HLT ; Stop execution
Experiment 2: Finding the Maximum (Largest) Number in an Array
Aim: Write an 8085 program to find the largest hexadecimal number in an array of \(N\) elements stored from address 8050H onward. The first byte represents array length \(N\). Store the maximum value at 8060H.
; Intel 8085 Assembly: Find Maximum Element
LXI H, 8050H ; HL points to array length byte
MOV C, M ; C = array size counter N
DCR C ; Number of comparisons = N - 1
INX H ; HL points to first array element
MOV A, M ; Initialize A with first element
LOOP: INX H ; Advance pointer to next element
CMP M ; Compare Accumulator with memory [HL]
JNC NEXT ; If A >= [HL], keep current maximum
MOV A, M ; If [HL] > A, update maximum in A
NEXT: DCR C ; Decrement comparison counter
JNZ LOOP ; Repeat until all elements tested
STA 8060H ; Store maximum element at 8060H
HLT ; Terminate execution
Experiment 3: Block Memory Transfer
Aim: Transfer a block of 10 consecutive data bytes from source starting address 8050H to destination starting address 9050H without data corruption.
; Intel 8085 Assembly: Block Memory Transfer
LXI H, 8050H ; HL = Source address pointer
LXI D, 9050H ; DE = Destination address pointer
MVI C, 0AH ; C = 10 (decimal count)
COPY: MOV A, M ; Fetch byte from source memory [HL]
STAX D ; Write byte to destination memory [DE]
INX H ; Advance source pointer
INX D ; Advance destination pointer
DCR C ; Decrement remaining byte counter
JNZ COPY ; Repeat if C > 0
HLT ; Transfer complete
Typical University Viva Voce Examination Questions:
• Q: Why is ALE activated only during T1 state?
A: ALE is asserted HIGH during T1 to indicate that AD0–AD7 holds valid address bits. It goes LOW at the end of T1 so external latches (74LS373) latch the address before the lines transition to data signals in T2/T3.
• Q: What is the difference between SUB and CMP instructions in 8085?
A: Both perform subtraction (A - Operand) and update condition flags (S, Z, CY, P, AC). However, SUB writes the difference back into Accumulator A, whereas CMP preserves the original Accumulator contents and discards the difference.
• Q: How many memory chips of size \(4\text{ KB}\) can be connected to the 8085?
A: The 8085 directly addresses 64 KB. Therefore, \(64\text{ KB} / 4\text{ KB} = 16\) chips can be connected using a 4-to-16 line address decoder.
The LPC-1768 microcontroller incorporates an ARM Cortex-M3 processor core operating at up to 100 MHz clock frequency. Peripherals and hardware components are interfaced via memory-mapped Fast General Purpose Input/Output (FGPIO) registers with single-cycle pin manipulation.
FGPIO Control Registers
• LPC_GPIO->FIODIR: Port Direction register. Writing 1 configures pin as output; 0 as input.
• LPC_GPIO->FIOPIN: Pin Value register. Reads current voltage state or writes full word.
• LPC_GPIO->FIOSET: Pin Output Set register. Writing 1 forces corresponding pin HIGH without affecting other pins.
• LPC_GPIO->FIOCLR: Pin Output Clear register. Writing 1 forces pin LOW.
7-Segment Display Pin Mapping
Connected across Port 2 (segments a to g, dp) and Port 1 (digit select lines DIG1-DIG4). Standard common-cathode 16-hex lookup array:
unsigned char data7[16] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71};
// Complete LPC-1768 C Program: Hex Counter 0 to F on 7-Segment
#include <lpc17xx.h>
void delay(unsigned int count) {
unsigned int i;
for (i = 0; i < count * 20000; i++);
}
int main(void) {
unsigned char hexCodes[16] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71};
int digit;
// Configure P2.0 to P2.7 as outputs (segments)
LPC_GPIO2->FIODIR |= 0x000000FF;
// Configure P1.0 as output (DIG1 common enable)
LPC_GPIO1->FIODIR |= (1 << 0);
LPC_GPIO1->FIOPIN |= (1 << 0); // Enable DIG1
while(1) {
for (digit = 0; digit < 16; digit++) {
LPC_GPIO2->FIOPIN = hexCodes[digit];
delay(500);
}
}
}
Viva Voce Questions:
• Q: Why is FIO preferred over legacy IOPIN registers in ARM Cortex-M3?
• Answer: Fast GPIO (FIO) is connected directly to the Cortex-M3 internal Advanced High-performance Bus (AHB) matrix, enabling single-cycle read and write operations rather than traversing peripheral bridge bottlenecks.