SlideShare a Scribd company logo
1 of 45
Basic Programming of 8085 
B.SAKTHISUDHURSUN 
12MT06PED003
CONTENTS 
1)Introduction 
2)Methods of programming 
3)Assembler Instruction format 
4)Instructions set of 8085 
5) Simple Programs
1) Introduction 
 Purpose of Processors & Controllers: 
To perform the user defined task 
 How to communicate this tasks to microprocessor????? 
Through program 
 What is program???? 
Sequence of instructions to perform the specified task. 
Instructions: 
An instruction is a binary pattern designed inside a 
microprocessor to perform a specific function 
 A microprocessor executes instructions given by the user to 
perform specified task. 
 Microprocessor understands the language of 0’s and 1’s only 
This language is called Machine Language
2) Types of Programming Language 
00111110 
00000010 
00000110 
00000100 
10000000 
Can we understand this???? 
Program to add two numbers 
Very difficult to understand 
Difficult to correct the errors 
What is the solution ????? 
1) Assembly Language 
2) High Level language
Assembly Language 
• Microprocessor cannot understand a program written in 
Assembly language 
• A program known as Assembler is used to convert a Assembly 
language program to machine language 
Assembly 
Language 
Program 
Assembler 
Program 
Machine 
Language 
Code
High Level Language 
• Machine language and Assembly language are both 
– Microprocessor specific (Machine dependent) 
• Machine independent languages are called 
– High-level languages 
– For e.g. BASIC, PASCAL,C++,C,JAVA, etc. 
– A software called Compiler is required to convert a high-level 
language program to machine code
With whom we have to communicate??? 
Accumulator (8-bit) Flag Register (8-bit) 
B (8-bit) C (8-bit) 
D (8-bit) E (8-bit) 
H (8-bit) L (8-bit) 
Stack Pointer (SP) (16-bit) 
Program Counter (PC) (16-bit) 
8- Lines 
Bidirectional 
16- Lines 
Unidirectional
Registers of 8085 
Six general-purpose registers: 
- B, C, D, E, H, L 
- Can be combined as register pairs to perform 16-bit 
operations 
Accumulator : 
– identified by name A 
– part of ALU 
– Performs arithmetic and logical operations & is stored in it 
Flag Register: 
-Part of ALU 
- 8085 has five flags named 
1. Zero flag (Z) 
2. Carry flag (CY) 
3. Sign flag (S) 
4. Parity flag (P) 
5. Auxiliary Carry flag (AC) 
Stack Pointer Register 
-16-bit memory pointer register 
-Points to a location in Stack memory 
-Beginning address defined by user
What is an Instruction set??? 
• An instruction is a binary pattern designed inside 
a microprocessor to perform a specific function 
• The entire group of instructions that a microprocessor 
supports is called Instruction Set. 
• Consists of 
– 246 Instructions, e.g. MOV A,B 
• Each instruction is represented by an 8-bit binary 
value. 
• These 8-bits of binary value is called Op-Code
3) Assembler Instruction Format 
Format: 4 Fields 
Label: Mnemonic operand1, operand2; comment 
Example: 
Label Mnemonic Operands Comment 
START: MOV A, 54 ;Load A Register with 54H 
Label: An identifier or a symbolic name 
Mnemonic: 
Used in conjunction with branch instruction 
Aims to translate information into a form that 
the human brain can retain better than its original form. 
Definition: 
Specifies operation to be executed in human 
understandable format 
Operand: On which operation is performed. It can have no or single or double operator
4) Classification of Instruction Sets 
• 8085 instructions can be classified as 
1. Data Transfer (Copy) 
2. Arithmetic 
3. Logical and Bit manipulation 
4. Branch 
5. Machine Control
Data Transfer Instructions 
• These instructions move data between 
registers, or between memory and registers 
• These instructions copy data from source to 
destination 
• While copying, the contents of source are not 
modified.
Data Transfer Instructions
Data Transfer Instructions
Data Transfer Instructions
Data Transfer Instructions
Data Transfer Instructions
Data Transfer Instructions 
LHLD 16-Bit Address Load HL pair with content 
of Direct address 
•The contents of 16-bit address is stored to L register 
•The contents of next memory location is stored to H register 
•Example: LHLD 1500H
Data Transfer Instructions
Data Transfer Instructions
Data Transfer Instructions
Data Transfer Instructions
Data Transfer Instructions
Data Transfer Instructions
Summary of Data Transfer Instructions 
1. Load a 8-bit number in a Register 
2. Copy from Register to Register 
3. Copy between Register and Memory 
4. Copy between Input/output Port and 
Accumulator 
5. Load a 16-bit number in a Register pair 
6. Copy between Register pair and Stack memory
Program 
Write a program to exchange memory contents of 2000H with 
4000H.
Programs 
2000 AA 
2001 BB 
2002 CC 
Memory Contents: 
Find the contents of H & L register after executing following Instruction? 
LXI H, 2001 
LHLD 2001 
Solution: 
After first instruction H=20H & L=01 
After second instruction H=CC & L=BB
PUSH & POP Testing Point 
1) If the Initial content of SP is 2000H. 
What is the value in SP if the number PUSH operation is equal to number of 
POP operation. 
2) If the content of SP is 2000H 
If POP instruction is used before PUSH instruction what will happen 
Answers: 
1) SP value will be same 
2) Garbage or unpredicted operation results
Data Transfer Instructions
More Test on PUSH & POP operations 
Find the contents of DE pair and PSW after executing following Instruction/ 
PUSH B 
PUSH H 
POP D 
POP PSW 
Initial Contents: 
SP=A000H 
BC=1050 
HL=8090 
90 E 
80 D 
50  Flag 
10 A 
9FFC 
9FFD 
9FFE 
9FFF 
A000SP
Program to understand I/O Operation 
Write a program to display following letter E. Assume the address of the LED is 
20H.Assume A is connected to AD0 and G is connected to AD7 
Assume it is connected in Common Cathode. 
Means all the cathode are connected through 
a resistance and grounded 
It is not an actual 7 Segment Display available in market. It is just for our example
Program to understand I/O Operation 
8085 
Decoder 
LATCH 
A 
B 
C 
D 
E 
F 
G 
Address Bus 
_ _ 
IO/M, WR 
Enable Signal 
Grounded 
Data Bus 
D0 
D6 
Solution: 
MVI A,F9 
OUT 20H 
HLT
Arithmetic Instructions
Arithmetic Instructions 
1. Add an immediate data with 
Accumulator 
2. Add contents of 
Registers(B,C,D,E ,H,L) or 
memory to Accumulator 
3. Add an immediate data with 
carry to Accumulator 
4. Add contents of or memory 
to Accumulator with carry 
5. Add 16 bit contents of 
Register pair with content of 
HL register 
ADI 32H 
ADD B 
ACI 42H 
ADC D 
DAD D
Arithmetic Instructions 
1. Subtract an immediate 
data from Accumulator 
2. Subtract contents of Rn 
from Accumulator 
3. Subtract an immediate 
data from Accumulator 
with borrow 
4. Subtract contents of Rn 
from Accumulator with 
borrow 
SUI 32H 
SUB B 
SIB 42H 
SBB D
Arithmetic Instructions 
1. Increment the contents 
of Rn or memory by 1 
2. Increment the contents 
of Rp by 1 
3. Decrement the 
contents of Rn or 
memory by 1 
4. Decrement the 
contents of Rp by 1 
5. Decimal Adjust 
accumulator 
INR A 
INX B 
DCR C 
DCX D 
DAA
Flag Register Status on Arithmetic Instructions 
Sl.NO Instruction CY AC S P Z 
1 ADD      
2 ADI      
3 ADC      
4 ACI      
5 SUB      
6 SUI      
7 SBB      
8 SBI      
9 INR      
10 INX      
 Not affected Affected
