Ei502 microprocessors & micrtocontrollers part 2(instructionset)
-
Upload
debasis-das -
Category
Education
-
view
1.758 -
download
0
description
Transcript of Ei502 microprocessors & micrtocontrollers part 2(instructionset)
Mallabhum Institute of Technology Debasis Das 1
EI 502Microprocessors
& Microcontrollers
Part 2(Instruction Set)
Debasis Das
Aug 2011
Mallabhum Institute of Technology Debasis Das 2
Addressing Modes
Immediate addressing
Register addressing
Direct Addressing
Indirect addressing
Implicit addressing
Aug 2011
Mallabhum Institute of Technology Debasis Das 3
General Instruction Format
Aug 2011
Opcode
Operand 1 Operand 2
Note: 1. Instruction may include 0, 1 or 2 operands
SourceDestination
Mallabhum Institute of Technology Debasis Das 4
Immediate AddressingValue following the instruction op code is the operand
MVI D, FF hexadecimal FF value will be loaded into register D
LXI H, 1234 hexadecimal 1234, a 16 bit value will be loaded
into H-L register pair
ADI 44 hex 44 will be added to the value in the accumulator
CPI 55 hex 55 will be compared to the value in accumulator
Aug 2011
Mallabhum Institute of Technology Debasis Das 5
Register AddressingOperand values stored in specified registers are
usedMOV A, B operand contained in register B is moved
to register A, the accumulatorADD C operand value stored in register C is added
to accumulatorSUB B operand stored in B is subtracted from the
value in APCHL Exchange values contained in HL and PC
Aug 2011
Mallabhum Institute of Technology Debasis Das 6
Direct AddressingValue of the operand is a direct memory or I/O
address
LDA ABC5 the operand is a memory address from
which the value is to be loaded into the accumulator
STA 123F value in accumulator to be stored into
memory location 123F
IN 23 input data from I/O port 23 hexAug 2011
Mallabhum Institute of Technology Debasis Das 7
Indirect Addressing(Register Indirect)
Value of the operand is a pointer to memory location containing data
MOV M,B moves content of register B to memory location pointed to by the register pair H-L
ADD M add content of memory pointed to by H-LMOV A,M move memory content pointed by H-L to
accumulatorLDAX B load accumulator with value contained in
memory location pointed by B-C
Aug 2011
Mallabhum Institute of Technology Debasis Das 8
Implicit AddressingThe operand is known and thus not needed in the
instruction
STC set carry flag
RAL rotate accumulator left
DAA decimal; adjust accumulator
CMA complement accumulatorAug 2011
Mallabhum Institute of Technology Debasis Das 9
8085/8085A Instruction SetData Transfer Instructions
Arithmetic instructions
Logical instructions
Branch instructions
Stack operations, I/O and Machine control
operations
Aug 2011
Mallabhum Institute of Technology Debasis Das 10
Data Transfer Instructions
MOV r1, r2MOV r, MMOV M, rMVI, r, dataMVI M, dataLXI rp, dataLDA addr
STA addrLHLD addrSHLD addrLDAX rpSTAX rpXCHG
Aug 2011
Mallabhum Institute of Technology Debasis Das 11
Arithmetic Instructions
ADD rADD MADI dataADC rADC MACI dataSUB rSUB MSUI dataSBB r
SBB MSRI dataINR rINR MDCR rDCR MINX rpDCX rpDAD rpDAA
Aug 2011
Mallabhum Institute of Technology Debasis Das 12
Logical InstructionsANA rANA MANI dataXRA rXRA MXRI dataORA rORA MORI dataCMP r
CMP MCPI dataRLCRRCRALRARCMACMCSTC
Aug 2011
Mallabhum Institute of Technology Debasis Das 13
Branch InstructionsJMP addr
Jcondition addr
CALL addr
Ccondition addr
RET
Rcondition
PCHL
ConditionsCarryNo carryPositiveMinusZeroNon zeroParity evenParity odd
Aug 2011
Mallabhum Institute of Technology Debasis Das 14
Stack, I/O, Machine ControlInstructions
PUSH rpPOP rpPUSH PSWPOP PSWXTHLSPHLIN port no.
OUT port no.EIDINOPHLTRIMSIM
Aug 2011
Mallabhum Institute of Technology Debasis Das 15
1,2,3 Byte Instruction Structures
Aug 2011
Op code
Op code
Data/address
Op code
Least Significant Byte
Most Significant Byte
One byte instructions
Two byte instructions
Three byte instructions
Mallabhum Institute of Technology Debasis Das 16
Typical Program Structure
Aug 2011
1000
1003
1006
1008
100B
100C
100D
Mallabhum Institute of Technology Debasis Das 17
Add N 8bit Numbers
Aug 2011
Mallabhum Institute of Technology Debasis Das 18
Sort in Descending Order
Aug 2011
Mallabhum Institute of Technology Debasis Das 19
Find Largest Number
Aug 2011
Mallabhum Institute of Technology Debasis Das 20
Multiplying Two numbers
Aug 2011
Mallabhum Institute of Technology Debasis Das 21
Division of Two Numbers
Aug 2011