1 / 14

Data Transfer Instructions

Data Transfer Instructions. Introduction. The data transfer instructions are used to move data between internal register or between internal register and the memory.

natane
Télécharger la présentation

Data Transfer Instructions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Data Transfer Instructions www.ustudy.in

  2. Introduction • The data transfer instructions are used to move data between internal register or between internal register and the memory. • The content of the source remains the same after the execution of data transfer instructions. Flags are not affected by any of the instruction in the group. www.ustudy.in

  3. MOV instruction • Move from source to destination. Syntax: • MOV destination, source • Transfers data referenced by the address of the second operand to the address of the first operand • Destination has to have the same length as source [label:] MOV register/memory register/memory/immediate Example: MOV F, AX ; // Move content of AX to the variable F MOV CX, D ;// Move value of D to CX MOV ES, AX MOV AX, 215 www.ustudy.in

  4. Examples on MOV BYTEFLD DB ? ; define byte WORDFLD DW ? ; define word … MOV EDX , ECX ; register to register MOV BYTEFLD , DH ; register to memory MOV WORDFLD , 1234 ; immediate to memory MOV CH , BYTEFLD ; memory to register MOV CX , 40H ; immediate to register MOV AX , DS ; segment register to register www.ustudy.in

  5. MOV instruction types • The following are the MOV instruction types, based on the data items. • Immediate moves • Register moves • Direct memory moves • Segment register moves • Move and fill instructions • Move string instruction www.ustudy.in

  6. Immediate Moves • This type of MOV instruction moves the data in the form of byte or word data into memory location or register • Examples • MOV AX, 25 • This instruction transfers the data 25 immediate to register AX. • MOV BYTEVAL, 25 • This instruction transfers the byte value data 25 immediate to memory. • MOV WORDVAL[BX], 25 • This instruction transfers the word value data 2 immediate to memory. www.ustudy.in

  7. Register Moves • This type of MOV instructions moves the data between internal register, or segment reg to register or register to memory. • Examples • MOV DS, AX • This instruction transfers the 16 bit content of AX register to segment register. • MOV BYTEVAL, BH • This instruction transfers 8 bit data from register BH to memory using direct addressing. www.ustudy.in

  8. Direct Memory Moves • This type of MOV instruction moves the data in the form of byte or word data from memory to register. • Examples • MOV BH, BYTEVAL • This instruction copies a 8 bit data from memory to register using direct addressing. • MOV AX, WORDVAL[BX] • This instruction transfers a 16 bit data from memory to AX register. The physical address is got by adding the effective address in BX register and the base address in DS register. www.ustudy.in

  9. Segment Register Moves • This type of MOV instruction moves the data from segment register to memory or register. • Examples • MOV AX, DS • This instruction transfer a data from segment register to register AX. • MOV WORDVAL, DS • This instruction transfers a data from segment register to memory location www.ustudy.in

  10. Move And Fill Instructions Move-and-Fill Instructions: MOVSX and MOVZX For the MOV instruction, size of source and destination must be same (eg, byte-to-byte, word-to-word). For MOVSX and MOVZX instructions facilitate transferring data from a byte or word source to a word or doubleword destination. Format for MOVSX and MOVZX instructions: www.ustudy.in

  11. Data Transfer Instructions MOVSX used with signed arithmetic value. moves a byte or word to destination with size of word or double word and all the leftmost bits of destination will be filled with the sign bit. MOVSX CX, 10110000B ; CX = 11111111 10110000 MOVZX used with unsigned arithmetic value moves a byte or word to destination with size of word or double word and the leftmost bit of destination will be filled with the value 0. MOVZX CX, 10110000B ; CX = 00000000 10110000 www.ustudy.in

  12. Examples: MOVSX AX, 00001010B ; AX = 00000000 00001010 MOVZX AX, 00001010B ; AX = 00000000 00001010 www.ustudy.in

  13. XCHG Instruction This instruction is used to change the value of source into that of the destination and vice versa. The format for this instruction: Example: WORDQ DW ? ; Word data item . . . XCHG CL , BH ; exchange the content of the 2 registers XCHG CX, WORDQ ; exchange the content between register ; and memory www.ustudy.in

  14. The End www.ustudy.in

More Related