flat assembler
Message board for the users of flat assembler.

Index > Main > How to see output of assembler?

Author
Thread Post new topic Reply to topic
thetrick



Joined: 19 Feb 2020
Posts: 18
thetrick 11 Oct 2021, 17:16
Hello everyone.

I want to know how to see an assembler output as a text file? When i use PREPSRC.EXE utility it only unrolls preprocessor output but things like "if" leave in the source.

For example:
Code:
    if REG0 in <ebx, esi, edi, ebp>
       push REG0
    end if      

"if" directive leaves in the source after PREPSRC.EXE. How to unroll all this uncompiled things and see clean assembler output?

Thank in advance!
Post 11 Oct 2021, 17:16
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 11 Oct 2021, 17:45
You cannot disassebler conditional macros/directives. They don't going to be compiled itself, they decide how their wards have to be compiled.
Run some debugger and see the clean assembly output.
Post 11 Oct 2021, 17:45
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 976
Location: Russia
macomics 11 Oct 2021, 18:16
Overclick wrote:
Run some debugger
or disassembler
Overclick wrote:
and see the clean assembly output
OllyDBG, x64dbg, IDA (free)
Post 11 Oct 2021, 18:16
View user's profile Send private message Reply with quote
thetrick



Joined: 19 Feb 2020
Posts: 18
thetrick 11 Oct 2021, 19:14
Thank you for the replies, i knew how to see a disassembler/debugger output. The reason i need the output because i want to use this asm output to further compilation. So i need the labels etc except "if" and some other "interpreter" things.
Post 11 Oct 2021, 19:14
View user's profile Send private message Reply with quote
sts-q



Joined: 29 Nov 2018
Posts: 57
sts-q 11 Oct 2021, 20:43
Post 11 Oct 2021, 20:43
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 11 Oct 2021, 21:04
thetrick wrote:
Thank you for the replies, i knew how to see a disassembler/debugger output. The reason i need the output because i want to use this asm output to further compilation. So i need the labels etc except "if" and some other "interpreter" things.
The assembly-time statements are involved in the multi-pass resolving process, therefore it may not be possible to get rid of them while preserving labels, because labels by their very nature may be moving. See my article about multi-pass assembly and consider this snippet of fasm-resolvable code:
Code:
        if ~ defined target | ( target-($+2) < 128 & target-($+2) >= -128 )
                db 0EBh,target-($+1)
        else
                db 0E9h
                dw target-($+2)
        end if    
If you keep the "target" as a label that does not yet have a final known value (because it itself may depend on the length of code generated here), you cannot get rid of this IF statement, because it may go either way.

sts-q wrote:
https://www.nasm.us/xdoc/2.15.05/html/nasmdoc2.html#section-2.1.3
Embarassed
I would guess that if one is already familiar with PREPSRC tool, the same should be true for LISTING one. Wink
Post 11 Oct 2021, 21:04
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 976
Location: Russia
macomics 11 Oct 2021, 21:51
And why do you need pure assembler code when you can create .obj (COFF / MS COFF) or .o (ELF) and use a linker to insert the code generated by fasm in the form of a binary module with your program. Then it will only be necessary to transfer constant & structure declarations to make it easier to interact.
Post 11 Oct 2021, 21:51
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.