SlideShare ist ein Scribd-Unternehmen logo
1 von 78
3 August 2020 1
8085
Programming Model
Er. Pooja Saini
(spst.08@gmail.Com)
Ambala College of Engineering and Applied Research, Ambala
Programming Model
3 August 2020 2
Programming Model
3 August 2020 3
3 August 2020 4
Opcode Operand
Instruction Format
3 August 2020 5
ADDRESSING MODES
3 August 2020 6
Addressing Modes
 The microprocessor has different ways of specifying the data or
operand for the instruction.
 The various formats of specifying operands are called addressing
modes.
 The 8085 has 5 addressing modes
 Register Mode
 Immediate Mode
 Direct Mode
 Indirect Mode
 Implied Mode
3 August 2020 7
INSTRUCTION SET
Instruction Set of 8085
• Consists of
• 74 operation codes, e.g. MOV, MVI
• 246 Instructions, e.g. MOV A,B, MVI A,03
• 8085 instructions can be classified as
1. Data Transfer (Copy)
2. Arithmetic
3. Logical and Bit manipulation
4. Branch
5. Machine Control
3 August 2020 8
Data Transfer Instruction
• MOV Move
• MVI Move Immediate
• LDA Load Accumulator Directly from Memory
• STA Store Accumulator Directly in Memory
• LHLD Load Hand L Registers Directly from Memory
• SHLD Store Hand L Registers Directly in Memory
• LXI Load register pair Immediate
• LDAX Load accumulator indirect
• STAX Store Accumulator In direct
• XCHG Exchange DE pair and HL pair
• XTHL Exchange between HL pair and stack
3 August 2020 9
Data Transfer Instruction
3 August 2020 10
Data Transfer Instructions
• IN portaddr
• i.e. IN 00 ( Reads data from the Input Switch, 0 0represents the port
address of the input switch)
• OUT portaddr
• i.e. OUT 00 ( Writes data to the Display device where 00 represents the
Port address of the display)
3 August 2020 11
Data Transfer Instructions
• The 256 input/output ports provide communication with the outside
world of peripheral devices.
• The IN and OUT instructions initiate data transfers.
• The I N instruction latches the number of the desired port onto the
address bus. As soon as a byte of data is returned to the data bus latch,
it is transferred into the accumulator.
• The OUT instruction latches the number of the desired port onto the
address bus and latches the data in the accumulator onto the data bus.
3 August 2020 12
Arithmetic Instructions
• ADD Add to Accumulator
• ADI Add Immediate Data to Accumulator
• ADC Add to Accumulator Using Carry Flag
• ACI Add Immediate Data to Accumulator Using Carry Flag
• SUB Subtract from Accumulator
• SUI Subtract Immediate Data from Accumulator
3 August 2020 13
Arithmetic Instructions
• SBB Subtract from Accumulator Using Borrow ((:Carry)
Flag
• SBI Subtract I mmediate from Accumulator Using Borrow
• INR Increment Specified Byte by One
• DCR Decrement Specified Byte by One
• INX Increment Register Pair by One
• DCX Decrement Register Pair by One
• DAD Double Register Add: Add Contents of Register
Pair to Hand L Register Pair
3 August 2020 14
Arithmetic Instructions
3 August 2020 15
Logical Instructions
• ANA Logical AND with Accumulator
• ANI Logical AND with Accumulator Using Immediate Data
• ORA Logical OR with Accumulator
• ORI Logical OR with Accumulator Using Immediate Data
• XRA Exclusive Logical OR with Accumulator
• XRI Exclusive OR Using Immediate Data
• CMP Compare
• CPI Compare Using Immediate Data
3 August 2020 16
Logical Instructions
• RLC Rotate Accumulator Left
• RRC Rotate Accumulator Right
• RAL Rotate Left Through Carry
• RAR Rotate Right Through Carry
• CMA Complement Accumulator
• CMC Complement Carry Flag
• STC Set Carry Flag
3 August 2020 17
Logical Instructions
3 August 2020 18
Logical Instructions
3 August 2020 19
Logical Instructions
3 August 2020 20
Logical Instructions
3 August 2020 21
Branching Instructions
• The unconditional branching instructions are as follows:
• JMP Jump
• CALL Call
• RET Return
• Conditional branching instructions
• jumps Calls Returns
• JC CC RC (Carry)
• JNC CNC RNC (No Carry)
• JZ CZ RZ (Zero)
• JNZ CNZ RNZ (Not Zero)
3 August 2020 22
Branching Instructions
• JP CP RP (Plus)
• JM CM RM (Minus)
• JPE CPE RPE (Parity Even)
• JPO CPO RPO (Parity Odd)
• PCHL Move Hand L to Program Counter
• RST Special Restart Instruction Used with
Interrupts
3 August 2020 23
Jump Instructions
3 August 2020 24
Call Instructions
3 August 2020 25
Return Instructions
3 August 2020 26
Re start Instructions
3 August 2020 27
Stack, I/O, and Machine Control Instructions.
• PUSH Push Two Bytes of Data onto the Stack
• POP Pop Two Bytes of Data off the Stack
• XTHL Exchange Top of Stack with Hand L
• SPHL Move contents of Hand L to Stack Pointer
• The I/O instructions are as follows:
• IN Initiate Input Operation
• OUT Initiate Output Operation
3 August 2020 28
Stack, I/O, and Machine Control Instructions.
• The machine control instructions are as follows:
• EI Enable Interrupt System
• DI Disable Interrupt System
• HLT Halt
• NOP No Operation
3 August 2020 29
Stack, I/O, and Machine Control Instructions.
• RIM
3 August 2020 30
Stack, I/O, and Machine Control Instructions.
• SIM
3 August 2020 31
3 August 2020 32
ASSEMBLY LANGUAGE
PROGRAMMING
Programming
• 1. Write an assembly program to add two numbers
• MVI D, 02BH
• MVI C, 06FH
• MOV A, C
• ADD D
• STA 4500
• HLT
3 August 2020 33
Program
1. Write an assembly program to add two numbers
• LXI H, 4500
• MOV A, M
• INX H
• ADD M
• STA 4500
• HLT
3 August 2020 34
Program
2. Write an Assembly Language Program to add two numbers ;
results contain carry
LXI H, 4500
MOV A, M
INX H
ADD M
JNC LOOP 1
INR C
LOOP1 STA 4500
MOV A, C
STA 4501
HLT
3 August 2020 35
Program
2. Write an Assembly Language Program to add two numbers ;
results contain carry ( write the program using JC)
LXI H, 4500
MOV A, M
INX H
ADD M
JC LOOP 1
JMP LOOP 2
LOOP1 INR C
STA 4500
LOOP1 MOV A, C
STA 4501
HLT
3 August 2020 36
ADDITION OF TWO 16 – BIT NUMBERS
3. To write an assembly language program for adding two 16 bit
numbers using 8085 micro processor.
3 August 2020 37
SUM OF DATAS
4. To write an assembly language program to calculate the sum of datas
using 8085 microprocessor
3 August 2020 38
SUBTRACTION OF TWO 8 BIT NUMBERS
5. To write a assembly language program for subtracting 2 bit (8)
numbers by using- 8085
3 August 2020 39
SUBTRACTION OF TWO 16 BIT NUMBERS
6. To write an assembly language program for subtracting two 16
bit numbers using 8085 microprocessor kit.
3 August 2020 40
Multiplication ; No carry
• LDA 2000 // Load multiplicant to accumulator
• MOV B,A // Move multiplicant from A(acc) to B register
• LDA 2001 // Load multiplier to accumulator
• MOV C,A // Move multiplier from A to C
• MVI A,00 // Load immediate value 00 to a
• L: ADD B // Add B(multiplier) with A
• DCR C // Decrement C, it act as a counter
• JNZ L // Jump to L if C reaches 0
• STA 2010 // Store result in to memory
• HLT // End
3 August 2020 41
Multiplication ; With carry
•7. Write an assembly program to multiply a number by 8
MVI C,OO
LXI H, 4100
MOV B, M
INX H
MOV A, M
DCR B
LOOP 2 ADD M
JNC LOOP1
INR C
LOOP 1 DCR B
JNZ LOOP2
STA 4500
HLT
3 August 2020 42
Multiplication
3 August 2020 43
DIVISION OF TWO 8 – BIT NUMBERS
• To write an assembly language program for dividing two 8 bit numbers
using microprocessor
3 August 2020 44
ASCENDING ORDER
• 9. To write a program to sort given ‘n’ numbers in ascending order
3 August 2020 45
DESCENDING ORDER
• 10. To write a program to sort given ‘n’ numbers in descending order
3 August 2020 46
Program
11. Write an Assembly Language Program to transfer a block of
data from a series of locations to other.
• MVI C, 0AH ; Initialize counter i.e no. of bytes
Store the count in Register C, ie ten
• LXI H, 2200H ; Initialize source memory pointer Data Starts from
2200 location
• LXI D, 2300H ; Initialize destination memory pointer
BK: MOV A, M ; Get byte from source memory block i.e 2200
to accumulator.
• STAX D ; Store byte in the destination memory block i.e 2300 as
stored in D-E pair
3 August 2020 47
Program
• INX H ; Increment source memory pointer
• INX D ; Increment destination memory pointer
• DCR C ; Decrement counter to keep track of bytes
moved
• JNZ BK ; If counter 0 repeat steps
• HLT ; Terminate program
3 August 2020 48
Largest Number
•Write an Assembly Language Program to find a
largest number.
LXI H, 4500
MOV A, M
INX H
CMP M
JNC LOOP 1
JMP LOOP 2
LOOP1 STA 4500
LOOP2 MOV A, M
STA 4500
HLT
3 August 2020 49
Smallest Number
•Write an Assembly Language Program to find a
smallest number.
LXI H, 4500
MOV A, M
INX H
CMP M
JC LOOP 1
JMP LOOP 2
LOOP1 STA 4500
LOOP2 MOV A, M
STA 4500
HLT
3 August 2020 50
Occurrence Counting
•Write an Assembly Language Program to count the
repetition of a number.
3 August 2020 51
UP Counting
•Write an Assembly Language Program to count up to
7F
3 August 2020 52
UP Counting
•Write an Assembly Language Program to count from
&F to 00 , downwards
3 August 2020 53
3 August 2020 54
STACK AND SUBROUTINE
STACK
• The stack is an area of memory identified by the programmer for
temporary storage of information.
• The stack is a LIFO structure.
• The stack normally grows backwards into memory.
• Programmer can defines the bottom of (SP) the stack and the stack
grows up into reducing address range.
3 August 2020 55
STACK
• Stack is defined by setting the SP (Stack Pointer) register.
• LXI SP, FFFFH ,This sets SP to location FFFFH (end of memory for 8085).
3 August 2020 56
STACK
• Save information by PUSHing onto STACK
• Retrieved from STACK by POPing it off.
• PUSH and POP work with register pairs only.
• Example “PUSH B”
• – Decrement SP, Copy B to (SP-1)
• – Decrement SP, Copy C to (SP-1)
• Example “POP B”
• – Copy (SP+1) to C, Increment SP
• – Copy (SP+1) to B, Increment SP
3 August 2020 57
SUBROUTINE
• A subroutine is a group of instructions that is used repeatedly in
different places of the program.
• It can be grouped into a subroutine and call from the different
locations.
• The CALL instruction is used to redirect program execution to the
subroutine.
• The RET instruction is used to return the execution to the calling
routine.
3 August 2020 58
SUBROUTINE
• You must set the SP correctly before using CALL
• CALL 5000H
• – Push the PC value onto the stack
• – Load PC with 16‐bit address supplied CALL ins.
• RET : Load PC with stack top; POP PC
3 August 2020 59
SUBROUTINE
3 August 2020 60
SUBROUTINE
• SUBRTN:
• PUSH PSW
• PUSH B
• PUSH D
• PUSH H
•subroutine coding
• POP H
• POP D
• POP B
• POP PSW
• RETURN
3 August 2020 61
3 August 2020 62
SERIAL INPUT / OUTPUT
OPERATION
Serial Input /Out put
• 8085 Microprocessor has two Serial Input/output pins that are
used to read/write one bit data to and from peripheral
devices.
• SID (Serial Input Data line)
• There is an One bit Input line inside the 8085 CPU (SID line ,Pin
number 5)
• -The data that is read is stored in the A7th bit of the
Accumulator
• -RIM instruction is used to read the SID line
3 August 2020 63
Serial Input
3 August 2020 64
Serial Input
• Example Pseudocode:
• 1) RIM
• 2) A7 (SID)
• As seen from the figure 1, if the SID line is connected with +5V
and RIM instruction is executed, then the Accumulator’s MSB
bit will be loaded with a Logic 1
3 August 2020 65
Serial Input
3 August 2020 66
Serial Input
• RIM
3 August 2020 67
SOD (Serial Output Data) Line
• -There is a One bit Output port inside the 8085 CPU (Pin
number 4
• -1 bit data can be externally written in this port.
• -To write data into this port, SIM instruction is used.
• -The data that is to be written in this port must be stored in the
A7th bit of the Accumulator.
• Bit A6 of the Accumulator is known as SOE (Serial output
Enable).
• This bit Must be set to 1 to enable Serial data output.
3 August 2020 68
SOD (Serial Output Data) Line
3 August 2020 69
SOD (Serial Output Data) Line
3 August 2020 70
SOD (Serial Output Data) Line
•Pseudocode:
•A 40H
•SIM
•SOD (A7)
3 August 2020 71
SOD (Serial Output Data) Line
• S
3 August 2020 72
SIM
Problem
• The SID Pin of an 8085 microprocessor is connected with a
0V/+5V source and the SOD Pin is connected with a LED. Write
down the Pseudocode that will read the SID pin of the
microprocessor and glow the LED if the SID pin is connected
with a +5V source otherwise Turn the Led off if the SID Pin is
connected with GND (0V)
3 August 2020 73
INSTRUCTION SUMMARY
3 August 2020 74
INSTRUCTION SUMMARY
3 August 2020 75
INSTRUCTION SUMMARY
3 August 2020 76
INSTRUCTION SUMMARY
3 August 2020 77
INSTRUCTION SUMMARY
3 August 2020 78

Weitere ähnliche Inhalte

Was ist angesagt?

8085 microprocessor lab manual
8085 microprocessor lab manual8085 microprocessor lab manual
8085 microprocessor lab manual
Nithin Mohan
 
Memory interfacing
Memory interfacingMemory interfacing
Memory interfacing
mahalakshmimalini
 
Programming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacingProgramming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacing
Amitabh Shukla
 
Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))
Ganesh Ram
 
