Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-12 - 43,50547/pltlib/v12/plttek.mac
There are 2 other files named plttek.mac in the archive. Click here to see a list.
SUBTTL	TEKTRONIX 4010-series Graphics Terminals

;	  These routines will drive the following Tektronix terminals:
;	4006, 4010, 4012, 4014, 4015, 4016, 4025, and others.
;
;	The 4010 is a storage-tube device, all vectors and character data
;	remain on the screen until the entire screen is erased.  The
;	4025 is a raster scan device.  All terminals in the 4010 series
;	use the same set of commands for plotting, the 4014 and 4016 have
;	a larger screen and higher resolution.



SUBTTL	Revision History for PLTTEK.MAC

;Edit	  Date	   Who          Description
;----   ---------  ---  ----------------------------------------------------
; 500	26-Jul-82  JMS	Major changes.
;
; 510	22-Oct-82  JMS	Set up the 4025 terminal properly.
;
;End of Revision History for PLTTEK
	COMMENT &

ESCAPE-FORMFEED erases the screen.
ESCAPE-CONTROL-Z turns on the crosshairs (not on 4006 or 4025)
ESCAPE-A-E enables the interactive plotter
ESCAPE-A-F turns off the interactive plotter
CONTROL-] turns on plot mode, the first move will be with beam off.
CONTROL-UNDERLINE turns off plot mode.  (CR also works for all but 4025.)

The plot commands are characters which specify the absolute position
to move the beam.  All moves except the one immediately after ^] are
with a visible trace.  The positions are from 0 to 1023 for both X
and Y, although only 0 to 780 is visible for Y due to screen geometry.

The positions are specified by two characters for Y and two for X.
6 bits of position are encoded in the 6 low-order bits of the ASCII
characters.  The first of the two characters is punctuation and is
the high-order part of the position, the second is alphabetic and is
the low-order part of the position.  The low-order for Y is always
a lower-case letter, low-order for X is an upper-case letter.  The
beam movement is triggered by receiving the low-order X letter.

Not all four characters need be sent to the TEKTRONIX, if part of
the position is the same as the previous.

	Hi Y	Lo Y	Hi X	 Characters sent (Lo-X always sent)
	----	----	----	----------------------
	Same	Same	Same	                  Lo-X
	Same	Same	Diff	      Lo-Y, Hi-X, Lo-X
	Same	Diff	Same	      Lo-Y,       Lo-X
	Same	Diff	Diff	      Lo-Y, Hi-X, Lo-x
	Diff	Same	Same	Hi-Y,             Lo-X
	Diff	Same	Diff	Hi-Y, Lo-Y, Hi-X, Lo-X
	Diff	Diff	Same	Hi-Y, Lo-Y,       Lo-X
	Diff	Diff	Diff	Hi-y, Lo-Y, Hi-X, Lo-X
Offset for byte:                 40   * 140   40   100

Note that Lo-Y must be sent before Hi-X, so the TEKTRONIX knows that the
punctuation character is Hi-X and not Hi-Y.

* If 2 Lo-Y bytes are sent in a row, most terminals will use the second one
  and ignore the first.  The 4014 uses this extra byte for high-resolution.
  The byte is 140 + MARGIN*20 + LSBY*4 + LSBX.
&	;End of COMMENT
SUBTTL	PPDATA macro expansion

TEKBYT==INSVL.(^D36,IN.BYT)!INSVL.(.IOIMG,IN.MOD) ;1 byte per word, image mode
TEKFLG==SP.CLR!SP.XHR	;Special routines are ERASE and XHAIRS
TEKINC==100.0		;Increments per inch
TEKMAX==^D1023,,^D780	;Max X and Y increments
TEKTYP==P4.TTY		;This is a graphics terminal
TEKEXT==SIXBIT/TEK/	;Output extension

  DEFINE	LCDATA,<	;Local data
XBLOCK (TEKHIY,1)	;Must be in this order: HIY,HIR,LOY,HIX,LOX
XBLOCK (TEKHIR,1)	;Hi resolution (4014, 4016)
XBLOCK (TEKLOY,1)	;These 5 words
XBLOCK (TEKHIX,1)	; keep track of what has
XBLOCK (TEKLOX,1)	; been sent to the terminal
  >  ;End of DEFINE LCDATA




	PPDATA	(TEK)		;Expand data area
