From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,edb329885d962c1d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-05 23:33:44 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news.uunet.ca!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Message-ID: <3F597A7C.60BF3B98@sympatico.ca> From: David Marceau X-Mailer: Mozilla 4.79 [en] (X11; U; Linux 2.4.17-10mdksmp i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada and ASM References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 06 Sep 2003 02:11:08 -0400 NNTP-Posting-Host: 65.92.161.185 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1062829115 65.92.161.185 (Sat, 06 Sep 2003 02:18:35 EDT) NNTP-Posting-Date: Sat, 06 Sep 2003 02:18:35 EDT Organization: Bell Sympatico Xref: archiver1.google.com comp.lang.ada:42202 Date: 2003-09-06T02:11:08-04:00 List-Id: Jerry van Dijk wrote: > > Simon Wright 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 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 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