The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: MichaelW on February 10, 2008, 10:20:28 AM

Title: More GAS
Post by: MichaelW on February 10, 2008, 10:20:28 AM
I recently had a chance to play with GAS again, and even though the macro system is still very weak, this time I managed to create some reasonably compact invoke macros. I used the as and ld from Binutils 2.18.50, available  here (http://sourceforge.net/project/showfiles.php?group_id=2435), and the import libraries from a fairly recent distribution of MinGW. I assembled and linked from SciTE using these commands:

command.name.0.*.asm=Assemble
command.0.*.asm=as -v -alsm="$(FileName).lst" -o "$(FileName).o" $(FileNameExt)

command.name.1.*.asm=LinkCon
command.1.*.asm=ld "$(FileName).o" -e start -subsystem console -Lsearchdir"C:\MinGW\lib" -l kernel32 -l user32 -l gdi32 -l msvcrt -o "$(FileName).exe"

command.name.2.*.asm=LinkGui
command.2.*.asm=ld "$(FileName).o" -e start -subsystem windows -Lsearchdir"C:\MinGW\lib" -l kernel32 -l user32 -l gdi32 -l msvcrt -o "$(FileName).exe"


A recent reference is available  here (http://arcib.dowling.edu/cgi-bin/info2html?(as.info.gz)Top).

I made an effort to add quoted string support to the invoke macros, to create a frame macro to automate the stack frames, and several other things, but I could not make them work with the macro system as it currently is.

The attachment contains the macros and two test apps.

[attachment deleted by admin]
Title: Re: More GAS
Post by: drhowarddrfine on February 10, 2008, 01:19:14 PM
binutils is for AS.  If you are using GAS then macros are much better.  Macros in GAS (http://www.ibm.com/developerworks/linux/library/l-gas-nasm.html#N1026C).  Scroll down for that section.

EDIT:  Well, in fact, the '.macro' directive is available in AS, too. 
Title: Re: More GAS
Post by: MichaelW on February 10, 2008, 01:49:41 PM
as.exe is the GNU Assembler. From the page you linked:

Assembling:
GAS:
as –o program.o program.s

And on the page, the GAS: GNU Assembler link is to a page titled "Using as".
Title: Re: More GAS
Post by: drhowarddrfine on February 10, 2008, 07:45:52 PM
Yes, you're right.  I had GCC on my mind.  I've been writing some assembly but compiling it all with gcc because it's interfacing some C stuff.  Plus, I'm stupider early in the morning.