From: dan.r.mcleran@seagate.com (Dan McLeran)
Subject: Inline ASM
Date: 18 May 2004 10:13:54 -0700
Date: 2004-05-18T10:13:54-07:00 [thread overview]
Message-ID: <19b0e504.0405180913.33db54ed@posting.google.com> (raw)
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;
next reply other threads:[~2004-05-18 17:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-18 17:13 Dan McLeran [this message]
2004-05-18 23:17 ` Inline ASM Jeff C,
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox