perm filename SERTST.FAI[KBD,ROB] blob sn#451828 filedate 1979-06-19 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002		TITLE sertst (or, can robert hack io in fail?)
C00008 ENDMK
C⊗;
	TITLE sertst (or, can robert hack io in fail?)

ac1←01
ac2←02
ac3←03
p←17

inchan←←1		; the channel for the Serializer TTY
inbufs←←2		; the number of input buffers

	.LIBRARY numstr[lib,ks]
	EXTERNAL octtyp, octtyw, intstr, unsstr

pdlen←←20
pdl:	BLOCK	pdlen
obuf:	BLOCK	3
ibuf:	BLOCK	3

;
; the data block for opening the tty
;
ttyini:	410			; image mode, error return if OPEN looses
	'TTY35 '		; this is the prototype serializer keyboard
	obuf,,ibuf		; as always...

;
; Open TTY35 for single character i/o.  Code lifted from DIAL.
;
openup:	OPEN	inchan,ttyini	; OPEN the tty
	JRST	lose		;   oops...
	MOVSI	ac3,700		;   transfers will be 7 bit bytes
	MOVEM	ac3,ibuf+1
	MOVEM	ac3,obuf+1
	INBUF	inchan,inbufs
	OUTBUF	inchan,inbufs
	POPJ	p,
lose:	OUTSTR	[asciz/OPEN failed?
/]
	EXIT

;
; get a character and return it in ac1
;
get:	SOSG	ibuf+2
	IN	inchan,
	CAIA
	JRST	inperr
	ILDB	ac1,ibuf+1
	POPJ	p,
inperr:	OUTSTR	[ASCIZ/Input error
/]
	EXIT

;
; send character (in ac1) to TTY
;
put:	SOSG	obuf+2
	IDPB	ac1,obuf+1
	OUT	inchan
	CAIA
	JRST	outerr
	POPJ	p,
outerr:	OUTSTR	[ASCIZ/Output error
/]
	EXIT

start:	RESET
	MOVE	p,[IOWD pdlen,pdl]
	PUSHJ	p,openup
loop:	PUSHJ	p,get
	MOVEI	ac3,3		; print width of 3
	PUSHJ	p,octtyw	; output it using KS's nice routines...
	OUTSTR	[ASCIZ/ /]
;	MOVEI	ac2,2
;	SLEEP	ac2,
	JRST	loop

	END	start