0% found this document useful (0 votes)
107 views46 pages

Microprocessor and Assembly Language Course Code: 343 ALL

This document provides notes on the instruction set of the 8085 microprocessor. It is divided into several sections: 1) Instructions are classified based on word size/format as 1-byte, 2-byte, or 3-byte instructions. 2) Instructions are also classified based on the type of operation performed as data transfer, arithmetic, logic, branching, or machine control instructions. 3) Examples of different instruction types are provided, such as MOV to move data between registers/memory, ADD to add contents to the accumulator, and LDA/STA to load/store from memory to accumulator. Problem examples are also given and solutions provided.

Uploaded by

Ga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views46 pages

Microprocessor and Assembly Language Course Code: 343 ALL

This document provides notes on the instruction set of the 8085 microprocessor. It is divided into several sections: 1) Instructions are classified based on word size/format as 1-byte, 2-byte, or 3-byte instructions. 2) Instructions are also classified based on the type of operation performed as data transfer, arithmetic, logic, branching, or machine control instructions. 3) Examples of different instruction types are provided, such as MOV to move data between registers/memory, ADD to add contents to the accumulator, and LDA/STA to load/store from memory to accumulator. Problem examples are also given and solutions provided.

Uploaded by

Ga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

Microprocessor and Assembly Language

Course Code: 343 ALL

CHAPTER 2
Instruction Set of 8085
Lecture Notes

Dr. Harish Kumar


CHAPTER 2

Instruction Set of MICROPROCESSOR 8085

The microprocessor instructions are classified


a.. based on word size/ format of instructions as.
1. one byte instructions-8-bit length. 1 byte
‫ﺗﺻﻧف اﻟﻰ‬
2. two byte instructions-16-bit length. 2 byte
3. three byte instructions-24-bit length. 3 byte

b.. based on type of operation performed by the instruction as.


1. Data transfer instructions.
2. Arithmetic instructions.
3. Logic instructions.
4. Branching instructions.
5. Machine control instructions.

.
‫ﺟﺎء ﻣﺻطﻠﺢ ﻋﻠﯾﮫ ﻓﻲ اﻻﺧﺗﺑﺎر‬

1. DATA TRANSFER INSTRUCTIONS.

Data transfer instructions copy data from a source into a destination


without modifying the content of the source.

The source and destinations can be registers, memory locations or accumulator

Eg: a. Move between Register and Register-MOV Rd, Rs

b. Move Immediate Instruction- MVI Rd, 8 bit data

c. Move between Register and Memory- MOV M , r and MOV r, M


6
d. Load Immediate Register Pair- LXI Rp,16 bit data

e. Store Accumulator Direct- STA addr

f. Load Accumulator Direct- LDA addr


a. Move between Register and Register

MOV Rd, Rs
Rd  destination register
Rs  source register
This is a one byte instruction.

The source and destination registers can be A,B, C,D,E, H or L.

Example: MOV B , A
Before instruction execution, the contents of registers B and A are
Rd = B= XAH
Rs = A = 0FH
After the execution of instruction.
Rd = B = 0FH
Rs = A = 0FH
b. Move Immediate Instruction.

MVI Rdr 8 bit data

Rdr  destination register

This is a two bytes instruction.

It loads the specified 8 bit data into the destination register.

Example:
MVI B , F1H
Before the execution of instruction.
Rdr = B = XAH
After the execution of instruction, the 8 bit data F1H is loaded into the register
B.
Rdr = B = F1H
c. Move between Register and Memory.

MOV M , R and MOV R, M


M  memory location
R  register or accumulator
The memory address is first loaded in HL register before any instruction makes
a memory reference.
Example:
MOV M , A
Before execution
A=56H H=20H L=50H
Memory Address Data

2050H 99H

After execution
The content of the accumulator 56H is loaded into the memory location 2050H.
Memory Data
Address
2050H 56H
Problem

Write a sequence of instructions that will load FFH in C register and transfer
the byte to a memory location whose address is 2051H.
MVI H,20H
MVI L,51H
MVI C,0FFH
MOV M,C
HLT

Solution: MVI H, 20H


‫ﻣﻛﺎن اﻟﻣﯾﻣوري ادرس‬
MVI L, 51H
MVI C, FFH ‫اﻟﻘﯾﻣﮫ اﻟﻲ طﻠﺑﮭﺎ ﻣﻧﻲ ﻓﻲ اﻟﺳؤال اﻧﻲ اﺧزﻧﮭﺎ ﻓﻲ ﺳﻲ‬
MOV M,C
HLT

