/
/ VERSION 5A 4-27-77  PT
/
	LINC=6141
	PDP=2
	DIS=140
	COMMZ	#PAGE0		/STANDARD PAGE 0
	ORG	17
	0			/ALPHA REG FOR PDP-12
	ENTRY	#DISP		/THIS IS SO #PAGE0 CAN BE LOADED
#DISP,
DISPLY,	0
	TAD	BUFADR+2	/GET BUFFER ADDRESS
	DCA	BUFADR
	TAD	DBFLD		/SET UP CHANGABLE CDF
	DCA	FLDDB
DBFLD,	HLT			/GO TO FIRST FIELD OF BUFFER
	TAD	PLTXR+4		/NUMBER OF POINTS
	CMA
	DCA	NPTS		/NEGATED
	JMP	ENDDL		/BEGIN DISPLAY
DSPLUP,				/START OF DISPLAY LOOP
	IFSW	8 <
	TAD%	BUFADR		/GET X VALUE
	6053			/LOAD X DISPLACEMENT
	CLA
	ISZ	BUFADR		/BUMP ADDRESS
	SKP CLA
	JMS	BUMPF		/BUMP FIELD
	TAD%	BUFADR
	6054			/LOAD Y DISPLACEMENT
	CLA
	ISZ	BUFADR		/INCR ADDRESS
	SKP CLA
	JMS	BUMPF		/INCR FIELD
	6052			/SKIP ON BEAM POSITIONED
	JMP	.-1
	6055			/INTENSIFY POINT
	>
	IFNSW	8 <
	TAD%	BUFADR		/GET X DISPLACEMENT
	DCAZ	17		/INTO ALPHA REG
	ISZ	BUFADR		/INCREMENT ADDRESS
	SKP CLA
	JMS	BUMPF		/INCREMENT DATA FIELD
	TAD%	BUFADR		/GET Y DISPLACEMENT
	CIF 10
	LINC
	DIS	17
	PDP
	CLA
	ISZ	BUFADR		/INCR BUFFER POINTER
	SKP CLA
	JMS	BUMPF
	>
ENDDL,	ISZ	NPTS		/INCREMENT COUNTER
	JMP	DSPLUP		/LOOP
	CDF	10
	JMP%	DISPLY		/RETURN TO IDLE Q
BUMPF,	0			/FIELD CHANGER
	TAD	FLDDB		/BUMP FIELD
	TAD	L10
	DCA	FLDDB
FLDDB,	HLT			/CHANGE IT NOW
	JMP%	BUMPF
PUTONQ,	0			/PUT DISPLY ONTO BACKROUND Q
	TAD	BUFADR+1	/CREATE CDF FOR DISPLAY LOOP
	AND	L7
	CLL RAL
	RTL
	TAD	FLD0
	DCA	DBFLD
	IFSW	8 <
	6050			/CLEAR DISPLAY LOGIC
	>
	CDF CIF
	SKP
	JMP%	PUTONQ
	DCA	.-2		/ONCE ONLY
	CIF CDF 10
	JMS%	ONQBX+1
	ADDR	DISPLY
	CIF CDF
	JMP%	PUTONQ		/CALLED VIA TRAP4
	EXTERN	ONQB
ONQBX,	ADDR	ONQB
BUFADR,	0
	0
PLTXR,	0;0;0;-1;0;0
FLD0,	CDF
L7,	7
L10,	10
NPTS,	0
	SECT	PLOT
	JA	#PLOT
NAME,	TEXT	+PLOT  +
PLTBAS,	0;0;0
XLO,
X,	0;0;0
YLO,
Y,	0;0;0
XHI,
N,	0;0;0
YHI,	0;0;0
ADRBUF,	0;0;0
	IFSW	8 <
YSCALE,	F	1022.
YZERO,	F	511.
	ORG	10*3+PLTBAS
	FNOP
	JA	NAME+3
	0
PLTRET,	JA	.
XSCALE,	F	786.
XZERO,	F	511.
RANGE,	F	1022.
BASE,	F	511.>
	IFNSW	8 <
YSCALE,	F	510.
YZERO,	F	255.
	ORG	10*3+PLTBAS
	FNOP
	JA	NAME+3
	0
PLTRET,	JA	.
XSCALE,	F	392.
XZERO,	F	0.
RANGE,	F	510.
BASE,	F	255.>
L1P5,	F	1.5
XYPAIR,	0;0;0
#PLOT,	BASE	PLTBAS
	JSA	SETUP
	LDX	1,1
	FLDA%	PLTBAS,1	/GET ARG ADDRESSES
	FSTA	N
	FLDA%	PLTBAS,1+
	FSTA	X
	FLDA%	PLTBAS,1+
	FSTA	Y
	STARTF
	FLDA%	N		/NUMBER OF POINTS TO PLOT
	FNEG
	ATX	1		/INTO XR 1
	LDX	-1,2		/XR 2 IS THE INDEXER
