Message board for the users of flat assembler.
> Macroinstructions > Assembly Listing Macro
I wrote this macro at an attempt to generate the assembly listing at the compiling time. There is a version of fasm supporting listing in the Compiler Internals section on this forum, but I want to see if it is possible using only macros. ok, here is a screenshot of my listing macro:
|29 Aug 2006, 04:46||
Whether and there is an opportunity to write listing to a file?
|29 Aug 2006, 11:48||
yes, the simplest way is to use I/O redirection. for example:
fasm BEER_listing.asm > list.txt
|29 Aug 2006, 14:44||
Today I finished the listing generator that I have told in another post. Sorry for the long delay but I was busy and sick these days
Unfortunatelly I saw this post yesterday when I had the listing generator almost done so I didn't take chris' macroses as a base. In a future release I will check his macroses to see if I can do things better.
The way to use it is as follows:
* First, you must add "include 'listing.inc'" at the beginning of your source or at least just before you want to start the listing.
* Second, you need to activate the listing with "enable" macro
The "enable" macro allows to enable the following features
* "listing": as the name says, the listing will start at the point you invoke "enable" with this parameter
* "resolve_equates": This one ensures that instead of list the symbolic name you will see the effective value (note that it works only for equates, assembler symbols keep their names and are not resolved)
The "disable" macro allows to disable the features mentioned above.
Although this macroses are intended for "format binary" it can actually be used with another formats. This is the way to list a PE with no relocations
(listing must be enabled after format declaration)
include 'listing.inc' format PE GUI 4.0 enable listing . . .
As you can imagine these macroses wastes lots of memory and delays the compiling process much. For example in my PC FASMW takes 12 seconds and I need to set 512 MB RAM for fasm (well maybe less, I tried with 256 MB and it didn't work so I decided to double the memory size). Apart of that, seems to works well.
The known limitatios are:
* Strings are not always shown as it, this happens when the string is not alone in the operand. For example " dq 'helo-pal'" will work but "dq 'helo-pal' + 0" will be listed as "dq hello - pal + 0" giving the sensation that "hello" and "pal" are symbols instead of strings.
* "times" assembler directive is not handled at all
* Due to the lack of matchi/macroi the listing work only if you write all in lowercase
* When relocations are present it will not work due to the arithmetics required to display address that fasm forbids
* There are more but I don't remember now
PS: http://ellocodelassembler.googlepages.com/listing.html <- Some listing examples
PS2: The current limitations will be fixed in future releases (at the cost of even more memory surely...)
PS3: The listing files in the site are the *.lst* ones.
|01 Jun 2007, 18:48||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.
Website powered by rwasa.