Tugas 3
8.Select an instruction for each of the following tasks :
(a) copy EBX into EDX
(b) copy BL into CL
(c) copy SI into BX
(d) copy DS into AX
(e) copy AL into AH
Answer :
Operation Assembly Language
(a) copy EBX into EDX MOV EDX,EBX
(b) copy BL into CL MOV CL,BL
(c) copy SI into BX MOV BX,SI
(d) copy DS into AX MOV AX,DS
(e) copy AL into AH MOV AH,AL
9.Select an instruction for each of the following tasks :
(a) move 12H into AL
(b) move 123AH into AX
(c) move 0CDH into CL
(d) move 1200A2H into EBX
Answer :
Operation Assembly Language
(a) move 12H into AL MOV AL,12H
(b) move 123AH into AX MOV AX,123AH
(c) move 0CDH into CL MOV CL,0CDH
(d) move 1200A2H into EBX MOV EBX,1200A2H
21.Suppose that DS = 0200H, BX = 0300H, and DI = 400H. Determine the memory address accessed by each of the following instruction, assuming real mode operations :
(a) MOV AL,[1234H]
(b) MOV EAX,[BX]
(c) MOV [DI],AL
Answer :
(a) Address Generation = DS x 10H + 1234H
= 200H x 10 + 1234H
= 2000H + 1234H
Memory Address = 3234H
(b) Address Generation = DS x 10H + BX
= 200H x 10 + 0300H
= 2000H + 0300H
Memory Address = 2300H
(c) Address Generation = DS x 10H + DI
= 200H x 10 + 400H
= 2000H + 400H
Memory Address = 2400H
33.Suppose that EAX = 00001000H, EBX = 00002000H, and DS = 0010H. Determine the addresses accessed by the following instruction, assuming real mode operation :
(a) MOV ECX,[EAX+EBX]
(b) MOV [EAX+2*EBX],CL
(c) MOV DH,[EBX+4*EAX+1000H]
Answer :
(a) Address Generation = DS x 10H + EAX + EBX
= 00000100H + 00001000H + 00002000H
Memory Address = 00003100H
(b) Address Generation = DS x 10H + EAX + 2 x EBX
= 00000100H + 00001000H + 00004000H
Memory Address = 00005100H
(c) Address Generation = DS x 10H + EBX + 4 x EAX + 1000H
= 00000100H + 00002000H + 00004000H + 00001000H
Memory Address = 00007100H
43.Show which JMP instruction assembles (short, near, or far) if the JMP THERE instruction is stored at s address 10000H and the address of THERE is :
(a) 10020H
(b) 11000H
(c) 0FFFEH
(d) 30000H
Answer :
(a) 10020H
10000H
00020H → 0000 0000 0000 0010 0000
1 byte
1 byte displacement → short jump
(b) 11000H
10000H
01000H → 0000 0001 0000 0000 0000
2 byte
2 byte displacement → near jump
(c) 0FFFEH
10000H
2H→ 0000 0010
1 byte
1 byte displacement → short jump
(d) 30000H
10000H
20000H → 0000 0010 0000 0000 0000 0000
3 byte
3 byte displacement → far jump
(a) copy EBX into EDX
(b) copy BL into CL
(c) copy SI into BX
(d) copy DS into AX
(e) copy AL into AH
Answer :
Operation Assembly Language
(a) copy EBX into EDX MOV EDX,EBX
(b) copy BL into CL MOV CL,BL
(c) copy SI into BX MOV BX,SI
(d) copy DS into AX MOV AX,DS
(e) copy AL into AH MOV AH,AL
9.Select an instruction for each of the following tasks :
(a) move 12H into AL
(b) move 123AH into AX
(c) move 0CDH into CL
(d) move 1200A2H into EBX
Answer :
Operation Assembly Language
(a) move 12H into AL MOV AL,12H
(b) move 123AH into AX MOV AX,123AH
(c) move 0CDH into CL MOV CL,0CDH
(d) move 1200A2H into EBX MOV EBX,1200A2H
21.Suppose that DS = 0200H, BX = 0300H, and DI = 400H. Determine the memory address accessed by each of the following instruction, assuming real mode operations :
(a) MOV AL,[1234H]
(b) MOV EAX,[BX]
(c) MOV [DI],AL
Answer :
(a) Address Generation = DS x 10H + 1234H
= 200H x 10 + 1234H
= 2000H + 1234H
Memory Address = 3234H
(b) Address Generation = DS x 10H + BX
= 200H x 10 + 0300H
= 2000H + 0300H
Memory Address = 2300H
(c) Address Generation = DS x 10H + DI
= 200H x 10 + 400H
= 2000H + 400H
Memory Address = 2400H
33.Suppose that EAX = 00001000H, EBX = 00002000H, and DS = 0010H. Determine the addresses accessed by the following instruction, assuming real mode operation :
(a) MOV ECX,[EAX+EBX]
(b) MOV [EAX+2*EBX],CL
(c) MOV DH,[EBX+4*EAX+1000H]
Answer :
(a) Address Generation = DS x 10H + EAX + EBX
= 00000100H + 00001000H + 00002000H
Memory Address = 00003100H
(b) Address Generation = DS x 10H + EAX + 2 x EBX
= 00000100H + 00001000H + 00004000H
Memory Address = 00005100H
(c) Address Generation = DS x 10H + EBX + 4 x EAX + 1000H
= 00000100H + 00002000H + 00004000H + 00001000H
Memory Address = 00007100H
43.Show which JMP instruction assembles (short, near, or far) if the JMP THERE instruction is stored at s address 10000H and the address of THERE is :
(a) 10020H
(b) 11000H
(c) 0FFFEH
(d) 30000H
Answer :
(a) 10020H
10000H
00020H → 0000 0000 0000 0010 0000
1 byte
1 byte displacement → short jump
(b) 11000H
10000H
01000H → 0000 0001 0000 0000 0000
2 byte
2 byte displacement → near jump
(c) 0FFFEH
10000H
2H→ 0000 0010
1 byte
1 byte displacement → short jump
(d) 30000H
10000H
20000H → 0000 0010 0000 0000 0000 0000
3 byte
3 byte displacement → far jump