Question: Suppose a program has the string COMSC 2 6 0 stored in source. The goal of the program is to store the reversed string,
Suppose a program has the string "COMSC stored in source. The goal of the program is to store the reversed string, CSMOC" in target. Part of the program is as follows:
data
source BYTE "COMSC
target BYTE SIZEOF source DUP
code
main PROC
mov ecx,SIZEOF source
L:
mov alesi
mov edi al
dec esi
inc edi
loop L
mov BYTE PTR edi
For this program to work correctly, esi and edi must both be initialized correctly. Which of the options below correctly initializes both registers?
NOTE: The source string ends with a null terminator After the program finishes running, the target string will also end with a null terminator
A
mov esi, OFFSET target
mov edi, OFFSET source SIZEOF source
B
mov esi, OFFSET target
mov edi, OFFSET source SIZEOF source
C
mov esi, OFFSET target
mov edi, OFFSET source SIZEOF source
D
mov esi, OFFSET target
mov edi, OFFSET source SIZEOF source
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