Flag Register Status on Arithmetic Instructions 
Sl.NO Instruction CY AC S P Z 
11 DCR      
12 DCX      
13 DAD      
14 DAA      
 Not affected Affected
Example 
Write a program/Instruction to Shift 16 bit data stored in HL 
Register towards left by 1 bit. 
CLUE: Use DAD instruction 
To shift left by 5 bit. How many times we have to execute the above Instruction 
What will happen if results exceed the FFFF. Will it work 
What are the application of shifting operation? 
1. Multiplication & Division 
2. Serial communication
How to Clear Flag Register 
One of the example: 
LXI B, 00H 
PUSH B 
POP PSW
Test point for Flag Register operation 
Find the content of Flag Register after 
each operation. Identify what this 
program is doing 
1. LXI H, 2040 
2. LHLD 2041 
3. ADD M 
4. INX H 
5. MOV M,A 
F0 
20 
42 
02 
A 
2043 
2042 
2041 
2040 
Solution: 
1. No change 
2. No change 
3. Affected 
4. No change 
5. No change 
1) H=20 , L=40 
2) H=20, L=42 
3) A=F0+20= 10 
4) H=20, L=43 
5) 2043=10 
Adding the content in 2042 and store 
the sum in 2043 
Flag Status: 
0 0 X 0 X 0 X 1
Machine Control Instructions 
1. NOP 
2. HALT 
3. DI 
4. EI 
No operation is performed 
An interrupt or Reset is 
required to come out from 
Halt State 
Disable all interrupt except 
TRAP 
To Enable all interrupt 
except TRAP. 
After Reset or interrupt 
acknowledgement 
interrupt flag is disabled
Steps to write Program 
• Steps to write a program 
–Analyze the problem 
– Develop program Logic 
– Write an Algorithm 
–Make a Flowchart 
– Write program Instructions using 
Assembly language of 8085
Basic programming of 8085

