Google
 

Trailing-Edge - PDP-10 Archives - steco_19840320_1er_E35 - 10,5676/teco/newsrc/tecxxx.mac
There are 3 other files named tecxxx.mac in the archive. Click here to see a list.
	SUBTTL	Introduction

; Copyright (c) 1980 Stevens Institute of Technology, Hoboken, New Jersey
; 07030.
; All rights reserved.
;
; This software is furnished under a license and may be used and copied
; only in accordance with the terms of such license and with the
; inclusion of the above copyright notice.  This software or any other
; copies thereof may not be provided or otherwise made available to any
; other person.  No title to and ownership of the software is hereby
; transferred.
;
; The information in this software is subject to change without notice
; and should not be construed as a commitment by Stevens Institute of
; Technology.

  ; Search needed universals

	SEARCH	TECUNV		; TECO universal file

  ; Generate the prologue

	TECVER==200		; Major version number
	TECMIN==0		; Minor version number
	TECEDT==1000		; Edit level
	TECWHO==0		; Last editor

	PROLOGUE(XXX,<TECO XXX terminal support routines>) ; Generate the TITLE and other stuff

	$CODE			; Put into code PSECT
	SUBTTL	Table of Contents

;+
;.pag.lit

;		Table of Contents for TECXXX - XXX terminal support
;
;
;			   Section			      Page
;   1. Introduction . . . . . . . . . . . . . . . . . . . . .    1
;   2. Table of Contents. . . . . . . . . . . . . . . . . . .    2
;   3. Revision History . . . . . . . . . . . . . . . . . . .    3
;   4. Macro definitions. . . . . . . . . . . . . . . . . . .    4
;   5. Tables
;        5.1.   H19 . . . . . . . . . . . . . . . . . . . . .    5
;        5.2.   H19A. . . . . . . . . . . . . . . . . . . . .    6
;   6. Support routines
;        6.1.   H19
;             6.1.1.     Initialization routine . . . . . . .    7
;             6.1.2.     Reset terminal . . . . . . . . . . .    8
;             6.1.3.     XY positioning . . . . . . . . . . .    9
;             6.1.4.     Delete a line feed . . . . . . . . .   10
;             6.1.5.     Delete a vertical tab. . . . . . . .   11
;             6.1.6.     Delete a form feed . . . . . . . . .   12
;             6.1.7.     Control-U. . . . . . . . . . . . . .   13
;             6.1.8.     Insert character . . . . . . . . . .   14
;             6.1.9.     Type a character . . . . . . . . . .   15
;             6.1.10.    Delete N lines . . . . . . . . . . .   16
;             6.1.11.    Insert N lines . . . . . . . . . . .   17
;             6.1.12.    Delete a character . . . . . . . . .   18
;             6.1.13.    Cost initialization routine. . . . .   19
;             6.1.14.    Replacement cost calculation . . . .   20
;             6.1.15.    Insert cost calculation. . . . . . .   21
;             6.1.16.    Delete cost calculation. . . . . . .   22
;             6.1.17.    Move cost calculation. . . . . . . .   23
;             6.1.18.    Delete to End of line. . . . . . . .   24
;        6.2.   H19A
;             6.2.1.     Delete the end of line . . . . . . .   25
;             6.2.2.     Initialization routine . . . . . . .   26
;             6.2.3.     Reset terminal . . . . . . . . . . .   27
;             6.2.4.     XY positioning . . . . . . . . . . .   28
;             6.2.5.     Delete a line feed . . . . . . . . .   29
;             6.2.6.     Delete a vertical tab. . . . . . . .   30
;             6.2.7.     Delete a form feed . . . . . . . . .   31
;             6.2.8.     Control-U. . . . . . . . . . . . . .   32
;             6.2.9.     Insert character . . . . . . . . . .   33
;        6.3.   H1A
;             6.3.1.     Type a character . . . . . . . . . .   34
;        6.4.   H19A
;             6.4.1.     Delete N lines . . . . . . . . . . .   35
;             6.4.2.     Insert N lines . . . . . . . . . . .   36
;             6.4.3.     Delete a character . . . . . . . . .   37
;             6.4.4.     Cost initialization routine. . . . .   38
;             6.4.5.     Replacement cost calculation . . . .   39
;             6.4.6.     Insert cost calculation. . . . . . .   40
;             6.4.7.     Delete cost calculation. . . . . . .   41
;             6.4.8.     Insert line cost calculation . . . .   42
;             6.4.9.     Delete line cost calculation . . . .   43
;             6.4.10.    Move cost calculation. . . . . . . .   44
;   7. Low segment for TECHEA . . . . . . . . . . . . . . . .   45
;   8. End of TECHEA. . . . . . . . . . . . . . . . . . . . .   46