memory address data


d. Load Immediate Register Pair. ‫اﻟﻣؤﺷر ﻋﻠﻰ اﻟﻣﯾﻣوري ادرس‬
‫ ﻣﺳﺟﻼت ﺳوا‬2 ‫ادﻣﺞ‬
LXI Rp,16 bit data

Rp  register pair, BC, DE, HL or stack pointer SP

This is a three byte instruction. A 16-bit data is loaded into register pair.

LXI H , 2050H
Before execution

H L

After execution
the 16 bit data or memory address ,2050H, is loaded into the HL pair.

H L

20H 50H
accumulator to data in address memory

e. Store Accumulator Direct.

STA addr
addr
 memory address

Stores the contents of the accumulator in the memory whose address is


specified in the instruction itself.

STA 2550H
Before execution
A Mem.address Data
47H 2550H

After execution
The contents of the accumulator which is 47H is copied to the memory address,2550H.

A Mem.address Data
47H 2550H 47H
data in memory address to a accumulator

f. Load Accumulator Direct.

LDA addr
addr
 memory address

Loads the accumulator with a byte from the memory location whose address
is specified in the instruction itself.

LDA 2450H
Before execution
Mem.address Data
A
2450H 67H
After execution
The contents of the memory location whose address is 2450H is copied to the
accumulator.
Mem.address Data
A
67H 2450H 67H
Problem:
Without using LXI command how you will transfer
one byte from memory location whose address is
2450H to another memory location whose address
is 2550H.
‫‪Solution:‬‬

‫‪LDA 2450H‬‬ ‫اﺣﻣل اﻟﺑﯾﺎﻧﺎت ﻣن اﻟرﯾﺟﺳﺗر اﻟﻰ اﻻﻛﻣﯾوﻟﯾﺗر‬


‫‪STA 2550H‬‬ ‫ﺧذاھﺎ ﻣن اﻻﻛﻣﯾوﻟﯾﺗر وﺣطﮭﺎ ﻓﻲ ھذا اﻟﻣوﻗﻊ‬
‫‪HLT‬‬
2. ARITHMETIC INSTRUCTIONS.

Arithmetic operations like addition/ subtraction are done by arithmetic


instructions between any 8-bit number, or the contents of register, or the contents of
memory location and the contents of accumulator.

The results are stored in accumulator.


The contents of two registers cannot be added or subtracted directly.
Eg:
a. ADD with register/memory h. Increment Register or Memory INR r or INR M

b. ADD immediate. ADI i.Decrement Register or Memory. DCR r or DCR M

c. ADD with carry ADC r [or] ADC M j.Decrement Register Pair


DCX r
d. SUB with register/memory SUB r [or] SUB M p

e. SUB immediate. SUI 8 bit data 10 INX r


p
f. SUB immediate with borrow. SBI 8 bit data

g. Double Register Add. DAD register pair


‫اﺧذ اي ﻗﯾﻣﮫ ﻣوﺟوده ﻓﻲ اﻟرﯾﺟﺳﺗر واﺟﻣﻌﮭﺎ ﻋﻠﻰ اﻟﻘﯾﻣﮫ اﻟﻣوﺟوده ﻓﻲ اﻻﻛﻣﯾوﻟﯾﺗر واﺧزﻧﮭﺎ ﻓﻲ اﻻﻛﻣﯾوﻟﯾﺗر‬

https://electricalvoice.com/8085-microprocessor-mcqs/4/

a. ADD with register/memory

ADD r [or] ADD M


r  register name M  memory location

It is used to add the contents of a specified register or memory to the contents of the
accumulator. (A)  (A) + r.

The result is stored in the accumulator.

Example: 1 ‫ﯾﺣﻣﻊ اﻟﺑﻲ ﻋﻠﻰ اﻟﻘﯾﻣﮫ اﻟﻲ ﻓﯾﺎﻻﻛﻣﯾوﻟﯾﺗر وﯾﺧزن ﻗﯾﻣﺗﮭﺎ ﻓﻲ اﻻﻛﻣﯾﻠوﯾﺗر‬
ADD B
If A= E2H and B= 03H then after the execution of the above instruction the content of A
will be E5H.
Example: 2
ADD M ‫ﯾﺟﻣﻊ اﻟﻘﯾﻣﮫ اﻟﻲ ﻓﻲ اﻟﻣﯾﻣوري ﻋﻠﻰ اﻟﻘﯾﻣﮫ اﻟﻲ ﻓﻲ اﻻﻛﻣﯾوﻟﯾﺗر وﯾﺧزن اﻟﻧﺎﺗﺞ ﻓﻲ اﻻﻛﻣﯾوﻟﯾﺗر‬