More Related Content

What's hot

Assembly Language Programming Of 8085
Assembly Language Programming Of 8085Assembly Language Programming Of 8085
Assembly Language Programming Of 8085techbed
 
Microprocessor instructions
Microprocessor instructionsMicroprocessor instructions
Microprocessor instructionshepzijustin
 
Microprocessor 8085 addition of two decimal number
Microprocessor 8085 addition of two decimal numberMicroprocessor 8085 addition of two decimal number
Microprocessor 8085 addition of two decimal numberSukanta Dutta
 
Microprocessor lab
Microprocessor labMicroprocessor lab
Microprocessor labkpaulraj
 
8085 instruction set and Programming
8085 instruction set and Programming 8085 instruction set and Programming
8085 instruction set and Programming pooja saini
 
Data transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorData transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorvishalgohel12195
 
Instruction set 8085
Instruction set 8085Instruction set 8085
Instruction set 8085varun sukheja
 
Assembly language i
Assembly language iAssembly language i
Assembly language iVivek Kumar
 
8051 Assembly Language Programming
8051 Assembly Language Programming8051 Assembly Language Programming
8051 Assembly Language ProgrammingRavikumar Tiwari
 
Chapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional InstructionsChapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional Instructionscmkandemir
 
Computer archi&mp
Computer archi&mpComputer archi&mp
Computer archi&mpMSc CST
 
Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!PRABHAHARAN429
 
Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Basil John
 

What's hot (19)

Assembly Language Programming Of 8085
Assembly Language Programming Of 8085Assembly Language Programming Of 8085
Assembly Language Programming Of 8085
 
8085 alp programs
8085 alp programs8085 alp programs
8085 alp programs
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Microprocessor instructions
Microprocessor instructionsMicroprocessor instructions
Microprocessor instructions
 
Microprocessor 8085 addition of two decimal number
Microprocessor 8085 addition of two decimal numberMicroprocessor 8085 addition of two decimal number
Microprocessor 8085 addition of two decimal number
 
Microprocessor lab
Microprocessor labMicroprocessor lab
Microprocessor lab
 
Intel 8051 Programming in C
Intel 8051 Programming in CIntel 8051 Programming in C
Intel 8051 Programming in C
 
8085 instruction set and Programming
8085 instruction set and Programming 8085 instruction set and Programming
8085 instruction set and Programming
 
Data transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorData transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processor
 
Instruction set 8085
Instruction set 8085Instruction set 8085
Instruction set 8085
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
Assembly language i
Assembly language iAssembly language i
Assembly language i
 
8051 Assembly Language Programming
8051 Assembly Language Programming8051 Assembly Language Programming
8051 Assembly Language Programming
 
8051 programming in c
8051 programming in c8051 programming in c
8051 programming in c
 
Chapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional InstructionsChapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional Instructions
 
Computer archi&mp
Computer archi&mpComputer archi&mp
Computer archi&mp
 
8085 instruction-set new
8085 instruction-set new8085 instruction-set new
8085 instruction-set new
 
Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!Microprocessor and Microcontroller Lab Manual!
Microprocessor and Microcontroller Lab Manual!
 
Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)Introduction to 8085 & it's description(includes basic lab experiments)
Introduction to 8085 & it's description(includes basic lab experiments)
 

