www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/14/10:45:11

Xref: news2.mv.net comp.os.msdos.djgpp:7244
From: Peter Baxendale <peter DOT baxendale AT durham DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Macros within "as" assembler
Date: 14 Aug 1996 13:31:02 GMT
Organization: University of Durham
Lines: 39
Message-ID: <4uskem$8hs@mercury.dur.ac.uk>
References: <4us181$kg2 AT status DOT gen DOT nz>
NNTP-Posting-Host: secs180.dur.ac.uk
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

If it's assembler macro facilities you are looking for (rather than using the C
preprocessor), the gas included inbinutils-2.6 has this built in: 
(from the info file)

> `.macro'
> ========
> 
>    The commands `.macro' and `.endm' allow you to define macros that
> generate assembly output.  For example, this definition specifies a
> macro `sum' that puts a sequence of numbers into memory:
> 
>              .macro  sum from=0, to=5
>              .long   \from
>              .if     \to-\from
>              sum     "(\from+1)",\to
>              .endif
>              .endm
> 
> With that definition, `SUM 0,5' is equivalent to this assembly input:
> 
>              .long   0
>              .long   1
>              .long   2
>              .long   3
>              .long   4
>              .long   5
> 

I'm not sure if this in the version of as that comes with djgpp, to be honest
(I avoid 486 assembler). I do notice that the info for as is not the same
as above, so maybe it's not. But earlier versions of gas could be used with a GNU 
macro preprocessor called gasp. I would imagine this wouldn't be hard to port to 
the djgpp environment. I think you just used to pipe it's output into gas.

Peter Baxendale
University of Durham
School of Engineering
England

- Raw text -


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