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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3cfb384718eb4f7a X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Re: question re Ada equivalent of C function Date: 1998/02/22 Message-ID: <01bd3f16$5006df60$LocalHost@xhv46.dial.pipex.com>#1/1 X-Deja-AN: 327393381 Content-Transfer-Encoding: 7bit References: <34EEFF9C.1D01FA5D@stellar1.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Organization: UUNet UK server (post doesn't reflect views of UUNet UK) Newsgroups: comp.lang.ada Date: 1998-02-22T00:00:00+00:00 List-Id: In addition, if your Ada compiler supports machine code insertions, you should be able to use these to provide the input/output functions you require. Consult your compiler's documentation. Note, however, that many processors these days enable normal (user application) programs to be prevented from executing 'privileged' instructions. With such a processor, the operating system may well decide to stop your program from executing input/output instructions: in this case, you will have to investigate your operating system's and/or compiler's provisions for writing device drivers. Also, of course, even if your program can't be stopped from executing input/output instructions, executing them in the wrong circumstances could interact badly with the operating system (or other software), unless you're running on a 'bare' machine. == Nick Roberts ================================================ == Croydon, UK =========================== == ================ == Proprietor, ThoughtWing Software ========== == Independent Software Development Consultant ====== == Nick.Roberts@dial.pipex.com ==== == Voicemail & Fax +44 181-405 1124 === == == == I live not in myself, but I become == === Portion of that around me; and to me == ==== High mountains are a feeling, but the hum == ======= Of human cities torture. =========== -- Byron [Childe Harold] Brian Rogoff wrote in article ... > On Sat, 21 Feb 1998, David Fisher wrote: > > Sorry if this is a bit basic, but learning Ada on one's own can be, er, > > challenging. > > You're never alone on comp.lang.ada! :-) > > > What are the Ada equivalents of the C functions, inp and outp, used to > > read a byte from or send one to a memory address? > > Well, that depends. If you just want to reuse some C routines, I'd suggest > that you use Interfaces.C and just reuse them. Otherwise, you'll want to > look at the System and System.Storage_Elements packages for what you want. > If you want to access a Character at some memory address, say > 16#CAFEBABE#, you'd do something like this (boilerplate omitted) > > ... > Mem_Addr : constant Address := To_Address(16#CAFEBABE#); > Mem_Mapped_Char : Character; > for Mem_Mapped_Char'Address use Mem_Addr; > ... > > which is surprisingly self-explanatory.