Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-12 - 43,50547/pltlib/sprout/ptci.mac
There is 1 other file named ptci.mac in the archive. Click here to see a list.
TITLE	PTCI - Interface to PTC6

	S1=1
	S2=2
	T1=3
	T2=4
	T3=5
	T4=6
	J=14
	L=16
	P=17

	TTY=14
	CR=15
	SEARCH	UUOSYM

	ENTRY	PLOTS	;Initialize plotter
	ENTRY	PLOT	;Move the pen, CALL PLOT(X,Y,999) to end
	ENTRY	NEWPEN	;Change pen color
	ENTRY	PAUSEP	;Sleep for a while

PLOTS::	SETZM	XPOS
	SETZM	YPOS
	SETZM	XMAX
	MOVEI	S1,1
	MOVEM	S1,OLDCOL	;Using pen #1
	INIT	TTY,IO.SUP	;Turn off echo
	 SIXBIT	/TTY/
         0,,0
          HALT
	MOVEI	T2,TTY		;I/O channel number
	IONDX.	T2,		;Get UDX
	  HALT
	MOVEI	T1,.TONFC+.TOSET;Change CRLF setting
	MOVEI	T3,1		; to no free ones
	MOVE	S1,[3,,T1]
	TRMOP.	S1,		;SET TTY NO CRLF
	  JFCL

	MOVEI	T1,0		;Use CRLF handshaking
	MOVEM	T1,HANDSH
	MOVEI	J,J$$BEG
	PUSHJ	P,PTCINI##	;Init the controller
	JRST	PTCMV1		;Output the init string




PAUSEP::MOVE	T1,@0(L)	;Get number of seconds
	SLEEP	T1,
	POPJ	P,
PLOT::	MOVE	T3,@2(L)
	CAIN	T3,^D999
	 JRST	PLOT99		;Stop on CALL PLOT(X,Y,999)

	MOVE	T1,@0(L)
	FMPRI	T1,(400.0)	;400 steps per inch
	FIX	T1,T1		;Position in increments
	CAML	T1,XMAX		;Highest seen?
	 MOVEM	T1,XMAX		;Yes
	SUB	T1,XPOS
	ADDM	T1,XPOS

	MOVE	T2,@1(L)
	FMPRI	T2,(400.0)
	FIX	T2,T2
	SUB	T2,YPOS
	ADDM	T2,YPOS

PTCMV:	MOVEI	J,J$$BEG
	PUSHJ	P,PTCMOV##	;Call conversion routine
	JUMPE	T1,CPOPJ	;Return if buffer not ready
PTCMV1:	SETSTS	TTY,IO.SUP  ;*HACK* Make darn sure echo is OFF!
	OUTSTR	(T1)		;Output command to PTC-6
	SKIPE	HANDSH		;Nothing more if using XON/XOFF
	 POPJ	P,	
	OUTSTR	[ASCIZ /
{Delay /]
	IDIVI	S1,^D1500*4	;Increments per second
	PUSHJ	P,OUTDEC	;Type S1 in decimal
	OUTSTR	[ASCIZ / seconds}/]

GETRSP:	INCHRW	T2
	CAIN	T2,"2"
BUFERR:: HALT	.		;Buffer length error
	CAIE	T2,CR		;Wait for CR at end of response
	 JRST	GETRSP
	INCHRW	T2		;Get LF
CPOPJ:	POPJ	P,


OUTDEC:	IDIVI	S1,^D10
	HRLM	S2,(P)
	SKIPE	S1
	 PUSHJ	P,OUTDEC
	HLRZ	S1,(P)
	ADDI	S1,"0"
	OUTCHR	S1
	POPJ	P,
;Finish up with plotter

PLOT99:	MOVEI	S2,1		;Reset to
	PUSHJ	P,NEWPN1	;Blue pen

	MOVE	T1,XMAX		;Highest X position
	SUB	T1,XPOS
	MOVN	T2,YPOS		;Move to Y=0
	MOVEI	T3,3		;Raise the pen
	MOVEI	J,J$$BEG
	PUSHJ	P,PTCMOV##
	SKIPE	T1
	 OUTSTR	(T1)

	MOVEI	J,J$$BEG
	PUSHJ	P,PTCOUT##	;Dump last buffer
	PUSHJ	P,PTCMV1	;Wait for CR
	MOVEI	J,J$$BEG
	PUSHJ	P,PTCFIN##	;Finish up
	OUTSTR	(T1)		;Output but don't wait

	RELEAS	TTY,		;Restore echo
	POPJ	P,

;Change pens

NEWPEN::MOVE	S2,@0(L)	;Get argument
NEWPN1:	PUSH	P,S2

	MOVEI	J,J$$BEG
	PUSHJ	P,PTCPEN##	;Change pen color

	POP	P,T1		;Get arg again
	MOVE	T2,T1		;Copy new pen number
	SUB	T2,OLDCOL	;Difference in pen numbers
	MOVEM	T1,OLDCOL	;Set new color
	JUMPE	T2,CPOPJ	;No shift if same pen
	MOVEI	T1,0		;No X offset
	IMULI	T2,^D400	;400 per inch
	MOVEI	T3,3		;Pen up
	JRST	PTCMV		;Go there

%OUTST::OUTSTR	(1)
	POPJ	P,

HANDSH:	0
XPOS:	0
YPOS:	0
XMAX:	0
OLDCOL:	1
J$$BEG:	BLOCK	1000
J$$END==:2


	END