flat assembler
Message board for the users of flat assembler.
Index
> Main > what is the name for instruction like this. |
Author |
|
vbVeryBeginner 21 Mar 2006, 06:07
recently, i saw Nikolay Petrov code on http://board.flatassembler.net/topic.php?t=4968
Code: cmp ecx,[edx+4*(eax+1)] mov ecx,[edx+4*(eax+2)] mov [edx+4*(eax+1)],ecx i didn't know we could code like this in assembly language. so i start wondering, where (any web) got information regarding something like above. maybe, mov ecx,edx*eax ;would works? so, i tried something like this Code: mov ecx,[edx+4*((ebx/10)*2)] it gets assembled, but from olly, i saw MOV ECX,DWORD PTR DS:[EDX] i search on intel pdf but didn't found examples like above, so, am wish to know like if anyone got any reference that could tell maybe like. wat reg we could use, how many reg we could use, are + - * / works? or how many level () we could use, does % works? and so on for instruction like above. thanks. |
|||
21 Mar 2006, 06:07 |
|
Tomasz Grysztar 21 Mar 2006, 07:49
The instruction sample you gave does not assemble with the latest fasm's versions, there was a bug that caused older versions to ignore register divided by some value, while it should signalize an error.
As for the allowed addressing modes, I'd recommend checking out Intel manuals. In general, with 32-bit addressing you can specify address in a form [base+index*scale+displacement], where base and index are registers, scale can be 1,2,4 or 8 and displacement (offset) can be a 32-bit number. fasm is able to do the calculations on expressions with scaled registers, so for example: Code: mov ecx,[((edx+ecx*3)+(edx+ecx*5))/2] gets reduced to Code: mov ecx,[edx+ecx*4] and thus assembles correctly. Also: Code: mov eax,[ecx*5] assembles, as it can be transformed into: Code: mov eax,[ecx+ecx*4] |
|||
21 Mar 2006, 07:49 |
|
vbVeryBeginner 21 Mar 2006, 16:07
oh yeah, i am using fasm 1.65.8
getting 1.65.17 now btw, thanks a lot!! i look at the intel manuals under the MOV section, maybe due to my ignorant, i didn't found any examples showing something like above maybe they are in another section, i check them again later. |
|||
21 Mar 2006, 16:07 |
|
Tomasz Grysztar 21 Mar 2006, 16:17
It is not related to MOV or any particular instruction, it's about the addressing modes and it affects almost any instruction. You should find detailed information on this nearer the beginnning of Intel Manuals.
|
|||
21 Mar 2006, 16:17 |
|
Reverend 21 Mar 2006, 20:35
Also I may add that there is one exception. ESP cannot be index register. So it cannot be multiplied and combination like [esp+esp] will not work.
|
|||
21 Mar 2006, 20:35 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.