SUBTTL	Database

;Special characters
	TEK.XH==32	;ESCape Control-Z triggers the crosshairs
	TEK.GR==35	;Control-] starts graph mode, 1st move with beam off
	TEK.TX==37	;Control-_ restores text mode
ON4662:	BYTE (7) ESC,"A","E",0		;Enable 4662 interactive plotter
OF4662:	BYTE (7) TEK.TX,ESC,"A","F",0	;Disable 4662 interactive plotter

;List of names for Tektronix terminals

TEKNAM:	DEC	3	;Data for PLOTS - IPLT=3 for subroutine WHERE
	ASCII /TEK/	;Generic, 4010 compatible
	ASCII /TEKTR/
	ASCII /LTEK/	;Low resolution TEK
	ASCII /HTEK/	;High resolution TEK
	DEC	4006	;11", no XHAIRS, no lowercase
	DEC	4010	;11", no lowercase
	DEC	4012	;11", standard storage tube with lowercase and XHAIRS
	DEC	4014	;19", hi-res optional (4015=4014+APL)
	DEC	4016	;25", hi-res
	DEC	4025	;12", raster scan, special setup, XHAIRS optional
	DEC	4027	;12", raster scan, color, special setup
	DEC	4051	;11", hi-res, 8-bit computer
	DEC	4052	;11", hi-res, 16-bit computer
	DEC	4054	;19", hi-res, 16-bit computer
;*;	DEC	4112	;15", hi-res, raster scan, 8-level gray, picture segment
;*;	DEC	4113	;19", hi-res, raster scan, color, picture segment
;*;	DEC	4114	;19", hi-res, picture segment
	DEC	4662	;Interactive plotter
	DEC	4663	;Interactive plotter
TEKLEN==.-TEKNAM
SUBTTL	INItialize, FINish, and Pause


;Routine to initialize the Tektronix graphics terminal

TEKINI:	TXNN	P4,P4.TTY	;Output going to a TTY?
	 JRST	TEKCL1		;No, do not send initial ESC-FF
	MOVEI	T1,[ASCIZ /
!WORKSPACE 30
!GRAPHIC 1,29
!SHRINK
/]				;Set up the 4025 terminal
	PUSHJ	P,OUTSTG	; for 30 lines of graphics an 4 lines text
	PFALL	TEKCLR		;Clear the screen

;Routine to clear the screen

TEKCLR:	MOVEI	T1,[BYTE (7)ESC,FF,0]	;Escape-formfeed clears the screen
	PUSHJ	P,OUTDMP	;Send string to terminal
	MOVEI	T1,^D750	;3/4 second
	TXNE	P4,P4.TTY	;Output to a TTY?
	 PUSHJ	P,TOWAIT	;Wait a bit for the screen to settle

TEKCL1:	MOVEI	T1,ON4662	;Turn on the interactive plotter
;*;	PUSHJ	P,OUTSTG
	SETZB	X,Y		;Clear coordinates
	DMOVEM	X,CURR.X(P4)	; ...
	DMOVEM	X,OLDP.X(P4)	; ...
	SETZB	T1,TEKHIY(P4)	;Pen is up, zero saved coords
	SETZM	TEKHIR(P4)	;(This is a
	SETZM	TEKLOY(P4)	; little faster
	SETZM	TEKHIX(P4)	; than a BLT)
	PJRST	TEKMOV		;Set graphics mode and go to (0,0)

		PAGE
;Finish plot by resetting to text mode at upper left corner, go beep

TEKFIN:	MOVEI	T1,[BYTE (7)TEK.GR,70,153,40,100,TEK.TX,7,0]
;*;	MOVEI	T1,[BYTE (7)TEK.GR,70,153,40,100,TEK.TX,ESC,"A","F",7,0]  ;4662
	PJRST	OUTDMP		;Eight, lower k, space, at sign, FS, bell

;Routine to cause plotter to pause and wait for a linefeed
;T1=-1 to pause, T1=0 to turn graphics off, T1=+1 to resume graphics

