flat assembler
Message board for the users of flat assembler.
Index
> Main > Proc-endp replacement |
Author |
|
revolution 12 Jul 2009, 13:13
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.
|
|||
12 Jul 2009, 13:13 |
|
Tomasz Grysztar 12 Jul 2009, 17:02
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 |
|||
12 Jul 2009, 17:02 |
|
bitRAKE 12 Jul 2009, 18:39
Code: virtual at ebp-16 .b rd 1 end virtual struc eax [a]{ common . eax a } mov eax,[.b] add eax,[.b] |
|||
12 Jul 2009, 18:39 |
|
baldr 15 Jul 2009, 22:39
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. |
|||
15 Jul 2009, 22:39 |
|
booter 16 Jul 2009, 05:40
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. |
|||
16 Jul 2009, 05:40 |
|
Tomasz Grysztar 16 Jul 2009, 08:19
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 |
|||
16 Jul 2009, 08:19 |
|
bitRAKE 16 Jul 2009, 14:48
baldr wrote: AFAIK eax will not be treated as macro/struc name in that context, so no cookie. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
16 Jul 2009, 14:48 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.