Register Organisation of 8086 Microprocessor
Register Organisation of 8086 MicroprocessorRegister Organisation of 8086 Microprocessor
Register Organisation of 8086 Microprocessor
Nikhil Kumar
 

Was ist angesagt? (20)

Addressing Modes of 8085 Microprocessor
Addressing Modes of 8085 MicroprocessorAddressing Modes of 8085 Microprocessor
Addressing Modes of 8085 Microprocessor
 
Introduction to 80386
Introduction to 80386Introduction to 80386
Introduction to 80386
 
PIC 16F877A by PARTHIBAN. S.
PIC 16F877A   by PARTHIBAN. S.PIC 16F877A   by PARTHIBAN. S.
PIC 16F877A by PARTHIBAN. S.
 
8086
80868086
8086
 
Stacks & subroutines 1
Stacks & subroutines 1Stacks & subroutines 1
Stacks & subroutines 1
 
MPMC LAB MANUAL EEE
MPMC LAB MANUAL EEEMPMC LAB MANUAL EEE
MPMC LAB MANUAL EEE
 
8085 microprocessor lab manual
8085 microprocessor lab manual8085 microprocessor lab manual
8085 microprocessor lab manual
 
Unit 2 mpmc
Unit 2 mpmcUnit 2 mpmc
Unit 2 mpmc
 
