Copy a sting from source to target in reverse order

-1

this program copies a string from source to target in reverse order. I am getting an Exception thrown at line 14 0x00401026 in Project.exe: 0xC0000005: Access violation writing location 0x00000018.

also, I am not sure what do the lines 3,13,14 do. I am also confused about the role of Square Brackets []

1  .data
2  source byte "this is a string ",0
3  target byte SIZEOF source DUP('#')
4
5  .code
6  main PROC
7   mov esi, OFFSET source       
8   mov edi, OFFSET target      
9   mov edi, SIZEOF target-2   
10
11  mov ecx, SIZEOF source-1     
12  L1:                             
13      mov al, [esi]
14      mov [edi], al     ;Exception thrown 
15      inc esi                      
16      dec edi                      
17      loop L1        
string
loops
assembly
x86
asked on Stack Overflow Oct 29, 2018 by Jinna • edited Oct 29, 2018 by lurker

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0