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=2.6 required=5.0 tests=BAYES_20,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!csd4.milw.wisc.edu!leah!rpi!crdgw1!sunroof!hammondr From: hammondr@sunroof.crd.ge.com (richard a hammond) Newsgroups: comp.lang.ada Subject: Re: Memory Access Question Message-ID: <1372@crdgw1.crd.ge.com> Date: 27 Jul 89 13:06:42 GMT References: <18800002@ucf-cs.ucf.edu> Sender: news@crdgw1.crd.ge.com Reply-To: hammondr@sunroof.crd.ge.com (richard a hammond) Organization: General Electric Corp. R&D, Schenectady, NY List-Id: In article <18800002@ucf-cs.ucf.edu> tony@ucf-cs.ucf.edu writes: > >Does anyone have a code fragment that demonstrates how to access memory? >I am looking for a program that tests memory. Instruction and data space >are seperate on my machine and I am trying to test RAM from 0 to n. I have >looked at the "access" data type and can't figure out how to initialize it >to 0 let alone increment the pointer by 1. The representation >specification doesn't seem to provide the answer either. Any and all help >is greatly appreciated. >Tony Becker Phone: 407-356-9334 >University of Central Florida csnet: tony@ucf-cs.ucf.edu >Orlando, FL 32816 uucp: {ihnp4!decvax,peora}!ucf-cs!tony Argh!!! No matter what you come up with in Ada, I can't believe that it would be portable across all machines - so why try to write it in Ada? Why not make it explicit to the next person porting the code that this code is going to break all the access controls and possibly muck up all memory (or do you just want to see if you can read it?) and write it in assembler? Besides, the several lines of assembly required to do this are as readable for most competent programmers as the dozens of lines of Ada. If you're doing a lot of other work, just write a trivial assembly language routine that takes two unsigned integers and stuffs the second argument's lower n (n = 8, 16, 32, 64, ...) bits into the physical/logical address implied by treating the first argument as an address. And another assembly routine to read the contents. Ada was designed to write portable, safe software. Reading/writing all locations in memory is possibly portable, but certainly not safe. Use the tool suited to the job, assembly language. Rich Hammond