Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computer Engineering by Richard E. Haskell Move and Exchange Instructions Module M16.1 Section 10.2.

Similar presentations


Presentation on theme: "Introduction to Computer Engineering by Richard E. Haskell Move and Exchange Instructions Module M16.1 Section 10.2."— Presentation transcript:

1 Introduction to Computer Engineering by Richard E. Haskell Move and Exchange Instructions Module M16.1 Section 10.2

2 Introduction to Computer Engineering by Richard E. Haskell MOV Move Instruction Can move immediate data to a register or memory (but not a segment register). Can move data from a register to a register. Can move data from a register to memory. Can move data from memory to a register. Can NOT use MOV instruction to move data directly from one memory location to another. But can use MOVS instruction.

3 Introduction to Computer Engineering by Richard E. Haskell

4 Some MOV Instructions

5 Introduction to Computer Engineering by Richard E. Haskell Table A2.a Opcode Map OR b AL,imm OR w AX,imm SBB b AL,imm SBB w AX,imm SUB b AL,imm SUB w AX,imm CMP b AL,imm CMP w AX,imm 89ABCDEF 0 1 2 3 4 5 6 7 8 9 A B C D E F MOV AX,imm MOV CX,imm MOV DX,imm MOV BX,imm MOV SP,imm MOV BP,imm MOV SI,imm MOV DI,imm TEST b AL,imm TEST w AL,imm OR b r/m,reg OR w OR bOR w reg,r/m SBB bSBB w SBB bSBB w SUB b SUB w SUB b SUB w CMP bCMP w CMP bCMP w PUSH CS PUSH DS POP DS SEGMENT CS SEGMENT DS DAS AAS DEC AX DEC CX DEC DX DEC BX DEC SP DEC BP DEC SI DEC DI POP AX POP CX POP DX POP BX POP SP POP BP POP SI POP DI JSJNS JP/JPEJNP/JPOJL/JNGEJNL/JGEJLE/JNG JNLE/JG MOV b r/m,reg MOV W r/m,reg MOV b reg,r/m MOV W reg,r/m MOV r/m,seg LEA reg,r/m MOV seg,r/m LAHFSAHF POPFPUSHF WAIT CALL inter CBW CWD STOS bSTOS wLODS bLODS wSCAS b SCAS w RET inter+ RET inter INT type INTINTOIRET ESC 0 1 2 3 4 5 6 7 CALL intra JMP intra JMP inter JMP short IN b AL,DX IN w AX,DX OUT b DX,AL OUT w DX,AX CLC STCCLISTI CLD STD** POP r/m mov bx,ax 8B D8

6 Introduction to Computer Engineering by Richard E. Haskell Postbyte modregr/m mov bx,ax 8B mov w reg,r/m reg = bx = 011 0 1 1 mod = 11 r/m = ax = 0 0 0 1 0 0 0= D8 mov bx,ax 8B D8

7 Introduction to Computer Engineering by Richard E. Haskell Table A2.a Opcode Map OR b AL,imm OR w AX,imm SBB b AL,imm SBB w AX,imm SUB b AL,imm SUB w AX,imm CMP b AL,imm CMP w AX,imm 89ABCDEF 0 1 2 3 4 5 6 7 8 9 A B C D E F MOV AX,imm MOV CX,imm MOV DX,imm MOV BX,imm MOV SP,imm MOV BP,imm MOV SI,imm MOV DI,imm TEST b AL,imm TEST w AL,imm OR b r/m,reg OR w OR bOR w reg,r/m SBB bSBB w SBB bSBB w SUB b SUB w SUB b SUB w CMP bCMP w CMP bCMP w PUSH CS PUSH DS POP DS SEGMENT CS SEGMENT DS DAS AAS DEC AX DEC CX DEC DX DEC BX DEC SP DEC BP DEC SI DEC DI POP AX POP CX POP DX POP BX POP SP POP BP POP SI POP DI JSJNS JP/JPEJNP/JPOJL/JNGEJNL/JGEJLE/JNG JNLE/JG MOV b r/m,reg MOV W r/m,reg MOV b reg,r/m MOV W reg,r/m MOV r/m,seg LEA reg,r/m MOV seg,r/m LAHFSAHF POPFPUSHF WAIT CALL inter CBW CWD STOS bSTOS wLODS bLODS wSCAS b SCAS w RET inter+ RET inter INT type INTINTOIRET ESC 0 1 2 3 4 5 6 7 CALL intra JMP intra JMP inter JMP short IN b AL,DX IN w AX,DX OUT b DX,AL OUT w DX,AX CLC STCCLISTI CLD STD** POP r/m mov bx,ax 8B D8 mov bx,ax 89 C3

8 Introduction to Computer Engineering by Richard E. Haskell Postbyte modregr/m mov bx,ax 89 mov w r/m, reg reg = ax = 000 0 0 0 mod = 11 r/m = bx = 0 11 1 0 1 1= C3 mov bx,ax 89 C3

9 Introduction to Computer Engineering by Richard E. Haskell Postbyte modregr/m mov bl,[si] 8A mov b reg, r/m reg = bl = 011 0 1 1 mod = 00 r/m = si = 100 0 1 0 0 = 1C mov bl,[si] 8A 1C Move byte pointed to by si into BL

10 Introduction to Computer Engineering by Richard E. Haskell XCHG Exchange Instruction Can exchange AX with a 16-bit register. Can exchange an 8-bit register with another 8-bit register or an 8-bit byte in memory. Can exchange a 16-bit register with another 16-bit register or a 16-bit word in memory.

11 Introduction to Computer Engineering by Richard E. Haskell XCHG Instruction MachineAssembly Language Code InstructionOperation 9XXCHG reg16 Exchange AX and reg16 86 PBXCHG b r/m,reg Exchange r/m and reg bytes 87 PBXCHG w r/m,reg Exchange r/m and reg words

12 Introduction to Computer Engineering by Richard E. Haskell Table A2.a Opcode Map

13 Introduction to Computer Engineering by Richard E. Haskell Postbyte modregr/m xchg bh,al 86 xchg b r/m,reg reg = al = 000 0 0 0 mod = 11 r/m = bh = 111 1 1 1 1= C7 xchg bh,al 86 C7


Download ppt "Introduction to Computer Engineering by Richard E. Haskell Move and Exchange Instructions Module M16.1 Section 10.2."

Similar presentations


Ads by Google