comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: updating a hardware cursor with assembly and ada
Date: Thu, 6 Mar 2008 13:31:27 -0800 (PST)
Date: 2008-03-06T13:31:27-08:00	[thread overview]
Message-ID: <98f7b81c-a874-466e-8d60-ab2c4e59bb0a@h11g2000prf.googlegroups.com> (raw)
In-Reply-To: b3eb9519-e99d-4de0-8ca6-f7dfbda0a441@e31g2000hse.googlegroups.com

On Mar 6, 9:51 am, cl1 <charles.w.lamb...@gmail.com> wrote:
> On Mar 6, 11:26 am, Georg Bauhaus <rm.tsoh-plus.nicif-
>
> bauh...@maps.futureapps.de> wrote:
> > cl1 schrieb:
>
> > > unsigned char outportb (unsigned short _port, unsigned char _data)
> > > {
> > >  __asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data));
> > > }
> > > ---------------------------------------------------------------------------­--
> > >   procedure Update_Cursor (Console : Video_Console) is
> > >      procedure OutportB (Port : Natural; Data : Natural);
>
> > Does type Natural match C type unsigned short on your system?
>
> If it didn't, what problem would this pose?

Assuming Natural is 32 bits (I don't really know): If the code
generated for your Ada program thinks it's passing two 32-bit integers
as parameters, but the runtime code is expecting a 16-bit integer and
an 8-bit integer as parameters, the runtime code may not use correct
values for the parameters.


> > (Just a guess.) Maybe Interfaces.Unsigned_N is better choice.
>
> I have no runtime (this is os development code). I don't know if i can
> use the Interfaces packages in gnat with out it. I tried to implement
> Unsigned_16 with out the operations and the compiler complained about
> not having primitive operations defined on the part where i was doing
> Data : Unsigned_16 := Console.Column * 80 + Console.Row; even when
> Column and Row were of type Unsigned_16;

The operations "*" and "+" aren't automatically available, unless you
do something to make them visible.  Try "use type
Interfaces.Unsigned_16;".

                               -- Adam



  reply	other threads:[~2008-03-06 21:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-06 17:07 updating a hardware cursor with assembly and ada cl1
2008-03-06 17:26 ` Georg Bauhaus
2008-03-06 17:51   ` cl1
2008-03-06 21:31     ` Adam Beneschan [this message]
2008-03-06 19:39 ` Jeffrey R. Carter
2008-03-06 20:08 ` Gautier
2008-03-06 20:14 ` Gautier
2008-03-06 22:54   ` Ludovic Brenta
2008-03-07 15:26 ` cl1
2008-03-07 19:01 ` cl1
2008-03-07 20:16   ` Ludovic Brenta
replies disabled

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