flat assembler
Message board for the users of flat assembler.
Index
> Main > mov [xxx+xxx*x], 0 |
Author |
|
typedef 27 Sep 2011, 23:58
Teehee wrote:
You mean the X's ? |
|||
27 Sep 2011, 23:58 |
|
typedef 28 Sep 2011, 00:01
Teehee wrote:
Code: lea eax,[xxx+yyy*Z] mov [data_type_whose_size_is_Z] [xxx+yyy*Z], 0 |
|||
28 Sep 2011, 00:01 |
|
bitshifter 28 Sep 2011, 00:03
I think maybe he wants to learn the LEA multiplier tricks?
|
|||
28 Sep 2011, 00:03 |
|
Fred 28 Sep 2011, 11:39
[reg + reg * (1,2,4,8) + const]
I think. |
|||
28 Sep 2011, 11:39 |
|
Teehee 28 Sep 2011, 12:25
bitshifter wrote: I think maybe he wants to learn the LEA multiplier tricks? no no!! i just wanna know why i cannot use others patterns than XXX+YYY*Z. And why i cant find that in the intel manuals Fred wrote: [reg + reg * (1,2,4,8 ) + const] hmmm it seems to accept that const too! so its XXX+YYY*Z+C !! _________________ Sorry if bad english. |
|||
28 Sep 2011, 12:25 |
|
bitRAKE 28 Sep 2011, 13:15
The instruction encoding has limited variability - this is outlined in the manual. Three bits for X and Y, two bits for Z, and an extension dword for C.
|
|||
28 Sep 2011, 13:15 |
|
Madis731 28 Sep 2011, 17:47
The "LEA-trick" mentioned means you can use LEA to multiply with small constants easily
where REG1=REG2=REG3 and C=0 in LEA REG1,[REG2*{0|1}+REG3*{1|2|4|8}+C] For example: lea eax,[eax*{0|1}+eax*{1|2|4|8}] combining you can replace MUL (which is sometimes more expensive) with LEA in a few cases: mul eax,{0,1,2,3,4,5,8,9} You can see that it is impossible to encode 6 or 7 with this trick, but there are two ways to encode 1 and 2. It is not very efficient to use LEA to multiply by 0,1,2,4 or 8 (ADD and SHL are better) so you are left with 3,5 and 9. FASM allows this simple markup: Code: lea eax,[eax*3] lea eax,[eax*5] lea eax,[eax*9] |
|||
28 Sep 2011, 17:47 |
|
typedef 28 Sep 2011, 21:02
^^Good for obfuscation
|
|||
28 Sep 2011, 21:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.