Professional Documents
Culture Documents
Instruction Set of 8085 1
Instruction Set of 8085 1
Instruction Set of 8085 1
An Instruction is a command given to the microprocessor to perform a specified operation on given data. The instruction set of a microprocessor is the collection of the instructions that the microprocessor is designed to execute. The programmer can write a program in assembly language using these instructions. These instructions have been classified into the following groups: Data Transfer Group Arithmetic Group Logical Group Branch Control Group I/O and Machine Control Group
Instructions, which are used to transfer data from one register to another register, from memory to register or register to memory, come under this group. When an instruction of data transfer group is executed, data is transferred from the source to the destination without altering the contents of the source.
[r1]
Example:
[r2].
Initially
After execution
Flags Affected Addressing mode Memory require Machine Cycle require T- States
B=10H.
B=10H.
Register.
C=20H.
C=10H.
2
7
EXAMPLE:
MOV C, M Move the content of memory location (M) , whose adders is in H-l pair {2000H} to register C
Initially content of memory location (M) 32H After execution content of memory location (M) 32H
C=00 H. C=32H.
Register C H- L
20 00 H
32H
32 00 H H
1Byte Instruction 2
7
EXAMPLE:
MOV M,C Move the content of register C to memory location (M) whose adders is in H-l pair {2000H}
Initially content of memory location (M) 00 H After execution content of memory location (M) 32H
C=32 H. C=32H.
Register C H- L
20 00 H
00H 32H
32 H
B=40H B=30H
No flags affected. Immediate. 2Byte Instruction 2 7
data.(8 bit)
No flags affected. Immediate.
Memory require
Machine Cycle require T- States
2Byte Instruction
2 7
=40H =32H
H- L
20 00 H
40H 32H
32 H
No flags affected.
Immediate. 3Byte Instruction 3
T- States
10
[A]
Flags Affected
[adders].
No flags affected.
Addressing mode
Memory require Machine Cycle require T- States
Direct
3Byte Instruction 4 13
Accumulator
2000 H
32H
40 32 H H
[A]
Flags Affected
[adders].
No flags affected.
Addressing mode
Memory require Machine Cycle require T- States
Direct
3Byte Instruction 4 13
Accumulator
2000 H
40H 32H
32 H
[L] [H]
Flags Affected Addressing mode Memory require Machine Cycle require
[addr], [addr+1].
No flags affected. Direct 3Byte Instruction 5
T- States
16
2000 H 2001 H
32H 23H
00 32 HH 23 00 HH
L H
[L] [H]
Flags Affected Addressing mode Memory require Machine Cycle require
[addr], [addr+1].
No flags affected. Direct 3Byte Instruction 5
T- States
16
2000 H 2001 H
32 H 23 H
L H
[A]
[Rp].
Flags Affected
No flags affected.
Addressing mode
Memory require Machine Cycle require T- States
Indirect
1Byte Instruction 2 7
B- C
Accumulator
20 00 H
32H
40 32 H H
[A]
[adders].
Flags Affected
No flags affected.
Addressing mode
Memory require Machine Cycle require T- States
Register indirect
1Byte Instruction 2 7
Accumulator
20 00 H
32H 00H
32 H
After execution
Flags Affected
ARITHMETIC GROUP
The instructions of this group perform arithmetic operations such as addition, subtraction; increment or decrement of the content of a register or memory.
ARITHMETIC GROUP
ADD R
(ADD register content with Acc and result in A ).
[A]
[A] + [r].
Example: ADD C. (ADD the content of C with A). Suppose the Data at C register is 10H. Initially C= 10H , After execution A=20H,
Flags Affected Addressing mode Memory require Machine Cycle require T- States All flags affected. Register 1Byte Instruction 1 4
A=10H C=10H.
ARITHMETIC GROUP
ADD M
(ADD memory content with Acc and result in A ).
[A]
[A] + [M].
Example: ADD M. (ADD the content of memory with A). Suppose the Data at memory is 10H. Initially M= 10H , A=10H After execution A=20H, M=10H.
Flags Affected Addressing mode Memory require Machine Cycle require T- States All flags affected. Register indirect 1Byte Instruction 2 7
ARITHMETIC GROUP
ADI Data
(ADD immediate data with Acc and result in A ).
[A]
Example:
[A] + data.
A=20H A=50H.
All flags affected. Immediate 2Byte Instruction 2 7
ARITHMETIC GROUP
ADC R
(ADD register with carry to accumulator and result in A ).
[A]
Example: ADC C. (ADD the content of C with A considering carry). Suppose the Data at C register is 10H. Initially C= 10H , A=10H CS = 1 After execution A=21H, C=10H.
Flags Affected Addressing mode Memory require Machine Cycle require T- States All flags affected. Register 1Byte Instruction 1 4
ARITHMETIC GROUP
ADC M (ADD memory content with carry to accumulator and result in A ). [A] [A] + [M] + [CS]. Example: ADD M. (ADD the content of memory with A considering carry). Suppose the Data at memory is 10H. Initially M= 10H , A=10H CS = 1 After execution A=21H, M=10H.
Flags Affected
Addressing mode Memory require Machine Cycle require
T- States
ARITHMETIC GROUP
ACI Data
(ADD immediate data with carry to accumulator and result in A ). [A] Example: ADI 30H. (ADD 30H with A considering carry). [A] + data + [CS]
A=20H CS = 1 A=51H.
All flags affected. Immediate 2Byte Instruction 2 7
ARITHMETIC GROUP
SUB R
(Subtract register content from Acc and result in A ).
[A]
[A] - [r].
Example: SUB C. (Subtract the content of C from A). Suppose the Data at C register is 10H. Initially C= 10H , A=20H After execution A=10H, C=10H.
Flags Affected Addressing mode Memory require Machine Cycle require T- States All flags affected. Register 1Byte Instruction 1 4
ARITHMETIC GROUP
SUB M
(Subtract memory content from Acc and result in A ).
[A]
[A] - [M].
Example: SUB M. (Subtract the content of memory from A). Suppose the Data at memory is 10H. Initially M= 10H , A=20H After execution A=10H, M=10H.
Flags Affected Addressing mode Memory require Machine Cycle require T- States All flags affected. Register indirect 1Byte Instruction 2 7
ARITHMETIC GROUP
SUI Data
(Subtract immediate data from Acc and result in A ).
[A]
Example:
[A] - data.
A=50H A=20H.
All flags affected. Immediate 2Byte Instruction 2 7
ARITHMETIC GROUP
SBB R
(Subtract register with borrow from accumulator and result in A ).
[A]
Example: SBB C. (Subtract the content of C from A with borrow). Suppose the Data at C register is 10H. Initially C= 10H , A=20H CS = 1 After execution A=9H, C=10H.
Flags Affected Addressing mode Memory require Machine Cycle require T- States All flags affected. Register 1Byte Instruction 1 4
ARITHMETIC GROUP
SBB M
(Subtract memory content with borrow from accumulator and result in A ). [A] [A] - [M] - [CS]. Example: SBB M. (ADD the content of memory from A with borrow). Suppose the Data at memory is 10H. Initially M= 10H , A=20H CS = 1 After execution A=09H, M=10H.
ARITHMETIC GROUP
SBI Data
(Subtract immediate data with borrow from accumulator and result in A ). [A] Example: SBI 30H. (Subtract 30H from A with borrow). [A] data-[CS]
A=50H CS = 1 A=19H.
All flags affected. Immediate 2Byte Instruction 2 7
ARITHMETIC GROUP
INR R
(Increment register content by 1 ).
[R]
Example:
[R] +1.
INR C. (Increment the content of C by 1). Suppose the Data at C register is 10H. Initially C= 10H C=11H.
After execution
ARITHMETIC GROUP
DCR R
(Decrement register content by 1 ).
[R]
Example:
[R] -1.
DCR C. (Decrement the content of C by 1). Suppose the Data at C register is 10H. Initially C= 10H C= 09H.
After execution
ARITHMETIC GROUP
INR M
(Increment content of memory by 1 ).
[M]
Example:
[M] +1.
INR M. (Increment the content of M by 1). Suppose the Data at M is 10H. Initially M= 10H M=11H.
After execution
ARITHMETIC GROUP
DCR M
(Decrement content of memory by 1 ).
[M]
Example:
[M] -1.
DCR M. (Decrement the content of M by 1). Suppose the Data at M is 10H. Initially M= 10H M= 0FH.
After execution
ARITHMETIC GROUP
INX Rp
(Increment register pair content by 1 ).
[Rp]
Example:
[Rp] +1.
INX B. (Increment the content of BC pair by 1). Suppose the Data at B-C register pair is 1110H. Initially B= 1110H B= 1111H.
After execution
ARITHMETIC GROUP
DCX Rp
(Decrement register pair content by 1 ).
[Rp]
Example:
[Rp] -1.
DCX B. (Decrement the content of B by 1). Suppose the Data at B-C register pair is 1110H. Initially B= 1110H B= 110FH.
After execution
ARITHMETIC GROUP
DAD Rp (Add specified register pair with HL pair)
(Add the content of E with L and that of D with H register and result in HL pair) [H-L] [H-L] + [rp]. Example: DAD D.(Add the content of E with L and that of D with H register and result in HL pair) Initially H=20H ,L=40H D=30H, E=10H After execution H=50H ,L=50H D=30H, E=10H
ARITHMETIC GROUP
LOGICAL GROUP
The Instructions under this group perform logical operation such as AND, OR, compare, rotate etc.
LOGICAL GROUP
ANA R
(Logically AND content of register with Acc and result in A )
LOGICAL GROUP
ANI Data
(Logically AND immediate data with Acc and result in A )
LOGICAL GROUP
ANA M
(Logically AND content of memory with Acc and result in A )
LOGICAL GROUP
ORA R
(Logically OR register content with Acc and result in A)
LOGICAL GROUP
ORI Data
(Logically OR immediate Data with Acc and result in A ).
LOGICAL GROUP
ORA M
(Logically OR memory content with Acc and result in A).
LOGICAL GROUP
XRA R
(Logically XOR register content with Acc and result in A)
[A] [A]
Example:
[r]
XRA C (XOR the content of C with A). Suppose the Data at C register is 17H. Initially After execution A=10H,C= 17H A=07H,C=17H.
LOGICAL GROUP
XRI Data
(Logically XOR immediate Data with Acc and result in A)
[A] [A]
Example:
[Data]
XRI 17 (XOR the Data with A). Suppose the Data is 17H. Initially After execution A=10H,Data=17H A=07H,Data=17H.
LOGICAL GROUP
XRA M
(Logically XOR memory content with Acc and result in A)
[A] [A]
Example:
[M]
XRA M (XOR the content of memory with A). Suppose the memory content is 17H. Initially After execution A=10H,M= 17H A=07H,M=17H.
LOGICAL GROUP
CMA. (Complement the accumulator) [A] [A]
Example: CMA (Complement the accumulator0
LOGICAL GROUP
CMC (Complement the carry status) [CS] [CS] STC (Set carry status) [CS] 1.
LOGICAL GROUP
CMP r. (Compare register with accumulator) [A] [r] The content of the register r is subtracted from the content of the accumulator and status flags are set according to the result of subtraction . But the result is discarded. The content of the accumulator remain unchanged.
LOGICAL GROUP
CMP M. (Compare memory content with accumulator) [A] [M] The content of the memory is subtracted from the content of the accumulator and status flags are set according to the result of subtraction . But the result is discarded. The content of the accumulator remain unchanged.
LOGICAL GROUP
CMP Data. (Compare immediate Data with accumulator) [A] [Data] The immediate Data is subtracted from the content of the accumulator and status flags are set according to the result of subtraction . But the result is discarded. The content of the accumulator remain unchanged.
LOGICAL GROUP
RLC (Rotate accumulator left) The content of the accumulator is rotated left by one bit. The seventh bit of the accumulator is moved to carry bit as well as to the zero bit of the accumulator. Only CS flag is affected. [An+1] [An], [A0] [A7], [CS] [A7]
CS
A7
A6
A5
A4
A3
A2
A1
A0
LOGICAL GROUP
RRC. (Rotate accumulator right) The content of the accumulator is rotated right by one bit. The zero bit of the accumulator is moved to the seventh bit as well as to carry bit. Only CS flag is affected. [An] [An+1] , [CS] [A0] , [A7][A0]
CS
A7
A6
A5
A4
A3
A2
A1
A0
LOGICAL GROUP
RAL (Rotate accumulator left through carry) The content of the accumulator is rotated left by one bit. The seventh bit of the accumulator is moved to carry bit & carry bit to the zero bit of the accumulator. Only CS flag is affected. [An+1] [An], [A0] [CS], [CS] [A7]
CS
A7
A6
A5
A4
A3
A2
A1
A0
LOGICAL GROUP
RAR. (Rotate accumulator right through carry) The content of the accumulator is rotated right by one bit. The zero bit of the accumulator is moved to the to carry bit & carry bit to the seventh bit. Only CS flag is affected. [An] [An+1] , [CS] [A0], [A7][CS]
CS
A7
A6
A5
A4
A3
A2
A1
A0
BRANCH GROUP
Conditional Jump addr (label): After the execution of the conditional jump instruction the program jumps to the instruction specified by the address (label) if the specified condition is fulfilled. The program proceeds further in the normal sequence if the specified condition is not fulfilled. If the condition is true and program jumps to the specified label, the execution of a conditional jump takes 3 machine cycles: 10 states. If condition is not true, only 2 machine cycles; 7 states are required for the execution of the instruction.
BRANCH GROUP
JZ addr (label). (Jump if the result is zero) JNZ addr (label) (Jump if the result is not zero) JC addr (label). (Jump if there is a carry) JNC addr (label). (Jump if there is no carry) JP addr (label). (Jump if the result is plus) JM addr (label). (Jump if the result is minus)
BRANCH GROUP
JZ adders (label). (Jump if the result is zero)
ARITHMETIC OR LOGICAL OPERATION
IF ZERO FLAG
=1
SATE OF ZERO FLAG
IF ZERO FLAG
=0
GO TO ADDERS (LABEL)
BRANCH GROUP
JNZ adders (label). (Jump if the result is not zero)
ARITHMETIC OR LOGICAL OPERATION
IF ZERO FLAG
=0
SATE OF ZERO FLAG
IF ZERO FLAG
=1
GO TO ADDERS (LABEL)
BRANCH GROUP
JC addr (label). (Jump if there is a carry)
ARITHMETIC OR LOGICAL OPERATION
IF
carry FLAG = 1
SATE OF
IF
carry FLAG = 0
carry
FLAG
GO TO ADDERS (LABEL)
BRANCH GROUP
JNC addr (label). (Jump if there is a carry)
ARITHMETIC OR LOGICAL OPERATION
IF
carry FLAG = 0
SATE OF
IF
carry FLAG = 1
carry
FLAG
GO TO ADDERS (LABEL)
BRANCH GROUP
JP addr (label). (Jump if there is a plus) (Jump if sign flag reset )
ARITHMETIC OR LOGICAL OPERATION
IF
sign FLAG = 0
SATE OF
IF
sign FLAG = 1
sign FLAG
GO TO ADDERS (LABEL)
BRANCH GROUP
JM addr (label). (Jump if there is a minus) (Jump if sign flag is set or minus)
ARITHMETIC OR LOGICAL OPERATION
IF
sign FLAG = 1
SATE OF
IF
sign FLAG = 0
sign FLAG
GO TO ADDERS (LABEL)
BRANCH GROUP
JPE addr (label). (Jump if parity flag is set)
ARITHMETIC OR LOGICAL OPERATION
IF
parity FLAG = 1
SATE OF
IF
parity FLAG = 0
parity
FLAG
GO TO ADDERS (LABEL)
BRANCH GROUP
JPO addr (label). (Jump if parity odd or P flag is reset )
ARITHMETIC OR LOGICAL OPERATION
IF
parity FLAG = 0
SATE OF
IF
parity FLAG = 1
parity
FLAG
GO TO ADDERS (LABEL)