comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: Reading/writing LPT1
Date: Mon, 21 Aug 2000 00:42:30 GMT
Date: 2000-08-21T00:42:30+00:00	[thread overview]
Message-ID: <WV_n5.121350$i5.1760862@news1.frmt1.sfba.home.com> (raw)
In-Reply-To: 8npkbf$bhd$1@nyheter.chalmers.se

>Does anyone know how to read /write from the parallellport in Ada?  I
>have a program written in Basic that modifys the some bit's on LPTx but
>I want to re-write this program to Ada.
   I presume you are running under DOS or perhaps Windows xx or OS/2 or
Linux on an Intel box?  So we will assume your hardware is the standard
sort of LPT port for such a box, and your OS allows you direct IO
operations to the port, as opposed to, say, a machine running the flight
controls on a jet.  Since IO is so widely varied across different
systems, it's not included in the Ada standard.  Your compiler vendor,
however, almost surely supplies a library that will do hardware level IO
on your target platform.  If that's not the case, then you can a) link
in appropriate subroutines written in asm or C or perhaps even Basic and
call them from your Ada program, or b) use your compiler's
implementation of standard package System.Machine_Code.  For handling
the bits in, eg, the status result, either use a record representation
clause to give names to individual bits or bit fields, or (more error
prone) use type "mod 256" and do "and"s and "or"s.



  reply	other threads:[~2000-08-21  0:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-20  0:00 Reading/writing LPT1 David Boman
2000-08-21  0:42 ` tmoran [this message]
2000-08-21  0:00   ` David Boman
2000-08-21  0:00     ` Ted Dennison
replies disabled

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