Google
 

Trailing-Edge - PDP-10 Archives - tops10_tools_bb-fp64b-sb - 10,7/sed/sedx.mac
There are 13 other files named sedx.mac in the archive. Click here to see a list.
TITLE	SEDX - SKELETON EDITOR TERMINAL DEFINITION PROGRAM
SUBTTL	A CHRISTOPHER HALL FECIT

;LOAD THE EDITOR BY: .LOAD SEDSYM,SEDX,SED
;		     .SS SED

	SEARCH	SEDSYM
IFE TOPS10,<SEARCH MONSYM>

	EXTERN	CPOPJ,PUTTYP,PUTSTG,PUTSQ1,PUTNUM,TRMNAM,TYPBUF,HOMPOS
	EXTERN	CHOME,CDOWN,CRIGHT
	INTERN	TERMNL

FTFAST==0	;SET THIS IF TERMINAL SENDS OUT XON-XOFF'S

TERMNL:	OTABLE	;ADDRESS OF THE TERMINAL TABLE TO USE

;TERMINAL OUTPUT TABLE - SEQUENCES TO MAKE THE TERMINAL DO SPECIAL THINGS
;FILL IN WITH THE CODES FOR YOUR TERMINAL

OTABLE:	BYTE (7) 0		;CURSOR UP
	BYTE (7) 0		; DOWN
	BYTE (7) 0		; RIGHT
	BYTE (7) 0		; LEFT
	BYTE (7) 0		; HOME
	BYTE (7) 0		;CLEAR TO END OF PAGE
	BYTE (7) 0		;CLEAR TO END OF LINE
	BYTE (7) 0		;ROLL UP AND CLEAR LINE
	BYTE (7) 0		;ROLL DOWN AND CLEAR LINE
	BYTE (7) 0		;PROTECT ON (0 IF NONE)
	BYTE (7) 0		;PROTECT OFF (0 IF NONE)
	BYTE (7) 0		;INSERT LINE (0 IF NONE)
	BYTE (7) 0		;INSERT SPACE (0 IF NONE)
	BYTE (7) 0		;DELETE LINE (0 IF NONE)
	BYTE (7) 0		;DELETE SPACE (0 IF NONE)
	BYTE (7) 0		;MOVE TO BOTTOM
	BYTE (7) 0		;HOME AND CLEAR ENTIRE PAGE
	POSCUR			;ROUTINE TO POSITION TO CHARACTER
	POSLIN			;ROUTINE TO POSITION TO START OF LINE
	^D24			;LINES PER PAGE
	^D80			;CHARACTERS PER LINE
IFE FTFAST,<
	0			;TERMINAL-DEPENDENT FLAGS
>
IFN FTFAST,<
	NPG			;TERMINAL-DEPENDENT FLAGS (KEEP TTY PAGE)
>
	CPOPJ			;ROUTINE TO CALL ON ENTRY
	CPOPJ			;ROUTINE TO CALL ON EXIT
	0,,0			;NUMBER OF NULLS TO OUTPUT,,NULL CHARACTER
	ITABLE			;ADDRESS OF INPUT CHARACTER TABLE
	0			;MARK TO DISPLAY ON ENTER (OMIT IF MRK NOT SET)

;TERMINAL INPUT TABLE - TELLS WHAT CONTROL CHARACTERS OR SEQUENCES
;INVOKE WHICH COMMANDS

IFE FTFAST,<
	EXP	$RESET				;RUBOUT
ITABLE:	EXP		$RECAL, $INSSP, $SETFI	;   0, A, B
	EXP	$ABORT, $INSLN, $SRCBK, $DELLN	;C, D, E, F
	EXP	$PUT,   $DELCH, $TAB,   $ERSLN	;G, H, I, J
	EXP	$SLDLF, $SLDRT, $RETRN, $SWTCH	;K, L, M, N
	EXP	$ENTCC, $GOTO,  $RLBKP, $SRCFW	;O, P, Q, R
	EXP	$DELSP, $RLFWL, $BKTAB, $PICK	;S, T, U, V
	EXP	$RLBKL, $EXEC,  $RLFWP, $EXIT	;W, X, Y, Z
	EXP	-SIZ.IS,,ISUBTB			;ESCAPE
	EXP	$CURDN, $CURRT, $CURUP, $CURHM	;\, ], ^, _