Viewers also liked

Viewers also liked (18)

презентация1
презентация1презентация1
презентация1
 
Ms community.cloud express-route
Ms community.cloud express-routeMs community.cloud express-route
Ms community.cloud express-route
 
Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled Presentation
 
12 mt06ped005
12 mt06ped005 12 mt06ped005
12 mt06ped005
 
Struktur sel (konsep sel)
Struktur sel (konsep sel)Struktur sel (konsep sel)
Struktur sel (konsep sel)
 
Hemanth143
Hemanth143 Hemanth143
Hemanth143
 
8051 serial communication1
8051 serial communication1 8051 serial communication1
8051 serial communication1
 
Struktur sel (organel)
Struktur sel (organel)Struktur sel (organel)
Struktur sel (organel)
 
Lyon
LyonLyon
Lyon
 
Azure de szenarien-v2-eshelter
Azure de szenarien-v2-eshelterAzure de szenarien-v2-eshelter
Azure de szenarien-v2-eshelter
 
Ihminen puhdastilassa
Ihminen puhdastilassaIhminen puhdastilassa
Ihminen puhdastilassa
 
Jaringan komputer
Jaringan komputerJaringan komputer
Jaringan komputer
 
Digitale Transformation Now & Then
Digitale Transformation Now & ThenDigitale Transformation Now & Then
Digitale Transformation Now & Then
 
Storage Spaces Direct - Introduction
Storage Spaces Direct - IntroductionStorage Spaces Direct - Introduction
Storage Spaces Direct - Introduction
 
Puhdastilatekniikan perusteet
Puhdastilatekniikan perusteetPuhdastilatekniikan perusteet
Puhdastilatekniikan perusteet
 
Surat niaga
Surat niagaSurat niaga
Surat niaga
 
Cleanroom clothing - Why, what and how?
Cleanroom clothing - Why, what and how?Cleanroom clothing - Why, what and how?
Cleanroom clothing - Why, what and how?
 
Réinvestir le blog
Réinvestir le blogRéinvestir le blog
Réinvestir le blog
 

Similar to Basic programming of 8085

8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller nitugatkal
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :PJathin Kanumuri
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction setSaumitra Rukmangad
 
microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2Jathin Kanumuri
 
Unit 2 Instruction set.pdf
Unit 2 Instruction set.pdfUnit 2 Instruction set.pdf
Unit 2 Instruction set.pdfHimanshuPant41
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSSwapnil Mishra
 
Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Shubham Singh
 
8085 microprocessor(1)
8085 microprocessor(1)8085 microprocessor(1)
8085 microprocessor(1)Reevu Pal
 
03 addr mode & instructions
03 addr mode & instructions03 addr mode & instructions
03 addr mode & instructionsShubhamBakshi14
 
Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3Sajan Agrawal
 
Microprocessor lab manual
Microprocessor lab manualMicroprocessor lab manual
Microprocessor lab manualDhaval Shukla
 
Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Ikhwan_Fakrudin
 
Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computerKamal Acharya
 

Similar to Basic programming of 8085 (20)

12 mt06ped008
12 mt06ped008 12 mt06ped008
12 mt06ped008
 
MPMC UNIT-2.pdf
MPMC UNIT-2.pdfMPMC UNIT-2.pdf
MPMC UNIT-2.pdf
 
8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :P
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
 
microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2
 
Unit 2 Instruction set.pdf
Unit 2 Instruction set.pdfUnit 2 Instruction set.pdf
Unit 2 Instruction set.pdf
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
 
Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085
 
8085 microprocessor(1)
8085 microprocessor(1)8085 microprocessor(1)
8085 microprocessor(1)
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
 
03 addr mode & instructions
03 addr mode & instructions03 addr mode & instructions
03 addr mode & instructions
 
Lec04
Lec04Lec04
Lec04
 
Lec04
Lec04Lec04
Lec04
 
Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3
 
Microprocessor lab manual
Microprocessor lab manualMicroprocessor lab manual
Microprocessor lab manual
 
Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2
 
Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Real Time Embedded System
Real Time Embedded SystemReal Time Embedded System
Real Time Embedded System
 

