36
Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set Topic : Logical Instruction Name of Faculty : H.M.Avaiya & N.D.Dhameliya Name of Students: (i) Jaisingvani Vinita(094)

Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

Embed Size (px)

Citation preview

Page 1: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

Parul Polytechnic Institute

Subject Code : 3330705

Name Of Subject : Microprocessor and assembly language

programming

Name of Unit : 8085 instruction set

Topic : Logical Instruction

Name of Faculty : H.M.Avaiya & N.D.Dhameliya

Name of Students: (i) Jaisingvani Vinita(094)

(ii) Jawangjale Priyanka(110)

Page 2: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(1) Logical Instructions

• ANA R• ANA M

• AND specified data in register or memory with accumulator.

• Store the result in accumulator (A).

• Example: ANA B, ANA M

Page 3: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

B 10 C

D E

H L

A

B 0F C

D E

H L

A 0A

AFTER EXECUTION

ANA BA=A and R

B 0F C

D E

H L

A AA

BEFORE EXECUTION

CY

AC

CY 0

AC 1

AFTER EXECUTIONBEFORE EXECUTION

CY

AC

CY 0

AC 1

A 11A 55

H 20

L 50

H 20

L 50

B3 B32050H

ANA MA=A and M

2050H

1010 1010=AAH0000 1111=0FH

0000 1010=0AH

0101 0101=55H1011 0011=B3H

0001 0001=11H

Page 4: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(2) Logical Instructions

• ANI 8-bit data

• AND 8-bit data with accumulator (A).• Store the result in accumulator (A)

• Example: ANI 3FH

Page 5: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

CY

AC

A B3

AFTER EXECUTIONBEFORE EXECUTION

CY 0

AC 1

A 33

ANI 3FHA=A and DATA(8)

1011 0011=B3H0011 1111=3FH

0011 0011=33H

Page 6: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(3) Logical Instructions

• XRA Register (8-bit)

• XOR specified register with accumulator.• Store the result in accumulator.

• Example: XRA C

Page 7: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

B 10 C

D E

H L

A

B C 2D

D E

H L

A 87

AFTER EXECUTION

XRA CA=A xor R

B C 2D

D E

H L

A AA

BEFORE EXECUTION

CY

AC

CY 0

AC 0

1010 1010=AAH0010 1101=2DH

1000 0111=87H

Page 8: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(4) Logical Instructions

• XRA M

• XOR data in memory (memory location pointed by H-L pair) with Accumulator.

• Store the result in Accumulator.

• Example: XRA M

Page 9: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

H 20 L 50

A 55

AFTER EXECUTION

XRA MA=A xor M

BEFORE EXECUTION

CY

AC

CY 0

AC 0

0101 0101=55H1011 0011=B3H

1110 0110=E6H

H 20 L 50

A E6B3 B32050H 2050H

Page 10: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(5) Logical Instructions

• XRI 8-bit data

• XOR 8-bit immediate data with accumulator (A).• Store the result in accumulator.

• Example: XRI 39H

Page 11: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

CY

AC

A B3

AFTER EXECUTIONBEFORE EXECUTION

CY 0

AC 0

A 8A

XRI 39HA=A xor DATA(8)

1011 0011=B3H0011 1001=39H

1000 1010=8AH

Page 12: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(6) Logical Instructions

• ORA Register

• OR specified register with accumulator (A).• Store the result in accumulator.

• Example: ORA B

Page 13: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

AFTER EXECUTIONBEFORE EXECUTION

CY

AC

ORA BA=A or R

1010 1010=AAH0001 0010=12H

1011 1010=BAH

B 12 C

D E

H L

A AA

B 12 C

D E

H L

A BA

CY 0

AC 0

Page 14: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(7) Logical Instructions

• ORA M

• OR specified register with accumulator (A).• Store the result in accumulator.

• Example: ORA M

Page 15: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

AFTER EXECUTIONBEFORE EXECUTION

CY

AC

ORA MA=A or M

0101 0101=55H1011 0011=B3H

1111 0111=F7H

H 20 L 50

A 55 A F7

CY 0

AC 0

H 20 L 50

