From: |
Unknown |
We could always introduce compiler switches to enable ISO M2
characteristics if desired? Pragmatically it might be easier to
introduce the -pim3 -pim4 switches before -ISO :-)
hope this helps,
Thanks Gaius
The interface for GNU Modula-2 to assembly language is almost identical to GNU
C.
The only alterations are that the keywords asm and volatile are in capitals,
following the Modula-2 convention.
A simple, but highly non optimal, example is given below. Here we want to add
the
two @code{CARDINAL}s @code{foo} and @code{bar} together and return the result.
@example
PROCEDURE Example (foo, bar: CARDINAL) : CARDINAL ;
VAR
myout: CARDINAL ;
BEGIN
ASM VOLATILE ("movl %1,%%eax; addl %2,%%eax; movl %%eax,%0"
: "=g" (myout) (* outputs *)
: "g" (foo), "g" (bar) (* inputs *)
: "eax") ; (* we trash *)
RETURN( myout )
END Example ;
@end example
For a full description of this interface we refer the reader to the GNU C
manual.
[Prev in Thread] |
Current Thread |
[Next in Thread] |