TERRA Datentechnik                                         13-Mar-92
A. Gorrengourt
===========================================================================

Subject: Using RS232Int, IOTRANSFER, and RTSIntPROC on PS/2 Systems
-------------------------------------------------------------------

RS232Int, IOTRANSFER, and interrupt handlers installed via RTSIntProc
do not work correctly on PS/2 systems. This is due to the different
hardware and behaviour of the PS/2 and PC/AT interrupt controllers.
The PS/2 Micro Channel architechture uses level-sensitive hardware
interrupts, while the PC and PC/AT use edge-sensitive ones. In a level-
sensitive system, the interrupt condition must be cleared (e.g. the byte
received must read from the port in case of RS232Int) BEFORE the EOI is
sent to the interrupt controller, otherwise the interrupt is repeated.
See also IBM PS/2 Tech. Ref. manual (e.g. page 9-6 in 1st edition April
87) and/or Dr. Dobbs Journal #178, July 91, page 130.

The interrupt service routines in RTSISR.ASM (used with IOTRANSFER)
and RTSISRPR.ASM (used with RTSIntPROC) send the EOI prior to
activating the interrupt handler. Depending on how exactly the
interrupt handler is programmed, this may cause infinite repetition
of the interrupt on a PS/2 system (hanging or crashing the system),
or other side effects (e.g. doubling interrupts/incoming bytes in case
of the RS232 port).

Work-arounds (ok on PC as well as PS/2):

- Use RS232Code (ok on PC as well as PS/2) instead of RS232Int.
- Install a procedure declared with attribute [INTERRUPT] as interrupt
  handler (e.g. using Devices.Save/RestoreInterruptVector as done in
  RS232Code) instead of using IOTRANSFER or RTSIntPROC. Note that this
  procedure must send EOI explicitly.
- Remove the sending of EOI from RTSISR.ASM and RTSISRPR.ASM. Instead,
  send EOI explicitly in each interrupt handler, after clearing the
  interrupt condition. Except for the explicit sending of EOI, this
  solution allows to use IOTRANSFER and RTSIntPROC as usual.
  Note: Unfortunately, this general solution is incompatible with
  existing programs (which assume EOI to be send implicitly),
  therefore, it is unlikely that it will be incorporate it into
  some future release of the Modula-2 system.

                                * * *