1. Data Movement Instructions A Course in Microprocessor Electrical Engineering Department University of Indonesia
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15. (a) 16-bit instruction mode Opcode 1-2 bytes Immediate 0-1 bytes MOD-REG-R/M 0-1 bytes Displacement 0-1 bytes (b) 32-bit instruction mode (80386 through Pentium 4 only) Opcode 1-2 bytes Immediate 0-1 bytes MOD-REG-R/M 0-1 bytes Displacement 0-1 bytes Scaled-index 0-1 bytes Register size 0-1 bytes Address size 0-1 bytes Figure 4-1 The formats of the 8086-Pentium 4 instructors. (a) The 16-bit form and (b) the 32-bit form.
16. Figure 4-2 Byte 1 of many machine language instructions, showing the position of the D- and W-bits. Figure 4-3 Byte 2 of many machine language instructions, showing the position of the MOD, REG and R/M fields. W D Opcode MOD REG R/M
17. Opcode = MOV D = Transfer to register (REG) W = Word MOD = R/M is a register REG = BP R/M = SP FIGURE 4-4 The 8BEC instruction placed into bytes 1 and 2 formats from Figures 4-2 and 4-3. This instruction is a MOV BP,SP 0 0 1 1 0 1 1 1 1 1 0 1 0 0 0 1 R/M REG MOD W D Opcode Opcode = MOV D = Transfer to register (REG) W = Byte MOD = No displacement REG = DL R/M = DS:[DI] FIGURE 4-5 A MOV DL,[DI] instruction converted to its machine language form. 1 0 1 0 1 0 0 0 0 1 0 1 0 0 0 1 R/M REG MOD W D Opcode
18.
19.
20.
21.
22.
23.
24.
25.
26. R/M is a register 11 16-bit signed displacement 10 8-bit sign-extended displacement 01 No displacement 00 Function MOD TABLE 4-1 MOD field for the 16-bit instruction mode R/M is a register 11 32-bit signed displacement 10 8-bit sign-extended displacement 01 No displacement 00 Function MOD TABLE 4-2 MOD field for the 32-bit instruction mode (80386-Pentium 4 only)
27. EDI DI BH 111 ESI SI DH 110 EBP BP CH 101 ESP SP AH 100 EBX BX BL 011 EDX DX DL 010 EAX CX CL 001 EAX AX AL 000 W = 1 ( Doubleword) W = 1 (Word) W = 0 (Byte) Code TABLE 4-3 REG and R/M (when MOD = 11) assignments