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,c6f7518956a9a842,start X-Google-Attributes: gid103376,public Path: controlnews3.google.com!postnews1.google.com!not-for-mail From: dan.r.mcleran@seagate.com (Dan McLeran) Newsgroups: comp.lang.ada Subject: Inline ASM Date: 18 May 2004 10:13:54 -0700 Organization: http://groups.google.com Message-ID: <19b0e504.0405180913.33db54ed@posting.google.com> NNTP-Posting-Host: 192.55.20.36 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1084900435 12135 127.0.0.1 (18 May 2004 17:13:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 18 May 2004 17:13:55 +0000 (UTC) Xref: controlnews3.google.com comp.lang.ada:670 Date: 2004-05-18T10:13:54-07:00 List-Id: First of all, let me say that I am using Gnat 3.15p. Now the problem. I have a piece of C code that outports 16-bit values to an ISA-bus card. It seemed that I should be able to do this from within Ada, using the Asm capabilities. I have been able to embed other Asm instructions with success but this one is frustrating me. I keep getting this error message: "Error: suffix or operands invalid for 'out'" Although, when I use the -S compiler option, it generates the asm code without error and it appears to be correct. I have checked the asm output of my C-code and it looks like this: out dx, ax So, I figured the following Ada code should work. Does anyone see a problem here? with Ada.Text_IO; with System.Machine_Code; with Interfaces; procedure Main is use Ada.Text_IO; procedure Outport(Address,Value : in Interfaces.Unsigned_16) is use System.Machine_Code; use Interfaces; use ASCII; begin Asm("out %%dx, %%ax" & LF & HT, Inputs => (Unsigned_16'Asm_Input("d",Address),Unsigned_16'Asm_Input("a",Value))); end Outport; Address : Interfaces.Unsigned_16 := 16#110#; Value : Interfaces.Unsigned_16 := 16#F#; begin Put(Item => "** Using inline Asm **"); New_Line; Put(Item => "Address = " & Interfaces.Unsigned_16'Image(Address)); New_Line; Put(Item => "Value = " & Interfaces.Unsigned_16'Image(Value)); New_Line; Outport(Address => Address, Value => Value); end Main;