Before execution

A H L Mem.address Data
05H 20H 50H
2050H 07H

After execution
The data in the memory location 2050H i.e 07H is added to value in accumulator A
and result is stored in A.

A H L Mem.address Data
0CH 20H 50H
2050H 07H
‫ﺟﺎت ﻣﺳﺎﻟﮫ ﻋﻠﯾﮫ‬

b. ADD immediate.

ADI 8 bit data ‫اﺿﯾف ﻗﯾﻣﮫ وﻟﯾﺳت ﻣﺳﺟل اﺟﻣﻊ اﻟﻘﯾﻣﮫ ﻣﻊ اﻟﻘﯾﻣﮫ اﻟﺗﻲ ﻓﻲ اﻻﻛﻣﯾوﻟﯾﺗر واﺧزن ﻓﻲ اﻻﻛﻣﯾوﻟﯾﺗر‬

It is used to add 8 bit data to the contents of the accumulator. (A)  (A) + 8-bit data.

The result is stored in the accumulator.

Example: 1
ADI 37H

If the value of A = 05H then after the execution of the above instruction the 8 bit data 37H
is added with the content of accumulator and the result 3CH is stored in the accumulator.
. 37h+05h=3ch
c. ADD with carry

ADC r [or] ADC M

It is used to add the contents of a specified register or memory along with the carry
flag to the contents of the accumulator.

(A)  (A) + r + Carry


B=03H
The result is stored in the accumulator. A=E2H
CARRY FLAG = 1
Example 1: ADC B 03+E2+1=E6H

If A= E2H and B= 03H and Carry flag = 1, then after the execution of the above
instruction the content of A will be E6H.
Example 2:

ADC M
Before the execution of instruction , if Carry flag = 1

A H L Memory Data
Address
05H 20H 50H 2050H 07H

After the execution of instruction, the data in the memory location 2050H i.e 07H
is added to value in accumulator A and carry 1 and result is stored in A.
05H + 07H + 1

A H L Memory Data
Address
0DH 20H 50H 2050H 07H
‫ﻋﻣﻠﯾﮫ اﻟطرح‬

d. SUB with register/memory

SUB r [or] SUB M


r  register name M  memory location

It is used to subtract the contents of a specified register or memory from the contents of
the accumulator. (A)  (A) - r.
A - REGISTER OR MEMORY
The result is stored in the accumulator.

Example: 1
SUB B
If A= 0CH and B= 03H , then after the execution of the above instruction the content of A
will be 09H.
Example: 2
SUB M

Before execution ,

A H L Mem.address Data
07H 20H 50H
2050H 03H

After execution
The data in the memory location 2050H i.e 07H and carry are subtracted from value
in accumulator A and result is stored in A.

A H L Mem.address Data
04H 20H 50H
2050H 03H
e. SUB immediate.

SUI 8 bit data

It is used to subtract 8 bit data from the contents of the accumulator. (A)  (A) - 8-bit
data.

The result is stored in the accumulator.

Example: 1
SUI 03H

If the value of A = 05H then after the execution of the above instruction the 8 bit data 03H
is subtracted from the content of accumulator and the result 02H is stored in the
accumulator.
.
‫اطرح واﺣد زﯾﺎده ﻣن اﻟﻘﯾم اﻟﻲ اﺑﻲ اطرﺣﮭﺎ‬

f. SUB immediate with borrow.

‫اﺧﺗﯾﺎري اﻛﻣﻠﻲ ﺻﺢ وﺧطﺎ ﻣﺳﺎﻟﮫ‬


SBI 8 bit data

It is used to subtract 8 bit data from the contents of the accumulator. (A)  (A) - 8-bit
data - carry.

The result is stored in the accumulator.


05 - 03 - 01 = 01
Example: 1
SBI 03H

