.PRINT	 ; ;	C/	;/;/
.PRINT	 ; ;	C/;/	;/
.PRINT	 ; ;
.PRINT	 ; ; the following	are mpp	macros
.PRINT	 ; ;
.PRINT	 ; 	$MACRO TTY A B C D E ...
.PRINT	 ; 	** TTY1	#@1 #@2	#@3 #@4	#@5 #@6	#@7 #@8	#@9 #@A	#@B #@C	
.PRINT	 ; 	$ENDM
.PRINT	 ; ;
.PRINT	 ; 	$MACRO TTY1
.PRINT	 ;         I%IN <#@1> END <<JSR PC,TTflsh>> <TTY2 <#@1>>
.PRINT	 ; 	$ENDM
.PRINT	 ; ;
.PRINT	 ; 	$MACRO TTY2
.PRINT	 ; 	S%SW 21
.PRINT	 ; 	I%IN <#@1> <R1 R2 R3 @R0 @R1 @R2 @R3>	<> <S%SW -21>
.PRINT	 ; 	I%SW 21	<MOV #@1,R0> <I%DF <#@1> R0 <MOV ##@1,R0>>
.PRINT	 ; 	CALL TTYCC
.PRINT	 ; 	$ENDM
.PRINT	 ; ;
.PRINT	 ; 	$MACRO FUNCTION	set to parm3
.PRINT	 ; 	I%IDN	R0 <#@2> <I%ERR	<Cant use	r0 here>>
.PRINT	 ; 	TTY ESC	'R
.PRINT	 ; 	I%DF R0	<#@3>	<mov #@3,r0>
.PRINT	 ; 	call ttycc
.PRINT	 ; 	$ENDM
.PRINT	 ; ;
.PRINT	 ; 	$MACRO CURSOR TO X,Y
.PRINT	 ; 	MOV #@2,-(SP)
.PRINT	 ; 	MOV #@3,-(SP)
.PRINT	 ; 	CALL CURSR2
.PRINT	 ; 	$ENDM
.PRINT	 ; ;
.PRINT	 ; 	$MACRO return	;this MUST be lower case
.PRINT	 ; 	rts pc
.PRINT	 ; 	$ENDM
.PRINT	 ; /
.PRINT	 ; 	PROGRAM	E8. SCREEN EDITOR	2
$auto$=-2
.enabl lc
;15-aug-80 for Conroy C runtime
.PRINT	 ;  mutask=1
 mutask=1
.PRINT	 ; 	.psect edi08
	.psect edi08
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; 	.enabl lc
	.enabl lc
.PRINT	 ; 
.PRINT	 ; 	.MACRO push this
	.MACRO push this
	mov this,-(sp)
	.ENDM
.PRINT	 ; 
.PRINT	 ; 	.MACRO pop that
	.MACRO pop that
	mov (sp)+,that
	.ENDM
.PRINT	 ; 			.if df mutask
			.if df mutask
.PRINT	 ; 				.MACRO pure
				.MACRO pure
                                .psect pur,ro
				.ENDM
.PRINT	 ; 
.PRINT	 ; 				.MACRO impure
				.MACRO impure
                                .psect ipur,rw
				.ENDM
.PRINT	 ; 			
			
.PRINT	 ; 			.iff
			.iff
.PRINT	 ; 			
			
.PRINT	 ; 				.MACRO pure
				.MACRO pure
				.ENDM
.PRINT	 ; 				.MACRO impure
				.MACRO impure
				.ENDM
.PRINT	 ; 			
			
.PRINT	 ; 			.endc
			.endc
.PRINT	 ; 	impure
	impure
.PRINT	 ; 
.PRINT	 ; 	.globl sfacts	;entry for facts output
	.globl sfacts	;entry for facts output
.PRINT	 ; 	.globl 	lkill	;line kill
	.globl 	lkill	;line kill
.PRINT	 ; 	.globl 	scner2	;error	message	screen mode fixup
	.globl 	scner2	;error	message	screen mode fixup
.PRINT	 ; 	.globl 	scner1	;error	message	screen mode fixup
	.globl 	scner1	;error	message	screen mode fixup
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; ; - - -	 macro library calls
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; 	.mcall dir$,callr
	.mcall dir$,callr
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; ; - - -	 local data and	symbols
.PRINT	 ; 
.PRINT	 ; 	esc	=	33
	esc	=	33
.PRINT	 ; 	sdel	=	123
	sdel	=	123
.PRINT	 ; 	home	=	110
	home	=	110
.PRINT	 ; 	bottom	=	24.
	bottom	=	24.
.PRINT	 ; 	insert	=	114
	insert	=	114