Memory interfacing
Memory interfacingMemory interfacing
Memory interfacing
 
Programming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacingProgramming with 8085-Microprocessor and interfacing
Programming with 8085-Microprocessor and interfacing
 
Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))Architecture of 8051 microcontroller))
Architecture of 8051 microcontroller))
 
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
 
Presentation on 8086 Microprocessor
Presentation  on   8086 MicroprocessorPresentation  on   8086 Microprocessor
Presentation on 8086 Microprocessor
 
MICROPROCESSOR INSTRUCTION SET OF 8085
MICROPROCESSOR INSTRUCTION SET OF 8085MICROPROCESSOR INSTRUCTION SET OF 8085
MICROPROCESSOR INSTRUCTION SET OF 8085
 
Addressing modes of 8085
Addressing modes of 8085Addressing modes of 8085
Addressing modes of 8085
 
Stack in 8085 microprocessor
Stack in 8085 microprocessorStack in 8085 microprocessor
Stack in 8085 microprocessor
 
Addressing modes of 8085
Addressing modes of 8085Addressing modes of 8085
Addressing modes of 8085
 
Register Organisation of 8086 Microprocessor
Register Organisation of 8086 MicroprocessorRegister Organisation of 8086 Microprocessor
Register Organisation of 8086 Microprocessor
 
