MOV, MVI, LDA, LDAX, LXI, LHLD, STA, STAX,SHLD

1.MOV: - This instruction is used to copy the data from one place to another.

Eg: - MOV Rd, Rs (This instruction copies the content of Rs to Rd)
         MOV M,Rs (This instruction copies the content of register Rs to memory location pointed by HL Register)
         MOV Rd, M (This instruction copies the content of memory location pointed by the HL
register to the register Rd.)




2.MVI: -
move immediate date to a register or memory location.


Eg: - MVI Rd, #30H (30h is stored in register Rd)

          MVI M, #30H(30h is stored in memory location pointed by HL Reg)




3.LDA: - Load accumulator. (this instruction copies the data from a given 16 bit address to the accumulator)

Eg: - LDA 3000H (content of memory location 3000h is coppied in accumulator)




4.LDAX(Load accumulator indirect): - The contents of the designated register pair point to a memory location. This instruction copies the contents of that memory location into the accumulator. The contents of either the register pair or the memory location are not altered.

Eg: - LDAX B



5.LXI(Load register pair immediate): - The instruction loads 16-bit data in the register pair designated in the
operand.
Eg: - LXI H, 2034H (2034H is stored in HL pair so that it act as memory pointer)
          
          LXI H, XYZ      (address of level XYZ is copied in HL pair)



6.LHLD(Load H and L register direct): - this instruction loads the contents of the 16- bit memory location into the HL register pair.

Eg: - LHLD 3000H (the content of location 3000h is copied into the HL reg pair)




7.STA: - the content of accumulator are copied into the memory location.

Eg: - STA 3000H (the content of accumulator is stored into the memory location 3000h)



8.STAX(Store accumulator indirect): - The contents of the accumulator are copied into the memory location specified by the contents of the operand (register pair). The contents of the accumulator are not altered.

Eg: - STAX B (the content of accumulator is stored into the memory location specified by the BC register pair.)



9.SHLD(store H and L register direct): - The contents of register L are stored into the memory location specified by the 16-bit address in the operand and the contents of H register are stored into the next memory location by incrementing the operand. The contents of registers HL are not altered. This is a 3-byte instruction, the second byte specifies the low-order address and the third byte specifies the high-order address.


Eg: - SHLD 3000H

