ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

INSTRUCTION SET OF 8085: Data Transfer Instruction

Updated on July 27, 2015

Types of Instructions in 8085

There are various different types of instructions in 8085 assembly language programming. These instructions are used to program the 8085. Generally the instructions are written in terms of HEX Code, i.e. machine understandable code. The programs contain instructions and all the required programs are stored into memory chip of 8085 system from where in microprocessor reads the instructions and executes it.

Well its not easy to remember the operation code(op-codes) of all the instructions, the programs are first implemented over simulator or other assembly language programming editor and assembler. Here the assembly language instructions are used to program. These instructions are the combination of mnemonics and data.

The mnemonics are the English like words or abbreviation to denote the operation to be performed and the data indicates the information over which the operation is to be performed. Generally these instructions are divided into following types:

  • Data Transfer Instruction
  • Arithmetic Instructions
  • Logical Instructions
  • Branching Instructions
  • Control Instructions

Data Transfer Insructions

Instruction(Op-code)
Operands
Description
 
Rd, Rs
Copy the content of source register to destination register
MOV
M, Rs
Copy the content of source register to memory location
 
Rd, M
Copy the content of memory location to destination register
MVI
Rd, 8 bit Data
Copy the immediate data to destination register
 
M, 8 bit Data
Copy the immediate data to destination memory location
LDA
16 bit memory address
Load Accumulator from given memory location
LDAX
B or D register pair
Load Accumulator from memory address stored into given register pair
LXI
Reg pair, 16-bit data
Load register pair with 16 bit data
LHLD
16 bit address
Load HL pair from 16 bit content at given memory address
STA
16 bit address
Store the content of accumulator at given address
STAX
Register Pair
Store the content of Accumulator at the memory address stored into given register pair
SHLD
16 bit address
Store the content of HL pair at the given 16 bit memory address
XCHG
 
Exchange the content of HL with DE register
SPHL
 
Copy the content of HL pair to Stack (SP location)
XTHL
 
Exchange the content pf HL pair with top of the stack (SP location)
PCHL
 
Load PC to HL pair value
PUSH
Register Pair
Store the content of register pair to stack (SP location)
POP
Register Pair
Load the content of top of the stack(SP) to register pair
IN
8 bit port address
Load the content at given port to Accumulator
OUT
8 bit port address
Output the content of accumulator to given 8 bit port address

MOV: The instruction copies the content of source to destination. The content can be copied:

  • from one register to another register,
  • from memory location to register,
  • from register to memory location.

In case of last two options the memory location will be stored into HL pair.

For Example: MOV A, B // copy the content of register B into A

MOV A, M //copy the content of memory location specified by HL pair into Accumulator

MOV M, B //copy the content of register B into memory location specified by HL register pair.

MVI: The instruction stores the 8 bit immediate data into register or memory location. If the data is to be stored into memory location than the address of memory location is to be stored into HL pair. The MVI instruction mentions the data immediately into the instruction.

For Example: MVI B, 08h // stores 08h into register B

MVI M, 0Bh // stores 0Bh at memory location specified by HL pair.

LDA: The instruction loads the content of accumulator by the data stored at memory address specified into the instruction. The instruction is used to directly load the content of memory into accumulator.

For Example: LDA 2020h // loads the content at memory location 2020h into Accumulator.

LDAX: The instruction loads the 16 bit content from memory location specified by the given register pair into accumulator. The memory location where the data is stored will be into the given register pair. So we can say that the instruction will load accumulator indirectly from given register pair.

For Example: LDAX B //consider B=02h & C=21h, the instruction will load the accumulator from memory address(0221h) specified by the BC pair. So A=the content at [0221h] memory location.

LXI: The instruction will load the register pair by the 16 bit data stored from given memory location. The lower order register will be stored first from given memory location and higher order register will be loaded from the next memory location.

For Example: LXI D, 20544h // the content of E=data at 2054h and D=data at 2055h

LHLD: This instruction will load the content of HL pair from the given memory location. The 16 bit data from given memory location will be loaded into register pair HL.

For Example: LHLD 5678h // the content of L = data at 5678h location and H = data at 5679h location.

STA: The instruction stores the content of Accumulator at the given memory location. The 16 bit address is given into the instruction. To store the Accumulator value into the memory location this instruction is used.

For Example: STA 1478h // it stores the value of Accumulator at 1478h memory location.

STAX: Store the accumulator indirectly. The instruction stores the content of accumulator at memory location specified by the content of given register pair. The register pair mentioned into the instruction contains the memory location value where the accumulator is to be stored.

For Example: STAX D // it stores the Accumulator content at the memory location specified by register pair DE. If D=12h and E= 54h than the accumulator content is stored at memory location 1254h.

SHLD: The instruction stores the HL pair content into memory location. The content of L is stored at the memory location specified. The value of register H is stored at the next memory location.

For Example: SHLD 8523h //Stores the content of register L at 8523h and content of register H at 8524h.

XCHG: The instruction exchanges the content of HL pair and DE pair. The instruction exchanges the value of register H with D, and L with E.

For Example: XCHG // consider HL=0230h and DE = 1005h than the instruction will exchange to HL = 1005h and DE = 0230h

PCHL: The instruction will store the content HL pair to program counter (PC). If the address of the next instruction to be executed is to be changed than the value will be stored into HL pair and the instruction will store the HL pair content with new next address of instruction is loaded into Program Counter(PC).

For Example: PCHL // consider if HL=1234h than instruction will change the PC to 1234h.

SPHL: Stores the content of HL pair to top of the stack. The instruction is used to store the HL pair into stack.

For Example: SPHL // stores the content of L at SP location and H at SP+1 location

XTHL: The instruction exchanges the content of HL pair with the content of top of stack(SP). The value of L is exchanged with SP location content and the content of H register is exchanged with SP+1 location.

For Example: XTHL // consider HL=2134h and content as SP= 14h and SP+1= 54h than the instruction will exchange the HL and top of stack. Now HL=5414h and SP=34h and SP+1=21h

PUSH: The instruction will store the content of given register pair into stack at the top of the stack location. The SP is decremented and higher order register content is stored into stack. The SP is again decremented and lower order register content is stored into stack.

For Example: PUSH B // stored B register value to SP-1 and C register value at SP-2 and SP is decremented by 2

POP: The instruction will load the content of top of the stack to the given register pair. The content of location pointed by SP is stored into lower order register and the content of location pointed by SP+1 is loaded into the higher order register.

For Example: POP D // load the value at SP into E and SP+1 into D register. SP is incremented by 2.

IN: The instruction performs the input operation from I/O device. The instruction reads the port specified by the 8 bit port address mentioned into the instruction and loads the content into Accumulator.

For Example: IN 02h // Reads the port 02h and loads the 8 bit value into Accumulator.

OUT: The instruction performs output operation to I/O device. The instruction sends the content of accumulator to the given port. The port address is specified by the 8 bit address into the instruction.

For Example: OUT 15h // Sends the content of Accumulator to the port 15h.

How do you rate the article?

Cast your vote for Instruction Set

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.

    Click to Rate This Article