PPT on 8085 Microprocessor
PPT on 8085 Microprocessor  PPT on 8085 Microprocessor
PPT on 8085 Microprocessor
 
80386 processor
80386 processor80386 processor
80386 processor
 

Ähnlich wie 8085 instruction set and Programming

Assemblylanguageprogrammingof8085 100523023329-phpapp02
Assemblylanguageprogrammingof8085 100523023329-phpapp02Assemblylanguageprogrammingof8085 100523023329-phpapp02
Assemblylanguageprogrammingof8085 100523023329-phpapp02
Swati Watve-Phadke
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085
vijaydeepakg
 

Ähnlich wie 8085 instruction set and Programming (20)

Chapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 InstructionsChapter 6 - Introduction to 8085 Instructions
Chapter 6 - Introduction to 8085 Instructions
 
Real Time Embedded System
Real Time Embedded SystemReal Time Embedded System
Real Time Embedded System
 
EE2356 Microprocessor and Microcontroller Lab Manuel
EE2356 Microprocessor and Microcontroller Lab ManuelEE2356 Microprocessor and Microcontroller Lab Manuel
EE2356 Microprocessor and Microcontroller Lab Manuel
 
8085 instructions and addressing modes
8085 instructions and addressing modes8085 instructions and addressing modes
8085 instructions and addressing modes
 