If the value of A = 05H and carry =1, then after the execution of the above instruction the
8 bit data 03H is subtracted from the content of accumulator and the carry flag and the
result 01H is stored in the accumulator.
.
‫اﺟﻣﻊ ﻗﯾﻣﮫ ﻣوﺟوده ﺟوا رﺟﺳﺗرﯾن ﻣﻊ ﺑﻌض‬

g. Double Register Add

DAD register pair

It is used to add the contents of HL pair with the contents of register pair mentioned in
the instruction. (HL)  (HL) + (register pair).

The result is stored in the accumulator. HL + BC =

‫ اﻟﺗﺧزﯾن ﻓﻲ ال‬HL
Example: 1
DAD B
Adds the content of the HL register with the content of the BC register pair stores the
result in the HL register pair

HL  HL+BC
Before execution After execution

H L B C H L B C
41H 01H 06H 02H 47H 03H 06H 02H
INCREMENT/ DECREMENT INSTRUCTIONS
h. Increment Register or Memory

INR r or INR M 1 ‫ﯾﻌﻧﻲ ﻟو ﺳوﯾت اﻧﻛرﯾﻣﯾﻧت ﻋﻠﻰ اﻟرﯾﺟﺳﺗر راح ازﯾد ﻋﻠﯾﮫ‬
1 ‫وﻟو ﺳوﯾت اﻧﻛرﯾﻣﯾﻧت ﻋﻠﻰ اﻟﻣﯾﻣوري راح ازﯾد ﻋﻠﯾﮫ‬

This instruction increments the contents of the specified register or memory location, M
by 1.
‫اﺧزن اﻟﻘﯾﻣﮫ ﻋﻠﻰ ﻧﻔس اﻟرﯾﺟﺳﺗر اﻟﻲ اﻧﺎ ﺳوﯾت ﻋﻠﯾﮫ اﻟﻌﻣﻠﯾﮫ‬
The result is stored in the specified register itself.

Example: 1
INR C ‫اﻧﺎ ھﻧﺎ ﺳوﯾت اﻧﻛرﯾﻣﻧت ﻋﻠﻰ اﻟرﯾﺟﺳﺗر ﺳﻲ ﻋﺷﺎن ﻛذا زدت ﻋﻠﯾﮫ واﺣد وﺧزﻧت اﻟﻧﺗﯾﺟﮫ ﻓﻲ ﺳﻲ‬
Increments the content of C register by 1 and the new value is stored in C register.

Example: 2
INR M ‫اﻧﺎ ھﻧﺎ ﺳوﯾت اﻧﻛرﯾﻣﻧت ﻟﻠﻣﯾﻣوري ﻋﺷﺎن ﻛذا اﻧﺎ زودت واﺣد ﻋﻠﻰ اﻟﻣﯾﻣوري واﻟﻘﯾﻣﮫ ﺧزﻧﺗﮭﺎ ﻓﻲ اﻟﻣﯾﻣوري‬
Increments the content of memory location specified by HL register by 1 and the value is
stored in that memory location itself.
‫اﻧﺎ ھﻧﺎ اطرح ﻣن اﻟرﯾﺟﺳﺗر او اﻟﻣﯾﻣوري واﺧزن اﻟﻘﯾﻣﮫ ﻓﻲ ﻧﻔس اﻟﺷﻲ اﻟﻲ اﻧﺎ ﺳوﯾت ﻋﻠﯾﮫ اﻟﻌﻣﻠﯾﮫ‬
‫ﻧﻔس اﻻﻧﻛرﯾﻣﻧت ﺑس اﻟﻔرق ﺑﯾﻧﮭم ان ھذا طرح وھذاك ﺟﻣﻊ‬

i. Decrement Register or Memory

DCR r or DCR M

This instruction decrements the contents of the specified register or memory location, M
by 1.

The result is stored in the specified register or memory location itself.

Example: 1
DCR C
Decrements the content of C register by 1 and the new value is stored in C register.

Example: 2
DCR M
Decrements the content of memory location specified by HL register by 1 and the value is
stored in that memory location itself.
‫ازﯾد واﺣد ﻋﻠﻰ اﻟﻣﺳﺟﻼت اﻟزوﺟﯾﮫ واﺧزن اﻟﻘﯾﻣﮫ ﻓﻲ ﻧﻔس اﻟﻣﺳﺟﻼت‬

j. Increment Register pair

INX rp

This instruction increments the contents of the specified register pair by 1.


