I'm using fasm to compile a dll that uses macros shipped with fasm, i would like to see what the output is after the preprocessor stage but before the binary stage. Is there any way to see this? I would like to quickly see what is being generated to see if it's Worth getting rid of the dependency on the macro.
2 Answers
Fresh IDE has a feature "Unroll macro" - compile the source, position the caret on the row with the macro invocation and press Ctrl+U or select from the drop down menu "Unroll macro". The preprocessed code will be displayed on the scratch pad window.
If you want the whole preprocessed code at once - use the converting tools located in the FASM package, in the directory tools/
- you need to compile tools/%YOUR_OS%/prepsrc.asm
.
But you should always remember, that the reverse side of having so powerful macro engine is that the complex macros are pretty hard to debug.

- 6,857
- 4
- 31
- 60
-
Thanks exactly what i needed! (I'm not developing macro but on the contrary trying to understand what one does so i can get rid of it and get back to raw asm so this sounds perfect) – Ronan Thibaudau Jul 28 '16 at 15:03
-
My own rule about the macros is that they should be used with care and only where improving the readability of the source. Also, for me is important to keep the "assembly like" view of the source, because I find it better than "HLL style". – johnfound Jul 28 '16 at 15:50
You could get it by prepsrc. You need to compile tools/%YOUR_OS%/prepsrc.asm by fasm.
fasm WIN32/PREPSRC.ASM
Next you need to get fas file. I do it by fasmw: Run -> Build symbols (for example let's call it file.fas).
Next:
prepsrc file.fas our_preprocessed_code.asm
our_preprocessed_code.asm will contain preprocessed souces.

- 707
- 7
- 26