Google
 

Trailing-Edge - PDP-10 Archives - tops20_version7_0_tools_tape_clock_tape - tools/sed/sed.pos
There are 13 other files named sed.pos in the archive. Click here to see a list.
;COPY INTO YOUR TERMINAL-DEPENDENT MODULE, OR USE AS GUIDES

;CONTAINS PAIRS OF ROUTINES: THE FIRST POSITIONS TO ROW (RW) COLUMN (CM)
;THE SECOND POSITIONS TO THE START OF LINE (T4)
;(RW, CM, AND T4 ARE ACCUMULATORS)
;THE ROUTINES ALL DO A "POPJ P," WHEN DONE

;SUBROUTINES THAT MAY BE CALLED BY THESE ROUTINES:

;MOVE  T1,NUMBER       ;PUTNUM - OUTPUT DECIMAL NUMBER IN T1
;PUSHJ P,PUTNUM

;MOVEI T1,[ASCIZ /STRING/] ;PUTSTG - OUTPUT STRING POINTED TO BY T1
;PUSHJ P,PUTSTG

;MOVE  T1,[ASCII /CHARS/] ;PUTSQ1 - OUTPUT UP TO 5 CHARACTERS IN 1
;PUSHJ P,PUTSQ1

;MOVEI T1,"X"    ;OUTPUT A SINGLE CHARACTER
;IDPB  T1,TY

;PUSHJ P,PUTTYP  ;OUTPUT THE TYPE BUFFER TO THE TERMINAL
                 ;(NORMALLY THIS WILL BE DONE AFTER THESE ROUTINES RETURN)

;*****************************************************************************
;OUTPUT ROW+37, COLUMN+37; STARTING ROW, COLUMN ARE [1,1]
;USED BY VT52, ADM2

;MOVE TO ROW (RW), COLUMN (CM)

POSCUR:	MOVE	T1,[BYTE (7) 33,"Y"]
	PUSHJ	P,PUTSQ1	;START IT OFF
	MOVEI	T1,40(RW)	;GET ROW POSITION
	IDPB	T1,TY
	MOVEI	T1,40(CM)	;GET COLUMN POSITION
	IDPB	T1,TY
	POPJ	P,		;DONE

;MOVE TO START OF LINE (T4)

POSLIN:	MOVE	T1,[BYTE (7) 33,"Y"]
	PUSHJ	P,PUTSQ1	;START IT OFF
	MOVEI	T1,40(T4)	;GET ROW POSITION
	IDPB	T1,TY
	MOVEI	T1,40		;MOVE TO COLUMN ZERO
	IDPB	T1,TY
	POPJ	P,

;*****************************************************************************
;OUTPUT ROW IN DECIMAL, ";", COLUMN IN DECIMAL, "H"
;USED BY VT100

;MOVE TO ROW (RW), COLUMN (CM)

POSCUR:	MOVE	T1,[BYTE (7) 33,"Y"]
	PUSHJ	P,PUTSQ1	;START IT OFF
	MOVEI	T1,1(RW)	;GET ROW POSITION
	PUSHJ	P,PUTNUM
	MOVEI	T1,";"		;THEN A SEMICOLON
	IDPB	T1,TY
	MOVEI	T1,1(CM)	;GET COLUMN POSITION
	PUSHJ	P,PUTNUM
	MOVEI	T1,"H"		;THEN AN H
	IDPB	T1,TY
	POPJ	P,		;DONE

;MOVE TO START OF LINE (T4)

POSLIN:	MOVE	T1,[BYTE (7) 33,"Y"]
	PUSHJ	P,PUTSQ1	;START IT OFF
	MOVEI	T1,1(T4)	;GET ROW POSITION
	PUSHJ	P,PUTNUM
	MOVE	T1,[ASCII /;0H/]
	JRST	PUTSQ1		;OUTPUT IT AND RETURN

;*****************************************************************************
;OUTPUT ROW AS TWO DECIMAL DIGITS; LIKEWISE COLUMN. HOME IS [0,0]
;USED BY ONTEL

;MOVE TO ROW (RW), COLUMN (CM)

POSCUR:	MOVE	T1,[BYTE (7) 33,"Y"]
	PUSHJ	P,PUTSQ1	;START IT OFF
	MOVE	T1,RW		;GET ROW POSITION
	IDIVI	T1,12
	ADDI	T1,"0"
	IDPB	T1,TY
	MOVEI	T1,"0"(T2)
	IDPB	T1,TY

	MOVE	T1,CM		;GET COLUMN POSITION
	IDIVI	T1,12
	ADDI	T1,"0"
	IDPB	T1,TY
	MOVEI	T1,"0"(T2)
	IDPB	T1,TY
	POPJ	P,		;DONE

;MOVE TO START OF LINE (T4)

POSLIN:	MOVE	T1,[BYTE (7) 33,"Y"]
	PUSHJ	P,PUTSQ1	;START IT OFF
	MOVE	T1,T4		;GET ROW POSITION
	IDIVI	T1,12
	ADDI	T1,"0"
	IDPB	T1,TY
	MOVEI	T1,"0"(T2)
	IDPB	T1,TY
	MOVEI	T1,"0"		;MOVE TO COLUMN ZERO
	IDPB	T1,TY
	IDPB	T1,TY
	POPJ	P,		;DONE

;*****************************************************************************
;USED BY NIH DELTA DATA 7000

