flat assembler
Message board for the users of flat assembler.
Index
> Main > Changing strings |
Author |
|
Tomasz Grysztar 27 Oct 2005, 10:41
There are String operation instructions for such purposes.
|
|||
27 Oct 2005, 10:41 |
|
denial 29 Oct 2005, 12:04
thank you. how could i forget about them.
i'm sorry... |
|||
29 Oct 2005, 12:04 |
|
Reverend 01 Nov 2005, 09:29
Code: push ecx edi esi mov esi, src mov edi, dest mov ecx, size rep movsb pop esi edi ecx |
|||
01 Nov 2005, 09:29 |
|
okasvi 11 Nov 2005, 08:12
Reverend wrote:
so which one is it? in code you have movsb... im not at home so i could test it but i want to know before i memorize either one of those... movsd/movsb... _________________ When We Ride On Our Enemies support reverse smileys |: |
|||
11 Nov 2005, 08:12 |
|
Reverend 12 Nov 2005, 14:43
The version I posted is correct for all strings (of course for correct arguments). But if you know the string you want to copy is of length dividable by 4 (ie. 4, 8, 12, 16, 20, ...) you can use movsd instruction which copies 4 bytes at once. Then you must also divide size by 4:
Code: ; if we know that size is dividable by 4 push ecx edi esi mov esi, src mov edi, dest mov ecx, size / 4 rep movsd pop esi edi ecx |
|||
12 Nov 2005, 14:43 |
|
El Tangas 13 Nov 2005, 20:58
And remember to align memory variables, for example dword variables should be in addresses divisible by 4 (use the "align" keyword in fasm). This is very important for good performance.
|
|||
13 Nov 2005, 20:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.