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-06 06:14:10 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!not-for-mail Message-ID: <3F59DD79.1040103@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada and ASM References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 06 Sep 2003 13:14:10 GMT NNTP-Posting-Host: 165.247.65.186 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1062854050 165.247.65.186 (Sat, 06 Sep 2003 09:14:10 EDT) NNTP-Posting-Date: Sat, 06 Sep 2003 09:14:10 EDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:42207 Date: 2003-09-06T13:14:10+00:00 List-Id: True, it would be difficult to have some sort of "full-up" Ada syntax for assembler that was anywhere near portable across all machines. Unless you simply got to the point where you're compiling Ada anyway, so why bother? ;-) However, I recall at least one Ada compiler that essentially defined something that looked like a discriminated record for assembler instructions and your assembler routines effectively looked like a set of agregates for the discriminated record where each aggregate represented the machine instruction you wanted. That was pretty much an "Ada Syntax" of sorts. Perhaps something along those lines with some semi-standard "macro-like" capabilities would be a good thing. (For example, if there were some flavor of "if" or "loop" statements that automagically expanded out into the corresponding machine instructions, that would be helpful and about all you'd need when you are dipping into assembler.) MDC Simon Wright wrote: > > > All very well if all you wanted to do was move things about. But > machines have all sorts of features, not all of which have > counterparts on each architecture to be supported. What about reading > the high-resolution clock? (rdtsc on Pentium, mftb on PowerPC). > > function Clock return Time is > type Half is (Low, High); > Lower, Upper : Interfaces.Unsigned_32; > Results : array (Half) of Interfaces.Unsigned_32; > Result : Time; > for Result'Address use Results (Low)'Address; > begin > System.Machine_Code.Asm > ("rdtsc" & ASCII.LF & ASCII.HT & > "movl %%eax, %0"& ASCII.LF & ASCII.HT & > "movl %%edx, %1", > Outputs => (Interfaces.Unsigned_32'Asm_Output ("=g", Lower), > Interfaces.Unsigned_32'Asm_Output ("=g", Upper)), > Clobber => "eax, edx"); > Results := (Low => Lower, High => Upper); > return Result; > end Clock; > > is an Intel version, the PPC version (which I can't post) is quite > different in structure. For a start, you have to read the timestamp in > two bites! (on 32-bit implementations). > > The major reason for using asm must be precisely to accommodate these > sorts of differences. -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jast.mil/ Send Replies To: m c o n d i c @ a c m . o r g "In general the art of government consists in taking as much money as possible from one class of citizens to give to the other." -- Voltaire ======================================================================