Trailing-Edge
-
PDP-10 Archives
-
decuslib10-12
-
43,50547/pltlib/v12/pltrgs.mac
There are 2 other files named pltrgs.mac in the archive. Click here to see a list.
SUBTTL ReGIS for GIGI, VT125, and DMP4R
; These routines drive the GIGI, VT125, and any other device that
; handles the Remote Graphics Instruction Set. Only the P and V
; commands are used by subroutine PLOT.
; ReGIS commands used by these routines:
;Initialization commands:
; S(I0,N0,A) = Screen: Intensity 0, Negative video off, Addressing normal
; W(V,A0,S0,M1,N0,P1(M2)) = Writing: oVerlay, no Alternating, Shading off,
; direction Multiplier 1, Negate off, Pattern 1 (pattern Multiplier 2)
; T(I0,A0,D0,S1) = Text: Italics off, Alphabet 0, Direction 0, Size 1
;Normal commands:
; S(E) Screen: Erase
; W(I(C)) Write with cyan (light Blue for pen 1)
; W(I(W)) Write with white (negative Black for pen 2)
; W(I(M)) Write with magenta (purple Red for pen 3)
; P[x,y] Position the graphics cursor (move with pen up)
; Pddd Position one pixel in the specified direction for each digit
; V[x,y] Draw a vector from current position to new position
; Vddd Draw one pixel moving in the specified direction
; V[] Put a dot at current position (needed because the V[x,y] does
; not draw current pixel, in case of W(C) complement mode.)
SUBTTL Revision History for PLTRGS.MAC
;Edit Date Who Description
;---- --------- --- ----------------------------------------------------
; 501 26-Jul-82 JMS Add ReGIS output for VT125 and GIGI terminals.
;
; 511 27-Oct-82 JMS Do orthoganal or diagonal moves up to 8 pixels by
; sending only digits to the GIGI.
; (PLTRGS)
;
;End of Revision History for PLTRGS
SUBTTL PPDATA macro expansion
DEFINE INVALID(Z),<;;Force output of [123,456] instead of [,]
HRROS Z>
RGSBYT==INSVL.(^D07,IN.BYT)!INSVL.(.IOASC,IN.MOD) ;Normal ASCII output
RGSFLG==SP.PEN!SP.CLR!SP.XHR!SP.TTL ;NEWPEN, ERASE, XHAIRS, TITLE
RGSINC==64.0 ;Increments per inch (768 pixels / 12.0 inches)
RGSMAX==^D767,,^D479 ;Max X and Y increments
RGSTYP==P4.TTY ;This is a graphics terminal
RGSEXT==SIXBIT/PIC/ ;Output extension
DEFINE LCDATA,<
XBLOCK (RGSXHR,1) ;Last position of crosshairs, X,,Y
> ;End of DEFINE LCDATA
PPDATA (RGS) ;Expand data area
SUBTTL Database
;Special character strings
GON$: BYTE (7) ESC,"P","p",0 ;Enables ReGIS processor (graphics on)
GOFF$: BYTE (7) ESC,"\",0 ;Graphics off (text cursor at random position)
HGON$E: BYTE (7) ESC,"[","H",ESC,"P","p","S","(","E",")",0 ;Home, GON$, erase
RGSLN1: BYTE (7) ESC,"[","H",CR,0 ;Text cursor to line 1 column 1
RGSL23: BYTE (7) ESC,"[","2","3",";","1","H",CR,0 ;Text cursor to line 23
;List of names for ReGIS terminals
RGSNAM: DEC 4 ;Data for PLOTS - IPLT = 4 for subroutine WHERE
ASCII /REGIS/
ASCII /GIGI/
ASCII /VT125/
ASCII /VK100/
ASCII /DMP4R/ ;Houston Instruments (8.5 by 11)
ASCII /DMP7R/ ;Houston Instruments (11 by 16)
DEC 125 ;VT125
RGSLEN==.-RGSNAM
SUBTTL INItialize, FINish
;Routine to initialize the GIGI graphics terminal
RGSINI: TXNN P4,P4.TTY ;Output going to a TTY?
PJRST RGSCL1 ;No, do not send GON$+"S(E)"
PFALL RGSCLR ;Yes, clear the screen
;Routine to clear the screen
RGSCLR: MOVEI T1,HGON$E ;Put text cursor at home, GON$+"S(E)"
PUSHJ P,OUTDMP ;Turn on ReGIS and clear the screen
MOVEI T1,^D250 ;1/4 second
TXNE P4,P4.TTY ;If going to TTY (instead of a disk file)
PUSHJ P,TOWAIT ;Wait that amount after output is finished
RGSCL1: SETZB X,Y ;Clear coordinates
MOVE T1,[^D384,,^D240];Set old cross-hair position
MOVEM T1,RGSXHR(P4) ; to middle of screen
MOVX T1,INSVL.(6,PN.COL) ;6 = Yellow (negative blue)
MOVEM T1,CURR.P(P4) ;Set color, pen up
MOVEI T1,[ASCIZ /;S(I0,N0,A) W(V,I6,A0,S0,M1,N0,P1(M2))
T(I0,A0,D0,S1) P[0,480]/] ;Initialize ReGIS, position to (0,0)
PJRST OUTSTG ;Set up terminal
;Finish plot by resetting to text mode at lower left corner
RGSFIN: TXNN P4,P4.TTY ;Going to terminal?
POPJ P, ;No, do not put ESCapes in disk file
MOVEI T1,RGSLN1 ;Position to line 1
PJRST OUTDMP
SUBTTL RGSPAS - Pause, plot-on, or plot-off
;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
RGSPAS: TXNN P4,P4.TTY ;Output going to a TTY
POPJ P, ;No, cannot pause
JUMPE T1,RGSOFF ;Turn off graphics if 0
JUMPG T1,RGSON ;Resume graphics if +1
MOVEI T1,[BYTE (7) ESC,"[","H",7,0] ;Text mode, bell
PUSHJ P,OUTDMP ;Output it
PUSHJ P,INCHR ;Input a character
CAIN T1,CR ;Carriage return?
PUSHJ P,INCHR ;Yes, must get LF since ReGIS uses ASCII mode
PFALL RGSON ;Turn on graphics and go to old position
;Routine to resume plotting
RGSON: MOVEI T1,GON$ ;Point to Graphics-ON-string
PUSHJ P,OUTSTG ;Send it
PFALL RGSPOS ;Go back to previous position
;Routine to put graphics cursor back at last known position
RGSPOS: PUSH P,X ;Preserve ACs X and Y across call
PUSH P,Y
DMOVE X,CURR.X(P4) ;Get old position
INVALID CURR.X(P4) ;Force output of full coordinates
INVALID CURR.Y(P4)
MOVEI T1,0 ;With pen up
PUSHJ P,RGSMOV ;Go to that position
POP P,Y
POP P,X
POPJ P,
RGSOFF: MOVEI T1,GOFF$ ;Set text mode (text cursor in random position)
PJRST OUTDMP ;Tell terminal to turn off graphics
SUBTTL RGSMOV - Move to beam to new position
;Routine to move graphics cursor
; Calling sequence:
; DMOVE X,(position in increments)
; SETO T1, ;-1 for pen down, 0 for pen up
; PUSHJ P,RGSMOV
; *return*
RGSMOV: MOVE T2,CURR.P(P4) ;Get current pen status
JUMPE T1,[MOVEI T1,"P" ;T1=0 means to position
PUSHJ P,OUTBYT ; with pen up
TXZ T2,PN.DWN!PN.FL1
JRST RGSMV1 ] ;Clear the pen down flags
MOVEI T1,[ASCIZ /V[]/];"V" to draw a vector
TXON T2,PN.FL1 ;Was previous command a "V"?
PUSHJ P,OUTSTG ;No, must start a new one
TXO T2,PN.DWN ;Pen is now down
RGSMV1: MOVEM T2,CURR.P(P4) ;Store flags
DMOVE T1,X ;Get new coordinates
SUB T1,CURR.X(P4) ;Find delta distance
SUB T2,CURR.Y(P4) ; ...
MOVM T3,T1 ;Absolute value
MOVM T4,T2
CAIG T3,^D8 ;More than 8 pixels away?
CAILE T4,^D8
JRST RGSMV2 ;Yes, fewer characters in "[,]" form
JUMPE T1,RGSMVV ;Check for vertical
JUMPE T2,RGSMVH ; or horizontal movement
CAME T3,T4 ;+45 or -45 degrees?
JRST RGSMV2 ;No, do it the long way
;Here for a diagonal move of 1 to 8 pixels
SKIPG T1 ;Plus X direction?
SKIPA T4,["5",,"3"] ;No, get the 2 -X movers
MOVE T4,["7",,"1"] ;Yes, get the 2 +X movers
SKIPG T2 ;Plus Y direction?
MOVSS T4 ;No, get "5" or "7"
RGSMVD: HRRZ T1,T4 ;Get the move command
PUSHJ P,RGSOUT ;Move 1 pixel
SOJG T3,RGSMVD ;Do up to 8 of them
DMOVEM X,CURR.X(P4) ;Store new position
POPJ P,
;Here for a horizontal move of 1 to 8 pixels
RGSMVH: MOVEI T4,"0" ;+X
SKIPG T1 ;True?
MOVEI T4,"4" ;-X
JRST RGSMVD
PAGE
;Here for a vertical move of 1 to 8 pixels
RGSMVV: JUMPE T2,CPOPJ ;Output nothing if no movement
MOVE T3,T4 ;Get vertical count
MOVEI T4,"2" ;+Y
SKIPG T2 ;True?
MOVEI T4,"6" ;-Y
JRST RGSMVD
;Here to move to a specific coordinate
RGSMV2: MOVEI T1,"[" ;Start of coordinate
PUSHJ P,OUTBYT
MOVE T1,X ;Get X position
CAME X,CURR.X(P4) ;Output nothing if at right position
PUSHJ P,OUTDEC ;Output decimal digits
MOVEI T1,"," ;Separator
PUSHJ P,OUTBYT
MOVEI T1,^D480 ;GIGI uses [0,0] as upper left
SUB T1,Y ;Top=+0, bottom = +480
CAME Y,CURR.Y(P4) ;Output nothing if at right position
PUSHJ P,OUTDEC ;Output translated Y position
DMOVEM X,CURR.X(P4) ;Store new position
MOVEI T1,"]" ;End of coordinate
PFALL RGSOUT ;Output it and possible CRLF
;Need to output CRLF after 72 so GED (Graphics Editor) can read disk file
RGSOUT: PUSHJ P,OUTBYT ;Output the last byte of this command
MOVE T1,BYTE.C(P4) ;Get the count of bytes since last CRLF
CAIG T1,^D70 ;Getting close to the end of a line?
POPJ P, ;Not time for CRLF yet
RGSCRL: MOVEI T1,CRLF ;Start a new line
PUSHJ P,OUTSTG
SETZM BYTE.C(P4) ;Reset byte count
POPJ P,
SUBTTL NEWPEN - Change pen colors
RGSSPC: TXNE T1,SP.CLR ;Is this a call to ERASE?
JRST RGSCLR ;Yes
TXNE T1,SP.XHR ;Call to XHAIRS?
JRST RXHAIR ;Yes
TXNE T1,SP.TTL ;Call to TITLE?
JRST RGSTTL ;Yes
TXNN T1,SP.PEN ;Call to NEWPEN?
POPJ P, ;No
; Change pen color
RGSPEN: MOVEI T1,[ASCIZ /W(I(/];Set writing intensity
PUSHJ P,OUTSTG
SKIPLE T1,C.NPEN ;Get caller's argument
CAILE T1,8 ;Within range?
MOVEI T1,1 ;No, set to default color
MOVE T1,RGSCOL-1(T1) ;Get translated color
DPB T1,[POINTR CURR.P(P4),PN.COL] ;Save in case anyone cares
PUSHJ P,OUTBYT ;Tell ReGIS
MOVX T1,PN.FL1 ;Get flag-1
ANDCAM T1,CURR.P(P4) ;Not in a V command
MOVEI T1,")" ;End of W command
PUSHJ P,OUTBYT ;Send 2 close parens
PJRST RGSOUT ;(the last one may need a CRLF after it)
RGSCOL: EXP 'C' ;Use Cyan (light Blue) for pen #1
EXP 'W' ; White (negative Black) for pen #2
EXP 'M' ; Magenta (purple-Red) for pen #3
EXP 'Y','G','R','B','D' ;Colors 4 through 8
SUBTTL TITLE - Plot text
;CALL TITLE(X,Y,HEIGHT,ICHAR,ANGLE,NUMCHR)
; 0 1 2 3 4 5
RGSTTL: MOVE X,@0(L) ;Get coordinates
MOVE Y,@1(L)
FADR Y,@2(L) ;Go to top of first letter (ONLY IF ANGLE=0)
PUSHJ P,MOVUP ;Go there (BYPASSING WINDOW CHECKS)
MOVEI T1,[ASCIZ /T(D/] ;Set ReGIS to text mode (must set direction
PUSHJ P,OUTSTG ; before size, else the letters are tilted)
IFE FTKA,<FIXR T1,@4(L) > ;Get the angle in degrees
IFN FTKA,<MOVE T1,@4(L) ;Get angle
PUSHJ P,IFX.1##> ;Integerize it
PUSHJ P,OUTDEC ;Output it
MOVEI T1,"S" ;Now for the size
PUSHJ P,OUTBYT
MOVE Y,@2(L) ;Get the height
MOVEI X,0 ;Avoid unnecessary overflows
PUSHJ P,FP2INC ;Convert to increments
MOVEI T1,5(Y) ;Add 5 for rounding
IDIVI T1,^D10 ;Get the height number
PUSHJ P,OUTDEC ;Output as the size number (I know it's wrong)
PUSHJ P,RGSCRL ;Send a CRLF
MOVEI T2,@3(L) ;Get addr of string
HRLI T2,(POINT 7,) ;Make into byte pointer
MOVE T3,@5(L) ;Get byte count
RGSTT1: ILDB T1,T2
CAIN T1,"'" ;Embedded apostrophe?
PUSHJ P,OUTBYT ;Yes, send 2 in a row
PUSHJ P,OUTBYT ;Send the character
SOJG T3,RGSTT1 ;Loop for all
MOVEI T1,"'" ;Finish off the string
PUSHJ P,RGSOUT ;Send it (and possible CRLF)
PJRST RGSPOS ;Reset graphics cursor position
SUBTTL XHAIRS - allow the user the use the crosshairs
RXHAIR: SETZM @0(L) ;Clear X
SETZM @1(L) ;Clear Y
SETOM @2(L) ;Set LETTER to -1 in case of error
TXNN P4,P4.TTY ;Output going to a TTY?
JRST [ERRSTR (<% XHAIRS works with GIGI terminals only>)
PJRST TRACE.##] ;Trace back from PUSHJ P,%XHAIRS
PUSH P,CURR.X(P4) ;Preserve current pen position
PUSH P,CURR.Y(P4)
PUSHJ P,RGSPOS ;Make sure graphics cursor is really there
MOVEI T1,RXH.X ;Point to string
PUSHJ P,OUTSTG ;Make an hourglass at current pen position
HLRZ X,RGSXHR(P4) ;Act like the Tektronix and trigger
HRRZ Y,RGSXHR(P4) ; the crosshairs at their old position
MOVEI T1,0 ;Pen up
PUSHJ P,RGSMOV ;Go there
POP P,CURR.Y(P4) ;Restore last known position
POP P,CURR.X(P4)
MOVEI T1,[ASCIZ /R(P(I))/] ;Report Position Interactive
kludge==-1
ife kludge,< MOVE T2,[^D10,,CR] ;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
MOVE T2,BLANKS ;5 spaces
MOVEM T2,0(T1) ;Clear the string
MOVEM T2,1(T1)
SETZB X,Y ;Clear position
;Read in 10 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
CAIN T1,3 ;Control-C as first character?
JRST RXHARC ;Yes, abort
PUSHJ P,INCHR ;Get "["
CAIN T1,3 ;Control-C as second character?
JRST RXHARC ;Yes, abort
RXHARX: PUSHJ P,INCHR ;Get a digit of X
CAIN T1,"," ;End of number?
JRST RXHARY ;Yes
IMULI X,^D10 ;Shift accumulated number
ADDI X,-"0"(T1) ;Add in new digit
JRST RXHARX ;Loop
RXHARY: PUSHJ P,INCHR ;Get a digit of Y
CAIN T1,"]" ;End of number?
JRST RXHAR1 ;Yes
IMULI Y,^D10 ;Shift
ADDI Y,-"0"(T1) ;Add
JRST RXHARY
RXHAR1: PUSHJ P,INCHR ;Get CR
> ;end of ifn kludge
RXHAR2: MOVE T1,@2(L) ;Get first character
CAIN T1,3 ;Control-C?
JRST RXHARC ;Yes
MOVNS Y ;Translate Y coord
ADDI Y,^D480 ; to normal
RXHARD: HRLM X,RGSXHR(P4) ;Remember position
HRRM Y,RGSXHR(P4) ; of crosshairs
PUSHJ P,OPNFIL ;Set up output again
PUSHJ P,RGSPOS ;Return cursor to previous pen position
PUSHJ P,RXHAR3 ;Return data to caller
JUMPE T1,RGSCLR ;Formfeed, erase the screen
MOVEI T1,RXH.X ;Point to string
PJRST OUTSTG ;Undo the hourglass
RXHARC: MOVEI T1,[BYTE(7)ESC,"\","^","C",7,0] ;GOFF$+"^C"+beep
PUSHJ P,OUTDMP ;Show that Control-C was noticed
ERRSTR (<^C>) ;Send to controlling terminal also
MONRT. ;Quiet exit to monitor level
MOVEI T1,GON$ ;Send graphics-on-string
PUSHJ P,OUTSTG ; to resume plotting
JRST RXHARD ;Allow ".CONTINUE" (X and Y are 0)
RXH.X: ASCIZ /V(W(C,I))[+10,-10][-20][+20,+20][-20][+10,-10]/
;Vector, Write(Complement,no Intensity), draw an "X" with crossbars
LITRGS: LIT
PAGE ;End of PLTRGS.MAC