8085 intel istruction Sets Data transfer Group



           a) Data transfer Group
Something you must know before going into it
We have studied about the register their pair in previous chapter, microprocessor architecture I will denote R for the register signally and register pair as Rp. Some revision here , that the registers can be used alone or as a pair so some instruction take register pair([BC][DE][HL])as their operand whereas other take only register( B C D E H L ) as their operand.

Also the concept of bits
          ‘0101’ count the no of 1’s and 0’s you will get the no. four so hat is four bits representation.
          ‘01010000’ no. of 1,s and 0 is 8 so it is 8 bit representation.
8 bits = 1 byte
16 bits =2 bytes

Let’s take 3040h, it’s a hex data and the binary of it is 0111 0000 so, it’s a 8 bit data
8085 assembler converts the 3040 to 8 bit binary value and give to microprocessor.
MOV Move
MVI Move Immediate
LDA Load Accumulator Directly from Memory
LXI Load Register Pair with Immediate data
LDAX Load Accumulator from Address in Register Pair
STA Store Accumulator Directly in Memory
STAX Store Accumulator in Address in Register Pair
LHLD Load H & L Registers Directly from Memory
SHLD Store H & L Registers Directly in Memory
XCHG Exchange H & L with D & E
XTHL Exchange Top of Stack with H & L
1)      MOV (Move)

a)      MOV move register instruction.
·         MOV Rd, Rs                
·         1 byte instruction
·         Carries data from source register (Rs) to another destination register (Rd).
·         Rd and Rs may be A,B,C D,E ,H,L.
·         Eg: MOV   H,A
                  Here ,The content of accumulator is transferred to H register.
                       If Accumulator contain data 20h than program below output as.
                         MOV   H, A
                           HLT              
                                  output
                                   A:20
                                   B: 00          C: J J
                                   D: 00           E: 00
                                   H:20            L:00
b)      Move to  memory from register
·         MOV M,Rs
·         Move the content of the specified register to the memory .Here memory is the location specified by content Of the HL pair registers.
Here we will study actually what M is .
Let [HL] pair contain data 2030 ,then the location 2030 is called as  memory(M) and let  B contains data 40h.If we have the instruction:

 MOV   M,B

Than 2030 location is filled by data in register B and it is summarized as output as:

Output
B: 20h
[2030]:20h

c)      Move to register from memory
·         MOV R,M
·         1 byte instruction
·         Moves the content of the memory location specified by HL pair to specified by HL pair to the specified by HL pair to specified register.
For Example : IF [HL] pair contain data 5060h then instruction MOV D,M transfer the data containing in address 5060  to the register D.


2)      MVI (Move immediate)  

a)      MVI R,8 bit data
·         Loads the 8 bits data into the specified register
·         R may be A,B,C,D,E,H ,L
·         Eg: MVI B,20h

In this example the content of register C is moved to B and data in C will also be unchanged.
 If C has data 20h than 20h will be moved to register B.

b)       MVI M,8 bit data

3)       LXI ( Load registers pair directly)
·         LXI Rp,2 bytes data
·         byte instruction
·         load immediate 16 bit data to the register pair
·         Rp may be B(BC),D(DE),H(HL),& SP

1st byte op code
2nd byte lower order data
3rd byte higher order data


4)      MVI (Load memory immediately)
a)      MVI  Rd,8 bit data to the
·         Loads the 8 bit data to the register
·         E.g. MVI B,20h
In this example 20h data is loaded  to register B.
Output
B: 20h
b)      MVI M,8 bit data
·         byte instruction
·         loads the 8-bit data to the memory location whose address is specified by the content of the HL pair

                 Eg. MVI M,35H; [HL] ß35 H
In this example 35h is stored in the location specified by the data in register pair HL
If the content of register pair [HL] was 2020 then 35h is stored in memory location 2020
Here
5)      LDA Load accumulator direct
·         LDA 16 bit address
·         2 byte instruction
·         loads the accumulator with the content of memory location whose address is specified by
·         the 16 bit address
·         Eg.LDA 4035;Aß[4035]
In this example the data from the address 4030 will be loaded to the Accumulator.
·         Eg.LDA 4035;Aß[4124]
In this example the data from the address 4124 will be loaded to the Accumulator.
Let’s solve a question
Write program to load the data
6)      LDAX (Load accumulator indirect )
·         LDAX  Rp
·         1 byte instruction
·         Moves the content of the memory location pointed by the content of the register pair to  accumulator
LXI
·         E.g LDAX B; Aß[BC]
Let [BC] pair contains 2020, then the instruction ‘LDAX B ‘ stores the data containing in address pointed by register B(i.e. 2020)
7)      STA (Store accumulator content direct)
·         STA 16 bit address
·         2 byte instruction
·         Stores the content of accumulator to specified address
·         Eg STA FA00,[FA00]ßA;
 In this example the content of accumulator is stored in the address FA00.m

Let’s do a program
MVI   A,20h
STA   5050h
HLT
Here, ‘MVI A, 20h’ stores the 20h in accumulator, and STA stores the content of accumulator to to 5050.

OUTPUT
A:20
           [5050]:20
                  
8)      Store accumulator content indirect
·         STAX Rp;
·         1 byte instruction

To understand this instruction let’s take an example
LXI            D,4060h;
MVI          A,20h;
STAX        D              ;[4060]ß20h
HLT
Here, LXI loads the immediate data 4060h to register pair D ,MVI moves 20h data to  accumulator and STAX instruction  content of accumulator is stored in address pointed by register D.
So he output is
D:40  E:60
A:20

[4020]: 20
9)      Input from input port
Do yourself
10)   Output to output

No comments:

Post a Comment

its cool