Can someone help me with these multiple choices. please explain your answer. Tha
ID: 3840836 • Letter: C
Question
Can someone help me with these multiple choices. please explain your answer. Thank you
Question 1 The REPNZ CMPSB instruction pair will execute as long as the byte pointed to by ESI is not equal to the byte pointed to by ED o True o False Question 2 What instruction is needed so that the following code works properly? mov esi offset dBufferl mov edi offset dBuffer2 mov ecx, LENGTHOF dBufferl add esi, SIZEOF dBufferl TYPE dBufferl point at end of buffer add edi SIZEOF dBuffer2 TYPE dBuffer2 What instruction should go here? rep movsd Question 3 The following code does what? mov esi, OFFSET dSource mov edi, OFFSET dDest mov ecx, LENGTHOF dSource cld repe cmpsd e L1 Compares elements in the dSource array to elements in the dDest array until a equal element is found Compares elements in the dSource array to elements in the dDest array until a non-equal element is found Compares elements in the dSource array to elements in the dDest array until a non-equal element is found or the end of the array is reached Compares a value in EAxto elements in the dDest array until a matching element is foundExplanation / Answer
1. True
The string elements to be operated on are identified with the ESI (source string element) and EDI (destination string element) registers. Both of these registers contain absolute addresses (offsets into a segment) that point to a string element.
2.CLD or STD
MOVSD increments/decrements by 4.Use MOVSD to delete the first element of the following doubleword array. All subsequent array values must be moved one position forward toward the beginning of the array.Whether it increments or decrements is determined by the “direction flag.”
The Direction flag can be explicitly changed using the CLD and STD instructions:
CLD ; clear Direction flag (direction = forward)
STD ; set Direction flag
3.A(First one)
Use a REPE (repeat while equal) prefix to compare corresponding elements of source and destination until ecx value is 0.
cld ; direction = forward
repe cmpsd ; repeat while equal
je L1 ; yes: continue loop
4. True (if you need the program to be really small, and LEA already used 100 times, you can make the program 100 bytes smaller simply by using MOV x, OFFSET y instead.)
5. False (Explained above that cld --> direction = forward)
6. True (The MOVSB instructions copy data from the memory location pointed to by ESI to the memory location pointed to by EDI depending on Whether it increments or decrements is determined by the “direction flag.”)
7. False
8. True
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.