.PRINT	 ; ; This is a program to display 3.2 full duplex tty characteristics.
.PRINT	 ; ; It  is a good demonstration of using Mp to most of the grunt work
.PRINT	 ; ; while still producing a program which is only about 3.5k of code.
.PRINT	 ; ;
.PRINT	 ; 	$MACRO TTYPE
.PRINT	 ; 	IFB TTP+1 = ##@1
.PRINT	 ; 	   PRINTS #BUF <     Terminal is #@2>
.PRINT	 ; 	   TYPE #BUF #0
.PRINT	 ; 	   JMP TEND
.PRINT	 ; 	 FI
.PRINT	 ; 	$ENDM
.PRINT	 ; ;
.PRINT	 ;         $MACRO FLAG m1 m2 flag
.PRINT	 ;         IFB #@3+1 = #0
.PRINT	 ;             I%NB <#@1> <TTY <    #@1>>
.PRINT	 ;         ELSE 
.PRINT	 ;             I%NB <#@2> <TTY <    #@2>>
.PRINT	 ;         FI 
.PRINT	 ;         $ENDM 
.PRINT	 ; ;
.PRINT	 ;         $MACRO SPD A B
.PRINT	 ;         IF R2 = ##@1
.PRINT	 ;             MOV ##@2,R2
.PRINT	 ;             RTS PC
.PRINT	 ;         FI 
.PRINT	 ;         $ENDM 
.PRINT	 ; ;
.PRINT	 ;         $MACRO g item
.PRINT	 ; #@1:    .byte tc.#@1,0
.PRINT	 ;         $ENDM 
.PRINT	 ; ;
.PRINT	 ;         $MACRO gg
.PRINT	 ;         ** g  #@1 #@2 #@3 #@4 #@5 #@6 #@7 #@8 #@9
.PRINT	 ;         $ENDM 
.PRINT	 ; /
.PRINT	 ;         PROGRAM gty	;get tty char (why did I have to write this)
$auto$=-2
.enabl lc
;15-aug-80 for Conroy C runtime
.PRINT	 ; 	.psect tty
	.psect tty
.PRINT	 ;          
         
.PRINT	 ; 	.mcall qiow$,dir$,ttsym$,alun$,glun$
	.mcall qiow$,dir$,ttsym$,alun$,glun$
.PRINT	 ;         ttsym$ 
        ttsym$ 
.PRINT	 ; 
.PRINT	 ; glun:   glun$ 1,buf
glun:   glun$ 1,buf
.PRINT	 ; alun:   alun$ 1,TT,0
alun:   alun$ 1,TT,0
.PRINT	 ; end:    .byte 12,15,177,0
end:    .byte 12,15,177,0
.PRINT	 ; null:   .word 177
null:   .word 177
.PRINT	 ; buf:    .blkb 100.
buf:    .blkb 100.
.PRINT	 ; get:    qiow$ sf.gmc,1,1,,ios,,<getl,2>
get:    qiow$ sf.gmc,1,1,,ios,,<getl,2>
.PRINT	 ; ios:    .word 0,0
ios:    .word 0,0
.PRINT	 ; i:      .word 0
i:      .word 0
.PRINT	 ; j:      .word 0
j:      .word 0
.PRINT	 ; get1:    
get1:    
.PRINT	 ;          
         
.PRINT	 ;         gg acr bin cts dlu
acr:    .byte tc.acr,0
bin:    .byte tc.bin,0
cts:    .byte tc.cts,0
dlu:    .byte tc.dlu,0
.PRINT	 ;         gg esq fdx hff
esq:    .byte tc.esq,0
fdx:    .byte tc.fdx,0
hff:    .byte tc.hff,0
.PRINT	 ;         gg hfl hht hld isl
hfl:    .byte tc.hfl,0
hht:    .byte tc.hht,0
hld:    .byte tc.hld,0
isl:    .byte tc.isl,0
.PRINT	 ;         gg lpp nec pri
lpp:    .byte tc.lpp,0
nec:    .byte tc.nec,0
pri:    .byte tc.pri,0
.PRINT	 ;         gg rat rsp scp slv
rat:    .byte tc.rat,0
rsp:    .byte tc.rsp,0
scp:    .byte tc.scp,0
slv:    .byte tc.slv,0
.PRINT	 ;         gg smr tbf ttp
smr:    .byte tc.smr,0
tbf:    .byte tc.tbf,0
ttp:    .byte tc.ttp,0
.PRINT	 ;         gg vfl wid xsp
vfl:    .byte tc.vfl,0
wid:    .byte tc.wid,0
xsp:    .byte tc.xsp,0
.PRINT	 ; getl:    
getl:    
.PRINT	 ;          
         
