flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Assembly Listing Macro

Author
Thread Post new topic Reply to topic
chris



Joined: 05 Jan 2006
Posts: 62
Location: China->US->China->?
chris
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:


Description:
Filesize: 21.74 KB
Viewed: 1025 Time(s)

list.PNG


Description:
Download
Filename: assembly_listing.zip
Filesize: 2.12 KB
Downloaded: 154 Time(s)

Post 29 Aug 2006, 04:46
View user's profile Send private message Reply with quote
Garthower



Joined: 21 Apr 2006
Posts: 158
Location: Ukraine
Garthower
Whether and there is an opportunity to write listing to a file?
Post 29 Aug 2006, 11:48
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
chris



Joined: 05 Jan 2006
Posts: 62
Location: China->US->China->?
chris
yes, the simplest way is to use I/O redirection. for example:

fasm BEER_listing.asm > list.txt
Post 29 Aug 2006, 14:44
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
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 Sad

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

Code:
include 'listing.inc'
format PE GUI 4.0
enable listing

.
.
.
    
(listing must be enabled after format declaration)

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 Razz

Enjoy!

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.


Description:
Download
Filename: listing.inc
Filesize: 15.15 KB
Downloaded: 134 Time(s)

Post 01 Jun 2007, 18:48
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-2020, Tomasz Grysztar.

Powered by rwasa.