| 1. |
SR Segment register |
|
Answer» SR Segment register 00 ES 01 CS 10 SS 11 DS To specify DS register, the SOP byte would be 001 11 110 = 3E H. Thus the 5 byte code for this instruction would be 3E 89 96 45 23 H. SOP Opcode D W MOD REG R/M LB disp. HD disp. 3EH 1000 10 0 1 10 010 110 45 23 Suppose we want to code MOV SS : 2345 (BP), DX. This generates only a 4 byte code, without SOP byte, as SS is already the default segment register in this case. Example 5 : Give the instruction template and generate code for the instruction ADD OFABE [BX], [DI], DX (code for ADD instruction is 000000) ADD OFABE [BX] [DI], DX Here we have to specify DX using REG field. The bit D is 0, indicating that DX is the source register. The REG field must be 010 to indicate DX register. The w must be 1 to indicate it is a word operation. FABE (BX + DI) is specified using MOD value of 10 and R/M value of 001 (from the summary table). The 4 byte code for this instruction would be Opcode D W MOD REG R/M 16 bit disp. =01 91 BE FAH 000000 0 1 10 010 001 BEH FAH 27 Example 6 : Give the instruction template and generate the code for the instruction MOV AX, [BX] (Code for MOV instruction is 100010) AX destination register with D=1 and code for AX is 000 [BX] is specified using 00 Mode and R/M value 111 It is a word operation Opcode D W Mod REG R/M =8B 07H 100010 1 1 00 000 111 |
|