.PRINT	 ; 	delete	=	115
	delete	=	115
.PRINT	 ; 	ceol	=	113
	ceol	=	113
.PRINT	 ; 	ceop	=	'J
	ceop	=	'J
.PRINT	 ; 	rightmost =	80.
	rightmost =	80.
.PRINT	 ; 	screen	=	1
	screen	=	1
.PRINT	 ; 	line	=	0
	line	=	0
.PRINT	 ; 	blank	=	40
	blank	=	40
.PRINT	 ; 
.PRINT	 ; 	tab	=	11
	tab	=	11
.PRINT	 ; 
.PRINT	 ; fst:	.word 0
fst:	.word 0
.PRINT	 ; lst:	.word 0
lst:	.word 0
.PRINT	 ; loc:    .word 0
loc:    .word 0
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; 		pure
		pure
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; lf:     .asciz /Left= /
lf:     .asciz /Left= /
.PRINT	 ; rt:     .asciz / Right= /
rt:     .asciz / Right= /
.PRINT	 ; ind:    .asciz / Indent= /
ind:    .asciz / Indent= /
.PRINT	 ; spc:    .asciz / Spacing= /
spc:    .asciz / Spacing= /
.PRINT	 ; jst:    .asciz / Justify= /
jst:    .asciz / Justify= /
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; fil:	.asciz /file: /
fil:	.asciz /file: /
.PRINT	 ; dt:	.asciz /   .= /
dt:	.asciz /   .= /
.PRINT	 ; d$:	.asciz /   $= /
d$:	.asciz /   $= /
.PRINT	 ; tp:	.asciz /    tmp= /
tp:	.asciz /    tmp= /
.PRINT	 ; 	.even
	.even
.PRINT	 ; 
.PRINT	 ; fword:  .word lf,rt,ind,spc,jst
fword:  .word lf,rt,ind,spc,jst
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; ; - - -	lkill	kill the line (as	in control-u, but no linefeed)
.PRINT	 ; 
.PRINT	 ; lkill:
lkill:
.PRINT	 ; 	IF smode NE #0			;if =	screen mode
	TST smode		;IS smode NE #0
	BEQ E8.1	;Not if EQ
.PRINT	 ; 	    push R0
	    push R0
.PRINT	 ; 	    CURSOR to	#30.,#1		;30 means current line column 1
	MOV #30.,-(SP)
	MOV #1,-(SP)
	JSR PC,CURSR2
.PRINT	 ; 	    TTY	esc ceol  END		;clear	it out on	the current line
MOV #esc,R0
	JSR PC,TTYCC
MOV #ceol,R0
	JSR PC,TTYCC
JSR PC,TTflsh
.PRINT	 ; 	    pop R0
	    pop R0
.PRINT	 ; 	    FI
E8.1=.			; 
E8.3=.
.PRINT	 ; 	return
	rts pc
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; ; - - -	 error fix up routines
.PRINT	 ; 
.PRINT	 ; scner2:
scner2:
.PRINT	 ; 	IF smode = #0
	TST smode		;IS smode = #0
	BNE E8.4	;Not if NE
.PRINT	 ; 	    call ttynl
	    call ttynl
.PRINT	 ; 	    callr ttyskp
	    callr ttyskp
.PRINT	 ; 	ELSE
	JMP E8.7
E8.4=.			; 
.PRINT	 ; 	    CURSOR to	#bottom-1,#1
	MOV #bottom-1,-(SP)
	MOV #1,-(SP)
	JSR PC,CURSR2
.PRINT	 ; 	    TTY	esc ceol END
MOV #esc,R0
	JSR PC,TTYCC
MOV #ceol,R0
	JSR PC,TTYCC
JSR PC,TTflsh
.PRINT	 ; 	    callr ttyskp
	    callr ttyskp
.PRINT	 ; 	    FI
E8.7=.			; 
E8.6=.
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; scner1:
scner1:
.PRINT	 ; 	IF smode NE #0
	TST smode		;IS smode NE #0
	BEQ E8.8	;Not if EQ
.PRINT	 ; 	    CURSOR to	#bottom,#30.	;leave it here, don't dump	it yet
	MOV #bottom,-(SP)
	MOV #30.,-(SP)
	JSR PC,CURSR2
.PRINT	 ; 	    FUNCTION set to #'D
MOV #ESC,R0
	JSR PC,TTYCC
MOV #'R,R0
	JSR PC,TTYCC
mov #'D,r0
	call ttycc