>
IFN FTFAST,<
;THIS TABLE SETS UP THE KEYBOARD ARRANGEMENT FOR WHEN YOU NEED TO KEEP
;TTY PAGE IN EFFECT BECAUSE THE TERMINAL SENDS OUT ITS OWN CONTROL S AND Q'S
;THOSE TWO CHARACTERS CANNOT BE COMMANDS SINCE SED DOES NOT KNOW WHETHER THE
;USER HAS TYPED THEM OR THEY WERE SENT BY THE TERMINAL.

;SO Q GOES TO A, A AND S GO TO K AND L, K TO ESCAPE-L, AND L TO ESCAPE-T

	EXP	$RESET				;RUBOUT
ITABLE:	EXP		$RECAL, $RLBKP, $SETFI	;   0, A, B
	EXP	$ABORT, $INSLN, $SRCBK, $DELLN	;C, D, E, F
	EXP	$PUT,   $DELCH, $TAB,   $ERSLN	;G, H, I, J
	EXP	$INSSP, $DELSP, $RETRN, $SWTCH	;K, L, M, N
	EXP	$ENTCC, $GOTO,  0,	$SRCFW	;O, P, Q, R
	EXP	0,	$RLFWL, $BKTAB, $PICK	;S, T, U, V
	EXP	$RLBKL, $EXEC,  $RLFWP, $EXIT	;W, X, Y, Z
		-SIZ.IS,,ISUBTB			;ESCAPE
	EXP	$CURDN, $CURRT, $CURUP, $CURHM	;\, ], ^, _
>
;SUBTABLE. PUT THE MOST FREQUENTLY-USED SEQUENCES FIRST
;ENTER IS PROBABLY THE MOST COMMON OF ALL

ISUBTB:	$ENTER,,"P" 	;ESCAPE P == ENTER
	$CURHM,,"R" 	;ESCAPE R == HOME
	$CURUP,,"A" 	;ESCAPE A == UP
	$CURDN,,"B" 	;ESCAPE B == DOWN
	$CURRT,,"C" 	;ESCAPE C == RIGHT
	$CURLF,,"D" 	;ESCAPE D == LEFT
	$RECAL,,"Q" 	;ESCAPE Q == RECALL
	$WINDW,,"W" 	;ESCAPE W == WINDOW
	$WINDW,,"w" 	;ESCAPE w == WINDOW
IFN FTFAST,<
			;IF TTY PAGE IS IN EFFECT,
			;DEFINE SEQUENCES FOR
			;<SLIDE-LEFT> AND <SLIDE-RIGHT> HERE
>
SIZ.IS=.-ISUBTB

;PUT THE CURSOR POSITIONING ROUTINES HERE (SEE SED.POS FOR SAMPLES)
;ALSO PUT ENTRY AND EXIT ROUTINES HERE

COMMENT \
;NOTE:	THE FOLLOWING CODE, UNDER TOPS-10 7.01, WILL READ THE TERMINAL TYPE,
;	IN SIXBIT, INTO T1. THE TYPE IS COMPARED WITH A LIST OF KNOWN TYPES
;	AND THE ADDRESS OF THE RIGHT TERMINAL OUTPUT TABLE IS SET UP:

IFN TOPS10,<
	...
	MOVE	T1,[2,,TRMBLK]	;READ SIXBIT TERMINAL TYPE INTO T1
	TRMOP.	T1,
	  JFCL
	MOVEI	T2,TTBLEN	;FIND THIS TYPE IN THE TERMINAL TABLE
	CAME	T1,TNMTBL(T2)
	SOJGE	T2,.-1
	JUMPL	T2,TRMERR	;NOT FOUND - ERROR (note: no error routine)
	HRR	TM,TADTBL(T2)	;FOUND - GET ADDRESS OF OUTPUT TABLE
	...

TNMTBL:	SIXBIT	/VT52/
	SIXBIT	/VT100/
	SIXBIT	/ADM3A/
TTBLEN=.-TNMTBL-1

TADTBL:	OVT52
	OVT100
	OADB3A

TRMBLK:	1041
	-1
>
IFE TOPS10,<
;THE TERMINAL TYPE CAN BE READ UNDER TOPS20 LIKE THIS:

TENTRY:	MOVEI	T1,.PRIIN	;READ TERMINAL TYPE
	GTTYP
>
;(END OF EXAMPLE CODE)
\
	END