Вы находитесь на странице: 1из 24

8085

8085
Instruction Set

Dayanand K
8085
Instruction Set
 The Instruction of 8085 are of 7 types
 They are grouped according to their
operation
1. Data Transfer Instructions
2. Arithmetic Instructions
3. Logical Instructions
4. Program Control Instructions
1. Loop Instructions
2. Subroutine Instructions
5. Machine Control Instructions
6. Interrupt Control Instructions
8085
1. Data Transfer Instructions
 These instructions are used to transfer or move data from
one location to other.
 This may be from
 A register to another register
A Data to another register
A register to one memory location.
A memory location to Register.
An input device to a register
A Register to output devices
 Examples are instructions with opcodes
MOV, MVI, LDA, STA, LXI, IN, OUT etc
 Flags are not affected with these instructions.
8085
1. 1. Data Transfer Instructions
8-bit Data Transfer
1. MOV Rd, Rs: this instruction moves the data byte from RS-Source Register to Rd-Destination
Register.
2. MOV R, M: This instruction copies the data byte from the memory location specified by the
memory pointer into the register
3. MOV M, R: This instruction copies the data byte to the memory location specified by the
memory pointer from the register
4. MVI Rd, (8-bit Data): This instruction moves data byte directly into the destination register R d.
5. LDA (16-bit Address): This instruction copies the data byte into the accumulator from the 16-
bit memory address.
6. STA (16-bit Address): This instruction copies the data byte from the accumulator into the 16-
bit memory address.
7. LDAX RP: This instruction copies the data byte into the accumulator from the memory
location indicated by the register pair.
8. STAX RP: This instruction copies the data byte from the accumulator to the memory location
indicated by the register pair.
9. IN (8-bit Port address): This instruction copies the 8-bit data from input device (whose port
address is given) to the content of the accumulator.
10. OUT (8-bit Port address): This instruction copies the 8-bit data to output device (whose port
address is given) from the content of the accumulator.
8085
1. 2. Data Transfer Instructions
8-bit Data Transfer
1. MOV Rd, Rs: this instruction moves the data byte from RS-Source Register to Rd-Destination Register.
2. MOV R, M: This instruction copies the data byte from the memory location specified by the memory
pointer into the register
3. MOV M, R: This instruction copies the data byte to the memory location specified by the memory
pointer from the register
4. MVI Rd, (8-bit Data): This instruction moves data byte directly into the destination register Rd.
5. LDA (16-bit Address): This instruction copies the data byte into the accumulator from the 16-bit
memory address.
6. STA (16-bit Address): This instruction copies the data byte from the accumulator into the 16-bit
memory address.
7. LDAX RP: This instruction copies the data byte into the accumulator from the memory location
indicated by the register pair.
8. STAX RP: This instruction copies the data byte from the accumulator to the memory location indicated
by the register pair.
9. IN (8-bit Port address): This instruction copies the 8-bit data from input device (whose port address is
given) to the content of the accumulator.
10. OUT (8-bit Port address): This instruction copies the 8-bit data to output device (whose port address is
given) from the content of the accumulator.
16-bit Data Transfer
11. LXI Rp, (16-bit Address): This instruction loads the 16-bit address as data into the register pair Rp. the
higher byte into Higher and lower byte of the register pair.
8085
1.EX.1. Data Transfer Instructions
Example 1: Register to Register
General Format :
MOV <Reg_dest>,<Reg_Src>
The 8-bit DATA Content in Source Register<Reg_Src-8> is
immediately Copied into Destination Register <Reg_Dest-8>

Specific Instruction:
1. MOV A,B
Here Source Register is ‘B’ and Destination Register is ‘A’
if Register ‘B’ holds a content of 25H before Execution then.
BEFORE EXECUTION AFTER EXECUTION
A B A B

XX 25 25 25
8085
1.EX.2. Data Transfer Instructions
Example 2: 8-bit Data to Register
General Format :
MVI <Reg>,<8 bit data>
<8-bit data> is immediately Copied into Register < Reg>

Specific Instruction:
2. MVI C,25H
Here Register is ‘C’. Data is 25 H

BEFORE EXECUTION AFTER EXECUTION


