;
; NAME: FNDSPD
;
; FUNCTION: This program is run to determine what speed an incoming
; terminal is set at. It does this by varying the port speed, asking
; the terminal operator to enter Carriage Returns, and then trying to
; read them. If it finds a valid CR character, it assumes that it is
; at the right speed. The only serial I/O board supported is the
; AM300. The only speeds supported are 300 and 1200. The line is
; is originally set to 1200 baud.
;
; AUTHOR: Tom Dahlquist
;
; HISTORY:
; When Who What
; 04/26/84 TAD Written.
;
SEARCH SYS
SEARCH SYSSYM
SEARCH TRM
TYPECR <Hit a Carriage Return and wait-->
MOVW #2,D5 ; for loop...
ILOOP: SLEEP #10000. ; wait 1 second,
TCKI: TCKI ; anything in buffer?
BNE ILPE ; go sleep again if not, else
KBD ; get it and see if it's
CMPB D1,#15 ; a CR...
BEQ EXIT ; if so, all done...
BR TCKI ; else see if any more.
ILPE: DBF D5,ILOOP ; do this N times, then fall thru
JMP LOOP ; and do the switch again.
EXIT: TYPE <Speed set at >
TSTW @A0
BEQ 1$
TYPE <1200>
BR 2$
1$: TYPE <300>
2$: TYPECR < baud.>
EXIT
SETSPD: SUPVR ; set supervisor state and
SVLOK ; disable interrupts.
MOV T.IHW(A5),A4 ; A4 -> I/O port...
MOV T.IHM(A5),D3 ; get port number
ANDB #7,D3 ; for MUX reg...
ORB #10,D3 ; set baud rate change bit...
MOVB D3,4(A4) ; and send to MUX reg.
MOVB D0,@A4 ; send baud rate.
ANDB #^C10,D3 ; turn off baud rate change bit...
MOVB D3,4(A4) ; select ASTRO...
MOVB #11,1(A4) ; set standard stuff...
MOVB #205,@A4
MOVB #20,4(A4) ; enable interrupts...
SVUNLK ; enable interrupts...
SSTS 2(A0) ; get current processor status,
ANDW #157777,2(A0) ; turn off supervisor state, and
LSTS 2(A0) ; reload it.
RTN