;.end lit.pag
;-
	SUBTTL	Revision History
COMMENT	|

1000	Start of this version
|
	SUBTTL	Macro definitions

; Macro to define a word of five characters

	DEFINE	TB(A<.CHNUL>,B<.CHNUL>,C<.CHNUL>,D<.CHNUL>,E<.CHNUL>)
	SUBTTL	Tables -- XXX

; General XXX terminal support.  Play fill in the blank.

CRTINI	VXXX
 CRTENT	INT,<PUSHJ P,XXXINT>	; Initialize the terminal handling
 CRTENT	WID,^D79		; 80 by
 CRTENT	LIN,^D24		; 25 lines
 CRTENT	CIN,<PUSHJ P,XXXCIN>	; Cost initialization
 CRTENT	CRP,<PUSHJ P,XXXCRP>	; Cost of replace character
 CRTENT	CIC,<PUSHJ P,XXXCIC>	; Cost of insert character
 CRTENT	CDC,<PUSHJ P,XXXCDC>	; Cost of delete character
 CRTENT	CIL,<MOVX T1,<<INSVL.($OPICH,CS$OPR)>!<INSVL.(2,CS$CST)>>> ; Cost of insert line
 CRTENT	CDL,<MOVX T1,<<INSVL.($OPDCH,CS$OPR)>!<INSVL.(2,CS$CST)>>> ; Cost of delete line
 CRTENT	CPP,<PUSHJ P,XXXCPP>	; Cost of point to point move
 CRTENT	BCK,<TB(.CHCNH)>
 CRTENT	SPC,<TB(.CHESC,"C")>
 CRTENT	DBS,<TB(" ",.CHCNH)>
 CRTENT	DLF,<PUSHJ P,XXXDLF>	; Delete a line feed
 CRTENT	DVT,<PUSHJ P,XXXDVT>	; Delete a vertical tab
 CRTENT	DFF,<PUSHJ P,XXXDFF>	; Delete a form feed
 CRTENT	CRB,<TB(.CHCNH)>
 CRTENT	CTU,<PUSHJ P,XXXCTU>	; Routine to do control U processing
 CRTENT	FIN,<PUSHJ P,XXXFIN>
 CRTENT	ERS,<TB(.CHESC,"E")>
 CRTENT	DEL,<PUSHJ P,XXXDEL>	; Routine to delete to the end of a line
 CRTENT	DSP,.CHSPC
 CRTENT	INL,<PUSHJ P,XXXINL>	; Routine to insert lines
 CRTENT	DLL,<PUSHJ P,XXXDLL>	; Routine to delete lines
 CRTENT	TCH,<PUSHJ P,XXXTCH>	; Type a character
 CRTENT	DCH,<PUSHJ P,XXXDCH>	; Routine to delete a character
 CRTENT	ICH,<PUSHJ P,XXXICH>	; Routine to insert a character
 CRTENT	XYP,<PUSHJ P,XXXXY>	; Routine to do XY positioning
 CRTENT CDE,<MOVEI T1,2>	; Cost of 2
CRTEND
	SUBTTL	Support routines -- XXX -- Initialization routine

;+
;.HL1 XXXINT
;This routine will initialize the terminal handling routines for the
;specific terminal.  It will also initialize the XXX terminal
;.literal
;
; Usage:
;	MOVEI	CRT,CRT.block.address
;	XCT	$CRINT(CRT)
;	(Return)
;
;.end literal
;-

