Z88 Developers' Notes
Contents   Contents of System Calls

OS_Si, low level serial interface

RST 20H, DEFB $8D

IN:

     IX = handle returned from GN_Opf of ":COM.0"
     L = reason code
     Other register parameters depend on reason code

OUT:

     Depends on reason code, see below.
     IX will always be unchanged.

Notes:

Full details of this call's reason codes are found below. Other information of this call can be found in the "The Serial Interface" section.

SI_HRD (L = $00), Serial hard reset

IN:  BC must be set to receive buffer handle before call.
     DE must be set to transmit buffer handle before call.

OUT: Fc = 0

Registers changed after return:

     ..BCDEHL/IXIY same
     AF....../.... different

This resets the UART in the gate array. This call should not need to be used.
 
 

SI_SFT (L = $03), serial soft rest

IN:  -
OUT: -

Registers changed after return:
     ......../IXIY same
     AFBCDEHL/.... different

This call should be useful to install new panel settings or when starting low level (ie. using SI_GBT, SI_PBT etc.) serial operations. It carries out the following:

1. Empty receive and transmit buffers.
2. Reset the XON/XOFF flags.
3. Reset baud rates, parity and flow control settings to the PANEL values.
4. Assert RTS.
5. Resets the serial port timeout to its default of 10 minutes.

SI_INT (L = $06), interrupt entry point (system use only)

No documentation available.
 

SI_GBT (L = $09), get byte from serial port

IN:  BC = timeout in centiseconds

Out if call succeeded:

     Fc = 0
     A = byte received
     BC = remaining time

Out if call failed:

     Fc = 1
     A = RC_TIME ($02) (if no data available before timeout)

Registers changed after return:

     ....D.H./IXIY same
     AFBC.E.L/.... different
SI_PBT (L = $0C), put byte to serial port 
IN:  BC = timeout in centiseconds. If BC = $FFFF then default timeout.
     A = byte to send

Out if call succeeded:

     Fc = 0
     BC = remaining time

Out if call failed:

     Fc = 1
     A = RC_TIME ($02)

Registers changed after return:

     ....DE../IXIY same
     AFBC..HL/.... different

This call will return immediatly if there is space in the transmit buffer, otherwise it will wait until there is space for as long as the timeout. If the timeout is exceeded it will return with an error.
 
 

SI_ENQ (L = $0F), Status enquiry

IN:  -

OUT:

     D = number of full slots in the Tx (transmit) buffer
     E = number of empty slots in the Tx (transmit) buffer
     B = number of full slots in the Rx (receive) buffer
     C = number of empty slots in the Rx (receive) buffer

     A0 = 1, CTS level (inverse of the value on the D-connector)
     A1 = 1, DCD level (inverse of the value on the D-connector)
     A2 = 1, Rx register full
     A3 =    undefined
     A4 = 1, Tx Register empty
     A5 = 1, CTS interrupt
     A6 = 1, DCD interrupt
     A7 = 1, Rx shift register full

Registers changed after return:

     ......../IXIY same
     AFBCDEHL/.... different

A slot, in this context, is the set of bits required to transmit on character. This will include 8 data bits plus start and stop bits.
 
 

SI_FTX (L = $12), Flush transmit buffer

IN:  -

OUT:

     Fc = 0

Registers changed after return:

     A.BCDE../IXIY same
     .F....HL/.... different


SI_FRX (L = $15), Flush receive buffer

IN:  -

OUT:

     Fc = 0

Registers changed after return:

     A.BCDE../IXIY same
     .F....HL/.... different

SI_TMO (L = $18), set default timeout

IN:

     BC = new value for default timeout

OUT:

     Fc = 0

Registers changed after return:

     A.BCDE.L/IXIY same
     .F....H./.... different

If you set the default to $FFFF then when the default is used (by setting a timeout value of $FFFF in get and put byte routines) then the system will wait forever. A soft reset sets the default timeout to 10 minutes. This timeout is completely independent of the system timeout, which is set by the Panel.