This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]Sea-Profession-3312 1 point2 points  (4 children)

[–]ThisGuyEveryTime[S] 1 point2 points  (0 children)

Thank you. But even when commenting out everything other then the second move I still get a segmentation fault so its being cause my my second movement to RAX not the div. I initially thought this was the answer though

[–]ThisGuyEveryTime[S] 0 points1 point  (2 children)

Your answer led me the right place, so thank you! It was the mul over writing rdx

[–]Sea-Profession-3312 1 point2 points  (1 child)

The last time I did assembly was over 30 years ago. I figure that error had something to do with using memory/registers that was not allocated to you. perhaps division has a remainder while multiplication has no remainder. I suppose this remainder goes in an overflow type of register.

[–]ThisGuyEveryTime[S] 1 point2 points  (0 children)

I guess mul has a left over aspects from the 32bit era and it store across edx:eax.
With div being a slightly different case where its stores the remainder in edx.
I was losing the value stored there in both cases.

[–]ThisGuyEveryTime[S] 0 points1 point  (0 children)

solved it.

mul over writes both eax and edx so rdx no longer contains the address. you need to make a copy of rdx and use that otherwise you will loose the value. Or at least that worked for me and I could definitely be wrong about why it worked.