0% found this document useful (0 votes)
7 views6 pages

UNIT VI - Assembly Language

The document provides an overview of assembly language programming, focusing on the 8085 microprocessor, its instruction set, and how to write assembly programs. It covers key components of the 8085 architecture, including the ALU, registers, and memory operations, as well as various addressing modes. Practical examples demonstrate how to implement simple tasks using assembly language instructions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views6 pages

UNIT VI - Assembly Language

The document provides an overview of assembly language programming, focusing on the 8085 microprocessor, its instruction set, and how to write assembly programs. It covers key components of the 8085 architecture, including the ALU, registers, and memory operations, as well as various addressing modes. Practical examples demonstrate how to implement simple tasks using assembly language instructions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

UNIT VI

ASSEMBLY LANGUAGE PROGRAMMING


Assembly language is a low-level programming language used to directly communicate with a
computer's hardware. It provides instructions that correspond to the machine code instructions
executed by the processor. In this context, we focus on the 8085 Microprocessor, its instructions,
and how to write assembly programs.
8085 assembly language programming is essential for understanding how hardware interacts with
low-level software. It provides insights into how instructions operate on data and control program
flow. Students can use simple programs and practice exercises to get hands-on experience.
An accumulator is dedicated to arithmetic operations and holds temporary data, while a register is a
versatile storage unit that can be used for various tasks.

Introduction to 8085 Instructions


The 8085 is an 8-bit microprocessor developed by Intel. It uses a set of instructions to perform
operations such as data transfer, arithmetic, logical operations, and branching. These instructions are
broadly categorized as:
1. Data Transfer Operations
2. Arithmetic Operations
3. Logic Operations
4. Branch Operations
Common Data Registers and Flags in 8085
1. Registers:
o Accumulator (A)
o General-purpose registers (B, C, D, E, H, L)
o Special-purpose register pairs (BC, DE, HL)
2. Flags:
o Carry flag (CY)
o Zero flag (Z)
o Sign flag (S)
o Parity flag (P)
o Auxiliary carry flag (AC)

1. Data Transfer Operations


These instructions are used to move data from one location to another. No arithmetic or logical
operation is performed during this transfer.
Instruction Description Example
MOV Rd, Rs Move data from Rs to Rd MOV B, C →B=C
MVI R, data Move immediate data to register MVI A, 05H → A = 05H
LDA addr Load data from memory to A LDA 2050H → A = (2050H)
STA addr Store A's data to memory STA 2070H → (2070H) = A
LHLD addr Load H and L from memory LHLD 2050H → HL = (2050H)
SHLD addr Store HL data in memory SHLD 2070H → (2070H) = HL

2. Arithmetic Operations
These instructions perform arithmetic operations like addition, subtraction, increment, and
decrement.
Instruction Description Example
ADD R Add R to accumulator (A) ADD B →A=A+B
ADI data Add immediate data to A ADI 05H → A = A + 05H
SUB R Subtract R from accumulator (A) SUB C →A=A-C
SUI data Subtract immediate data from A SUI 03H → A = A - 03H
INR R Increment the value of register R INR B →B=B+1
DCR R Decrement the value of register R DCR C →C=C-1

3. Logic Operations
These instructions perform logical operations like AND, OR, XOR, and complement on the data in the
accumulator.
Instruction Description Example
ANA R Logical AND with register R ANA B →A=A&B
ANI data Logical AND with immediate data ANI 0FH → A = A & 0FH
XRA R XOR accumulator with register R XRA C →A=A^C
CPI data Compare accumulator with data CPI 02H → Sets flags based
CMA Complement the accumulator CMA → A = ~A

4. Branch Operations
Branching instructions alter the flow of execution based on conditions.
Instruction Description Example
JMP addr Unconditional jump JMP 2050H → Jump to 2050H
JC addr Jump if carry flag is set JC 3000H
JZ addr Jump if zero flag is set JZ 3050H
CALL addr Call a subroutine CALL 2500H
RET Return from subroutine RET
HLT Halt the microprocessor HLT

Writing Assembly Language Programs


To write an assembly language program for the 8085, follow these steps:
1. Define the Problem:
o Decide what the program needs to achieve (e.g., addition of numbers, data transfer,
etc.).
2. Plan the Algorithm:
o Break the task into smaller steps using a flowchart or pseudocode.
3. Write the Program:
o Use appropriate instructions for each step.
4. Assemble the Program:
o Translate the assembly program into machine code using an assembler.
5. Test the Program:
o Run the program on an 8085 simulator or hardware.
Example Program
Problem 1: Add two 8-bit numbers stored at memory locations 2050H and 2051H, and store the
result in 2052H.
LDA 2050H ; Load the first number into A
MOV B, A ; Move the number in A to register B
LDA 2051H ; Load the second number into A
ADD B ; Add the contents of register B to A
STA 2052H ; Store the result in memory location 2052H
HLT ; Halt the program