53 comments:

  1. Thank you so much..good place to learn and revise the instructions.

    ReplyDelete
  2. nice!!!! can i get some practice problems!!!

    ReplyDelete
    Replies

    1. Example 2: Arithmetic operations
      LDA ALPHA
      ADD INCR
      SUB ONE

      …….. STA BETA

      ……..
      ……..
      ONE WORD 1
      ALPHA RESW 1
      BEETA RESW 1
      INCR RESW 1
      Example 3: Looping and Indexing operation
      LDX ZERO ;X = 0
      MOVECH LDCH STR1, X
      STCH STR2, X
      TIX ELEVEN
      JLT MOVECH
      . . . . . .
      . . . . . .
      . . . . . .
      STR1 BYTE C ‘HELLO WORLD’
      STR2 RESB 11
      ZERO WORD 0
      ELEVEN WORD 11
      Example 4: Input and Output operation
      INLOOP TD
      JEQ RD STCH INDEV
      INLOOP INDEV DATA ; TEST INPUT DEVICE
      ; LOOP UNTIL DEVICE IS READY
      ; READ ONE BYTE INTO A
      ; STORE A TO DATA
      .
      .
      OUTLP TD OUTDEV ; TEST OUTPUT DEVICE
      JEQ OUTLP ; LOOP UNTIL DEVICE IS READY
      LDCH DATA ; LOAD DATA INTO A
      WD OUTDEV ; WRITE A TO OUTPUT DEVICE
      .
      .
      INDEV BYTE X ‘F5’ ; INPUT DEVICE NUMBER
      OUTDEV BYTE X ‘08’ ; OUTPUT DEVICE NUMBER
      DATA RESB 1 ; ONE-BYTE VARIABLE

      Delete
  3. 5.LXI(Load register pair immediate): - The instruction loads 16-bit data in the register pair designated in the
    operand.
    Eg: - LXI H, 2034H (2034H is stored in HL pair so that it act as memory pointer)

    LXI H, XYZ (address of level XYZ is copied in HL pair)



    6.LHLD(Load H and L register direct): - this instruction loads the contents of the 16- bit memory location into the HL register pair.

    Eg: - LHLD 3000H (the content of location 3000h is copied into the HL reg pair)

    What is difference tem will u explain it

    ReplyDelete
    Replies
    1. both are same just the difference is in the type of addressing mode...google type of addressing mode for more information

      Delete
    2. No both arent the same. LXI copies the 16 bit address 3000H to HL pair as in 30H to H and 00H to L. LHLD will copy the data contained in 3000H memory location to L and data contained in 3001H memory location to H.

      Delete
    3. This comment has been removed by the author.

      Delete
    4. sorry i fail to distinguish btn MOV and MVI help me please

      Delete
    5. LHLD 3000
      (3000)-->L
      (3001)-->H

      Delete
    6. @Javesh Go through ramesh goankar

      Delete
    7. @shaban mov dest,source moves data between registers
      Mvi reg,xx stores an value xx in register

      Delete
    8. in LHLD instruction the data at two consecutive locations will load in HL pair
      for eg- LHLD 3000H
      then data at 3000 load in H reg and data at next location which is 3001 load in L reg

      Delete
    9. If address is 3000H and data at 3000H is 20 and at 3001H is 30.

      Then LXI H, 3000H
      H = 30H
      L = 00H

      Then LHLD 3000H
      H = 30H
      L = 20H

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Why STAX H is not possible plz answer in detail

    ReplyDelete
    Replies
    1. Ldax H and stax H is not there as Mov M,A and Mov A,M does the job

      Delete
    2. STAX means:conntent of A sent to regıster pairs.I mean regıster paırs are 16 bıts.

      Delete
  6. If no1 and no2 are 8 bit the how to cpy no1 to no2 and if they are 16 bit

    ReplyDelete
  7. thanks for giving defined information of instructions

    ReplyDelete
  8. b ram and vibhuti microprocessor 8085 which any person have pdf book please send me my mail.id pravesh.bhagat@gmail.com

    ReplyDelete
  9. Replies
    1. nh nL is 16bit data nh lxi B,nhnl stores nh in B reg nl in C register

      Delete
    2. nh nL is 16bit data nh lxi B,nhnl stores nh in B reg nl in C register

      Delete
    3. can mov r,m be used after lxi d?

      Delete
    4. Lxi B initialises the pointer at the specified memory location of register By.For example:
      LXI B,C050H indicates that pointer is now pointing towards memory location C050 in register B

      Delete
    5. @mercy Yes mov r,m can be used after LXI d but memory location should have some specific data in it(cannot be empty).Also,we generally prefer initialising registers at the start so LXI d should be at the start of the program ,then you should load data into memory m and then use the instruction mov r,m to move data in memory location to register r

      Delete
  10. can i use "mov" instruction to move data to accumulator or i have to only use "mvi" instruction only?

    ReplyDelete
    Replies
    1. Don't get confused. Both will move the data.

      MOV A B will move the contents of B

      MVI A 03 here the value 03 is directly moved to the Accumulator!

      Delete
  11. Nice......... From these I will learn about so much instructions

    ReplyDelete
  12. Subscribe the YouTube Channel

    The Knowledge Adda

    for learn microprocessor programming

    ReplyDelete
  13. is STAX H a valid instruction??

    ReplyDelete
    Replies
    1. i am trying same but it shows error to me that is "unrecognized instruction". :-(

      Delete
  14. how to copy the content of flag register into another register

    ReplyDelete
  15. LDA 2000H HERE H DENOTES WHAT?

    ReplyDelete
  16. WHAT IS THE DIFFERENCE BETWEEN ADDING 2 BIT OR 16 BIT NO.?

    ReplyDelete
  17. wat is the difference bwt mov a b and mov b a?

    ReplyDelete
    Replies
    1. Mov a b means moving the value of b to a and mov b a means moving the value of a to b

      Delete
  18. In 30H , what does He means??

    ReplyDelete
  19. Very useful sir..Tq😊✌️

    ReplyDelete
  20. When shld instruction for hl register then which instruction use for bc and de register?

    ReplyDelete