Malp edusat
Malp edusatMalp edusat
Malp edusat
 
8085 alp programs
8085 alp programs8085 alp programs
8085 alp programs
 
Assemblylanguageprogrammingof8085 100523023329-phpapp02
Assemblylanguageprogrammingof8085 100523023329-phpapp02Assemblylanguageprogrammingof8085 100523023329-phpapp02
Assemblylanguageprogrammingof8085 100523023329-phpapp02
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085
 
Assembly Language Paper.docx
Assembly Language Paper.docxAssembly Language Paper.docx
Assembly Language Paper.docx
 
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)
 
Lec04
Lec04Lec04
Lec04
 
Lec04
Lec04Lec04
Lec04
 
Microprocessor system - summarize
Microprocessor system - summarizeMicroprocessor system - summarize
Microprocessor system - summarize
 
8085 Assembly language programs.pdf
8085 Assembly language programs.pdf8085 Assembly language programs.pdf
8085 Assembly language programs.pdf
 
Lec03
Lec03Lec03
Lec03
 
5th unit Microprocessor 8085
5th unit Microprocessor 80855th unit Microprocessor 8085
5th unit Microprocessor 8085
 
Computer architecture 3
Computer architecture 3Computer architecture 3
Computer architecture 3
 
Question bank malp 3340302
Question bank malp 3340302Question bank malp 3340302
Question bank malp 3340302
 
Microprocessor lab manual
Microprocessor lab manualMicroprocessor lab manual
Microprocessor lab manual
 
Question Bank microcontroller 8051
Question Bank microcontroller 8051Question Bank microcontroller 8051
Question Bank microcontroller 8051
 

Kürzlich hochgeladen

Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 

Kürzlich hochgeladen (20)

Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 