Problem 2: Store the data byte 32H into memory location 4000H.
Program 1:
MVI A, 32H : Store 32H in the accumulator
STA 4000H : Copy accumulator contents at address 4000H
HLT : Terminate program execution
Program 2:
LXI H : Load HL with 4000H
MVI M (4000H) : Store 32H in memory location pointed by HL register pair
HLT : Terminate program execution

Common Data Registers and Flags in 8085


3. Registers:
o Accumulator (A)
o General-purpose registers (B, C, D, E, H, L)
o Special-purpose register pairs (BC, DE, HL)
4. Flags:
o Carry flag (CY)
o Zero flag (Z)
o Sign flag (S)
o Parity flag (P)
o Auxiliary carry flag (AC)

Architecture of 8085 Microprocessor


8085 Microprocessor Architecture
The 8085 Microprocessor is an 8-bit microprocessor developed by Intel. It operates with 8-
bit data and 16-bit address buses, allowing it to access up to 64 KB of memory. Below is the
explanation and architecture of the 8085 microprocessor.
 8085 Microprocessor is an 8-bit, 5-register based processor with a 16-bit address bus and 8-
bit data bus.
 The processor includes important components such as the ALU, control unit, flag register,
and program counter.
 It is designed for simple and efficient operations, capable of handling a wide range of tasks
such as arithmetic, logic, and control operations.
Key Components of the 8085 Microprocessor Architecture:
1. ALU (Arithmetic Logic Unit):
o The ALU is responsible for performing arithmetic and logical operations (addition,
subtraction, AND, OR, etc.) on data.
2. Register Bank:
o The 8085 has a 5-register set (B, C, D, E, H, L) that are 8-bits wide. The registers can
hold data for processing.
o A temporary register (Accumulator) is used for intermediate results and operations.
o The 16-bit HL pair can be used as a memory pointer for addressing.
3. Program Counter (PC):
o The Program Counter is a 16-bit register that stores the address of the next
instruction to be fetched for execution.
4. Instruction Register:
o The Instruction Register temporarily holds the opcode of the current instruction
being executed.
5. Flag Register:
o The Flag Register consists of five flags: Sign (S), Zero (Z), Auxiliary Carry (AC), Parity
(P), and Carry (C). These flags are set based on the result of the arithmetic or logical
operation.
6. Control Unit:
o The Control Unit generates signals for various operations such as reading and writing
to memory, decoding instructions, and controlling the ALU and other parts of the
microprocessor.
7. Memory (16-bit Address Bus):
o The microprocessor uses a 16-bit address bus to access 64 KB of memory.
8. Data Bus (8-bit):
o The microprocessor uses an 8-bit data bus to transfer data to and from the CPU. It
transfers one byte of data at a time.
9. Clock:
o The clock synchronizes the operations in the microprocessor. The 8085 uses a 3-
phase clock.
Operation of 8085 Microprocessor:
1. Fetching the Instruction:
o The Program Counter (PC) holds the address of the next instruction. The
microprocessor uses this address to fetch the instruction from memory via the
address bus and stores it in the Instruction Register.
2. Decoding the Instruction:
o The instruction is decoded by the control unit, which generates appropriate control
signals for executing the instruction.
3. Executing the Instruction:
o The ALU performs the necessary operation (e.g., arithmetic or logical operation) on
the data.
4. Storing the Result:
o The result of the operation is stored in the accumulator or in memory.
5. Incrementing the Program Counter:
o The Program Counter is incremented to the next instruction's address after executing
the current instruction.

Addressing modes in 8085 assembly language programming

In 8085 Assembly Language Programming, there are four main addressing modes that
specify how the operands of the instructions are addressed. These modes determine where
the operands are located (in registers, memory, or immediate values). Here are the four
addressing modes:
1. Immediate Addressing Mode
 In this mode, the operand is directly specified in the instruction.
 The operand is part of the instruction itself.
 Example: MVI A, 30H
o This instruction moves the immediate value 30H into the accumulator
register A.
 Explanation: The operand 30H is directly given in the instruction and is moved into
register A.
2. Register Addressing Mode
 In this mode, the operand is specified using a register (A, B, C, D, E, H, L).
 The operand is fetched from a register, and the result is stored in a register.
 Example: MOV A, B
o This instruction copies the contents of register B into register A.
 Explanation: The operand is in register B, and the result is stored in register A.
3. Direct Addressing Mode
 In this mode, the operand is a memory location whose address is specified in the
instruction.
 The instruction directly specifies the memory address.
 Example: LDA 2050H
o This instruction loads the contents of memory location 2050H into the
accumulator A.
 Explanation: The operand is located in memory address 2050H, and its content is
loaded into register A.
4. Register Indirect Addressing Mode
 In this mode, the operand's address is stored in one of the registers (either H and L
pair).
 The instruction uses a register pair to point to the memory location where the
operand is stored.
 Example: MOV A, M
o This instruction moves the contents of the memory location pointed to by
the HL register pair into register A.
 Explanation: The address of the operand is stored in the HL register pair, and the
operand is fetched from the memory location pointed to by HL.

You might also like