.PRINT	 ; EBC:    .BYTE TC.8BC,0
EBC:    .BYTE TC.8BC,0
.PRINT	 ;          
         
.PRINT	 ;          
         
.PRINT	 ;          
         
.PRINT	 ; MAIN::   
MAIN::   
.PRINT	 ;         FUNC ARGC,ARGV
ARGC=	12
ARGV=	14
	jsr r0,$$csav           ;get stack frame
	add #$auto$,sp          ;allocate space on stack for autos
	$auto.=$auto$
	$auto$=-2               ;re-init
.PRINT	 ; 
.PRINT	 ;         IF argc(r5) GT #1
	CMP argc(r5),#1		;IS argc(r5) GT #1
	BLE gty1	;Not if LE
.PRINT	 ;             mov argv(r5),r2
            mov argv(r5),r2
.PRINT	 ;             add #2,r2
            add #2,r2
.PRINT	 ;             mov (r2),r2                     ;get addr of arg 2 (tty #)
            mov (r2),r2                     ;get addr of arg 2 (tty #)
.PRINT	 ;             LEN r2
	mov r2,r0
gty4=.
	tstb (r0)+
	bne gty4
	sub r2,r0
	dec r0
.PRINT	 ; ;;;;        C r3 = btoi[r2,r0,#i,#8.]    ;lets do this locally
.PRINT	 ; 	    call term
	JSR PC,term
.PRINT	 ;             mov i,alun+a.lunu            ;set tt#
            mov i,alun+a.lunu            ;set tt#
.PRINT	 ;             dir$ #alun                   ;and assign it
            dir$ #alun                   ;and assign it
.PRINT	 ; 	ELSE
	JMP gty5
gty1=.			; 
.PRINT	 ; 	   dir$ #glun
	   dir$ #glun
.PRINT	 ; 	   movb buf+g.lunu,i             ;set tty number
	   movb buf+g.lunu,i             ;set tty number
.PRINT	 ; 	   clrb i+1
	   clrb i+1
.PRINT	 ;         FI 
gty5=.			; 
gty3=.
.PRINT	 ;          
         
.PRINT	 ;         LOOP FOR r3 = #get1 THRU #getl STEP #2
	MOV #get1,r3	;Init loop index
gty6=.
	CMP r3,#getl	;done loop?
	BHI gty7	;yes if HI
.PRINT	 ;             mov r3,get+q.iopl			;get char 1 at a time
            mov r3,get+q.iopl			;get char 1 at a time
.PRINT	 ;             dir$ #get
            dir$ #get
.PRINT	 ;         NEXT r3
	ADD #2,r3
	JMP gty6		;back to top
gty7=.
.PRINT	 ; 
.PRINT	 ;          
         
.PRINT	 ; 	movb isl+1,j
	movb isl+1,j
.PRINT	 ; 	clrb j+1
	clrb j+1
.PRINT	 ;         PRINTF #BUF <Characteristics for tt%o: Interface subline = %o (8)> i,j
	MOV R0,-(SP)
	MOV R1,-(SP)
	BR gty9
gty8=.
	.ASCIZ _Characteristics for tt%o: Interface subline = %o (8)_
	.EVEN
gty9=.
	MOV j,-(SP)
	MOV i,-(SP)
	MOV #gty8,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2+2+2,SP	;clean up stk
	mov #BUF,r0
gty10=.
	tstb (r0)+
	bne gty10
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	MOV (SP)+,R1
	MOV (SP)+,R0
.PRINT	 ; 
.PRINT	 ; 	FLAG <NO-wrap-around> <Wrap-around>       acr
	TSTB acr+1		;IS acr+1 = #0
	BNE gty11	;Not if NE
	br gty15
gty14=.
	.asciz _    NO-wrap-around_
	.even
gty15=.
	mov #gty14,r0
gty16=.
	tstb (r0)+
	bne gty16
	sub #gty14,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty14,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	JMP gty17
gty11=.			; 
	br gty19
gty18=.
	.asciz _    Wrap-around_
	.even
gty19=.
	mov #gty18,r0
gty20=.
	tstb (r0)+
	bne gty20
	sub #gty18,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty18,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty17=.			; 
gty13=.
.PRINT	 ;         FLAG <> <read pass all>                   bin
	TSTB bin+1		;IS bin+1 = #0
	BNE gty21	;Not if NE
	JMP gty24
gty21=.			; 
	br gty26
gty25=.
	.asciz _    read pass all_
	.even
gty26=.
	mov #gty25,r0
gty27=.
	tstb (r0)+
	bne gty27
	sub #gty25,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty25,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty24=.			; 
gty23=.
.PRINT	 ; 	FLAG <> <Control-S active>                cts
	TSTB cts+1		;IS cts+1 = #0
	BNE gty28	;Not if NE
	JMP gty31
gty28=.			; 
	br gty33
gty32=.
	.asciz _    Control-S active_
	.even
gty33=.
	mov #gty32,r0
gty34=.
	tstb (r0)+
	bne gty34
	sub #gty32,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty32,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty31=.			; 
gty30=.
.PRINT	 ; 	FLAG <Local> <Dial-up (remote)>           dlu
	TSTB dlu+1		;IS dlu+1 = #0
	BNE gty35	;Not if NE
	br gty39
gty38=.
	.asciz _    Local_
	.even
gty39=.
	mov #gty38,r0
gty40=.
	tstb (r0)+
	bne gty40
	sub #gty38,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty38,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	JMP gty41
gty35=.			; 
	br gty43
gty42=.
	.asciz _    Dial-up (remote)_
	.even
gty43=.
	mov #gty42,r0
gty44=.
	tstb (r0)+
	bne gty44
	sub #gty42,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty42,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty41=.			; 
gty37=.
.PRINT	 ;          
         
.PRINT	 ;         FLAG <> <Escape sequences>                esq
	TSTB esq+1		;IS esq+1 = #0
	BNE gty45	;Not if NE
	JMP gty48
gty45=.			; 
	br gty50
gty49=.
	.asciz _    Escape sequences_
	.even
gty50=.
	mov #gty49,r0
gty51=.
	tstb (r0)+
	bne gty51
	sub #gty49,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty49,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty48=.			; 
gty47=.
.PRINT	 ;         FLAG <Half duplex> <Full duplex>          fdx
	TSTB fdx+1		;IS fdx+1 = #0
	BNE gty52	;Not if NE
	br gty56
gty55=.
	.asciz _    Half duplex_
	.even
gty56=.
	mov #gty55,r0
gty57=.
	tstb (r0)+
	bne gty57
	sub #gty55,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty55,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	JMP gty58
gty52=.			; 
	br gty60
gty59=.
	.asciz _    Full duplex_
	.even
gty60=.
	mov #gty59,r0
gty61=.
	tstb (r0)+
	bne gty61
	sub #gty59,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty59,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty58=.			; 
gty54=.
.PRINT	 ; 	FLAG <Simulate form feeds> <Hardware form feed> hff
	TSTB hff+1		;IS hff+1 = #0
	BNE gty62	;Not if NE
	br gty66
gty65=.
	.asciz _    Simulate form feeds_
	.even
gty66=.
	mov #gty65,r0
gty67=.
	tstb (r0)+
	bne gty67
	sub #gty65,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty65,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	JMP gty68
gty62=.			; 
	br gty70
gty69=.
	.asciz _    Hardware form feed_
	.even
gty70=.
	mov #gty69,r0
gty71=.
	tstb (r0)+
	bne gty71
	sub #gty69,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty69,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty68=.			; 
gty64=.
.PRINT	 ;          
         
.PRINT	 ; 	FLAG <Simulate tabs> <Hardware tab>       hht
	TSTB hht+1		;IS hht+1 = #0
	BNE gty72	;Not if NE
	br gty76
gty75=.
	.asciz _    Simulate tabs_
	.even
gty76=.
	mov #gty75,r0
gty77=.
	tstb (r0)+
	bne gty77
	sub #gty75,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty75,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	JMP gty78
gty72=.			; 
	br gty80
gty79=.
	.asciz _    Hardware tab_
	.even
gty80=.
	mov #gty79,r0
gty81=.
	tstb (r0)+
	bne gty81
	sub #gty79,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty79,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty78=.			; 
gty74=.
.PRINT	 ;         FLAG <> <Hold screen mode>                hld
	TSTB hld+1		;IS hld+1 = #0
	BNE gty82	;Not if NE
	JMP gty85
gty82=.			; 
	br gty87
gty86=.
	.asciz _    Hold screen mode_
	.even
gty87=.
	mov #gty86,r0
gty88=.
	tstb (r0)+
	bne gty88
	sub #gty86,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty86,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty85=.			; 
gty84=.
.PRINT	 ;         FLAG <> <No echo>                         nec
	TSTB nec+1		;IS nec+1 = #0
	BNE gty89	;Not if NE
	JMP gty92
gty89=.			; 
	br gty94
gty93=.
	.asciz _    No echo_
	.even
gty94=.
	mov #gty93,r0
gty95=.
	tstb (r0)+
	bne gty95
	sub #gty93,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty93,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty92=.			; 
gty91=.
.PRINT	 ;         FLAG <> <Terminal is PRIVILEGED>          pri
	TSTB pri+1		;IS pri+1 = #0
	BNE gty96	;Not if NE
	JMP gty99
gty96=.			; 
	br gty101
gty100=.
	.asciz _    Terminal is PRIVILEGED_
	.even
gty101=.
	mov #gty100,r0
gty102=.
	tstb (r0)+
	bne gty102
	sub #gty100,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty100,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty99=.			; 
gty98=.
.PRINT	 ; 
.PRINT	 ;         FLAG <Not scope> <Scope>                  scp
	TSTB scp+1		;IS scp+1 = #0
	BNE gty103	;Not if NE
	br gty107
gty106=.
	.asciz _    Not scope_
	.even
gty107=.
	mov #gty106,r0
gty108=.
	tstb (r0)+
	bne gty108
	sub #gty106,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty106,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	JMP gty109
gty103=.			; 
	br gty111
gty110=.
	.asciz _    Scope_
	.even
gty111=.
	mov #gty110,r0
gty112=.
	tstb (r0)+
	bne gty112
	sub #gty110,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty110,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty109=.			; 
gty105=.
.PRINT	 ;         FLAG <> <Slaved>                          slv
	TSTB slv+1		;IS slv+1 = #0
	BNE gty113	;Not if NE
	JMP gty116
gty113=.			; 
	br gty118
gty117=.
	.asciz _    Slaved_
	.even
gty118=.
	mov #gty117,r0
gty119=.
	tstb (r0)+
	bne gty119
	sub #gty117,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty117,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty116=.			; 
gty115=.
.PRINT	 ;         FLAG <UPPER case only> <UPPER/lower case> smr
	TSTB smr+1		;IS smr+1 = #0
	BNE gty120	;Not if NE
	br gty124
gty123=.
	.asciz _    UPPER case only_
	.even
gty124=.
	mov #gty123,r0
gty125=.
	tstb (r0)+
	bne gty125
	sub #gty123,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty123,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	JMP gty126
gty120=.			; 
	br gty128
gty127=.
	.asciz _    UPPER/lower case_
	.even
gty128=.
	mov #gty127,r0
gty129=.
	tstb (r0)+
	bne gty129
	sub #gty127,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty127,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty126=.			; 
gty122=.
.PRINT	 ;         FLAG <> <Send 4 fills after line feed>    vfl
	TSTB vfl+1		;IS vfl+1 = #0
	BNE gty130	;Not if NE
	JMP gty133
gty130=.			; 
	br gty135
gty134=.
	.asciz _    Send 4 fills after line feed_
	.even
gty135=.
	mov #gty134,r0
gty136=.
	tstb (r0)+
	bne gty136
	sub #gty134,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty134,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty133=.			; 
gty132=.
.PRINT	 ;         FLAG <> <Eight bit binary data>           ebc
	TSTB ebc+1		;IS ebc+1 = #0
	BNE gty137	;Not if NE
	JMP gty140
gty137=.			; 
	br gty142
gty141=.
	.asciz _    Eight bit binary data_
	.even
gty142=.
	mov #gty141,r0
gty143=.
	tstb (r0)+
	bne gty143
	sub #gty141,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty141,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty140=.			; 
gty139=.
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; 	movb tbf+1,r3
	movb tbf+1,r3
.PRINT	 ; 	IF r3 NE #0
	TST r3		;IS r3 NE #0
	BEQ gty144	;Not if EQ
.PRINT	 ; 	   PRINTF #BUF <    Typeahead (current count = %d)> r3
	MOV R0,-(SP)
	MOV R1,-(SP)
	BR gty148
gty147=.
	.ASCIZ _    Typeahead (current count = %d)_
	.EVEN
gty148=.
	MOV r3,-(SP)
	MOV #gty147,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2+2,SP	;clean up stk
	mov #BUF,r0
gty149=.
	tstb (r0)+
	bne gty149
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	MOV (SP)+,R1
	MOV (SP)+,R0
.PRINT	 ; 	ELSE
	JMP gty150
gty144=.			; 
.PRINT	 ; 	   FLAG <> <Typeahead>                    rat
	TSTB rat+1		;IS rat+1 = #0
	BNE gty151	;Not if NE
	JMP gty154
gty151=.			; 
	br gty156
gty155=.
	.asciz _    Typeahead_
	.even
gty156=.
	mov #gty155,r0
gty157=.
	tstb (r0)+
	bne gty157
	sub #gty155,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #40,-(SP)
	MOV     r0,-(SP)
	MOV     #gty155,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
gty154=.			; 
gty153=.
.PRINT	 ; 	FI
gty150=.			; 
gty146=.
.PRINT	 ;          
         
.PRINT	 ; 
.PRINT	 ;          
         
.PRINT	 ;         TTY <_<12>_> #0
	br gty159
gty158=.
	.asciz __<12>__
	.even
gty159=.
	mov #gty158,r0
gty160=.
	tstb (r0)+
	bne gty160
	sub #gty158,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #gty158,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
.PRINT	 ;          
         
.PRINT	 ;         movb rsp+1,r2
        movb rsp+1,r2
.PRINT	 ;         call speed
	JSR PC,speed
.PRINT	 ;         PRINTS #buf <Receive speed= %4d    > r2
	BR gty162
gty161=.
	.ASCIZ _Receive speed= %4d    _
	.EVEN
gty162=.
	MOV r2,-(SP)
	MOV #gty161,-(SP)
	MOV #buf,-(SP)
	jsr pc,sprint
	ADD #0+2+2+2,SP	;clean up stk
.PRINT	 ;         TYPE #buf #0
	mov #buf,r0
gty163=.
	tstb (r0)+
	bne gty163
	sub #buf,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #buf,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
.PRINT	 ;          
         
.PRINT	 ;         movb xsp+1,r2
        movb xsp+1,r2
.PRINT	 ;         call speed
	JSR PC,speed
.PRINT	 ;         PRINTS #buf <Transmit speed= %4d    > r2
	BR gty165
gty164=.
	.ASCIZ _Transmit speed= %4d    _
	.EVEN
gty165=.
	MOV r2,-(SP)
	MOV #gty164,-(SP)
	MOV #buf,-(SP)
	jsr pc,sprint
	ADD #0+2+2+2,SP	;clean up stk
.PRINT	 ;         TYPE #buf #0
	mov #buf,r0
gty166=.
	tstb (r0)+
	bne gty166
	sub #buf,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #buf,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
.PRINT	 ;          
         
.PRINT	 ;         movb wid+1,r2
        movb wid+1,r2
.PRINT	 ;         bic #177400,r2
        bic #177400,r2
.PRINT	 ;         PRINTS #buf <Buffer width= %d.> r2
	BR gty168
gty167=.
	.ASCIZ _Buffer width= %d._
	.EVEN
gty168=.
	MOV r2,-(SP)
	MOV #gty167,-(SP)
	MOV #buf,-(SP)
	jsr pc,sprint
	ADD #0+2+2+2,SP	;clean up stk
.PRINT	 ;         TYPE #buf #0
	mov #buf,r0
gty169=.
	tstb (r0)+
	bne gty169
	sub #buf,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #buf,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
.PRINT	 ;          
         
.PRINT	 ;         TTY <_<15>__<12>_> #0
	br gty171
gty170=.
	.asciz __<15>__<12>__
	.even
gty171=.
	mov #gty170,r0
gty172=.
	tstb (r0)+
	bne gty172
	sub #gty170,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #gty170,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
.PRINT	 ;          
         
.PRINT	 ;         movb hfl+1,r2
        movb hfl+1,r2
.PRINT	 ;         PRINTS #buf <Fill count: %d.         > r2
	BR gty174
gty173=.
	.ASCIZ _Fill count: %d.         _
	.EVEN
gty174=.
	MOV r2,-(SP)
	MOV #gty173,-(SP)
	MOV #buf,-(SP)
	jsr pc,sprint
	ADD #0+2+2+2,SP	;clean up stk
.PRINT	 ;         TYPE #buf #0
	mov #buf,r0
gty175=.
	tstb (r0)+
	bne gty175
	sub #buf,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #buf,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
.PRINT	 ;          
         
.PRINT	 ;         movb lpp+1,r2
        movb lpp+1,r2
.PRINT	 ;         bic #177400,r2
        bic #177400,r2
.PRINT	 ;         PRINTS #buf <Page length: %4d. > r2
	BR gty177
gty176=.
	.ASCIZ _Page length: %4d. _
	.EVEN
gty177=.
	MOV r2,-(SP)
	MOV #gty176,-(SP)
	MOV #buf,-(SP)
	jsr pc,sprint
	ADD #0+2+2+2,SP	;clean up stk
.PRINT	 ;         TYPE #buf #0
	mov #buf,r0
gty178=.
	tstb (r0)+
	bne gty178
	sub #buf,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #buf,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
.PRINT	 ;          
         
.PRINT	 ; 	 TTYPE 1        <Asr33>
	CMPB TTP+1,#1		;IS TTP+1 = #1
	BNE gty179	;Not if NE
	BR gty183
gty182=.
	.ASCIZ _     Terminal is Asr33_
	.EVEN
gty183=.
	MOV #gty182,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty184=.
	tstb (r0)+
	bne gty184
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty179=.			; 
gty181=.
.PRINT	 ; 	 TTYPE 2        <Ksr33>
	CMPB TTP+1,#2		;IS TTP+1 = #2
	BNE gty185	;Not if NE
	BR gty189
gty188=.
	.ASCIZ _     Terminal is Ksr33_
	.EVEN
gty189=.
	MOV #gty188,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty190=.
	tstb (r0)+
	bne gty190
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty185=.			; 
gty187=.
.PRINT	 ; 	 TTYPE 3        <Asr35>
	CMPB TTP+1,#3		;IS TTP+1 = #3
	BNE gty191	;Not if NE
	BR gty195
gty194=.
	.ASCIZ _     Terminal is Asr35_
	.EVEN
gty195=.
	MOV #gty194,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty196=.
	tstb (r0)+
	bne gty196
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty191=.			; 
gty193=.
.PRINT	 ; 	 TTYPE 4        <La30s>
	CMPB TTP+1,#4		;IS TTP+1 = #4
	BNE gty197	;Not if NE
	BR gty201
gty200=.
	.ASCIZ _     Terminal is La30s_
	.EVEN
gty201=.
	MOV #gty200,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty202=.
	tstb (r0)+
	bne gty202
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty197=.			; 
gty199=.
.PRINT	 ; 	 TTYPE 5        <La30p>
	CMPB TTP+1,#5		;IS TTP+1 = #5
	BNE gty203	;Not if NE
	BR gty207
gty206=.
	.ASCIZ _     Terminal is La30p_
	.EVEN
gty207=.
	MOV #gty206,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty208=.
	tstb (r0)+
	bne gty208
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty203=.			; 
gty205=.
.PRINT	 ; 	 TTYPE 6        <La36>
	CMPB TTP+1,#6		;IS TTP+1 = #6
	BNE gty209	;Not if NE
	BR gty213
gty212=.
	.ASCIZ _     Terminal is La36_
	.EVEN
gty213=.
	MOV #gty212,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty214=.
	tstb (r0)+
	bne gty214
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty209=.			; 
gty211=.
.PRINT	 ; 	 TTYPE 7        <Vt05>
	CMPB TTP+1,#7		;IS TTP+1 = #7
	BNE gty215	;Not if NE
	BR gty219
gty218=.
	.ASCIZ _     Terminal is Vt05_
	.EVEN
gty219=.
	MOV #gty218,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty220=.
	tstb (r0)+
	bne gty220
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty215=.			; 
gty217=.
.PRINT	 ; 	 TTYPE 10       <Vt50>
	CMPB TTP+1,#10		;IS TTP+1 = #10
	BNE gty221	;Not if NE
	BR gty225
gty224=.
	.ASCIZ _     Terminal is Vt50_
	.EVEN
gty225=.
	MOV #gty224,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty226=.
	tstb (r0)+
	bne gty226
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty221=.			; 
gty223=.
.PRINT	 ; 	 TTYPE 11       <Vt52>
	CMPB TTP+1,#11		;IS TTP+1 = #11
	BNE gty227	;Not if NE
	BR gty231
gty230=.
	.ASCIZ _     Terminal is Vt52_
	.EVEN
gty231=.
	MOV #gty230,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty232=.
	tstb (r0)+
	bne gty232
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty227=.			; 
gty229=.
.PRINT	 ; 	 TTYPE 12       <Vt55>
	CMPB TTP+1,#12		;IS TTP+1 = #12
	BNE gty233	;Not if NE
	BR gty237
gty236=.
	.ASCIZ _     Terminal is Vt55_
	.EVEN
gty237=.
	MOV #gty236,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty238=.
	tstb (r0)+
	bne gty238
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty233=.			; 
gty235=.
.PRINT	 ; 	 TTYPE 13       <Vt61>
	CMPB TTP+1,#13		;IS TTP+1 = #13
	BNE gty239	;Not if NE
	BR gty243
gty242=.
	.ASCIZ _     Terminal is Vt61_
	.EVEN
gty243=.
	MOV #gty242,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty244=.
	tstb (r0)+
	bne gty244
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty239=.			; 
gty241=.
.PRINT	 ; 	 TTYPE 14       <La180s>
	CMPB TTP+1,#14		;IS TTP+1 = #14
	BNE gty245	;Not if NE
	BR gty249
gty248=.
	.ASCIZ _     Terminal is La180s_
	.EVEN
gty249=.
	MOV #gty248,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty250=.
	tstb (r0)+
	bne gty250
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty245=.			; 
gty247=.
.PRINT	 ; 	 TTYPE 15       <Vt100>
	CMPB TTP+1,#15		;IS TTP+1 = #15
	BNE gty251	;Not if NE
	BR gty255
gty254=.
	.ASCIZ _     Terminal is Vt100_
	.EVEN
gty255=.
	MOV #gty254,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty256=.
	tstb (r0)+
	bne gty256
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty251=.			; 
gty253=.
.PRINT	 ; 	 TTYPE 16       <La120>
	CMPB TTP+1,#16		;IS TTP+1 = #16
	BNE gty257	;Not if NE
	BR gty261
gty260=.
	.ASCIZ _     Terminal is La120_
	.EVEN
gty261=.
	MOV #gty260,-(SP)
	MOV #BUF,-(SP)
	jsr pc,sprint
	ADD #0+2+2,SP	;clean up stk
	mov #BUF,r0
gty262=.
	tstb (r0)+
	bne gty262
	sub #BUF,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #BUF,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
	   JMP TEND
gty257=.			; 
gty259=.
.PRINT	 ; Tend:
Tend:
.PRINT	 ;         TTY  <_<15>_> #0
	br gty264
gty263=.
	.asciz __<15>__
	.even
gty264=.
	mov #gty263,r0
gty265=.
	tstb (r0)+
	bne gty265
	sub #gty263,r0
	dec r0
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOV     #0,-(SP)
	MOV     r0,-(SP)
	MOV     #gty263,-(SP)
	CLR     -(SP)
	CLR     -(SP)
	CLR     -(SP)
	MOVB    #5,(SP)
	MOV     #5,-(SP)
	MOV     #io.wvb,-(SP)
	MOV     (PC)+,-(SP)
	.BYTE   3,12.
	EMT     ^O<377>
.PRINT	 ;          
         
.PRINT	 ;         RET #1
	MOV #1,R0
	sub #$auto.,sp          ;de-allocate locals
	jmp $$cret
.PRINT	 ; speed:   
speed:   
.PRINT	 ;          
         
.PRINT	 ;         SPD S.0 0.
	CMP R2,#S.0		;IS R2 = #S.0
	BNE gty266	;Not if NE
            MOV #0.,R2
            RTS PC
gty266=.			; 
gty268=.
.PRINT	 ;         SPD S.50 50.
	CMP R2,#S.50		;IS R2 = #S.50
	BNE gty269	;Not if NE
            MOV #50.,R2
            RTS PC
gty269=.			; 
gty271=.
.PRINT	 ;         SPD S.75 75.
	CMP R2,#S.75		;IS R2 = #S.75
	BNE gty272	;Not if NE
            MOV #75.,R2
            RTS PC
gty272=.			; 
gty274=.
.PRINT	 ;         SPD S.110 110.
	CMP R2,#S.110		;IS R2 = #S.110
	BNE gty275	;Not if NE
            MOV #110.,R2
            RTS PC
gty275=.			; 
gty277=.
.PRINT	 ;         SPD S.134 134.
	CMP R2,#S.134		;IS R2 = #S.134
	BNE gty278	;Not if NE
            MOV #134.,R2
            RTS PC
gty278=.			; 
gty280=.
.PRINT	 ;         SPD S.150 150.
	CMP R2,#S.150		;IS R2 = #S.150
	BNE gty281	;Not if NE
            MOV #150.,R2
            RTS PC
gty281=.			; 
gty283=.
.PRINT	 ;         SPD S.200 200.
	CMP R2,#S.200		;IS R2 = #S.200
	BNE gty284	;Not if NE
            MOV #200.,R2
            RTS PC
gty284=.			; 
gty286=.
.PRINT	 ;         SPD S.300 300.
	CMP R2,#S.300		;IS R2 = #S.300
	BNE gty287	;Not if NE
            MOV #300.,R2
            RTS PC
gty287=.			; 
gty289=.
.PRINT	 ;         SPD S.600 600.
	CMP R2,#S.600		;IS R2 = #S.600
	BNE gty290	;Not if NE
            MOV #600.,R2
            RTS PC
gty290=.			; 
gty292=.
.PRINT	 ;         SPD S.1200 1200.
	CMP R2,#S.1200		;IS R2 = #S.1200
	BNE gty293	;Not if NE
            MOV #1200.,R2
            RTS PC
gty293=.			; 
gty295=.
.PRINT	 ;         SPD S.1800 1800.
	CMP R2,#S.1800		;IS R2 = #S.1800
	BNE gty296	;Not if NE
            MOV #1800.,R2
            RTS PC
gty296=.			; 
gty298=.
.PRINT	 ;         SPD S.2000 2000.
	CMP R2,#S.2000		;IS R2 = #S.2000
	BNE gty299	;Not if NE
            MOV #2000.,R2
            RTS PC
gty299=.			; 
gty301=.
.PRINT	 ;         SPD S.2400 2400.
	CMP R2,#S.2400		;IS R2 = #S.2400
	BNE gty302	;Not if NE
            MOV #2400.,R2
            RTS PC
gty302=.			; 
gty304=.
.PRINT	 ;         SPD S.3600 3600.
	CMP R2,#S.3600		;IS R2 = #S.3600
	BNE gty305	;Not if NE
            MOV #3600.,R2
            RTS PC
gty305=.			; 
gty307=.
.PRINT	 ;         SPD S.4800 4800.
	CMP R2,#S.4800		;IS R2 = #S.4800
	BNE gty308	;Not if NE
            MOV #4800.,R2
            RTS PC
gty308=.			; 
gty310=.
.PRINT	 ;         SPD S.7200 7200.
	CMP R2,#S.7200		;IS R2 = #S.7200
	BNE gty311	;Not if NE
            MOV #7200.,R2
            RTS PC
gty311=.			; 
gty313=.
.PRINT	 ;         SPD S.9600 9600.
	CMP R2,#S.9600		;IS R2 = #S.9600
	BNE gty314	;Not if NE
            MOV #9600.,R2
            RTS PC
gty314=.			; 
gty316=.
.PRINT	 ;         RTS PC
        RTS PC
.PRINT	 ; term:                   ;convert terminal number to binary
term:                   ;convert terminal number to binary
.PRINT	 ; 			;do it this way since there ain't no conversion
.PRINT	 ; 			;short of using Whitesmiths
.PRINT	 ; 			;and we want to give this one away.
.PRINT	 ; 
.PRINT	 ; 	clr r3
	clr r3
.PRINT	 ; 	LOOP FOR j = #1 TO R0
	MOV #1,j	;Init loop index
gty317=.
	CMP j,R0	;done loop?
	BGT gty318	;yes if GT
.PRINT	 ; 	     movb (r2)+,r1           ;get char
	     movb (r2)+,r1           ;get char
.PRINT	 ; 	     sub #'0,r1              ;make it a binary
	     sub #'0,r1              ;make it a binary
.PRINT	 ; 	     asl r3
	     asl r3
.PRINT	 ; 	     asl r3
	     asl r3
.PRINT	 ; 	     asl r3                  ;multiply r3 by 8
	     asl r3                  ;multiply r3 by 8
.PRINT	 ; 	     add r1,r3               ;and add this char
	     add r1,r3               ;and add this char
.PRINT	 ; 	NEXT j
	INC j
	JMP gty317		;back to top
gty318=.
.PRINT	 ; 	mov r3,i                     ;store result in i
	mov r3,i                     ;store result in i
.PRINT	 ; 
.PRINT	 ; 	rts pc
	rts pc
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ;         .end 
        .end 