(rp)  (rp) +1

The register pair used are BC, DE, HL and the 16-bit Stack Pointer.

The result is stored in the specified register pair itself.

Example: 1
INX H
If the initial value in HL register pair is 14FFH, then the instruction INX H increments the
16 bit value in HL register pair by 1 and the new value 1500H is stored in HL.

HL = 14FFH + 1 = 1500H
HL= 1500H
K. Decrement Register pair

DCX rp

This instruction decrements the contents of the specified register pair by 1.


(rp)  (rp) -1

The register pair used are BC, DE, HL and the 16-bit Stack Pointer.

The result is stored in the specified register pair itself.

Example: 1
DCX D
If the initial value in DE register pair is 1500H, then the instruction DCX D decrements 16
bit value in DE register pair by 1 and the new value is stored in DE.

‫ ﻣن اﻟﻣﺳﺟﻼت‬1 ‫اطرح‬
3. LOGIC INSTRUCTIONS.

Logic Instructions perform logical operations on data stored in registers,


memory and status flags.

The results are stored in accumulator.

The various logic operations supported by 8085 are:

ANI 8-bit data


a. AND ‫ رﯾﺟﺳﺗﺎر واذا ھم ھﺎي او ﻻ‬2 ‫ﯾﺣول ﻣن ھﯾﻛﺳﺎدﯾﺳﻣﺎل ﻟﺑﺎﯾﻧﺎري وﯾﻘﺎرن ﺑﯾن‬
ANA r
ORA r
XRA r b. OR.
ORI 8 bit data
XRI 8 bit data c. XOR
CMA
d. Complement CMC noneCMC noneCMC none
STC none
CMP register
CPI register e. Compare.
RA L
f. Rotate. RAR
RRC
RLC
a. AND instruction

ANA r

This instruction performs logical AND operation between the specified register, r and the
accumulator.

The result is stored in the accumulator. ‫ﯾﺷوف اﻟﻘﯾﻣﮫ اﻟﻲ ﻓﻲ اﻻﻛﻣﯾوﻟﯾﺗر وﯾﺳوي ﻟﮭﺎ اﻧدﯾﻧﻖ ﻣﻊ اﻟﺑﻲ‬

‫اﺣول ﻣن دﯾﺳﻣﺎل ﻟﺑﺎﯾﻧﺎري‬


Example: 1
ANA B

If A = 97H = 1001 0111


And if B = C5H = 1100 0101

Then ANA B results in A = 1000 0101= 85H


a. AND immediate

ANI 8-bit data

This instruction performs logical AND operation between the accumulator and the 8 bit
data given in the instruction itself.

The result is stored in the accumulator.

Example: 1
ANI 0FH

If A = 97H = 1001 0111


And if 8 bit data = 0FH = 0000 1111

Then ANI 0FH results in A = 0000 0111= 07H in the A register.


b. OR instruction

ORA r

This instruction performs logical OR operation between the accumulator and the register
content given in the instruction itself .

The result is stored in the accumulator.

Example: 1
ORA B
‫ﻋﺳل او ﺳم‬
If A = 97H = 1001 0111
And if B = C5H = 1100 0101

Then ORA B results in A = 1101 0111= D7H


.
b. OR immediate

ORI 8 bit data

This instruction performs logical OR operation between the accumulator and the 8-bit
data given in the instruction itself .

The result is stored in the accumulator.

Example: 1
ORI 0FH
If A = 97H = 1001 0111
And if 8 bit data = 0FH = 0000 1111

Then ORI 0FH results in A = 1001 1111= 9FH in the A register.

.
0 ,, ‫ﻟو اﻻﺛﻧﯾن ﻣﺗﺷﺎﺑﮭﯾن ﯾﻛون‬
c. EX-OR Instruction 1,, ‫ﻟوو اﻻﺛﻧﯾن ﻣﺧﺗﻠﻔﯾن ﯾطﻠﻊ‬

XRA r

This instruction performs EX-OR operation between the contents of the accumulator and
the specified register on a bit by bit basis.

The result is stored in the accumulator.

The XRA clears the accumulator. With this single instruction, we can clear accumulator,
Carry flag and Auxiliary Carry flag.

Example: 1
XRA B
If A = 97H = 1001 0111 and if B = C5H = 1100 0101

The XRA B results in A = 0101 0010 = 52H in the A register.

