[Oberon] Negative integer literals in Oberon
skulski at pas.rochester.edu
Tue Apr 28 06:50:50 CEST 2020
>It‘s a good point but a little bit a corner case. Principally,
> Oberon does not know addresses, as addresses are abstracted
> away by the type construct POINTER TO
Yes, POINTER TO needs to be used eventually. But we are facing the question
how to assign the hard coded address to the POINTER. The VRAMORG is
the case in point. This address is connected to the firmware video controller.
The value has to be used as provided below, or there will be no video.
VRAMORG does not have to be coded in hex in Oberon. The FW developer can use
0E7F00H, while the Oberon programmer can write 950016 in decimal. But it is
much easier and less error prone if both developers can use the same notation.
So we need the hex in this case because firmware developers are likely to use hex.
Another example is perhaps all these protocols like Ethernet where the documentation
will provide hex constants. Imagine the Oberon developer not being able to use these,
but rather using a Windows calculator to translate to decimal because hex notation
was removed from the language.
> Am 27.04.2020 um 22:40 schrieb Skulski, Wojciech <skulski at pas.rochester.edu>:
>> Could somebody give me a good example, where INTEGERs need a hex notation?
> How about this? These INTEGERS represent addresses. Are addresses integers? I believe they are. The memory is a collection of addresses with consecutive numbers expressed with integers. So it is a relevant example.
> (* Memory map; PO.System page 104 *)
> STACKSIZE* = 8000H; (* 32 kB. Was hardwired in Kernel.Init *)
> STACKORG* = 80000H; (* stackOrg = 524,288; half a megabyte. *)
> HEAPORG* = STACKORG; (* heapOrg = stackOrg *)
> FSoffset* = STACKORG; (* Not clear what it is *)
> MEMLIM* = 0E7EF0H; (* 1 MB minus 98,575 bytes of VRAM at the end*)
> VRAMORG* = 0E7F00H; (* start of memory-mapped display frame*)
> VRAMSIZE* = 1024*768 DIV 8; (* 1024 x 768 pixel, monocolor display frame*)
More information about the Oberon