5 * Revision 1.2 1996/04/18 16:10:34 mclareni
6 * Incorporate changes from J.Zoll for version 3.77
8 * Revision 1.1.1.1 1996/03/06 10:47:14 mclareni
12 #include "zebra/pilot.h"
15 C- ready memory occupation table for input
16 C- ready space for the relocation table
19 #include "zebra/zbcd.inc"
20 #include "zebra/zmach.inc"
21 #include "zebra/zunit.inc"
22 #include "zebra/mqsys.inc"
23 #include "zebra/eqlqf.inc"
24 #include "zebra/mzcn.inc"
25 #include "zebra/mzct.inc"
26 #include "zebra/fzci.inc"
27 #include "zebra/fzcseg.inc"
28 #include "zebra/fzcocc.inc"
29 C-------------- End CDE --------------
31 DIMENSION ITOSOR(20), ISORDV(20), ISORSP(20)
32 DIMENSION LSTAV(20), LENDV(20)
33 EQUIVALENCE (LSTAV(1),IQUEST(60)), (LENDV(1),IQUEST(80))
35 #if (defined(CERNLIB_QTRHOLL))&&(!defined(CERNLIB_A6M))
37 DATA NAMESR / 4HFZIM, 4HTB /
39 #if (defined(CERNLIB_QTRHOLL))&&(defined(CERNLIB_A6M))
40 DATA NAMESR / 6HFZIMTB /
42 #if !defined(CERNLIB_QTRHOLL)
44 PARAMETER (NAMESR = 'FZIMTB ')
47 #include "zebra/q_shiftl.inc"
48 #include "zebra/q_jbyt.inc"
50 C---- Input information
52 C- if NQSEG = 0 : read non-segmented
54 C- if NQSEG > 0 : read segmented according to :
55 C- IQSEGD segment selection table set by the user
56 C- IQ(LFISEG+1) copy of the segmentation table from the pilot
58 C---- Output information
60 C- The memory occupation table at LQ(LQMTA) ready for the material
64 C- LQ(LMT+3) = -NW words to be skipped
66 C- read : LQ(LMT) = JDIV
71 C- The space at LQ(LQTA) ready (and big enough) to receive
72 C- the relocation table.
74 C- The common /FZOCC/ indicates the amount of space IQOCSP(J)
75 C- reserved at the end/start of division IQOCDV(J) for J=1,NQOCC
76 C- and blocked by a dummy bank.
79 #include "zebra/qtrace.inc"
98 C-- Multiple segments, tidy division numbers
100 #if defined(CERNLIB_QDEBPRI)
101 IF (LOGLVI.GE.3) WRITE (IQLOG,9016) (J,
102 + IQSEGH(1,J),IQSEGH(2,J),IQSEGD(J),J=1,NQSEG)
103 9016 FORMAT (1X/' FZIMTB- Segment Selection Table as set by the user'
105 #if (defined(CERNLIB_QDEBPRI))&&(!defined(CERNLIB_HEX))
106 F/(10X,I2,1X,2A4,O23))
108 #if (defined(CERNLIB_QDEBPRI))&&(defined(CERNLIB_HEX))
109 F/(10X,I2,1X,2A4,Z17))
112 LFISEG = LQFI + JAUSEG
113 IF (3*NQSEG.NE.IQ(KQSP+LFISEG)) GO TO 715
114 LSPACE = KQSP + LFISEG + 2*NQSEG
118 IF (IXDIV) 22, 23, 24
119 22 IF (IXDIV.LT.-7) GO TO 714
120 ITOSOR(JS) = -IQ(LSPACE+JS)
126 24 JDIV = JBYT (IXDIV,1,26)
127 IF (JDIV.GT.20) GO TO 714
128 JSTO = JBYT (IXDIV,27,4)
130 IF (JSTO.NE.JQSTOR) GO TO 714
133 IF (JDIV.EQ.0) GO TO 23
134 IF (JDIV.GT.JQDVLL) THEN
135 IF (JDIV.LT.JQDVSY) GO TO 714
142 C---- Construct tables sorted by division number
144 C- ISOR table : one entry per segment
145 C- IQOC table : one entry per target division
152 C-- Find largest division number not yet done
160 IF (ITOSOR(JS).NE.0) GO TO 35
162 IF (JANX.EQ.0) JANX=JS
164 IF (JDIV.LE.JDVBIG) GO TO 35
168 IF (JDVBIG.EQ.0) GO TO 41
172 ISORDV(NSOR) = JDVBIG
173 ISORSP(NSOR) = IQ(LSPACE+JSBIG)
176 IQOCDV(NOCC) = JDVBIG
177 IQOCSP(NOCC) = IQ(LSPACE+JSBIG)
179 C-- Find further segments for the same division
181 IF (JSBIG.EQ.JENX) GO TO 31
182 DO 37 JS=JSBIG+1,JENX
183 IF (ITOSOR(JS).NE.0) GO TO 37
184 IF (IQSEGD(JS).NE.JDVBIG) GO TO 37
187 ISORDV(NSOR) = JDVBIG
188 ISORSP(NSOR) = IQ(LSPACE+JS)
189 IQOCSP(NOCC) = IQOCSP(NOCC) + IQ(LSPACE+JS)
193 C---- Reserve space in divisions
195 41 IF (NOCC.EQ.0) GO TO 81
198 JQDIVI = IQOCDV(JOCC)
202 IF (NQRESV.LT.0) CALL MZGAR1
206 IF (JQMODE.EQ.0) THEN
207 IQLN = LQEND(KQT+JQDIVI)
209 LQEND(KQT+JQDIVI) = IQNX
214 IQNX = LQSTA(KQT+JQDIVI)
216 LQSTA(KQT+JQDIVI) = IQLN
220 C-- Fill space reserved with dummy bank
226 LQ(KQS+IQLN+5) = IQLETT(1)
229 LQ(KQS+IQLN+8) = NW - 10
231 IF (JOCC.NE.NOCC) GO TO 42
233 C---- Allocate space for the relocation tables
235 46 NWTR = 2*NWTABI + 2
237 IF (NWTR+NWTM.LT.NQWKTB) THEN
238 C-- Both tables in the normal work area
244 IF (NQGAPN.EQ.0) GO TO 61
245 IF (IQGAP(1,1).LT.NWTR) THEN
246 C-- MO table in the (smaller) gap, LR table in area
247 IF (NQWKTB.LT.NWTR) GO TO 61
251 C-- MO table in area, LR table in (bigger) gap
259 LQTE = LQTA + 2*NWTABI
261 #if defined(CERNLIB_QDEVZE)
262 IF (LOGLVI.GE.4) WRITE (IQLOG,9141) LQMTA,LQMTE,LQTA,LQTE
263 9141 FORMAT (' FZIMTB- Tables : LQMTA,LQMTE,LQTA,LQTE=',4I9)
266 C---- Calculate start adrs on the sorted table
270 52 JQDIVI = ISORDV(JSOR)
272 IF (IQMODE(KQT+JQDIVI).EQ.0) THEN
273 LSTA = LQEND(KQT+JQDIVI) - IQOCSP(JOCC)
275 LSTA = LQSTA(KQT+JQDIVI)
278 LEND = LSTA + ISORSP(JSOR)
284 54 IF (JSOR.EQ.NSOR) GO TO 55
286 IF (ISORDV(JSOR).NE.JQDIVI) GO TO 52
288 LEND = LSTA + ISORSP(JSOR)
293 C---- Transfer the information from the sorted table
294 C- to the memory occupation table
300 IF (JSOR.GE.0) GO TO 57
309 #if defined(CERNLIB_QDEBPRI)
310 IF (LOGLVI.GE.3) WRITE (IQLOG,9055) JS, -JSOR
311 9055 FORMAT (' FZIMTB- skip segment',I3,I9,' WORDS')
315 57 LQ(LMT) = ISORDV(JSOR)
318 LQ(LMT+3) = LSTAV(JSOR)
319 LQ(LMT+4) = LENDV(JSOR)
323 #if defined(CERNLIB_QDEBPRI)
324 IF (LOGLVI.GE.3) THEN
325 WRITE (IQLOG,9058) JS,LQ(LMT),LQ(LMT+3),LQ(LMT+4)
327 9058 FORMAT (' FZIMTB- read segment',I3,' into division/from/to'
331 #include "zebra/qtrace99.inc"
334 C------ Garbage collection to make room for the table
336 61 IF (IFLGAR.GE.2) GO TO 721
337 IXSTOR = ISHFTL (JQSTOR,26)
338 IF (IFLGAR.NE.0) GO TO 63
340 IXSTOR = MZIXCO (IXSTOR+21,22,23,24)
341 CALL MZGARB (IXSTOR, 0)
343 IF (JQSTOR.NE.0) GO TO 46
347 C-- Collect also the primary store
350 J = MZIXCO (21,22,23,24)
352 CALL MZSDIV (IXSTOR,-7)
355 C---- All segments to be skipped
359 #if defined(CERNLIB_QDEBPRI)
360 IF (LOGLVI.GE.3) WRITE (IQLOG,9081)
361 9081 FORMAT (' FZIMTB- skip all segments')
365 C-------------------------------------------------
367 C-------------------------------------------------
371 C- JERROR = 15 NQSEG has been changed by the user
374 IQUEST(15)= IQ(KQSP+LFISEG)
378 C- JERROR = 14 invalid division number in segment table
388 C---- Not enough space
390 C- JERROR = 21 not enough space
396 * ==================================================
397 #include "zebra/qcardl.inc"