Basic programming of 8085

  • 1. Basic Programming of 8085 B.SAKTHISUDHURSUN 12MT06PED003
  • 2. CONTENTS 1)Introduction 2)Methods of programming 3)Assembler Instruction format 4)Instructions set of 8085 5) Simple Programs
  • 3. 1) Introduction  Purpose of Processors & Controllers: To perform the user defined task  How to communicate this tasks to microprocessor????? Through program  What is program???? Sequence of instructions to perform the specified task. Instructions: An instruction is a binary pattern designed inside a microprocessor to perform a specific function  A microprocessor executes instructions given by the user to perform specified task.  Microprocessor understands the language of 0’s and 1’s only This language is called Machine Language
  • 4. 2) Types of Programming Language 00111110 00000010 00000110 00000100 10000000 Can we understand this???? Program to add two numbers Very difficult to understand Difficult to correct the errors What is the solution ????? 1) Assembly Language 2) High Level language
  • 5. Assembly Language • Microprocessor cannot understand a program written in Assembly language • A program known as Assembler is used to convert a Assembly language program to machine language Assembly Language Program Assembler Program Machine Language Code
  • 6. High Level Language • Machine language and Assembly language are both – Microprocessor specific (Machine dependent) • Machine independent languages are called – High-level languages – For e.g. BASIC, PASCAL,C++,C,JAVA, etc. – A software called Compiler is required to convert a high-level language program to machine code
  • 7. With whom we have to communicate??? Accumulator (8-bit) Flag Register (8-bit) B (8-bit) C (8-bit) D (8-bit) E (8-bit) H (8-bit) L (8-bit) Stack Pointer (SP) (16-bit) Program Counter (PC) (16-bit) 8- Lines Bidirectional 16- Lines Unidirectional
  • 8. Registers of 8085 Six general-purpose registers: - B, C, D, E, H, L - Can be combined as register pairs to perform 16-bit operations Accumulator : – identified by name A – part of ALU – Performs arithmetic and logical operations & is stored in it Flag Register: -Part of ALU - 8085 has five flags named 1. Zero flag (Z) 2. Carry flag (CY) 3. Sign flag (S) 4. Parity flag (P) 5. Auxiliary Carry flag (AC) Stack Pointer Register -16-bit memory pointer register -Points to a location in Stack memory -Beginning address defined by user
  • 9. What is an Instruction set??? • An instruction is a binary pattern designed inside a microprocessor to perform a specific function • The entire group of instructions that a microprocessor supports is called Instruction Set. • Consists of – 246 Instructions, e.g. MOV A,B • Each instruction is represented by an 8-bit binary value. • These 8-bits of binary value is called Op-Code
  • 10. 3) Assembler Instruction Format Format: 4 Fields Label: Mnemonic operand1, operand2; comment Example: Label Mnemonic Operands Comment START: MOV A, 54 ;Load A Register with 54H Label: An identifier or a symbolic name Mnemonic: Used in conjunction with branch instruction Aims to translate information into a form that the human brain can retain better than its original form. Definition: Specifies operation to be executed in human understandable format Operand: On which operation is performed. It can have no or single or double operator
  • 11. 4) Classification of Instruction Sets • 8085 instructions can be classified as 1. Data Transfer (Copy) 2. Arithmetic 3. Logical and Bit manipulation 4. Branch 5. Machine Control
  • 12. Data Transfer Instructions • These instructions move data between registers, or between memory and registers • These instructions copy data from source to destination • While copying, the contents of source are not modified.
  • 18. Data Transfer Instructions LHLD 16-Bit Address Load HL pair with content of Direct address •The contents of 16-bit address is stored to L register •The contents of next memory location is stored to H register •Example: LHLD 1500H
  • 25. Summary of Data Transfer Instructions 1. Load a 8-bit number in a Register 2. Copy from Register to Register 3. Copy between Register and Memory 4. Copy between Input/output Port and Accumulator 5. Load a 16-bit number in a Register pair 6. Copy between Register pair and Stack memory
  • 26. Program Write a program to exchange memory contents of 2000H with 4000H.
  • 27. Programs 2000 AA 2001 BB 2002 CC Memory Contents: Find the contents of H & L register after executing following Instruction? LXI H, 2001 LHLD 2001 Solution: After first instruction H=20H & L=01 After second instruction H=CC & L=BB
  • 28. PUSH & POP Testing Point 1) If the Initial content of SP is 2000H. What is the value in SP if the number PUSH operation is equal to number of POP operation. 2) If the content of SP is 2000H If POP instruction is used before PUSH instruction what will happen Answers: 1) SP value will be same 2) Garbage or unpredicted operation results
  • 29.
  • 31. More Test on PUSH & POP operations Find the contents of DE pair and PSW after executing following Instruction/ PUSH B PUSH H POP D POP PSW Initial Contents: SP=A000H BC=1050 HL=8090 90 E 80 D 50  Flag 10 A 9FFC 9FFD 9FFE 9FFF A000SP
  • 32. Program to understand I/O Operation Write a program to display following letter E. Assume the address of the LED is 20H.Assume A is connected to AD0 and G is connected to AD7 Assume it is connected in Common Cathode. Means all the cathode are connected through a resistance and grounded It is not an actual 7 Segment Display available in market. It is just for our example
  • 33. Program to understand I/O Operation 8085 Decoder LATCH A B C D E F G Address Bus _ _ IO/M, WR Enable Signal Grounded Data Bus D0 D6 Solution: MVI A,F9 OUT 20H HLT
  • 35. Arithmetic Instructions 1. Add an immediate data with Accumulator 2. Add contents of Registers(B,C,D,E ,H,L) or memory to Accumulator 3. Add an immediate data with carry to Accumulator 4. Add contents of or memory to Accumulator with carry 5. Add 16 bit contents of Register pair with content of HL register ADI 32H ADD B ACI 42H ADC D DAD D
  • 36. Arithmetic Instructions 1. Subtract an immediate data from Accumulator 2. Subtract contents of Rn from Accumulator 3. Subtract an immediate data from Accumulator with borrow 4. Subtract contents of Rn from Accumulator with borrow SUI 32H SUB B SIB 42H SBB D
  • 37. Arithmetic Instructions 1. Increment the contents of Rn or memory by 1 2. Increment the contents of Rp by 1 3. Decrement the contents of Rn or memory by 1 4. Decrement the contents of Rp by 1 5. Decimal Adjust accumulator INR A INX B DCR C DCX D DAA
  • 38. Flag Register Status on Arithmetic Instructions Sl.NO Instruction CY AC S P Z 1 ADD      2 ADI      3 ADC      4 ACI      5 SUB      6 SUI      7 SBB      8 SBI      9 INR      10 INX       Not affected Affected
  • 39. Flag Register Status on Arithmetic Instructions Sl.NO Instruction CY AC S P Z 11 DCR      12 DCX      13 DAD      14 DAA       Not affected Affected
  • 40. Example Write a program/Instruction to Shift 16 bit data stored in HL Register towards left by 1 bit. CLUE: Use DAD instruction To shift left by 5 bit. How many times we have to execute the above Instruction What will happen if results exceed the FFFF. Will it work What are the application of shifting operation? 1. Multiplication & Division 2. Serial communication
  • 41. How to Clear Flag Register One of the example: LXI B, 00H PUSH B POP PSW
  • 42. Test point for Flag Register operation Find the content of Flag Register after each operation. Identify what this program is doing 1. LXI H, 2040 2. LHLD 2041 3. ADD M 4. INX H 5. MOV M,A F0 20 42 02 A 2043 2042 2041 2040 Solution: 1. No change 2. No change 3. Affected 4. No change 5. No change 1) H=20 , L=40 2) H=20, L=42 3) A=F0+20= 10 4) H=20, L=43 5) 2043=10 Adding the content in 2042 and store the sum in 2043 Flag Status: 0 0 X 0 X 0 X 1
  • 43. Machine Control Instructions 1. NOP 2. HALT 3. DI 4. EI No operation is performed An interrupt or Reset is required to come out from Halt State Disable all interrupt except TRAP To Enable all interrupt except TRAP. After Reset or interrupt acknowledgement interrupt flag is disabled
  • 44. Steps to write Program • Steps to write a program –Analyze the problem – Develop program Logic – Write an Algorithm –Make a Flowchart – Write program Instructions using Assembly language of 8085

Editor's Notes

  1. Explanation: Suppose HL pair has content of 00000000 00000001. After executing the DAD H the following operation happens 00 01+ 00 01=0002 which is nothing but 00000000 00000010.