Cha 1
Cha 1
Set by :
Molla K.
Chapter- Four
Techniques
Instruction Set of 8085
An instruction set is a binary pattern designed inside a
CPU to perform a specific function.
The entire group of instruction that a microprocessor
supports is called Instruction set.
8085 has 246 instructions.
Each instruction is represented by an 8-bit binary value.
These instruction of binary value is called opcode or
instruction byte.
Addressing Mode
The various formats for specifying operand/data are called the addressing modes.
8085 instruction can be classified in the following addressing modes.
1. Register Addressing Mode: data is provided through registers. Eg.MOV, ADD,ANA,ORA
XRA e.t.c
E.G. MOV A, 78H ;opcode of MOV A,B
MOV A,B ; move the content of register B to A
2. Immediate Addressing Mode: data represents the instruction load the immediate data to the
destination provided. E.g MVI, LXI
e.g. MVI A, 05H ; Move the 05 in register A
MVI A, 12h ; Opcode of MVI A, 12H
3. Direct Addressing Mode: Instructions have their operands in memory and the 16-bit memory
address is specified in the instruction.
• The address of the operand is given in the instruction. E.g LDA, LHLD, STA, SHLD e.t.c
E.g. STA 7500 ; Stores the content of accumulator in the memory location 7500H
STA ; opcode of STA 7500
LDA, F820H but initially the Mov A, 35H which is stored in A register.
Cont’d
4. Register Indirect Adderssing Mode: In this address of the operand is
specified by the register pair. The address stored in the register pair
points to memory location.
E.g. LDAX, STAX, PUSH, POP e.t.c
LXI H, 7500 ; Load HL pair with 7500H
MOV A, M ;Move the content of memory location, whose
address is in pair to the accumulator.
5. Implied Addressing Mode: The operand is not specified in the
instruction, specified within the opcode itself.
Operand is supposed to be present in accumulator. E.g. CMA, CMC, STC e.t.c
RAL rotate the content of accumulator towards left.
LXI D, ABCDH
E.G.
LXI H, 1234H
XCHG
Classification of Instruction Set
1. Data Transfer Instructions 5. Branching Instruction
2. Arithmetic Instructions 6. I/O instructions
3. Logical Instruction 7. Interrupt Instructions
4. Control Instructions 8. Stack Instructions
Arithmetic Instructions 14 62
Logical Instruction 15 43
Stack Instructions 9 15
Branching Instruction 8 36
I/O instructions 2 2
Interrupt Instructions 5 5
1. Data Transfer Instructions
These instruction move data between register , or between memory and
register.
These instructions copy data from resource to destination.
Q. Using the table register code table derive opcodes for the following.
a. MOV B, C b. MOV M, D c. MOV A, M
Cont’d
MVI H, F8H
MVI L, 21H
MOV A, M
Cont’d
LXI A, F821H
MVI L, 21H
MOV A, M
Cont’d
o The contents of the register H are exchanged with the contents of register D.
o The contents of register L are exchanged with the contents of register E.
o 1- byte instruction. E.g. XCHG
LXI, D, ABCDH
LXI H, 1234H
XCHG
Cont’d
o The contents of the accumulator are copied into the memory location whose
address is in the registered pair.
o 1 -byte instruction. E.g. STAX B & STAX D.
Arithmetic Instruction
o These instruction perform the operation like:
Addition
Subtraction
Increment
Decrement
o Almost all the instruction in this group affects the
flag registers.
Addition
o Any 8-bit number or the contents of registers, or the contents memory location can be added
to the contents of accumulator.
o The result is stored in the accumulator.
o No two other 8-bit registers can be added directly.
o Example: the content of register B can not be added directly to the contents oof register C.
• The contents of register or memory are subtracted from the contents of the accumulator.
• The result is stored in accumulator
• If the operand is memory location, its address is specified by H-L pair.
• All flags are modified to reflect the result of subtraction.
• 1 byte instruction.
• Example SUB B or SUB M.
Cont’d
Increment
o The 8-bit contents of register or a memory location can be incremented
or decremented by 1.
o The 16-bit content of a register pair can be incremented or decremented
by 1.
o Increment or decrement can be performed on any register or a memory location.
o The contents of the accumulator are logically ANDed with the contents of
register or memory.
o The result is placed in the accumulator. It is used to reset the bits.
o If the operand is a memory location, its address is specified by the contents of
H-L pair.
o S,Z,P are modified to reflect the result of operation.
o CY is reset(CY=0) and AC is set (AC=1)for AND operation
o 1 byte instruction
Example:ANA B or ANA M.
Cont’d
Logical Instruction
o The contents of the accumulator are logically ORed with the contents of register or
memory.
o The result is placed in the accumulator. It is used to set the bits.
o If the operand is a memory location, its address is specified by the contents of H-L
pair.
o S,Z,P are modified to reflect the result of operation.
o CY and AC are reset (CY=AC=0) for OR operation
o 1 -byte instruction
Example: ORA B or ORA M.
Cont’d
Cont’d
XOR Instruction
o The contents of the accumulator are logically XORed with the contents of
register or memory.
o The result is placed in the accumulator. It is used to set/ reset the bits.
o If the operand is a memory location, its address is specified by the contents of H-
L pair.
o S,Z,P are modified to reflect the result of operation.
o Cy and AC are reset CY= AC=0 ) for Ex-OR operation
o 1 byte instruction
Example: XRA B or XRA M.
Cont’d
Cont’d
Compare
• Any 8-bit data or the contents of register, or memory ;location can be compares for
Rotate
Each bit in the accumulator can be shifted either left or right to the next position.
The execution of RET brings back the saved address from the stack to the
program counter.
The content of stack counter is incremented by 2, then the programs
jumps to the next instruction after CALL in the main program.
1- byte instruction.
Example: RET
Con’d
Return Conditionally
Return from subroutine conditionally
Con’d
Con’d
Stack, I/O & Machine Control Instructions
o The instruction of this group perform I/O data transfer , manipulates the
stack and perform machine related operation.
Stack
It is the reserved place at the top of memory map.
Stack can be initialized anywhere in the memory
map but it is initialize at the highest user memory.
Beginning of stack is defined in the program by
instruction. e.g. LXI SP, 16 bit
It loads the 16 bit address into the stack.
Then the content of BC and HL can be stored in
two consecutive stack memory location by using
push and can be retrieved by POP instruction.
The address in the SP always points to the top of the stack and
indicates that the next memory location( SP-1) is available to
store information.
Stack Operation
Subroutines
Types of Subroutines
Machine Control Instructions
BCD Arithmetic operations