The modules ConsoleX simple text output interfaces to the Astrobe console. Both use the same buffered serial RS232 device. They differ in their way that interface is operated, and thus in their use cases. The modules can be used concurrently by different client modules.


All three modules export:

  • a Texts.Writer
  • an RS232dev.Device

The RS232dev.Device is physically the same for all three modules.

The different Texts.Writer:

  • ConsoleB.C: using the transmit buffer of the RS232 device, with busy-waiting upon buffer full
  • ConsoleC.C: not using the transmit buffer, with busy-waiting for each character
  • ConsoleS.C: using the transmit buffer, with yielding control upon buffer full, and awaiting the buffer empty device signal to continue

Clients can easily change the output method used by IMPORT Console := ConsoleX.


Evidently, with ConsoleC.C and ConsoleB.C, the writing process holds control over the output device until it yields explicitly, while with ConsoleS.C the writing process will yield on the driver level during the duration of the output in case the transmit buffer cannot hold the complete output text. For example, module Errors uses ConsoleC.C.

Using busy-waiting, ConsoleC.C and ConsoleB.C can disrupt the timing of other processes. They should only be used within error handling and for the related error messages, where the error processing does not want to allow other processes to run until the situation is resolved.

For normal output, say from commands, ConsoleS.C is the better choice, as there is less, or no, negative impact on the timing of other processes. For example, module System uses ConsoleS.C.


Obviously, the output via ConsoleS.C could be interfered with by output from other processes, which is not possible with ConsoleC.C and ConsoleB.C. This mixup is “benign”, though. The process using ConsoleS.C will await the buffer empty signal, so any other process writing during this awaiting period will simply add more output to the buffer, delaying the buffer empty signal accordingly.