Example 2:
XRA A
If A = 97H = 1001 0111 and again A = 97H = 1001 0111

The XRA B results in A = 0000 0000 = 0 in the A register.


c. EX-OR
EX OR immediate

XRI 8 bit data

This instruction performs logical EX-OR operation between the accumulator and the 8-bit
data given in the instruction itself .

The result is stored in the accumulator.

Example: 1
XRI 0FH
If A = 97H = 1001 0111
and if 8 bit data = 0FH = 0000 1111

Then XRI 0FH results in A = 1001 1000= 98H in the A register

.
‫ﺟﺎت ﻣﺳﺎﻟﮫ ﻋﻠﯾﮫ ﻓﻲ اﻻﺧﺗﺑﺎر‬
‫ﻣﻛﻣل‬
d. Complement Instruction
‫ واﻟﻌﻛس‬0 ‫ ﯾﺧﻠﯾﮭﺎ‬1 ‫ﺗﺑدﯾل ﻟو اﻟﻘﯾﻣﮫ ب‬
CMA

This instruction complements each bit in the accumulator.

The result is stored in the accumulator.

Example: 1
CMA ‫ﺣول ﻛل واﺣد ﻟﺿده‬
If A = 97H = 1001 0111

The CMA results in A= 0110 1000 in the A register.

CMC none ‫اﻧﺎ اﺑﻲ اﺳوي ﻋﻣﻠﯾﮫ اﻟﺗﺣوﯾل ﻟﻠﻛﺎري اﻟﻲ ﺟوا اﻟﻔﻼق‬
‫ ﻣﺛﺎل ال‬CARRY=1
This instruction complements the content of carry flag. ‫اﻟﺣل‬
CARRY = 0
STC none
This instruction sets carry flag to 1.

‫ﺟﺎء ﻣﺻطﻠﺢ‬
‫ﻓﻲ اﻻﺧﺗﺑﺎر‬
‫ﻣﻘﺎراﻧﮫ‬
e. Compare Instruction

Compare Accumulator contents with register

CMP register
This instruction compares the content of the accumulator with the value in register given in
instruction.
Example
CMP B
SET 1
If (B) > (A) , then Carry flag is set ‫اذا ﻛﺎن اﻟﺑﻲ اﻛﺑر ﻣن ال اﻻي اذا اﻟﻛﺎري ﻓﻼق ﺑواﺣد‬
If (B) = (A) , then Zero flag is set 0 = ‫اذا اﻟﺑﻲ واﻻي ﻣﺗﺳﺎوﯾن اذا اﻟﻛﺎري ﻓﻼق‬ RESET 0
If (A) > (B) , then No flag is set ‫اذا ﻛﺎن اﻻي اﻛﺑر ﻣن اﻟﺑﻲ اذا اﻟﻛﺎري ﻓﻼق ﻣﺎراح ﯾﺻﯾر ﻟﮫ اي ﺷﻲ‬

Compare Accumulator contents with immediate data


‫اذا ﺟﯾت اﺑﻲ اﺳوي ھذي ف اﻧﺎ اﺣط ﻗﯾﻣﮫ واﻗﺎرﻧﮭﺎ ﻣن اﻻﻛﺎﻣﯾوﻟﯾﺗر‬

CPI 8-bit data ‫زﯾﮫ‬


The 8-bit data is compared with the contents of the accumulator.
Example CPI 89H
if (A) < data: carry flag is set ‫اذا ﻛﺎن اﻻﻛﻣﯾوﻟﯾﺗر ااﺻﻐر ﻣن اﻟداﺗﺎ ﯾﻌﻧﻲ اﻟﻛﺎري ﻓﻼق = ﺳﯾت‬
if (A) = data: zero flag is set
if (A) > data: carry and zero flags are reset
‫ﺟﺎء ﻓﻲ اﻻﺧﺗﯾﺎري ﻣن اﻟﺻوره اﻟﻲ ﻧزﻟﺗﮭﺎ ﻟﻧﺎ ﻓﻲ اﻟﺑﻼك‬

f. Rotate Instruction

Rotate accumulator right

RRC ‫اﻟﻘﯾﻣﮫ‬

Each binary bit of the accumulator is rotated right by one position. Bit D0 is placed in the
position of D7 as well as in the Carry flag. CY is modified according to bit D0. S, Z, P,
AC are not affected.

Rotate accumulator left

RLC