PLTLUP,	JXN	PLOOP,3+	/ANY MORE ROOM IN PLOT BUFFER ?
	LDX	-1,3		/NO, FIX COUNT
	JA	PLTRET
PLOOP,	FLDA%	Y,2+		/GET Y VALUE
	FMUL	YSCALE		/SCALE IT
	FSUB	YZERO		/SUBTRACT LOWER LIMIT
	ALN	0
	FSTA	XYPAIR
	FLDA%	X,2		/GET X VALUE OF PAIR
	FMUL	XSCALE		/SCALE IT
	FSUB	XZERO		/SUBTRACT LOWER LIMIT
	ALN	0
	STARTD
	FSTA	XYPAIR,0	/XYPAIR+1,+2 CONTAINS THE POINT
	FLDA	XYPAIR		/STORE THIS DOUBLE WORD INTO PLOT BUFFER
	FSTA%	ADRBUF,4
	ADDX	1,4		/TROUBLE IS, WE WANT POST INCREMENT
	STARTF
	JXN	PLTLUP,1+	/LOOP IF MORE POINTS
	JA	PLTRET
	BASE	0
SETUP,	JA	.
	STARTD
	FLDA	30		/GET RETURN ADDRESS
	FSTA	PLTRET
	FLDA	0		/GET ARG POINTER
	BASE	PLTBAS
	SETB	PLTBAS
	SETX	PLTXR
	FSTA	PLTBAS
	JA	SETUP
	SECT	PLOTR
	BASE	PLTBAS
	JSA	SETUP
	LDX	1,1
	FLDA%	PLTBAS,1	/GET ARG ADDRESSES
	FSTA	N
	FLDA%	PLTBAS,1+
	FSTA	X
	FLDA%	PLTBAS,1+
	FSTA	Y
	FLDA%	PLTBAS,1+
	FSTA	YHI
	STARTF
	FLDA%	YHI
	ATX	5
	FLDA%	N		/NUMBER OF POINTS TO PLOT
	FNEG
	ATX	1		/INTO XR 1
	LDX	-1,2		/XR 2 IS THE INDEXER
PLOTRL,	FLDA%	Y,2+		/GET Y VALUE
	FMUL	YSCALE		/SCALE IT
	FSUB	YZERO		/SUBTRACT LOWER LIMIT
	ALN	0
	FSTA	XYPAIR
	FLDA%	X,2		/GET X VALUE OF PAIR
	FMUL	XSCALE		/SCALE IT
	FSUB	XZERO		/SUBTRACT LOWER LIMIT
	ALN	0
	STARTD
	FSTA	XYPAIR,0	/XYPAIR+1,+2 CONTAINS THE POINT
	FLDA	XYPAIR		/STORE THIS DOUBLE WORD INTO PLOT BUFFER
	FSTA%	ADRBUF,5
	ADDX	1,5		/TROUBLE IS, WE WANT POST INCREMENT
	STARTF
	JXN	PLOTRL,1+	/LOOP IF MORE POINTS
	JA	PLTRET
	SECT	CLRPLT
	BASE	PLTBAS
	JSA	SETUP
	LDX	0,4		/DISABLE DISPLAY LOOP
	LDX	1,1
	FLDA%	PLTBAS,1	/GET ARG POINTERS
	FSTA	N
	FLDA%	PLTBAS,1+
	FSTA	ADRBUF
	FSTA	BUFADR+1
	STARTF
	FLDA%	N		/SIZE OF BUFFER
	FMUL	L1P5		/NUMBER OF 2 WORD PAIRS
	FNEG
	ATX	3		/INTO SOME CHOICE XRS
	TRAP4	PUTONQ		/PUTISPLY ONTO IDLE Q
CLRRET,	JA	PLTRET
	SECT	SCALE		/SET SCALING FACTORS
	BASE	PLTBAS
	JSA	SETUP
	LDX	1,1
	FLDA%	PLTBAS,1	/GET ARGS
	FSTA	XLO
	FLDA%	PLTBAS,1+
	FSTA	YLO
	FLDA%	PLTBAS,1+
	FSTA	XHI
	FLDA%	PLTBAS,1+
	FSTA	YHI
	STARTF
	FLDA%	XHI		/COMPUTE X RANGE
	FSUB%	XLO
	FSTA	XHI
	FLDA%	YHI		/NOW Y RANGE
	FSUB%	YLO
	FSTA	YHI
	FLDA	RANGE		/COMPUTE XSCALE
	FDIV	XHI
	FSTA	XSCALE
	FLDA	RANGE		/NOW Y SCALE
	FDIV	YHI
	FSTA	YSCALE
	FLDA%	XLO		/COMPUTE XZERO
	FMUL	RANGE
	FDIV	XHI
	IFSW	8 <
	FADD	BASE>
	FSTA	XZERO
	FLDA%	YLO		/NOW YZERO
	FMUL	RANGE
	FDIV	YHI
	FADD	BASE
	FSTA	YZERO
SCLRET,	JA	PLTRET
	END
