flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution
But inside a procedure the incoming and local parameters are EBP based so using mov ebx,b means you have to override the mov opcode. It becomes very messy, but you are welcome to try if you want a challenge.
|
|||
![]() |
|
Tomasz Grysztar
It seems there's been some confusion here. The "mov eax,[a]" inside a procedure is NOT an equivalent of "mov eax,a" outside it. Actually, these things work very similarly in both cases:
Code: a dd ? mov eax,[a] Code: proc T1 locals a dd ? endl mov eax,[a] ret endp |
|||
![]() |
|
bitRAKE
Code: virtual at ebp-16 .b rd 1 end virtual struc eax [a]{ common . eax a } mov eax,[.b] add eax,[.b] ![]() |
|||
![]() |
|
baldr
booter,
Probably you're used to MASM syntax/semantics of symbolic names; here in fasm we use label to refer to the address and [label] for memory contents at that address. Procedure-local variable doesn't have compile-time address, thus you can't compile something like mov eax, a where a is a proc-local var. Use lea eax, [a] instead (if you really need the address). Quick tour on old (i.e. around 1.53) INCLUDE\MACRO\STDCALL.INC will help (and increase your macro expertise as well ![]() Tomasz Grysztar, mov eax, [a] is not equivalent to mov eax, a in any occurrence (heavy macro beside), aren't they? ![]() bitRAKE, AFAIK eax will not be treated as macro/struc name in that context, so no cookie. ![]() |
|||
![]() |
|
booter
baldr wrote: booter, Yes, that's the problem with local variables and parameters! However actually it may be a problem with assembler, which requires lea mnemonic/syntax instead of compiling Code: mov eax,ebp+N Code: lea eax,[ebp+N] Tomasz, How to recognixe register+N operand in a macro? Thanks BTW, as I understand we can't base data by ebp, I mean [ebp:N] is not legal. |
|||
![]() |
|
Tomasz Grysztar
booter wrote: Tomasz, Check out how "pushd" macro from win32ax.inc does it: Code: virtual at 0 label ..address at var mov eax,dword [..address] load ..opcode from 0 end virtual if ..opcode = 0A1h push var else lea edx,[..address] push edx end if |
|||
![]() |
|
bitRAKE
baldr wrote: AFAIK eax will not be treated as macro/struc name in that context, so no cookie. ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.