C 8-bit Data C 8-bit Data

XX 25 25 25
8085
1.EX.3 Data Transfer Instructions
Example 3: 16-Bit Data Transfer to Register Pair
General Format :
LXI <Reg_Pair>,<16-Bit Data>
<16-bit data> is immediately Copied into Register Pair
<Reg_Pair>

Specific Instruction:
3. LXI H,245EH
Here Register Pair is ‘HL’. Data is ‘245E’ H

BEFORE EXECUTION AFTER EXECUTION


H L 16-bit Data H L 16-bit Data

XX XX 245E 24 5E 245E
8085
1.EX.4 Data Transfer Instructions
Example 4: 8-bit Data Transfer (Memory Location) to Register
General Format :
LDA <16_Bit_Mem_Addr>
<8-bit data> Content in Memory Location in specified address
<16_Bit_Mem_Addr> is Loaded into content of Accumulator
<Reg A>

Specific Instruction:
4. LDA 4100H
<8-bit data> Content in Memory Location in specified address
<4100H> is Loaded into content of Accumulator <Reg A>

BEFORE EXECUTION AFTER EXECUTION


A 4100 A 4100

XX 5E 5E 5E
8085
1.EX.5 Data Transfer Instructions
Example 5: 8-bit Data Transfer Register to Memory Location
General Format :
STA <16_Bit_Mem_Addr>
The Content of Accumulator <Reg A> is transferred into <8-bit
data> Content in Memory Location in specified address
<16_Bit_Mem_Addr>

Specific Instruction:
5. STA 4100H
<8-bit data> Content in Memory Location in specified address
<4100H> is Loaded FROM the content of Accumulator
<Reg A>
BEFORE EXECUTION AFTER EXECUTION
A 4100 A 4100

