The Z88 has a single serial port which has to be shared by all applications, so it is important that applications use the system to access the port to avoid interfering with the correct operation of other applications running in the machine. The system runs the serial port using interrupts and buffering, so most of its operation is transparent, but there are certain operations, such as directly controlling the RTS line (required for auto-dialing by some modems), which the system calls do not support and in these cases the hardware is accessed more directly - see the "Hardware" section of these notes. The serial port specification is reproduced here for convenience:
Function | Details |
---|---|
Baud rates | 75, 300, 600, 1200, 2400, 9600, 19200, 38400. Send and receive rates are independent. |
Parity | None, Odd, Even, Mark, Space. Note the Z88 generates the appropriate parity, and will ignore, but not strip, the parity of incoming data |
Flow | Hardware handshaking with or without XON/XOFF |
Timeout | Output: 10 minutes is the default value Input: Infinite is the default value |
Buffer | OZ 2.x and 3.x : Output: 95 bytes, Input: 127 bytes OZ 4.2 - 4.4 : Output: 256 bytes, Input: 256 bytes OZ 4.5 : Output: unbuffered, Input: |
256 bytes |
Using the Serial Port
The serial port is accessed by opening the device :COM.0, using GN_Opf, and then using the standard file I/O routines: OS_Gb, OS_Gbt, OS_Pb, OS_Pbt and OS_Mv. The device should be closed after the operation is complete. For most application this level of access should be sufficient, however, it may be necessary to change the serial port parameters from within an application. This is done by writing new values to the Panel, using the OS_Sp call, and then issuing a soft reset command to the serial driver. Changing the Panel setting may affect other software in the machine, so should not be undertaken lightly. It would be appropriate to reset the Panel to its original setting after serial port operations are complete. This can be achieved by first reading the Panel settings with OS_Nq. The "EazyLink" and "PCLINK II" popdowns use this technique. OS_Sp and OS_Nq are covered in detail in the "Miscellaneous useful routines" section.
...