.PRINT	 ; 	    FI
E8.8=.			; 
E8.10=.
.PRINT	 ; 	return
	rts pc
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; ; - - -	screen editor facts
.PRINT	 ; 
.PRINT	 ; sfacts:
sfacts:
.PRINT	 ; 	call fixscn			;clear bottom 2 lines first
	call fixscn			;clear bottom 2 lines first
.PRINT	 ; 	CURSOR to #bottom-1,#20.
	MOV #bottom-1,-(SP)
	MOV #20.,-(SP)
	JSR PC,CURSR2
.PRINT	 ; 	call fillfacts                  ;display fill parmameters
	call fillfacts                  ;display fill parmameters
.PRINT	 ; 
.PRINT	 ; 	CURSOR to #bottom,#20.
	MOV #bottom,-(SP)
	MOV #20.,-(SP)
	JSR PC,CURSR2
.PRINT	 ; 
.PRINT	 ; 	mov #fil,r0			;string "	file: "
	mov #fil,r0			;string "	file: "
.PRINT	 ; 	call ttystr
	call ttystr
.PRINT	 ; 
.PRINT	 ; 	mov #sfn,r0			;the file	name
	mov #sfn,r0			;the file	name
.PRINT	 ; 	call ttystr
	call ttystr
.PRINT	 ; 
.PRINT	 ; 	mov #dt,r0			;string " .= "
	mov #dt,r0			;string " .= "
.PRINT	 ; 	call ttystr
	call ttystr
.PRINT	 ; 
.PRINT	 ; 	mov dot,r1
	mov dot,r1
.PRINT	 ; 	sub zero,r1			;decimal value of	dot
	sub zero,r1			;decimal value of	dot
.PRINT	 ; 	asr r1
	asr r1
.PRINT	 ; 	call ttynum
	call ttynum
.PRINT	 ; 
.PRINT	 ; 	mov #d$,r0			;string " $= "
	mov #d$,r0			;string " $= "
.PRINT	 ; 	call ttystr
	call ttystr
.PRINT	 ; 
.PRINT	 ; 	mov dol,r1			;decimal value of dollar
	mov dol,r1			;decimal value of dollar
.PRINT	 ; 	sub zero,r1
	sub zero,r1
.PRINT	 ; 	asr r1
	asr r1
.PRINT	 ; 	call ttynum
	call ttynum
.PRINT	 ; 
.PRINT	 ; 	mov #tp,r0			;string " tmp= "
	mov #tp,r0			;string " tmp= "
.PRINT	 ; 	call ttystr
	call ttystr
.PRINT	 ; 	mov $tptr,r1			;tmp pointer value
	mov $tptr,r1			;tmp pointer value
.PRINT	 ; 	call ttynum			;output it
	call ttynum			;output it
.PRINT	 ; 
.PRINT	 ; 	CURSOR to #bottom-1,#1.
	MOV #bottom-1,-(SP)
	MOV #1.,-(SP)
	JSR PC,CURSR2
.PRINT	 ; 	TTY END
JSR PC,TTflsh
.PRINT	 ; 	IF adr2 NE #0
	TST adr2		;IS adr2 NE #0
	BEQ E8.11	;Not if EQ
.PRINT	 ;         call shade                    
        call shade                    
.PRINT	 ; 	FI
E8.11=.			; 
E8.13=.
.PRINT	 ; 
.PRINT	 ; 	return
	rts pc
.PRINT	 ; 
.PRINT	 ;  
 
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; shade:
shade:
.PRINT	 ; ;        push    r4
.PRINT	 ; ;	push	r3
.PRINT	 ; ;	push	r0
.PRINT	 ; 	call saval
	call saval
.PRINT	 ; 
.PRINT	 ;         LOOP for r2 = #1 TO #2
	MOV #1,r2	;Init loop index
E8.14=.
	CMP r2,#2	;done loop?
	BGT E8.15	;yes if GT
.PRINT	 ;         LET fst = dot - #24.
	MOV dot,fst
	SUB #24.,fst
.PRINT	 ; 	LET lst = dot + #18.
	MOV dot,lst
	ADD #18.,lst
.PRINT	 ;         mov #-1,loc
        mov #-1,loc
.PRINT	 ; 
.PRINT	 ; 	LOOP for r3 = fst THRU lst step #2
	MOV fst,r3	;Init loop index
E8.16=.
	CMP r3,lst	;done loop?
	BHI E8.17	;yes if HI
.PRINT	 ; 		inc loc
		inc loc
.PRINT	 ; 		IF r3 HI zero   AND   r3 LOS   dol
	CMP r3,zero		;IS r3 HI zero
	BLOS E8.18	;Not if LOS
	CMP r3,dol		;IS r3 LOS dol
	BHI E8.21	;Not if HI
	BR E8.24	;Here IF r3 LOS dol    
