A large commit.
[pdp8.git] / sw / rescue / lab8e_goettingen / disk2_11 / rkb / paroff / plot.ra
1 /
2 / F4 LIBRARY P L O T . R A
3 /
4 / PLOT.RA RELEASE 22-MAY-74 ON S8-LFTNA-C-VAV
5 /
6 / UPDATES:
7 /
8 / CLRPLT: INSERTS THE DISPLY TASK ONLY ONCE INTO THE IDLE QUEUE.
9 / 11-SEP-80 HA
10 /
11 /
12 / CLRPLT: THERE IS AN OPTIONAL THIRD PARAMETER. IT SPECIFIES THE NUMBER
13 / OF (X,Y) POINTS ALREADY PRESENT IN THE BUFFER TO BE DISPLAYED.
14 / EACH (X,Y) PAIR CONSITS OF TWO SIGNED 10 BIT INTEGERS STORED IN ONE
15 / WORD EACH.
16 /
17 / EXAMPLE: CALL CLRPLT (BUFFER,LENGTH)
18 / CALL CLRPLT (SAMPLE,LENGHT,SAMCNT) DISPLAYES SAMCNT POINTS
19 /
20 / 11-SEP-80 HA
21 /
22 /
23 LINC=6141
24 PDP=2
25 DIS=140
26 COMMZ #PAGE0 /STANDARD PAGE 0
27 ORG 17
28 0 /ALPHA REG FOR PDP-12
29 ENTRY #DISP /THIS IS SO #PAGE0 CAN BE LOADED
30 #DISP,
31 DISPLY, 0
32 TAD BUFADR+2 /GET BUFFER ADDRESS
33 DCA BUFADR
34 TAD DBFLD /SET UP CHANGABLE CDF
35 DCA FLDDB
36 DBFLD, HLT /GO TO FIRST FIELD OF BUFFER
37 TAD PLTXR+4 /NUMBER OF POINTS
38 CMA
39 DCA NPTS /NEGATED
40 JMP ENDDL /BEGIN DISPLAY
41 DSPLUP, /START OF DISPLAY LOOP
42 IFSW 8 <
43 TAD% BUFADR /GET X VALUE
44 6053 /LOAD X DISPLACEMENT
45 CLA
46 ISZ BUFADR /BUMP ADDRESS
47 SKP CLA
48 JMS BUMPF /BUMP FIELD
49 TAD% BUFADR
50 6054 /LOAD Y DISPLACEMENT
51 CLA
52 ISZ BUFADR /INCR ADDRESS
53 SKP CLA
54 JMS BUMPF /INCR FIELD
55 6052 /SKIP ON BEAM POSITIONED
56 JMP .-1
57 6055 /INTENSIFY POINT
58 >
59 IFNSW 8 <
60 TAD% BUFADR /GET X DISPLACEMENT
61 DCAZ 17 /INTO ALPHA REG
62 ISZ BUFADR /INCREMENT ADDRESS
63 SKP CLA
64 JMS BUMPF /INCREMENT DATA FIELD
65 TAD% BUFADR /GET Y DISPLACEMENT
66 CIF 10
67 LINC
68 DIS 17
69 PDP
70 CLA
71 ISZ BUFADR /INCR BUFFER POINTER
72 SKP CLA
73 JMS BUMPF
74 >
75 ENDDL, ISZ NPTS /INCREMENT COUNTER
76 JMP DSPLUP /LOOP
77 CDF 10
78 JMP% DISPLY /RETURN TO IDLE Q
79 BUMPF, 0 /FIELD CHANGER
80 TAD FLDDB /BUMP FIELD
81 TAD L10
82 DCA FLDDB
83 FLDDB, HLT /CHANGE IT NOW
84 JMP% BUMPF
85 PUTONQ, 0 /PUT DISPLY ONTO BACKROUND Q
86 TAD BUFADR+1 /CREATE CDF FOR DISPLAY LOOP
87 AND L7
88 CLL RAL
89 RTL
90 TAD FLD0
91 DCA DBFLD
92 IFSW 8 <
93 6050 /CLEAR DISPLAY LOGIC
94 >
95 CDF CIF
96 SKP
97 JMP% PUTONQ
98 DCA .-2 /ONCE ONLY
99 CIF CDF 10
100 JMS% ONQBX+1
101 ADDR DISPLY
102 CIF CDF
103 JMP% PUTONQ /CALLED VIA TRAP4
104 EXTERN ONQB
105 ONQBX, ADDR ONQB
106 BUFADR, 0
107 0
108 PLTXR, 0;0;0;-1;0;0
109 FLD0, CDF
110 L7, 7
111 L10, 10
112 NPTS, 0
113 \f SECT PLOT
114 JA #PLOT
115 NAME, TEXT +PLOT +
116 PLTBAS, 0;0;0
117 XLO,
118 X, 0;0;0
119 YLO,
120 Y, 0;0;0
121 XHI,
122 N, 0;0;0
123 YHI, 0;0;0
124 ADRBUF, 0;0;0
125 TEMP, 0;0;0
126 IFSW 8 <
127 YSCALE, F 1022.
128 YZERO, F 511.
129 ORG 10*3+PLTBAS
130 FNOP
131 JA NAME+3
132 0
133 PLTRET, JA .
134 XSCALE, F 786.
135 XZERO, F 511.
136 RANGE, F 1022.
137 BASE, F 511.>
138 IFNSW 8 <
139 YSCALE, F 510.
140 YZERO, F 255.
141 ORG 10*3+PLTBAS
142 FNOP
143 JA NAME+3
144 0
145 PLTRET, JA .
146 XSCALE, F 392.
147 XZERO, F 0.
148 RANGE, F 510.
149 BASE, F 255.>
150 L1P5, F 1.5
151 XYPAIR, 0;0;0
152 #PLOT, BASE PLTBAS
153 JSA SETUP
154 LDX 1,1
155 FLDA% PLTBAS,1 /GET ARG ADDRESSES
156 FSTA N
157 FLDA% PLTBAS,1+
158 FSTA X
159 FLDA% PLTBAS,1+
160 FSTA Y
161 STARTF
162 FLDA% N /NUMBER OF POINTS TO PLOT
163 FNEG
164 ATX 1 /INTO XR 1
165 LDX -1,2 /XR 2 IS THE INDEXER
166 PLTLUP, JXN PLOOP,3+ /ANY MORE ROOM IN PLOT BUFFER ?
167 LDX -1,3 /NO, FIX COUNT
168 JA PLTRET
169 PLOOP, FLDA% Y,2+ /GET Y VALUE
170 FMUL YSCALE /SCALE IT
171 FSUB YZERO /SUBTRACT LOWER LIMIT
172 ALN 0
173 FSTA XYPAIR
174 FLDA% X,2 /GET X VALUE OF PAIR
175 FMUL XSCALE /SCALE IT
176 FSUB XZERO /SUBTRACT LOWER LIMIT
177 ALN 0
178 STARTD
179 FSTA XYPAIR,0 /XYPAIR+1,+2 CONTAINS THE POINT
180 FLDA XYPAIR /STORE THIS DOUBLE WORD INTO PLOT BUFFER
181 FSTA% ADRBUF,4
182 ADDX 1,4 /TROUBLE IS, WE WANT POST INCREMENT
183 STARTF
184 JXN PLTLUP,1+ /LOOP IF MORE POINTS
185 JA PLTRET
186 BASE 0
187 SETUP, JA .
188 STARTD
189 FLDA 30 /GET RETURN ADDRESS
190 FSTA PLTRET
191 FLDA 0 /GET ARG POINTER
192 BASE PLTBAS
193 SETB PLTBAS
194 SETX PLTXR
195 FSTA PLTBAS
196 JA SETUP
197 \f SECT PLOTR
198 BASE PLTBAS
199 JSA SETUP
200 LDX 1,1
201 FLDA% PLTBAS,1 /GET ARG ADDRESSES
202 FSTA N
203 FLDA% PLTBAS,1+
204 FSTA X
205 FLDA% PLTBAS,1+
206 FSTA Y
207 FLDA% PLTBAS,1+
208 FSTA YHI
209 STARTF
210 FLDA% YHI
211 ATX 5
212 FLDA% N /NUMBER OF POINTS TO PLOT
213 FNEG
214 ATX 1 /INTO XR 1
215 LDX -1,2 /XR 2 IS THE INDEXER
216 PLOTRL, FLDA% Y,2+ /GET Y VALUE
217 FMUL YSCALE /SCALE IT
218 FSUB YZERO /SUBTRACT LOWER LIMIT
219 ALN 0
220 FSTA XYPAIR
221 FLDA% X,2 /GET X VALUE OF PAIR
222 FMUL XSCALE /SCALE IT
223 FSUB XZERO /SUBTRACT LOWER LIMIT
224 ALN 0
225 STARTD
226 FSTA XYPAIR,0 /XYPAIR+1,+2 CONTAINS THE POINT
227 FLDA XYPAIR /STORE THIS DOUBLE WORD INTO PLOT BUFFER
228 FSTA% ADRBUF,5
229 ADDX 1,5 /TROUBLE IS, WE WANT POST INCREMENT
230 STARTF
231 JXN PLOTRL,1+ /LOOP IF MORE POINTS
232 JA PLTRET
233 \f SECT CLRPLT
234 BASE PLTBAS
235 JSA SETUP
236 LDX 0,4 /DISABLE DISPLAY LOOP
237 LDX 1,1
238 FLDA% PLTBAS,1 /GET ARG POINTERS
239 FSTA N
240 FLDA% PLTBAS,1+
241 FSTA ADRBUF
242 FSTA BUFADR+1
243 STARTF
244 FLDA% N /SIZE OF BUFFER
245 FMUL L1P5 /NUMBER OF 2 WORD PAIRS
246 FNEG
247 ATX 3 /INTO SOME CHOICE XRS
248 STARTD
249 FLDA% PLTBAS,0 / LOAD RETURN ADR. --> FAC
250 FSUB PLTBAS / SUBTRACT PARAMETER LIST ADR.
251 FSUB LC6 / FAC=0 <==> TWO PARAM. ELSE FAC=2 <==> THREE PAR.
252 JEQ CTRP0 / CONTINUE AT CTRP0 IF THERE ARE TWO PARA. ONLY
253 FLDA% PLTBAS,1+ / LOAD ADR. OF THIRD PARAMETER
254 FSTA TEMP / LOAD CONTENTS OF THIRD PARAMETER
255 STARTF
256 FLDA% TEMP / NUMBER OF POINTS ALREADY TO DISPLAY
257 ATX 4 / INSERT IT INTO X4 THE WORD COUNT REGISTER
258 CTRP0,
259 STARTF
260 CTRP, TRAP4 PUTONQ /PUTISPLY ONTO IDLE Q
261 STARTD / BUT PUT DISPLY ONLY ONCE ONTO THE IDLE LOOP
262 FLDA LFNOP
263 FSTA CTRP / CLEAR TRAP4 INTO FNOP
264 STARTF
265 LFNOP, FNOP / TWO FNOP INSTRUCTION MUST FOLLOW HERE!
266 FNOP
267 CLRRET, JA PLTRET
268 LC6, 0;2
269 \f SECT SCALE /SET SCALING FACTORS
270 BASE PLTBAS
271 JSA SETUP
272 LDX 1,1
273 FLDA% PLTBAS,1 /GET ARGS
274 FSTA XLO
275 FLDA% PLTBAS,1+
276 FSTA YLO
277 FLDA% PLTBAS,1+
278 FSTA XHI
279 FLDA% PLTBAS,1+
280 FSTA YHI
281 STARTF
282 FLDA% XHI /COMPUTE X RANGE
283 FSUB% XLO
284 FSTA XHI
285 FLDA% YHI /NOW Y RANGE
286 FSUB% YLO
287 FSTA YHI
288 FLDA RANGE /COMPUTE XSCALE
289 FDIV XHI
290 FSTA XSCALE
291 FLDA RANGE /NOW Y SCALE
292 FDIV YHI
293 FSTA YSCALE
294 FLDA% XLO /COMPUTE XZERO
295 FMUL RANGE
296 FDIV XHI
297 IFSW 8 <
298 FADD BASE>
299 FSTA XZERO
300 FLDA% YLO /NOW YZERO
301 FMUL RANGE
302 FDIV YHI
303 FADD BASE
304 FSTA YZERO
305 SCLRET, JA PLTRET
306 END
307 \f\1a