Trailing-Edge
-
PDP-10 Archives
-
decuslib10-12
-
43,50547/plttek.mac
There are 2 other files named plttek.mac in the archive. Click here to see a list.
STTL <PLTTEK - TEKTRONIX 4010-series Graphics Terminals>
TOPS20<;@!Before plotting, the terminal mode must be set up
; @TERMINAL NO INDICATE !Do not show Control-] as ^]
; @TERMINAL FORMFEED !Formfeed is needed to clear TEKTRONIX screen
; @TERMINAL WIDTH 0 !Do not send free CRLF after 80 characters
; @
; @EXECUTE PLOTTING-PROGRAM.FOR,SYS:TEKPLT.REL
> ;End TOPS20
; 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-CONTROL-E (ENQ) requests a status report
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
ESCAPE-M-L-2 Selects color 2 for drawing lines on 4113
ESCAPE-M-T-: Selects color 10 for drawing text on 4113
CONTROL-] (GS) turns on plot mode, the first move will be with beam off.
CONTROL-UNDERLINE (US) turns off plot mode. (CR also works for all but 4025.)
CONTROL-X switches HDSGVT from TEKTRONIX mode to NORMAL alpha mode.
The plot commands are characters which specify the absolute position to move
the beam. All moves except the one immediately after the GS character
(Control-]) are with a visible trace.
For 4010-like devices - The positions are from 0 to 1023 for both X and Y,
although only 0 to 780 are visible for Y due to screen geometry. The screen is
10.23 by 7.80 inches, and coordinates are sent as 1 to 4 characters.
For 4014-like devices - The positions are from 0 to 4096, but each movement
is a multiple of 4 positions unless the high-resolution LSBXY are sent. This
makes it compatible with the 4010 in that a full sized plot fills the screen.
HIX,HIY = High-order 5 bits of position
LOX,LOY = Middle-order 5 bits of position
LSBXY = Low-order 2 bits of X + low-order 2 bits of Y (4014 mode)
Hi Y Lo Y Hi X LSBXY Characters sent (Lo-X always sent)
---- ---- ---- ----- ----------------------------------
Same Same Same Same Lo-X
Same Same Same Diff LSB, Lo-Y, Lo-X 4014
Same Same Diff Same Lo-Y, Hi-X, Lo-X
Same Same Diff Diff LSB, Lo-Y, Hi-X, Lo-X 4014
Same Diff Same Same Lo-Y, Lo-X
Same Diff Same Diff LSB, Lo-Y, Lo-X 4014
Same Diff Diff Same Lo-Y, Hi-X, Lo-X
Same Diff Diff Diff LSB, Lo-Y, Hi-X, Lo-X 4014
Diff Same Same Same Hi-Y, Lo-X
Diff Same Same Diff Hi-Y, LSB, Lo-Y, Lo-X 4014
Diff Same Diff Same Hi-Y, Lo-Y, Hi-X, Lo-X
Diff Same Diff Diff Hi-Y, LSB, Lo-Y, Hi-X, Lo-X 4014
Diff Diff Same Same Hi-Y, Lo-Y, Lo-X
Diff Diff Same Diff Hi-Y, LSB, Lo-Y, Lo-X 4014
Diff Diff Diff Same Hi-y, Lo-Y, Hi-X, Lo-X
Diff Diff Diff Diff Hi-y, LSB, Lo-Y, Hi-X, Lo-X 4014
Offset for byte: 40 140 140 40 100
Note that LO-Y must be sent if HI-X has changed so that the TEKTRONIX knows that
the HI-X byte (in the range of 40-77 octal) is HI-X and not HI-Y. LO-Y must
also be sent if LSBXY has changed, so that the 4010 will ignore LSBXY and
accept LO-Y. The LSBXY byte is 140 + MARGIN*20 + LSBY*4 + LSBX. (MARGIN=0)
& ;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.PEN!SP.XHR ;Special routines are ERASE, NEWPEN, XHAIRS
TEKINY==<TEKINX==400.0> ;Increments per inch (100.0 for 4010)
TEKMAX==^D4095,,^D3120 ;Max X and Y increments (1023 by 780)
TEKTYP==P4.TTY!3 ;This is a graphics terminal, IPLT=3 for WHERE
TEKEXT=='TEK' ;Output extension
DEFINE LCDATA,< ;Local data
XBLOCK (TEKHIY,1) ;Must be in this order: HIY,LSB,LOY,HIX,LOX
XBLOCK (TEKLSB,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.AL==30 ;Control-X for HDSGVT terminal (24 lines of 80 chars)
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 (34 lines of 74 chars)
ON4662: BYTE (7) ESC,"A","E",0 ;Enable 4662 interactive plotter
OF4662: BYTE (7) ESC,"A","F",0 ;Disable 4662 interactive plotter
;List of names for Tektronix terminals
TK.RES==1B0 ;Hi-res terminal (4014 or later)
TK.WOR==1B1 ;Must set up workspace (4025,4027)
TK.PLO==1B2 ;Interactive plotter (4662)
TK.COL==1B3 ;Color commands (4027,4113)
;*; TK.VID==1B4 ;Video (raster) display
DEFINE PLNAM$,<
XX ( 3,TEK, TK.WOR) ;Generic (IPLT=3 for subroutine WHERE)
XX (4006,4006,0) ;11", no XHAIRS, no lowercase
XX (4010,4010,0) ;11", no lowercase
XX (4012,4012,0) ;11", standard storage tube with lowercase and XHAIRS
XX (4014,4014,TK.RES) ;19", hi-res optional (4015=4014+APL)
XX (4016,4016,TK.RES) ;25", hi-res
XX (4025,4025,TK.WOR) ;12", raster scan, special setup, XHAIRS optional
XX (4027,4027,TK.WOR!TK.COL);12", raster scan, color, special setup
XX (4051,4051,0) ;11", hi-res, 8-bit computer
XX (4052,4052,0) ;11", hi-res, 16-bit computer
XX (4054,4054,TK.RES) ;19", hi-res, 16-bit computer
XX (4112,4112,TK.RES!TK.COL);15", hi-res, raster scan, 8-level gray, picture segment
XX (4113,4113,TK.RES!TK.COL);19", hi-res, raster scan, color, picture segment
XX (4114,4114,TK.RES!TK.COL);19", hi-res, picture segment, remembers color
XX (4662,4662,TK.RES!TK.COL!TK.PLO);Interactive plotter
XX (4663,4663,TK.RES!TK.COL!TK.PLO);Interactive plotter
XX ( 3,HDSGVT,0) ;Human Design Systems, emulates TEK 4012
> ;End of DEFINE PLNAM$
DEFINE XX(NUM,NAM,FLAG),<
DEC NUM
ASCII /NAM/
EXP FLAG>
TEKNAM: PLNAM$ ;Table of plotter types
TEKLEN==<.-TEKNAM>/3
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,0 ;Nothing special for 4010
MOVE T2,PLTTYP(P4) ;Does terminal require setup?
;*; TXNE T2,TK.WOR
MOVEI T1,[ASCIZ /
!WORKSPACE 30
!GRAPHIC 1,29
!SHRINK
/] ;Set up the 4025 terminal
TXNE T2,TK.PLO ;4662 or 4663?
MOVEI T1,ON4662 ;Command to turn on the interactive plotter
JUMPE T1,TEKCLR ;Continue if nothing special
PUSHJ P,OUTSTG ;Send set-up command
PFALL TEKCLR ;Clear the screen
;Routine to clear the screen
TEKCLR: MOVEI T1,[BYTE (7)TEK.GR,ESC,FF,0] ;Escape-formfeed clears 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: 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 TEKLSB(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
TEKFIN: MOVEI T1,[BYTE (7)TEK.GR,70,153,40,100,TEK.TX,TEK.AL,0]
PUSHJ P,OUTSTG ;Turn off graphics mode, position upper left
MOVEI T1,OF4662 ;Disable interactive graphics plotter
MOVX T2,TK.PLO ;Is it a 4662 or 4663?
TDNE T2,PLTTYP(P4)
PUSHJ P,OUTSTG
PJRST TTYDMP ;Empty the buffer
;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
;Pause and wait for a linefeed
MOVEI T1,[BYTE (7)TEK.TX,TEK.AL,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,[BYTE (7) TEK.TX,TEK.AL,0] ;Set text mode
MOVX T2,TK.PLO ;Use other string for 4662 or 4663
TDNE T2,PLTTYP(P4)
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*
; * CALCULATE THE PLOT CHARACTERS TO ARRIVE AT IX,IY
; * ORDER IS HIY, LSBYX, LOY, HIX, LOX
; KX=IX*KFACTR
; KY=IY*KFACTR
; IHIY =MOD(KY/128,32)+32
; LSBYX=MOD(KY,4)*4+MOD(KX,4)+96
; ILOY =MOD(KY/4,32)+96
; IHIX =MOD(KX/128,32)+32
; ILOX =MOD(KX/4,32)+64
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,4 ;Separate LSB
MOVEI T3,140(T2) ;Bits for LSB
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,4 ;Separate LSB
LSH T2,2 ;Shift over
IOR T3,T2 ;Combine the X-LSB
CAME T3,TEKLSB(P4) ;Same as last time?
HRROM T3,TEKLSB(P4) ;No, flag it
MOVX T2,TK.RES
TDNN T2,PLTTYP(P4) ;Output to hi-res terminal?
SETZM TEKLSB(P4) ;No, don't waste bytes on 4010
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
SKIPL TEKHIX(P4) ;If hi-X changed,
SKIPGE TEKLSB(P4) ; or if LSB will be output,
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
TXNE T1,SP.XHR ;Call to XHAIRS?
JRST TXHAIR ;Yes
;*; TXNE T1,SP.TTL ;Call to TITLE?
;*; JRST TEKTTL ;Yes
TXNN T1,SP.PEN ;Call to XHAIRS?
POPJ P, ;No
;Change pen color
TEKPEN: MOVX T2,TK.COL ;Can this device change colors?
TDNN T2,PLTTYP(P4)
POPJ P, ;No
MOVEI T1,[BYTE (7)ESC,"M","L",0]
PUSHJ P,OUTSTG ;Start of <Set-Line-Index> command
MOVE T1,C.NPEN ;Get caller's argument
CAIL T1,1 ;Within range of 1-16?
CAILE T1,^D16
SETOM SAVE0 ;No, return error
MOVM T0,T1 ;Watch out for negative numbers
IDIVI T0,^D16 ;Force T1 to be within range of 0 to 15
DPB T1,[POINTR CURR.P(P4),PN.COL] ;Save in case anyone cares
ADDI T1,"0" ;Convert to range of ASCII digits
PUSHJ P,OUTBYT ;Send the end of command
PJRST TEKPOS ;Reposition cursor and return
;Trigger the crosshairs
TXHAIR: TXNN P4,P4.TTY ;Output going to a TTY?
JRST [ERRSTR (MSG,<% XHAIRS works with Tektronix terminals only>)
PJRST TRACE] ;Trace back from PUSHJ P,%XHAIRS
TOPS10< ND KLUDGE,-1>
TOPS20< ND KLUDGE,0>
IFE KLUDGE,<
MOVEI T1,TEK.XH ;Command to trigger the crosshairs
MOVEI T2,TEMP ;Where to store the string
MOVNI T3,5 ;Read 5 chars regardless of what they are
PUSHJ P,RDTBIN ;Prompt and read TTY in binary mode
> ;End of IFE KLUDGE
IFN KLUDGE,<
if2,<printx % XHAIRS for TEKTRONIX is kludged up>
MOVEI T1,TEK.XH ;Display the crosshairs
PUSHJ P,OUTDMP ;Put in buffer
PUSHJ P,TTASCM ;Set TTY to ASCII mode
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 (NON,<^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
MOVEI T1,0 ;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
MOVX T2,TK.PLO ;But only if 4662 or 4663
TDNE T2,PLTTYP(P4)
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