Appendix C: The module SYSTEM

The module SYSTEM contains certain types and procedures that are necessary to implement low-level operations particular to a given computer and/or implementation. These include for example facilities for accessing devices that are controlled by the computer, and facilities to break the type compatibility rules otherwise imposed by the language definition. It is strongly recommended to restrict their use to specific modules (called low-level modules). Such modules are inherently non-portable, but easily recognized due to the identifier SYSTEM appearing in their import list. The following specifications hold for the implementation of Oberon-2 on the Ceres computer.

Module SYSTEM exports a type BYTE with the following characteristics: Variables of type CHAR or SHORTINT can be assigned to variables of type BYTE. If a formal variable parameter is of type ARRAY OF BYTE then the corresponding actual parameter may be of any type.

Another type exported by module SYSTEM is the type PTR. Variables of any pointer type may be assigned to variables of type PTR. If a formal variable parameter is of type PTR, the actual parameter may be of any pointer type.

The procedures contained in module SYSTEM are listed in the following tables. Most of them correspond to single instructions compiled as in-line code. For details, the reader is referred to the processor manual. v stands for a variable, x, y, a, and n for expressions, and T for a type.

Function procedures
Name         Argument types            Result type    Function
ADR(v)       any                       LONGINT        address of variable v
BIT(a, n)    a: LONGINT                BOOLEAN        bit n of Mem[a]
             n: integer
CC(n)        integer constant          BOOLEAN        condition n
(0 <= n <= 15)
LSH(x, n) x: integer, CHAR, BYTE type of x logical shift
n: integer ROT(x, n) x: integer, CHAR, BYTE type of x rotation
n: integer VAL(T, x) T, x: any type T x interpreted as of type T
Proper procedures
Name             Argument types                    Function
GET(a, v)        a: LONGINT; v: any basic type,    v := Mem[a]
                 pointer, procedure type
PUT(a, x)        a: LONGINT; x: any basic type,    Mem[a] := x
                 pointer, procedure type
GETREG(n, v)     n: integer constant;              v := Register n
v: any basic type, pointer,
procedure type
PUTREG(n, x) n: integer constant; Register n := x
x: any basic type, pointer,
procedure type
MOVE(a0,a1,n) a0, a1: LONGINT; n: integer Mem[a1..a1+n-1] := Mem[a0.. a0+n-1])
NEW(v, n) v: any pointer; n: integer allocate storage block
of n bytes; assign its
address to v

Previous Section, Next Section, Contents
Adapted to HTML by Jürgen Geßwein; 12. Juni 1995