Your approach to the problem is flawed. The address to which you
mapped Device'Address is a memory (RAM) address within the
virtual address space of your executable. It is not an I/O address.
The reason you got an exception, is that address 16#378# within
a program's virtual memory space is not accessible by User code.
For a technique which will work in a DOS window on Windows 9X
platforms, see http://users.ncrvnet.nl/gmvdijk/other_os.html#PORTS
However, this approach requires GNAT for DOS available at
It would be helpful to know what you are trying to do with the
parallel port -- perhaps there's a higher-level way to do what
you want to do.
P.S. Attachments to E-mail are not allowed on this list, so your
.exe was deleted, and the source code made a part of the message
----- Original Message -----
From: "Tecnosistemi BCN" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Tuesday, April 09, 2002 7:17 AM
Subject: parallel port control
> I get a exception while running the program. The
> compilations is OK.
> I attach the source and the .exe.
> I'm not sure if Ada can manage devices over the
> Windows Layer.
> Anybody can take a look to it?
> PS: Tested on Pentium, 32Mb RAM, Windows 98 SE
> compiled with GNAT 3.13p
> ------- Here starts the source -----
> --with Text_Io;
> --use Text_Io;
> with Ada.Integer_Text_Io;
> use Ada.Integer_Text_Io;
> with System;
> use System;
> procedure Prueba is
> type Flags is mod 2**24; -- 3 bytes for control,
> data , status
> F : Flags;
> type Recurso is
> Estado : Flags;
> end record;
> Device : Recurso;
> Direccion : System.Address := System'To_Address
> -- LPT1 configured as standard bidi.
> for Device'Address use Direccion;
> -- pragma Atomic (device);
> -- pragma Import (Ada, device);
> -- PROGRAM_ERROR: EXCEPTION_ACCESS_VIOLATION
> --Put (Integer (F));
> -- when others =>
> -- Put (Integer (device.Estado));
> end Prueba;
> Do You Yahoo!?
> Yahoo! Messenger
> Comunicación instantánea gratis con tu gente.