0% found this document useful (0 votes)
147 views25 pages

Programming With 8085: Introduction To 8085 Instructions

The document provides an introduction to the 8085 microprocessor instruction set. It discusses the 8085 programming model which includes six general purpose registers (B, C, D, E, H, L), an accumulator register, flag register, program counter register, and stack pointer register. It then summarizes the main categories of the 8085 instruction set: 1) data transfer instructions, 2) arithmetic instructions, 3) logical and bit manipulation instructions, and 4) branching instructions. Examples are given for common instructions in each category.

Uploaded by

sukirti gupta
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)
147 views25 pages

Programming With 8085: Introduction To 8085 Instructions

The document provides an introduction to the 8085 microprocessor instruction set. It discusses the 8085 programming model which includes six general purpose registers (B, C, D, E, H, L), an accumulator register, flag register, program counter register, and stack pointer register. It then summarizes the main categories of the 8085 instruction set: 1) data transfer instructions, 2) arithmetic instructions, 3) logical and bit manipulation instructions, and 4) branching instructions. Examples are given for common instructions in each category.

Uploaded by

sukirti gupta
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/ 25

PROGRAMMING WITH 8085

LECTURE 2

INTRODUCTION TO
8085
INSTRUCTIONS
1. Introduction
• A microprocessor executes instructions given by
the user
• Instructions should be in a language known to
the microprocessor
• Microprocessor understands the language of 0’s
and 1’s only
• This language is called Machine Language
A Machine language program to
add two numbers

00111110 ;Copy value 2H in register A


00000010
00000110 ;Copy value 4H in register B
00000100
10000000 ;A = A + B
Assembly Language of 8085
• It uses English like words to convey the
action/meaning called as MNEMONICS
• For e.g.
– MOV to indicate data transfer
– ADD to add two values
– SUB to subtract two values
Assembly language program to add
two numbers
MVI A, 2H ;Copy value 2H in register A
MVI B, 4H ;Copy value 4H in register B
ADD B ;A = A + B

Note:
• Assembly language is specific to a given
processor
• For e.g. assembly language of 8085 is different
than that of Motorola 6800 microprocessor
Microprocessor understands Machine Language only!

• 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 Machine
Assembler
Language Language
Program
Program Code
Low-level/High-level languages
• Machine language and Assembly language are
both
– Microprocessor specific (Machine dependent)
so they are called
– Low-level languages
• 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
2. Programming model of 8085

Accumulator 16-bit
Address Bus
Register Array
ALU

Memory Pointer
Flags 8-bit Data
Registers Bus
Instruction
Decoder

Control Bus
Timing and Control Unit
Accumulator (8-bit) Flag Register (8-bit)
S Z AC P CY

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 16- Lines


Bidirectional Unidirectional
Overview: 8085 Programming model

1. Six general-purpose Registers


2. Accumulator Register
3. Flag Register
4. Program Counter Register
5. Stack Pointer Register
1. Six general-purpose registers
– B, C, D, E, H, L
– Can be combined as register pairs to
perform 16-bit operations (BC, DE, HL)
2. Accumulator – identified by name A
– This register is a part of ALU
– 8-bit data storage
– Performs arithmetic and logical operations
– Result of an operation is stored in
accumulator
3. Flag Register
– This is also a part of ALU
– 8085 has five flags named
• Zero flag (Z)
• Carry flag (CY)
• Sign flag (S)
• Parity flag (P)
• Auxiliary Carry flag (AC)
• These flags are five flip-flops in flag register
• Execution of an arithmetic/logic operation can
set or reset these flags
• Condition of flags (set or reset) can be tested
through software instructions
• 8085 uses these flags in decision-making
process
4. Program Counter (PC)
– A 16-bit memory pointer register
– Used to sequence execution of program
instructions
– Stores address of a memory location
• where next instruction byte is to be fetched
by the 8085
– when 8085 gets busy to fetch current
instruction from memory
• PC is incremented by one
• PC is now pointing to the address of next
instruction
5. Stack Pointer Register
– a 16-bit memory pointer register
– Points to a location in Stack memory
– Beginning of the stack is defined by loading
a 16-bit address in stack pointer register
3.Instruction Set of 8085
• Consists of
– 74 operation codes, e.g. MOV
– 246 Instructions, e.g. MOV A,B
• 8085 instructions can be classified as
1. Data Transfer (Copy)
2. Arithmetic
3. Logical and Bit manipulation
4. Branch
5. Machine Control
1. Data Transfer (Copy) Operations
Copying data from a source to destination
refers to data transfer function.
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
Example Data Transfer (Copy)
Operations / Instructions
1. Load a 8-bit number 4F in MVI B, 4FH
register B
2. Copy from Register B to MOV A,B
Register A
3. Load a 16-bit number LXI H, 2050H
2050 in Register pair HL
4. Copy from Register B to MOV M,B
Memory Address 2050
5. Copy between OUT 01H
Input/Output Port and
Accumulator IN 07H
Data Transfer (Copy)
Operations
6. 1 byte instruction. HLT
Processor stops
executing and enters
wait state.
7. 1 byte instruction . No NOP
operation .Generally
used to increase
processing time or
substitute in place of
instruction.
2. Arithmetic Operations
1. Addition of two 8-bit numbers
2. Subtraction of two 8-bit numbers
3. Increment/ Decrement a 8-bit number
Example Arithmetic
Operations / Instructions
1. Add a 8-bit number 32H to ADI 32H
Accumulator
2. Add contents of Register B to ADD B
Accumulator
3. Subtract a 8-bit number 32H SUI 32H
from Accumulator
4. Subtract contents of Register SUB C
C from Accumulator
5. Increment the contents of INR D
Register D by 1
6. Decrement the contents of DCR E
Register E by 1
3. Logical & Bit Manipulation
Operations
1. AND two 8-bit numbers
2. OR two 8-bit numbers
3. Exclusive-OR two 8-bit numbers
4. Compare two 8-bit numbers
5. Complement
6. Rotate Left/Right Accumulator bits
Example Logical & Bit Manipulation
Operations / Instructions
1. Logically AND Register H ANA H
with Accumulator
2. Logically OR Register L with ORA L
Accumulator
3. Logically XOR Register B XRA B
with Accumulator
4. Compare contents of CMP C
Register C with Accumulator
5. Complement Accumulator CMA
6. Rotate Accumulator Left RAL
4. Branching Operations
These operations are used to control the flow
of program execution
1.Jumps
• Conditional jumps
• Unconditional jumps
2.Call & Return
• Conditional Call & Return
• Unconditional Call & Return
Example Branching
Operations / Instructions
1. Jump to a 16-bit Address 2080H if JC 2080H
Carry flag is SET. This is conditional
jump. JNC, JZ,JNZ,JP,JM,JPE,JPO
2. Unconditional Jump
JMP 2050H
3 byte instruction. 2nd and 3rd byte
specify 16 bit memory address.
3. Call a subroutine with its 16-bit Address CALL 3050H
4.Return back from the Call
RET
5. Call a subroutine with its 16-bit Address
if Carry flag is RESET CNC 3050H
6. Return if Zero flag is SET RZ

You might also like