gasp.info: Overview
Go forward to Invoking GASP
Go backward to Top
Go up to Top
Go to the top op gasp
What is GASP?
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 conveniences 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.
Here is a small example to give the flavor of GASP. This input to
GASP
.MACRO saveregs from=8 to=14
count .ASSIGNA \from
! save r\from..r\to
.AWHILE \&count LE \to
mov r\&count,@-sp
count .ASSIGNA \&count + 1
.AENDW
.ENDM
saveregs from=12
bar: mov #H'dead+10,r0
foo .SDATAC "hello"<10>
.END
generates this assembly program:
! save r12..r14
mov r12,@-sp
mov r13,@-sp
mov r14,@-sp
bar: mov #57005+10,r0
foo: .byte 6,104,101,108,108,111,10
Created Wed Sep 1 16:42:11 2004 on bee with info_to_html version 0.9.6.