Introduction

This text reports the differences between the PC Native Oberon Compiler and the Oberon language report.

Document Log

13.11.00
SYSTEM.GETTYPE
20.08.00
SYSTEM.GET8, SYSTEM.GET16, SYSTEM.GET32, SYSTEM.PUT8, SYSTEM.PUT16, SYSTEM.PUT32

Changes in language semantics

TRUE / FALSE

TRUE and FALSE have been promoted to language keywords, to avoid redefining them, which could compromize the consistence of the language. The following code piece shows the inconsistence:

  PROCEDURE P;
  CONST   TRUE = FALSE;
  VAR b, c: BOOLEAN;
  BEGIN
    b := FALSE;
    c := FALSE = TRUE;
  END P;

In procedure P, b is set FALSE, while c is set to TRUE. This is an inconsistency, because a boolean value x must hold the same value as testing the same value x against TRUE.

Built-In Functions

HALT

HALT(MAX(INTEGER)) generates a trap with stack dump and then returns to the code that caused the trap.

Module SYSTEM

Types

PTR vs. SYSTEM.PTR

In PC Native Oberon the built-in types PTR and SYSTEM.PTR are equivalent.

Constants

SYSTEM.EAX ....

For the use with SYSTEM.GETREG and SYSTEM.PUTREG we have defined in module SYSTEM the following constants: If these constants are used, the compiler will check that the parameter size matches the register size.

Procedures

SYSTEM.HALT

SYSTEM.HALT(n), where n is any LONGINT number. This call generates a Trap with exception number n. This allows to generate traps with numbers usually reserved to the kernel; it is to be used for the implementation of low-level drivers.

SYSTEM.PORTIN /SYSTEM.PORTOUT

The procedures

  PROCEDURE PORTOUT(port: LONGINT; value: AnyType);
  PROCEDURE PORTIN(port: LONGINT; VAR value: AnyType);

access the I/O ports of the processor. They correspond to the IN and OUT assembler commands. The port must be a number between 0 and 65535.

SYSTEM.STI / SYSTEM.CLI

The function SYSTEM.STI() sets the interrupt flag; SYSTEM.CLI() clears the interrupt flag. These procedures are implemented as the assembler commands STI and CLI.

SYSTEM.GETREG / SYSTEM.PUTREG

The procedures

  PROCEDURE PUTREG(reg: LONGINT; value: AnyType);
  PROCEDURE GETREG(reg: LONGINT; VAR value: AnyType);

allow accessing the CPU registers. For this purpose some constants with the register names have been defined (SYSTEM.EAX, ...).

SYSTEM.PUT8, SYSTEM.PUT16, SYSTEM.PUT32

The SYSTEM.PUTx procedures are similar to the SYSTEM.PUT.

Examples:
  SYSTEM.PUT8(addr, 20X);
  SYSTEM.PUT32(addr, -1);	(*writes 0FFFFFFFFH *)
  SYSTEM.PUT16(addr, {4..18});	(*writes 0FFF0H *)

SYSTEM.GET8, SYSTEM.GET16, SYSTEM.GET32

The SYSTEM.GETx procedures read a value of given size from the memory and return the integer type of the same size.

  PROCEDURE SYSTEM.GET8(addr: LONGINT): SHORTINT;
  PROCEDURE SYSTEM.GET16(addr: LONGINT): INTEGER;
  PROCEDURE SYSTEM.GET32(addr: LONGINT): LONGINT;

SYSTEM.GETYPE

  PROCEDURE GETTYPE(POINTER TO RECORD): PTR;
  PROCEUDRE GETTYPE(RECORD): PTR;
The SYSTEM.GETTYPE procedure returns a pointer to the type description of the given structure.



reali@inf.ethz.ch