h62085
s 00151/00000/00000
d D 1.1 83/03/30 17:41:21 bog 1 0
c date and time created 83/03/30 17:41:21 by bog
e
u
4
U
t
T
I 1
	Extrn	HsInit:Far,HsStop:Far,HsRecv:Far,HsSend:Far

Code	CSeg	Byte

	Mov	Ss,Ds:(Word Ptr .00015h)
	Mov	Sp,Offset Top_Stack

	Callf	HsInit

	Mov	Dx,Offset Mess

Show:
	Mov	Cl,9
	Int	224

Loopp:	Call	GetCh
	Cmp	Ax,-1
	Je	ConIn
	Cmp	Ax,-2
	Jne	Poop
	Mov	Dx,Offset B_Mess
	Jmps	Show

Poop:	And	Ax,07fh
	Mov	Dx,Ax
	Mov	Cl,6
	Int	224
	Jmps	Loopp

ConIn:	Mov	Cl,6
	Mov	Dl,-1
	Int	224

	And	Al,07fh
	Jz	Loopp

	Test	XSw,0ffffh
	Jnz	WasUpX

	Cmp	Al,24	; ^X?
	Jne	Shove

	Mov	XSw,1
	Jmps	Loopp

Shove:	Mov	XSw,0
	Call	PutCh
	Jmps	Loopp

WasUpX:	Cmp	Al,2	; ^B
	Jne	Try_E

	Mov	Ax,-2	; BREAK
	Jmps	Shove

Try_E:	Cmp	Al,5	; ^E
	Jne	Try_X

	Callf	HsStop

	Sub	Dx,Dx
	Sub	Cl,Cl
	Int	224

Try_X:	Cmp	Al,24
	Jne	Other

	Mov	Al,24
	Jmps	Shove

Other:	Push	Ax
	Mov	Ax,24
	Call	PutCh
	Pop	Ax
	Jmps	Shove

PutCh:	Mov	Char,Ax
	Push	Ax

PutL:	Push	Ds
	Mov	Ax,Offset Char
	Push	Ax
	Push	Ds
	Mov	Ax,Offset Error
	Push	Ax
	Callf	HsSend
	Cmp	Error,0
	Jl	PutL
	Pop	Ax
	Ret

GetCh:	Push	Ds
	Mov	Ax,Offset Char
	Push	Ax
	Push	Ds
	Mov	Ax,Offset Error
	Push	Ax
	Callf	HsRecv
	Mov	Ax,Char
	Or	Ax,Ax
	Ret

Data	DSeg	Word
Char	Dw	65
Error	Dw	0
XSw	Dw	0

Mess	Db	'[^X ^B] ==> BREAK',13,10
	Db	'[^X ^E] ==> Quit',13,10
	Db	'[^X ^X] ==> ^X',13,10
	Db	'[^X other] ==> ^X other',13,10,'$'

B_Mess	Db	'       ',8,8,8,8,8,8,8,27,'p<Break>',27,'q$'

@GHStat	ESeg	Para	Common

FStDim	Equ	40

; Current state of host interface

COpen	Rw	1		; NOT currently open
RBaudI	Dw	14		; Current receive baud rate index
CRBaud	Dw	9600		; Current receive baud rate
TBaudI	Dw	0		; Current transmit baud rate index
CTBaud	Dw	0		; Current transmit baud rate
CurPar	Dw	0		; Current parity setting
DatBtI	Dw	4		; Current data bits per char index
CDatBt	Dw	8		; Current data bits per character
StoBtI	Dw	0		; Current stop bits per character index
CStoBt	Dw	1		; Current stop bits per character
CBkTim	Dw	250		; Current BREAK milliseconds
CIFMod	Dw	1		; Current receive flagging mode
COFMod	Dw	0		; Current transmit flagging mode
CInStL	Dw	1		; Current receive stop string length
CInStS	Dw	19
	Rw	FStDim-1	; Current receive stop string
CInGoL	Dw	1		; Current receive go string length
CInGoS	Dw	17
	Rw	FStDim-1	; Current receive go string
COtStL	Dw	0		; Current transmit stop string length
COtStS	Dw	19
	Rw	FStDim-1		; Current transmit stop string
COtGoL	Dw	0		; Current transmit go string length
COtGoS	Dw	17
	Rw	FStDim-1		; Current transmit go string

Stack		SSeg	Word	Public
		Rw	1024
Top_Stack	Rw	0
	End
E 1
