Hi,

I'm a student in computer science and I have to create a small program in assembly. This program must then be used in a C++ program.

Now onto the purpose : it must take a destination vector, a source vector and the length of thoses vectors (which is the same), take every number in the first vector, multiply it by two and then put it in the second vector.

My problem is this, for the core of the program, it looks like this :

xor edi, edi ; initialising edi at 0 for the offset

table_multiplier:

mov esi, [edx + edi*4] ; getting the value from the source table

shl esi, 1 ; multiplying the taken value by 2

mov [eax + edi*4], esi ; putting the value in the destination table

inc edi

loopnz table_multiplier

ecx contains the length of the vector. When I run it in sasm, I don't have any problem. But when I try using it in my C++ code, I get a segmentation fault. I've been trying to wrap my head around this for a day now and I can't seem to find the problem.

Thanks in advance if anyone can help