Question: Programming Exercise 2 : - COPY A STRING IN REVERSE ORDER Write a program with a loop ( use the Loop instruction and ECX )

Programming Exercise 2 :-
COPY A STRING IN REVERSE ORDER
Write a program with a loop (use the Loop instruction and ECX) and indirect addressing that copies a string from source to target, reversing the character
order in the process. You MUST use the exact data block, memory allocation and initialization, as shown in the followings for testing - for showing that
your code would not over-write the original data at the head(4'$'s) middle(4'%'s) and tail(4'^'s):
BYTE 4 DUP('$')
source BYTE "This is the source string",
BYTE 4 DUP('%')
target BYTE SIZEOF source DUP ('#')
BYTE 4 DUP('???')
Hint: Should Not copy the null character, 0, at the end of the source string to the front of the target string. And, finish writing the target string by
writing the null character, 0, to the last byte - replacing the last '#' there.
In the output of the program, both the source and target(reversed) strings should be shown, by calling the Irvine peripheral procedure(s). Use the
following test code to display the Whole Data Bank:
mov edx, OFFSET source-4 ; display the 4"$" and source string
call Writestring
mov al, source[SIZEOF source-1] ; if the last char of source is Null, then display it as '.'
cmp al,
jz Disp_Null_char_1
call Writechar
jmp Disp_target_str
Disp_Null_char_1:
mov al,'.' ; use '.' to represent the Null
call Writechar
Disp_target_str:
mov edx, OFFSET target-4 ; display the 4"%" and target string
call Writestring
mov al, target[SIZEOF target-1] ; if the last char of target is Null, then display it as '.'
cmp al,
jz Disp_Null_char_2
call Writechar
jmp Disp_4_hats
Disp_Null_char_2:
mov al,'.' ; use '.' to represent the Null
call Writechar
Disp_4_hats:
mov edx, OFFSET target + SIZEOF target ; display the 4"^"
call Writestring
IMPORTANT: for this exercise, NOT allowable to use any one of these directives: .IF,.ELSE, .ELSEIF, .WHILE, .REPEAT, etc
Please add a lot of comments to explain step-by-step
 Programming Exercise 2 :- COPY A STRING IN REVERSE ORDER Write

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!