8085 instruction set and Programming

  • 1. 3 August 2020 1 8085 Programming Model Er. Pooja Saini (spst.08@gmail.Com) Ambala College of Engineering and Applied Research, Ambala
  • 4. 3 August 2020 4 Opcode Operand Instruction Format
  • 5. 3 August 2020 5 ADDRESSING MODES
  • 6. 3 August 2020 6 Addressing Modes  The microprocessor has different ways of specifying the data or operand for the instruction.  The various formats of specifying operands are called addressing modes.  The 8085 has 5 addressing modes  Register Mode  Immediate Mode  Direct Mode  Indirect Mode  Implied Mode
  • 7. 3 August 2020 7 INSTRUCTION SET
  • 8. Instruction Set of 8085 • Consists of • 74 operation codes, e.g. MOV, MVI • 246 Instructions, e.g. MOV A,B, MVI A,03 • 8085 instructions can be classified as 1. Data Transfer (Copy) 2. Arithmetic 3. Logical and Bit manipulation 4. Branch 5. Machine Control 3 August 2020 8
  • 9. Data Transfer Instruction • MOV Move • MVI Move Immediate • LDA Load Accumulator Directly from Memory • STA Store Accumulator Directly in Memory • LHLD Load Hand L Registers Directly from Memory • SHLD Store Hand L Registers Directly in Memory • LXI Load register pair Immediate • LDAX Load accumulator indirect • STAX Store Accumulator In direct • XCHG Exchange DE pair and HL pair • XTHL Exchange between HL pair and stack 3 August 2020 9
  • 10. Data Transfer Instruction 3 August 2020 10
  • 11. Data Transfer Instructions • IN portaddr • i.e. IN 00 ( Reads data from the Input Switch, 0 0represents the port address of the input switch) • OUT portaddr • i.e. OUT 00 ( Writes data to the Display device where 00 represents the Port address of the display) 3 August 2020 11
  • 12. Data Transfer Instructions • The 256 input/output ports provide communication with the outside world of peripheral devices. • The IN and OUT instructions initiate data transfers. • The I N instruction latches the number of the desired port onto the address bus. As soon as a byte of data is returned to the data bus latch, it is transferred into the accumulator. • The OUT instruction latches the number of the desired port onto the address bus and latches the data in the accumulator onto the data bus. 3 August 2020 12
  • 13. Arithmetic Instructions • ADD Add to Accumulator • ADI Add Immediate Data to Accumulator • ADC Add to Accumulator Using Carry Flag • ACI Add Immediate Data to Accumulator Using Carry Flag • SUB Subtract from Accumulator • SUI Subtract Immediate Data from Accumulator 3 August 2020 13
  • 14. Arithmetic Instructions • SBB Subtract from Accumulator Using Borrow ((:Carry) Flag • SBI Subtract I mmediate from Accumulator Using Borrow • INR Increment Specified Byte by One • DCR Decrement Specified Byte by One • INX Increment Register Pair by One • DCX Decrement Register Pair by One • DAD Double Register Add: Add Contents of Register Pair to Hand L Register Pair 3 August 2020 14
  • 16. Logical Instructions • ANA Logical AND with Accumulator • ANI Logical AND with Accumulator Using Immediate Data • ORA Logical OR with Accumulator • ORI Logical OR with Accumulator Using Immediate Data • XRA Exclusive Logical OR with Accumulator • XRI Exclusive OR Using Immediate Data • CMP Compare • CPI Compare Using Immediate Data 3 August 2020 16
  • 17. Logical Instructions • RLC Rotate Accumulator Left • RRC Rotate Accumulator Right • RAL Rotate Left Through Carry • RAR Rotate Right Through Carry • CMA Complement Accumulator • CMC Complement Carry Flag • STC Set Carry Flag 3 August 2020 17
  • 22. Branching Instructions • The unconditional branching instructions are as follows: • JMP Jump • CALL Call • RET Return • Conditional branching instructions • jumps Calls Returns • JC CC RC (Carry) • JNC CNC RNC (No Carry) • JZ CZ RZ (Zero) • JNZ CNZ RNZ (Not Zero) 3 August 2020 22
  • 23. Branching Instructions • JP CP RP (Plus) • JM CM RM (Minus) • JPE CPE RPE (Parity Even) • JPO CPO RPO (Parity Odd) • PCHL Move Hand L to Program Counter • RST Special Restart Instruction Used with Interrupts 3 August 2020 23
  • 27. Re start Instructions 3 August 2020 27
  • 28. Stack, I/O, and Machine Control Instructions. • PUSH Push Two Bytes of Data onto the Stack • POP Pop Two Bytes of Data off the Stack • XTHL Exchange Top of Stack with Hand L • SPHL Move contents of Hand L to Stack Pointer • The I/O instructions are as follows: • IN Initiate Input Operation • OUT Initiate Output Operation 3 August 2020 28
  • 29. Stack, I/O, and Machine Control Instructions. • The machine control instructions are as follows: • EI Enable Interrupt System • DI Disable Interrupt System • HLT Halt • NOP No Operation 3 August 2020 29
  • 30. Stack, I/O, and Machine Control Instructions. • RIM 3 August 2020 30
  • 31. Stack, I/O, and Machine Control Instructions. • SIM 3 August 2020 31
  • 32. 3 August 2020 32 ASSEMBLY LANGUAGE PROGRAMMING
  • 33. Programming • 1. Write an assembly program to add two numbers • MVI D, 02BH • MVI C, 06FH • MOV A, C • ADD D • STA 4500 • HLT 3 August 2020 33
  • 34. Program 1. Write an assembly program to add two numbers • LXI H, 4500 • MOV A, M • INX H • ADD M • STA 4500 • HLT 3 August 2020 34
  • 35. Program 2. Write an Assembly Language Program to add two numbers ; results contain carry LXI H, 4500 MOV A, M INX H ADD M JNC LOOP 1 INR C LOOP1 STA 4500 MOV A, C STA 4501 HLT 3 August 2020 35
  • 36. Program 2. Write an Assembly Language Program to add two numbers ; results contain carry ( write the program using JC) LXI H, 4500 MOV A, M INX H ADD M JC LOOP 1 JMP LOOP 2 LOOP1 INR C STA 4500 LOOP1 MOV A, C STA 4501 HLT 3 August 2020 36
  • 37. ADDITION OF TWO 16 – BIT NUMBERS 3. To write an assembly language program for adding two 16 bit numbers using 8085 micro processor. 3 August 2020 37
  • 38. SUM OF DATAS 4. To write an assembly language program to calculate the sum of datas using 8085 microprocessor 3 August 2020 38
  • 39. SUBTRACTION OF TWO 8 BIT NUMBERS 5. To write a assembly language program for subtracting 2 bit (8) numbers by using- 8085 3 August 2020 39
  • 40. SUBTRACTION OF TWO 16 BIT NUMBERS 6. To write an assembly language program for subtracting two 16 bit numbers using 8085 microprocessor kit. 3 August 2020 40
  • 41. Multiplication ; No carry • LDA 2000 // Load multiplicant to accumulator • MOV B,A // Move multiplicant from A(acc) to B register • LDA 2001 // Load multiplier to accumulator • MOV C,A // Move multiplier from A to C • MVI A,00 // Load immediate value 00 to a • L: ADD B // Add B(multiplier) with A • DCR C // Decrement C, it act as a counter • JNZ L // Jump to L if C reaches 0 • STA 2010 // Store result in to memory • HLT // End 3 August 2020 41
  • 42. Multiplication ; With carry •7. Write an assembly program to multiply a number by 8 MVI C,OO LXI H, 4100 MOV B, M INX H MOV A, M DCR B LOOP 2 ADD M JNC LOOP1 INR C LOOP 1 DCR B JNZ LOOP2 STA 4500 HLT 3 August 2020 42
  • 44. DIVISION OF TWO 8 – BIT NUMBERS • To write an assembly language program for dividing two 8 bit numbers using microprocessor 3 August 2020 44
  • 45. ASCENDING ORDER • 9. To write a program to sort given ‘n’ numbers in ascending order 3 August 2020 45
  • 46. DESCENDING ORDER • 10. To write a program to sort given ‘n’ numbers in descending order 3 August 2020 46
  • 47. Program 11. Write an Assembly Language Program to transfer a block of data from a series of locations to other. • MVI C, 0AH ; Initialize counter i.e no. of bytes Store the count in Register C, ie ten • LXI H, 2200H ; Initialize source memory pointer Data Starts from 2200 location • LXI D, 2300H ; Initialize destination memory pointer BK: MOV A, M ; Get byte from source memory block i.e 2200 to accumulator. • STAX D ; Store byte in the destination memory block i.e 2300 as stored in D-E pair 3 August 2020 47
  • 48. Program • INX H ; Increment source memory pointer • INX D ; Increment destination memory pointer • DCR C ; Decrement counter to keep track of bytes moved • JNZ BK ; If counter 0 repeat steps • HLT ; Terminate program 3 August 2020 48
  • 49. Largest Number •Write an Assembly Language Program to find a largest number. LXI H, 4500 MOV A, M INX H CMP M JNC LOOP 1 JMP LOOP 2 LOOP1 STA 4500 LOOP2 MOV A, M STA 4500 HLT 3 August 2020 49
  • 50. Smallest Number •Write an Assembly Language Program to find a smallest number. LXI H, 4500 MOV A, M INX H CMP M JC LOOP 1 JMP LOOP 2 LOOP1 STA 4500 LOOP2 MOV A, M STA 4500 HLT 3 August 2020 50
  • 51. Occurrence Counting •Write an Assembly Language Program to count the repetition of a number. 3 August 2020 51
  • 52. UP Counting •Write an Assembly Language Program to count up to 7F 3 August 2020 52
  • 53. UP Counting •Write an Assembly Language Program to count from &F to 00 , downwards 3 August 2020 53
  • 54. 3 August 2020 54 STACK AND SUBROUTINE
  • 55. STACK • The stack is an area of memory identified by the programmer for temporary storage of information. • The stack is a LIFO structure. • The stack normally grows backwards into memory. • Programmer can defines the bottom of (SP) the stack and the stack grows up into reducing address range. 3 August 2020 55
  • 56. STACK • Stack is defined by setting the SP (Stack Pointer) register. • LXI SP, FFFFH ,This sets SP to location FFFFH (end of memory for 8085). 3 August 2020 56
  • 57. STACK • Save information by PUSHing onto STACK • Retrieved from STACK by POPing it off. • PUSH and POP work with register pairs only. • Example “PUSH B” • – Decrement SP, Copy B to (SP-1) • – Decrement SP, Copy C to (SP-1) • Example “POP B” • – Copy (SP+1) to C, Increment SP • – Copy (SP+1) to B, Increment SP 3 August 2020 57
  • 58. SUBROUTINE • A subroutine is a group of instructions that is used repeatedly in different places of the program. • It can be grouped into a subroutine and call from the different locations. • The CALL instruction is used to redirect program execution to the subroutine. • The RET instruction is used to return the execution to the calling routine. 3 August 2020 58
  • 59. SUBROUTINE • You must set the SP correctly before using CALL • CALL 5000H • – Push the PC value onto the stack • – Load PC with 16‐bit address supplied CALL ins. • RET : Load PC with stack top; POP PC 3 August 2020 59
  • 61. SUBROUTINE • SUBRTN: • PUSH PSW • PUSH B • PUSH D • PUSH H •subroutine coding • POP H • POP D • POP B • POP PSW • RETURN 3 August 2020 61
  • 62. 3 August 2020 62 SERIAL INPUT / OUTPUT OPERATION
  • 63. Serial Input /Out put • 8085 Microprocessor has two Serial Input/output pins that are used to read/write one bit data to and from peripheral devices. • SID (Serial Input Data line) • There is an One bit Input line inside the 8085 CPU (SID line ,Pin number 5) • -The data that is read is stored in the A7th bit of the Accumulator • -RIM instruction is used to read the SID line 3 August 2020 63
  • 65. Serial Input • Example Pseudocode: • 1) RIM • 2) A7 (SID) • As seen from the figure 1, if the SID line is connected with +5V and RIM instruction is executed, then the Accumulator’s MSB bit will be loaded with a Logic 1 3 August 2020 65
  • 67. Serial Input • RIM 3 August 2020 67
  • 68. SOD (Serial Output Data) Line • -There is a One bit Output port inside the 8085 CPU (Pin number 4 • -1 bit data can be externally written in this port. • -To write data into this port, SIM instruction is used. • -The data that is to be written in this port must be stored in the A7th bit of the Accumulator. • Bit A6 of the Accumulator is known as SOE (Serial output Enable). • This bit Must be set to 1 to enable Serial data output. 3 August 2020 68
  • 69. SOD (Serial Output Data) Line 3 August 2020 69
  • 70. SOD (Serial Output Data) Line 3 August 2020 70
  • 71. SOD (Serial Output Data) Line •Pseudocode: •A 40H •SIM •SOD (A7) 3 August 2020 71
  • 72. SOD (Serial Output Data) Line • S 3 August 2020 72 SIM
  • 73. Problem • The SID Pin of an 8085 microprocessor is connected with a 0V/+5V source and the SOD Pin is connected with a LED. Write down the Pseudocode that will read the SID pin of the microprocessor and glow the LED if the SID pin is connected with a +5V source otherwise Turn the Led off if the SID Pin is connected with GND (0V) 3 August 2020 73