XXXINT:	SETZM	INSFLG		; Flag not in insert mode
	MOVEI	T1,[$STRING(<^A[?2hOx1>)] ; Get the string to put terminal
				; in VT-52 mode, not insert
	PJRST	SC$STR		; And output it
	SUBTTL	Support routines -- XXX -- Reset terminal

;+
;.HL1 XXXFIN
;This routine will reset the terminal to set up for exiting from
;TECO.
;.literal
;
; Usage:
;	MOVEI	CRT,CRT.block.address
;	XCT	$CRFIN(CRT)
;	(Return)
;
;.end literal
;-

XXXFIN:	SKIPN	INSFLG		; In insert mode?
	 POPJ	P,		; No, just return
	SETZM	INSFLG		; Flag not in insert mode
	MOVX	T1,<BYTE(7).CHESC,"O"> ; Get string to take out of insert mode
	PJRST	SC$STR		; And output it
	SUBTTL	Support routines -- XXX -- XY positioning

;+
;.HL XXXXY
;This routine will do the positioning for the Heathkit XXX terminal.
;.literal
;
; Usage:
;	MOVE	X,X.postion
;	MOVE	Y,Y.postion
;	MOVE	CRT,CRT.block.index
;	PUSHJ	P,@$CRXYP(CRT)
;	(Return)
;
;.end literal
;-

XXXXY:	$SAVE	<X,Y>		; Save the args
	DMOVE	T1,CURPOS	; Get the current position
	DMOVEM	X,CURPOS	; Save the current position
	SUB	T1+$OFSX,X	; Determine if it is an up/down/right/left by one
	SUB	T1+$OFSY,Y	;  movement
	SKIPE	T1+$OFSX	; Is the X zero ?
	 SKIPN	T1+$OFSY	; Or the Y ?
	  SKIPA			; Yes - Handle differently
	JRST	XXXXYA		; No - Handle normally
	SKIPN	T1+$OFSY	; No change in the Y offset ?
	 JUMPE	X,XXXXYC	; Yes - Only need a CR
	MOVM	T3,T1+$OFSX	; Get the X offset
	SOJE	T3,XXXXYX	; Just X by one
	MOVM	T3,T1+$OFSY	; Get the Y offset
	SOJE	T3,XXXXYY	; Just the Y by one
	JUMPE	T1+$OFSX,XXXXYA	; If X change is zero, must do full address
	TXNE	X,7		; Heading for a tab stop?
	 JRST	XXXXYA		; No, must do full address
	JUMPG	T1,XXXXYA	; Going forward?
	CAXGE	T1,-^D8		; Yes, is it the next tab stop?
	 JRST	XXXXYA		; No, do the full address
	$SAVE	<CH>		; Yes, save CH
	MOVX	CH,.CHTAB	; Get a tab
	PJRST	SC$IMG		; And type it


XXXXYA:	SKIPN	X		; Is this non-zero ?
	 JUMPE	Y,XXXXYH	; Just home it
	ADDX	X," "		; Convert to a position
	ADDX	Y," "		; Convert to a position
	MOVEI	T1,[$STRING(<Y^8/Y/^8/X/>)]
	PJRST	SC$STR		; Output the string

; Here to just home the cursor

XXXXYH:	MOVX	T1,<BYTE (7).CHESC,"H"> ; Get the home string
	PJRST	SC$STR		; Send it

; Here to just output a CR

XXXXYC:	$SAVE	<CH>		; Save current character
	MOVX	CH,.CHCRT	; Just output a CR
	PJRST	SC$IMG		; . . .

; Here to move in the X direction by one

XXXXYX:	SKIPGE	T1+$OFSX	; Is this negative ?
	 SKIPA	T1,[BYTE (7).CHESC,"C"] ; No - To the right
	  MOVX	T1,<BYTE(7).CHCNH> ; Yes, use a backspace
	PJRST	SC$STR		; Output the string

; Here to move in the Y direction by one

XXXXYY:	CAXN	Y,^D25-1	; Going to the 25th line?
	 JRST	XXXXYA		; Yes, have to use the direct addressing
	SKIPL	T1+$OFSY	; Is this negative ?
	 SKIPA	T1,[BYTE (7).CHESC,"A"] ; No - Move up
	  MOVX	T1,<BYTE(7).CHLFD> ; Yes, move down with a line feed
	PJRST	SC$STR		; Output the string
	SUBTTL	Support routines -- XXX -- Delete a line feed

;+
;.HL1 XXXDLF
;This routine will send the character string to delete a line feed.
;.literal
;
; Usage:
;	MOVE	CRT,CRT.block.address
;	PUSHJ	P,@$CRDLF(CRT)
;	(Return)
;.end literal
;-

XXXDLF:	MOVX	T1,<BYTE (7).CHESC,"A"> ; Get the string
	PJRST	SC$STR		; And output it
	SUBTTL	Support routines -- XXX -- Delete a vertical tab

;+
;.HL1 XXXDVT
;This routine will send the character string to delete a vertical tab.
;.literal
;
; Usage:
;	MOVE	CRT,CRT.block.address
;	PUSHJ	P,@$CRDVT(CRT)
;	(Return)
;
;.end literal
;-


XXXDVT:	$SAVE	<P1>		; Save P1
	MOVX	P1,4		; Get the number of times to repeat
XXXCMN:	MOVX	T1,<BYTE (7).CHESC,"A"> ; Get the string
	PUSHJ	P,SC$STR	; Output the string
	SOJG	P1,XXXCMN	; Loop until done
	POPJ	P,		; Return to the caller

	SUBTTL	Support routines -- XXX -- Delete a form feed

;+
;.HL1 XXXDFF
;This routine will send the character string to delete a form feed.
;.literal
;
; Usage:
;	MOVE	CRT,CRT.block.address
;	PUSHJ	P,$CRDFF(CRT)
;	(Return)
;
;.end literal
;-

XXXDFF:	$SAVE	<P1>		; Save P1
	MOVX	P1,10		; Get the number of times to repeat
	PJRST	XXXCMN		; Go to the common routine
	SUBTTL	Support routines -- XXX -- Control-U

;+
;.HL1 XXXCTU
;This routine will process the control U in the command parser.  It
;may be called without CRT being set up.
;.literal
;
; Usage:
;	MOVE	CRT,CRT.block.address
;	PUSHJ	P,@$CRCTU(CRT)
;	(Return)
;
;.end literal
;-

XXXCTU:	MOVX	T1,<BYTE(7).CHESC,"l"> ; Get the characters

	PUSHJ	P,SC$STR	; Output them
	MOVX	CH,.CHCRT	; And the free carriage return
	PJRST	T$OCHR		; Output it
	SUBTTL	Support routines -- XXX -- Insert character

;+
;.HL XXXICH
;This routine will cause a character to be inserted.  It is called
;with the character.  It is assumed that the positioning has been done
;before this routine is called.
;.literal
;
; Usage:
;	MOVX	CH,Character
;	MOVEI	CRT,CRT.block.address
;	XCT	$CRICH(CRT)
;
;.end literal
;-

XXXICH:	SKIPE	INSFLG		; In insert mode ?
	 PJRST	SC$CHR		; Yes, then just type it
	PUSH	P,T1		; Save T1
	MOVX	T1,<BYTE (7).CHESC,"@"> ; Enter insert mode string
	PUSHJ	P,SC$STR	; Type the string
	POP	P,T1		; Restore T1
	SETOM	INSFLG		; Flag we are now in insert mode
	PJRST	SC$CHR		; Type the character
	SUBTTL	Support routines -- XXX -- Type a character

;+
;.HL1 XXXTCH
;This routine will type a character on the terminal.  It will first check
;to see if the terminal is in insert character mode and take it out if it
;is in insert character mode.
;.literal
;
; Usage:
;	MOVX	CH,Character
;	MOVEI	CRT,CRT.block.address
;	XCT	$CRTCH(CRT)
;	(Return)
;
;.end literal
;-

XXXTCH:	SKIPN	INSFLG		; In insert character mode ?
	 PJRST	SC$CHR		; No - Type the character
	PUSH	P,T1		; Save T1
	MOVX	T1,<BYTE (7).CHESC,"O"> ; Get the string
	PUSHJ	P,SC$STR	; Type the string
	POP	P,T1		; And return
	SETZM	INSFLG		; Not in insert mode now
	PJRST	SC$CHR		; Type the character
	SUBTTL	Support routines -- XXX -- Delete N lines

;+
;.HL1 XXXDLL
;This routine will cause N lines to be deleted from the screen.  It is
;called with a repeat count.
;.literal
;
; Usage:
;	MOVEI	T1,Repeat.count
;	MOVEI	CRT,CRT.block.address
;	XCT	$CRDLL(CRT)
;	(Return)
;
;.end literal
;-

XXXDLL:	$SAVE	<P1>		; Save P1
	MOVE	P1,T1		; Copy the repeat count
XXXDL0:	MOVX	T1,<BYTE (7).CHESC,"M"> ; Get the text to send
	PUSHJ	P,SC$STR	; Output the string
	SOJG	P1,XXXDL0	; Loop for all the lines
	POPJ	P,		; Return
	SUBTTL	Support routines -- XXX -- Insert N lines

;+
;.HL1 XXXINL
;This routine will cause N lines to be inserted on the screen.  It is
;called with a repeat count.
;.literal
;
; Usage:
;	MOVEI	T1,Repeat.count
;	MOVEI	CRT,CRT.block.address
;	XCT	$CRINL(CRT)
;	(Return)
;
;.end literal
;-

XXXINL:	$SAVE	<P1>		; Save P1
	MOVE	P1,T1		; Copy the count
XXXIN0:	MOVX	T1,<BYTE (7).CHESC,"L"> ; Get the text to send
	PUSHJ	P,SC$STR	; Output the string
	SOJG	P1,XXXIN0	; Loop for all the lines
	POPJ	P,		; Return to the caller
	SUBTTL	Support routines -- XXX -- Delete a character

;+
;.HL1 XXXDCH
;This routine will cause n characters to be deleted from the screen.
;It is assumed that all cursor positioning has been done before this
;routine is called.
;.literal
;
; Usage:
;	MOVX	T1,Number.of.character.to.delete
;	MOVEI	CRT,CRT.block.address
;	XCT	$CRDCH(CRT)
;	(Return)
;
;.end literal
;-

XXXDCH:	$SAVE	<P1>		; Save P1
	MOVE	P1,T1		; Copy the value
XXXCI0:	MOVX	T1,<BYTE (7).CHESC,"N"> ; Get the string to delete a char
	PUSHJ	P,SC$STR	; Type it
	SOJG	P1,XXXCI0	; Loop back
	POPJ	P,		; Return to the caller
	SUBTTL	Support routines -- XXX -- Cost initialization routine

;+
;.hl 1 XXXCIN
; This routine will return the initial cost word for the character
;by character comparison of a line.
;.b.lit
;
; Usage:
;	MOVE	CRT,CRTTYP
;	PUSHJ	P,@$CRCIN(CRT) or XCT $CRCIN(CRT)
;	 (return, first array element in T1)
;
;.end literal
;-

	CS$INS==1		; Term dependent info - terminal in insert mode

XXXCIN:	MOVX	T1,<INSVL.(0,CS$DEP)>!<INSVL.($OPACH,CS$OPR)>
	SKIPE	INSFLG		; In insert mode?
	 MOVX	T1,<INSVL.(CS$INS,CS$DEP)>!<INSVL.($OPACH,CS$OPR)>
	POPJ	P,		; Return the cost word
	SUBTTL	Support routines -- XXX -- Replacement cost calculation

;+
;.hl 1 XXXCRP
; This routine will return the cost of replacing a character in the
;line.
;.b.lit
;
; Usage:
;	MOVE	T1,CST entry
;	MOVE	X,[-n,,Column]
;	MOVE	Y,[-n,,Row]
;	MOVE	CRT,CRTTYP
;	XCT	$CRCRP(CRT)
;	 (return, T1=CST entry
;
;.end literal
;-

XXXCRP:	MOVE	T2,T1		; Copy the old word
	MOVX	T1,<<INSVL.($OPRCH,CS$OPR)>!<INSVL.(1,CS$CST)>> ; Get the operation
	TXNN	T2,<INSVL.(CS$INS,CS$DEP)> ; Check if in insert mode
	 POPJ	P,		; No, return now
	STORI.	3,T2,CSTCST,+T1	; Store the cost if we are coming from insert mode
	POPJ	P,		; And return
	SUBTTL	Support routines -- XXX -- Insert cost calculation

;+
;.hl 1 XXXCIC
; This routine will return the cost of inserting a character in the
;line.
;.b.lit
;
; Usage:
;	MOVE	T1,CST entry
;	MOVE	X,[-n,,Column]
;	MOVE	Y,[-n,,Row]
;	MOVE	CRT,CRTTYP
;	XCT	$CRCIC(CRT)
;	 (return, T1=CST entry
;
;.end literal
;-

XXXCIC:	MOVE	T2,T1		; Get a copy of the old entry
	MOVX	T1,<<INSVL.(CS$INS,CS$DEP)>!<INSVL.($OPICH,CS$OPR)>!<INSVL.(1,CS$CST)>>
	TXNE	T2,<INSVL.(CS$INS,CS$DEP)> ; Already in insert mode?
	 POPJ	P,		; Yes, return
	STORI.	3,T2,CSTCST,+T1	; Store the cost if we must put into insert mode
	POPJ	P,		; And return
	SUBTTL	Support routines -- XXX -- Delete cost calculation

;+
;.hl 1 XXXCDC
; This routine will return the cost of deleting a character in the
;line.
;.b.lit
;
; Usage:
;	MOVE	T1,CST entry
;	MOVE	X,[-n,,Column]
;	MOVE	Y,[-n,,Row]
;	MOVE	CRT,CRTTYP
;	XCT	$CRCDC(CRT)
;	 (return, T1=CST entry
;
;.end literal
;-

XXXCDC:	ANDX	T1,CS$DEP	; Keep only the dependant portion
	TXO	T1,<<INSVL.($OPDCH,CS$OPR)>!<INSVL.(2,CS$CST)>> ; Store the operation
	POPJ	P,		; And return
	SUBTTL	Support routines -- XXX -- Move cost calculation

;+
;.hl 1 XXXCPP
; This routine will return the cost of moving the cursor from
;one point to another.
;.b.lit
;
; Usage:
;	MOVE	T1,[XWD X pos,Y pos] ; Source position
;	MOVE	X,[-n,,Column]
;	MOVE	Y,[-n,,Row]
;	MOVE	CRT,CRTTYP
;	XCT	$CRCPP(CRT)
;	 (return, T1= cost in characters)
;
;.end literal
;-

XXXCPP:	MOVE	T3,T2		; Get a copy of where we are moving to
	XOR	T3,T1		; Xor together
	JUMPE	T3,.RET0	; Return a zero if not moving
	TXNN	T3,LH.ALF	; Same X position line ?
	 JRST	XXXCPY		; Yes - Check more
	TXNN	T3,RH.ALF	; Same Y position ?
	 JRST	XXXCPX		; Yes - Check more
	JUMPE	T2,.RET2	; If moving home return cost of two
XXXCPA:	MOVX	T1,4		; Have to type four characters
	POPJ	P,		; Return

; Here if possible same column movement

XXXCPY:	MOVEI	T2,(T2)		; Get just the Y position
	SUBI	T2,(T1)		; Determine if just one line movement
	MOVM	T1,T2		; . . .
	SOJG	T1,XXXCPA	; More than one - use four
	JUMPL	T2,.RET2	; If less than zero return two
	JRST	.RET1		; Else return one

; Here if possible same line movement

XXXCPX:	HLRZ	T2,T2		; Get just the X position
	JUMPE	T2,.RET1	; If moving to the beginning of the line
				;  then return one
	HLRZ	T1,T1		; See if moving only one position
	SUBI	T1,T2		; . . .
	MOVM	T2,T1		; Get the magntude
	SOJG	T2,XXXCPA	; If more than one - return four
	JUMPL	T1,.RET1	; If backing up then only one
	JRST	.RET2		; Else return two
	SUBTTL Support routines -- XXX -- Delete to End of line

;+
;.hl1 XXXDEL
;This routine will delete to the end of the line.
;.literal
;
; Usage:
;	MOVEI	T1,# of characters to delete
;	XCT	$CRDEL(CRT)
;
;.end literal
;-

XXXDEL:	MOVX	T1,<BYTE (7) .CHESC,"K">
	PJRST	SC$STR		; Print out the string
	SUBTTL	Low segment for TECXXX


	$IMPURE

XXXBEG:!
INSFLG:	BLOCK	1		; Flag whether we are in insert mode (0 if not)

	LOWVER(XXX,<.-XXXBEG>)	; Define the version number
	SUBTTL	End of TECXXX

	END			; End of TECXXX