	.TITLE	KILTAH
	.IDENT	"V1.0"
	.ENABL	LC
	.NLIST	BEX,ME,CND
 
;	Author:		Henry R. Tumblin
 
;	Date:		March 6,1979
 
;	Version:	1.0
 
;	For:		Animal Resources - Phase 2
 
;	Module Name:	KILTAH
 
;	Residence:	DB0:[117,14]KILTAH.MAC
 
;	Build File:	N/A
 
;	Machine/System:	PDP-11/70 IAS V2.0
 
;	Type/Language:	Subroutine/Assembler
 
;	Abstract:	This subroutine will clear the type ahead of the
;			terminal whose LUN is passed to us. This
;			is performed by reading 10 characters at a time
;			using a Read_With_Timeout function code with a
;			zero(0) timeout value.
 
;	Edits:
 
;	Date	By	Reason
;     ---------	-----	-----------------------------------------------
;	none
;

	.sbttl	Mcall needed macros and set up the DPB
 
	.MCALL	QIOW$,DIR$,DEFIN$

	...GBL=0			; Define TT symbols
	DEFIN$	TF.RST,001
	DEFIN$	TF.BIN,002
	DEFIN$	TF.RAL,010
	DEFIN$	TF.RNE,020
	DEFIN$	TF.RNC,040
	DEFIN$	TF.XOF,100
	DEFIN$	TF.TMO,200
	DEFIN$	TF.WAL,010
	DEFIN$	TF.WMS,020
	DEFIN$	TF.CCO,040
	DEFIN$	TF.WBT,100
	DEFIN$	TF.SYN,200;	   SYNCHRONOUS WRITE
	DEFIN$	TF.AST,010
	DEFIN$	TF.ESQ,020

	.PSECT	$$OTSD,CON,RW,REL,LCL,D

	TTFUN=TF.RAL!TF.RNE!TF.TMO
 
READ:	QIOW$	IO.RLB!TTFUN,5,1,200,IOSB,,<0,10.,0>
 
IOSB:	.BLKW	2
 
	.sbttl	Start mainline code
 
	.globl	KILTAH
	.psect	$$OTSI,CON,RW,REL,LCL,I
 
 
KILTAH:	SUB	#12.,SP			; Use the stack for impure storage
	MOV	SP,READ+Q.IOPL		; Store in the DPB
	MOV	@2(R5),READ+Q.IOLU	; Set lun in the DPB
 
10$:	DIR$	#READ			; Read 10 characters
	TST	IOSB+2			; Anything read?
	BNE	10$			; NE - Yup, try again
 
	ADD	#12.,SP			; Restore stack pointer
	RETURN				; Return to calling proc.
 
	.END
