flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Specific FASM compatibility with MSVC generated assembly Goto page 1, 2 Next |
Author |
|
vid 17 Apr 2008, 11:53
I don't think this is possible. what do you need it for?
|
|||
17 Apr 2008, 11:53 |
|
alorent 17 Apr 2008, 12:02
I usually convert some C code to assembly to include it in ASM source files and modify the ASM output.
So, it would be great if a macro can do the job instead of going line by line to replace it to FASM syntax. Thanks, |
|||
17 Apr 2008, 12:02 |
|
revolution 17 Apr 2008, 13:02
You need to catch all cases of memory instructions, mov/add/sub/etc.
I think I can be done, but for big files you might run out of memory. Code: macro mov dest,source { match =DWORD =PTR offset[reg],source \{ ... ;just a framework idea, you can finish it off \} } |
|||
17 Apr 2008, 13:02 |
|
vid 17 Apr 2008, 13:09
can't you get NASM output? that is pretty close to FASM.
Otherwise, I suggest rewriting. MASM syntax is context-dependent bitch. For example "mov eax, something", this can be both memory access, or moving immediate value to eax, depending on how "something" is defined. Things like this can't be solved with some search-replace or macro trickery. |
|||
17 Apr 2008, 13:09 |
|
alorent 17 Apr 2008, 13:15
Quote:
Thanks a lot!! I don't have much knowledge of those advance macro definiton (only basic macros definition ) I will be delight if you can continue the macro just for one case, so, I can continue it off. I'm a bit stuck (damn!) Quote:
Nothing, MSVC only outputs MASM compatible code. Rewriting is quite painful. I already rewrite the output code, but there are so many "contants[esp]" access that it's a total nightmare to change them all. And we have a computer in front of us with the power of FASM macros to do painful works, right? Thanks!!! |
|||
17 Apr 2008, 13:15 |
|
revolution 17 Apr 2008, 13:15
vid wrote: ... "mov eax, something", this can be both memory access, or moving immediate value to eax, depending on how "something" is defined. ... |
|||
17 Apr 2008, 13:15 |
|
revolution 17 Apr 2008, 13:17
vid wrote: Things like this can't be solved with some search-replace or macro trickery. |
|||
17 Apr 2008, 13:17 |
|
vid 17 Apr 2008, 13:33
Just trying to solve it is quite bad idea, for any purpose except macro practice
MASM has such shitload of features that macro solution is not realistic |
|||
17 Apr 2008, 13:33 |
|
revolution 17 Apr 2008, 13:37
vid wrote: MASM has such shitload of features that macro solution is not realistic |
|||
17 Apr 2008, 13:37 |
|
alorent 17 Apr 2008, 14:41
Thanks guys for the information.
I know it's quite of shitty stuff, but it's also good for macro practise as "vid" says But cannot FASM do like a replace for: constant_name$[esp is replaced by: [esp + constant_name$ I think that's the only thing that need to be done, right? Thanks! |
|||
17 Apr 2008, 14:41 |
|
vid 17 Apr 2008, 14:53
it can't
|
|||
17 Apr 2008, 14:53 |
|
revolution 17 Apr 2008, 15:12
alorent wrote: Thanks guys for the information. |
|||
17 Apr 2008, 15:12 |
|
alorent 17 Apr 2008, 15:36
Thanks revolution!!! I was starting of thinking the idea of coding a tool to manually search and replace...
I'm a bit stuck with the match command. Once I match the string, how can I use part of the matched string? So, I match: Myvar$[esp now, how can I just get "Myvar$" to be able to construct: [esp + Myvar$ If you can just give me any similar example, I will be delighted! Thanks tons! |
|||
17 Apr 2008, 15:36 |
|
revolution 17 Apr 2008, 15:39
Code: macro mov dest,source { match x[reg],source\{ mov dest,[reg+x] \} ... ;handle other cases not matched above .... } |
|||
17 Apr 2008, 15:39 |
|
alorent 17 Apr 2008, 15:45
Thanks a lot revolution! You are my hero!
Is there any way to create just a single case that matches all instructions? I mean, there are also: push var1$[esp] dec var2$[esp] add eax, var3$[esp] etc... Making cases for all types of instructions would be a nightmare, don't you think? Thanks a lot for your fast help! |
|||
17 Apr 2008, 15:45 |
|
revolution 17 Apr 2008, 15:47
Code: irp instr,mov,sub,add,xor { macro instr dest,source \{ match x[reg],source\\{ instr dest,[reg+x] \\} ... ;handle other cases not matched above .... \} } |
|||
17 Apr 2008, 15:47 |
|
alorent 17 Apr 2008, 15:55
Thanks revolution! I'm going to try that out and see how it goes!
THANKS!!!!!!!! |
|||
17 Apr 2008, 15:55 |
|
AlexP 17 Apr 2008, 16:40
Quote: Thanks a lot revolution! You are my hero! Quote: Thanks revolution!...THANKS!!!!!!!! Alorent: Quote: I love you Revolution! |
|||
17 Apr 2008, 16:40 |
|
revolution 17 Apr 2008, 16:48
Oh er, I am humbled by that. Remember that my handle is all lower case. It is not a proper name you know, just a handle with no meaning.
|
|||
17 Apr 2008, 16:48 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.