Super Prev Next

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.


Super Prev Next

Function procedures

Name Argument types Result type Function
ADR(v) any LONGINT address of variable v
BIT(a,n) a: LONGINT n: integer BOOLEAN bit n of Mem[a]
CC(n) integer constant BOOLEAN condition n (0<=n<=15)
LSH(x,n) x: integer, CHAR, BYTE; n: integer type of x logical shift
ROT(x,n) x: integer, CHAR, BYTE; n: integer type of x rotation
VAL(T,x) T, x: any type T x interpreted as of type T


Super Prev

Proper procedures

Name Argument types Function
GET(a,v) a: LONGINT; v: any basic type, pointer, procedure type v := Mem[a]
PUT(a,x) a: LONGINT; x: any basic type, pointer, procedure type Mem[a] :=x
GETREG(n,v) n: integer constant; v: any basic type, pointer, procedure type v := Register n
PUTREG(n,x) n: integer constant; x: any basic type, pointer, procedure type Register 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