E8.21=.
	BR E8.18		;Here if not
E8.24=.
.PRINT	 ; 			IF r3 HIS padr1  AND r3 LOS padr2
	CMP r3,padr1		;IS r3 HIS padr1
	BLO E8.25	;Not if LO
	CMP r3,padr2		;IS r3 LOS padr2
	BHI E8.28	;Not if HI
	BR E8.31	;Here IF r3 LOS padr2    
E8.28=.
	BR E8.25		;Here if not
E8.31=.
.PRINT	 ; 				ELSE
	JMP E8.32
E8.25=.			; 
.PRINT	 ; 				call 10$
				call 10$
.PRINT	 ; 			FI
E8.32=.			; 
E8.27=.
.PRINT	 ; 		FI
E8.18=.			; 
E8.20=.
.PRINT	 ; 
.PRINT	 ; 	NEXT r3
	ADD #2,r3
	JMP E8.16		;back to top
E8.17=.
.PRINT	 ; 	CURSOR to #bottom-1,#1
	MOV #bottom-1,-(SP)
	MOV #1,-(SP)
	JSR PC,CURSR2
.PRINT	 ;         TTY END
JSR PC,TTflsh
.PRINT	 ;         call getc
        call getc
.PRINT	 ;         mov r0,peek
        mov r0,peek
.PRINT	 ; 	NEXT r2
	INC r2
	JMP E8.14		;back to top
E8.15=.
.PRINT	 ; ;;	pop	r0
.PRINT	 ; ;;	pop	r3
.PRINT	 ; ;;	pop	r4
.PRINT	 ; 	return
	rts pc
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ;  
 
.PRINT	 ; 10$:
10$:
.PRINT	 ; 	IF loc = #0
	TST loc		;IS loc = #0
	BNE E8.33	;Not if NE
.PRINT	 ; 		CURSOR to #24.,#rightmost
	MOV #24.,-(SP)
	MOV #rightmost,-(SP)
	JSR PC,CURSR2
.PRINT	 ; 	ELSE
	JMP E8.36
E8.33=.			; 
.PRINT	 ; 	        CURSOR to loc,#rightmost
	MOV loc,-(SP)
	MOV #rightmost,-(SP)
	JSR PC,CURSR2
.PRINT	 ; 	FI
E8.36=.			; 
E8.35=.
.PRINT	 ; 
.PRINT	 ;         TTY esc sdel esc 'R
MOV #esc,R0
	JSR PC,TTYCC
MOV #sdel,R0
	JSR PC,TTYCC
MOV #esc,R0
	JSR PC,TTYCC
MOV #'R,R0
	JSR PC,TTYCC
.PRINT	 ; 
.PRINT	 ; 	IF r3 = dot
	CMP r3,dot		;IS r3 = dot
	BNE E8.37	;Not if NE
.PRINT	 ;                 mov fdot,r0
                mov fdot,r0
.PRINT	 ;         ELSE
	JMP E8.40
E8.37=.			; 
.PRINT	 ;                 mov fpage,r0
                mov fpage,r0
.PRINT	 ;         FI
E8.40=.			; 
E8.39=.
.PRINT	 ; 
.PRINT	 ;         IF r2 = #1
	CMP r2,#1		;IS r2 = #1
	BNE E8.41	;Not if NE
.PRINT	 ; 	        bis #2,r0
	        bis #2,r0
.PRINT	 ;         FI
E8.41=.			; 
E8.43=.
.PRINT	 ;         TTY R0 END
	JSR PC,TTYCC
JSR PC,TTflsh
.PRINT	 ;         rts pc
        rts pc
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; fillfacts:
fillfacts:
.PRINT	 ; 	call saval
	call saval
.PRINT	 ; 	mov #fparms,r3
	mov #fparms,r3
.PRINT	 ;         LOOP for r2 = #fword THRU #fword+8. STEP #2
	MOV #fword,r2	;Init loop index
E8.44=.
	CMP r2,#fword+8.	;done loop?
	BHI E8.45	;yes if HI
.PRINT	 ;            mov (r2),r0
           mov (r2),r0
.PRINT	 ;            call ttystr
           call ttystr
.PRINT	 ;            mov (r3)+,r1
           mov (r3)+,r1
.PRINT	 ;            call ttynum
           call ttynum
.PRINT	 ;         NEXT r2
	ADD #2,r2
	JMP E8.44		;back to top
E8.45=.
.PRINT	 ;         TTY END
JSR PC,TTflsh
.PRINT	 ; 	rts pc
	rts pc
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; 
.PRINT	 ; 	.end
	.end
