can you check if the following code is correct for the following question and can you show me the screen shot of the out put. Thank you so much ; include the irvine library INCLUDE Irvine32.inc ;Data section declare all the variables .data source BYTE "This is the source string",0 target BYTE SIZEOF source DUP('#') ;Code section .code main PROC ;assign value o to esi mov esi,0 ;find the length of the source ;subtract with 2 and assign to edi mov edi,LENGTHOF source - 2 ;find the number of bytes used source ;assign to ecx mov ecx,SIZEOF source ;iterate a loop L1: ;get the value of source at index esi ;and move into register al. mov al,source[esi] ;move the value of al into target array ;at index edi. mov target[edi],al ;increment the value of esi inc esi ;decrement the value of edi. dec edi loop L1 ;get the address value of the target ;into edx. mov edx, OFFSET target ;print the string call WriteString exit main ENDP END main
can you check if the following code is correct for the following question and can you show me the screen shot of the out put. Thank you so much
; include the irvine library
INCLUDE Irvine32.inc
;Data section declare all the variables
.data
source BYTE "This is the source string",0
target BYTE SIZEOF source DUP('#')
;Code section
.code
main PROC
;assign value o to esi
mov esi,0
;find the length of the source
;subtract with 2 and assign to edi
mov edi,LENGTHOF source - 2
;find the number of bytes used source
;assign to ecx
mov ecx,SIZEOF source
;iterate a loop
L1:
;get the value of source at index esi
;and move into register al.
mov al,source[esi]
;move the value of al into target array
;at index edi.
mov target[edi],al
;increment the value of esi
inc esi
;decrement the value of edi.
dec edi
loop L1
;get the address value of the target
;into edx.
mov edx, OFFSET target
;print the string
call WriteString
exit
main ENDP
END main


In the Assembly language, to copy a string in reverse order by using any of the assembly language, you will need to use a loop to iterate over the characters in the string and copy them into a new string in reverse order. You will also need to use a couple of registers to keep track of the current index in both the source and destination strings.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images









