From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8fde36cb1870c22 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-08-20 17:42:32 PST Path: supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!feeder.via.net!newshub2.rdc1.sfba.home.com!news.home.com!news1.frmt1.sfba.home.com.POSTED!not-for-mail From: tmoran@bix.com Newsgroups: comp.lang.ada Subject: Re: Reading/writing LPT1 References: <8npkbf$bhd$1@nyheter.chalmers.se> X-Newsreader: Tom's custom newsreader Message-ID: Date: Mon, 21 Aug 2000 00:42:30 GMT NNTP-Posting-Host: 24.20.190.201 X-Complaints-To: abuse@home.net X-Trace: news1.frmt1.sfba.home.com 966818550 24.20.190.201 (Sun, 20 Aug 2000 17:42:30 PDT) NNTP-Posting-Date: Sun, 20 Aug 2000 17:42:30 PDT Organization: @Home Network Xref: supernews.google.com comp.lang.ada:232 Date: 2000-08-21T00:42:30+00:00 List-Id: >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.