Each binary bit of the accumulator is rotated left by one position. Bit D7 is placed in the
position of D0 as well as in the Carry flag. CY is modified according to bit D7. S, Z, P,
AC are not affected.
f. Rotate Instruction

Rotate accumulator left through carry

RAL
Each binary bit of the accumulator is rotated left by one position through the Carry
flag. Bit D7 is placed in the Carry flag, and the Carry flag is placed in the least
significant position D0. CY is modified according to bit D7. S, Z, P, AC are not
affected.

Rotate accumulator right through carry

RAR

Each binary bit of the accumulator is rotated right by one position through the
Carry flag. Bit D0 is placed in the Carry flag, and the Carry flag is placed in the
most significant position D7. CY is modified according to bit D0. S, Z, P, AC
are not affected.
‫اﺑﻲ اروح ﻣن ﻣﻛﺎن ﻣﻌﯾن ﻓﻲ اﻟذاﻛره ﻟﻣﻛﺎن ﺛﺎﻧﻲ‬

3. BRANCH INSTRUCTIONS.

Branch Instructions are used to transfer the sequence of instructions from one
memory location to another.

a. Jump unconditionally

b. Jump conditionally
BRANCH INSTRUCTIONS
Jump unconditionally
JMP 16-bit address

The program sequence is transferred to the memory location specified by the 16-bit
address given in the operand.
Example: JMP 2034H.
NB: In 8085 JMP unconditionally ins. is used to do the function of GOTO

Jump conditionally Operand: 16-bit address

The program sequence is transferred to the memory location specified by the 16-bit
address given in the operand based on the specified flag of the PSW as described below.
Opcode Description Flag Status
JC ‫ﺟس‬ Jump on Carry CY = 1
JNC ‫اﻟﺟﻧس‬ Jump on no Carry CY = 0
JP ‫ﺟب‬ Jump on positive S=0
JM ‫اﻟﺟم‬ Jump on minus S=1
JZ ‫ﺟز‬ Jump on zero Z=1
JNZ ‫اﻟﺟﻧز‬ Jump on no zero Z=0
JPE ‫ﺟﯾﺑﻲ‬ Jump on parity even P=1
JPO ‫ﺟﯾﺑو‬ Jump on parity odd P=0
Example 1: Write a program to add two bytes and store the result in memory
location 2050H. Also store the carry as 1 if there is a carry, in the next memory
location. If there is no carry, store a 0 in the next location.
Answer
• MVI C,00
• MVI A,05
• MVI B,04
• ADD B
• JNC AHEAD
• INR C
• AHEAD: STA 2050
• MOV A,C
• STA 2051
• HLT
Machine control instructions

• HLT
• Stop executing the program.

• NOP
• No operation
• Exactly as it says, do nothing.
• Usually used for delay or to replace instructions during debugging
‫ﺟﺎء ﻓﺎﻻﺧﺗﺑﺎر ﻋﻠﻰ ﺷﻛل اذﻛري ﻧوع ھذي اﻻﻧﺳﺗرﻛﺷن وﻋطﺗﻧﺎ اﻧﺳﺗرﻛﺷن وﻗﺎﻟت اذﻛري ﻧوﻋﮭﺎ‬
Addressing Modes

Immediate Addressing
Direct Addressing
Register Addressing
Register Indirect Addressing
Implied Addressing

Immediate Addressing:
In immediate addressing mode, the data is specified in the instruction itself. The data
will be a part of the program instruction.

EXAMPLE:
MVI B, 3EH - Move the data 3EH given in the instruction to B register;

Direct Addressing:
In direct addressing mode, the address of the data is specified in the instruction. The
data will be in memory. In this addressing mode, the program instructions and data
can be stored in different memory.

EXAMPLE.
LDA 1050H - Load the data available in memory location 1050H in to accumulator;
Register Addressing:
In register addressing mode, the instruction specifies the name of the register in which
the data is available.

EXAMPLE.
MOV A, B - Move the content of B register to A register;

Register Indirect Addressing:


In register indirect addressing mode, the instruction specifies the name of the register in
which the address of the data is available. Here the data will be in memory and the
address will be in the register pair.

EXAMPLE.
MOV A, M - The memory data addressed by H L pair is moved to A register.

Implied Addressing:
In implied addressing mode, the instruction itself specifies the data to be operated.

EXAMPLE.
CMA - Complement the content of accumulator

You might also like