
;*****************************************************
;                                                    *
;        Serial  Equates                             *
;        Last Update: 2/6/84                         *
;*****************************************************


INMSGS          equ     80H             ; Input queue buffer size
UPPER_LIM	equ	INMSGS - 10 

NULL		equ	0

V_FLAG          equ     020H            ; Flag bias for GSX 
SWITCH_BIAS     equ     028H            ; Flag bias for Screen Switch

P_DELAY		equ	141             ; used in Tick
DELAY_16MS	equ	1	        ; each system tick is 16 ms

                                        ; used by Send_Xon, Send_Xoff in Serin
SLAVE_PIC_MASK	equ	53H	        ; slave pic's irq mask port
CONIN_IRQ	equ	40H	        ; console input irq bit


                                        ; usart's command registers bit equates
X_CTL		equ	01H
DTR		equ	02H
R_CTL		equ	04H
ERROR_RESET	equ	10H
RTS		equ	20H

                                        ;usart's status register bit equates
TXRDY		equ	01H             ;Transmit buffer is empty
RXRDY		equ	02H             ;Receive buffer has data
PARITY_ERR	equ	08H
OVERRUN_ERR	equ	10H
FRAME_ERR	equ	20H
DCD		equ	40H             ;Set = DCD is low
DSR             equ     80H             ;Set = DSR is low

eject

     ;**************************************************
     ;                           		       *
     ;          INPUT  QUEUE  CONTROL  STRUCTURE       *
     ;				   		       *
     ;**************************************************

SYS_FLAG	equ	byte ptr 0		; Q's CCP/M flag number
Q_STATE		equ	word ptr (SYS_FLAG +1)	; current state of this Q
CMD_REG		equ	byte ptr (Q_STATE + 2)	; usarts command reg image
UN_PC		equ	word ptr (CMD_REG +1)	; unprocessed characters
INT_IN		equ	word ptr (UN_PC + 2)	; interrupt side index 
PROC_OUT	equ	word ptr (INT_IN + 2)	; process side index
U_NUMB		equ	byte ptr (PROC_OUT + 2)	; usart,s number
U_PORTC		equ	byte ptr (U_NUMB + 1)	; usart's command port
U_PORTS		equ	byte ptr (U_PORTC + 1)	; usart's status port
U_PORTD		equ	byte ptr (U_PORTS + 1)	; usart's data port
XINT_MASK	equ	byte ptr (U_PORTD +1)	; xmitters interrupt mask
IESC_IN		equ	word ptr (XINT_MASK +1)	; input esc buff index
OESC_IN		equ	word ptr (IESC_IN +2)	; output esc buff index
LAST_CHAR	equ	byte ptr (OESC_IN +2)	; last char read from Q
LAST_STAT	equ	byte ptr (LAST_CHAR +1)	; last status read from Q
C_STATE		equ	word ptr (LAST_STAT +1)	; conin current routine/state
P_CON		equ	byte ptr (C_STATE +2)	; physical console number
V_CON		equ	byte ptr (P_CON +1)	; virtual console number
ERR_CNT		equ	byte ptr (V_CON +1)	; Error reset counter

ESC_BUFF	equ	byte ptr 32		; the escape buffer
D_BUFF		equ	byte ptr 48		; the data buffer
S_BUFF		equ	byte ptr (D_BUFF + INMSGS) ; the status buffer

                                                ; bit definitions for Q_state
IPROC_WAITING	equ	0001H
CHAR_AVAIL	equ	0002H
BIT8_MASK	equ	0004H
XX_MODE		equ	0010H
DTR_MODE	equ	0020H
RTS_MODE	equ	0040H
SENDER_STOPPED	equ	0080H
SWITCH_PEND     equ     0100H

eject

           ;************************************************
           ;					           *
           ;          OUTPUT  QUEUE  CONTROL  STRUCTURE    *
           ;						   *
           ;************************************************


OFLAGN		equ	byte ptr 0	; CCP/M's flag number
OFLAG		equ	byte ptr 1	; I/O system bit flags
OMSGCNT		equ	word ptr 2	; Number of chars in Q
OMSGOUT		equ	word ptr 4	; current output position in Q
OIOPORT		equ	byte ptr 6	; Output data port address
OSTPORT		equ	byte ptr 7	; Output Status port address
OUSART		equ	byte ptr 8	; Output Usart number
OESC_CNT	equ	byte ptr 9	; chars since last escape
O_BIT_MASK	equ	byte ptr 10	; USART's interrupt bit position
CUR_VCON	equ	byte ptr 11	; Current Vcon on this Pcon
XMIT_MASK	equ	byte ptr 13	; bit(s) used as a Xmit ready mask
DSR_BIT		equ	byte ptr 14	; bit used by usart to reflect the
					; status of the USARTs DSR pin.
OBUFFER		equ	byte ptr 16	; the Q starts here

ONMSGS		equ	      0080h     ; size of the output Q buffer
OESC_MAX        equ               4     ; maximum # char's in esc sequence
                                        ; (for VT-52)


                                        ; Bit definitions for Queue State field
XON_XOFF_MODE	EQU	20H		; If set, the Queue system will respect
					; Xon/Xoff protocol.
XOFF_PENDING	EQU	10H		; If set,the USART we're sending chars
					; to wants us to stop.
RTS_PROT	EQU	80H		; If set, the Queue system will recognize
					; the DSR pin on the USART.
PROC_WAITING	equ	01H		; If set,a process is waiting for
					; room in this Queue.

NO_SELECT	equ	0ffH		; Put into the USART NUMBER field of 
                                        ; the Q Control structure (OUSART) when:
                                        ; we do not want a usart select call
					; made before a usart is accessed for
					; command, status, or data.




                                ; IN_XMT_MASK values for each of the USARTS
SS_U	equ	0FFH		; system support boards USART
US_0	equ	01H		; Interfacer 3 USART 0
US_1	equ	02H		; Interfacer 3 USART 1
US_2	equ	04H		; Interfacer 3 USART 2
US_3	equ	08H		; Interfacer 3 USART 3
US_4	equ	10H		; Interfacer 3 USART 4
US_5	equ	20H		; Interfacer 3 USART 5
US_6	equ	40H		; Interfacer 3 USART 6
US_7	equ	80H		; Interfacer 3 USART 7



