From very old memory, I think that Modula-2 had a construct to allow reading and writing from absolute memory addresses.  I don't know if a Wirth compiler had this, or if it was from someone else.

Something similar to
 
VAR  memmap [ 100B ] : ARRAY 3 OF INTEGER;




On Sat, Jul 30, 2016 at 1:06 AM, Skulski, Wojciech <skulski@pas.rochester.edu> wrote:
Chris:

> But Oberon variables are not mapped to registers that can be changed "from
> the other end". The explicit operations SYSTEM.GET and SYSTEM.PUT are used
> when you want to transfer data between a peripheral register (mapped to an
> absolute memory location) and Oberon variables.

 Pardon my C on this mailing list. The point I want to make is that it is ugly.

Here is a sample of my C program where I am reading from an absolute memory location mapped to an FPGA register. The "target" is an integer, which is then used to retrieve a value from the FPGA. The address is not constant, but I can make it constant using a #define.

 long target; /* long int holds addr, needs a typecast */
 short value;
 short *virt_saddr;     /* typed pointer to 16-bit short */

 virt_saddr = (short *) target; /* convert target to pointer */
 value = * virt_saddr;            /* read value from address   */

I would prefer to write in C something like the following:

 short value at address; /* address is constant, which is most often the case*/

In Oberon it would be something like this:

 CONST address = ....;
  VAR value: INTEGER AT address; (* address must be constant*)

Now the question, is this unreasonable?

Wojtek
--
Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon



--
(email is my preferred communication media)
Aubrey McIntosh, Ph.D.
1502 Devon Circle
Austin TX 78723-1814
(512)-348-7401