;MOVE TO ROW (RW), COLUMN (CM)

POSCUR:	MOVE	T1,[BYTE (7) 33,"Y"]
	PUSHJ	P,PUTSQ1	;START IT OFF
	SETCMI	T1,(CM)		;GET COLUMN POSITION
	IDPB	T1,TY
	SETCMI	T1,(RW)		;GET ROW POSITION
	IDPB	T1,TY
	POPJ	P,		;DONE

;MOVE TO START OF LINE (T4)

POSLIN:	MOVE	T1,[BYTE (7) 33,"Y"]
	PUSHJ	P,PUTSQ1	;START IT OFF
	SETO	T1,		;SET TO COLUMN ZERO
	IDPB	T1,TY
	SETCMI	T1,(T4)		;GET ROW POSITION
	IDPB	T1,TY
	POPJ	P,		;DONE

;*****************************************************************************
;USED BY HAZELTINE 1420

;MOVE TO ROW (RW), COLUMN (CM)

POSCUR:	MOVE	T1,[BYTE (7) 176,21]
	PUSHJ	P,PUTSQ1	;START IT OFF
	MOVEI	T1,(CM)		;GET COLUMN POSITION
	JUMPN	T1,.+2
	ADDI	T1,^D96
	IDPB	T1,TY
	HRRZ	T1,RW		;GET ROW POSITION
POSCR1:	JUMPN	T1,.+2
	ADDI	T1,^D96
	IDPB	T1,TY
	POPJ	P,

;MOVE TO START OF LINE (T4)

POSLIN:	MOVE	T1,[BYTE (7) 176,21]
	PUSHJ	P,PUTSQ1	;START IT OFF
	MOVEI	T1,^D96		;SET TO COLUMN ZERO
	IDPB	T1,TY
	MOVEI	T1,(T4)		;GET ROW POSITION
	JRST	POSCR1		;FINISH WITH ROW

;*****************************************************************************
;ROUTINES FOR A TERMINAL WHICH CANNOT POSITION ABSOLUTELY:
;GOES HOME AND MOVES TO THE PROPER POSITION

;MOVE TO ROW (RW), COLUMN (CM)

POSCUR:	PUSHJ	P,CHOME 	;SIMULATE POSITIONING: GO HOME
	SKIPN	T2,RW		;WANT TO MOVE DOWN?
	JRST	POSCR1		;NO - SKIP THIS
	PUSHJ	P,CDOWN
	SOJG	T2,.-1
POSCR1:	SKIPN	T2,CM		;WANT TO MOVE ACROSS?
	POPJ	P,		;NO - SKIP THIS
	PUSHJ	P,CRIGHT
	SOJG	T2,.-1
	POPJ	P,		;VERY VERY CRUDE

;MOVE TO START OF LINE (T4)

POSLIN:	PUSHJ	P,CHOME 	;SIMULATE POSITIONING: GO HOME
	SKIPN	T2,T4		;WANT TO MOVE DOWN?
	POPJ	P,		;NO - SKIP THIS
	PUSHJ	P,CDOWN
	SOJG	T2,.-1
	POPJ	P,		;STILL VERY CRUDE

;*****************************************************************************
;ROUTINES TO CLEAR TO END OF LINE AND PAGE IF TERMINAL CANNOT DO EITHER
;SIMULATE THE CLEAR BY OUTPUTTING THE RIGHT NUMBER OF SPACES
;NOTE: THESE ARE TOLERABLE ONLY ON A FAST (9600) TERMINAL

;SUBROUTINE TO CLEAR TO END OF LINE - OUTPUTS CPL-(T0) SPACES

CLRLIN:	SUBI	T0,CPL		;FIND NUMBER OF SPACES TO OUTPUT
	MOVNS	T0
	MOVEI	T1," "		;GET A SPACE
	IDPB	T1,TY		;SPACE OVER
	SOJG	T0,.-1		;DO ALL THE SPACES
	POPJ	P,		;DONE

;SUBROUTINE TO CLEAR TO THE END OF THE PAGE. CLEARS TO THE END OF THE LINE
;BY CALLING CLRLIN, THEN OUTPUTS CPL SPACES FOR EACH REMAINING LINE ON THE PAGE

;beware: this will probably fill up the type buffer

CLRPAG:	PUSHJ	P,CLRLIN	;CLEAR TO THE END OF THE CURRENT LINE
	MOVEI	T0,LPP		;FIND NUMBER OF LINES THAT REMAIN
	SUB	T0,RW
	PUSH	T2,		;SAVE A WORK AC
	MOVEI	T1," "		;GET A SPACE
CLRPG1:	MOVEI	T2,CPL		;CLEAR AN ENTIRE LINE
	IDPB	T1,TY		;SPACE OVER
	SOJG	T2,.-1		;DO ALL THE SPACES FOR THIS LINE
	SOJG	T0,CLRPG1	;LOOP THROUGH ALL LINES
	POPJ	P,		;THEN DONE

;SUBROUTINE TO GO HOME AND CLEAR THE PAGE

CLRALL:	PUSHJ	P,CHOME		;GO HOME
	PUSH	P,RW		;SAVE CURRENT ROW
	SETZB	RW,T0		;NOTE THAT CURSOR IS HOME
	PUSHJ	P,CLRPAG	;CLEAR ENTIRE SCREEN
	POP	P,RW		;GET REAL ROW BACK AGAIN
	POPJ	P,		;DONE