XX 5E 5E 5E
8085
1.EX.6 Data Transfer Instructions
Example 6: Input Device to Register
General Format :
IN <8_Bit_IO_Addr>
<8-bit data> Content in Input Device whose address
<8_Bit_IO_Addr> is Loaded into content of Accumulator (Reg
A>

Specific Instruction:
6. IN 75H
<8-bit data> Content in Input Device whose address <75H> is
Loaded into content of Accumulator (Reg A>

BEFORE EXECUTION AFTER EXECUTION


A 75 A 75

XX 59 59 59
8085
1.EX.7 Data Transfer Instructions
Example 7: Register to Output Device
General Format :
OUT <8_Bit_IO_Addr>
Content of Accumulator (Reg A> Loaded into <8-bit data>
Content in Output Device whose address <8_Bit_IO_Addr>

Specific Instruction:
7. OUT 75H
Content of Accumulator (Reg A> is Loaded into <8-bit data>
Content in Output Device whose address <75H>

BEFORE EXECUTION AFTER EXECUTION


A 75 A 75

59 xx 59 59
8085
2. Arithmetic Instructions
 These instructions are used to do arithmetic
operations on data specified in the operand. The
operations are addition, subtraction, increment and
decrement.
 Examples are instructions with opcodes
ADD, ADI, ADC, ACI, SUB,SUI, SBB, SBI, INR,
DCR, INX, DCX, DAD etc
 All the flags are affected
8085
2.1 Arithmetic Instructions
8-bit Instructions
1. ADD R: Add the contents of the register with the content of accumulator and store the result in accumulator. All Flags affected
2. ADD M: Add the contents of the memory location specified by the memory pointer with the content of accumulator and store
the result in accumulator. All Flags affected
3. ADI (8-Bit Data): Add the 8-bit data with the content of accumulator and store the result in accumulator. All Flags affected
4. ADC R: Add the contents of the register with the content of accumulator with the carry and store the result in accumulator. All
Flags affected
5. ACI (8-Bit Data): Add the 8-bit data with the content of accumulator and with the carry and store the result in accumulator. All
Flags affected
6. SUB R: Subtract the contents of the register from the content of accumulator and store the result in accumulator. All Flags
affected
7. SUB M: Subtract the contents of the memory location specified by the memory pointer from the content of accumulator and
store the result in accumulator. All Flags affected
8. SUI (8-bit data): Subtract the 8-bit data from the content of accumulator and store the result in accumulator. All Flags affected
9. SBB R: Subtract the contents of the register and borrow from the content of accumulator and store the result in accumulator.
All Flags affected
10. SBI (8-bit data): Subtract the 8-bit data and borrow from the content of accumulator and store the result in accumulator. All
Flags affected
11. INR R: Increment the content of the register by 1. All flags are affected.
12. DCR R: Decrement the content of the register by 1. All flags are affected.
13. INX Rp: Increment the contents of the register pair by 1.All flags are affected.
14. DCX Rp: Decrement the contents of the register pair by 1 All flags are affected.
16-bit Instructions
15. DAD Rp: Double addition: Add the 16 bit contents of the register pair (Rp) mentioned with the contents of HL pair and then
store the result in HL pair. All flags are affected.
8085
2.EX.1 Arithmetic Instructions
Example 1:
General Format :
ADD <Reg-src>
<8-bit data> Content in Register <Reg_Src> is Added to <8-bit Data>
content of Accumulator (Reg A>
[A] <= [A] + [Reg_Src]
CARRY IS GENERATED THROUGH CARRY FLAG=0/1

Specific Instruction:
1. ADD E
<8-bit data> Content in Register <E> is Added to <8-bit Data> content of
Accumulator (Reg A>
[A] <= [A] + [E]
BEFORE EXECUTION AFTER EXECUTION
A E A A E A

24 35 59 59 35 59

CARRY FLAG 0/1 CARRY FLAG 0


8085
3. Logical Instructions
 These instructions are used to do Logical
operations on data specified in the operand. The
operations
 Gate oriented operations like NOT, OR, AND, XOR.
 CMA, ANA, ORA, XRA, ANI, ORI, XRI
 Compare Operations
 CMP, CPI
 Rotate Operations
 RAL, RAR, RLC, RRC
 All the flags are affected for most of the instructions
8085
3.1 Logical Instructions
 Gate Oriented operations like NOT, OR, AND, XOR are
• ANA R/M: Logically AND the contents of the register / memory location specified by the
pointer with the contents of accumulator and store the result in the accumulator. Flags are
affected
• ANI (8-bit Data): Logically AND the data byte given with the contents of accumulator and
store the result in the accumulator. Flags are affected
• ORA R/M: Logically OR the contents of the register / memory location specified by the
pointer with the contents of accumulator and store the result in the accumulator. Flags are
affected
• ORI (8-bit Data): Logically OR the data byte given with the contents of accumulator and
store the result in the accumulator. Flags are affected
• XRA R/M:Logically XOR the contents of the register / memory location specified by the
pointer with the contents of accumulator and store the result in the accumulator. Flags are
affected
• XRI (8-bit Data): Logically XOR the data byte given with the contents of accumulator and
store the result in the accumulator. Flags are affected
• CMA: Complement the contents of the accumulator and store the result in the accumulator.
This is the only instruction where no flags are affected.
• CMC: Complement the carry flag.
8085
3.2 Logical Instructions
 Compare Operations like
• CMP R: Compare the Contents of the register with the contents of
accumulator. Flags are affected.
CARRY FLAG ZERO FLAG
COMPARE RESULT
STATUS STATUS
If the content of accumulator (A) is
  numerically LESS than the content of the
SET TO 1 -
register (R)
[A]<[R]
If the content of accumulator (A) is
numerically EQUAL to the content of the
- SET TO 1
register (R)
[A] = [R]
If the content of accumulator (A)) is
numerically MORE than the content of the RESET TO
RESET TO 0
register (R 0
[A]> [R]

• CPI (8-bit Data): Compare the 8-bit data with the contents of accumulator.
Flags are affected. Same as above.
8085
3.3 Logical Instructions
 Rotate operations like
• RAL: Rotate Accumulator Left through Carry: Rotate the contents of
the accumulator with the carry in left direction. MSB content goes to
carry and carry content goes to LSB and so on.
• RLC: Rotate Accumulator Left: Rotate the contents of the accumulator
in left direction. MSB content goes to carry and MSB content goes to
LSB and so on. Carry is not involved in the rotation process.
• RAR: Rotate Accumulator Right through Carry: Rotate the contents of
the accumulator with the carry in right direction. LSB content goes to
carry and carry content goes to MSB and so on.
• RRC: Rotate Accumulator Right: Rotate the contents of the
accumulator in left direction. LSB content goes to carry and LSB
content goes to MSB and so on. Carry is not involved in the rotation
process.
8085
4. Program Control Instructions
 These instructions are used to do change the program
sequence.
 These changes can happen within the same program
(Main Routine) or can go to a subroutine and return to
the main program.
 Thus we can classify these instructions into Looping
instructions and Sub-routine instructions as stated
above respectively.
 These changes can occur if specified data conditions
are met or unconditionally.
 The conditions involve the flags. They are sign, zero,
parity, and carry flags.
8085
4.1 Program Control Instructions
Unconditional Loop instruction are:
• JMP (16-bit address): Change the program sequence to the specified 16 bit address location
unconditionally.
Conditional Loop Instructions are:
• JZ (16-bit address): Change the program sequence to the specified 16 bit address location when
Zero flag is set.
• JNZ (16-bit address): Change the program sequence to the specified 16 bit address location
when Zero flag is reset.
• JC (16-bit address): Change the program sequence to the specified 16 bit address location when
Carry flag is set..
• JNC (16-bit address): Change the program sequence to the specified 16 bit address location
when Carry flag is reset.
• JM (16-bit address): Change the program sequence to the specified 16 bit address location when
Sign flag is set.
• JP (16-bit address): Change the program sequence to the specified 16 bit address location when
Sign flag is reset.
• JPE (16-bit address): Change the program sequence to the specified 16 bit address location
when Parity flag is set.
• JP0 (16-bit address): Change the program sequence to the specified 16 bit address location
when Parity flag is reset.
8085
4.2 Program Control Instructions
Unconditional Subroutine instructions are:
• CALL (16-bit address): Change the program sequence
to the specified 16 bit address location of a subroutine
unconditionally.
• RET: Return to the calling program after completing
the subroutine sequence unconditionally.
8085
4.3 Program Control Instructions
Conditional Loop Instructions are:
• CZ (16-bit address): Change the program sequence to the specified 16 bit address location of a subroutine when Zero flag is
set.
• CNZ (16-bit address): Change the program sequence to the specified 16 bit address location of a subroutine when Zero flag
is Reset..
• CC (16-bit address): Change the program sequence to the specified 16 bit address location of a subroutine when Carry flag
is set..
• CNC (16-bit address): Change the program sequence to the specified 16 bit address location of a subroutine when Carry
flag is reset.
• CM (16-bit address): Change the program sequence to the specified 16 bit address location of a subroutine when Sign flag
is set.
• CP (16-bit address): Change the program sequence to the specified 16 bit address location of a subroutine when Sign flag is
reset.
• CPE (16-bit address): Change the program sequence to the specified 16 bit address location of a subroutine when Parity
flag is set.
• CP0 (16-bit address): Change the program sequence to the specified 16 bit address location of a subroutine when Parity
flag is reset.
• RZ (16-bit address): Return to the calling program after completing the subroutine sequence when Zero flag is set.
• RNZ (16-bit address): to the calling program after completing the subroutine sequence when Zero flag is reset.
• RC (16-bit address): to the calling program after completing the subroutine sequence when Carry flag is set..
• RNC (16-bit address):to the calling program after completing the subroutine sequence when Carry flag is reset.
• RM (16-bit address): Change to the calling program after completing the subroutine sequence when Sign flag is set.
• RP (16-bit address): to the calling program after completing the subroutine sequence when Sign flag is reset.
• RPE (16-bit address): to the calling program after completing the subroutine sequence when Parity flag is set.
• RP0 (16-bit address): to the calling program after completing the subroutine sequence when Parity flag is reset.
8085
5. Machine Control Instructions
 These instructions are used to control the machine
so that to reset, stop operation, stop the program
etc.
 The Instructions are HALT, NOP.
 HLT: Stop the program and wait.
 NOP: do not perform any operation.

Вам также может понравиться