comp.lang.ada
 help / color / mirror / Atom feed
From: Dave Poirier <instinc@users.sf.net>
Subject: Device driver in Ada95
Date: Mon, 25 Feb 2002 16:20:11 -0500
Date: 2002-02-25T16:20:11-05:00	[thread overview]
Message-ID: <3C7AAA8B.6020507@users.sf.net> (raw)

I'm currently trying to write a basic device driver in Ada95.  The 
device is a simple text mode videocard under a x86 PC. I got the boot 
record going as well as a small rtk of my own which allow me to run 
simple programs that return values.

My next step is to start to write device drivers in Ada95 using this 
same setup, so as to have as useable os sooner or later.  As my first 
try, I decided to create a small vga driver for text mode.  This 
requires that I write in memory from 0xB8000 to 0xB8A9F.

Here's what I tried:
--------------------
with System.Address_to_Access_Conversions;

procedure Hello is
   type Screen is array(0 .. 999) of Character;
   type Char_Ptr is access Screen;
   package CharPtrs is new System.Address_To_Access_Conversions(Char_Ptr);
   Vga : CharPtrs.Object_Pointer;
   VgaAddress : System.Address;

begin
   VgaAddress := System.Address(16#B8000#);
   Vga := CharPtrs.To_Pointer(VgaAddress);
   Vga.all(0) := '!';
end Hello;

---------

Ofcourse that doesn't compile, it doesn't like the assignment I'm trying 
to do for VgaAddress :=...

Now, could any of you indicate how I'm supposed to do that as properly 
as possible using only Ada95?

I'm compiling with GNAT to generate a .s which I then compile with my 
own wrappers, so as long as it's valid Ada95 and that it can get to 
generating my .o it should be fine.

Thanks for any help.




             reply	other threads:[~2002-02-25 21:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-25 21:20 Dave Poirier [this message]
2002-02-25 21:47 ` Device driver in Ada95 sk
2002-02-26  0:02   ` Dave Poirier
2002-02-25 21:53 ` chris.danx
2002-02-25 22:06 ` Jerry van Dijk
2002-02-25 22:54   ` Dave Poirier
2002-02-25 23:21     ` sk
2002-02-26 10:05     ` chris.danx
  -- strict thread matches above, loose matches on Subject: below --
2002-02-26 11:09 Gautier Write-only-address
replies disabled

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