;	C/	;/;/
;	C/;/	;/
;
; the following	are mpp	macros
;
        $MACRO TTY A B C D E ...
        ** TTY1	#@1 #@2	#@3 #@4	#@5 #@6	#@7 #@8	#@9 #@A	#@B #@C	
        $ENDM 
;
        $MACRO TTY1
        I%IN <#@1> END <<JSR PC,TTYNLL>> <TTY2 <#@1>>
        $ENDM 
;
        $MACRO TTY2
        S%SW 21
        I%IN <#@1> <R1 R2 R3 @R0 @R1 @R2 @R3>	<> <S%SW -21>
        I%SW 21	<MOV #@1,R0> <I%DF <#@1> R0 <MOV ##@1,R0>>
        CALL TTYCC
        $ENDM 
;
        $MACRO FUNCTION	set to parm3
        I%IDN	R0 <#@2> <I%ERR	<Cant use	r0 here>>
        TTY ESC	'R
        I%DF R0	<#@3>	<mov #@3,r0>
        call ttycc
        $ENDM 
;
        $MACRO CURSOR	TO LINE	COL
        I%IDN	R0 <#@2> <I%ERR	<Cant use	r0 here>>
        TTY ESC	'Y
        MOV #@2,R0
        ADD #31.,R0
        TTY R0
        MOV #@3,R0
        ADD #31.,R0
        TTY R0
        $ENDM 
;
        $MACRO return	;this MUST be lower case
        rts pc
        $ENDM 
;
        $MACRO PUSH	;this MUST be lower case
        mov #@1,-(sp)
        $ENDM 
;
        $MACRO POP	;this MUST be lower case
        mov (sp)+,#@1
        $ENDM 
/
        PROGRAM e8.	;SCREEN EDITOR	2
         
         
         
        .enabl lc
         
         
         
        .globl sfacts	;entry for facts output
        .globl 	lkill	;line kill
        .globl 	scner2	;error	message	screen mode fixup
        .globl 	scner1	;error	message	screen mode fixup
         
         
         
; - - -	 macro library calls
         
         
        .mcall dir$,callr
         
         
; - - -	 local data and	symbols
         
        tab	=	11
        ceop	=	'J
         
         
         
         
         
         
lf:     .asciz /Left= /
rt:     .asciz / Right= /
ind:    .asciz / Indent= /
spc:    .asciz / Spacing= /
jst:    .asciz / Justify= /
         
fil:    .asciz /file: /
dt:     .asciz /   .= /
d$:     .asciz /   $= /
tp:     .asciz /    tmp= /
         
         
         
        .even 
         
fword:  .word lf,rt,ind,spc,jst
         
         
; - - -	lkill	kill the line (as	in control-u, but no linefeed)
         
lkill:   
        IF smode NE #0			;if =	screen mode
            PUSH R0
            TTY 15		;to the right
            TTY	esc ceol  		;clear	it out on	the current line
            TTY esc 'A END	;and 1 line up
            POP	R0
        FI 
        return 
         
         
; - - -	 error fix up routines
         
scner2:  
        IF smode = #0
            call ttynl
            callr ttyskp
        ELSE 
            CURSOR to	#bottom-1,#1
            TTY	esc ceol END
            CURSOR to	#bottom-2,#1
            TTY END
            callr ttyskp
        FI 
         
         
scner1:  
        IF smode NE #0
            CURSOR to	#bottom,#30.	;leave it here, don't dump	it yet
        FI 
        return 
         
         
; - - -	screen editor facts
         
sfacts:  
        call fixscn			;clear bottom 2 lines first
        CURSOR to #bottom-1,#20.
        call fillfacts
        CURSOR to #bottom,#20.
        mov #fil,r0			;string "	file: "
        call ttystr
         
        mov #sfn,r0			;the file	name
        call ttystr
         
        mov #dt,r0			;string " .= "
        call ttystr
         
        mov dot,r1
        sub zero,r1			;decimal value of	dot
        asr r1
        call ttynum
         
        mov #d$,r0			;string " $= "
        call ttystr
         
        mov dol,r1			;decimal value of dollar
        sub zero,r1
        asr r1
        call ttynum
         
        mov #tp,r0			;string " tmp= "
        call ttystr
        mov $tptr,r1			;tmp pointer value
        call ttynum			;output it
         
        CURSOR to #bottom-1,#1.
        TTY END
        return 
         
         
fillfacts:  
        call saval
        mov #fparms,r3
        LOOP for r2 = #fword THRU #fword+8. STEP #2
            mov (r2),r0
            call ttystr
            mov (r3)+,r1
            call ttynum
        NEXT r2
        TTY END
        rts pc
         
        .end 
