UNIT VI - Assembly Language
UNIT VI - Assembly Language
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
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
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.