The primary purpose of the GNU assembler is to assemble the output of other programs--notably compilers. When you have to hand-code specialized routines in assembly, that means the GNU assembler is an unfriendly processor: it has no directives for macros, conditionals, or many other con- veniences that you might expect.
In some cases you can simply use the C preprocessor, or a generalized preprocessor like M4; but this can be awkward, since none of these things are designed with assembly in mind.
gasp fills this need. It is expressly designed to provide the facilities you need with hand-coded assembly code. Implementing it as a preprocessor, rather than part of the assembler, allows the maximum flexibility: you can use it with hand-coded assembly, without paying a penalty of added complexity in the assembler you use for compiler output.
The simplest way to use GASP is to run it as a filter and assemble its output. In Unix and its ilk, you can do this, for example:
$ gasp prog.asm | as -o prog.o
Naturally, there are also a few command-line options to allow you to request variations on this basic theme. Here is the full set of possibilities for the GASP command line.
Use alternative macro syntax. *Note Alternate macro syntax: Alternate, for a discussion of how this syntax differs from the default GASP syntax.
Use CHAR as the comment character. The default comment character is `!'. For example, to use a semicolon as the comment character, specify `-c ';'' on the GASP command line. Since assembler command characters often have special significance to command shells, it is a good idea to quote or escape CHAR when you specify a comment character.
For the sake of simplicity, all examples in this manual use the default comment character `!'.
Show debugging statistics. In this version of GASP, this option produces statistics about the string buffers that GASP allocates internally. For each defined buffersize S, GASP shows the number of strings N that it allocated, with a line like this:
strings size S : N
GASP displays these statistics on the standard er- ror stream, when done preprocessing.
Display a summary of the GASP command line options.
Use MRI compatibility mode. Using this option causes GASP to accept the syntax and pseudo-ops used by the Microtec Research `ASM68K' assembler.
`-o OUTFILE' `--output OUTFILE' Write the output in a file called OUTFILE. If you do not use the `-o' option, GASP writes its output on the standard out- put stream.
Print line numbers. GASP obeys this option only if you also specify `-s' to copy source lines to its output. With `-s -p', GASP displays the line number of each source line copied (immediately af- ter the comment character at the beginning of the line).
Copy the source lines to the output file. Use this option to see the effect of each preprocessor line on the GASP output. GASP places a comment charac- ter (`!' by default) at the beginning of each source line it copies, so that you can use this op- tion and still assemble the result.
Display the GASP version number.
The input file names. You must specify at least one input file; if you specify more, GASP prepro- cesses them all, concatenating the output in the order you list the INFILE arguments.