comp.lang.ada
 help / color / mirror / Atom feed
From: David Marceau <davidmarceau@sympatico.ca>
Subject: Re: Ada and ASM
Date: Sat, 06 Sep 2003 02:11:08 -0400
Date: 2003-09-06T02:11:08-04:00	[thread overview]
Message-ID: <3F597A7C.60BF3B98@sympatico.ca> (raw)
In-Reply-To: m2y8x2sypp.fsf@jvdsys.demon.nl

Jerry van Dijk wrote:
> 
> Simon Wright <simon@pushface.org> writes:
> 
> > > Volatile%20Parameter
> > > Asm ("movl %0, %%ebx" & LF & HT &
> > >           "movl %%ebx, %1",
> > >           Inputs   => Unsigned_32'Asm_Input  ("g", Var_In),
> > >           Outputs  => Unsigned_32'Asm_Output ("=g", Var_Out),
> > >           Clobber  => "ebx",
> > >           Volatile => True);
> > > The actual Asm statement still is a quoted string. It is not Ada syntax.
> >
> > I do not understand how it could possibly "[be] Ada syntax".
> >
> > OP wanted to include an asm *routine*, I think, so perhaps what is
> > wanted instead is a pragma Import (Asm, ...)? (if suoported).
> 
> No, you can include a ASM routine very easily this way (although, yes, one
> does need to actually read the documentation first :-).
> 
> Note that this has three big advantages over a separately assembled function:
> 1) no need to use non Ada tools
> 2) easy access to other Ada objects
> 3) optimizer can help
> 
> --
> --  Jerry van Dijk, Leiden, Holland
> --  Note that email address is invalid
1)I think Mr. van Dijk's inline assembler in ada tutorial(on adapower
and part of ACT/GNAT docs) is the most straightforward and most fluid. 
Lots of gnu.org site borrows from your doc but IMHO the flow changed and
to get a better picture I do suggest to look at both the adapower
version and also the gnu.org version of the documentation.  

2)Check out http://studwww.rug.ac.be/~fcorneli/eduos
The link doesn't seem to be working at the moment but the document is
called:
"Making plain binary  
files using a C compiler (i386+) Cornelis Frank
<Frank.Cornelis@rug.ac.be> April 27, 2001
"
The actual doc explains much about generating assembler files from C
files and the helper tools around all this.
It also mentions a bit about nasm for those who were looking for it.  It
is an excellent supplemental to the ada inline assembler docs.

3)Last but not least, Mr. Simon Knipe <sknipe@ktc.com> has made a
wonderful tutorial to make an Ada OS:
http://www.ktc.com/~sknipe/EOSA.html
I suggest examining its sources showing the usage of nasm and Ada
bridging them together using "pragma import" to make an OS.
There are a lot of cool tidbits in here that could equally apply to
in-line ada assembler.
One of the people on this thread was looking for pragma import stuff
using nasm well here it is :)

4)A bit off topic but still related because it does talk about getting
closer to metal.(spec'ing to cpu/dsp/controller chips)
It is also a great place demonstrating ada's strong concurrency
mechanisms with sources.
http://cs.anu.edu.au/student/comp4710/Lectures/RTES.book.e.pdf
http://cs.anu.edu.au/student/comp4710/Level-0/Sources.html

I hope this helps :)

Cheers,
David Marceau



  reply	other threads:[~2003-09-06  6:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E19vIlZ-0002mO-Fg@punt-3.mail.demon.net>
2003-09-05 19:09 ` Ada and ASM Simon Wright
2003-09-05 21:38   ` Jerry van Dijk
2003-09-06  6:11     ` David Marceau [this message]
2003-09-07  7:18       ` sk
     [not found] <E19vQkV-0006EH-Ek@punt-3.mail.demon.net>
2003-09-06  7:25 ` Simon Wright
2003-09-06 13:14   ` Marin David Condic
2003-09-06 15:25   ` Wes Groleau
     [not found] <200309051909.h85J9Flb002351@smaug.pushface.org>
2003-09-06  0:15 ` Robert C. Leif
2003-09-04  7:47 luiX_
2003-09-04 11:43 ` David C. Hoos, Sr.
2003-09-04 15:07   ` Martin Krischik
2003-09-06  0:22   ` Freejack
2003-09-06  2:18     ` Jerry van Dijk
2003-09-06 12:59       ` Jeffrey Creem
2003-09-06 15:33         ` Wes Groleau
2003-09-06 17:11           ` Jerry van Dijk
2003-09-07  4:02             ` Wes Groleau
2003-09-06 17:16         ` Jerry van Dijk
2003-09-04 14:47 ` Martin Krischik
2003-09-04 15:08 ` Martin Krischik
2003-09-04 19:31 ` Leif Holmgren
2003-09-05  2:42   ` Robert C. Leif
2003-09-05 21:32   ` Jerry van Dijk
2003-09-23 10:45   ` Jacob Sparre Andersen
2003-09-05  5:46 ` Simon Wright
2003-09-05 15:44   ` Robert C. Leif
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox