Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Transfer Instructions www.ustudy.in. Introduction The data transfer instructions are used to move data between internal register or between internal.

Similar presentations


Presentation on theme: "Data Transfer Instructions www.ustudy.in. Introduction The data transfer instructions are used to move data between internal register or between internal."— 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 BYTEFLDDB?; define byte WORDFLDDW?; 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. 1.Immediate moves 2.Register moves 3.Direct memory moves 4.Segment register moves 5.Move and fill instructions 6.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: [Label:]MOVSX/MOVZXregister/memory, register/memory/immediate 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. MOVZXCX, 10110000B; CX = 00000000 10110000 www.ustudy.in

12 Examples: MOVSXAX, 00001010B; AX = 00000000 00001010 MOVZXAX, 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: WORDQDW?; Word data item... XCHG CL, BH ; exchange the content of the 2 registers XCHG CX, WORDQ ; exchange the content between register ; and memory [Label :]XCHGregister/memory, register/memory www.ustudy.in

14 The End www.ustudy.in


Download ppt "Data Transfer Instructions www.ustudy.in. Introduction The data transfer instructions are used to move data between internal register or between internal."

Similar presentations


Ads by Google