gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



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.




reply via email to

From: Unknown
[Prev in Thread] Current Thread [Next in Thread]