TEKPAS:	MOVE	T2,T1		;Save argument
	TXNN	P4,P4.TTY	;Output going to a TTY?
	 POPJ	P,		;No, cannot pause
	JUMPG	T2,TEKON	;Resume graphics if +1
	JUMPE	T2,TEKOFF	;Change to text mode if 0, pause if -1
	MOVEI	T1,[BYTE (7)TEK.TX,7,0]	;Text mode, bell
	PUSHJ	P,OUTDMP	;Output it
	PUSHJ	P,INCHR		;Input a character
	PJRST	TEKPOS		;Reposition beam and return

TEKOFF:	MOVEI	T1,OF4662	;Set text mode
	PJRST	OUTDMP		;Tell terminal to turn off graphics
SUBTTL	TEKMOV - Move to beam to new position


;  Calling sequence:
;	DMOVE	X,(position in increments)
;	SETO	T1,	;-1 for pen down, 0 for pen up
;	PUSHJ	P,TEKMOV
;	 *return*

TEKMOV:	MOVEM	T1,CURR.P(P4)	;Set pen up/down status
	DMOVEM	X,CURR.X(P4)	;Store position pen will be in
	JUMPL	T1,TEKDWN	;Continue if pen is down
	MOVEI	T1,TEK.GR	;Tell the TEKTRONIX we are entering graph mode
	PUSHJ	P,OUTBYT	;First movement after GRFMOD is always invisible

TEKDWN:	MOVE	T1,X		;Get coordinate
	IDIVI	T1,40		;Split
	TRO	T1,40		;Bit for Hi-X
	TRO	T2,100		;Bit for Lo-X
	CAME	T1,TEKHIX(P4)	;Same as last time?
	 HRROM	T1,TEKHIX(P4)	;No, flag it
	HRROM	T2,TEKLOX(P4)	;Always output lo-X
	MOVE	T1,Y		;Get coordinate
	IDIVI	T1,40		;Split
	TRO	T1,40		;Bit for Hi-Y
	TRO	T2,140		;Bits for Lo-Y
	CAME	T1,TEKHIY(P4)	;Same as last time?
	 HRROM	T1,TEKHIY(P4)	;No, flag it
	CAME	T2,TEKLOY(P4)	;Same as last time?
	 HRROM	T2,TEKLOY(P4)	;No, flag it
	SKIPGE	TEKHIX(P4)	;If hi-X changed,
	 HRROS	TEKLOY(P4)	; set to output lo-Y

	MOVEI	T2,TEKHIY(P4)	;Point to first byte
	HRLI	T2,-5		;Counter

TEKOUT:	HRRZ	T1,(T2)		;Get the byte
	SKIPGE	(T2)		;If this byte as changed,
	 PUSHJ	P,OUTBYT	; output it
	HRRZS	(T2)		;Reset to positive number
	AOBJN	T2,TEKOUT	;Loop for more

	POPJ	P,		;Return
SUBTTL	XHAIRS - allow the user the use the crosshairs

;  Calling sequence:
;	CALL XHAIRS (XPOS, YPOS, LETTER, ISTRNG)
;  ISTRNG is optional

TEKSPC:	TXNE	T1,SP.CLR	;Is this a call to ERASE?
	 JRST	TEKCLR		;Yes
	TXNN	T1,SP.XHR	;Call to XHAIRS?
	 POPJ	P,		;No

;Trigger the crosshairs

