www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/14/09:02:32

Xref: news2.mv.net comp.os.msdos.djgpp:7238
From: Robert Hoehne <Robert DOT Hoehne AT Mathematik DOT tu-chemnitz DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Macros within "as" assembler
Date: Wed, 14 Aug 1996 12:36:23 +0200
Organization: TU Chemnitz-Zwickau
Lines: 35
Message-ID: <3211AC27.B86@Mathematik.tu-chemnitz.de>
References: <4us181$kg2 AT status DOT gen DOT nz>
NNTP-Posting-Host: trolli.hrz.tu-chemnitz.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Bruce Foley wrote:
> 
> #define MY_MACRO(MY_ARGUMENT)
>         movl    MY_ARGUMENT, %eax
> ....
> 

Exact. You can define macros like any other macros in C or C++. But you must
tell gcc, that your assembler file should be run at first through the 
preprocessor cpp. This can be done very easy. Instead of calling

gcc -c foo.s

compile it with

gcc -c foo.S

NOTE the upper case 'S'. Or compile it with (if you don't like the uppercase S):

gcc -c -x assembler-with-cpp foo.s

> Also, (dumb question time) what is it that actually TERMINATES a macro
> declaration?  obviously, for T/MASM, it is the "endm" statement,
> but what about for the #define above?

The ending of the line, if it not ends with a backslash.

Robert
-- 
*****************************************************************
* Robert Hoehne, Fakultaet fuer Mathematik, TU-Chemnitz-Zwickau *
* Post:    Am Berg 3, D-09573 Dittmannsdorf                     *
* e-Mail:  Robert DOT Hoehne AT Mathematik DOT TU-Chemnitz DOT DE              *
* WWW:     http://www.tu-chemnitz.de/~rho                       *
*****************************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019