B3 B32050H 2050H

Page 16: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(8) Logical Instructions

• ORI 8-bit data

• OR 8-bit data with accumulator (A).• Store the result in accumulator.

• Example: ORI 08H

Page 17: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

CY

AC

A B3

AFTER EXECUTIONBEFORE EXECUTION

CY 0

AC 0

A BB

ORI 08HA=A or DATA(8)

1011 0011=B3H0000 1000=08H

1011 1011=BBH

Page 18: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(9) Logical Instructions

• CMP Register• CMP M

• Compare specified data in register or memory with accumulator (A).

• Store the result in accumulator.

• Example: CMP D or CMP M

Page 19: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

B 10 C

D E

H L

A

B C

D B9 E

H L

A B8

AFTER EXECUTION

CMP DA-R

B C

D B9 E

H L

A B8

BEFORE EXECUTION

CY

Z

CY 0

Z 0

AFTER EXECUTIONBEFORE EXECUTION

CY

Z

CY 0

Z 1

A B8A B8

H 20

L 50

H 20

L 50

B8 B82050H CMP M

A-M

2050H

A>R: CY=0,Z=0A=R: CY=0,Z=1A<R: CY=1,Z=0

A>M: CY=0,Z=0A=M: CY=0,Z=1A<M: CY=1,Z=0

Page 20: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(10) Logical Instructions

• CPI 8-bit data

• Compare 8-bit immediate data with accumulator (A).

• Store the result in accumulator.

• Example: CPI 30H

Page 21: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

CY

Z

A BA

AFTER EXECUTIONBEFORE EXECUTION

CY 0

AC 0

A BA

CPI 30HA-DATA

A>DATA: CY=0,Z=0A=DATA: CY=0,Z=1A<DATA: CY=1,Z=0

1011 1010=BAH

Page 22: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(11) Logical Instructions

• STC

• It sets the carry flag to 1.• Example: STC

Page 23: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

CY 0

AFTER EXECUTIONBEFORE EXECUTION

CY 1

STCCY=1

Page 24: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(12) Logical Instructions

• CMC

• It complements the carry flag.• Example: CMC

Page 25: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

CY 1

AFTER EXECUTIONBEFORE EXECUTION

CY 0

CMC

Page 26: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(13) Logical Instructions

• CMA

• It complements each bit of the accumulator.• Example: CMA

Page 27: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(14) Logical Instructions

• RLC

• Rotate accumulator left• 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.

• Example: RLC.

Page 28: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

B7 B6 B5 B4 B3 B2 B1 B0CY

B6 B5 B4 B3 B2 B1 B0 B7B7

AFTER EXECUTION

BEFORE EXECUTION

Page 29: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(15) Logical Instructions

• RRC

• Rotate accumulator right• 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.

• Example: RRC.

Page 30: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

B7 B6 B5 B4 B3 B2 B1 B0 CY

B0 B7 B6 B5 B4 B3 B2 B1 B0

AFTER EXECUTION

BEFORE EXECUTION

Page 31: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(16) Logical Instructions

• RAL

• Rotate accumulator left through carry• 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.

• Example: RAL.

Page 32: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

B7 B6 B5 B4 B3 B2 B1 B0CY

B6 B5 B4 B3 B2 B1 B0 CYB7

AFTER EXECUTION

BEFORE EXECUTION

Page 33: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

(17) Logical Instructions

• RAR

• Rotate accumulator right through carry• 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.

• Example: RAR

Page 34: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

B7 B6 B5 B4 B3 B2 B1 B0 CY

CY B7 B6 B5 B4 B3 B2 B1 B0

AFTER EXECUTION

BEFORE EXECUTION

Page 35: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

Concept of Subroutine

• In 8085 microprocessor a subroutine is a separate program written aside from main program ,this program is basically the program which requires to be executed several times in the main program.

• The microprocessor can call subroutine any time using CALL instruction. after the subroutine is executed the subroutine hands over the program to main program using RET instruction.

Page 36: Parul Polytechnic Institute Subject Code : 3330705 Name Of Subject : Microprocessor and assembly language programming Name of Unit : 8085 instruction set

THANK YOU