XHAIR:	TXNN	P4,P4.TTY	;Output going to a TTY?
	 JRST	[ERRSTR	(<% XHAIRS works with Tektronix terminals only>)
		 PJRST	TRACE.##]  ;Trace back from PUSHJ P,%XHAIRS
	MOVEI	T1,TEK.XH	;Display the crosshairs
kludge==-1
ife kludge,<	MOVE	T2,[^D5,,0]	;Byte count ,, terminator
		PUSHJ	P,RDTBIN >	;Prompt and read TTY in binary mode
ifn kludge,<
	PUSHJ	P,OUTDMP	;Put in buffer
	PUSHJ	P,CLSFIL	;Close file (but keep channel INITed)
	PUSHJ	P,CLRIB		;Clear input buffer

;Nulls and Control-C can be read in Packed Image Mode

	MOVE	T1,BUFR.N(P4)	;Get channel number
	HRRI	T1,.FORED	;Set for input
	MOVEM	T1,FLP+.FOFNC
	MOVEI	T1,^D8		;8-bit bytes
	MOVEI	T2,.IOPIM	;Packed image mode
	PUSHJ	P,REOPEN	;PIM works for INCHR even with no input buffer

	MOVE	T1,[POINT 7,@3(L)] ;Put the characters in 4th arg
	HLRZ	T2,-1(L)	;Get the number of args
	CAIL	T2,-3		;Is it more than 3?
	 MOVE	T1,[POINT 7,TEMP] ;No, put chars in TEMP
	MOVEM	T1,HEADBP	;Store byte pointer
	SETZM	(T1)		;Clear the string
	SETZB	X,Y		;Clear position

;Read in 5 bytes from the terminal.  Single Control-C will not stop execution.

	PUSHJ	P,INCHR		;Get the first character from the TTY
	MOVEM	T1,@2(L)	;Store LETTER

	PUSHJ	P,INCHR		;Get Hi-X
	CAIN	T1,3		;Control-C as second character?
	 JRST	[ERRSTR	(<^C>)	  ;Show that Control-C was noticed
		 MONRT.		  ;Quiet exit to monitor level
		 JRST	XHAIR1	] ;Allow ".CONTINUE"
	ANDI	T1,37		;Only 5 bits
	DPB	T1,[POINT 5,X,30];put in right position
	PUSHJ	P,INCHR		;Get Lo-X
	ANDI	T1,37		;Only 5 bits
	IORM	T1,X		;Finish X coord

	PUSHJ	P,INCHR		;Get Hi-Y
	ANDI	T1,37		;Only 5 bits
	DPB	T1,[POINT 5,Y,30];put in right position
	PUSHJ	P,INCHR		;Get Lo-Y
	ANDI	T1,37		;Only 5 bits
	IORM	T1,Y		;Finish Y coord

XHAIR1:	PUSHJ	P,OPNFIL	;Reset I/O to output
>  ;end of ifn kludge

	PUSHJ	P,TEKPOS	;Return to previous position
	PUSHJ	P,RXHAR3	;Return arguments to caller
	JUMPE	T1,TEKCLR	;Erase the screen on a formfeed
	POPJ	P,		;Return from XHAIRS

RXHAR3:	PUSHJ	P,INC2FP	;Convert increments to floating-point
	MOVE	T1,@2(L)	;Get back first character
	CAIN	T1,FF		;Formfeed?
	 JRST	[SETZB	X,Y	  ;Yes, return zeros for all args
		 SETZ	T1,	  ;Flag to erase the screen
		 JRST	XHAIR2	] ;Store args and return
	CAIGE	T1,40		;Is it a control char?
	 JRST	XHAIR2		;Yes, don't justify
	ROT	T1,-7		;Shift the character into the right place
	OR	T1,[BYTE (7)0," "," "," "," "]
XHAIR2:	MOVEM	X,@0(L)		;Store X in the calling routine
	MOVEM	Y,@1(L)		;Store Y in the calling program
	MOVEM	T1,@2(L)	;Send the character to the caller
	POPJ	P,		;Return

;Routine to re-enable graphics

TEKON:	MOVEI	T1,ON4662	;Tell interactive plotter to turn itself on
	PUSHJ	P,OUTSTG
	PFALL	TEKPOS

;TEKPOS - Return to previous position.  Preserves X and Y accumulators

TEKPOS:	MOVEI	T1,TEK.GR	;Tell the TEKTRONIX
	PUSHJ	P,OUTBYT	; to switch to graphics mode
	MOVEI	T2,TEKHIY(P4)	;Point to data
	HRLI	T2,-5		;5 variables
TEKPO1:	SKIPE	T1,(T2)		;Get a byte
	 PUSHJ	P,OUTBYT	;Send to terminal
	AOBJN	T2,TEKPO1
	POPJ	P,

LITTEK:	LIT

		PAGE		;End of PLTTEK.MAC