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.

NameArgument typesResult typeFunction
ADR(v)anyLONGINTaddress of variable v
BIT(a, n)a: LONGINTBOOLEANbit n of Mem[a]
n: integer
CC(n)integer constantBOOLEAN condition n (0 <= n <= 15)
LSH(x, n)x: integer, CHAR, BYTEtype of x logical shift
n: integer
ROT(x, n)x: integer, CHAR, BYTEtype of x rotation
n: integer
VAL(T, x)T, x: any typeTx interpreted as of type T
Function procedures
NameArgument typesFunction
GET(a, v)a: LONGINT; v: any basic type, pointer, procedure typev := Mem[a]
PUT(a, x)a: LONGINT; x: any basic type, pointer, procedure typeMem[a] := x
GETREG(n, v)n: integer constant; v: any basic type, pointer, procedure typev := Register n
PUTREG(n, x)n: integer constant; x: any basic type, pointer, procedure typeRegister n := x
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
Proper procedures

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